code
stringlengths
82
54.1k
code_codestyle
int64
0
699
style_context
stringlengths
111
35.6k
style_context_codestyle
int64
0
699
label
int64
0
1
import math from ...configuration_utils import PretrainedConfig from ...utils import logging _A : int = logging.get_logger(__name__) _A : Union[str, Any] = { """facebook/data2vec-base-960h""": """https://huggingface.co/facebook/data2vec-audio-base-960h/resolve/main/config.json""", ...
100
import argparse import logging import sys from unittest.mock import patch import run_glue_deebert from transformers.testing_utils import TestCasePlus, get_gpu_count, require_torch_non_multi_gpu, slow logging.basicConfig(level=logging.DEBUG) a__ : Optional[Any] = logging.getLogger() def _lowe...
622
0
import json import os import shutil import tempfile import unittest import numpy as np import pytest from transformers import CLIPTokenizer, CLIPTokenizerFast from transformers.models.clip.tokenization_clip import VOCAB_FILES_NAMES from transformers.testing_utils import require_vision from transform...
101
import json import os import unittest from transformers.models.ctrl.tokenization_ctrl import VOCAB_FILES_NAMES, CTRLTokenizer from ...test_tokenization_common import TokenizerTesterMixin class UpperCAmelCase__( lowerCamelCase , unittest.TestCase ): '''simple docstring''' A : int ...
622
0
"""simple docstring""" import unittest from transformers import is_torch_available from transformers.testing_utils import require_torch if is_torch_available(): import torch from transformers.activations import gelu_new, gelu_python, get_activation @require_torch class ...
102
from argparse import ArgumentParser from .add_new_model import AddNewModelCommand from .add_new_model_like import AddNewModelLikeCommand from .convert import ConvertCommand from .download import DownloadCommand from .env import EnvironmentCommand from .lfs import LfsCommands from .pt_to_tf import PTtoTFCommand fro...
622
0
"""simple docstring""" from typing import Dict, List from nltk.translate import gleu_score import datasets from datasets import MetricInfo snake_case = '''\ @misc{wu2016googles, title={Google\'s Neural Machine Translation System: Bridging the Gap between Human and Machin...
103
import pytest import requests from datasets.utils.file_utils import http_head from .utils import OfflineSimulationMode, RequestWouldHangIndefinitelyError, offline @pytest.mark.integration def _lowerCAmelCase ( ): with offline(OfflineSimulationMode.CONNECTION_TIMES_OUT ): with pytest.ra...
622
0
"""simple docstring""" from collections import OrderedDict from typing import Mapping from ...configuration_utils import PretrainedConfig from ...onnx import OnnxConfig from ...utils import logging UpperCamelCase = logging.get_logger(__name__) UpperCamelCase = { ...
104
def _lowerCAmelCase ( A__ = 600_851_475_143 ): try: lowercase__ = int(A__ ) except (TypeError, ValueError): raise TypeError('Parameter n must be int or castable to int.' ) if n <= 0: raise ValueError('Parameter n must be greater than or equa...
622
0
from typing import TYPE_CHECKING from ...utils import ( OptionalDependencyNotAvailable, _LazyModule, is_flax_available, is_tf_available, is_tokenizers_available, is_torch_available, ) UpperCamelCase__ : Dict = {'''configuration_opt''': ['''OPT_PRETRAINED_CONFIG_ARCHIVE_MAP''...
105
from __future__ import annotations def _lowerCAmelCase ( A__ , A__ = None ): lowercase__ = word_bank or [] # create a table lowercase__ = len(A__ ) + 1 lowercase__ = [] for _ in range(A__ ): table.append([] ) # seed value lowercas...
622
0
from typing import TYPE_CHECKING from ..utils import _LazyModule __snake_case :int ={ 'config': [ 'EXTERNAL_DATA_FORMAT_SIZE_LIMIT', 'OnnxConfig', 'OnnxConfigWithPast', 'OnnxSeq2SeqConfigWithPast', 'PatchingSpec', ], 'convert': ['export', 'validate...
106
a__ : Tuple = "Tobias Carryer" from time import time class UpperCAmelCase__: '''simple docstring''' def __init__( self : str , lowerCAmelCase : List[str] , lowerCAmelCase : Any , lowerCAmelCase : str , lowerCAmelCase : ...
622
0
'''simple docstring''' from __future__ import annotations from scipy.special import comb # type: ignore class lowercase_ : """simple docstring""" def __init__( self : Tuple, UpperCamelCase__ : list[tuple[float, float]] ) -> Any: _A = list_of_poi...
107
import warnings from ...utils import logging from .image_processing_glpn import GLPNImageProcessor a__ : Optional[Any] = logging.get_logger(__name__) class UpperCAmelCase__( lowerCamelCase ): '''simple docstring''' def __init__( self : Optional[Any] , *l...
622
0
import pyarrow.parquet as pq import pytest from datasets import Audio, Dataset, DatasetDict, Features, NamedSplit, Sequence, Value, config from datasets.features.image import Image from datasets.io.parquet import ParquetDatasetReader, ParquetDatasetWriter, get_writer_batch_size from ..utils import assert_arrow...
108
import random import unittest import torch from diffusers import IFImgaImgSuperResolutionPipeline from diffusers.utils import floats_tensor from diffusers.utils.import_utils import is_xformers_available from diffusers.utils.testing_utils import skip_mps, torch_device from ..pipeline_params import TEXT_GUIDED_IMA...
622
0
'''simple docstring''' import gc import random import unittest import numpy as np import torch from PIL import Image from transformers import CLIPTextConfig, CLIPTextModel, CLIPTokenizer from diffusers import ( AutoencoderKL, DDIMScheduler, EulerAncestralDiscreteScheduler, LMSDiscreteScheduler,...
109
import unittest from transformers.models.xlm_prophetnet.tokenization_xlm_prophetnet import SPIECE_UNDERLINE, XLMProphetNetTokenizer from transformers.testing_utils import get_tests_dir, require_sentencepiece, slow from transformers.utils import cached_property from ...test_tokenization_common import TokenizerTest...
622
0
'''simple docstring''' __magic_name__ : List[str] ="\n# Transformers installation\n! pip install transformers datasets\n# To install from source instead of the last release, comment the command above and uncomment the following one.\n# ! pip install git+https://github.com/huggingface/transformers.git\n" __magic...
664
from math import sqrt def _lowerCAmelCase ( A__ ): assert isinstance(A__ , A__ ) and ( number >= 0 ), "'number' must been an int and positive" lowercase__ = True # 0 and 1 are none primes. if number <= 1: lowercase__ = False for diviso...
622
0
import copy import os from typing import Union from ...configuration_utils import PretrainedConfig from ...models.auto.modeling_auto import MODEL_FOR_CAUSAL_LM_MAPPING_NAMES from ...utils import logging from ..auto import CONFIG_MAPPING _A : Union[str, Any] = logging.get_logger(__name__) _A...
315
import argparse import torch from transformers import ( EncodecConfig, EncodecFeatureExtractor, EncodecModel, logging, ) # checkpoints downloaded from: # https://dl.fbaipublicfiles.com/encodec/v0/encodec_24khz-d7cc33bc.th # https://huggingface.co/facebook/musicgen-small/resolve/main/compression_...
622
0
from dataclasses import dataclass from typing import Tuple import numpy as np import torch @dataclass class UpperCAmelCase : '''simple docstring''' snake_case_ = 42 # [batch_size x 3] snake_case_ = 42 # [batch_size x 3] snake_case_ = 42 # [batch_size x 3] snake_cas...
55
# 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 # # Unless required by appli...
622
0
'''simple docstring''' def lowerCAmelCase_ ( snake_case__ = 6008_5147_5143 ): '''simple docstring''' try: A : int = int(A__ ) except (TypeError, ValueError): raise TypeError('''Parameter n must be int or castable to int.''' ) if n <= 0...
634
def _lowerCAmelCase ( A__ = 50_000_000 ): lowercase__ = set() lowercase__ = int((limit - 24) ** (1 / 2) ) lowercase__ = set(range(3 , prime_square_limit + 1 , 2 ) ) primes.add(2 ) for p in range(3 , prime_square_limit + 1 , 2 ): ...
622
0
def a_ ( __lowerCAmelCase , __lowerCAmelCase ): return price * (1 + tax_rate) if __name__ == "__main__": print(F"{price_plus_tax(1_00, 0.25) = }") print(F"{price_plus_tax(1_25.50, 0.05) = }")
615
from collections import OrderedDict from typing import Any, Mapping, Optional from ... import PreTrainedTokenizer from ...configuration_utils import PretrainedConfig from ...onnx import OnnxConfig, OnnxConfigWithPast, OnnxSeqaSeqConfigWithPast from ...onnx.utils import compute_effective_axis_dimension from ...util...
622
0
import argparse from transformers import TaConfig, TaForConditionalGeneration, load_tf_weights_in_ta from transformers.utils import logging logging.set_verbosity_info() def lowerCAmelCase__ ( a__: Union[str, Any] , a__: List[str] , a__: Any ) -> int: '''...
618
from sklearn.metrics import matthews_corrcoef import datasets a__ : Any = "\nCompute the Matthews correlation coefficient (MCC)\n\nThe Matthews correlation coefficient is used in machine learning as a\nmeasure of the quality of binary and multiclass classifications. It takes\ninto account true a...
622
0
"""simple docstring""" # using dfs for finding eulerian path traversal def a__ ( __SCREAMING_SNAKE_CASE , __SCREAMING_SNAKE_CASE , __SCREAMING_SNAKE_CASE , __SCREAMING_SNAKE_CASE=None ) -> Optional[Any]: __lowerCAmelCase: Optional[int] ...
346
import inspect import unittest from transformers import ViTHybridConfig from transformers.testing_utils import require_accelerate, require_torch, require_vision, slow, torch_device from transformers.utils import cached_property, is_torch_available, is_vision_available from ...test_configuration_common import Conf...
622
0
from collections import OrderedDict from typing import Mapping from ...configuration_utils import PretrainedConfig from ...onnx import OnnxConfig from ...utils import logging lowerCAmelCase_ = logging.get_logger(__name__) lowerCAmelCase_ = { "junnyu/roformer_chinese_small": "https://huggin...
411
from datasets.utils.patching import _PatchedModuleObj, patch_submodule from . import _test_patching def _lowerCAmelCase ( ): import os as original_os from os import path as original_path from os import rename as original_rename from os.path import dirname as original_dirname from...
622
0
def __lowerCAmelCase ( __snake_case ): if len(A__ ) < 2: return collection def circle_sort_util(__snake_case , __snake_case , __snake_case ) -> bool: __lowerCAmelCase = False if low == high: retu...
367
import os import unittest from transformers.models.cpmant.tokenization_cpmant import VOCAB_FILES_NAMES, CpmAntTokenizer from transformers.testing_utils import require_jieba, tooslow from ...test_tokenization_common import TokenizerTesterMixin @require_jieba class UpperCAmelCase__( lowerCamelCase , un...
622
0
from __future__ import annotations from collections.abc import Callable from typing import Any, Generic, TypeVar _lowercase = TypeVar("""T""") class lowercase_ ( Generic[T] ): def __init__( self , __A , __A ) -> None: ...
443
import argparse import requests import torch from PIL import Image from transformers import SwinConfig, SwinForMaskedImageModeling, ViTImageProcessor def _lowerCAmelCase ( A__ ): lowercase__ = SwinConfig(image_size=192 ) if "base" in model_name: lowercase__ = 6 ...
622
0
import copy from typing import Any, Dict, List, Optional, Union import numpy as np import torch from ...audio_utils import mel_filter_bank, spectrogram, window_function from ...feature_extraction_sequence_utils import SequenceFeatureExtractor from ...feature_extraction_utils import BatchFeature from ...utils...
520
import os import unicodedata from shutil import copyfile from typing import Any, Dict, List, Optional, Tuple import sentencepiece as spm from ...tokenization_utils import AddedToken, PreTrainedTokenizer from ...utils import logging a__ : Optional[int] = logging.get_logger(__name__) a__ : ...
622
0
'''simple docstring''' def __snake_case ( lowerCamelCase_ : Tuple = 10**9 ): '''simple docstring''' __magic_name__ = 1 __magic_name__ = 2 __magic_name__ = 0 __magic_name__ = 0 __magic_name__ = 0 while perimeter <= max_per...
664
from __future__ import annotations import copy import inspect import unittest import numpy as np from transformers import is_tf_available, is_vision_available from transformers.models.auto import get_values from transformers.testing_utils import require_tf, slow from transformers.utils import cached_property fr...
622
0
import json from typing import List, Optional, Tuple from tokenizers import normalizers from tokenizers.pre_tokenizers import BertPreTokenizer, PreTokenizer from ...tokenization_utils_fast import PreTrainedTokenizerFast from ...utils import logging from .tokenization_roformer import RoFormerTokenizer from .toke...
315
import argparse import logging import sys from unittest.mock import patch import run_glue_deebert from transformers.testing_utils import TestCasePlus, get_gpu_count, require_torch_non_multi_gpu, slow logging.basicConfig(level=logging.DEBUG) a__ : Optional[Any] = logging.getLogger() def _lowe...
622
0
def UpperCAmelCase ( a_ = 5_0 ) -> Any: """simple docstring""" __A = [1] * (length + 1) for row_length in range(3 , length + 1 ): for block_length in range(3 , row_length + 1 ): for block_start in range(row_length - block_length ...
55
import json import os import unittest from transformers.models.ctrl.tokenization_ctrl import VOCAB_FILES_NAMES, CTRLTokenizer from ...test_tokenization_common import TokenizerTesterMixin class UpperCAmelCase__( lowerCamelCase , unittest.TestCase ): '''simple docstring''' A : int ...
622
0
'''simple docstring''' def lowerCAmelCase_ ( snake_case__ ): '''simple docstring''' A : Dict = abs(A__ ) A : Any = 0 while n > 0: res += n % 10 n //= 10 return res def lowerCAmelCase_ ( snake_case_...
634
from argparse import ArgumentParser from .add_new_model import AddNewModelCommand from .add_new_model_like import AddNewModelLikeCommand from .convert import ConvertCommand from .download import DownloadCommand from .env import EnvironmentCommand from .lfs import LfsCommands from .pt_to_tf import PTtoTFCommand fro...
622
0
from __future__ import annotations import requests __magic_name__ : List[Any] = set( """approved_at_utc approved_by author_flair_background_color\nauthor_flair_css_class author_flair_richtext author_flair_template_id author_fullname\nauthor_premium can_mod_post category clicked content_...
615
import pytest import requests from datasets.utils.file_utils import http_head from .utils import OfflineSimulationMode, RequestWouldHangIndefinitelyError, offline @pytest.mark.integration def _lowerCAmelCase ( ): with offline(OfflineSimulationMode.CONNECTION_TIMES_OUT ): with pytest.ra...
622
0
lowerCAmelCase__ :Tuple = "Tobias Carryer" from time import time class __a : def __init__( self , _SCREAMING_SNAKE_CASE , _SCREAMING_SNAKE_CASE , _SCREAMING_SNAKE_CASE , _SCREAMING_SNAKE_CASE=int(time() ) ) -> List[Any]: # noqa: B008 ...
618
def _lowerCAmelCase ( A__ = 600_851_475_143 ): try: lowercase__ = int(A__ ) except (TypeError, ValueError): raise TypeError('Parameter n must be int or castable to int.' ) if n <= 0: raise ValueError('Parameter n must be greater than or equa...
622
0
"""simple docstring""" import argparse import os import torch from transformers.utils import WEIGHTS_NAME __A = ["small", "medium", "large"] __A = "lm_head.decoder.weight" __A = "lm_head.weight" def a__ ( __SCREAMING_SNAKE_CASE , __SCRE...
346
from __future__ import annotations def _lowerCAmelCase ( A__ , A__ = None ): lowercase__ = word_bank or [] # create a table lowercase__ = len(A__ ) + 1 lowercase__ = [] for _ in range(A__ ): table.append([] ) # seed value lowercas...
622
0
from __future__ import annotations def lowerCamelCase_ ( lowerCAmelCase: Dict , lowerCAmelCase: List[Any] , lowerCAmelCase: Union[str, Any] , lowerCAmelCase: int , lowerCAmelCase: Optional[int] , )-> Union[str, Any]: _snake_case : Tu...
411
a__ : Tuple = "Tobias Carryer" from time import time class UpperCAmelCase__: '''simple docstring''' def __init__( self : str , lowerCAmelCase : List[str] , lowerCAmelCase : Any , lowerCAmelCase : str , lowerCAmelCase : ...
622
0
import gc import random import unittest import numpy as np import torch from transformers import ( CLIPImageProcessor, CLIPTextConfig, CLIPTextModel, CLIPTokenizer, CLIPVisionConfig, CLIPVisionModelWithProjection, ) from diffusers import AutoencoderKL, DDIMScheduler, DDPMScheduler, Stab...
367
import warnings from ...utils import logging from .image_processing_glpn import GLPNImageProcessor a__ : Optional[Any] = logging.get_logger(__name__) class UpperCAmelCase__( lowerCamelCase ): '''simple docstring''' def __init__( self : Optional[Any] , *l...
622
0
from __future__ import annotations from collections.abc import Callable _lowercase = list[list[float | int]] def SCREAMING_SNAKE_CASE_ ( UpperCAmelCase_ : Optional[Any] , UpperCAmelCase_ : str ) -> int: SCREAMING_SNAKE_CASE_ : Optional[Any] =l...
443
import random import unittest import torch from diffusers import IFImgaImgSuperResolutionPipeline from diffusers.utils import floats_tensor from diffusers.utils.import_utils import is_xformers_available from diffusers.utils.testing_utils import skip_mps, torch_device from ..pipeline_params import TEXT_GUIDED_IMA...
622
0
from typing import TYPE_CHECKING from ...utils import ( OptionalDependencyNotAvailable, _LazyModule, is_torch_available, ) UpperCamelCase = { "configuration_mega": ["MEGA_PRETRAINED_CONFIG_ARCHIVE_MAP", "MegaConfig", "MegaOnnxConfig"], } try: if not is_torch_availabl...
520
import unittest from transformers.models.xlm_prophetnet.tokenization_xlm_prophetnet import SPIECE_UNDERLINE, XLMProphetNetTokenizer from transformers.testing_utils import get_tests_dir, require_sentencepiece, slow from transformers.utils import cached_property from ...test_tokenization_common import TokenizerTest...
622
0
'''simple docstring''' import json import os import tempfile import datasets from utils import generate_example_dataset, get_duration __magic_name__ : Any =5_00_00 __magic_name__ : List[Any] =50_00 __magic_name__ : Optional[int] =os.path.split(__file__) __magic_name__ : Optional[int] =os.path.joi...
664
from math import sqrt def _lowerCAmelCase ( A__ ): assert isinstance(A__ , A__ ) and ( number >= 0 ), "'number' must been an int and positive" lowercase__ = True # 0 and 1 are none primes. if number <= 1: lowercase__ = False for diviso...
622
0
import os from shutil import copyfile from typing import Any, Dict, List, Optional, Tuple import sentencepiece as spm from ...tokenization_utils import AddedToken, PreTrainedTokenizer from ...utils import logging _A : List[str] = logging.get_logger(__name__) _A : Any = {...
315
import argparse import torch from transformers import ( EncodecConfig, EncodecFeatureExtractor, EncodecModel, logging, ) # checkpoints downloaded from: # https://dl.fbaipublicfiles.com/encodec/v0/encodec_24khz-d7cc33bc.th # https://huggingface.co/facebook/musicgen-small/resolve/main/compression_...
622
0
import json import os import unittest from transformers.models.ctrl.tokenization_ctrl import VOCAB_FILES_NAMES, CTRLTokenizer from ...test_tokenization_common import TokenizerTesterMixin class UpperCAmelCase ( __SCREAMING_SNAKE_CASE , unittest.TestCase ): '''simple docstring''' snak...
55
# 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 # # Unless required by appli...
622
0
'''simple docstring''' from typing import TYPE_CHECKING from ...utils import OptionalDependencyNotAvailable, _LazyModule, is_sentencepiece_available lowercase : Optional[int] = {} try: if not is_sentencepiece_available(): raise OptionalDependencyNotAva...
634
def _lowerCAmelCase ( A__ = 50_000_000 ): lowercase__ = set() lowercase__ = int((limit - 24) ** (1 / 2) ) lowercase__ = set(range(3 , prime_square_limit + 1 , 2 ) ) primes.add(2 ) for p in range(3 , prime_square_limit + 1 , 2 ): ...
622
0
def a_ ( __lowerCAmelCase ): if len(A__ ) <= 1: return lst lowerCAmelCase__ = 1 while i < len(A__ ): if lst[i - 1] <= lst[i]: i += 1 else: lowerCAmelCase__ , lowerCAmelCase__ = lst[i], lst[i - 1] i -= 1 ...
615
from collections import OrderedDict from typing import Any, Mapping, Optional from ... import PreTrainedTokenizer from ...configuration_utils import PretrainedConfig from ...onnx import OnnxConfig, OnnxConfigWithPast, OnnxSeqaSeqConfigWithPast from ...onnx.utils import compute_effective_axis_dimension from ...util...
622
0
import argparse import shutil import time from json import JSONDecodeError from logging import getLogger from pathlib import Path from typing import Dict, List import torch from torch.utils.data import DataLoader from tqdm import tqdm from transformers import AutoModelForSeqaSeqLM, AutoTokenizer from utils import ...
618
from sklearn.metrics import matthews_corrcoef import datasets a__ : Any = "\nCompute the Matthews correlation coefficient (MCC)\n\nThe Matthews correlation coefficient is used in machine learning as a\nmeasure of the quality of binary and multiclass classifications. It takes\ninto account true a...
622
0
"""simple docstring""" import json from typing import List, Optional, Tuple from tokenizers import pre_tokenizers, processors from ...tokenization_utils_base import AddedToken, BatchEncoding from ...tokenization_utils_fast import PreTrainedTokenizerFast from ...utils import logging from .tokenization...
346
import inspect import unittest from transformers import ViTHybridConfig from transformers.testing_utils import require_accelerate, require_torch, require_vision, slow, torch_device from transformers.utils import cached_property, is_torch_available, is_vision_available from ...test_configuration_common import Conf...
622
0
import os import unicodedata from shutil import copyfile from typing import Any, Dict, List, Optional, Tuple import sentencepiece as spm from ...tokenization_utils import AddedToken, PreTrainedTokenizer from ...utils import logging lowerCAmelCase_ = logging.get_logger(__name__) lowerCAmelCase_ = ...
411
from datasets.utils.patching import _PatchedModuleObj, patch_submodule from . import _test_patching def _lowerCAmelCase ( ): import os as original_os from os import path as original_path from os import rename as original_rename from os.path import dirname as original_dirname from...
622
0
from collections import OrderedDict from typing import Mapping from ...configuration_utils import PretrainedConfig from ...onnx import OnnxConfig from ...utils import logging lowerCamelCase : Tuple = logging.get_logger(__name__) lowerCamelCase : Union[str, Any] = { "...
367
import os import unittest from transformers.models.cpmant.tokenization_cpmant import VOCAB_FILES_NAMES, CpmAntTokenizer from transformers.testing_utils import require_jieba, tooslow from ...test_tokenization_common import TokenizerTesterMixin @require_jieba class UpperCAmelCase__( lowerCamelCase , un...
622
0
from __future__ import annotations from math import pow, sqrt def SCREAMING_SNAKE_CASE_ ( UpperCAmelCase_ : Any , UpperCAmelCase_ : Optional[int] , UpperCAmelCase_ : Any ) -> Union[str, Any]: if (resistance, reactance, impedance).count(0 ) != 1: ...
443
import argparse import requests import torch from PIL import Image from transformers import SwinConfig, SwinForMaskedImageModeling, ViTImageProcessor def _lowerCAmelCase ( A__ ): lowercase__ = SwinConfig(image_size=192 ) if "base" in model_name: lowercase__ = 6 ...
622
0
import json import os import pickle import shutil import tempfile from unittest import TestCase from unittest.mock import patch import numpy as np from datasets import Dataset from transformers import is_faiss_available from transformers.models.bart.configuration_bart import BartConfig from transformers....
520
import os import unicodedata from shutil import copyfile from typing import Any, Dict, List, Optional, Tuple import sentencepiece as spm from ...tokenization_utils import AddedToken, PreTrainedTokenizer from ...utils import logging a__ : Optional[int] = logging.get_logger(__name__) a__ : ...
622
0
'''simple docstring''' # XXX: we want transformers master here - in the absense of conftest manipulating sys.path: # hack it in for now: import sys from pathlib import Path __magic_name__ : str =Path(__file__).resolve().parents[3] / "src" sys.path.insert(1, str(git_repo_path)) import dataclasses # noqa impor...
664
from __future__ import annotations import copy import inspect import unittest import numpy as np from transformers import is_tf_available, is_vision_available from transformers.models.auto import get_values from transformers.testing_utils import require_tf, slow from transformers.utils import cached_property fr...
622
0
import gc import random import unittest import numpy as np import torch from transformers import CLIPTextConfig, CLIPTextModel, CLIPTextModelWithProjection, CLIPTokenizer from diffusers import ( AutoencoderKL, DiffusionPipeline, EulerDiscreteScheduler, StableDiffusionXLImgaImgPipeline, UNeta...
315
import argparse import logging import sys from unittest.mock import patch import run_glue_deebert from transformers.testing_utils import TestCasePlus, get_gpu_count, require_torch_non_multi_gpu, slow logging.basicConfig(level=logging.DEBUG) a__ : Optional[Any] = logging.getLogger() def _lowe...
622
0
import os import tempfile import unittest import numpy as np from diffusers.utils import is_flax_available from diffusers.utils.testing_utils import require_flax, slow if is_flax_available(): import jax import jax.numpy as jnp from flax.jax_utils import replicate from flax.training.common_utils...
55
import json import os import unittest from transformers.models.ctrl.tokenization_ctrl import VOCAB_FILES_NAMES, CTRLTokenizer from ...test_tokenization_common import TokenizerTesterMixin class UpperCAmelCase__( lowerCamelCase , unittest.TestCase ): '''simple docstring''' A : int ...
622
0
'''simple docstring''' import inspect import unittest from transformers import RegNetConfig, is_flax_available from transformers.testing_utils import require_flax, slow from transformers.utils import cached_property, is_vision_available from ...test_configuration_common import ConfigTester from ......
634
from argparse import ArgumentParser from .add_new_model import AddNewModelCommand from .add_new_model_like import AddNewModelLikeCommand from .convert import ConvertCommand from .download import DownloadCommand from .env import EnvironmentCommand from .lfs import LfsCommands from .pt_to_tf import PTtoTFCommand fro...
622
0
from collections import namedtuple import requests from lxml import html # type: ignore __magic_name__ : Tuple = namedtuple("""covid_data""", """cases deaths recovered""") def a_ ( __lowerCAmelCase = "https://www.worldometers.info/coronavirus/" ): lowerCAmelCase__ =...
615
import pytest import requests from datasets.utils.file_utils import http_head from .utils import OfflineSimulationMode, RequestWouldHangIndefinitelyError, offline @pytest.mark.integration def _lowerCAmelCase ( ): with offline(OfflineSimulationMode.CONNECTION_TIMES_OUT ): with pytest.ra...
622
0
import unittest from parameterized import parameterized from transformers import AutoTokenizer, GPTNeoXConfig, is_torch_available, set_seed from transformers.testing_utils import require_torch, slow, torch_device from ...generation.test_utils import GenerationTesterMixin from ...test_configuration_common import C...
618
def _lowerCAmelCase ( A__ = 600_851_475_143 ): try: lowercase__ = int(A__ ) except (TypeError, ValueError): raise TypeError('Parameter n must be int or castable to int.' ) if n <= 0: raise ValueError('Parameter n must be greater than or equa...
622
0
"""simple docstring""" import math import os import unittest from transformers import MegatronBertConfig, is_torch_available from transformers.models.auto import get_values from transformers.testing_utils import require_sentencepiece, require_tokenizers, require_torch, slow, torch_device from ...test...
346
from __future__ import annotations def _lowerCAmelCase ( A__ , A__ = None ): lowercase__ = word_bank or [] # create a table lowercase__ = len(A__ ) + 1 lowercase__ = [] for _ in range(A__ ): table.append([] ) # seed value lowercas...
622
0
import logging import os from typing import List, TextIO, Union from conllu import parse_incr from utils_ner import InputExample, Split, TokenClassificationTask lowerCAmelCase_ = logging.getLogger(__name__) class _lowerCAmelCase ( UpperCAmelCase_ ): '''simple docstring''' ...
411
a__ : Tuple = "Tobias Carryer" from time import time class UpperCAmelCase__: '''simple docstring''' def __init__( self : str , lowerCAmelCase : List[str] , lowerCAmelCase : Any , lowerCAmelCase : str , lowerCAmelCase : ...
622
0
def __lowerCAmelCase ( __snake_case , __snake_case , __snake_case ): def update_area_of_max_square(__snake_case , __snake_case ) -> int: # BASE CASE if row >= rows or col >= cols: return 0 __lowerCAmelCase ...
367
import warnings from ...utils import logging from .image_processing_glpn import GLPNImageProcessor a__ : Optional[Any] = logging.get_logger(__name__) class UpperCAmelCase__( lowerCamelCase ): '''simple docstring''' def __init__( self : Optional[Any] , *l...
622
0
from __future__ import annotations from collections.abc import Iterator from typing import Generic, TypeVar _lowercase = TypeVar("""T""") class lowercase_ ( Generic[T] ): def __init__( self , __A ) -> int: SCREAMING_SNAKE_CASE...
443
import random import unittest import torch from diffusers import IFImgaImgSuperResolutionPipeline from diffusers.utils import floats_tensor from diffusers.utils.import_utils import is_xformers_available from diffusers.utils.testing_utils import skip_mps, torch_device from ..pipeline_params import TEXT_GUIDED_IMA...
622
0
import tempfile import torch from diffusers import ( DEISMultistepScheduler, DPMSolverMultistepScheduler, DPMSolverSinglestepScheduler, UniPCMultistepScheduler, ) from .test_schedulers import SchedulerCommonTest class _a ( lowerCAmelCase__ ): '''simple docstring''' lo...
520
import unittest from transformers.models.xlm_prophetnet.tokenization_xlm_prophetnet import SPIECE_UNDERLINE, XLMProphetNetTokenizer from transformers.testing_utils import get_tests_dir, require_sentencepiece, slow from transformers.utils import cached_property from ...test_tokenization_common import TokenizerTest...
622
0
'''simple docstring''' import dataclasses import re import string from typing import Any, Dict, Iterator, List, Mapping, Optional, Sequence, Tuple import numpy as np from . import residue_constants __magic_name__ : int =Mapping[str, np.ndarray] __magic_name__ : Tuple =Mapping[str, Any] # Is a nested dic...
664
from math import sqrt def _lowerCAmelCase ( A__ ): assert isinstance(A__ , A__ ) and ( number >= 0 ), "'number' must been an int and positive" lowercase__ = True # 0 and 1 are none primes. if number <= 1: lowercase__ = False for diviso...
622
0
from typing import Dict, Optional, Union import numpy as np from ...image_processing_utils import BaseImageProcessor, BatchFeature, get_size_dict from ...image_transforms import flip_channel_order, resize, to_channel_dimension_format, to_pil_image from ...image_utils import ( ChannelDimension, ImageInpu...
315
import argparse import torch from transformers import ( EncodecConfig, EncodecFeatureExtractor, EncodecModel, logging, ) # checkpoints downloaded from: # https://dl.fbaipublicfiles.com/encodec/v0/encodec_24khz-d7cc33bc.th # https://huggingface.co/facebook/musicgen-small/resolve/main/compression_...
622
0
import torch from torch import nn from torch.nn import CrossEntropyLoss, MSELoss from transformers.file_utils import add_start_docstrings, add_start_docstrings_to_model_forward from transformers.models.bert.modeling_bert import ( BERT_INPUTS_DOCSTRING, BERT_START_DOCSTRING, BertEmbeddings, BertLayer, ...
55
# 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 # # Unless required by appli...
622
0
'''simple docstring''' import os from glob import glob import imageio import torch import torchvision import wandb from img_processing import custom_to_pil, loop_post_process, preprocess, preprocess_vqgan from loaders import load_vqgan from PIL import Image from torch import nn from transformer...
634
def _lowerCAmelCase ( A__ = 50_000_000 ): lowercase__ = set() lowercase__ = int((limit - 24) ** (1 / 2) ) lowercase__ = set(range(3 , prime_square_limit + 1 , 2 ) ) primes.add(2 ) for p in range(3 , prime_square_limit + 1 , 2 ): ...
622
0
import unittest from transformers import load_tool from .test_tools_common import ToolTesterMixin class SCREAMING_SNAKE_CASE__ (unittest.TestCase , _a ): def A__ ( self : str ): """simple docstring""" lowerCAmelCase__ =...
615
from collections import OrderedDict from typing import Any, Mapping, Optional from ... import PreTrainedTokenizer from ...configuration_utils import PretrainedConfig from ...onnx import OnnxConfig, OnnxConfigWithPast, OnnxSeqaSeqConfigWithPast from ...onnx.utils import compute_effective_axis_dimension from ...util...
622
0
import copy from ...configuration_utils import PretrainedConfig from ...utils import logging from ..auto.configuration_auto import CONFIG_MAPPING lowerCAmelCase__ :Union[str, Any] = logging.get_logger(__name__) class __a ( UpperCAmelCase ): _a : List[str] = "u...
618
from sklearn.metrics import matthews_corrcoef import datasets a__ : Any = "\nCompute the Matthews correlation coefficient (MCC)\n\nThe Matthews correlation coefficient is used in machine learning as a\nmeasure of the quality of binary and multiclass classifications. It takes\ninto account true a...
622
0
"""simple docstring""" import numpy as np class snake_case : def __init__( self : int)-> int: '''simple docstring''' __lowerCAmelCase: Optional[int] = (0, 0) __lowerCAmelCase: Optional[Any] = None __low...
346
import inspect import unittest from transformers import ViTHybridConfig from transformers.testing_utils import require_accelerate, require_torch, require_vision, slow, torch_device from transformers.utils import cached_property, is_torch_available, is_vision_available from ...test_configuration_common import Conf...
622
0
import torch from diffusers import DDPMScheduler from .test_schedulers import SchedulerCommonTest class _lowerCAmelCase ( UpperCAmelCase_ ): '''simple docstring''' a_ : List[str] =(DDPMScheduler,) def UpperCamelCase_ ( self : Dict , **Uppe...
411
from datasets.utils.patching import _PatchedModuleObj, patch_submodule from . import _test_patching def _lowerCAmelCase ( ): import os as original_os from os import path as original_path from os import rename as original_rename from os.path import dirname as original_dirname from...
622
0
import argparse import json from pathlib import Path import requests import timm import torch from huggingface_hub import hf_hub_download from PIL import Image from transformers import AutoImageProcessor, SwinvaConfig, SwinvaForImageClassification def __lowerCAmelCase ( __snake_case ): ...
367
import os import unittest from transformers.models.cpmant.tokenization_cpmant import VOCAB_FILES_NAMES, CpmAntTokenizer from transformers.testing_utils import require_jieba, tooslow from ...test_tokenization_common import TokenizerTesterMixin @require_jieba class UpperCAmelCase__( lowerCamelCase , un...
622
0
def SCREAMING_SNAKE_CASE_ ( UpperCAmelCase_ : List[str] ) -> int: return credit_card_number.startswith(('''34''', '''35''', '''37''', '''4''', '''5''', '''6''') ) def SCREAMING_SNAKE_CASE_ ( UpperCAmelCase_ : Dict ) -> Union[str, Any]: SCREAMING_SN...
443
import argparse import requests import torch from PIL import Image from transformers import SwinConfig, SwinForMaskedImageModeling, ViTImageProcessor def _lowerCAmelCase ( A__ ): lowercase__ = SwinConfig(image_size=192 ) if "base" in model_name: lowercase__ = 6 ...
622
0
import logging import torch from accelerate import Accelerator from arguments import EvaluationArguments from datasets import load_dataset from torch.utils.data import IterableDataset from torch.utils.data.dataloader import DataLoader from transformers import AutoModelForCausalLM, AutoTokenizer, HfArgumentPa...
520
import os import unicodedata from shutil import copyfile from typing import Any, Dict, List, Optional, Tuple import sentencepiece as spm from ...tokenization_utils import AddedToken, PreTrainedTokenizer from ...utils import logging a__ : Optional[int] = logging.get_logger(__name__) a__ : ...
622
0
'''simple docstring''' from dataclasses import dataclass from typing import Optional import numpy as np import torch import torch.nn as nn from ..utils import BaseOutput, is_torch_version, randn_tensor from .attention_processor import SpatialNorm from .unet_ad_blocks import UNetMidBlockaD, get_down_block, get_up_b...
664
from __future__ import annotations import copy import inspect import unittest import numpy as np from transformers import is_tf_available, is_vision_available from transformers.models.auto import get_values from transformers.testing_utils import require_tf, slow from transformers.utils import cached_property fr...
622
0
def _a ( UpperCAmelCase = 50 ) -> Dict: """simple docstring""" lowerCamelCase__ : str = [[0] * 3 for _ in range(length + 1 )] for row_length in range(length + 1 ): for tile_length in range(2 , 5 ): for tile_start in range(row_length - tile_leng...
315
import argparse import logging import sys from unittest.mock import patch import run_glue_deebert from transformers.testing_utils import TestCasePlus, get_gpu_count, require_torch_non_multi_gpu, slow logging.basicConfig(level=logging.DEBUG) a__ : Optional[Any] = logging.getLogger() def _lowe...
622
0
from math import loga def UpperCAmelCase ( a_ ) -> Dict: """simple docstring""" if a < 0: raise ValueError("Input value must be a positive integer" ) elif isinstance(A__ , A__ ): raise TypeError("Input value must be a \'int\' type" ) return 0 i...
55
import json import os import unittest from transformers.models.ctrl.tokenization_ctrl import VOCAB_FILES_NAMES, CTRLTokenizer from ...test_tokenization_common import TokenizerTesterMixin class UpperCAmelCase__( lowerCamelCase , unittest.TestCase ): '''simple docstring''' A : int ...
622
0
'''simple docstring''' def lowerCAmelCase_ ( ): '''simple docstring''' A : Tuple = [] A : str = 1 while len(A__ ) < 1E6: constant.append(str(A__ ) ) i += 1 A : int = ''''''.join(A__ ) return ( int(...
634
from argparse import ArgumentParser from .add_new_model import AddNewModelCommand from .add_new_model_like import AddNewModelLikeCommand from .convert import ConvertCommand from .download import DownloadCommand from .env import EnvironmentCommand from .lfs import LfsCommands from .pt_to_tf import PTtoTFCommand fro...
622
0
# Copyright 2023 The HuggingFace Inc. 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 # # Unles...
615
import pytest import requests from datasets.utils.file_utils import http_head from .utils import OfflineSimulationMode, RequestWouldHangIndefinitelyError, offline @pytest.mark.integration def _lowerCAmelCase ( ): with offline(OfflineSimulationMode.CONNECTION_TIMES_OUT ): with pytest.ra...
622
0
import math import os from copy import deepcopy import datasets import evaluate import torch import transformers from datasets import load_dataset from torch.utils.data import DataLoader from transformers import AutoModelForSequenceClassification, AutoTokenizer from accelerate import Accelerator from accelerate.te...
618
def _lowerCAmelCase ( A__ = 600_851_475_143 ): try: lowercase__ = int(A__ ) except (TypeError, ValueError): raise TypeError('Parameter n must be int or castable to int.' ) if n <= 0: raise ValueError('Parameter n must be greater than or equa...
622
0
"""simple docstring""" from datetime import datetime as dt import os from github import Github __A = [ "good first issue", "good second issue", "good difficult issue", "feature request", "new model", "wip", ] def a__ ( ) -> ...
346
from __future__ import annotations def _lowerCAmelCase ( A__ , A__ = None ): lowercase__ = word_bank or [] # create a table lowercase__ = len(A__ ) + 1 lowercase__ = [] for _ in range(A__ ): table.append([] ) # seed value lowercas...
622
0
from __future__ import absolute_import, division, print_function, unicode_literals from torch import nn from torch.nn import CrossEntropyLoss, MSELoss from transformers import RobertaConfig from transformers.file_utils import add_start_docstrings, add_start_docstrings_to_model_forward from transformers.models.r...
411
a__ : Tuple = "Tobias Carryer" from time import time class UpperCAmelCase__: '''simple docstring''' def __init__( self : str , lowerCAmelCase : List[str] , lowerCAmelCase : Any , lowerCAmelCase : str , lowerCAmelCase : ...
622
0
from sklearn.metrics import recall_score import datasets lowerCamelCase : Optional[int] = "\nRecall is the fraction of the positive examples that were correctly labeled by the model as positive. It can be computed with the equation:\nRecall = TP / (TP + FN)\nWhere TP is the true positives a...
367
import warnings from ...utils import logging from .image_processing_glpn import GLPNImageProcessor a__ : Optional[Any] = logging.get_logger(__name__) class UpperCAmelCase__( lowerCamelCase ): '''simple docstring''' def __init__( self : Optional[Any] , *l...
622
0
from ...configuration_utils import PretrainedConfig from ...utils import logging _lowercase = logging.get_logger(__name__) _lowercase = { "google/realm-cc-news-pretrained-embedder": ( "https://huggingface.co/google/realm-cc-news-pretrained-embedder/resolve/main/config....
443
import random import unittest import torch from diffusers import IFImgaImgSuperResolutionPipeline from diffusers.utils import floats_tensor from diffusers.utils.import_utils import is_xformers_available from diffusers.utils.testing_utils import skip_mps, torch_device from ..pipeline_params import TEXT_GUIDED_IMA...
622
0
import unittest from transformers import MODEL_FOR_DOCUMENT_QUESTION_ANSWERING_MAPPING, AutoTokenizer, is_vision_available from transformers.pipelines import pipeline from transformers.pipelines.document_question_answering import apply_tesseract from transformers.testing_utils import ( is_pipeline_test, ...
520
import unittest from transformers.models.xlm_prophetnet.tokenization_xlm_prophetnet import SPIECE_UNDERLINE, XLMProphetNetTokenizer from transformers.testing_utils import get_tests_dir, require_sentencepiece, slow from transformers.utils import cached_property from ...test_tokenization_common import TokenizerTest...
622
0
'''simple docstring''' from collections import OrderedDict from typing import Any, List, Mapping, Optional from ... import PreTrainedTokenizer, TensorType, is_torch_available from ...configuration_utils import PretrainedConfig from ...onnx import OnnxConfigWithPast, PatchingSpec from ...utils import logging __mag...
664
from math import sqrt def _lowerCAmelCase ( A__ ): assert isinstance(A__ , A__ ) and ( number >= 0 ), "'number' must been an int and positive" lowercase__ = True # 0 and 1 are none primes. if number <= 1: lowercase__ = False for diviso...
622
0
import os from collections.abc import Iterator def _a ( UpperCAmelCase = "." ) -> Tuple: """simple docstring""" for dir_path, dir_names, filenames in os.walk(A__ ): lowerCamelCase__ : List[Any] = [d for d in dir_names if d != '''scripts''' and d[0] not in '''._...
315
import argparse import torch from transformers import ( EncodecConfig, EncodecFeatureExtractor, EncodecModel, logging, ) # checkpoints downloaded from: # https://dl.fbaipublicfiles.com/encodec/v0/encodec_24khz-d7cc33bc.th # https://huggingface.co/facebook/musicgen-small/resolve/main/compression_...
622
0
import unittest from transformers.models.xlm_prophetnet.tokenization_xlm_prophetnet import SPIECE_UNDERLINE, XLMProphetNetTokenizer from transformers.testing_utils import get_tests_dir, require_sentencepiece, slow from transformers.utils import cached_property from ...test_tokenization_common import TokenizerTesterM...
55
# 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 # # Unless required by appli...
622
0
'''simple docstring''' from typing import TYPE_CHECKING from ...utils import OptionalDependencyNotAvailable, _LazyModule, is_torch_available lowercase : Union[str, Any] = { "configuration_clipseg": [ "CLIPSEG_PRETRAINED_CONFIG_ARCHIVE_MAP", "CLIPSegCon...
634
def _lowerCAmelCase ( A__ = 50_000_000 ): lowercase__ = set() lowercase__ = int((limit - 24) ** (1 / 2) ) lowercase__ = set(range(3 , prime_square_limit + 1 , 2 ) ) primes.add(2 ) for p in range(3 , prime_square_limit + 1 , 2 ): ...
622
0
def a_ ( ): return [ a * b * (10_00 - a - b) for a in range(1 , 9_99 ) for b in range(A__ , 9_99 ) if (a * a + b * b == (10_00 - a - b) ** 2) ][0] if __name__ == "__main__": print(F"{solution() = }")
615
from collections import OrderedDict from typing import Any, Mapping, Optional from ... import PreTrainedTokenizer from ...configuration_utils import PretrainedConfig from ...onnx import OnnxConfig, OnnxConfigWithPast, OnnxSeqaSeqConfigWithPast from ...onnx.utils import compute_effective_axis_dimension from ...util...
622
0
from __future__ import annotations import copy import inspect import unittest import numpy as np from transformers import is_tf_available, is_vision_available from transformers.models.auto import get_values from transformers.testing_utils import require_tf, slow from transformers.utils import cached_property fro...
618
from sklearn.metrics import matthews_corrcoef import datasets a__ : Any = "\nCompute the Matthews correlation coefficient (MCC)\n\nThe Matthews correlation coefficient is used in machine learning as a\nmeasure of the quality of binary and multiclass classifications. It takes\ninto account true a...
622
0
"""simple docstring""" from typing import List import jiwer import jiwer.transforms as tr from packaging import version import datasets from datasets.config import PY_VERSION if PY_VERSION < version.parse("3.8"): import importlib_metadata else: import importlib.metadata as importlib_meta...
346
import inspect import unittest from transformers import ViTHybridConfig from transformers.testing_utils import require_accelerate, require_torch, require_vision, slow, torch_device from transformers.utils import cached_property, is_torch_available, is_vision_available from ...test_configuration_common import Conf...
622
0
from typing import TYPE_CHECKING # rely on isort to merge the imports from ...utils import OptionalDependencyNotAvailable, _LazyModule, is_torch_available lowerCAmelCase_ = { "configuration_autoformer": [ "AUTOFORMER_PRETRAINED_CONFIG_ARCHIVE_MAP", "AutoformerConfig", ], } try:...
411
from datasets.utils.patching import _PatchedModuleObj, patch_submodule from . import _test_patching def _lowerCAmelCase ( ): import os as original_os from os import path as original_path from os import rename as original_rename from os.path import dirname as original_dirname from...
622
0
from math import sqrt def __lowerCAmelCase ( __snake_case ): assert isinstance(A__ , A__ ) and ( number >= 0 ), "'number' must been an int and positive" __lowerCAmelCase = True # 0 and 1 are none primes. if number <= 1: ...
367
import os import unittest from transformers.models.cpmant.tokenization_cpmant import VOCAB_FILES_NAMES, CpmAntTokenizer from transformers.testing_utils import require_jieba, tooslow from ...test_tokenization_common import TokenizerTesterMixin @require_jieba class UpperCAmelCase__( lowerCamelCase , un...
622
0
import json import os import subprocess import unittest from ast import literal_eval import pytest from parameterized import parameterized_class from . import is_sagemaker_available if is_sagemaker_available(): from sagemaker import Session, TrainingJobAnalytics from sagemaker.huggingface import H...
443
import argparse import requests import torch from PIL import Image from transformers import SwinConfig, SwinForMaskedImageModeling, ViTImageProcessor def _lowerCAmelCase ( A__ ): lowercase__ = SwinConfig(image_size=192 ) if "base" in model_name: lowercase__ = 6 ...
622
0
import os import sys import tempfile import torch from .state import AcceleratorState from .utils import PrecisionType, PrepareForLaunch, is_mps_available, patch_environment def lowerCamelCase_ ( _lowercase , _lowercase=() , _lowercase=None , _lowercase="no" , ...
520
import os import unicodedata from shutil import copyfile from typing import Any, Dict, List, Optional, Tuple import sentencepiece as spm from ...tokenization_utils import AddedToken, PreTrainedTokenizer from ...utils import logging a__ : Optional[int] = logging.get_logger(__name__) a__ : ...
622
0
'''simple docstring''' def __snake_case ( lowerCamelCase_ : Tuple ): '''simple docstring''' return sum(i for i in range(1 , number // 2 + 1 ) if number % i == 0 ) == number if __name__ == "__main__": print('Program to check whether a number is a Perfect number or...
664
from __future__ import annotations import copy import inspect import unittest import numpy as np from transformers import is_tf_available, is_vision_available from transformers.models.auto import get_values from transformers.testing_utils import require_tf, slow from transformers.utils import cached_property fr...
622
0
import sys from collections import defaultdict class __SCREAMING_SNAKE_CASE : def __init__( self : List[Any] ) ->Optional[int]: lowerCamelCase__ : Tuple = [] def __lowerCamelCase ( self : Optional[Any] , A : Tuple ) ->s...
315
import argparse import logging import sys from unittest.mock import patch import run_glue_deebert from transformers.testing_utils import TestCasePlus, get_gpu_count, require_torch_non_multi_gpu, slow logging.basicConfig(level=logging.DEBUG) a__ : Optional[Any] = logging.getLogger() def _lowe...
622
0
from collections import OrderedDict from typing import Any, Mapping, Optional from ... import PreTrainedTokenizer from ...configuration_utils import PretrainedConfig from ...onnx import OnnxConfig, OnnxConfigWithPast, OnnxSeqaSeqConfigWithPast from ...onnx.utils import compute_effective_axis_dimension from ...utils i...
55
import json import os import unittest from transformers.models.ctrl.tokenization_ctrl import VOCAB_FILES_NAMES, CTRLTokenizer from ...test_tokenization_common import TokenizerTesterMixin class UpperCAmelCase__( lowerCamelCase , unittest.TestCase ): '''simple docstring''' A : int ...
622
0
'''simple docstring''' from .integrations import ( is_optuna_available, is_ray_available, is_sigopt_available, is_wandb_available, run_hp_search_optuna, run_hp_search_ray, run_hp_search_sigopt, run_hp_search_wandb, ) from .trainer_utils import ( HPSearchBackend,...
634
from argparse import ArgumentParser from .add_new_model import AddNewModelCommand from .add_new_model_like import AddNewModelLikeCommand from .convert import ConvertCommand from .download import DownloadCommand from .env import EnvironmentCommand from .lfs import LfsCommands from .pt_to_tf import PTtoTFCommand fro...
622
0
import logging import os import sys from dataclasses import dataclass, field from itertools import chain from typing import Optional, Union import datasets import numpy as np import torch from datasets import load_dataset import transformers from transformers import ( AutoConfig, Auto...
615
import pytest import requests from datasets.utils.file_utils import http_head from .utils import OfflineSimulationMode, RequestWouldHangIndefinitelyError, offline @pytest.mark.integration def _lowerCAmelCase ( ): with offline(OfflineSimulationMode.CONNECTION_TIMES_OUT ): with pytest.ra...
622
0
def lowerCAmelCase__ ( a__: Optional[Any] , a__: Dict , a__: List[str]=False ) -> List[str]: '''simple docstring''' if isinstance(A__ , A__ ) and isinstance(A__ , A__ ): _UpperCAmelCase = len(set_a.in...
618
def _lowerCAmelCase ( A__ = 600_851_475_143 ): try: lowercase__ = int(A__ ) except (TypeError, ValueError): raise TypeError('Parameter n must be int or castable to int.' ) if n <= 0: raise ValueError('Parameter n must be greater than or equa...
622
0
"""simple docstring""" import argparse import datetime import json import time import warnings from logging import getLogger from pathlib import Path from typing import Dict, List import torch from tqdm import tqdm from transformers import AutoModelForSeqaSeqLM, AutoTokenizer from utils import c...
346
from __future__ import annotations def _lowerCAmelCase ( A__ , A__ = None ): lowercase__ = word_bank or [] # create a table lowercase__ = len(A__ ) + 1 lowercase__ = [] for _ in range(A__ ): table.append([] ) # seed value lowercas...
622
0
from math import asin, atan, cos, radians, sin, sqrt, tan lowerCAmelCase_ = 637_8137.0 lowerCAmelCase_ = 635_6752.31_4245 lowerCAmelCase_ = 637_8137 def lowerCamelCase_ ( lowerCAmelCase: int , lowerCAmelCase: Union[str, Any] , lowerCAmelCase: Any...
411
a__ : Tuple = "Tobias Carryer" from time import time class UpperCAmelCase__: '''simple docstring''' def __init__( self : str , lowerCAmelCase : List[str] , lowerCAmelCase : Any , lowerCAmelCase : str , lowerCAmelCase : ...
622
0
from typing import TYPE_CHECKING from ...utils import ( OptionalDependencyNotAvailable, _LazyModule, is_tf_available, is_tokenizers_available, is_torch_available, ) lowerCamelCase : Dict = { "configuration_deberta": ["DEBERTA_PRETRAINED_CONFIG_ARCHIVE_MAP", "DebertaC...
367
import warnings from ...utils import logging from .image_processing_glpn import GLPNImageProcessor a__ : Optional[Any] = logging.get_logger(__name__) class UpperCAmelCase__( lowerCamelCase ): '''simple docstring''' def __init__( self : Optional[Any] , *l...
622
0
from typing import TYPE_CHECKING from ...utils import OptionalDependencyNotAvailable, _LazyModule, is_torch_available _lowercase = { "configuration_bigbird_pegasus": [ "BIGBIRD_PEGASUS_PRETRAINED_CONFIG_ARCHIVE_MAP", "BigBirdPegasusConfig", "BigBirdPegasusOnnxConfi...
443
import random import unittest import torch from diffusers import IFImgaImgSuperResolutionPipeline from diffusers.utils import floats_tensor from diffusers.utils.import_utils import is_xformers_available from diffusers.utils.testing_utils import skip_mps, torch_device from ..pipeline_params import TEXT_GUIDED_IMA...
622
0
def lowerCamelCase_ ( _lowercase , _lowercase = False ) -> Union[str, Any]: if not isinstance(A__ , A__ ): __A : Union[str, Any] = F"Expected string as input, found {type(A__ )}" raise ValueError(A__ ) if not isinstance(A__ , ...
520
import unittest from transformers.models.xlm_prophetnet.tokenization_xlm_prophetnet import SPIECE_UNDERLINE, XLMProphetNetTokenizer from transformers.testing_utils import get_tests_dir, require_sentencepiece, slow from transformers.utils import cached_property from ...test_tokenization_common import TokenizerTest...
622
0
'''simple docstring''' from pathlib import Path import fire def __snake_case ( lowerCamelCase_ : Dict , lowerCamelCase_ : Any , lowerCamelCase_ : Optional[Any] ): '''simple docstring''' __magic_name__ = Path(A__ ) __magic_name__ = P...
664
from math import sqrt def _lowerCAmelCase ( A__ ): assert isinstance(A__ , A__ ) and ( number >= 0 ), "'number' must been an int and positive" lowercase__ = True # 0 and 1 are none primes. if number <= 1: lowercase__ = False for diviso...
622
0
import math def _a ( ) -> Tuple: """simple docstring""" lowerCamelCase__ : Dict = input('''Enter message: ''' ) lowerCamelCase__ : List[str] = int(input(f"Enter key [2-{len(A__ ) - 1}]: " ) ) lowerCamelCase__ : List[Any] = input('''Encryption/...
315
import argparse import torch from transformers import ( EncodecConfig, EncodecFeatureExtractor, EncodecModel, logging, ) # checkpoints downloaded from: # https://dl.fbaipublicfiles.com/encodec/v0/encodec_24khz-d7cc33bc.th # https://huggingface.co/facebook/musicgen-small/resolve/main/compression_...
622
0