code
stringlengths
87
55.2k
code_codestyle
int64
0
349
style_context
stringlengths
135
49.1k
style_context_codestyle
int64
0
349
label
int64
0
1
"""simple docstring""" import os import socket from contextlib import contextmanager import torch from ..commands.config.default import write_basic_config # noqa: F401 from ..state import PartialState from .dataclasses import DistributedType from .imports import is_deepspeed_available, is_tpu_available from .t...
61
'''simple docstring''' import operator as op def lowerCamelCase ( UpperCAmelCase__ : Optional[Any] ) -> int: lowercase_ : Optional[Any] = [] lowercase_ : str = lambda UpperCAmelCase__ , UpperCAmelCase__ : int(x / y ) ...
239
0
from typing import Any, Dict, List, Optional, Tuple, Union import torch from torch import nn from torch.utils.data import DistributedSampler, RandomSampler from transformers import PreTrainedModel, Trainer, logging from transformers.integrations import is_fairscale_available from transformers.models.fsmt.configurat...
275
'''simple docstring''' import math import unittest def lowerCamelCase ( UpperCAmelCase__ : int ) -> bool: assert isinstance(UpperCAmelCase__ , UpperCAmelCase__ ) and ( number >= 0 ), "'number' must been an int and positive" if 1 < number < ...
239
0
from typing import TYPE_CHECKING from ...utils import ( OptionalDependencyNotAvailable, _LazyModule, is_flax_available, is_torch_available, is_vision_available, ) _A : List[Any] = {"configuration_beit": ["BEIT_PRETRAINED_CONFIG_ARCHIVE_MAP", "BeitConfig", "BeitOnnxConfig"]} try: ...
142
'''simple docstring''' import baseaa import io import json import os from copy import deepcopy from ..optimizer import AcceleratedOptimizer from ..scheduler import AcceleratedScheduler class __magic_name__ : def __init__( self : str , lowercase_ : Dict ): if isinst...
239
0
import math import unittest def _a ( SCREAMING_SNAKE_CASE_ : int ): assert isinstance(UpperCAmelCase__ , UpperCAmelCase__ ) and ( number >= 0 ), "'number' must been an int and positive" if 1 < number < 4: # 2 and 3 are primes ...
92
'''simple docstring''' import gc import inspect import unittest import torch from parameterized import parameterized from diffusers import PriorTransformer from diffusers.utils import floats_tensor, slow, torch_all_close, torch_device from diffusers.utils.testing_utils import enable_full_determinism from .test_m...
239
0
'''simple docstring''' def lowerCAmelCase_ ( _lowerCamelCase: list , _lowerCamelCase: int = 0 ): __SCREAMING_SNAKE_CASE : Union[str, Any] = length or len(UpperCAmelCase__ ) __SCREAMING_SNAKE_CASE : Optional[int] = False for i in range(length...
112
'''simple docstring''' from collections import defaultdict def lowerCamelCase ( UpperCAmelCase__ : str , UpperCAmelCase__ : str ) -> bool: lowercase_ : Tuple = first_str.lower().strip() lowercase_ : List[Any] = ...
239
0
import argparse from collections import OrderedDict from pathlib import Path import torch from huggingface_hub import hf_hub_download from PIL import Image from torchvision.transforms import functional as F from transformers import DetrImageProcessor, TableTransformerConfig, TableTransformerForObjectDetection from ...
154
'''simple docstring''' import os def lowerCamelCase ( UpperCAmelCase__ : str = "input.txt" ) -> int: with open(os.path.join(os.path.dirname(UpperCAmelCase__ ) , UpperCAmelCase__ ) ) as input_file: lowercase_ : str = [ ...
239
0
'''simple docstring''' from collections import OrderedDict from typing import Mapping from packaging import version from ...configuration_utils import PretrainedConfig from ...onnx import OnnxConfig from ...utils import logging _SCREAMING_SNAKE_CASE = logging.get_logger(__name__) _SCREAMING_S...
158
'''simple docstring''' import sacrebleu as scb from packaging import version from sacrebleu import TER import datasets _lowercase : List[str] = "\\n@inproceedings{snover-etal-2006-study,\n title = \"A Study of Translation Edit Rate with Targeted Human Annotation\",\n author = \"Snover, Matth...
239
0
import unittest import numpy as np from transformers.testing_utils import require_torch, require_vision from transformers.utils import is_torch_available, is_vision_available from ...test_image_processing_common import ImageProcessingSavingTestMixin, prepare_video_inputs if is_torch_available(): import t...
146
'''simple docstring''' def lowerCamelCase ( UpperCAmelCase__ : int , UpperCAmelCase__ : int ) -> bool: return numa ^ numa < 0 if __name__ == "__main__": import doctest doctest.testmod()
239
0
def lowerCAmelCase__(__snake_case = 10 ,__snake_case = 22 ) -> int: '''simple docstring''' lowerCamelCase__ = range(1 ,UpperCAmelCase__ ) lowerCamelCase__ = range(1 ,UpperCAmelCase__ ) return sum( 1 for power in powers for base in ...
209
'''simple docstring''' import os from shutil import copyfile from typing import List, Optional, Tuple from ...tokenization_utils import AddedToken from ...tokenization_utils_fast import PreTrainedTokenizerFast from ...utils import is_sentencepiece_available, logging if is_sentencepiece_available(): from .t...
239
0
"""simple docstring""" import unittest from transformers import AutoTokenizer, NystromformerConfig, is_torch_available from transformers.testing_utils import require_torch, slow, torch_device from ...test_configuration_common import ConfigTester from ...test_modeling_common import ModelTesterMixin, i...
335
'''simple docstring''' _lowercase : str = tuple[float, float, float] _lowercase : List[Any] = tuple[float, float, float] def lowerCamelCase ( UpperCAmelCase__ : Pointad , UpperCAmelCase__ : Pointad ) -> Vectorad: lowercase_ ...
239
0
"""simple docstring""" from typing import TYPE_CHECKING from ...utils import _LazyModule SCREAMING_SNAKE_CASE = {"processing_wav2vec2_with_lm": ["Wav2Vec2ProcessorWithLM"]} if TYPE_CHECKING: from .processing_wavaveca_with_lm import WavaVecaProcessorWithLM else: import sys SCREAM...
247
'''simple docstring''' def lowerCamelCase ( UpperCAmelCase__ : list ) -> list: if any(not isinstance(UpperCAmelCase__ , UpperCAmelCase__ ) or x < 0 for x in sequence ): raise TypeError("""Sequence must be list of non-negative integers""" ) for _ in ...
239
0
"""simple docstring""" import os from shutil import copyfile from typing import List, Optional, Tuple from ...tokenization_utils import AddedToken from ...tokenization_utils_fast import PreTrainedTokenizerFast from ...utils import is_sentencepiece_available, logging if is_sentencepiece_available(): from .t...
61
'''simple docstring''' from typing import TYPE_CHECKING from ....utils import OptionalDependencyNotAvailable, _LazyModule, is_torch_available _lowercase : Dict = {"configuration_mmbt": ["MMBTConfig"]} try: if not is_torch_available(): raise OptionalDependencyNotAvailable() excep...
239
0
def _lowercase ( lowercase__ ): return [ { 0: [1, 2], 1: [0, 2], 2: [0, 1, 3, 5], 3: [2, 4], 4: [3], 5: [2, 6, 8], 6: [5, 7], 7: [6, 8], 8: [5, 7], }, ...
275
'''simple docstring''' from itertools import product def lowerCamelCase ( UpperCAmelCase__ : int , UpperCAmelCase__ : int ) -> list[int]: lowercase_ : List[Any] = sides_number lowercase_ : Dict = max_face_nu...
239
0
import os import pytest from transformers.dynamic_module_utils import get_imports _A : str = "\nimport os\n" _A : List[str] = "\ndef foo():\n import os\n return False\n" _A : Optional[Any] = "\ndef foo():\n def bar():\n if True:\n import os\n r...
142
'''simple docstring''' import copy import os from typing import Union from ...configuration_utils import PretrainedConfig from ...utils import logging _lowercase : Optional[Any] = logging.get_logger(__name__) _lowercase : Tuple = { "BAAI/AltCLIP": "https://huggingface.co/BAAI/A...
239
0
from typing import Callable, Optional, Union from ...configuration_utils import PretrainedConfig from ...utils import logging UpperCamelCase__ = logging.get_logger(__name__) UpperCamelCase__ = { "microsoft/xprophetnet-large-wiki100-cased": ( "https://huggingface.co/microsoft/xprophe...
92
'''simple docstring''' import argparse import json import os import sys import tempfile import unittest from argparse import Namespace from dataclasses import dataclass, field from enum import Enum from pathlib import Path from typing import List, Literal, Optional import yaml from transformers import HfArgumentP...
239
0
'''simple docstring''' from typing import TYPE_CHECKING from ...utils import OptionalDependencyNotAvailable, _LazyModule, is_torch_available, is_vision_available UpperCamelCase__ : Tuple = { "configuration_bridgetower": [ "BRIDGETOWER_PRETRAINED_CONFIG_ARCHIVE_MAP", "BridgeTowerC...
112
'''simple docstring''' import faiss # noqa: F401 # Here to have a nice missing dependency error message early on import numpy # noqa: F401 # Here to have a nice missing dependency error message early on import requests # noqa: F401 # Here to have a nice missing dependency error message early on import sklearn #...
239
0
def __UpperCamelCase ( _A : str , _A : int ) ->list: """simple docstring""" lowerCamelCase_ =word.split() def justify(_A : list , _A : int , _A : int ) -> str: lowerCamelCase_ =max_width - width lowerCamelC...
154
'''simple docstring''' from __future__ import annotations import math import random from typing import Any class __magic_name__ : def __init__( self : Any ): lowercase_ : list[Any] = [] lowercase_ : int = 0 lower...
239
0
'''simple docstring''' def __a(SCREAMING_SNAKE_CASE_ : list[int] ): '''simple docstring''' if not numbers: return 0 if not isinstance(UpperCAmelCase__ , (list, tuple) ) or not all( isinstance(UpperCAmelCase__ , UpperCAmelCase__ ) for number in ...
158
'''simple docstring''' import math def lowerCamelCase ( UpperCAmelCase__ : int ) -> int: if not isinstance(UpperCAmelCase__ , UpperCAmelCase__ ): lowercase_ : List[Any] = F'''Input value of [number={number}] must be an integer''' ...
239
0
import torch from torch import nn from transformers import CLIPPreTrainedModel, CLIPVisionModel from ...models.attention import BasicTransformerBlock from ...utils import logging __UpperCamelCase : Dict = logging.get_logger(__name__) # pylint: disable=invalid-name class __magic_name__ ( _Uppe...
146
'''simple docstring''' import unittest from transformers import AutoTokenizer, NystromformerConfig, is_torch_available from transformers.testing_utils import require_torch, slow, torch_device from ...test_configuration_common import ConfigTester from ...test_modeling_common import ModelTesterMixin, ids_tensor, ra...
239
0
import pickle import shutil import tempfile import unittest from transformers import SPIECE_UNDERLINE, XLMRobertaTokenizer, XLMRobertaTokenizerFast from transformers.testing_utils import get_tests_dir, require_sentencepiece, require_tokenizers, slow from transformers.utils import cached_property from ...test_to...
209
'''simple docstring''' import unittest from transformers import load_tool from transformers.utils import is_torch_available if is_torch_available(): import torch from transformers.testing_utils import require_torch from .test_tools_common import ToolTesterMixin @require_torch class __magic_name_...
239
0
"""simple docstring""" import math class a : """simple docstring""" def UpperCamelCase ( self: int , UpperCamelCase: list[list[float]] , UpperCamelCase: list[int] ): """simple docstring""" A__ = 0....
335
'''simple docstring''' from urllib.parse import quote import pytest from datasets.utils.hub import hf_hub_url @pytest.mark.parametrize("""repo_id""" , ["""canonical_dataset_name""", """org-name/dataset-name"""] ) @pytest.mark.parametrize("""path""" , ["""filename.csv""", """filename with b...
239
0
"""simple docstring""" import collections import inspect import unittest from transformers import FocalNetConfig from transformers.testing_utils import require_torch, require_vision, slow, torch_device from transformers.utils import cached_property, is_torch_available, is_vision_available from ...test_backbon...
247
'''simple docstring''' # Copyright 2021 The HuggingFace Team. All rights reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # U...
239
0
"""simple docstring""" from collections import OrderedDict from typing import Any, Mapping, Optional, Union from ...configuration_utils import PretrainedConfig from ...feature_extraction_utils import FeatureExtractionMixin from ...onnx import OnnxConfig from ...onnx.utils import compute_effective_axis_dimension ...
61
'''simple docstring''' import operator as op def lowerCamelCase ( UpperCAmelCase__ : Optional[Any] ) -> int: lowercase_ : Optional[Any] = [] lowercase_ : str = lambda UpperCAmelCase__ , UpperCAmelCase__ : int(x / y ) ...
239
0
import inspect import unittest from transformers import ConvNextConfig from transformers.testing_utils import require_torch, require_vision, slow, torch_device from transformers.utils import cached_property, is_torch_available, is_vision_available from ...test_backbone_common import BackboneTesterMixin from ...test...
275
'''simple docstring''' import math import unittest def lowerCamelCase ( UpperCAmelCase__ : int ) -> bool: assert isinstance(UpperCAmelCase__ , UpperCAmelCase__ ) and ( number >= 0 ), "'number' must been an int and positive" if 1 < number < ...
239
0
from __future__ import annotations import numpy as np def _a ( UpperCAmelCase ) -> Union[str, Any]: """simple docstring""" return np.maximum(0 , UpperCAmelCase__ ) if __name__ == "__main__": print(np.array(relu([-1, 0, 5]))) # --> [0, 0, 5]
142
'''simple docstring''' import baseaa import io import json import os from copy import deepcopy from ..optimizer import AcceleratedOptimizer from ..scheduler import AcceleratedScheduler class __magic_name__ : def __init__( self : str , lowercase_ : Dict ): if isinst...
239
0
import math from dataclasses import dataclass from typing import Optional, Tuple, Union import numpy as np import torch from ..configuration_utils import ConfigMixin, register_to_config from ..utils import BaseOutput, randn_tensor from .scheduling_utils import SchedulerMixin @dataclass # Copied from diffusers.sc...
92
'''simple docstring''' import gc import inspect import unittest import torch from parameterized import parameterized from diffusers import PriorTransformer from diffusers.utils import floats_tensor, slow, torch_all_close, torch_device from diffusers.utils.testing_utils import enable_full_determinism from .test_m...
239
0
'''simple docstring''' import inspect import unittest from transformers import ViTConfig from transformers.testing_utils import ( require_accelerate, require_torch, require_torch_gpu, require_vision, slow, torch_device, ) from transformers.utils import cached_property, is_torch_availabl...
112
'''simple docstring''' from collections import defaultdict def lowerCamelCase ( UpperCAmelCase__ : str , UpperCAmelCase__ : str ) -> bool: lowercase_ : Tuple = first_str.lower().strip() lowercase_ : List[Any] = ...
239
0
from collections import defaultdict from typing import Optional from ..image_utils import load_image from ..utils import ( add_end_docstrings, is_torch_available, logging, requires_backends, ) from .base import PIPELINE_INIT_ARGS, ChunkPipeline if is_torch_available(): import torch from ..models...
154
'''simple docstring''' import os def lowerCamelCase ( UpperCAmelCase__ : str = "input.txt" ) -> int: with open(os.path.join(os.path.dirname(UpperCAmelCase__ ) , UpperCAmelCase__ ) ) as input_file: lowercase_ : str = [ ...
239
0
'''simple docstring''' def __a(SCREAMING_SNAKE_CASE_ : list ): '''simple docstring''' if len(UpperCAmelCase__ ) < 2: return collection def circle_sort_util(SCREAMING_SNAKE_CASE_ : list , SCREAMING_SNAKE_CASE_ : int , SCREAMING_SNAKE_CASE_ ...
158
'''simple docstring''' import sacrebleu as scb from packaging import version from sacrebleu import TER import datasets _lowercase : List[str] = "\\n@inproceedings{snover-etal-2006-study,\n title = \"A Study of Translation Edit Rate with Targeted Human Annotation\",\n author = \"Snover, Matth...
239
0
import os def _a ( SCREAMING_SNAKE_CASE : str = "input.txt" ): """simple docstring""" with open(os.path.join(os.path.dirname(UpperCAmelCase__ ) , UpperCAmelCase__ ) ) as input_file: UpperCamelCase__ : str = [ [int(UpperCAmelCase__ ) for element in line....
146
'''simple docstring''' def lowerCamelCase ( UpperCAmelCase__ : int , UpperCAmelCase__ : int ) -> bool: return numa ^ numa < 0 if __name__ == "__main__": import doctest doctest.testmod()
239
0
from collections import OrderedDict from typing import TYPE_CHECKING, Any, List, Mapping, Optional from packaging import version if TYPE_CHECKING: from ... import PreTrainedTokenizer, TensorType from ...configuration_utils import PretrainedConfig from ...onnx import OnnxConfigWithPast, PatchingSpec from .....
209
'''simple docstring''' import os from shutil import copyfile from typing import List, Optional, Tuple from ...tokenization_utils import AddedToken from ...tokenization_utils_fast import PreTrainedTokenizerFast from ...utils import is_sentencepiece_available, logging if is_sentencepiece_available(): from .t...
239
0
"""simple docstring""" import math import random def _snake_case ( UpperCAmelCase_ : float , UpperCAmelCase_ : bool = False ): if deriv: return value * (1 - value) return 1 / (1 + math.exp(-value )) # Initial Value SCREAMING_SNAKE_CASE...
335
'''simple docstring''' _lowercase : str = tuple[float, float, float] _lowercase : List[Any] = tuple[float, float, float] def lowerCamelCase ( UpperCAmelCase__ : Pointad , UpperCAmelCase__ : Pointad ) -> Vectorad: lowercase_ ...
239
0
"""simple docstring""" SCREAMING_SNAKE_CASE = { "meter": "m", "kilometer": "km", "megametre": "Mm", "gigametre": "Gm", "terametre": "Tm", "petametre": "Pm", "exametre": "Em", "zettametre": "Zm", "yottametre": "Ym", } # Exponent of the factor(meter) SCREAMING_SNAKE_CA...
247
'''simple docstring''' def lowerCamelCase ( UpperCAmelCase__ : list ) -> list: if any(not isinstance(UpperCAmelCase__ , UpperCAmelCase__ ) or x < 0 for x in sequence ): raise TypeError("""Sequence must be list of non-negative integers""" ) for _ in ...
239
0
"""simple docstring""" from typing import TYPE_CHECKING from ...utils import ( OptionalDependencyNotAvailable, _LazyModule, is_flax_available, is_tf_available, is_torch_available, ) _a = {"configuration_unispeech": ["UNISPEECH_PRETRAINED_CONFIG_ARCHIVE_MAP", "UniSpeechConfig"]...
61
'''simple docstring''' from typing import TYPE_CHECKING from ....utils import OptionalDependencyNotAvailable, _LazyModule, is_torch_available _lowercase : Dict = {"configuration_mmbt": ["MMBTConfig"]} try: if not is_torch_available(): raise OptionalDependencyNotAvailable() excep...
239
0
import baseaa def _lowercase ( lowercase__ ): return baseaa.aaaencode(string.encode('''utf-8''' ) ) def _lowercase ( lowercase__ ): return baseaa.aaadecode(UpperCAmelCase__ ).decode('''utf-8''' ) if __name__ == "__main__": import doctest doctest...
275
'''simple docstring''' from itertools import product def lowerCamelCase ( UpperCAmelCase__ : int , UpperCAmelCase__ : int ) -> list[int]: lowercase_ : List[Any] = sides_number lowercase_ : Dict = max_face_nu...
239
0
import argparse import json import math import os import time import traceback import zipfile from collections import Counter import requests def _a ( UpperCAmelCase , UpperCAmelCase=None ) -> int: """simple docstring""" lowerCamelCase__ : Any = Non...
142
'''simple docstring''' import copy import os from typing import Union from ...configuration_utils import PretrainedConfig from ...utils import logging _lowercase : Optional[Any] = logging.get_logger(__name__) _lowercase : Tuple = { "BAAI/AltCLIP": "https://huggingface.co/BAAI/A...
239
0
import random def _a ( SCREAMING_SNAKE_CASE_ : Any , SCREAMING_SNAKE_CASE_ : List[Any] , SCREAMING_SNAKE_CASE_ : Optional[Any] ): __lowerCAmelCase = a[left_index] __lowerCAmelCase = left_index + 1 for j in r...
92
'''simple docstring''' import argparse import json import os import sys import tempfile import unittest from argparse import Namespace from dataclasses import dataclass, field from enum import Enum from pathlib import Path from typing import List, Literal, Optional import yaml from transformers import HfArgumentP...
239
0
'''simple docstring''' def lowerCAmelCase_ ( _lowerCamelCase: int ): __SCREAMING_SNAKE_CASE : List[Any] = [1] __SCREAMING_SNAKE_CASE : Optional[Any] = 0, 0, 0 __SCREAMING_SNAKE_CASE : Union[str, Any] = ugly_nums[ia] * 2 __SCREAMING_SNAKE...
112
'''simple docstring''' import faiss # noqa: F401 # Here to have a nice missing dependency error message early on import numpy # noqa: F401 # Here to have a nice missing dependency error message early on import requests # noqa: F401 # Here to have a nice missing dependency error message early on import sklearn #...
239
0
from scipy.stats import pearsonr import datasets __A : str = "\nPearson correlation coefficient and p-value for testing non-correlation.\nThe Pearson correlation coefficient measures the linear relationship between two datasets. The calculation of the p-value relies on the assumption that each dataset ...
154
'''simple docstring''' from __future__ import annotations import math import random from typing import Any class __magic_name__ : def __init__( self : Any ): lowercase_ : list[Any] = [] lowercase_ : int = 0 lower...
239
0
'''simple docstring''' import unittest from datasets import load_dataset from transformers.pipelines import pipeline from transformers.testing_utils import is_pipeline_test, nested_simplify, require_torch, slow @is_pipeline_test @require_torch class lowerCAmelCase_ ( unittest.TestCase ):...
158
'''simple docstring''' import math def lowerCamelCase ( UpperCAmelCase__ : int ) -> int: if not isinstance(UpperCAmelCase__ , UpperCAmelCase__ ): lowercase_ : List[Any] = F'''Input value of [number={number}] must be an integer''' ...
239
0
from __future__ import annotations from typing import Generic, TypeVar __UpperCamelCase : Optional[int] = TypeVar("T") class __magic_name__ ( Generic[T]): def __init__( self : Tuple , lowerCamelCase__ : T ) -> List[Any]: '''simple docstring''...
146
'''simple docstring''' import unittest from transformers import AutoTokenizer, NystromformerConfig, is_torch_available from transformers.testing_utils import require_torch, slow, torch_device from ...test_configuration_common import ConfigTester from ...test_modeling_common import ModelTesterMixin, ids_tensor, ra...
239
0
def lowerCAmelCase__(__snake_case ) -> int: '''simple docstring''' if not isinstance(UpperCAmelCase__ ,UpperCAmelCase__ ): raise ValueError('''multiplicative_persistence() only accepts integral values''' ) if num < 0: raise ValueError('''multiplicative_persiste...
209
'''simple docstring''' import unittest from transformers import load_tool from transformers.utils import is_torch_available if is_torch_available(): import torch from transformers.testing_utils import require_torch from .test_tools_common import ToolTesterMixin @require_torch class __magic_name_...
239
0
"""simple docstring""" import os import sys import warnings from dataclasses import dataclass, field from io import BytesIO from typing import TYPE_CHECKING, Any, ClassVar, Dict, List, Optional, Union import numpy as np import pyarrow as pa from .. import config from ..download.streaming_downloa...
335
'''simple docstring''' from urllib.parse import quote import pytest from datasets.utils.hub import hf_hub_url @pytest.mark.parametrize("""repo_id""" , ["""canonical_dataset_name""", """org-name/dataset-name"""] ) @pytest.mark.parametrize("""path""" , ["""filename.csv""", """filename with b...
239
0
"""simple docstring""" import unittest import numpy as np import torch from diffusers import PNDMPipeline, PNDMScheduler, UNetaDModel from diffusers.utils.testing_utils import enable_full_determinism, require_torch, slow, torch_device enable_full_determinism() class UpperCAmelCase_ ( unittest.Tes...
247
'''simple docstring''' # Copyright 2021 The HuggingFace Team. All rights reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # U...
239
0
"""simple docstring""" import warnings from typing import List, Optional, Union from ...processing_utils import ProcessorMixin from ...tokenization_utils_base import BatchEncoding, PaddingStrategy, PreTokenizedInput, TextInput, TruncationStrategy from ...utils import TensorType class A_ (_UpperCAmelCase )...
61
'''simple docstring''' import operator as op def lowerCamelCase ( UpperCAmelCase__ : Optional[Any] ) -> int: lowercase_ : Optional[Any] = [] lowercase_ : str = lambda UpperCAmelCase__ , UpperCAmelCase__ : int(x / y ) ...
239
0
import json import os import unittest from transformers.models.biogpt.tokenization_biogpt import VOCAB_FILES_NAMES, BioGptTokenizer from transformers.testing_utils import slow from ...test_tokenization_common import TokenizerTesterMixin class __lowercase (_UpperCAmelCase , unittest.TestCase ): _Up...
275
'''simple docstring''' import math import unittest def lowerCamelCase ( UpperCAmelCase__ : int ) -> bool: assert isinstance(UpperCAmelCase__ , UpperCAmelCase__ ) and ( number >= 0 ), "'number' must been an int and positive" if 1 < number < ...
239
0
from ....utils import logging _A : Dict = logging.get_logger(__name__) class __SCREAMING_SNAKE_CASE ( _UpperCAmelCase ): def __init__( self : List[Any] , A : List[str] , A : Any=None , A : List[str]=2_0_4_8 ) ->List[str]: lower...
142
'''simple docstring''' import baseaa import io import json import os from copy import deepcopy from ..optimizer import AcceleratedOptimizer from ..scheduler import AcceleratedScheduler class __magic_name__ : def __init__( self : str , lowercase_ : Dict ): if isinst...
239
0
import argparse from collections import OrderedDict from pathlib import Path import requests import torch from PIL import Image from transformers import GLPNConfig, GLPNForDepthEstimation, GLPNImageProcessor from transformers.utils import logging logging.set_verbosity_info() UpperCamelCase__ = logging....
92
'''simple docstring''' import gc import inspect import unittest import torch from parameterized import parameterized from diffusers import PriorTransformer from diffusers.utils import floats_tensor, slow, torch_all_close, torch_device from diffusers.utils.testing_utils import enable_full_determinism from .test_m...
239
0
'''simple docstring''' def lowerCAmelCase_ ( _lowerCamelCase: int , _lowerCamelCase: int ): while second != 0: __SCREAMING_SNAKE_CASE : Dict = first & second first ^= second __SCREAMING_SNAKE_CASE : Optional[int] = c << 1 return first ...
112
'''simple docstring''' from collections import defaultdict def lowerCamelCase ( UpperCAmelCase__ : str , UpperCAmelCase__ : str ) -> bool: lowercase_ : Tuple = first_str.lower().strip() lowercase_ : List[Any] = ...
239
0
def __UpperCamelCase ( _A : int ) ->list[int]: """simple docstring""" if num <= 0: raise ValueError("""Input must be a positive integer""" ) lowerCamelCase_ =[True] * (num + 1) lowerCamelCase_ =2 while p * p <= num: ...
154
'''simple docstring''' import os def lowerCamelCase ( UpperCAmelCase__ : str = "input.txt" ) -> int: with open(os.path.join(os.path.dirname(UpperCAmelCase__ ) , UpperCAmelCase__ ) ) as input_file: lowercase_ : str = [ ...
239
0
'''simple docstring''' import pytest from datasets.parallel import ParallelBackendConfig, parallel_backend from datasets.utils.py_utils import map_nested from .utils import require_dill_gt_0_3_2, require_joblibspark, require_not_windows def __a(SCREAMING_SNAKE_CASE_ : Optional[int] ): # picklabl...
158
'''simple docstring''' import sacrebleu as scb from packaging import version from sacrebleu import TER import datasets _lowercase : List[str] = "\\n@inproceedings{snover-etal-2006-study,\n title = \"A Study of Translation Edit Rate with Targeted Human Annotation\",\n author = \"Snover, Matth...
239
0
import argparse import json import requests import torch from huggingface_hub import hf_hub_download from PIL import Image from transformers import ConvNextConfig, SegformerImageProcessor, UperNetConfig, UperNetForSemanticSegmentation def _a ( SCREAMING_SNAKE_CASE : List[Any] ): """simple docstrin...
146
'''simple docstring''' def lowerCamelCase ( UpperCAmelCase__ : int , UpperCAmelCase__ : int ) -> bool: return numa ^ numa < 0 if __name__ == "__main__": import doctest doctest.testmod()
239
0
from collections import OrderedDict from typing import Any, Mapping, Optional from ... import PreTrainedTokenizer, TensorType, is_torch_available from ...configuration_utils import PretrainedConfig from ...onnx import OnnxConfigWithPast from ...utils import logging _a = logging.get_logger(__name__) ...
209
'''simple docstring''' import os from shutil import copyfile from typing import List, Optional, Tuple from ...tokenization_utils import AddedToken from ...tokenization_utils_fast import PreTrainedTokenizerFast from ...utils import is_sentencepiece_available, logging if is_sentencepiece_available(): from .t...
239
0
"""simple docstring""" import unittest import numpy as np from transformers import RobertaConfig, is_flax_available from transformers.testing_utils import require_flax, slow from ...test_modeling_flax_common import FlaxModelTesterMixin, floats_tensor, ids_tensor, random_attention_mask if is_fl...
335
'''simple docstring''' _lowercase : str = tuple[float, float, float] _lowercase : List[Any] = tuple[float, float, float] def lowerCamelCase ( UpperCAmelCase__ : Pointad , UpperCAmelCase__ : Pointad ) -> Vectorad: lowercase_ ...
239
0
"""simple docstring""" import collections import importlib.util import os import re from pathlib import Path SCREAMING_SNAKE_CASE = "src/transformers" # Matches is_xxx_available() SCREAMING_SNAKE_CASE = re.compile(r"is\_([a-z_]*)_available()") # Catches a one-line _import_struct = {xxx} SC...
247
'''simple docstring''' def lowerCamelCase ( UpperCAmelCase__ : list ) -> list: if any(not isinstance(UpperCAmelCase__ , UpperCAmelCase__ ) or x < 0 for x in sequence ): raise TypeError("""Sequence must be list of non-negative integers""" ) for _ in ...
239
0
"""simple docstring""" import gc import unittest from transformers import MODEL_FOR_MASKED_LM_MAPPING, TF_MODEL_FOR_MASKED_LM_MAPPING, FillMaskPipeline, pipeline from transformers.pipelines import PipelineException from transformers.testing_utils import ( is_pipeline_test, is_torch_available, nested_...
61
'''simple docstring''' from typing import TYPE_CHECKING from ....utils import OptionalDependencyNotAvailable, _LazyModule, is_torch_available _lowercase : Dict = {"configuration_mmbt": ["MMBTConfig"]} try: if not is_torch_available(): raise OptionalDependencyNotAvailable() excep...
239
0
import argparse import json from pathlib import Path import requests import torch from huggingface_hub import hf_hub_download from PIL import Image from transformers import ( MobileViTConfig, MobileViTForImageClassification, MobileViTForSemanticSegmentation, MobileViTImageProcessor, ) from transform...
275
'''simple docstring''' from itertools import product def lowerCamelCase ( UpperCAmelCase__ : int , UpperCAmelCase__ : int ) -> list[int]: lowercase_ : List[Any] = sides_number lowercase_ : Dict = max_face_nu...
239
0
from typing import TYPE_CHECKING from ...utils import OptionalDependencyNotAvailable, _LazyModule, is_torch_available _A : Dict = { "configuration_xmod": [ "XMOD_PRETRAINED_CONFIG_ARCHIVE_MAP", "XmodConfig", "XmodOnnxConfig", ], } try: if not is_torch_available...
142
'''simple docstring''' import copy import os from typing import Union from ...configuration_utils import PretrainedConfig from ...utils import logging _lowercase : Optional[Any] = logging.get_logger(__name__) _lowercase : Tuple = { "BAAI/AltCLIP": "https://huggingface.co/BAAI/A...
239
0
import multiprocessing import time from arguments import PretokenizationArguments from datasets import load_dataset from transformers import AutoTokenizer, HfArgumentParser def _a ( SCREAMING_SNAKE_CASE_ : List[Any] ): __lowerCAmelCase = {} __lowerCAmelCase ...
92
'''simple docstring''' import argparse import json import os import sys import tempfile import unittest from argparse import Namespace from dataclasses import dataclass, field from enum import Enum from pathlib import Path from typing import List, Literal, Optional import yaml from transformers import HfArgumentP...
239
0
'''simple docstring''' from typing import TYPE_CHECKING from ...utils import OptionalDependencyNotAvailable, _LazyModule, is_torch_available, is_vision_available UpperCamelCase__ : Dict = {"configuration_glpn": ["GLPN_PRETRAINED_CONFIG_ARCHIVE_MAP", "GLPNConfig"]} try: if not is_vision_availa...
112
'''simple docstring''' import faiss # noqa: F401 # Here to have a nice missing dependency error message early on import numpy # noqa: F401 # Here to have a nice missing dependency error message early on import requests # noqa: F401 # Here to have a nice missing dependency error message early on import sklearn #...
239
0
from __future__ import annotations import unittest import numpy as np from transformers import BlipTextConfig from transformers.testing_utils import require_tf, slow from transformers.utils import is_tf_available from ...test_configuration_common import ConfigTester from ...test_modeling_tf_common import TFModelT...
154
'''simple docstring''' from __future__ import annotations import math import random from typing import Any class __magic_name__ : def __init__( self : Any ): lowercase_ : list[Any] = [] lowercase_ : int = 0 lower...
239
0
'''simple docstring''' import copy from dataclasses import dataclass from pathlib import Path from typing import Dict, Optional, Union @dataclass class lowerCAmelCase_ : __lowerCamelCase : int = None __lowerCamelCase : Tuple = False __lowerCamelCase : Op...
158
'''simple docstring''' import math def lowerCamelCase ( UpperCAmelCase__ : int ) -> int: if not isinstance(UpperCAmelCase__ , UpperCAmelCase__ ): lowercase_ : List[Any] = F'''Input value of [number={number}] must be an integer''' ...
239
0
from typing import Dict, List, Optional from ...tokenization_utils import AddedToken, PreTrainedTokenizer from ...utils import logging __UpperCamelCase : Optional[int] = logging.get_logger(__name__) __UpperCamelCase : Optional[int] = { "nielsr/canine-s": 2048, } # Unicode defines 1,11...
146
'''simple docstring''' import unittest from transformers import AutoTokenizer, NystromformerConfig, is_torch_available from transformers.testing_utils import require_torch, slow, torch_device from ...test_configuration_common import ConfigTester from ...test_modeling_common import ModelTesterMixin, ids_tensor, ra...
239
0
from ...configuration_utils import PretrainedConfig from ...utils import logging _a = logging.get_logger(__name__) _a = { "microsoft/markuplm-base": "https://huggingface.co/microsoft/markuplm-base/resolve/main/config.json", "microsoft/markuplm-large": "https://huggingface.co/micro...
209
'''simple docstring''' import unittest from transformers import load_tool from transformers.utils import is_torch_available if is_torch_available(): import torch from transformers.testing_utils import require_torch from .test_tools_common import ToolTesterMixin @require_torch class __magic_name_...
239
0
"""simple docstring""" def _snake_case ( UpperCAmelCase_ : str , UpperCAmelCase_ : str ): A__ = len(UpperCAmelCase__ ) A__ = len(UpperCAmelCase__ ) A__ = ( first_str_length if first_str_length > second_str_length el...
335
'''simple docstring''' from urllib.parse import quote import pytest from datasets.utils.hub import hf_hub_url @pytest.mark.parametrize("""repo_id""" , ["""canonical_dataset_name""", """org-name/dataset-name"""] ) @pytest.mark.parametrize("""path""" , ["""filename.csv""", """filename with b...
239
0
"""simple docstring""" from typing import TYPE_CHECKING from ...utils import OptionalDependencyNotAvailable, _LazyModule, is_torch_available SCREAMING_SNAKE_CASE = { "configuration_bigbird_pegasus": [ "BIGBIRD_PEGASUS_PRETRAINED_CONFIG_ARCHIVE_MAP", "BigBirdPegasusConfig", ...
247
'''simple docstring''' # Copyright 2021 The HuggingFace Team. All rights reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # U...
239
0
"""simple docstring""" from typing import List, Optional, Union import numpy as np import torch import torchaudio.compliance.kaldi as ta_kaldi from ...feature_extraction_sequence_utils import SequenceFeatureExtractor from ...feature_extraction_utils import BatchFeature from ...utils import PaddingStrategy, Tens...
61
'''simple docstring''' import operator as op def lowerCamelCase ( UpperCAmelCase__ : Optional[Any] ) -> int: lowercase_ : Optional[Any] = [] lowercase_ : str = lambda UpperCAmelCase__ , UpperCAmelCase__ : int(x / y ) ...
239
0
import argparse from transformers import TaConfig, TaForConditionalGeneration, load_tf_weights_in_ta from transformers.utils import logging logging.set_verbosity_info() def _lowercase ( lowercase__ , lowercase__ , lowercase__ ): # Initialise PyTorch model __lowerCAmelCase : ...
275
'''simple docstring''' import math import unittest def lowerCamelCase ( UpperCAmelCase__ : int ) -> bool: assert isinstance(UpperCAmelCase__ , UpperCAmelCase__ ) and ( number >= 0 ), "'number' must been an int and positive" if 1 < number < ...
239
0
def _a ( UpperCAmelCase , UpperCAmelCase ) -> int: """simple docstring""" while b: lowerCamelCase__ : List[Any] = b, a % b return a def _a ( UpperCAmelCase , UpperCAmelCase ) -> int: """simple docstring"...
142
'''simple docstring''' import baseaa import io import json import os from copy import deepcopy from ..optimizer import AcceleratedOptimizer from ..scheduler import AcceleratedScheduler class __magic_name__ : def __init__( self : str , lowercase_ : Dict ): if isinst...
239
0
import torch from diffusers import DDPMScheduler from .test_schedulers import SchedulerCommonTest class a__ ( _UpperCAmelCase ): _a : Optional[Any] = (DDPMScheduler,) def __SCREAMING_SNAKE_CASE( self , **_A ): """simple docstring""" ...
92
'''simple docstring''' import gc import inspect import unittest import torch from parameterized import parameterized from diffusers import PriorTransformer from diffusers.utils import floats_tensor, slow, torch_all_close, torch_device from diffusers.utils.testing_utils import enable_full_determinism from .test_m...
239
0
'''simple docstring''' from transformers import BertTokenizer, EncoderDecoderModel, SeqaSeqTrainer, SeqaSeqTrainingArguments from transformers.testing_utils import TestCasePlus, require_torch, slow from transformers.utils import is_datasets_available if is_datasets_available(): import datasets cla...
112
'''simple docstring''' from collections import defaultdict def lowerCamelCase ( UpperCAmelCase__ : str , UpperCAmelCase__ : str ) -> bool: lowercase_ : Tuple = first_str.lower().strip() lowercase_ : List[Any] = ...
239
0
import copy import os from typing import Union from ...configuration_utils import PretrainedConfig from ...utils import logging __A : Optional[Any] = logging.get_logger(__name__) __A : Tuple = { "BAAI/AltCLIP": "https://huggingface.co/BAAI/AltCLIP/resolve/main/config.json", # See a...
154
'''simple docstring''' import os def lowerCamelCase ( UpperCAmelCase__ : str = "input.txt" ) -> int: with open(os.path.join(os.path.dirname(UpperCAmelCase__ ) , UpperCAmelCase__ ) ) as input_file: lowercase_ : str = [ ...
239
0
'''simple docstring''' from collections import OrderedDict from typing import TYPE_CHECKING, Any, Mapping, Optional, Union from ...configuration_utils import PretrainedConfig from ...onnx import OnnxConfig from ...utils import logging if TYPE_CHECKING: from ... import FeatureExtractionMixin, PreTraine...
158
'''simple docstring''' import sacrebleu as scb from packaging import version from sacrebleu import TER import datasets _lowercase : List[str] = "\\n@inproceedings{snover-etal-2006-study,\n title = \"A Study of Translation Edit Rate with Targeted Human Annotation\",\n author = \"Snover, Matth...
239
0
import shutil import tempfile import unittest from transformers import SPIECE_UNDERLINE, BatchEncoding, MBartaaTokenizer, MBartaaTokenizerFast, is_torch_available from transformers.testing_utils import ( get_tests_dir, nested_simplify, require_sentencepiece, require_tokenizers, require_torch, ...
146
'''simple docstring''' def lowerCamelCase ( UpperCAmelCase__ : int , UpperCAmelCase__ : int ) -> bool: return numa ^ numa < 0 if __name__ == "__main__": import doctest doctest.testmod()
239
0
import os from shutil import copyfile from typing import Any, Dict, List, Optional, Tuple import sentencepiece as spm from ...tokenization_utils import PreTrainedTokenizer from ...utils import logging _a = logging.get_logger(__name__) _a = {"vocab_file": "spiece.model"} _a = ...
209
'''simple docstring''' import os from shutil import copyfile from typing import List, Optional, Tuple from ...tokenization_utils import AddedToken from ...tokenization_utils_fast import PreTrainedTokenizerFast from ...utils import is_sentencepiece_available, logging if is_sentencepiece_available(): from .t...
239
0
"""simple docstring""" from __future__ import annotations SCREAMING_SNAKE_CASE_ : Dict = [] def _snake_case ( UpperCAmelCase_ : list[list[int]] , UpperCAmelCase_ : int , UpperCAmelCase_ : int ): for i in range(len(UpperCAmelC...
335
'''simple docstring''' _lowercase : str = tuple[float, float, float] _lowercase : List[Any] = tuple[float, float, float] def lowerCamelCase ( UpperCAmelCase__ : Pointad , UpperCAmelCase__ : Pointad ) -> Vectorad: lowercase_ ...
239
0
"""simple docstring""" from arguments import InitializationArguments from transformers import AutoConfig, AutoModelForCausalLM, AutoTokenizer, HfArgumentParser # Configuration SCREAMING_SNAKE_CASE = HfArgumentParser(InitializationArguments) SCREAMING_SNAKE_CASE = parser.parse_args() # Load...
247
'''simple docstring''' def lowerCamelCase ( UpperCAmelCase__ : list ) -> list: if any(not isinstance(UpperCAmelCase__ , UpperCAmelCase__ ) or x < 0 for x in sequence ): raise TypeError("""Sequence must be list of non-negative integers""" ) for _ in ...
239
0
"""simple docstring""" from typing import TYPE_CHECKING from ...utils import OptionalDependencyNotAvailable, _LazyModule, is_torch_available _a = { "configuration_clipseg": [ "CLIPSEG_PRETRAINED_CONFIG_ARCHIVE_MAP", "CLIPSegConfig", "CLIPSegTextConfig", "CLIPSe...
61
'''simple docstring''' from typing import TYPE_CHECKING from ....utils import OptionalDependencyNotAvailable, _LazyModule, is_torch_available _lowercase : Dict = {"configuration_mmbt": ["MMBTConfig"]} try: if not is_torch_available(): raise OptionalDependencyNotAvailable() excep...
239
0
from collections import defaultdict def _lowercase ( lowercase__ , lowercase__ ): __lowerCAmelCase : Tuple = first_str.lower().strip() __lowerCAmelCase : List[Any] = second_str.lower().strip() # Remove whitespace __lowerCAmelCase : ...
275
'''simple docstring''' from itertools import product def lowerCamelCase ( UpperCAmelCase__ : int , UpperCAmelCase__ : int ) -> list[int]: lowercase_ : List[Any] = sides_number lowercase_ : Dict = max_face_nu...
239
0
from __future__ import annotations import math class __SCREAMING_SNAKE_CASE : def __init__( self : int , A : int ) ->Any: lowerCamelCase__ : Union[str, Any] = size # approximate the overall size of segment tree with given value ...
142
'''simple docstring''' import copy import os from typing import Union from ...configuration_utils import PretrainedConfig from ...utils import logging _lowercase : Optional[Any] = logging.get_logger(__name__) _lowercase : Tuple = { "BAAI/AltCLIP": "https://huggingface.co/BAAI/A...
239
0
import os from pathlib import Path def _a ( SCREAMING_SNAKE_CASE_ : Optional[Any] , SCREAMING_SNAKE_CASE_ : Dict , SCREAMING_SNAKE_CASE_ : List[Any] ): __lowerCAmelCase = { """en""": """Machine learning is great, isn't i...
92
'''simple docstring''' import argparse import json import os import sys import tempfile import unittest from argparse import Namespace from dataclasses import dataclass, field from enum import Enum from pathlib import Path from typing import List, Literal, Optional import yaml from transformers import HfArgumentP...
239
0
'''simple docstring''' import argparse import json import os import sys import tempfile import unittest from argparse import Namespace from dataclasses import dataclass, field from enum import Enum from pathlib import Path from typing import List, Literal, Optional import yaml from transformers import HfArgum...
112
'''simple docstring''' import faiss # noqa: F401 # Here to have a nice missing dependency error message early on import numpy # noqa: F401 # Here to have a nice missing dependency error message early on import requests # noqa: F401 # Here to have a nice missing dependency error message early on import sklearn #...
239
0
import argparse import json import re from pathlib import Path import requests import torch from huggingface_hub import hf_hub_download from PIL import Image from transformers import ( MobileNetVaConfig, MobileNetVaForImageClassification, MobileNetVaImageProcessor, load_tf_weights_in_mobilenet_va, )...
154
'''simple docstring''' from __future__ import annotations import math import random from typing import Any class __magic_name__ : def __init__( self : Any ): lowercase_ : list[Any] = [] lowercase_ : int = 0 lower...
239
0
'''simple docstring''' import json import logging import math import os import sys from dataclasses import dataclass, field from typing import Optional from datasets import Dataset, load_dataset import transformers from transformers import ( CONFIG_MAPPING, MODEL_FOR_MASKED_LM_MAPPING, AutoConfig,...
158
'''simple docstring''' import math def lowerCamelCase ( UpperCAmelCase__ : int ) -> int: if not isinstance(UpperCAmelCase__ , UpperCAmelCase__ ): lowercase_ : List[Any] = F'''Input value of [number={number}] must be an integer''' ...
239
0
import gc import unittest import numpy as np import torch from transformers import CLIPTextConfig, CLIPTextModel, CLIPTokenizer from diffusers import ( AutoencoderKL, DDIMScheduler, StableDiffusionAttendAndExcitePipeline, UNetaDConditionModel, ) from diffusers.utils import load_numpy, skip_mps, slo...
146
'''simple docstring''' import unittest from transformers import AutoTokenizer, NystromformerConfig, is_torch_available from transformers.testing_utils import require_torch, slow, torch_device from ...test_configuration_common import ConfigTester from ...test_modeling_common import ModelTesterMixin, ids_tensor, ra...
239
0
def lowerCAmelCase__(__snake_case ,__snake_case ) -> bool: '''simple docstring''' return numa ^ numa < 0 if __name__ == "__main__": import doctest doctest.testmod()
209
'''simple docstring''' import unittest from transformers import load_tool from transformers.utils import is_torch_available if is_torch_available(): import torch from transformers.testing_utils import require_torch from .test_tools_common import ToolTesterMixin @require_torch class __magic_name_...
239
0
"""simple docstring""" import argparse import json import os from collections import OrderedDict import numpy as np import tensorflow as tf import torch def _snake_case ( UpperCAmelCase_ : int ): A__ = os.path.join(args.tf_model_dir , """parameter...
335
'''simple docstring''' from urllib.parse import quote import pytest from datasets.utils.hub import hf_hub_url @pytest.mark.parametrize("""repo_id""" , ["""canonical_dataset_name""", """org-name/dataset-name"""] ) @pytest.mark.parametrize("""path""" , ["""filename.csv""", """filename with b...
239
0
"""simple docstring""" from itertools import product def _SCREAMING_SNAKE_CASE ( lowercase_ , lowercase_ ) -> list[int]: A__ = sides_number A__ = max_face_number * dice_number A__ = [0] * (max_total + 1) A__ = 1 A__ = range(UpperCA...
247
'''simple docstring''' # Copyright 2021 The HuggingFace Team. All rights reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # U...
239
0
"""simple docstring""" import logging import math import os from dataclasses import dataclass, field from glob import glob from typing import Optional from torch.utils.data import ConcatDataset import transformers from transformers import ( CONFIG_MAPPING, MODEL_WITH_LM_HEAD_MAPPING, AutoConfig, ...
61
'''simple docstring''' import operator as op def lowerCamelCase ( UpperCAmelCase__ : Optional[Any] ) -> int: lowercase_ : Optional[Any] = [] lowercase_ : str = lambda UpperCAmelCase__ , UpperCAmelCase__ : int(x / y ) ...
239
0
def _lowercase ( lowercase__ ): return [ txt[:a] + txt[a].upper() + txt[a + 1 :] for a in range(len(UpperCAmelCase__ ) ) if txt[a].isalpha() ] if __name__ == "__main__": __import__("doctest").testmod()
275
'''simple docstring''' import math import unittest def lowerCamelCase ( UpperCAmelCase__ : int ) -> bool: assert isinstance(UpperCAmelCase__ , UpperCAmelCase__ ) and ( number >= 0 ), "'number' must been an int and positive" if 1 < number < ...
239
0
import os from typing import List, Optional, Union from ...tokenization_utils import PreTrainedTokenizer from ...tokenization_utils_base import AddedToken from ...utils import logging _A : List[str] = logging.get_logger(__name__) _A : int = {"vocab_file": "vocab.txt"} _A : List[Any...
142
'''simple docstring''' import baseaa import io import json import os from copy import deepcopy from ..optimizer import AcceleratedOptimizer from ..scheduler import AcceleratedScheduler class __magic_name__ : def __init__( self : str , lowercase_ : Dict ): if isinst...
239
0
import unittest import numpy as np from transformers.file_utils import is_torch_available, is_vision_available from transformers.testing_utils import require_torch, require_vision from ...test_image_processing_common import ImageProcessingSavingTestMixin, prepare_image_inputs if is_torch_available(): imp...
92
'''simple docstring''' import gc import inspect import unittest import torch from parameterized import parameterized from diffusers import PriorTransformer from diffusers.utils import floats_tensor, slow, torch_all_close, torch_device from diffusers.utils.testing_utils import enable_full_determinism from .test_m...
239
0
'''simple docstring''' from torch import nn class _UpperCamelCase ( nn.Module ): '''simple docstring''' def __init__( self : Optional[Any] , lowerCAmelCase__ : Tuple , lowerCAmelCase__ : str ): """simple docstring""" ...
112
'''simple docstring''' from collections import defaultdict def lowerCamelCase ( UpperCAmelCase__ : str , UpperCAmelCase__ : str ) -> bool: lowercase_ : Tuple = first_str.lower().strip() lowercase_ : List[Any] = ...
239
0
import gc import random import unittest import numpy as np import torch from PIL import Image from transformers import XLMRobertaTokenizerFast from diffusers import DDIMScheduler, KandinskyImgaImgPipeline, KandinskyPriorPipeline, UNetaDConditionModel, VQModel from diffusers.pipelines.kandinsky.text_encoder import M...
154
'''simple docstring''' import os def lowerCamelCase ( UpperCAmelCase__ : str = "input.txt" ) -> int: with open(os.path.join(os.path.dirname(UpperCAmelCase__ ) , UpperCAmelCase__ ) ) as input_file: lowercase_ : str = [ ...
239
0
'''simple docstring''' import faiss # noqa: F401 # Here to have a nice missing dependency error message early on import numpy # noqa: F401 # Here to have a nice missing dependency error message early on import requests # noqa: F401 # Here to have a nice missing dependency error message early on import sklear...
158
'''simple docstring''' import sacrebleu as scb from packaging import version from sacrebleu import TER import datasets _lowercase : List[str] = "\\n@inproceedings{snover-etal-2006-study,\n title = \"A Study of Translation Edit Rate with Targeted Human Annotation\",\n author = \"Snover, Matth...
239
0
import copy from ...configuration_utils import PretrainedConfig from ...utils import add_start_docstrings __UpperCamelCase : Optional[int] = r"\n [`RagConfig`] stores the configuration of a *RagModel*. Configuration objects inherit from [`PretrainedConfig`] and\n can be used to control the model ...
146
'''simple docstring''' def lowerCamelCase ( UpperCAmelCase__ : int , UpperCAmelCase__ : int ) -> bool: return numa ^ numa < 0 if __name__ == "__main__": import doctest doctest.testmod()
239
0
import unittest import numpy as np import torch from transformers import CLIPTextConfig, CLIPTextModel from diffusers import DDIMScheduler, LDMPipeline, UNetaDModel, VQModel from diffusers.utils.testing_utils import enable_full_determinism, require_torch, slow, torch_device enable_full_determinism() cla...
209
'''simple docstring''' import os from shutil import copyfile from typing import List, Optional, Tuple from ...tokenization_utils import AddedToken from ...tokenization_utils_fast import PreTrainedTokenizerFast from ...utils import is_sentencepiece_available, logging if is_sentencepiece_available(): from .t...
239
0
"""simple docstring""" import operator as op def _snake_case ( UpperCAmelCase_ : Optional[Any] ): A__ = [] A__ = lambda UpperCAmelCase_ , UpperCAmelCase_ : int(x / y ) # noqa: E731 integer division operation A__ = { ...
335
'''simple docstring''' _lowercase : str = tuple[float, float, float] _lowercase : List[Any] = tuple[float, float, float] def lowerCamelCase ( UpperCAmelCase__ : Pointad , UpperCAmelCase__ : Pointad ) -> Vectorad: lowercase_ ...
239
0
"""simple docstring""" from __future__ import annotations import math def _SCREAMING_SNAKE_CASE ( lowercase_ ) -> bool: if 1 < number < 4: # 2 and 3 are primes return True elif number < 2 or number % 2 == 0 or number % 3 == 0: # Negatives, 0, 1, all even numbers, all multip...
247
'''simple docstring''' def lowerCamelCase ( UpperCAmelCase__ : list ) -> list: if any(not isinstance(UpperCAmelCase__ , UpperCAmelCase__ ) or x < 0 for x in sequence ): raise TypeError("""Sequence must be list of non-negative integers""" ) for _ in ...
239
0
from typing import TYPE_CHECKING from ...utils import ( OptionalDependencyNotAvailable, _LazyModule, is_flax_available, is_sentencepiece_available, is_tf_available, is_tokenizers_available, is_torch_available, ) snake_case : Dict = { '''configuration_albert'...
240
from argparse import ArgumentParser from .env import EnvironmentCommand def __lowercase ( ): a__ = ArgumentParser('Diffusers CLI tool' , usage='diffusers-cli <command> [<args>]' ) a__ = parser.add_subparsers(help='diffusers-cli command helpers' ...
240
1