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
from typing import Dict, List, Optional, Union import numpy as np from ...image_processing_utils import BaseImageProcessor, BatchFeature, get_size_dict from ...image_transforms import ( center_crop, get_resize_output_image_size, normalize, rescale, resize, to_channel_dimen...
61
'''simple docstring''' 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, ) if is_sentencepiece_available(): from ..ta...
13
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_image_inputs if is_torch_available(): import t...
62
'''simple docstring''' import re from typing import Callable, List, Optional, Union import tensorflow as tf try: from tensorflow.keras.optimizers.legacy import Adam except ImportError: from tensorflow.keras.optimizers import Adam class UpperCAmelCase_ (tf.keras.optimizers.schedules.Learni...
13
0
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_flax_available(): ...
63
'''simple docstring''' import collections import inspect import unittest from typing import Dict, List, Tuple from transformers import MaskFormerSwinConfig from transformers.testing_utils import require_torch, require_torch_multi_gpu, torch_device from transformers.utils import is_torch_available from ...test_b...
13
0
import warnings from ...processing_utils import ProcessorMixin from ...tokenization_utils_base import BatchEncoding class _lowerCamelCase ( UpperCamelCase_ ): __a = ["image_processor", "tokenizer"] __a = "CLIPImageProcessor" __a = ("CLIPTokenizer", "CLIPTokenizerFast") ...
64
'''simple docstring''' from .dependency_versions_table import deps from .utils.versions import require_version, require_version_core # define which module versions we always want to check at run time # (usually the ones defined in `install_requires` in setup.py) # # order specific notes: # - tqdm must be checke...
13
0
"""simple docstring""" import json from typing import List, Optional, Tuple from tokenizers import normalizers from ...tokenization_utils_fast import PreTrainedTokenizerFast from .tokenization_electra import ElectraTokenizer __UpperCAmelCase = {'vocab_file': 'vocab.txt', 'tokenizer_file'...
65
'''simple docstring''' # coding=utf-8 # Copyright 2023 The HuggingFace Inc. team. # # 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 # # ...
13
0
import warnings from ...utils import logging from .image_processing_clip import CLIPImageProcessor UpperCamelCase = logging.get_logger(__name__) class lowerCAmelCase_ ( __snake_case ): def __init__( self , *_lowerCAmelCase , **_lowerCAmelCase ): warnings.war...
66
'''simple docstring''' from collections import namedtuple import requests from lxml import html # type: ignore A__ : Tuple = namedtuple("""covid_data""", """cases deaths recovered""") def UpperCAmelCase__ ( UpperCAmelCase_ : str = "https://www.worldometers.info/coronavir...
13
0
import gc import math import unittest import torch from diffusers import UNetaDModel from diffusers.utils import floats_tensor, logging, slow, torch_all_close, torch_device from diffusers.utils.testing_utils import enable_full_determinism from .test_modeling_common import ModelTesterMixin, UNet...
67
'''simple docstring''' from __future__ import annotations import os from collections.abc import Mapping A__ : Optional[Any] = tuple[int, int] class UpperCAmelCase_ : """simple docstring""" def __init__( self , SCREAMING_SNAKE_CASE_ , SCREAMING_SNAKE_CASE_ ...
13
0
from ..utils import DummyObject, requires_backends class _A ( metaclass=UpperCamelCase ): """simple docstring""" lowerCamelCase : Tuple = ['torch', 'torchsde'] def __init__( self : str , *__SCREAMING_SNAKE_CASE : Dict , **__SCREAMING_SNAKE_CAS...
68
'''simple docstring''' from collections.abc import Generator from math import sin def UpperCAmelCase__ ( UpperCAmelCase_ : bytes ) -> bytes: if len(UpperCAmelCase_ ) != 32: raise ValueError('Input must be of length 32' ) __lowerCamelCase : Dict ...
13
0
'''simple docstring''' 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, ) a : Union[str, An...
69
'''simple docstring''' from ...configuration_utils import PretrainedConfig from ...utils import logging A__ : Tuple = logging.get_logger(__name__) A__ : Dict = { """RWKV/rwkv-4-169m-pile""": """https://huggingface.co/RWKV/rwkv-4-169m-pile/resolve/main/config.json""", """RWKV/r...
13
0
# flake8: noqa # Lint as: python3 lowerCamelCase : Any = [ "VerificationMode", "Version", "disable_progress_bar", "enable_progress_bar", "is_progress_bar_enabled", "experimental", ] from .info_utils import VerificationMode from .logging import disabl...
70
'''simple docstring''' def UpperCAmelCase__ ( UpperCAmelCase_ : int = 10_00 ) -> int: __lowerCamelCase : Union[str, Any] = 3 __lowerCamelCase : Dict = 0 while a < n: if a % 3 == 0 or a % 5 == 0: ...
13
0
'''simple docstring''' from math import factorial def a__ ( _SCREAMING_SNAKE_CASE : int , _SCREAMING_SNAKE_CASE : int ) -> int: """simple docstring""" if n < k or k < 0: raise ValueError("Please enter positive integers for n and k where n >= k" )...
71
'''simple docstring''' from __future__ import annotations import unittest from transformers import XGLMConfig, XGLMTokenizer, is_tf_available from transformers.testing_utils import require_tf, slow from ...test_configuration_common import ConfigTester from ...test_modeling_tf_common import TFModelTesterMixin, ...
13
0
'''simple docstring''' import os import pytest from datasets import ( get_dataset_config_info, get_dataset_config_names, get_dataset_infos, get_dataset_split_names, inspect_dataset, inspect_metric, ) _UpperCAmelCase : Any = pytest.mark.integration @pytest.mark.parametrize('''path''...
72
'''simple docstring''' from dataclasses import asdict, dataclass from typing import Optional from ...configuration_utils import PretrainedConfig from ...utils import logging A__ : List[str] = logging.get_logger(__name__) # TODO Update this A__ : Tuple = { """facebook/esm-1b""": "...
13
0
import math from ...configuration_utils import PretrainedConfig from ...utils import logging a_ : int = logging.get_logger(__name__) a_ : Optional[Any] = { 'facebook/data2vec-base-960h': 'https://huggingface.co/facebook/data2vec-audio-base-960h/resolve/main/config.json',...
73
'''simple docstring''' A__ : dict[tuple[int, int, int], int] = {} def UpperCAmelCase__ ( UpperCAmelCase_ : int , UpperCAmelCase_ : int , UpperCAmelCase_ : int ) -> int: # if we are absent twice, or late 3 consecutive days, ...
13
0
# Usage: # ./gen-card-facebook-wmt19.py import os from pathlib import Path def a__ ( snake_case , snake_case , snake_case ): """simple docstring""" __SCREAMING_SNAKE_CASE : Optional[Any] = { '''en''': '''Machine learning is great, isn\'t it?''', ...
74
'''simple docstring''' # Lint as: python3 import dataclasses import re from dataclasses import dataclass from functools import total_ordering from typing import Optional, Union A__ : Any = re.compile(R"""^(?P<major>\d+)""" R"""\.(?P<minor>\d+)""" R"""\.(?P<patch>\d+)$""") @total_ordering @data...
13
0
'''simple docstring''' def a__ ( lowerCAmelCase__ = 1_00_00_00 ) -> int: UpperCAmelCase__ : str = 1 UpperCAmelCase__ : int = 1 UpperCAmelCase__ : int = {1: 1} for inputa in range(2 , lowerCAmelCase__ ): ...
75
'''simple docstring''' import sys from collections import defaultdict class UpperCAmelCase_ : """simple docstring""" def __init__( self ) -> int: __lowerCamelCase : Any = [] def lowercase_ ( self , SCREAMING_SNAKE...
13
0
"""simple docstring""" from typing import Union import fire import torch from tqdm import tqdm def __UpperCAmelCase ( __UpperCamelCase , __UpperCamelCase = "cpu" , __UpperCamelCase = None ): __lowercase : str = torch.load(__UpperCamelCase , ma...
76
'''simple docstring''' def UpperCAmelCase__ ( UpperCAmelCase_ : int = 1_00 ) -> int: __lowerCamelCase : Union[str, Any] = n * (n + 1) * (2 * n + 1) / 6 __lowerCamelCase : Union[str, Any] = (n * (n + 1) / 2) ** 2 return ...
13
0
"""simple docstring""" import torch from transformers import CamembertForMaskedLM, CamembertTokenizer def _UpperCamelCase ( UpperCamelCase , UpperCamelCase , UpperCamelCase , UpperCamelCase=5 ) -> Optional[Any]: """simple docstring""" # Adap...
77
'''simple docstring''' import inspect import unittest import numpy as np from transformers import ViTConfig, is_flax_available from transformers.testing_utils import require_flax, slow from ...test_configuration_common import ConfigTester from ...test_modeling_flax_common import FlaxModelTesterMixin, floats_te...
13
0
'''simple docstring''' from ...utils import ( OptionalDependencyNotAvailable, is_torch_available, is_transformers_available, is_transformers_version, ) try: if not (is_transformers_available() and is_torch_available() and is_transformers_version('>=', '4.25.0')): raise OptionalDepende...
78
'''simple docstring''' import argparse A__ : Optional[Any] = """docs/source/_static/js/custom.js""" def UpperCAmelCase__ ( UpperCAmelCase_ : Optional[int] ) -> int: with open(UpperCAmelCase_ , encoding='utf-8' , newline='\n' ) as f: _...
13
0
from pathlib import PurePosixPath from typing import Optional import fsspec from fsspec import AbstractFileSystem from huggingface_hub.hf_api import DatasetInfo from ..utils.file_utils import get_authentication_headers_for_url from ..utils.hub import hf_hub_url class UpperCAme...
79
'''simple docstring''' import flax.linen as nn import jax import jax.numpy as jnp class UpperCAmelCase_ (nn.Module ): """simple docstring""" lowerCamelCase : int lowerCamelCase : jnp.dtype = jnp.floataa def lowercase_ ( self ) -...
13
0
import os import tempfile import unittest from transformers import DistilBertConfig, is_torch_available from transformers.testing_utils import require_torch, require_torch_gpu, slow, torch_device from ...test_configuration_common import ConfigTester from ...test_modeling_common import ModelTesterMixin, ids_ten...
80
'''simple docstring''' from __future__ import annotations A__ : int = 10 def UpperCAmelCase__ ( UpperCAmelCase_ : list[int] ) -> list[int]: __lowerCamelCase : List[Any] = 1 __lowerCamelCase : Any = max(Upper...
13
0
from typing import List, Optional, Union import numpy as np import tensorflow as tf from .utils import logging _snake_case : List[str] = logging.get_logger(__name__) def lowerCAmelCase_ ( __lowerCamelCase ): if isinstance(__lowerCamelCase , np.ndarray )...
81
'''simple docstring''' from collections import defaultdict from math import gcd def UpperCAmelCase__ ( UpperCAmelCase_ : int = 1_50_00_00 ) -> int: __lowerCamelCase : defaultdict = defaultdict(UpperCAmelCase_ ) __lowerCamelCase : Any ...
13
0
"""simple docstring""" from ...configuration_utils import PretrainedConfig from ...utils import logging lowerCamelCase = logging.get_logger(__name__) lowerCamelCase = { """s-JoL/Open-Llama-V1""": """https://huggingface.co/s-JoL/Open-Llama-V1/blob/main/config.json""", } class...
82
'''simple docstring''' 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 RoFor...
13
0
"""simple docstring""" import os import time import numpy as np import onnxruntime as ort lowerCAmelCase__ = '''1''' lowerCAmelCase__ = '''0''' lowerCAmelCase__ = '''1''' lowerCAmelCase__ = ort.SessionOptions() lowerCAmelCase__ ...
83
'''simple docstring''' 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, ) if is_sentencepiece_available(): from ..ta...
13
0
from collections import defaultdict from math import ceil, sqrt def UpperCAmelCase_ ( __SCREAMING_SNAKE_CASE = 100_0000 , __SCREAMING_SNAKE_CASE = 10 ): lowercase = defaultdict(__SCREAMING_SNAKE_CASE ) for outer_width in range(3 , (t_limit // 4) + 2 ): if outer_w...
84
'''simple docstring''' import re from typing import Callable, List, Optional, Union import tensorflow as tf try: from tensorflow.keras.optimizers.legacy import Adam except ImportError: from tensorflow.keras.optimizers import Adam class UpperCAmelCase_ (tf.keras.optimizers.schedules.Learni...
13
0
import json import unittest import numpy as np from huggingface_hub import hf_hub_download 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_im...
85
'''simple docstring''' import collections import inspect import unittest from typing import Dict, List, Tuple from transformers import MaskFormerSwinConfig from transformers.testing_utils import require_torch, require_torch_multi_gpu, torch_device from transformers.utils import is_torch_available from ...test_b...
13
0
def __snake_case ( __UpperCamelCase : list[list[int]] ,__UpperCamelCase : int ,__UpperCamelCase : int ,__UpperCamelCase : set ): """simple docstring""" A_ , A_ = len(__UpperCamelCase ), len(grid[0] ) if ( min(__UpperCamelCase ,__...
86
'''simple docstring''' from .dependency_versions_table import deps from .utils.versions import require_version, require_version_core # define which module versions we always want to check at run time # (usually the ones defined in `install_requires` in setup.py) # # order specific notes: # - tqdm must be checke...
13
0
import inspect import unittest from transformers import RegNetConfig from transformers.file_utils import cached_property, is_torch_available, is_vision_available from transformers.testing_utils import require_torch, require_vision, slow, torch_device from ...test_configuration_common import ConfigTester from ......
87
'''simple docstring''' # coding=utf-8 # Copyright 2023 The HuggingFace Inc. team. # # 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 # # ...
13
0
"""simple docstring""" from __future__ import annotations def _snake_case ( __snake_case : list[int] , __snake_case : int , __snake_case : int , __snake_case : int ): """simple docstring""" if (direction == 1...
88
'''simple docstring''' from collections import namedtuple import requests from lxml import html # type: ignore A__ : Tuple = namedtuple("""covid_data""", """cases deaths recovered""") def UpperCAmelCase__ ( UpperCAmelCase_ : str = "https://www.worldometers.info/coronavir...
13
0
import argparse import os from transformers.utils import direct_transformers_import # All paths are set with the intent you should run this script from the root of the repo with the command # python utils/check_task_guides.py SCREAMING_SNAKE_CASE : int = "src/transformers" SCREAMING_SNAKE_CASE : Opt...
89
'''simple docstring''' from __future__ import annotations import os from collections.abc import Mapping A__ : Optional[Any] = tuple[int, int] class UpperCAmelCase_ : """simple docstring""" def __init__( self , SCREAMING_SNAKE_CASE_ , SCREAMING_SNAKE_CASE_ ...
13
0
'''simple docstring''' import gc import tempfile import unittest import numpy as np import torch from diffusers import VersatileDiffusionPipeline from diffusers.utils.testing_utils import load_image, nightly, require_torch_gpu, torch_device __UpperCAmelCase = False ...
90
'''simple docstring''' from collections.abc import Generator from math import sin def UpperCAmelCase__ ( UpperCAmelCase_ : bytes ) -> bytes: if len(UpperCAmelCase_ ) != 32: raise ValueError('Input must be of length 32' ) __lowerCamelCase : Dict ...
13
0
"""simple docstring""" from copy import deepcopy class lowerCAmelCase_ : '''simple docstring''' def __init__( self : Optional[Any] ,A_ : list[int] | None = None ,A_ : int | None = None ) -> None: if arr is None and size is not None: A = size ...
91
'''simple docstring''' from ...configuration_utils import PretrainedConfig from ...utils import logging A__ : Tuple = logging.get_logger(__name__) A__ : Dict = { """RWKV/rwkv-4-169m-pile""": """https://huggingface.co/RWKV/rwkv-4-169m-pile/resolve/main/config.json""", """RWKV/r...
13
0
'''simple docstring''' def _lowerCAmelCase ( __magic_name__ : int , __magic_name__ : int ) -> int: return int(input_a == input_a == 0 ) def _lowerCAmelCase ( ) -> None: print('''Truth Table of NOR Gate:''' ) print('''| Input 1 ...
92
'''simple docstring''' def UpperCAmelCase__ ( UpperCAmelCase_ : int = 10_00 ) -> int: __lowerCamelCase : Union[str, Any] = 3 __lowerCamelCase : Dict = 0 while a < n: if a % 3 == 0 or a % 5 == 0: ...
13
0
"""simple docstring""" from __future__ import annotations def __A (_SCREAMING_SNAKE_CASE ) ->list[int]: """simple docstring""" lowerCAmelCase__ :str = [True] * limit lowerCAmelCase__ :Optional[int] = False lowerCAmelCase__ :str = F...
93
'''simple docstring''' from __future__ import annotations import unittest from transformers import XGLMConfig, XGLMTokenizer, is_tf_available from transformers.testing_utils import require_tf, slow from ...test_configuration_common import ConfigTester from ...test_modeling_tf_common import TFModelTesterMixin, ...
13
0
'''simple docstring''' from __future__ import annotations SCREAMING_SNAKE_CASE = { 'A': ['B', 'C', 'E'], 'B': ['A', 'D', 'E'], 'C': ['A', 'F', 'G'], 'D': ['B'], 'E': ['A', 'B', 'D'], 'F': ['C'], 'G': ['C'], } class UpperCAmelCase_ : """simple docstring""...
94
'''simple docstring''' from dataclasses import asdict, dataclass from typing import Optional from ...configuration_utils import PretrainedConfig from ...utils import logging A__ : List[str] = logging.get_logger(__name__) # TODO Update this A__ : Tuple = { """facebook/esm-1b""": "...
13
0
"""simple docstring""" import argparse from typing import Dict import tensorflow as tf import torch from tqdm import tqdm from transformers import BigBirdPegasusConfig, BigBirdPegasusForConditionalGeneration lowerCamelCase_ = [ # tf -> hf ('''/''', '''.'''), ('''layer_''', '''layers.'...
95
'''simple docstring''' A__ : dict[tuple[int, int, int], int] = {} def UpperCAmelCase__ ( UpperCAmelCase_ : int , UpperCAmelCase_ : int , UpperCAmelCase_ : int ) -> int: # if we are absent twice, or late 3 consecutive days, ...
13
0
"""simple docstring""" from collections import OrderedDict from typing import List, Mapping from packaging import version from ...configuration_utils import PretrainedConfig from ...onnx import OnnxConfig from ...utils import logging __lowerCamelCase = logging.get_logger(__...
96
'''simple docstring''' # Lint as: python3 import dataclasses import re from dataclasses import dataclass from functools import total_ordering from typing import Optional, Union A__ : Any = re.compile(R"""^(?P<major>\d+)""" R"""\.(?P<minor>\d+)""" R"""\.(?P<patch>\d+)$""") @total_ordering @data...
13
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 Tokenizer...
97
'''simple docstring''' import sys from collections import defaultdict class UpperCAmelCase_ : """simple docstring""" def __init__( self ) -> int: __lowerCamelCase : Any = [] def lowercase_ ( self , SCREAMING_SNAKE...
13
0
'''simple docstring''' import datasets from .evaluate import evaluate lowercase__ : int = '\\n@article{hendrycks2021cuad,\n title={CUAD: An Expert-Annotated NLP Dataset for Legal Contract Review},\n author={Dan Hendrycks and Collin Burns and Anya Chen and Spencer Ball},\n journal={...
98
'''simple docstring''' def UpperCAmelCase__ ( UpperCAmelCase_ : int = 1_00 ) -> int: __lowerCamelCase : Union[str, Any] = n * (n + 1) * (2 * n + 1) / 6 __lowerCamelCase : Union[str, Any] = (n * (n + 1) / 2) ** 2 return ...
13
0
import warnings from diffusers import StableDiffusionImgaImgPipeline # noqa F401 warnings.warn( 'The `image_to_image.py` script is outdated. Please use directly `from diffusers import' ' StableDiffusionImg2ImgPipeline` instead.' )
99
'''simple docstring''' import inspect import unittest import numpy as np from transformers import ViTConfig, is_flax_available from transformers.testing_utils import require_flax, slow from ...test_configuration_common import ConfigTester from ...test_modeling_flax_common import FlaxModelTesterMixin, floats_te...
13
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 # # Unless required b...
100
'''simple docstring''' import argparse A__ : Optional[Any] = """docs/source/_static/js/custom.js""" def UpperCAmelCase__ ( UpperCAmelCase_ : Optional[int] ) -> int: with open(UpperCAmelCase_ , encoding='utf-8' , newline='\n' ) as f: _...
13
0
import webbrowser from sys import argv from urllib.parse import parse_qs, quote import requests from bsa import BeautifulSoup from fake_useragent import UserAgent if __name__ == "__main__": lowerCAmelCase__ : Optional[int] ='%20'.join(argv[1:]) if len(argv) > 1 else quote(str(input('S...
101
'''simple docstring''' import flax.linen as nn import jax import jax.numpy as jnp class UpperCAmelCase_ (nn.Module ): """simple docstring""" lowerCamelCase : int lowerCamelCase : jnp.dtype = jnp.floataa def lowercase_ ( self ) -...
13
0
"""simple docstring""" from typing import TYPE_CHECKING from ....utils import _LazyModule __magic_name__ : Any = {"""tokenization_tapex""": ["""TapexTokenizer"""]} if TYPE_CHECKING: from .tokenization_tapex import TapexTokenizer else: import sys __magic_nam...
102
'''simple docstring''' from __future__ import annotations A__ : int = 10 def UpperCAmelCase__ ( UpperCAmelCase_ : list[int] ) -> list[int]: __lowerCamelCase : List[Any] = 1 __lowerCamelCase : Any = max(Upper...
13
0
"""simple docstring""" import logging from pathlib import Path import numpy as np import pytorch_lightning as pl import torch from pytorch_lightning.callbacks import EarlyStopping, ModelCheckpoint from pytorch_lightning.utilities import rank_zero_only from utils_rag import save_json ...
103
'''simple docstring''' from collections import defaultdict from math import gcd def UpperCAmelCase__ ( UpperCAmelCase_ : int = 1_50_00_00 ) -> int: __lowerCamelCase : defaultdict = defaultdict(UpperCAmelCase_ ) __lowerCamelCase : Any ...
13
0
"""simple docstring""" import logging import os from typing import List, TextIO, Union from conllu import parse_incr from utils_ner import InputExample, Split, TokenClassificationTask UpperCamelCase = logging.getLogger(__name__) class UpperCamelCase__ ( ...
104
'''simple docstring''' 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 RoFor...
13
0
import logging 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, BertEncoder...
105
'''simple docstring''' 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, ) if is_sentencepiece_available(): from ..ta...
13
0
import argparse import json import os import fairseq import torch from fairseq.data import Dictionary from transformers import ( UniSpeechConfig, UniSpeechForCTC, UniSpeechForPreTraining, WavaVecaFeatureExtractor, WavaVecaPhonemeCTCTokenizer, WavaVecaProcessor, logging, ) logging.set...
106
'''simple docstring''' import re from typing import Callable, List, Optional, Union import tensorflow as tf try: from tensorflow.keras.optimizers.legacy import Adam except ImportError: from tensorflow.keras.optimizers import Adam class UpperCAmelCase_ (tf.keras.optimizers.schedules.Learni...
13
0
'''simple docstring''' from datetime import datetime as dt import os from github import Github _UpperCAmelCase : str = [ '''good first issue''', '''good second issue''', '''good difficult issue''', '''feature request''', '''new model''', '''wip''', ] def _SCRE...
107
'''simple docstring''' import collections import inspect import unittest from typing import Dict, List, Tuple from transformers import MaskFormerSwinConfig from transformers.testing_utils import require_torch, require_torch_multi_gpu, torch_device from transformers.utils import is_torch_available from ...test_b...
13
0
from unittest import TestCase from datasets import Sequence, Value from datasets.arrow_dataset import Dataset class SCREAMING_SNAKE_CASE__ ( UpperCAmelCase ): '''simple docstring''' def lowerCamelCase ( self : List[str] ) -> Dict: """simple docstring""" ...
108
'''simple docstring''' from .dependency_versions_table import deps from .utils.versions import require_version, require_version_core # define which module versions we always want to check at run time # (usually the ones defined in `install_requires` in setup.py) # # order specific notes: # - tqdm must be checke...
13
0
'''simple docstring''' from __future__ import annotations class __a : def __init__( self : Optional[int] ,lowerCamelCase : list[list[int]] ): '''simple docstring''' __SCREAMING_SNAKE_CASE = TypeError( """Matrices must be formed ...
109
'''simple docstring''' # coding=utf-8 # Copyright 2023 The HuggingFace Inc. team. # # 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 # # ...
13
0
"""simple docstring""" def lowerCamelCase ( _snake_case ): if not isinstance(_snake_case ,_snake_case ): raise ValueError('Input must be an integer' ) if input_num <= 0: raise ValueError('Input must be positive' ) return sum( divisor for divisor in range(1 ,input...
110
'''simple docstring''' from collections import namedtuple import requests from lxml import html # type: ignore A__ : Tuple = namedtuple("""covid_data""", """cases deaths recovered""") def UpperCAmelCase__ ( UpperCAmelCase_ : str = "https://www.worldometers.info/coronavir...
13
0
import argparse import logging import os from datetime import datetime import numpy as np import torch from torch import nn from torch.utils.data import DataLoader, RandomSampler, TensorDataset from tqdm import tqdm from transformers import GPTaLMHeadModel snake_case_ = loggi...
592
'''simple docstring''' from __future__ import annotations import os from collections.abc import Mapping A__ : Optional[Any] = tuple[int, int] class UpperCAmelCase_ : """simple docstring""" def __init__( self , SCREAMING_SNAKE_CASE_ , SCREAMING_SNAKE_CASE_ ...
13
0
import collections import inspect import unittest from typing import Dict, List, Tuple from transformers import MaskFormerSwinConfig from transformers.testing_utils import require_torch, require_torch_multi_gpu, torch_device from transformers.utils import is_torch_available from ...test_backbone_common import Back...
170
'''simple docstring''' from collections.abc import Generator from math import sin def UpperCAmelCase__ ( UpperCAmelCase_ : bytes ) -> bytes: if len(UpperCAmelCase_ ) != 32: raise ValueError('Input must be of length 32' ) __lowerCamelCase : Dict ...
13
0
'''simple docstring''' import unittest from pathlib import Path from tempfile import TemporaryDirectory from transformers import AutoConfig, TFAutoModel, is_tensorflow_text_available, is_tf_available from transformers.models.bert.tokenization_bert import BertTokenizer from transformers.testing_utils import require_t...
451
'''simple docstring''' from ...configuration_utils import PretrainedConfig from ...utils import logging A__ : Tuple = logging.get_logger(__name__) A__ : Dict = { """RWKV/rwkv-4-169m-pile""": """https://huggingface.co/RWKV/rwkv-4-169m-pile/resolve/main/config.json""", """RWKV/r...
13
0
from math import asin, atan, cos, radians, sin, sqrt, tan UpperCamelCase_ = 6_37_81_37.0 UpperCamelCase_ = 6_35_67_52.31_42_45 UpperCamelCase_ = 6_37_81_37 def _lowerCamelCase ( lowerCamelCase_: float , lowerCamelCase_: float , lowerCamelC...
256
'''simple docstring''' def UpperCAmelCase__ ( UpperCAmelCase_ : int = 10_00 ) -> int: __lowerCamelCase : Union[str, Any] = 3 __lowerCamelCase : Dict = 0 while a < n: if a % 3 == 0 or a % 5 == 0: ...
13
0
"""simple docstring""" from typing import TYPE_CHECKING from ...utils import ( OptionalDependencyNotAvailable, _LazyModule, is_torch_available, ) A = { """configuration_gpt_bigcode""": ["""GPT_BIGCODE_PRETRAINED_CONFIG_ARCHIVE_MAP""", """GPTBigCodeConfig"""], } try: if not is...
77
'''simple docstring''' from __future__ import annotations import unittest from transformers import XGLMConfig, XGLMTokenizer, is_tf_available from transformers.testing_utils import require_tf, slow from ...test_configuration_common import ConfigTester from ...test_modeling_tf_common import TFModelTesterMixin, ...
13
0
'''simple docstring''' from dataclasses import asdict, dataclass from typing import Optional from ...configuration_utils import PretrainedConfig from ...utils import logging __SCREAMING_SNAKE_CASE : List[str] = logging.get_logger(__name__) # TODO Update this __SCREAMING_SNAKE_CASE : Tuple ...
452
'''simple docstring''' from dataclasses import asdict, dataclass from typing import Optional from ...configuration_utils import PretrainedConfig from ...utils import logging A__ : List[str] = logging.get_logger(__name__) # TODO Update this A__ : Tuple = { """facebook/esm-1b""": "...
13
0
"""simple docstring""" from collections.abc import Generator from math import sin def _lowerCamelCase ( UpperCAmelCase_ : bytes ) -> bytes: """simple docstring""" if len(UpperCAmelCase_ ) != 32: raise ValueError("Input must be of lengt...
104
'''simple docstring''' A__ : dict[tuple[int, int, int], int] = {} def UpperCAmelCase__ ( UpperCAmelCase_ : int , UpperCAmelCase_ : int , UpperCAmelCase_ : int ) -> int: # if we are absent twice, or late 3 consecutive days, ...
13
0
from . import ( albert, align, altclip, audio_spectrogram_transformer, auto, autoformer, bark, bart, barthez, bartpho, beit, bert, bert_generation, bert_japanese, bertweet, big_bird, bigbird_pegasus, biogpt, bit, blenderbot, blen...
181
'''simple docstring''' # Lint as: python3 import dataclasses import re from dataclasses import dataclass from functools import total_ordering from typing import Optional, Union A__ : Any = re.compile(R"""^(?P<major>\d+)""" R"""\.(?P<minor>\d+)""" R"""\.(?P<patch>\d+)$""") @total_ordering @data...
13
0
import flax.linen as nn import jax import jax.numpy as jnp class __lowerCAmelCase ( nn.Module ): _a = 42 _a = jnp.floataa def A__ ( self ) -> Union[str, Any]: '''simple docstring''' _lowercase =nn.Conv...
291
'''simple docstring''' import sys from collections import defaultdict class UpperCAmelCase_ : """simple docstring""" def __init__( self ) -> int: __lowerCamelCase : Any = [] def lowercase_ ( self , SCREAMING_SNAKE...
13
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 ( SwiftFormerConfig, SwiftFormerForImageClassification, ViTImageProcessor, ) from transformers.utils import logging logging.set...
191
'''simple docstring''' def UpperCAmelCase__ ( UpperCAmelCase_ : int = 1_00 ) -> int: __lowerCamelCase : Union[str, Any] = n * (n + 1) * (2 * n + 1) / 6 __lowerCamelCase : Union[str, Any] = (n * (n + 1) / 2) ** 2 return ...
13
0
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 class __lowerCAmelCas...
283
'''simple docstring''' import inspect import unittest import numpy as np from transformers import ViTConfig, is_flax_available from transformers.testing_utils import require_flax, slow from ...test_configuration_common import ConfigTester from ...test_modeling_flax_common import FlaxModelTesterMixin, floats_te...
13
0
import warnings from ...processing_utils import ProcessorMixin from ...tokenization_utils_base import BatchEncoding class SCREAMING_SNAKE_CASE__ ( _UpperCAmelCase ): A_ : Tuple = ['image_processor', 'tokenizer'] A_ : Union[str, Any] = 'CL...
592
'''simple docstring''' import argparse A__ : Optional[Any] = """docs/source/_static/js/custom.js""" def UpperCAmelCase__ ( UpperCAmelCase_ : Optional[int] ) -> int: with open(UpperCAmelCase_ , encoding='utf-8' , newline='\n' ) as f: _...
13
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 .tokeniz...
170
'''simple docstring''' import flax.linen as nn import jax import jax.numpy as jnp class UpperCAmelCase_ (nn.Module ): """simple docstring""" lowerCamelCase : int lowerCamelCase : jnp.dtype = jnp.floataa def lowercase_ ( self ) -...
13
0
'''simple docstring''' import sys __snake_case = ( """73167176531330624919225119674426574742355349194934""" """96983520312774506326239578318016984801869478851843""" """85861560789112949495459501737958331952853208805511""" """12540698747158523863050715693290963295227443043557""" """6689664...
451
'''simple docstring''' from __future__ import annotations A__ : int = 10 def UpperCAmelCase__ ( UpperCAmelCase_ : list[int] ) -> list[int]: __lowerCamelCase : List[Any] = 1 __lowerCamelCase : Any = max(Upper...
13
0
import logging import os from dataclasses import dataclass, field from functools import partial from pathlib import Path from tempfile import TemporaryDirectory from typing import List, Optional import faiss import torch from datasets import Features, Sequence, Value, load_dataset from transformers impo...
256
'''simple docstring''' from collections import defaultdict from math import gcd def UpperCAmelCase__ ( UpperCAmelCase_ : int = 1_50_00_00 ) -> int: __lowerCamelCase : defaultdict = defaultdict(UpperCAmelCase_ ) __lowerCamelCase : Any ...
13
0
"""simple docstring""" 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 if is_torch_available(): im...
77
'''simple docstring''' 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 RoFor...
13
0
'''simple docstring''' from __future__ import annotations import inspect import unittest import numpy as np from transformers import DeiTConfig from transformers.testing_utils import require_tf, require_vision, slow from transformers.utils import cached_property, is_tf_available, is_vision_available from ...test...
452
'''simple docstring''' 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, ) if is_sentencepiece_available(): from ..ta...
13
0
"""simple docstring""" import requests from bsa import BeautifulSoup def _lowerCamelCase ( UpperCAmelCase_ : str, UpperCAmelCase_ : dict ) -> str: """simple docstring""" A__ = BeautifulSoup(requests.get(UpperCAmelCase_, pa...
104
'''simple docstring''' import re from typing import Callable, List, Optional, Union import tensorflow as tf try: from tensorflow.keras.optimizers.legacy import Adam except ImportError: from tensorflow.keras.optimizers import Adam class UpperCAmelCase_ (tf.keras.optimizers.schedules.Learni...
13
0
from __future__ import annotations def _snake_case (_snake_case : int) -> bool: _lowercase =str(UpperCAmelCase_) return len(UpperCAmelCase_) == 9 and set(UpperCAmelCase_) == set('123456789') def _snake_case () -> int | None: for base_num in range...
181
'''simple docstring''' import collections import inspect import unittest from typing import Dict, List, Tuple from transformers import MaskFormerSwinConfig from transformers.testing_utils import require_torch, require_torch_multi_gpu, torch_device from transformers.utils import is_torch_available from ...test_b...
13
0
import argparse import copy def a ( A__ : Optional[Any] ) -> Optional[int]: """simple docstring""" _lowercase ={} with open(UpperCAmelCase_ ) as f: for line in f: if line.split()[0] not in dict_of_neighbours: ...
291
'''simple docstring''' from .dependency_versions_table import deps from .utils.versions import require_version, require_version_core # define which module versions we always want to check at run time # (usually the ones defined in `install_requires` in setup.py) # # order specific notes: # - tqdm must be checke...
13
0
from typing import Optional, Tuple, Union import torch from einops import rearrange, reduce from diffusers import DDIMScheduler, DDPMScheduler, DiffusionPipeline, ImagePipelineOutput, UNetaDConditionModel from diffusers.schedulers.scheduling_ddim import DDIMSchedulerOutput from diffusers.schedulers.scheduling_ddp...
191
'''simple docstring''' # coding=utf-8 # Copyright 2023 The HuggingFace Inc. team. # # 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 # # ...
13
0
import glob import os import random from string import ascii_lowercase, digits import cva import numpy as np # Parrameters SCREAMING_SNAKE_CASE :Optional[Any] = (7_20, 12_80) # Height, Width SCREAMING_SNAKE_CASE :int = (0.4, 0.6) # if height or width lower than this scale, drop it. ...
283
'''simple docstring''' from collections import namedtuple import requests from lxml import html # type: ignore A__ : Tuple = namedtuple("""covid_data""", """cases deaths recovered""") def UpperCAmelCase__ ( UpperCAmelCase_ : str = "https://www.worldometers.info/coronavir...
13
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 t...
592
'''simple docstring''' from __future__ import annotations import os from collections.abc import Mapping A__ : Optional[Any] = tuple[int, int] class UpperCAmelCase_ : """simple docstring""" def __init__( self , SCREAMING_SNAKE_CASE_ , SCREAMING_SNAKE_CASE_ ...
13
0
import copy import os from collections import OrderedDict from typing import TYPE_CHECKING, Any, Dict, Mapping, Optional, Union if TYPE_CHECKING: from ...processing_utils import ProcessorMixin from ...utils import TensorType from ...configuration_utils import PretrainedConfig from ...onnx import OnnxConfig from...
170
'''simple docstring''' from collections.abc import Generator from math import sin def UpperCAmelCase__ ( UpperCAmelCase_ : bytes ) -> bytes: if len(UpperCAmelCase_ ) != 32: raise ValueError('Input must be of length 32' ) __lowerCamelCase : Dict ...
13
0
'''simple docstring''' def A_ ( ) ->int: return 1 def A_ ( SCREAMING_SNAKE_CASE_ ) ->int: return 0 if x < 0 else two_pence(x - 2 ) + one_pence() def A_ ( SCREAMING_SNAKE_CASE_ ) ->int: return 0 if x < 0 else five_pence(x - 5 ) + two_pence(UpperC...
451
'''simple docstring''' from ...configuration_utils import PretrainedConfig from ...utils import logging A__ : Tuple = logging.get_logger(__name__) A__ : Dict = { """RWKV/rwkv-4-169m-pile""": """https://huggingface.co/RWKV/rwkv-4-169m-pile/resolve/main/config.json""", """RWKV/r...
13
0
import time from contextlib import contextmanager from pathlib import Path import pytest import requests from huggingface_hub.hf_api import HfApi, HfFolder UpperCamelCase_ = """__DUMMY_TRANSFORMERS_USER__""" UpperCamelCase_ = """Dummy User""" UpperCamelCase_ = """hf_hZEmnoO...
256
'''simple docstring''' def UpperCAmelCase__ ( UpperCAmelCase_ : int = 10_00 ) -> int: __lowerCamelCase : Union[str, Any] = 3 __lowerCamelCase : Dict = 0 while a < n: if a % 3 == 0 or a % 5 == 0: ...
13
0
"""simple docstring""" from random import shuffle import tensorflow as tf from numpy import array def _UpperCamelCase ( UpperCamelCase , UpperCamelCase ) -> List[str]: """simple docstring""" __UpperCAmelCase : str = int(UpperCAmelCase_ ...
77
'''simple docstring''' from __future__ import annotations import unittest from transformers import XGLMConfig, XGLMTokenizer, is_tf_available from transformers.testing_utils import require_tf, slow from ...test_configuration_common import ConfigTester from ...test_modeling_tf_common import TFModelTesterMixin, ...
13
0
'''simple docstring''' import unittest from transformers import GPTSwaTokenizer from transformers.testing_utils import get_tests_dir, require_sentencepiece, require_tokenizers, slow from ...test_tokenization_common import TokenizerTesterMixin __SCREAMING_SNAKE_CASE : str = get_tests_dir('''fixtur...
452
'''simple docstring''' from dataclasses import asdict, dataclass from typing import Optional from ...configuration_utils import PretrainedConfig from ...utils import logging A__ : List[str] = logging.get_logger(__name__) # TODO Update this A__ : Tuple = { """facebook/esm-1b""": "...
13
0
"""simple docstring""" from typing import TYPE_CHECKING from ....utils import OptionalDependencyNotAvailable, _LazyModule, is_torch_available UpperCamelCase = { """configuration_mctct""": ["""MCTCT_PRETRAINED_CONFIG_ARCHIVE_MAP""", """MCTCTConfig"""], """feature_extrac...
104
'''simple docstring''' A__ : dict[tuple[int, int, int], int] = {} def UpperCAmelCase__ ( UpperCAmelCase_ : int , UpperCAmelCase_ : int , UpperCAmelCase_ : int ) -> int: # if we are absent twice, or late 3 consecutive days, ...
13
0
_SCREAMING_SNAKE_CASE = { "km/h": 1.0, "m/s": 3.6, "mph": 1.60_9344, "knot": 1.852, } _SCREAMING_SNAKE_CASE = { "km/h": 1.0, "m/s": 0.2_7777_7778, "mph": 0.6_2137_1192, "knot": 0.5_3995_6803, } def _snake_case (_snake_case : float , _snake_cas...
181
'''simple docstring''' # Lint as: python3 import dataclasses import re from dataclasses import dataclass from functools import total_ordering from typing import Optional, Union A__ : Any = re.compile(R"""^(?P<major>\d+)""" R"""\.(?P<minor>\d+)""" R"""\.(?P<patch>\d+)$""") @total_ordering @data...
13
0
import os import time import pytest from datasets.utils.filelock import FileLock, Timeout def a ( A__ : Tuple ) -> int: """simple docstring""" _lowercase =FileLock(str(tmpdir / 'foo.lock' ) ) _lowercase =FileLock(str(tmpdir / 'foo.lock' )...
291
'''simple docstring''' import sys from collections import defaultdict class UpperCAmelCase_ : """simple docstring""" def __init__( self ) -> int: __lowerCamelCase : Any = [] def lowercase_ ( self , SCREAMING_SNAKE...
13
0
import inspect import unittest import numpy as np from transformers import ViTConfig, is_flax_available from transformers.testing_utils import require_flax, slow from ...test_configuration_common import ConfigTester from ...test_modeling_flax_common import FlaxModelTesterMixin, floats_tensor if is_flax_availab...
191
'''simple docstring''' def UpperCAmelCase__ ( UpperCAmelCase_ : int = 1_00 ) -> int: __lowerCamelCase : Union[str, Any] = n * (n + 1) * (2 * n + 1) / 6 __lowerCamelCase : Union[str, Any] = (n * (n + 1) / 2) ** 2 return ...
13
0
def _lowerCAmelCase ( lowerCAmelCase_ :int = 100 )->int: '''simple docstring''' snake_case_ = n * (n + 1) * (2 * n + 1) / 6 snake_case_ = (n * (n + 1) / 2) ** 2 return int(square_of_sum - sum_of_squares ) if __name__ == "__mai...
283
'''simple docstring''' import inspect import unittest import numpy as np from transformers import ViTConfig, is_flax_available from transformers.testing_utils import require_flax, slow from ...test_configuration_common import ConfigTester from ...test_modeling_flax_common import FlaxModelTesterMixin, floats_te...
13
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 tra...
592
'''simple docstring''' import argparse A__ : Optional[Any] = """docs/source/_static/js/custom.js""" def UpperCAmelCase__ ( UpperCAmelCase_ : Optional[int] ) -> int: with open(UpperCAmelCase_ , encoding='utf-8' , newline='\n' ) as f: _...
13
0
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 lowerCamelCase : Optional[Any] = logging.get_logger(__name__) lowerCamelCase : Li...
170
'''simple docstring''' import flax.linen as nn import jax import jax.numpy as jnp class UpperCAmelCase_ (nn.Module ): """simple docstring""" lowerCamelCase : int lowerCamelCase : jnp.dtype = jnp.floataa def lowercase_ ( self ) -...
13
0
'''simple docstring''' from typing import TYPE_CHECKING from ...utils import OptionalDependencyNotAvailable, _LazyModule, is_tokenizers_available, is_torch_available __snake_case = { """configuration_nezha""": ["""NEZHA_PRETRAINED_CONFIG_ARCHIVE_MAP""", """NezhaConfig"""], } try: if not is_torc...
451
'''simple docstring''' from __future__ import annotations A__ : int = 10 def UpperCAmelCase__ ( UpperCAmelCase_ : list[int] ) -> list[int]: __lowerCamelCase : List[Any] = 1 __lowerCamelCase : Any = max(Upper...
13
0
import gc import random import unittest import numpy as np import torch from PIL import Image from diffusers import ( DDIMScheduler, KandinskyVaaInpaintPipeline, KandinskyVaaPriorPipeline, UNetaDConditionModel, VQModel, ) from diffusers.utils import floats_tensor, load_image, load...
256
'''simple docstring''' from collections import defaultdict from math import gcd def UpperCAmelCase__ ( UpperCAmelCase_ : int = 1_50_00_00 ) -> int: __lowerCamelCase : defaultdict = defaultdict(UpperCAmelCase_ ) __lowerCamelCase : Any ...
13
0
"""simple docstring""" import math from numpy import inf from scipy.integrate import quad def _UpperCamelCase ( UpperCamelCase ) -> float: """simple docstring""" if num <= 0: raise ValueError("math domain error" ) return quad(UpperCAmelCase_ , 0 ...
77
'''simple docstring''' 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 RoFor...
13
0
'''simple docstring''' import shutil import tempfile import unittest from transformers import ( SPIECE_UNDERLINE, AddedToken, BatchEncoding, NllbTokenizer, NllbTokenizerFast, is_torch_available, ) from transformers.testing_utils import ( get_tests_dir, nested_simplify, require_se...
452
'''simple docstring''' 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, ) if is_sentencepiece_available(): from ..ta...
13
0
"""simple docstring""" from math import loga def _lowerCamelCase ( UpperCAmelCase_ : int ) -> int: """simple docstring""" if a < 0: raise ValueError("Input value must be a positive integer" ) elif isinstance(UpperCAmelCase_, UpperCAme...
104
'''simple docstring''' import re from typing import Callable, List, Optional, Union import tensorflow as tf try: from tensorflow.keras.optimizers.legacy import Adam except ImportError: from tensorflow.keras.optimizers import Adam class UpperCAmelCase_ (tf.keras.optimizers.schedules.Learni...
13
0
import shutil import tempfile import unittest import numpy as np import pytest from transformers.testing_utils import require_vision from transformers.utils import is_vision_available if is_vision_available(): from PIL import Image from transformers import ( AutoProcessor, BertTokeni...
181
'''simple docstring''' import collections import inspect import unittest from typing import Dict, List, Tuple from transformers import MaskFormerSwinConfig from transformers.testing_utils import require_torch, require_torch_multi_gpu, torch_device from transformers.utils import is_torch_available from ...test_b...
13
0
from decimal import Decimal, getcontext from math import ceil, factorial def a ( A__ : int ) -> str: """simple docstring""" if not isinstance(UpperCAmelCase_ , UpperCAmelCase_ ): raise TypeError('Undefined for non-integers' ) elif precision < 1: ...
291
'''simple docstring''' from .dependency_versions_table import deps from .utils.versions import require_version, require_version_core # define which module versions we always want to check at run time # (usually the ones defined in `install_requires` in setup.py) # # order specific notes: # - tqdm must be checke...
13
0
import functools import operator from ...configuration_utils import PretrainedConfig from ...utils import logging lowerCamelCase = logging.get_logger(__name__) lowerCamelCase = { """asapp/sew-tiny-100k""": """https://huggingface.co/asapp/sew-tiny-100k/resolve/main/config.json""", ...
191
'''simple docstring''' # coding=utf-8 # Copyright 2023 The HuggingFace Inc. team. # # 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 # # ...
13
0
from typing import List, Optional, Union from ...configuration_utils import PretrainedConfig from ...utils import logging SCREAMING_SNAKE_CASE :Optional[Any] = logging.get_logger(__name__) SCREAMING_SNAKE_CASE :Dict = { """huggingface/time-series-transformer-tourism-monthly""": ( ...
283
'''simple docstring''' from collections import namedtuple import requests from lxml import html # type: ignore A__ : Tuple = namedtuple("""covid_data""", """cases deaths recovered""") def UpperCAmelCase__ ( UpperCAmelCase_ : str = "https://www.worldometers.info/coronavir...
13
0
from collections import defaultdict from math import ceil, sqrt def lowerCamelCase__ ( snake_case_ : int = 100_0000 , snake_case_ : int = 10 ) -> int: __snake_case = defaultdict(UpperCAmelCase_ ) for outer_width in range(3 , (t_limit // 4...
592
'''simple docstring''' from __future__ import annotations import os from collections.abc import Mapping A__ : Optional[Any] = tuple[int, int] class UpperCAmelCase_ : """simple docstring""" def __init__( self , SCREAMING_SNAKE_CASE_ , SCREAMING_SNAKE_CASE_ ...
13
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 lowerCamelCase : Dict = log...
170
'''simple docstring''' from collections.abc import Generator from math import sin def UpperCAmelCase__ ( UpperCAmelCase_ : bytes ) -> bytes: if len(UpperCAmelCase_ ) != 32: raise ValueError('Input must be of length 32' ) __lowerCamelCase : Dict ...
13
0
'''simple docstring''' from collections import OrderedDict from ...utils import logging from .auto_factory import _BaseAutoModelClass, _LazyAutoMapping, auto_class_update from .configuration_auto import CONFIG_MAPPING_NAMES __snake_case = logging.get_logger(__name__) __snake_case = OrderedDict( ...
451
'''simple docstring''' from ...configuration_utils import PretrainedConfig from ...utils import logging A__ : Tuple = logging.get_logger(__name__) A__ : Dict = { """RWKV/rwkv-4-169m-pile""": """https://huggingface.co/RWKV/rwkv-4-169m-pile/resolve/main/config.json""", """RWKV/r...
13
0
from __future__ import annotations import unittest from transformers import XGLMConfig, XGLMTokenizer, is_tf_available from transformers.testing_utils import require_tf, slow from ...test_configuration_common import ConfigTester from ...test_modeling_tf_common import TFModelTesterMixin, floats_tensor, ids_...
256
'''simple docstring''' def UpperCAmelCase__ ( UpperCAmelCase_ : int = 10_00 ) -> int: __lowerCamelCase : Union[str, Any] = 3 __lowerCamelCase : Dict = 0 while a < n: if a % 3 == 0 or a % 5 == 0: ...
13
0
"""simple docstring""" from __future__ import annotations import typing from collections.abc import Iterable import numpy as np A = typing.Union[Iterable[float], Iterable[int], np.ndarray] # noqa: UP007 A = typing.Union[np.floataa, int, float] # noqa: UP007 def _UpperCamelCase ...
77
'''simple docstring''' from __future__ import annotations import unittest from transformers import XGLMConfig, XGLMTokenizer, is_tf_available from transformers.testing_utils import require_tf, slow from ...test_configuration_common import ConfigTester from ...test_modeling_tf_common import TFModelTesterMixin, ...
13
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...
452
'''simple docstring''' from dataclasses import asdict, dataclass from typing import Optional from ...configuration_utils import PretrainedConfig from ...utils import logging A__ : List[str] = logging.get_logger(__name__) # TODO Update this A__ : Tuple = { """facebook/esm-1b""": "...
13
0