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 argparse import glob import importlib.util import os import re import black from doc_builder.style_doc import style_docstrings_in_code # All paths are set with the intent you should run this script from the root of the repo with the command # python u...
183
"""simple docstring""" def SCREAMING_SNAKE_CASE__ ( __UpperCAmelCase , __UpperCAmelCase ) -> List[str]: lowercase__: Optional[Any] = 0 lowercase__: List[Any] = len(__UpperCAmelCase ) - 1 while left <= right: # avoid divided by 0 during interpolation if so...
177
0
'''simple docstring''' def a ( lowerCamelCase__ , lowerCamelCase__ ): '''simple docstring''' return price * (1 + tax_rate) if __name__ == "__main__": print(F"{price_plus_tax(1_0_0, 0.25) = }") print(F"{price_plus_tax(1_2_5.5_0, 0.05) = }")
367
'''simple docstring''' from maths.is_square_free import is_square_free from maths.prime_factors import prime_factors def a ( lowerCamelCase__ ): '''simple docstring''' A_ : List[Any] = prime_factors(lowerCamelCase__ ) if is_square_free(lowerCamelCase__ ): ...
135
0
"""simple docstring""" import unittest from transformers import BigBirdTokenizer, BigBirdTokenizerFast from transformers.testing_utils import get_tests_dir, require_sentencepiece, require_tokenizers, require_torch, slow from transformers.utils import cached_property from ...test_tokenization_common import Tokeniz...
44
'''simple docstring''' import itertools import string from collections.abc import Generator, Iterable def a__ ( lowercase : Iterable[str], lowercase : int ) -> Generator[tuple[str, ...], None, None]: """simple docstring""" _UpperCamelCase = ...
324
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 ...
334
'''simple docstring''' import argparse import torch from transformers import ( EncodecConfig, EncodecFeatureExtractor, EncodecModel, logging, ) # checkpoints downloaded from: # https://dl.fbaipublicfiles.com/encodec/v0/encodec_24khz-d7cc33bc.th # https://huggingface.co/f...
334
1
"""simple docstring""" import argparse import collections import json from pathlib import Path import requests import torch import yaml from huggingface_hub import hf_hub_download from PIL import Image from transformers import ( MobileViTImageProcessor, MobileViTVaConfig, Mobi...
113
"""simple docstring""" def lowercase (SCREAMING_SNAKE_CASE_ : int = 10_00 ) -> int: SCREAMING_SNAKE_CASE = 2**power SCREAMING_SNAKE_CASE = 0 while n: SCREAMING_SNAKE_CASE , SCREAMING_SNAKE_CASE = ...
113
1
"""simple docstring""" from typing import TYPE_CHECKING from ...utils import OptionalDependencyNotAvailable, _LazyModule, is_torch_available A__ : List[str] = { 'configuration_clipseg': [ 'CLIPSEG_PRETRAINED_CONFIG_ARCHIVE_MAP', 'CLIPSegConfig', 'CLIPSegTextConfig', ...
358
"""simple docstring""" import gc import random import unittest import numpy as np import torch from transformers import XLMRobertaTokenizer from diffusers import ( AltDiffusionImgaImgPipeline, AutoencoderKL, PNDMScheduler, UNetaDConditionModel, ) from diffusers.image_processor import VaeImag...
209
0
'''simple docstring''' import warnings from ...processing_utils import ProcessorMixin from ...tokenization_utils_base import BatchEncoding class _a ( __a ): __a : Optional[int] = ["""image_processor""", """tokenizer"""] __a : str = """CLIPImageProcessor...
34
from typing import TYPE_CHECKING from ...file_utils import _LazyModule, is_tokenizers_available, is_torch_available from ...utils import OptionalDependencyNotAvailable lowerCAmelCase = {'''configuration_gpt_neox''': ['''GPT_NEOX_PRETRAINED_CONFIG_ARCHIVE_MAP''', '''GPTNeoXConfig''']} try: if not is_t...
295
0
"""simple docstring""" from ...configuration_utils import PretrainedConfig class snake_case ( __lowerCamelCase): __UpperCamelCase = """bert-generation""" def __init__( self : Dict , a__ : str=5_03_58 , a__ : int=10_24 , a__ : List[st...
350
"""simple docstring""" import logging import os import sys import warnings from dataclasses import dataclass, field from random import randint from typing import Optional import datasets import evaluate import numpy as np from datasets import DatasetDict, load_dataset import transformers from...
163
0
"""simple docstring""" from typing import TYPE_CHECKING from ...utils import OptionalDependencyNotAvailable, _LazyModule, is_tokenizers_available, is_torch_available _A = { """configuration_bloom""": ["""BLOOM_PRETRAINED_CONFIG_ARCHIVE_MAP""", """BloomConfig""", """BloomOnnxConfig"""], } try...
242
"""simple docstring""" from collections import OrderedDict from typing import Mapping from packaging import version from ...configuration_utils import PretrainedConfig from ...onnx import OnnxConfig from ...utils import logging lowerCAmelCase__ = logging.get_logger(__name__) lowerCAmelCase__ ...
108
0
class UpperCAmelCase : def __init__(self : int , snake_case__ : int ) -> str: '''simple docstring''' snake_case : Union[str, Any] = n snake_case : Any = [None] * self.n snake_case : List[Any] ...
10
def UpperCamelCase ( __lowerCamelCase : str ): snake_case : Union[str, Any] = 0 # if input_string is "aba" than new_input_string become "a|b|a" snake_case : Tuple = "" snake_case : Optional[int] = "" # ap...
10
1
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 OptionalDependencyNotAvailable...
129
import warnings from contextlib import contextmanager from ...processing_utils import ProcessorMixin class lowerCamelCase__ ( lowerCamelCase__): '''simple docstring''' snake_case_ ="""Speech2TextFeatureExtractor""" snake_case_ ="""Speech2TextTokenizer""" def __init__(self ,__lo...
129
1
import inspect import unittest from transformers import DecisionTransformerConfig, 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 from ...test_modeling_common ...
301
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 UpperCAmelCase__ : Tuple = logging.get_logger(__name__) UpperCAmelCase__ : Union[str, ...
301
1
import requests def snake_case( __magic_name__ , __magic_name__ ) -> None: '''simple docstring''' lowercase : str = {'''Content-Type''': '''application/json'''} lowercase : Union[str, Any] = requests.post(__magic_name__ ,...
308
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 lowerCAmelCase_ = logg...
308
1
'''simple docstring''' import gc import unittest import numpy as np import torch from diffusers import StableDiffusionKDiffusionPipeline from diffusers.utils import slow, torch_device from diffusers.utils.testing_utils import enable_full_determinism, require_torch_gpu enable_full_det...
360
'''simple docstring''' from typing import Optional import pyspark from .. import Features, NamedSplit from ..download import DownloadMode from ..packaged_modules.spark.spark import Spark from .abc import AbstractDatasetReader class lowercase ( _lowerCamelCase ): """simple docstring""" de...
349
0
"""simple docstring""" import os from typing import Dict, List, Tuple, TypeVar, Union _a : List[str]= TypeVar("T") _a : int= Union[List[T], Tuple[T, ...]] _a : Union[str, Any]= Union[T, List[T], Dict[str, T]] _a : int= Union[str, bytes, os.PathLike]
172
"""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 _a : i...
172
1
"""simple docstring""" import faiss # noqa: F401 # Here to have a nice missing dependency error message early on import numpy # noqa: F401 # Here to have a nice missing dependency error message early on import requests # noqa: F401 # Here to have a nice missing dependency error message early on import sklearn #...
56
"""simple docstring""" from math import loga def _lowercase ( __lowerCAmelCase ) -> int: if a < 0: raise ValueError("""Input value must be a positive integer""" ) elif isinstance(__lowerCAmelCase , __lowerCAmelCase ): raise TypeError("""In...
56
1
"""simple docstring""" import torch import torch.nn as nn from transformers.modeling_utils import ModuleUtilsMixin from transformers.models.ta.modeling_ta import TaBlock, TaConfig, TaLayerNorm from ...configuration_utils import ConfigMixin, register_to_config from ...models import ModelMixin class _UpperCAmel...
102
"""simple docstring""" import numpy as np from PIL import Image def lowercase_ ( _lowerCamelCase: np.ndarray , _lowerCamelCase: int , _lowerCamelCase: int ) -> np.ndarray: '''simple docstring''' __lowerCamelCase : Dict = np.array...
135
0
import random import unittest from torch.utils.data import BatchSampler, DataLoader, IterableDataset from accelerate import Accelerator from accelerate.data_loader import ( BatchSamplerShard, DataLoaderDispatcher, DataLoaderShard, IterableDatasetShard, SkipBatchSampler, Ski...
256
import argparse import json import os import time import zipfile from get_ci_error_statistics import download_artifact, get_artifacts_links from transformers import logging __SCREAMING_SNAKE_CASE = logging.get_logger(__name__) def UpperCAmelCase ( _lowerCamelCase , ...
256
1
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 torch i...
334
def snake_case__ ( lowerCAmelCase_ ): """simple docstring""" return " ".join( ''.join(word[::-1] ) if len(lowerCAmelCase_ ) > 4 else word for word in sentence.split() ) if __name__ == "__main__": import doctest doctest.testmod() print(reverse_long_words("Hey wollef...
334
1
"""simple docstring""" import io import os import unicodedata from typing import Any, Dict, List, Optional, Tuple import sentencepiece as spm from ...tokenization_utils import PreTrainedTokenizer from ...utils import logging __A = logging.get_logger(__name__) __A = """▁""" __A ...
361
"""simple docstring""" import json from typing import Iterator, List, Union from tokenizers import AddedToken, Regex, Tokenizer, decoders, normalizers, pre_tokenizers, trainers from tokenizers.implementations.base_tokenizer import BaseTokenizer from tokenizers.models import Unigram from tokenizers.processor...
254
0
'''simple docstring''' from scipy.stats import pearsonr, spearmanr from sklearn.metrics import fa_score, matthews_corrcoef import datasets lowerCamelCase : List[Any] = "\\n@inproceedings{wang2019glue,\n title={{GLUE}: A Multi-Task Benchmark and Analysis Platform for Natural Language Understanding},\...
47
import pytest from datasets.parallel import ParallelBackendConfig, parallel_backend from datasets.utils.py_utils import map_nested from .utils import require_dill_gt_0_3_2, require_joblibspark, require_not_windows def lowerCAmelCase__(__snake_case ) -> int: # picklable for multiprocessing ...
209
0
import os from shutil import copyfile from typing import Any, Dict, List, Optional, Tuple import sentencepiece as spm from ...tokenization_utils import AddedToken, PreTrainedTokenizer from ...utils import logging __A = logging.get_logger(__name__) __A = '''▁''' __A = {'''vocab...
277
from math import acos, sin from typing import List, Tuple, Union import numpy as np import torch from PIL import Image from ...models import AutoencoderKL, UNetaDConditionModel from ...schedulers import DDIMScheduler, DDPMScheduler from ...utils import randn_tensor from ..pipeline_utils import AudioPipelineOutput...
277
1
'''simple docstring''' import datasets from .evaluate import evaluate _A : Tuple ='''\ @inproceedings{Rajpurkar2016SQuAD10, title={SQuAD: 100, 000+ Questions for Machine Comprehension of Text}, author={Pranav Rajpurkar and Jian Zhang and Konstantin Lopyrev and Percy Li...
41
'''simple docstring''' from __future__ import annotations def _UpperCamelCase ( UpperCamelCase__ ): return [ord(UpperCamelCase__ ) - 9_6 for elem in plain] def _UpperCamelCase ( UpperCamelCase__ ): return "".join(chr(elem + 9_6 ) for...
163
0
"""simple docstring""" import unittest from transformers import DebertaConfig, is_torch_available from transformers.testing_utils import require_sentencepiece, require_tokenizers, require_torch, slow, torch_device from ...test_configuration_common import ConfigTester from ...test_modeling_c...
366
"""simple docstring""" from typing import List, Optional from tokenizers import ByteLevelBPETokenizer from ...tokenization_utils_fast import PreTrainedTokenizerFast from ...utils import logging from .tokenization_blenderbot_small import BlenderbotSmallTokenizer A__ : Dict = logging.get_logger(__name...
209
0
class _SCREAMING_SNAKE_CASE : '''simple docstring''' def __init__(self : Optional[Any] , UpperCAmelCase_ : int) ->Optional[int]: '''simple docstring''' lowerCamelCase__: Any =n lowerCamelCase__: Tuple =[None] * self.n lowerCamelCase__: ...
10
import logging from transformers.configuration_utils import PretrainedConfig __A = logging.getLogger(__name__) class _SCREAMING_SNAKE_CASE ( __SCREAMING_SNAKE_CASE ): '''simple docstring''' lowercase_ = "masked_bert" def __init__(self : Dict , UpperCAmelCase_ ...
10
1
'''simple docstring''' from typing import TYPE_CHECKING from ...utils import OptionalDependencyNotAvailable, _LazyModule, is_torch_available snake_case__ = { 'configuration_time_series_transformer': [ 'TIME_SERIES_TRANSFORMER_PRETRAINED_CONFIG_ARCHIVE_MAP', 'Ti...
360
'''simple docstring''' import sys import tempfile import unittest import unittest.mock as mock from pathlib import Path from huggingface_hub import HfFolder, delete_repo from requests.exceptions import HTTPError from transformers import AutoImageProcessor, ViTImageProcessor from transform...
4
0
"""simple docstring""" from collections import namedtuple import requests from lxml import html # type: ignore SCREAMING_SNAKE_CASE_ = namedtuple('''covid_data''', '''cases deaths recovered''') def lowercase (_lowerCAmelCase = "https://www.worldometers.info/coronavirus/" ): __lowerC...
301
"""simple docstring""" def lowercase (_lowerCAmelCase = 100_0000 ): __lowerCAmelCase = 1 __lowerCAmelCase = 1 __lowerCAmelCase = {1: 1} for inputa in range(2 , _lowerCAmelCase ): __lowerCAmelCase = 0 __lowerCA...
301
1
from math import pi, sqrt, tan def __lowercase ( __lowerCAmelCase : float ): if side_length < 0: raise ValueError('surface_area_cube() only accepts non-negative values' ) return 6 * side_length**2 def __lowercase ( __lowerCAme...
109
from collections import defaultdict from math import ceil, sqrt def __lowercase ( __lowerCAmelCase : int = 1_0_0_0_0_0_0 , __lowerCAmelCase : int = 1_0 ): a__ = defaultdict(__lowerCAmelCase ) for outer_width in range(3 , (t_limit // 4) + 2...
109
1
from jiwer import compute_measures import datasets __A : str = '\\n@inproceedings{inproceedings,\n author = {Morris, Andrew and Maier, Viktoria and Green, Phil},\n year = {2004},\n month = {01},\n pages = {},\n title = {From WER and RIL to MER and WIL: improved evaluation measures ...
273
'''simple docstring''' from typing import TYPE_CHECKING from ...utils import ( OptionalDependencyNotAvailable, _LazyModule, is_sentencepiece_available, is_speech_available, is_torch_available, ) a__ : str = { 'configuration_trocr': ['TROCR_PRETRAINED_CONFIG_...
349
0
'''simple docstring''' import random import unittest import numpy as np import torch from transformers import CLIPTextConfig, CLIPTextModel, CLIPTokenizer from diffusers import ( AutoencoderKL, DDIMScheduler, UNetaDConditionModel, VideoToVideoSDPipeline, ) from diffusers....
351
'''simple docstring''' import unittest import numpy as np from transformers.testing_utils import require_pytesseract, require_torch from transformers.utils import is_pytesseract_available, is_torch_available from ...test_image_processing_common import ImageProcessingSavingTestMixin, prepa...
3
0
'''simple docstring''' import logging import os import sys from dataclasses import dataclass, field from typing import Optional import torch from datasets import load_dataset from torchvision.transforms import Compose, Lambda, Normalize, RandomHorizontalFlip, RandomResizedCrop, ToTensor from torchvision.transfor...
56
'''simple docstring''' from __future__ import annotations import math def __magic_name__ ( __UpperCAmelCase, __UpperCAmelCase, __UpperCAmelCase, __UpperCAmelCase, __UpperCAmelCase ) -> int: '''simple docstring''' if depth < 0: raise ValueError('''Depth cannot...
56
1
"""simple docstring""" from ...configuration_utils import PretrainedConfig from ...utils import logging __A = logging.get_logger(__name__) __A = { "facebook/vit-mae-base": "https://huggingface.co/facebook/vit-mae-base/resolve/main/config.json", # See all ViT MAE models at ht...
2
"""simple docstring""" import os import re import shutil from argparse import ArgumentParser, Namespace from datasets.commands import BaseDatasetsCLICommand from datasets.utils.logging import get_logger __A = "<<<<<<< This should probably be modified because it mentions: " __A = "=...
2
1
"""simple docstring""" 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_co...
256
"""simple docstring""" from typing import List import numpy as np def lowercase ( a__ : dict ) -> int: _UpperCamelCase = {key: len(a__ ) for key, value in gen_kwargs.items() if isinstance(a__ , a__ )} if len(set(lists_lengths.values() ) ) > 1: ...
256
1
import re def __UpperCamelCase (_SCREAMING_SNAKE_CASE ) -> bool: lowercase__ = re.compile( R'^(?:0|94|\+94|0{2}94)' R'7(0|1|2|4|5|6|7|8)' R'(-| |)' R'\d{7}$' ) return bool(re.search(__UpperCAmelCase , __UpperCAmelCase ) ) if __name__ == "__...
356
from typing import TYPE_CHECKING from ..utils import _LazyModule lowercase_ = { """config""": [ """EXTERNAL_DATA_FORMAT_SIZE_LIMIT""", """OnnxConfig""", """OnnxConfigWithPast""", """OnnxSeq2SeqConfigWithPast""", """PatchingSpec""", ], ...
269
0
import darl # noqa import gym import tqdm from diffusers.experimental import ValueGuidedRLPipeline __snake_case :List[str] = { '''n_samples''': 64, '''horizon''': 32, '''num_inference_steps''': 20, '''n_guide_steps''': 2, # can set to 0 for faster sampling, does not use value net...
49
'''simple docstring''' import argparse import os import shutil from pathlib import Path import onnx import torch from packaging import version from torch.onnx import export from diffusers import OnnxRuntimeModel, OnnxStableDiffusionPipeline, StableDiffusionPipeline _UpperCamelCase = ver...
254
0
import math from ...configuration_utils import PretrainedConfig from ...utils import logging A : Any = logging.get_logger(__name__) A : Optional[Any] = { 'facebook/data2vec-base-960h': 'https://huggingface.co/facebook/data2vec-audio-base-960h/resolve/main/config.json', # ...
351
import warnings from ...utils import logging from .image_processing_clip import CLIPImageProcessor A : List[Any] = logging.get_logger(__name__) class A ( UpperCAmelCase__ ): '''simple docstring''' def __init__(self : List[Any] , *_UpperCAm...
146
0
import argparse import fairseq import torch from torch import nn from transformers import ( MBartaaTokenizer, MBartConfig, MBartForCausalLM, SpeechEncoderDecoderConfig, SpeechEncoderDecoderModel, WavaVecaConfig, WavaVecaFeatureExtractor, WavaVecaModel, logging, ) logging.set_...
277
import argparse import json import pickle from pathlib import Path import requests import torch from huggingface_hub import hf_hub_download from PIL import Image from transformers import MaskFormerConfig, MaskFormerForInstanceSegmentation, MaskFormerImageProcessor, SwinConfig from transformers.utils import loggin...
277
1
from __future__ import annotations UpperCamelCase_ = [-10, -5, 0, 5, 5.1, 11, 13, 21, 3, 4, -21, -10, -5, -1, 0] UpperCamelCase_ = [-5, 0, 5, 5.1, 11, 13, 21, -1, 4, -1, -10, -5, -1, 0, -1] def A ( __UpperCAmelCase ) -> list[float]: '''simple docstring''' ...
352
import os from dataclasses import dataclass, field from io import BytesIO from typing import TYPE_CHECKING, Any, ClassVar, Dict, Optional, Union import numpy as np import pyarrow as pa from .. import config from ..download.streaming_download_manager import xopen, xsplitext from ..table import array_cast from ..ut...
344
0
"""simple docstring""" import argparse import os import re __snake_case : Optional[int] = 'src/diffusers' # Pattern that looks at the indentation in a line. __snake_case : List[Any] = re.compile(R'^(\s*)\S') # Pattern that matches `"key":" and puts `key` ...
269
from collections import OrderedDict from typing import Mapping from ...configuration_utils import PretrainedConfig from ...onnx import OnnxConfig from ...utils import logging _a = logging.get_logger(__name__) _a = { "camembert-base": "https://huggingface.co/camembert-base/resolve/mai...
209
0
from __future__ import annotations import math import numpy as np from numpy.linalg import norm def _lowerCAmelCase ( __lowerCAmelCase , __lowerCAmelCase ) -> float: """simple docstring""" return math.sqrt(sum(pow(a - b , 2 ) for a, b in zip(lowercase__ , lo...
356
A__ = 0 # The first color of the flag. A__ = 1 # The second color of the flag. A__ = 2 # The third color of the flag. A__ = (red, white, blue) def _lowerCAmelCase ( __lowerCAmelCase ) -> list: """simple docstring""" if n...
44
0
"""simple docstring""" import copy from ...configuration_utils import PretrainedConfig from ...utils import logging from ..auto import CONFIG_MAPPING __A : List[str] = logging.get_logger(__name__) __A : int = { '''ut/deta''': '''https://huggingface.co/ut/...
33
'''simple docstring''' import gc import unittest import numpy as np import torch from diffusers import StableDiffusionKDiffusionPipeline from diffusers.utils import slow, torch_device from diffusers.utils.testing_utils import enable_full_determinism, require_torch_gpu enable_full_determini...
4
0
import unittest import numpy as np from diffusers import LMSDiscreteScheduler, OnnxStableDiffusionInpaintPipeline from diffusers.utils.testing_utils import ( is_onnx_available, load_image, nightly, require_onnxruntime, require_torch_gpu, ) from ..test_pipelines_onnx_common import OnnxPipelineT...
185
import tempfile import unittest from transformers import TaConfig, is_torch_available from transformers.testing_utils import ( require_sentencepiece, require_tokenizers, require_torch, slow, torch_device, ) from ...generation.test_utils import GenerationTesterMixin from ...test_modeling_common ...
185
1
"""simple docstring""" import argparse from diffusers.pipelines.stable_diffusion.convert_from_ckpt import download_controlnet_from_original_ckpt if __name__ == "__main__": A: Tuple = argparse.ArgumentParser() parser.add_argument( "--checkpoint_path", default=None, type=str, requi...
109
"""simple docstring""" import argparse import re from typing import Dict import torch from datasets import Audio, Dataset, load_dataset, load_metric from transformers import AutoFeatureExtractor, pipeline def _snake_case ( UpperCamelCase : Dataset , UpperCamelCase : Dict[str, str] ...
109
1
def UpperCAmelCase ( _lowerCamelCase , _lowerCamelCase ): return int((input_a, input_a).count(1 ) != 0 ) def UpperCAmelCase ( ): assert or_gate(0 , 0 ) == 0 assert or_gate(0 , 1 ) == 1 assert or_gate(1 , 0 ) == 1 assert o...
256
import os import random import sys from . import cryptomath_module as cryptomath from . import rabin_miller __SCREAMING_SNAKE_CASE = 3 def UpperCAmelCase ( _lowerCamelCase ): print("Generating primitive root of p" ) while True: A : str =...
256
1
import argparse from transformers import ( TapasConfig, TapasForMaskedLM, TapasForQuestionAnswering, TapasForSequenceClassification, TapasModel, TapasTokenizer, load_tf_weights_in_tapas, ) from transformers.utils import logging logging.set_verbosity_info() ...
90
'''simple docstring''' def lowerCAmelCase_ ( snake_case__ = 10 ): '''simple docstring''' if not isinstance(snake_case__ , snake_case__ ) or n < 0: raise ValueError('''Invalid input''' ) A : List[str] = 10**n A : Tup...
3
0
def __UpperCAmelCase ( __a : int ,__a : float ,__a : float ) -> float: """simple docstring""" return round(float(moles / volume ) * nfactor ) def __UpperCAmelCase ( __a : float ,__a : float ,__a : ...
15
import argparse import json import os import fairseq import torch from fairseq.data import Dictionary from transformers import ( HubertConfig, HubertForCTC, HubertModel, WavaVecaCTCTokenizer, WavaVecaFeatureExtractor, WavaVecaProcessor, logging, ) logging.set_verbo...
15
1
'''simple docstring''' from ...configuration_utils import PretrainedConfig from ...utils import logging lowerCamelCase : Any = logging.get_logger(__name__) lowerCamelCase : Tuple = { 'facebook/vit-mae-base': 'https://huggingface.co/facebook/vit-mae-base/resolve/main/config.json'...
2
'''simple docstring''' import unittest from transformers import TrOCRConfig from transformers.testing_utils import is_torch_available, require_torch, torch_device from ...generation.test_utils import GenerationTesterMixin from ...test_configuration_common import ConfigTester from ...test_modeling_common import Mo...
2
1
"""simple docstring""" import itertools import string from collections.abc import Generator, Iterable def _lowerCamelCase( a , a ): __a = iter(a ) while True: __a = tuple(itertools.islice(a , a ) ) if not chunk: ...
268
"""simple docstring""" SCREAMING_SNAKE_CASE__:Any = { """A""": """.-""", """B""": """-...""", """C""": """-.-.""", """D""": """-..""", """E""": """.""", """F""": """..-.""", """G""": """--.""", """H""": """....""", """I""": """..""", """J""": """.---""", """K""": """-.-""", """L""": """.-..""", """M""": ""...
268
1
'''simple docstring''' import math def __lowercase ( __lowercase = 100 ) -> int: '''simple docstring''' _A = sum(i * i for i in range(1 , n + 1 ) ) _A = int(math.pow(sum(range(1 , n + 1 ) ) , 2 ) ) ...
79
import torch from torch import nn class snake_case ( nn.Module ): '''simple docstring''' def __init__( self : int , lowerCAmelCase : Tuple , lowerCAmelCase : int , lowerCAmelCase : Any , lowerCAmelCase : T...
317
0
"""simple docstring""" from __future__ import annotations import math _lowerCAmelCase :Tuple = '2020.9.26' _lowerCAmelCase :int = 'xcodz-dot, cclaus, dhruvmanila' def lowerCamelCase_ (UpperCamelCase__ : Dict , UpperCamelCase__ : List[Any] , UpperCamelCase__ : List[str] ,...
371
"""simple docstring""" from transformers import HfArgumentParser, TensorFlowBenchmark, TensorFlowBenchmarkArguments def lowerCamelCase_ (): _UpperCAmelCase : int = HfArgumentParser(UpperCamelCase__ ) _UpperCAmelCase : Optional[Any] = parser.parse_args...
68
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...
108
import shutil import tempfile import unittest import numpy as np import pytest from transformers import is_speech_available, is_vision_available from transformers.testing_utils import require_torch if is_vision_available(): from transformers import TvltImageProcessor if is_speech_available(): from...
146
0
'''simple docstring''' import unittest import numpy as np import torch from transformers import CLIPTextConfig, CLIPTextModel, CLIPTokenizer from diffusers import ( AutoencoderKL, DDIMScheduler, DPMSolverMultistepScheduler, TextToVideoSDPipeline, UNetaDConditionModel, ) from diffusers.utils ...
91
'''simple docstring''' import numpy as np from cva import COLOR_BGR2GRAY, CV_8UC3, cvtColor, filteraD, imread, imshow, waitKey def lowerCamelCase__ ( A : int , A : int , A : int , A : int , A : int , A ...
91
1
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_ = logging.get_logger(__name__) lowerCAmelCase_ = {...
308
def snake_case( __magic_name__ , __magic_name__ ) -> float: '''simple docstring''' return price * (1 + tax_rate) if __name__ == "__main__": print(f'''{price_plus_tax(1_00, 0.2_5) = }''') print(f'''{price_plus_tax(1_2_5.5_0, 0.0_5) = }''')
308
1
'''simple docstring''' from __future__ import annotations def _a ( _lowerCamelCase : List[str] ) -> list: """simple docstring""" if len(_lowerCamelCase ) == 0: return [] __snake_case : Tuple = min(_lowerCamel...
358
'''simple docstring''' from collections import OrderedDict from typing import Any, List, Mapping, Optional from ... import PreTrainedTokenizer, TensorType, is_torch_available from ...configuration_utils import PretrainedConfig from ...onnx import OnnxConfigWithPast, PatchingSpec from ......
13
0
'''simple docstring''' import gc import random import unittest import numpy as np import torch from transformers import CLIPTextConfig, CLIPTextModel, CLIPTokenizer import diffusers from diffusers import ( AutoencoderKL, EulerDiscreteScheduler, StableDiffusionLatentUpscalePipeline, StableDiffusi...
27
"""simple docstring""" import pickle import shutil import tempfile import unittest from transformers import SPIECE_UNDERLINE, XGLMTokenizer, XGLMTokenizerFast from transformers.testing_utils import get_tests_dir, require_sentencepiece, require_tokenizers, slow from transformers.utils import cached_property from ....
44
0
from ...utils import is_torch_available, is_transformers_available if is_transformers_available() and is_torch_available(): from .pipeline_vq_diffusion import LearnedClassifierFreeSamplingEmbeddings, VQDiffusionPipeline
367
def __lowerCAmelCase (SCREAMING_SNAKE_CASE , SCREAMING_SNAKE_CASE )-> list[int]: """simple docstring""" snake_case_ = int(SCREAMING_SNAKE_CASE ) # Initialize Result snake_case_ = [] # Traverse through all denomination for denomination in reversed(SCREAMING_SNAKE_C...
267
0
'''simple docstring''' # Copyright 2023 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 # #...
185
'''simple docstring''' A__ : Optional[int] = """ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/""" def UpperCAmelCase__ ( UpperCAmelCase_ : bytes ) -> bytes: # Make sure the supplied data is a bytes-like object if not isinstance(UpperCAmelCase...
185
1
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, JumanppTokeni...
343
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) _snake_case = logging.getLogger() def lowerCAmelCase_ ...
343
1
"""simple docstring""" from typing import TYPE_CHECKING # rely on isort to merge the imports from ...utils import OptionalDependencyNotAvailable, _LazyModule, is_torch_available UpperCAmelCase = {"""configuration_focalnet""": ["""FOCALNET_PRETRAINED_CONFIG_ARCHIVE_MAP""", """FocalNetConfig"""]} try: if n...
256
"""simple docstring""" import argparse import os import jax as jnp import numpy as onp import torch import torch.nn as nn from music_spectrogram_diffusion import inference from tax import checkpoints from diffusers import DDPMScheduler, OnnxRuntimeModel, SpectrogramDiffusionPipeline from diffusers.pipelines.spectrog...
256
1
from __future__ import annotations from itertools import permutations from random import randint from timeit import repeat def lowerCamelCase ( ) -> tuple[list[int], int]: lowerCAmelCase_ = [randint(-1_000 , 1_000 ) for i in range(10 )] ...
14
def lowerCamelCase ( a_ , a_ ) -> List[Any]: lowerCAmelCase_ = 0 while b > 0: if b & 1: res += a a += a b >>= 1 return res def lowerCamelCase ( a_ , a...
14
1
def UpperCAmelCase ( a_ , a_ , a_ ) -> float: """simple docstring""" return round(float(moles / volume ) * nfactor ) def UpperCAmelCase ( a_ , a_ , a_ ) -> float: """simple docstring""" return round(float((moles * 0.0_821 * tempera...
15
import PIL.Image import PIL.ImageOps from packaging import version from PIL import Image if version.parse(version.parse(PIL.__version__).base_version) >= version.parse('9.1.0'): SCREAMING_SNAKE_CASE :Any = { 'linear': PIL.Image.Resampling.BILINEAR, 'bilinear': PIL.Image.Resampl...
15
1
"""simple docstring""" import gc import random import unittest import torch from diffusers import ( IFImgaImgPipeline, IFImgaImgSuperResolutionPipeline, IFInpaintingPipeline, IFInpaintingSuperResolutionPipeline, IFPipeline, IFSuperResolutionPipeline, ) from diffusers.models.attention...
298
"""simple docstring""" from __future__ import annotations import unittest from transformers import is_tf_available from transformers.testing_utils import require_sentencepiece, require_tf, require_tokenizers, slow if is_tf_available(): import tensorflow as tf from transformers import AutoTokenizer, TFA...
298
1
"""simple docstring""" from collections import namedtuple lowerCamelCase_ = namedtuple('''from_to''', '''from_ to''') lowerCamelCase_ = { '''cubicmeter''': from_to(1, 1), '''litre''': from_to(0.001, 1000), '''kilolitre''': from_to(1, 1), '''gallon''': from_to(0.00454, 264.172)...
268
"""simple docstring""" from torch import nn def snake_case ( A__ ): if act_fn in ["swish", "silu"]: return nn.SiLU() elif act_fn == "mish": return nn.Mish() elif act_fn == "gelu": return nn.GELU() else: raise ValueError(F"""Unsupported activation function: {ac...
268
1
"""simple docstring""" import inspect import unittest from transformers import ViTConfig from transformers.testing_utils import ( require_accelerate, require_torch, require_torch_gpu, require_vision, slow, torch_device, ) from transformers.utils import cached_property, is_torch_available...
212
"""simple docstring""" import json import os from typing import Optional, Tuple from ...tokenization_utils import PreTrainedTokenizer from ...utils import logging _A = logging.get_logger(__name__) _A = {"""vocab_file""": """vocab.json"""} _A = { """voca...
212
1
'''simple docstring''' from ...configuration_utils import PretrainedConfig from ...utils import logging from ...utils.backbone_utils import BackboneConfigMixin, get_aligned_output_features_output_indices _A : str =logging.get_logger(__name__) _A : List[str] ={ ...
41
import gc import unittest import torch from parameterized import parameterized from diffusers import AutoencoderKL from diffusers.utils import floats_tensor, load_hf_numpy, require_torch_gpu, slow, torch_all_close, torch_device from diffusers.utils.import_utils import is_xformers_available from diffusers.utils.test...
68
0
"""simple docstring""" import argparse import logging import pickle from collections import Counter logging.basicConfig( format='%(asctime)s - %(levelname)s - %(name)s - %(message)s', datefmt='%m/%d/%Y %H:%M:%S', level=logging.INFO ) UpperCamelCase_ = logging.getLogger(__name__) if __name__ == "__main__...
366
"""simple docstring""" import unittest from transformers import LiltConfig, 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 from ...test_modeling_common i...
303
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(): fr...
91
"""simple docstring""" from ...configuration_utils import PretrainedConfig from ...utils import logging UpperCAmelCase_ : Optional[int] = logging.get_logger(__name__) UpperCAmelCase_ : Any = {"""openai-gpt""": """https://huggingface.co/openai-gpt/resolve/main/config.json"""} class ...
91
1
"""simple docstring""" import gc import unittest import numpy as np import torch from transformers import CLIPTextConfig, CLIPTextModel, XLMRobertaTokenizer from diffusers import AltDiffusionPipeline, AutoencoderKL, DDIMScheduler, PNDMScheduler, UNetaDConditionModel from diffusers.pipelines.alt_dif...
352
"""simple docstring""" import json import os import shutil import tempfile import unittest import numpy as np import pytest from transformers import BertTokenizer, BertTokenizerFast from transformers.models.bert.tokenization_bert import VOCAB_FILES_NAMES from transformers.testing_utils...
128
0
'''simple docstring''' import pytest import datasets # Import fixture modules as plugins lowerCamelCase = ["""tests.fixtures.files""", """tests.fixtures.hub""", """tests.fixtures.fsspec"""] def _A ( _lowerCAmelCase , _lowerCAmelCase ): """simple docstring""" ...
166
def A_ ( _UpperCAmelCase , _UpperCAmelCase , _UpperCAmelCase , _UpperCAmelCase , _UpperCAmelCase , ): SCREAMING_SNAKE_CASE_: Optional[int] = [redshift, radiation_density, matter_density, dark_energy] if any(p < 0 for p in parameters ): raise ValueError("Al...
13
0
import tempfile import unittest from pathlib import Path from shutil import copyfile from transformers import MaMaaaTokenizer, is_torch_available from transformers.testing_utils import ( get_tests_dir, nested_simplify, require_sentencepiece, require_tokenizers, require_torch, slow...
10
from __future__ import annotations __lowerCamelCase = { """A""": ["""B""", """C""", """E"""], """B""": ["""A""", """D""", """E"""], """C""": ["""A""", """F""", """G"""], """D""": ["""B"""], """E""": ["""A""", """B""", """D"""], """F""": ["""C"""], """G""": ["""C"""], } ...
10
1
def __lowerCamelCase ( UpperCamelCase__ ): '''simple docstring''' return 10 - x * x def __lowerCamelCase ( UpperCamelCase__ , UpperCamelCase__ ): '''simple docstring''' if equation(UpperCamelCase__ ) * equation(UpperCamelCase_...
285
def __lowerCamelCase ( UpperCamelCase__ , UpperCamelCase__ , UpperCamelCase__ , UpperCamelCase__ ): '''simple docstring''' global f # a global dp table for knapsack if f[i][j] < 0: if j < wt[i - 1]: snake_case_ ...
285
1
def UpperCamelCase( lowercase_ ) -> Dict: '''simple docstring''' stooge(lowercase_ , 0 , len(lowercase_ ) - 1 ) return arr def UpperCamelCase( lowercase_ , lowercase_ , lowercase_ ) -> Any: '''simple docstring''' ...
353
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_ = logging.get_logger(__name__) lowerCamelCase_ = { '''facebook/levit-1...
34
0
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, ...
343
import argparse import json from collections import OrderedDict from pathlib import Path import requests import torch from huggingface_hub import hf_hub_download from PIL import Image from transformers import ( ConditionalDetrConfig, ConditionalDetrForObjectDetection, ConditionalDetrForSegmentation, C...
343
1
from math import ceil, sqrt def __UpperCAmelCase ( __a : int = 1_000_000 ) -> int: """simple docstring""" _a : Any = 0 for outer_width in range(3 ,(limit // 4) + 2 ): if outer_width**2 > limit: _a :...
15
import argparse import os import torch from transformers.utils import WEIGHTS_NAME a__ = ['''small''', '''medium''', '''large'''] a__ = '''lm_head.decoder.weight''' a__ = '''lm_head.weight''' def __UpperCAmelCase ( __a : str ,__a : str ) -> ...
15
1
from __future__ import annotations from itertools import permutations from random import randint from timeit import repeat def SCREAMING_SNAKE_CASE ( ) -> tuple[list[int], int]: """simple docstring""" A__ = [randint(-1_000 , 1_000 ) for i in range(10 ...
14
from typing import TYPE_CHECKING from ...utils import OptionalDependencyNotAvailable, _LazyModule, is_torch_available _lowerCamelCase : List[str] = {"""configuration_vit_msn""": ["""VIT_MSN_PRETRAINED_CONFIG_ARCHIVE_MAP""", """ViTMSNConfig"""]} try: if not is_torch_available(): raise Opti...
14
1
def __lowercase ( lowerCamelCase : int = 1000 ): return sum(e for e in range(3 , UpperCamelCase__ ) if e % 3 == 0 or e % 5 == 0 ) if __name__ == "__main__": print(F"""{solution() = }""")
363
import itertools import random import unittest import numpy as np from transformers import is_speech_available from transformers.testing_utils import require_torch, require_torchaudio from ...test_sequence_feature_extraction_common import SequenceFeatureExtractionTestMixin if is_speech_available(): from transfo...
50
0
'''simple docstring''' import copy from typing import Dict, List, Optional from ...configuration_utils import PretrainedConfig from ...utils import logging from ..auto import CONFIG_MAPPING _lowerCAmelCase = { '''facebook/mask2former-swin-small-coco-instance''': ( ...
298
'''simple docstring''' def __lowerCAmelCase ( snake_case__ ): return "".join([hex(snake_case__ )[2:].zfill(2 ).upper() for byte in list(snake_case__ )] ) def __lowerCAmelCase ( snake_case__ ): # Check data validity, following RFC3548 ...
298
1
from ...configuration_utils import PretrainedConfig from ...utils import logging from ...utils.backbone_utils import BackboneConfigMixin, get_aligned_output_features_output_indices __a :List[Any] = logging.get_logger(__name__) __a :Union[str, Any] = { 'shi-labs/dinat-mini-in1k-224': 'https://hugg...
364
from ..utils import DummyObject, requires_backends class _a ( metaclass=snake_case_ ): """simple docstring""" _lowerCamelCase : Union[str, Any] = ['torch', 'transformers', 'onnx'] def __init__( self : List[Any] , *UpperCAmelCase :...
329
0
import random def lowerCAmelCase__ ( SCREAMING_SNAKE_CASE_ , SCREAMING_SNAKE_CASE_ , SCREAMING_SNAKE_CASE_ ) -> int: lowerCAmelCase__ : Optional[int] = a[left_index] lowerCAmelCase__ : Optional[int] = left_index + 1 for j in range(...
212
import re def lowerCAmelCase__ ( SCREAMING_SNAKE_CASE_ ) -> str: if len(re.findall('[ATCG]' , SCREAMING_SNAKE_CASE_ ) ) != len(SCREAMING_SNAKE_CASE_ ): raise ValueError('Invalid Strand' ) return dna.translate(dna.maketrans('ATCG' , 'TAGC' ) ...
212
1
"""simple docstring""" def UpperCamelCase_ ( lowerCAmelCase__ : str ) -> str: """simple docstring""" return " ".join( ''.join(word[::-1] ) if len(lowerCAmelCase__ ) > 4 else word for word in sentence.split() ) if __name__ ==...
289
"""simple docstring""" def UpperCamelCase_ ( lowerCAmelCase__ : Optional[Any] , lowerCAmelCase__ : str ) -> List[Any]: """simple docstring""" return (pointa[0] - pointa[0]) ** 2 + (pointa[1] - pointa[1]) ** 2 def UpperCamelCase_ ...
289
1
from typing import List, Optional, Tuple, Union import PIL import torch from torchvision import transforms from diffusers.pipeline_utils import DiffusionPipeline, ImagePipelineOutput from diffusers.schedulers import DDIMScheduler from diffusers.utils import randn_tensor _a = transfor...
39
import math import os import sys def a__ ( snake_case ): """simple docstring""" __SCREAMING_SNAKE_CASE : Optional[int] = '''''' try: with open(snake_case , '''rb''' ) as binary_file: __SCREAMING_SNAKE_CASE : int = binary_file.read() for dat in data: ...
303
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 .tokeni...
219
'''simple docstring''' # Lint as: python3 import sys from collections.abc import Mapping from typing import TYPE_CHECKING, Dict, Optional import numpy as np import pyarrow as pa from .. import config from ..utils.logging import get_logger from ..utils.py_utils import map_nested from .formatting import TensorFormat...
219
1
"""simple docstring""" from typing import TYPE_CHECKING from ...utils import ( OptionalDependencyNotAvailable, _LazyModule, is_flax_available, is_tf_available, is_tokenizers_available, is_torch_available, ) lowerCAmelCase : Optional[int] = { """configurat...
291
import unittest from transformers import BertGenerationConfig, 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 from ...test_modeling_common import ModelTeste...
128
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 ...t...
367
import json import os import unittest from transformers.models.ctrl.tokenization_ctrl import VOCAB_FILES_NAMES, CTRLTokenizer from ...test_tokenization_common import TokenizerTesterMixin class UpperCAmelCase ( __SCREAMING_SNAKE_CASE , unittest.TestCase ): '''simple docstring''' ...
124
0
import tempfile import unittest from pathlib import Path from shutil import copyfile from transformers import MaMaaaTokenizer, is_torch_available from transformers.testing_utils import ( get_tests_dir, nested_simplify, require_sentencepiece, require_tokenizers, require_torch, slow, ) from...
10
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 YolosConfig, YolosForObjectDetection, YolosImageProcessor from transformers.utils import logging logging.set_verbosity_info() __A ...
10
1
from typing import TYPE_CHECKING from ...utils import OptionalDependencyNotAvailable, _LazyModule, is_tokenizers_available, is_torch_available SCREAMING_SNAKE_CASE_ = { """configuration_roc_bert""": ["""ROC_BERT_PRETRAINED_CONFIG_ARCHIVE_MAP""", """RoCBertConfig"""], """tokeniz...
193
import os from pathlib import Path from unittest.mock import patch import pytest import zstandard as zstd from datasets.download.download_config import DownloadConfig from datasets.utils.file_utils import ( OfflineModeIsEnabled, cached_path, fsspec_get, fsspec_head, ftp_ge...
193
1
import contextlib import csv import json import os import sqlitea import tarfile import textwrap import zipfile import pyarrow as pa import pyarrow.parquet as pq import pytest import datasets import datasets.config @pytest.fixture(scope="""session""" ) def lowerCAmelCase_ ( ): _A :...
26
'''simple docstring''' import argparse import logging from collections import namedtuple import torch from model_bertabs import BertAbsSummarizer from models.model_builder import AbsSummarizer # The authors' implementation from transformers import BertTokenizer logging.basicConfig(level=logging.INFO) A...
34
0
"""simple docstring""" import argparse import json from pathlib import Path import requests import timm import torch from huggingface_hub import hf_hub_download from PIL import Image from transformers import DeiTImageProcessor, ViTConfig, ViTForImageClassification, ViTImageProcessor, Vi...
357
import argparse import json import os import time import zipfile from get_ci_error_statistics import download_artifact, get_artifacts_links from transformers import logging UpperCAmelCase : Union[str, Any] = logging.get_logger(__name__) def _A ( SCREAMING_SNAKE_CASE :...
148
0
from math import ceil, sqrt def UpperCAmelCase ( a_ = 1_0_0_0_0_0_0 ) -> int: """simple docstring""" __A = 0 for outer_width in range(3 , (limit // 4) + 2 ): if outer_width**2 > limit: __A = max(ceil(sqrt(outer_width**2 - limit ) ) ...
15
import argparse import json import os import torch from transformers.file_utils import has_file from diffusers import UNetaDConditionModel, UNetaDModel SCREAMING_SNAKE_CASE :Union[str, Any] = False SCREAMING_SNAKE_CASE :Any = True SCREAMING_SNAKE_CASE :Tuple = False ...
15
1
"""simple docstring""" import numpy as np import qiskit def __lowercase ( snake_case_ : int = 8 ,snake_case_ : int | None = None ) ->str: '''simple docstring''' __A : str = np.random.default_rng(seed=snake_case_ ) # Roughly 25%...
291
"""simple docstring""" from typing import TYPE_CHECKING from ...utils import OptionalDependencyNotAvailable, _LazyModule, is_tokenizers_available, is_torch_available a_ = { """configuration_bloom""": ["""BLOOM_PRETRAINED_CONFIG_ARCHIVE_MAP""", """BloomConfig""", """BloomOnnxConfig"""], } try: ...
291
1
"""simple docstring""" import os import tempfile import unittest from pathlib import Path from transformers import AutoConfig, is_torch_available from transformers.testing_utils import require_torch, torch_device if is_torch_available(): from transformers import PyTorchBenchmark,...
33
def SCREAMING_SNAKE_CASE ( _UpperCAmelCase = 100_0000 ) -> int: lowerCamelCase__ : int = limit + 1 lowerCamelCase__ : Optional[Any] = [0] * limit for first_term in range(1 , _UpperCAmelCase ): for n in range(_UpperCAmelCase , _Upper...
50
0
import json import re from typing import TYPE_CHECKING, List, Optional, Tuple, Union import numpy as np from ...utils import is_tf_available, is_torch_available, logging if TYPE_CHECKING: if is_torch_available(): import torch if is_tf_available(): import tensorflow as tf ...
359
"""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 ( ...
12
0
'''simple docstring''' import unittest import numpy as np from transformers.testing_utils import require_flax, require_tf, require_torch from transformers.utils import ( expand_dims, flatten_dict, is_flax_available, is_tf_available, is_torch_available, reshape, squeeze, transpos...
58
import argparse import json from collections import OrderedDict from pathlib import Path import requests import torch from huggingface_hub import hf_hub_download from PIL import Image from transformers import PoolFormerConfig, PoolFormerForImageClassification, PoolFormerImageProcessor from transformers.utils impor...
329
0
"""simple docstring""" def _lowerCAmelCase ( UpperCAmelCase__ : int = 6_0_0_8_5_1_4_7_5_1_4_3 ) ->int: try: A__ : List[str] = int(lowerCAmelCase__ ) except (TypeError, ValueError): raise TypeError("""Parameter n must be int or...
361
"""simple docstring""" import argparse import json from pathlib import Path import requests import torch from huggingface_hub import cached_download, hf_hub_url from PIL import Image from transformers import DPTConfig, DPTForDepthEstimation, DPTForSemanticSegmentation, DPTImageProcessor from transformers.ut...
296
0
import argparse import json import os import torch from transformers import LukeConfig, LukeModel, LukeTokenizer, RobertaTokenizer from transformers.tokenization_utils_base import AddedToken @torch.no_grad() def snake_case( __magic_name__ , __magic_name__ , __magic_name__ , _...
308
import importlib import sys from argparse import REMAINDER, ArgumentParser from pathlib import Path import torch_xla.distributed.xla_multiprocessing as xmp def snake_case( ) -> int: '''simple docstring''' lowercase : List[str] = ArgumentP...
308
1
def SCREAMING_SNAKE_CASE__ ( _UpperCAmelCase ) -> int: '''simple docstring''' if not isinstance(_UpperCAmelCase, _UpperCAmelCase ): raise ValueError('multiplicative_persistence() only accepts integral values' ) if num < 0: raise ValueError('multiplicative_per...
323
from dataclasses import dataclass from typing import List, Optional, Union import numpy as np import PIL from ...utils import BaseOutput, OptionalDependencyNotAvailable, is_torch_available, is_transformers_available from .timesteps import ( fastaa_timesteps, smartaa_timesteps, smartaa_timesteps, sma...
323
1
from timeit import timeit def __SCREAMING_SNAKE_CASE ( __UpperCamelCase : int ) -> int: """simple docstring""" if number < 0: raise ValueError("""the value of input must not be negative""" ) SCREAMING_SNAKE_CASE__ = 0 while number: ...
219
import unittest from transformers import GPTNeoXJapaneseConfig, is_torch_available from transformers.models.gpt_neox_japanese.tokenization_gpt_neox_japanese import GPTNeoXJapaneseTokenizer from transformers.testing_utils import require_torch, slow, torch_device from ...test_configuration_common import ConfigTes...
219
1
from math import acos, sin from typing import List, Tuple, Union import numpy as np import torch from PIL import Image from ...models import AutoencoderKL, UNetaDConditionModel from ...schedulers import DDIMScheduler, DDPMScheduler from ...utils import randn_tensor from ..pipeline_utils import...
196
def SCREAMING_SNAKE_CASE ( __lowerCAmelCase ) -> int: UpperCamelCase__ : int = 1 for i in range(1 , num + 1 ): fact *= i return fact def SCREAMING_SNAKE_CASE ( __lowerCAmelCase ) -> int: UpperCam...
196
1
'''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...
80
from typing import TYPE_CHECKING from ...utils import OptionalDependencyNotAvailable, _LazyModule, is_tf_available, is_torch_available lowerCamelCase : Optional[int] = { 'configuration_rag': ['RagConfig'], 'retrieval_rag': ['RagRetriever'], 'tokenization_rag': ['RagTokenizer'],...
124
0
"""simple docstring""" from __future__ import annotations from decimal import Decimal from math import * # noqa: F403 from sympy import diff def _SCREAMING_SNAKE_CASE ( _lowercase : str , _lowercase : float | Decimal , _lowercase : float = 10**...
371
"""simple docstring""" from itertools import product def _SCREAMING_SNAKE_CASE ( _lowercase : int , _lowercase : int ) ->list[int]: '''simple docstring''' a : Dict = sides_number a : List[str] = max_face_num...
79
0