code
stringlengths
86
54.5k
code_codestyle
int64
0
371
style_context
stringlengths
87
49.2k
style_context_codestyle
int64
0
349
label
int64
0
1
"""simple docstring""" import json import pathlib import unittest import numpy as np from transformers.testing_utils import require_torch, require_vision, slow from transformers.utils import is_torch_available, is_vision_available from ...test_image_processing_common import ImageProcessin...
249
'''simple docstring''' class _lowercase : def __init__( self: Tuple , UpperCamelCase__: list[int] ): lowerCamelCase__ : Union[str, Any] = len(UpperCamelCase__ ) lowerCamelCase__ : Union[str, Any]...
41
0
"""simple docstring""" from __future__ import annotations def _a ( _snake_case ): """simple docstring""" create_state_space_tree(UpperCamelCase__ , [] , 0 , [0 for i in range(len(UpperCamelCase__ ) )] ) def _a ( _snake_case , _snake_case...
363
"""simple docstring""" import argparse import torch from transformers import ( SpeechTaConfig, SpeechTaFeatureExtractor, SpeechTaForSpeechToSpeech, SpeechTaForSpeechToText, SpeechTaForTextToSpeech, SpeechTaProcessor, SpeechTaTokenizer, logging, ) from transformers.tokeniz...
234
0
"""simple docstring""" from typing import Callable, List, Optional, Union import PIL import torch from transformers import ( CLIPImageProcessor, CLIPSegForImageSegmentation, CLIPSegProcessor, CLIPTextModel, CLIPTokenizer, ) from diffusers import DiffusionPipeline from d...
45
from heapq import heappop, heappush import numpy as np def _SCREAMING_SNAKE_CASE ( a , a , a , a , ) -> tuple[float | int, list[tuple[int, int]]]: __A , __A : int = grid.shape __A : Any = [-1, 1, 0, 0] __A...
280
0
"""simple docstring""" from ...configuration_utils import PretrainedConfig from ...utils import logging lowerCAmelCase : Union[str, Any] = logging.get_logger(__name__) lowerCAmelCase : Any = { """microsoft/trocr-base-handwritten""": ( """https://hugging...
358
import doctest from collections import deque import numpy as np class __lowercase : """simple docstring""" def __init__( self : Union[str, Any]): SCREAMING_SNAKE_CASE_: int = [2, 1, 2, -1] SCREAMING_SNAKE_CASE_: Optional[Any] = [1, 2, 3, 4] def _SCR...
127
0
from PIL import Image def _SCREAMING_SNAKE_CASE ( _lowerCamelCase : Image , _lowerCamelCase : float) -> Optional[int]: '''simple docstring''' def brightness(_lowerCamelCase : int) -> float: return 128 + level + (c - 128) ...
232
'''simple docstring''' import json import os from functools import lru_cache from typing import List, Optional, Tuple import regex as re from ...tokenization_utils import AddedToken, PreTrainedTokenizer from ...utils import logging UpperCamelCase__ : Optional[int] = logging.get_logger(__name__) U...
112
0
"""simple docstring""" import os import unittest from transformers import LxmertTokenizer, LxmertTokenizerFast from transformers.models.bert.tokenization_bert import VOCAB_FILES_NAMES from transformers.testing_utils import require_tokenizers from ...test_tokenization_common import TokenizerTesterMixin @...
202
"""simple docstring""" import os import zipfile import requests from get_ci_error_statistics import download_artifact, get_artifacts_links def __snake_case ( SCREAMING_SNAKE_CASE__ : Tuple , SCREAMING_SNAKE_CASE__ : List[str]=7 ) -> Tuple: '''simple do...
202
1
'''simple docstring''' import baseaa def SCREAMING_SNAKE_CASE_ ( _UpperCAmelCase : str ) -> bytes: return baseaa.baaencode(string.encode("""utf-8""" ) ) def SCREAMING_SNAKE_CASE_ ( _UpperCAmelCase : bytes ) -> str: return baseaa.baadecode(_UpperCAmelC...
276
import warnings from typing import List, Optional, Union from ...processing_utils import ProcessorMixin from ...tokenization_utils_base import BatchEncoding, PaddingStrategy, PreTokenizedInput, TextInput, TruncationStrategy from ...utils import TensorType class A_ ( snake_case__ ): ...
322
0
import importlib import os import fsspec import pytest from fsspec import register_implementation from fsspec.registry import _registry as _fsspec_registry from datasets.filesystems import COMPRESSION_FILESYSTEMS, HfFileSystem, extract_path_from_uri, is_remote_filesystem from .utils import require_lza, require_zstan...
284
def snake_case (__lowercase ) -> bool: '''simple docstring''' _snake_case : Dict = 0 for ch in input_str: _snake_case : int = ord(__lowercase ) _snake_case : List[Any] = pow(2 , __lowercase ) #...
284
1
"""simple docstring""" import os import re import shutil import sys import tempfile import unittest import black __SCREAMING_SNAKE_CASE : Dict = os.path.abspath(os.path.dirname(os.path.dirname(os.path.dirname(__file__)))) sys.path.append(os.path.join(git_repo_path, 'utils')) import check_copies #...
347
'''simple docstring''' def SCREAMING_SNAKE_CASE__ ( __A ) -> bool: return number & 1 == 0 if __name__ == "__main__": import doctest doctest.testmod()
42
0
"""simple docstring""" import unittest from dataclasses import dataclass import pytest from accelerate.commands.config.config_args import SageMakerConfig from accelerate.utils import ComputeEnvironment from accelerate.utils.launch import _convert_nargs_to_dict @dataclass class UpperCAmelCase_ ( _low...
360
"""simple docstring""" import unittest from huggingface_hub import hf_hub_download from transformers import MODEL_FOR_VIDEO_CLASSIFICATION_MAPPING, VideoMAEFeatureExtractor from transformers.pipelines import VideoClassificationPipeline, pipeline from transformers.testing_utils import ( is_pipeline_test, nest...
54
0
import argparse import os import re # All paths are set with the intent you should run this script from the root of the repo with the command # python utils/check_dummies.py _UpperCAmelCase : Optional[Any] ="""src/diffusers""" # Matches is_xxx_available() _UpperCAmelCase : Dict =re.compile(R"""is\_([a...
262
from .glue import glue_convert_examples_to_features, glue_output_modes, glue_processors, glue_tasks_num_labels from .squad import SquadExample, SquadFeatures, SquadVaProcessor, SquadVaProcessor, squad_convert_examples_to_features from .utils import DataProcessor, InputExample, InputFeatures, SingleSentenceClassifica...
262
1
import os # Precomputes a list of the 100 first triangular numbers UpperCamelCase__ =[int(0.5 * n * (n + 1)) for n in range(1, 101)] def lowerCamelCase__ (): _SCREAMING_SNAKE_CASE : Union[str, Any] = os.path.dirname(os.path.realpath(__lowerCamelCase ) ) _SCREAM...
325
from maths.prime_check import is_prime def lowerCamelCase__ (__lowerCamelCase ): if not isinstance(__lowerCamelCase, __lowerCamelCase ): _SCREAMING_SNAKE_CASE : List[str] = f"""Input value of [number={number}] must be an integer""" raise TypeError(__l...
325
1
import json import os from typing import Optional import numpy as np from ...feature_extraction_utils import BatchFeature from ...processing_utils import ProcessorMixin from ...utils import logging from ...utils.hub import get_file_from_repo from ..auto import AutoTokenizer a_ = logging.get_logger(__name__)...
76
"""simple docstring""" from typing import TYPE_CHECKING from ...utils import ( OptionalDependencyNotAvailable, _LazyModule, is_flax_available, is_tf_available, is_tokenizers_available, is_torch_available, ) SCREAMING_SNAKE_CASE_ = { '''configuration_roberta''': ['''...
301
0
"""simple docstring""" from typing import TYPE_CHECKING from ...utils import ( OptionalDependencyNotAvailable, _LazyModule, is_flax_available, is_tf_available, is_tokenizers_available, is_torch_available, ) _snake_case = { "configuration_blenderbot": [ ...
371
import argparse import json from pathlib import Path import requests import torch from huggingface_hub import hf_hub_download from PIL import Image from transformers import ( MobileViTConfig, MobileViTForImageClassification, MobileViTForSemanticSegmentation, MobileViTImageProcessor, ) f...
342
0
'''simple docstring''' from __future__ import annotations import inspect import unittest from math import floor import numpy as np from transformers import CvtConfig from transformers.testing_utils import require_tf, require_vision, slow from transformers.utils import cached_property, is_tf_available, is_vision_...
239
'''simple docstring''' from typing import Mapping from ...configuration_utils import PretrainedConfig from ...onnx import OnnxSeqaSeqConfigWithPast from ...utils import logging __lowercase : Dict = logging.get_logger(__name__) __lowercase : Optional[Any] = { 'google/umt5-small': 'htt...
27
0
'''simple docstring''' import argparse import os import platform import numpy as np import psutil import torch from accelerate import __version__ as version from accelerate.commands.config import default_config_file, load_config_from_file from ..utils import is_npu_available, is_xpu_available def lower...
365
'''simple docstring''' from __future__ import annotations def lowerCamelCase__ ( __lowerCamelCase : list[int] ): '''simple docstring''' if not nums: return 0 _UpperCAmelCase : Tuple =nums[0] _UpperCAmelCase : int ...
242
0
"""simple docstring""" import io import itertools import json from dataclasses import dataclass from typing import Optional import pyarrow as pa import pyarrow.json as paj import datasets from datasets.table import table_cast from datasets.utils.file_utils import readline lowercase__ = datasets.uti...
241
from ....configuration_utils import PretrainedConfig from ....utils import logging UpperCAmelCase_ : List[str] = logging.get_logger(__name__) UpperCAmelCase_ : int = { '''CarlCochet/trajectory-transformer-halfcheetah-medium-v2''': ( '''https://huggingface.co/CarlCoche...
38
0
"""simple docstring""" from typing import Optional, Tuple, Union import tensorflow as tf from ...activations_tf import ACTaFN from ...file_utils import add_code_sample_docstrings, add_start_docstrings, add_start_docstrings_to_model_forward from ...modeling_tf_outputs import ( TFBaseModelOutputWithNoAttention, ...
364
"""simple docstring""" from itertools import product def __UpperCAmelCase ( lowercase ,lowercase ): """simple docstring""" _UpperCAmelCase = sides_number _UpperCAmelCase = max_face_number * dice_number _UpperCAmelCase = [0] * (max_total + 1) _UpperCAmelCase = 1 _U...
30
0
from __future__ import annotations import time import numpy as np __a : Optional[Any] = [8, 5, 9, 7] __a : Optional[Any] = [ [2, 0, 1, 1], [0, 1, 2, 1], [4, 0, 0, 3], [0, 2, 1, 0], [1, 0, 3, 0], ] __a : List[Any] = [ [3, 2, 1, 4], [0, 2, 5, 2], [5, ...
210
import os import pickle import unittest from transformers import AutoTokenizer from transformers.models.bert.tokenization_bert import BertTokenizer from transformers.models.bert_japanese.tokenization_bert_japanese import ( VOCAB_FILES_NAMES, BertJapaneseTokenizer, CharacterTokenizer, JumanppTokenizer, ...
210
1
'''simple docstring''' 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) lowercase =logging.getLogger() ...
352
'''simple docstring''' from __future__ import annotations from random import choice def lowerCamelCase__ ( __lowerCamelCase : Optional[int] ): '''simple docstring''' return choice(__lowerCamelCase ) def lowerCamelCase__ ( __lowerCamelCase : ...
242
0
"""simple docstring""" def UpperCamelCase__ ( lowercase__ : str , lowercase__ : str = " " ): snake_case : List[str] = [] snake_case : List[Any] = 0 for index, char in enumerate(lowercase__ ): if char == separator: split_words...
148
"""simple docstring""" from typing import Any class lowerCamelCase__ : def __init__( self , SCREAMING_SNAKE_CASE ): """simple docstring""" snake_case : Tuple = data snake_case : Union[str, Any] = None class ...
148
1
import requests from bsa import BeautifulSoup def __UpperCamelCase ( lowercase__ : str = "AAPL" ) -> str: '''simple docstring''' lowerCAmelCase_ : Optional[Any] = f'https://in.finance.yahoo.com/quote/{symbol}?s={symbol}' lowerCAmelCase_ : Tuple = B...
28
import argparse import numpy as np import torch from transformers import SpeechTaHifiGan, SpeechTaHifiGanConfig, logging logging.set_verbosity_info() __UpperCAmelCase = logging.get_logger('transformers.models.speecht5') def __UpperCamelCase ( lowercase__ : Optional[Any] , lowe...
28
1
'''simple docstring''' import unittest import torch from torch import nn from diffusers.models.activations import get_activation class _UpperCamelCase ( unittest.TestCase ): '''simple docstring''' def __lowerCamelCase ( self : int): '''simpl...
166
'''simple docstring''' import os from shutil import copyfile from typing import Any, Dict, List, Optional, Tuple import sentencepiece as spm from ...tokenization_utils import PreTrainedTokenizer from ...utils import logging lowerCamelCase = logging.get_logger(__name__) lowerCamelCase = ...
166
1
"""simple docstring""" 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 ( _UpperCAmelCase , unittest.TestCase ): lower...
350
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 checked before tokenizers Uppe...
198
0
def __snake_case ( _UpperCAmelCase = 4000000 ): __a = [0, 1] __a = 0 while fib[i] <= n: fib.append(fib[i] + fib[i + 1] ) if fib[i + 2] > n: break i += 1 __a = 0 for j in range(len(_UpperCAmelCase ) -...
49
import functools from typing import Any def UpperCamelCase ( snake_case__ : str , snake_case__ : list[str] ) -> bool: # Validation if not isinstance(snake_case__ , snake_case__ ) or len(snake_case__ ) == 0: raise ValueError('the string should be not empty s...
119
0
'''simple docstring''' import baseaa def __magic_name__( lowerCamelCase): return baseaa.baaencode(string.encode('''utf-8''')) def __magic_name__( lowerCamelCase): return baseaa.baadecode(lowerCamelCase).decode('''utf-8''') if __name__ == "__main__": _UpperCAmelCase ...
353
'''simple docstring''' from typing import Callable, Dict, Optional, Tuple import torch from torch import nn from torch.distributions import ( AffineTransform, Distribution, Independent, NegativeBinomial, Normal, StudentT, TransformedDistribution, ) class a__ ( _...
9
0
"""simple docstring""" from __future__ import annotations __SCREAMING_SNAKE_CASE =[] def lowercase__( __SCREAMING_SNAKE_CASE : list[list[int]] , __SCREAMING_SNAKE_CASE : int , __SCREAMING_SNAKE_CASE : int ): for i in range(len(__SCREAMING_SNAKE...
213
"""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_t...
213
1
import inspect import unittest from huggingface_hub import hf_hub_download from transformers import ASTConfig from transformers.testing_utils import require_torch, require_torchaudio, slow, torch_device from transformers.utils import cached_property, is_torch_available, is_torchaudio_available from ...test_confi...
353
from math import factorial def lowerCAmelCase__ ( lowerCamelCase_ : int = 100): '''simple docstring''' return sum(map(lowerCamelCase_ ,str(factorial(lowerCamelCase_)))) if __name__ == "__main__": print(solution(int(input('Enter the Number: ').strip())))
94
0
import os import time from dataclasses import dataclass, field from enum import Enum from typing import Dict, List, Optional, Union import torch from filelock import FileLock from torch.utils.data import Dataset from ...models.auto.modeling_auto import MODEL_FOR_QUESTION_ANSWERING_MAPPING from ...tokenization_util...
94
import json import pathlib import unittest import numpy as np from transformers.testing_utils import require_torch, require_vision, slow from transformers.utils import is_torch_available, is_vision_available from ...test_image_processing_common import ImageProcessingSavingTestMixin, prepare_image_inpu...
184
0
from __future__ import annotations import unittest from transformers import RoFormerConfig, is_tf_available from transformers.testing_utils import require_tf, slow from ...test_configuration_common import ConfigTester from ...test_modeling_tf_common import TFModelTesterMixin, ids_tensor, random_attention_mas...
367
import warnings from ...utils import logging from .image_processing_clip import CLIPImageProcessor lowercase = logging.get_logger(__name__) class __lowercase ( A ): '''simple docstring''' def __init__( self : Any , *_a : Optional[A...
35
0
"""simple docstring""" import json import sys import tempfile import unittest from pathlib import Path import transformers from transformers import ( CONFIG_MAPPING, IMAGE_PROCESSOR_MAPPING, AutoConfig, AutoImageProcessor, CLIPConfig, CLIPImageProcessor, ) from transform...
217
"""simple docstring""" from ...configuration_utils import PretrainedConfig from ...utils import logging __A = logging.get_logger(__name__) __A = { "google/switch-base-8": "https://huggingface.co/google/switch-base-8/blob/main/config.json", } class snake_case ( ...
217
1
from math import sqrt def UpperCAmelCase_ (_lowerCAmelCase : int = 1_00_00_00 ): __UpperCamelCase : int = 0 __UpperCamelCase : int = 0 __UpperCamelCase : int while num_cuboids <= limit: max_cuboid_size += 1 for sum_shortest_si...
171
def UpperCAmelCase_ (_lowerCAmelCase : int = 1_00 ): __UpperCamelCase : Tuple = n * (n + 1) * (2 * n + 1) / 6 __UpperCamelCase : List[str] = (n * (n + 1) / 2) ** 2 return int(square_of_sum - sum_of_squares ) if __name__ == "__main__": print(F"""{s...
171
1
import gc import threading import time import psutil import torch class A_ : def __init__( self : List[str]): __lowerCamelCase : str = psutil.Process() __lowerCamelCase : Tuple = False def lowerCAmelCase ( se...
73
import copy from ...configuration_utils import PretrainedConfig from ...utils import logging from ..auto import CONFIG_MAPPING __a : int = logging.get_logger(__name__) __a : str = { """ut/deta""": """https://huggingface.co/ut/deta/resolve/main/config.json""", } class _UpperCamelCa...
210
0
"""simple docstring""" import gc import unittest from transformers import CTRLConfig, is_torch_available from transformers.testing_utils import require_torch, slow, torch_device from ...generation.test_utils import GenerationTesterMixin from ...test_configuration_common import ConfigTester...
128
"""simple docstring""" from ..utils import is_flax_available, is_torch_available if is_torch_available(): from .autoencoder_kl import AutoencoderKL from .controlnet import ControlNetModel from .dual_transformer_ad import DualTransformeraDModel from .modeling_utils i...
128
1
"""simple docstring""" from typing import Dict, Iterable, Optional, Union import numpy as np from ...image_processing_utils import BaseImageProcessor, BatchFeature, get_size_dict from ...image_transforms import normalize, rescale, resize, to_channel_dimension_format, to_pil_image from ...image_utils import ...
220
import requests from bsa import BeautifulSoup def UpperCAmelCase_ ( _A = "AAPL" ): '''simple docstring''' SCREAMING_SNAKE_CASE__ = F'''https://in.finance.yahoo.com/quote/{symbol}?s={symbol}''' SCREAMING_SNAKE_CASE__ = BeautifulSoup(requests.get(_A ).text , ''...
314
0
"""simple docstring""" import math import qiskit def _A (__a = 1 , __a = 1 , __a = 1 ) -> qiskit.result.counts.Counts: """simple docstring""" if ( isinstance(__a , __a ) or isinstance(__a , __a ) or isinstance(__a , ...
318
"""simple docstring""" from collections import defaultdict def _A (__a , __a ) -> bool: """simple docstring""" SCREAMING_SNAKE_CASE_ : Dict = first_str.lower().strip() SCREAMING_SNAKE_CASE_ : List[Any] = second_str.lower().strip() # Rem...
318
1
'''simple docstring''' import collections import os from typing import List, Optional, Tuple from transformers.utils import is_jieba_available, requires_backends if is_jieba_available(): import jieba from ...tokenization_utils import PreTrainedTokenizer from ...utils import logging ...
168
'''simple docstring''' from typing import TYPE_CHECKING from ...utils import ( OptionalDependencyNotAvailable, _LazyModule, is_tf_available, is_tokenizers_available, is_torch_available, is_vision_available, ) a_ : Union[str, Any] = { "config...
168
1
import os from typing import Any, Callable, Dict, List, Optional, Tuple, Union import torch from torch import nn from ...models.controlnet import ControlNetModel, ControlNetOutput from ...models.modeling_utils import ModelMixin from ...utils import logging snake_case : Any = logging.get_logger(__nam...
281
from typing import TYPE_CHECKING from ....utils import OptionalDependencyNotAvailable, _LazyModule, is_torch_available, is_vision_available snake_case : Any = {'''configuration_van''': ['''VAN_PRETRAINED_CONFIG_ARCHIVE_MAP''', '''VanConfig''']} try: if not is_torch_available(): raise...
281
1
import re def UpperCamelCase( __UpperCamelCase : str ): lowerCAmelCase_ : str = re.compile(R'''^(\+91[\-\s]?)?[0]?(91)?[789]\d{9}$''' ) if match := re.search(__UpperCamelCase ,__UpperCamelCase ): return match.string == phone return False if __name__ == "__main__": pr...
103
from typing import Any import numpy as np def __SCREAMING_SNAKE_CASE ( snake_case_ ): '''simple docstring''' return np.array_equal(snake_case_ , matrix.conjugate().T ) def __SCREAMING_SNAKE_CASE ( snake_case_ , snake_case_ ): '''simple docstring''...
133
0
'''simple docstring''' # NOTE: This file is deprecated and will be removed in a future version. # It only exists so that temporarely `from diffusers.pipelines import DiffusionPipeline` works from ...utils import deprecate from ..controlnet.multicontrolnet import MultiControlNetModel # noqa: F401 from ..cont...
363
'''simple docstring''' from collections import defaultdict from math import gcd def __lowercase ( __lowercase = 150_0000 ) -> int: '''simple docstring''' _A = defaultdict(__lowercase ) _A = 2 while 2 * euclid_m * (euclid_m + 1) <= limit:...
174
0
"""simple docstring""" # this script reports modified .py files under the desired list of top-level sub-dirs passed as a list of arguments, e.g.: # python ./utils/get_modified_files.py utils src tests examples # # it uses git to find the forking point and which files were modified - i.e. files not under git won...
292
"""simple docstring""" from __future__ import annotations import unittest from transformers import AutoTokenizer, PegasusConfig, is_tf_available from transformers.testing_utils import require_sentencepiece, require_tf, require_tokenizers, slow from transformers.utils import cached_property from ...test_configu...
292
1
"""simple docstring""" from __future__ import annotations def lowercase ( _snake_case : list[int] ) ->list[int]: # This function is recursive """simple docstring""" __snake_case : int = len(_snake_case ) # If the array contains only one element, we retu...
24
"""simple docstring""" import itertools from dataclasses import dataclass from typing import List, Optional import pyarrow as pa import pyarrow.parquet as pq import datasets from datasets.table import table_cast SCREAMING_SNAKE_CASE : int = datasets.utils.logging.get_logger(__name__) @dataclass cla...
24
1
import math_equivalence # From: git+https://github.com/hendrycks/math.git import datasets UpperCAmelCase__ : List[Any] = """\ @article{hendrycksmath2021, title={Measuring Mathematical Problem Solving With the MATH Dataset}, author={Dan Hendrycks and Collin Burns and Saurav Kadavath...
245
import inspect import unittest from transformers import YolosConfig from transformers.testing_utils import require_torch, require_vision, slow, torch_device from transformers.utils import cached_property, is_torch_available, is_vision_available from ...test_configuration_common import ConfigTester from .....
245
1
'''simple docstring''' from __future__ import annotations def __snake_case( _lowerCAmelCase ) -> int: if not nums: return 0 snake_case__ : List[str] = nums[0] snake_case__ : Tuple = 0 for num in nums[1:]: snake_cas...
370
'''simple docstring''' import collections from typing import List, Optional, Union from ...tokenization_utils_base import BatchEncoding from ...utils import TensorType, add_end_docstrings, add_start_docstrings, logging from ..bert.tokenization_bert import BertTokenizer __a = logging.get_logger(__nam...
43
0
def __lowercase ( _UpperCamelCase, _UpperCamelCase ) ->Tuple: """simple docstring""" while b: lowercase , lowercase : Any = b, a % b return a def __lowercase ( _UpperCamelCase, _UpperCamelCase ) ->Dict: """simple docstri...
337
"""simple docstring""" from typing import TYPE_CHECKING from ...utils import OptionalDependencyNotAvailable, _LazyModule, is_tokenizers_available, is_torch_available lowerCAmelCase__ : str = { 'configuration_roc_bert': ['ROC_BERT_PRETRAINED_CONFIG_ARCHIVE_MAP', 'RoCBertConfig'], 'tokenizati...
98
0
'''simple docstring''' import os from collections import deque import torch from torch.utils.data import Dataset class _a ( SCREAMING_SNAKE_CASE ): '''simple docstring''' def __init__( self, A="", A="train" ): ...
246
'''simple docstring''' import copy from dataclasses import dataclass, field from typing import ClassVar, Dict from ..features import ClassLabel, Features, Value from .base import TaskTemplate @dataclass(frozen=SCREAMING_SNAKE_CASE ) class _a ( SCREAMING_SNAKE_CASE ):...
246
1
import warnings from typing import List, Optional, Union from ...processing_utils import ProcessorMixin from ...tokenization_utils_base import BatchEncoding, PaddingStrategy, PreTokenizedInput, TextInput, TruncationStrategy from ...utils import TensorType class lowercase ( UpperCamelCase__ )...
26
from __future__ import annotations import numpy as np def lowerCAmelCase_ ( snake_case_ ): return np.maximum(0,snake_case_ ) if __name__ == "__main__": print(np.array(relu([-1, 0, 5]))) # --> [0, 0, 5]
26
1
"""simple docstring""" from typing import Optional, Union import torch from torch import nn from ...configuration_utils import ConfigMixin, register_to_config from ...models.modeling_utils import ModelMixin class A ( _UpperCAmelCase , _UpperCAmelCase ): ...
361
def _snake_case( SCREAMING_SNAKE_CASE__ : int = 1000 ) -> int: '''simple docstring''' A__ = 3 A__ = 0 while a < n: if a % 3 == 0 or a % 5 == 0: result += a elif a % 15 == 0: res...
282
0
'''simple docstring''' from typing import List, Optional, Union from ...configuration_utils import PretrainedConfig from ...utils import logging __lowerCamelCase = logging.get_logger(__name__) __lowerCamelCase = { '''huggingface/time-series-transformer-tourism-monthly''': ( ...
162
'''simple docstring''' import gc import unittest import numpy as np import torch from transformers import CLIPTextConfig, CLIPTextModelWithProjection, CLIPTokenizer from diffusers import HeunDiscreteScheduler, PriorTransformer, ShapEPipeline from diffusers.pipelines.shap_e import ShapERenderer from diffusers...
162
1
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_bart import BartTokenizer _lowerCam...
99
import logging import os from .state import PartialState class __UpperCAmelCase ( logging.LoggerAdapter ): @staticmethod def __magic_name__ ( __A : str ): UpperCAmelCase : Dict = PartialState() return not main_process_only or (main_process_only a...
99
1
import json import os import tempfile import datasets from utils import generate_example_dataset, get_duration lowerCamelCase : Optional[Any] = 50_000 lowerCamelCase : Dict = 5_000 lowerCamelCase , lowerCamelCase : Optional[Any] = os.path.split(__file__) low...
204
from typing import TYPE_CHECKING from ...utils import OptionalDependencyNotAvailable, _LazyModule, is_tokenizers_available, is_torch_available lowerCamelCase : str = { "configuration_nezha": ["NEZHA_PRETRAINED_CONFIG_ARCHIVE_MAP", "NezhaConfig"], } try: if not is_torch_available()...
204
1
'''simple docstring''' import argparse import torch from transformers import BertConfig, BertForPreTraining, load_tf_weights_in_bert from transformers.utils import logging logging.set_verbosity_info() def _lowerCAmelCase ( lowercase , lowercase , lowercase ) -> List[str]: ...
358
'''simple docstring''' import numpy as np from transformers import Pipeline def _lowerCAmelCase ( lowercase ) -> List[str]: __lowerCAmelCase = np.max(lowercase , axis=-1 , keepdims=lowercase ) __lowerCAmelCase = np.exp(outputs - maxes ) ...
46
0
'''simple docstring''' import argparse import json import os import fairseq import torch from fairseq.data import Dictionary from transformers import ( WavaVecaConformerConfig, WavaVecaConformerForCTC, WavaVecaConformerForPreTraining, WavaVecaCTCTokenizer, WavaVecaFeatureExtr...
55
'''simple docstring''' import inspect import unittest import numpy as np from tests.test_modeling_common import floats_tensor from transformers import DetrConfig, MaskFormerConfig, SwinConfig, is_torch_available, is_vision_available from transformers.testing_utils import require_torch, require_torch_multi_gp...
37
0
"""simple docstring""" import warnings from ...processing_utils import ProcessorMixin from ...tokenization_utils_base import BatchEncoding class lowerCamelCase__ ( SCREAMING_SNAKE_CASE ): '''simple docstring''' _lowerCamelCase = ['''image_processor''', '''tokeniz...
371
"""simple docstring""" import argparse from transformers import CLIPImageProcessor, CLIPVisionModelWithProjection from diffusers import UnCLIPImageVariationPipeline, UnCLIPPipeline if __name__ == "__main__": UpperCAmelCase =argparse.ArgumentParser() parser.add_argument("--dump_path", de...
77
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, prepare_image_inputs if is_torch_...
112
from __future__ import annotations import math lowercase : Any = '2020.9.26' lowercase : Union[str, Any] = 'xcodz-dot, cclaus, dhruvmanila' def _SCREAMING_SNAKE_CASE ( _lowerCamelCase : float , _lowerCamelCase : float , _lowerCamelCas...
232
0
from math import factorial lowerCAmelCase_ = {str(d): factorial(d) for d in range(10)} def snake_case( __magic_name__ ) -> int: '''simple docstring''' return sum(DIGIT_FACTORIAL[d] for d in str(__magic_name__ ) ) def snake_case( ...
116
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 _A ( tf.keras.optimizers.schedules.LearningRateSchedule ): ...
116
1
import inspect import unittest from transformers import DPTConfig from transformers.file_utils import is_torch_available, is_vision_available from transformers.models.auto import get_values from transformers.testing_utils import require_torch, require_vision, slow, torch_device from ...test_configuration_common imp...
214
def snake_case__ ( SCREAMING_SNAKE_CASE_ : str , SCREAMING_SNAKE_CASE_ : str ): '''simple docstring''' if len(SCREAMING_SNAKE_CASE_ ) != len(SCREAMING_SNAKE_CASE_ ): raise ValueError('String lengths must match!' ) lowercase__ : Union[str, Any] = ...
214
1
from math import log from scipy.constants import Boltzmann, physical_constants lowercase : List[Any] = 3_0_0 # TEMPERATURE (unit = K) def A_ ( A__ , A__ , A__ , ) -> float: if donor_conc <= 0: raise ValueError('Donor concentration should be positive' ...
364
import glob import os import random from string import ascii_lowercase, digits import cva lowercase : Optional[Any] = """""" lowercase : int = """""" lowercase : List[Any] = """""" lowercase : Optional[int] = 1 # (0 is vertical, 1 is horizontal) def...
225
0
from __future__ import annotations def snake_case__ ( SCREAMING_SNAKE_CASE_ : list[int] ): '''simple docstring''' lowercase__ : Optional[Any] = len(UpperCAmelCase_ ) // 2 # choose the middle 3 elements lowercase__ : Dict = lst[m - 1 : m + 2] ...
214
from collections import OrderedDict from typing import Any, Mapping, Optional from ... import PreTrainedTokenizer from ...configuration_utils import PretrainedConfig from ...file_utils import TensorType, is_torch_available from ...onnx import OnnxConfig, OnnxConfigWithPast, OnnxSeqaSeqConfigWithPast from ...onnx.ut...
94
0
"""simple docstring""" from unittest import TestCase from datasets import Dataset from minhash_deduplication import deduplicate_dataset, make_duplicate_clusters def UpperCamelCase_ ( ) -> Optional[int]: """simple docstring""" lowerCAmelCase_ : Tu...
350
"""simple docstring""" from typing import TYPE_CHECKING from ...utils import ( OptionalDependencyNotAvailable, _LazyModule, is_sentencepiece_available, is_speech_available, is_torch_available, ) lowercase__ : Optional[int] = { """configuration_...
289
0
"""simple docstring""" import numpy as np import torch from torch.utils.data import Dataset from utils import logger class _UpperCAmelCase ( snake_case__ ): '''simple docstring''' def __init__(self , a_ , a_ ): '''simple docstring''' __snake_case : An...
102
"""simple docstring""" from ..utils import DummyObject, requires_backends class __A (metaclass=snake_case__): '''simple docstring''' __lowercase: List[Any] = ["""sentencepiece"""] def __init__( self : int , *UpperCAmelCase_ : Any ...
347
0
import argparse import collections import os import re 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_table.py a ="""src/transformers""" a ="""docs/source/en""" ...
358
# 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 ...
113
0
"""simple docstring""" from typing import TYPE_CHECKING from ...utils import OptionalDependencyNotAvailable, _LazyModule, is_torch_available, is_vision_available UpperCAmelCase_ : Dict = {"""configuration_glpn""": ["""GLPN_PRETRAINED_CONFIG_ARCHIVE_MAP""", """GLPNConfig"""]} try: if not is_vis...
91
from typing import Union import fire import torch from tqdm import tqdm def SCREAMING_SNAKE_CASE__ ( lowercase ,lowercase = "cpu" ,lowercase = None ) -> None: snake_case : int = torch.load(lowercase ,map_location=lowercase ) for k, v in tqdm(state_...
124
0
'''simple docstring''' from __future__ import annotations import unittest from transformers import is_tf_available, is_torch_available from transformers.testing_utils import DUMMY_UNKNOWN_IDENTIFIER, SMALL_MODEL_IDENTIFIER, is_pt_tf_cross_test, slow if is_tf_available(): from transformers...
358
'''simple docstring''' import json import os import unittest from transformers import DebertaTokenizer, DebertaTokenizerFast from transformers.models.deberta.tokenization_deberta import VOCAB_FILES_NAMES from transformers.testing_utils import slow from ...test_tokenization_common import TokenizerTest...
9
0
from __future__ import annotations from collections import deque from collections.abc import Sequence from dataclasses import dataclass from typing import Any @dataclass class A__ : lowerCAmelCase__ : int lowerCAmelCase__ : Node | None = None lowerCAmelCase__ : No...
325
import os import string import sys lowerCamelCase = 1 << 8 lowerCamelCase = { '''tab''': ord('''\t'''), '''newline''': ord('''\r'''), '''esc''': 27, '''up''': 65 + ARROW_KEY_FLAG, '''down''': 66 + ARROW_KEY_FLAG, '''right''': 67 + ARROW_KEY_FLAG, '''left''': ...
188
0
'''simple docstring''' import unittest from transformers import DonutProcessor lowerCAmelCase: Optional[int] = 'naver-clova-ix/donut-base' class a__( unittest.TestCase ): def lowercase_ ( self : Union[str, Any] ): a : Dict = DonutP...
357
'''simple docstring''' import copy import os import cva import numpy as np from matplotlib import pyplot as plt class a__: def __init__( self : Optional[int] ): a : int = '' a : List[str] = '' a : int = ...
96
0
'''simple docstring''' import pickle import shutil import tempfile import unittest from transformers import SPIECE_UNDERLINE, XLMRobertaTokenizer, XLMRobertaTokenizerFast from transformers.testing_utils import get_tests_dir, require_sentencepiece, require_tokenizers, slow from transformers.utils import cached_...
258
'''simple docstring''' import copy from typing import Any, Dict, List, Optional, Union import numpy as np from ...audio_utils import mel_filter_bank, spectrogram, window_function from ...feature_extraction_sequence_utils import SequenceFeatureExtractor from ...feature_extraction_utils import BatchFeature from ......
272
0
'''simple docstring''' import warnings from typing import List, Optional, Union from ...image_utils import ImageInput from ...processing_utils import ProcessorMixin from ...tokenization_utils_base import BatchEncoding, PaddingStrategy, PreTokenizedInput, TextInput, TruncationStrategy from ...utils import Tens...
365
'''simple docstring''' import warnings from ...utils import logging from .image_processing_mobilevit import MobileViTImageProcessor __A : Optional[int] = logging.get_logger(__name__) class __UpperCamelCase ( lowercase__ ): def __init__( self :List[str] ,*_Upp...
8
0
from copy import deepcopy class __snake_case : def __init__( self : List[str] , _snake_case : list[int] | None = None , _snake_case : int | None = None): """simple docstring""" if arr is None and size is not No...
51
'''simple docstring''' import os import sys from contextlib import contextmanager # Windows only if os.name == "nt": import ctypes import msvcrt # noqa class lowercase__ ( ctypes.Structure ): '''simple docstring''' A_ : Optional[Any] =...
200
0
'''simple docstring''' import argparse from transformers import CLIPImageProcessor, CLIPVisionModelWithProjection from diffusers import UnCLIPImageVariationPipeline, UnCLIPPipeline if __name__ == "__main__": __snake_case : str = argparse.ArgumentParser() parser.add_argument('--dump...
354
'''simple docstring''' import torch from diffusers import CMStochasticIterativeScheduler from .test_schedulers import SchedulerCommonTest class lowerCamelCase ( lowercase_ ): '''simple docstring''' __snake_case = (CMStochasticIterativeScheduler,) __snake_case = 10 ...
136
0
def lowerCAmelCase_ ( __A ) -> str: '''simple docstring''' return " ".join(input_str.split()[::-1] ) if __name__ == "__main__": import doctest doctest.testmod()
65
"""simple docstring""" from typing import TYPE_CHECKING from ...utils import ( OptionalDependencyNotAvailable, _LazyModule, is_tf_available, is_tokenizers_available, is_torch_available, is_vision_available, ) __A = { '''configuration_layoutlmv3''': [ '''LAYOUTLMV3_PRETRAI...
135
0
"""simple docstring""" from __future__ import annotations def _A ( lowercase ): """simple docstring""" a =[True] * limit a =False a =False a =True for i in range(3 , int(limit**0.5 + 1 ) , 2 ): a =i * 2 ...
215
"""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.testi...
215
1
import copy from ...configuration_utils import PretrainedConfig from ...utils import logging __lowerCAmelCase : Union[str, Any] = logging.get_logger(__name__) class snake_case__ (_UpperCamelCase ): """simple docstring""" SCREAMING_SNAKE_CASE_ : Union[str, Any...
107
import pickle import shutil import tempfile import unittest from transformers import SPIECE_UNDERLINE, XLMRobertaTokenizer, XLMRobertaTokenizerFast from transformers.testing_utils import get_tests_dir, require_sentencepiece, require_tokenizers, slow from transformers.utils import cached_property from ...test_tok...
107
1
from abc import ABC, abstractmethod from argparse import ArgumentParser class a__ ( __snake_case ): @staticmethod @abstractmethod def __SCREAMING_SNAKE_CASE ( UpperCAmelCase ) -> Any: raise NotImplementedError() @abstractmethod de...
370
import copy import json import os import tempfile from transformers import is_torch_available from .test_configuration_utils import config_common_kwargs class a__ ( __snake_case ): def __init__( self , UpperCAmelCase , UpperCAmelCase=None , UpperCA...
197
0
'''simple docstring''' import math import random from typing import Any from .hill_climbing import SearchProblem def lowerCamelCase ( __lowerCamelCase : Dict , __lowerCamelCase : bool = True , __lowerCamelCase : float = math.inf , __lowerCamelCase : float ...
58
def __UpperCAmelCase ( __a : int ,__a : list[int] ,__a : int ) -> int: """simple docstring""" def count_of_possible_combinations(__a : int ) -> int: if target < 0: return 0 if target == 0: return 1 ...
235
0
"""simple docstring""" import logging import os from dataclasses import dataclass, field from typing import Dict, Optional import datasets import numpy as np import tensorflow as tf from transformers import ( AutoConfig, AutoTokenizer, EvalPrediction, HfArgumentParser, PreTrainedTokenizer...
340
"""simple docstring""" import os from typing import BinaryIO, Optional, Union import numpy as np import pyarrow.parquet as pq from .. import Audio, Dataset, Features, Image, NamedSplit, Value, config from ..features.features import FeatureType, _visit from ..formatting import query_table from ..packaged_modu...
340
1
'''simple docstring''' import bza import gzip import lzma import os import shutil import struct import tarfile import warnings import zipfile from abc import ABC, abstractmethod from pathlib import Path from typing import Dict, List, Optional, Type, Union from .. import config from .filelock import FileLock from .log...
198
'''simple docstring''' import os import re import warnings from shutil import copyfile from typing import List, Optional, Tuple from ...tokenization_utils_fast import PreTrainedTokenizerFast from ...utils import is_sentencepiece_available, logging if is_sentencepiece_available(): from .tokenization_ta import TaTo...
198
1
def lowercase_ ( A__ ) -> List[Any]: """simple docstring""" snake_case = len(A__ ) for i in range(length - 1 ): snake_case = i for k in range(i + 1 , A__ ): if collection[k] < collection[least]: snake_ca...
137
def lowercase_ ( A__ = 1000 ) -> int: """simple docstring""" return sum(2 * a * ((a - 1) // 2) for a in range(3 , n + 1 ) ) if __name__ == "__main__": print(solution())
137
1
from collections import OrderedDict from typing import Mapping from ...configuration_utils import PretrainedConfig from ...onnx import OnnxConfig from ...utils import logging __UpperCAmelCase : Optional[Any] = logging.get_logger(__name__) __UpperCAmelCase : Tuple = ...
111
from ...configuration_utils import PretrainedConfig from ...utils import logging _lowerCamelCase =logging.get_logger(__name__) _lowerCamelCase ={ "facebook/vit-mae-base": "https://huggingface.co/facebook/vit-mae-base/resolve/main/config.json", # See all ViT MAE models at https://h...
334
0
from typing import Dict, List, Optional, Union import numpy as np from .feature_extraction_utils import BatchFeature, FeatureExtractionMixin from .utils import PaddingStrategy, TensorType, is_tf_tensor, is_torch_tensor, logging, to_numpy __magic_name__ = logging.get_logger(__name__) ...
355
import operator as op def _lowerCAmelCase ( A__: List[str] ): '''simple docstring''' UpperCAmelCase = [] UpperCAmelCase = lambda A__ , A__ : int(x / y ) # noqa: E731 integer division operation UpperCAmelCase = { ...
152
0
import argparse import os from io import BytesIO from pathlib import Path import requests from clip_retrieval.clip_client import ClipClient from PIL import Image from tqdm import tqdm def a ( snake_case__: Dict , snake_case__: str , snake_case__: List[str] ...
30
"""simple docstring""" import pickle import unittest import torch from accelerate import Accelerator from accelerate.state import AcceleratorState from accelerate.test_utils import require_cpu @require_cpu class lowerCAmelCase_ (unittest.TestCase ): """simple docstring""" ...
25
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_mvp impo...
362
'''simple docstring''' def UpperCAmelCase_ ( __lowercase : str = "The quick brown fox jumps over the lazy dog" , ) -> bool: '''simple docstring''' _UpperCAmelCase = set() # Replace all the whitespace in our sentence _UpperCAmelCase ...
156
0
lowercase : Union[str, Any] = { """A""": ["""B""", """C""", """E"""], """B""": ["""A""", """D""", """E"""], """C""": ["""A""", """F""", """G"""], """D""": ["""B"""], """E""": ["""A""", """B""", """D"""], """F""": ["""C"""], """G""": ["""C"""], } def A_ ( A__ , ...
99
def lowerCAmelCase_ ( __UpperCAmelCase: int ) -> int: if not isinstance(__UpperCAmelCase , __UpperCAmelCase ) or number < 0: raise ValueError('''Input must be a non-negative integer''' ) UpperCamelCase__ : Optional[Any] = 0 whil...
201
0
'''simple docstring''' from typing import TYPE_CHECKING from ...utils import ( OptionalDependencyNotAvailable, _LazyModule, is_flax_available, is_tf_available, is_tokenizers_available, is_torch_available, ) __lowercase : Tuple = { 'configuration_distilbert': [ '...
352
'''simple docstring''' from dataclasses import dataclass from typing import Optional, Tuple import torch from torch import nn from transformers import RobertaPreTrainedModel, XLMRobertaConfig, XLMRobertaModel from transformers.utils import ModelOutput @dataclass class __UpperCamelCase ( lowerCAme...
294
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 __lowerCAmelCase : str =logging.get_logger(__name__) __lowerCAmelCase : Optional[int] ={'...
9
import json from typing import TYPE_CHECKING, List, Optional, Tuple from tokenizers import pre_tokenizers from ...tokenization_utils_fast import PreTrainedTokenizerFast from ...utils import logging if TYPE_CHECKING: from transformers.pipelines.conversational import Conversation __lowerCAmelCase : Optiona...
9
1
"""simple docstring""" import json import os import shutil import tempfile from unittest import TestCase from transformers import BartTokenizer, BartTokenizerFast, DPRQuestionEncoderTokenizer, DPRQuestionEncoderTokenizerFast from transformers.models.bart.configuration_bart import BartConfig from t...
326
"""simple docstring""" import argparse import json import os from collections import OrderedDict import torch from transformers import LukeConfig, LukeForMaskedLM, MLukeTokenizer, XLMRobertaTokenizer from transformers.tokenization_utils_base import AddedToken @torch.no_grad() def ...
326
1
'''simple docstring''' import requests def __lowercase ( __lowercase , __lowercase ) -> None: '''simple docstring''' _A = {"Content-Type": "application/json"} _A = requests.post(__lowercase , json={"text": message_body} , headers=__low...
79
'''simple docstring''' from __future__ import annotations import unittest from transformers import AutoTokenizer, PegasusConfig, is_tf_available from transformers.testing_utils import require_sentencepiece, require_tf, require_tokenizers, slow from transformers.utils import cached_property fro...
349
0
"""simple docstring""" from ...configuration_utils import PretrainedConfig from ...utils import logging lowercase__ : int = logging.get_logger(__name__) lowercase__ : Union[str, Any] = { """sayakpaul/vit-msn-base""": """https://huggingface.co/sayakpau...
364
"""simple docstring""" from diffusers.utils.testing_utils import require_onnxruntime @require_onnxruntime class UpperCamelCase__ : """simple docstring""" pass
289
0
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 .tokenization_big_bird import ...
348
from functools import lru_cache @lru_cache def _snake_case ( lowerCAmelCase : int ): """simple docstring""" if num < 0: raise ValueError("Number should not be negative." ) return 1 if num in (0, 1) else num * factorial(num - 1 ) if __name__ == "__main__": import doctest doct...
18
0
import importlib.metadata import operator import re import sys from typing import Optional from packaging import version snake_case : List[str] = { '''<''': operator.lt, '''<=''': operator.le, '''==''': operator.eq, '''!=''': operator.ne, '''>=''': operator.ge, '''>''': ...
109
from __future__ import annotations def __lowercase ( __lowerCAmelCase : List[Any] , __lowerCAmelCase : Optional[Any] , __lowerCAmelCase : str , __lowerCAmelCase : List[str] ): # noqa: E741 while r - l > 1: a__ = (l + r...
109
1
from __future__ import annotations from typing import Dict from ...configuration_utils import PretrainedConfig A__ = { '''susnato/ernie-m-base_pytorch''': '''https://huggingface.co/susnato/ernie-m-base_pytorch/blob/main/config.json''', '''susnato/ernie-m-large_pytorch''': '''htt...
230
from collections import OrderedDict from typing import TYPE_CHECKING, Any, Mapping, Optional from packaging import version from ...configuration_utils import PretrainedConfig from ...onnx import OnnxConfig from ...onnx.utils import compute_effective_axis_dimension from ...utils import logging if TYPE_CHECKING: ...
345
0
from ..utils import DummyObject, requires_backends class UpperCamelCase ( metaclass=lowercase__ ): '''simple docstring''' lowercase : Optional[int] =["""flax""", """transformers"""] def __init__( self , *UpperCamelCase_ , ...
365
from __future__ import annotations from random import random class UpperCamelCase : '''simple docstring''' def __init__( self , UpperCamelCase_ = None ): lowercase_ :Tuple = value lowercase_ :Tuple = r...
252
0
from __future__ import annotations UpperCAmelCase__ = list[list[int]] # assigning initial values to the grid UpperCAmelCase__ = [ [3, 0, 6, 5, 0, 8, 4, 0, 0], [5, 2, 0, 0, 0, 0, 0, 0, 0], [0, 8, 7, 0, 0, 0, 0, 3, 1], [0, 0, 3, 0, 1, 0, 0, 8, 0], [9, 0, 0, 8, 6...
0
"""simple docstring""" import numpy as np import pandas as pd from sklearn.preprocessing import MinMaxScaler from tensorflow.keras.layers import LSTM, Dense from tensorflow.keras.models import Sequential if __name__ == "__main__": __a = pd.read_csv("sample_data.csv", header=None) __a = ...
66
0
'''simple docstring''' def SCREAMING_SNAKE_CASE__ ( snake_case : int , snake_case : int ) -> str: """simple docstring""" if a < 0 or b < 0: raise ValueError('the value of both inputs must be positive' ) a : List[str] = ...
345
'''simple docstring''' from typing import TYPE_CHECKING from ...utils import ( OptionalDependencyNotAvailable, _LazyModule, is_sentencepiece_available, is_tokenizers_available, is_torch_available, is_vision_available, ) UpperCamelCase : List[str] = {"""processing_layout...
345
1
'''simple docstring''' from ...configuration_utils import PretrainedConfig from ...utils import logging a : Optional[int] = logging.get_logger(__name__) a : Union[str, Any] = { 'sayakpaul/vit-msn-base': 'https://huggingface.co/sayakpaul/vit-msn-base/resolve/main/config.json', # See...
311
"""simple docstring""" from argparse import ArgumentParser from .env import EnvironmentCommand def _SCREAMING_SNAKE_CASE ( ): '''simple docstring''' lowercase = ArgumentParser('Diffusers CLI tool' , usage='diffusers-cli <command> [<args>]' ) lowercase ...
220
0
'''simple docstring''' import argparse import os.path as osp import re import torch from safetensors.torch import load_file, save_file # =================# # UNet Conversion # # =================# UpperCAmelCase = [ # (stable-diffusion, HF Diffusers) ('time_embed.0.weight', 'time_em...
365
'''simple docstring''' from __future__ import annotations import os import tempfile import unittest from transformers import ConvBertConfig, is_tf_available from transformers.testing_utils import require_tf, slow from ...test_configuration_common import ConfigTester from ...test_modeling_tf_comm...
187
0
'''simple docstring''' import warnings from ...utils import logging from .image_processing_deformable_detr import DeformableDetrImageProcessor lowerCAmelCase: List[str] = logging.get_logger(__name__) class a__( UpperCamelCase_ ): def __init__( self : str ...
297
import unittest from transformers import EsmConfig, is_torch_available from transformers.testing_utils import TestCasePlus, require_torch, slow, torch_device from ...test_configuration_common import ConfigTester from ...test_modeling_common import ModelTesterMixin, ids_tensor, random_attention_mask from ...tes...
338
0
'''simple docstring''' import unittest from accelerate import debug_launcher from accelerate.test_utils import require_cpu, test_ops, test_script @require_cpu class UpperCamelCase__( unittest.TestCase ): def a__( self : List[str] )-> Union[str, Any]: """simple...
353
'''simple docstring''' from __future__ import annotations from typing import Any class UpperCamelCase__: def __init__( self : Any , lowerCAmelCase : int , lowerCAmelCase : int , lowerCAmelCase : float = 0 )-> None: """simple docstring""...
91
0
"""simple docstring""" # using dfs for finding eulerian path traversal def UpperCAmelCase__ (snake_case__ : List[str] , snake_case__ : Tuple , snake_case__ : int , snake_case__ : List[str]=None ): """simple docstring""" _snake_ca...
64
"""simple docstring""" from math import factorial A_ = {str(d): factorial(d) for d in range(10)} def UpperCAmelCase__ (snake_case__ : int ): """simple docstring""" return sum(DIGIT_FACTORIAL[d] for d in str(snake_case__ ) ) def UpperCAmelCas...
64
1
# 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 by a...
134
from __future__ import annotations _snake_case : Union[str, Any] = [] def lowerCAmelCase_ ( __lowerCamelCase , __lowerCamelCase , __lowerCamelCase ): for i in range(len(__lowerCamelCase ) ): if board[row][i] == 1: ...
134
1