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
from ...utils import is_note_seq_available, is_transformers_available, is_torch_available from ...utils import OptionalDependencyNotAvailable try: if not (is_transformers_available() and is_torch_available()): raise OptionalDependencyNotAvailable() except OptionalDependencyNotAvailable: from ...utils.dummy_tor...
21
import copy from typing import Dict, List, Optional from ...configuration_utils import PretrainedConfig from ...utils import logging from ..auto import CONFIG_MAPPING SCREAMING_SNAKE_CASE__ = { """facebook/mask2former-swin-small-coco-instance""": ( """https://huggingface.co/facebook/mask2former...
325
0
'''simple docstring''' import gc import random import unittest import numpy as np import torch from PIL import Image from transformers import CLIPTextConfig, CLIPTextModel, CLIPTokenizer from diffusers import ( AutoencoderKL, DDIMScheduler, EulerAncestralDiscreteScheduler, LMSDiscreteSchedule...
350
'''simple docstring''' from ...configuration_utils import PretrainedConfig from ...utils import logging __a = logging.get_logger(__name__) __a = { "microsoft/markuplm-base": "https://huggingface.co/microsoft/markuplm-base/resolve/main/config.json", "microsoft/markuplm-large": "https:...
43
0
_lowercase : Dict ={"a": ["c", "b"], "b": ["d", "e"], "c": [], "d": [], "e": []} _lowercase : str =["a", "b", "c", "d", "e"] def lowerCAmelCase_ ( _lowercase : Optional[Any] , _lowercase : Tuple , _lowercase : int) -> Optional[Any]: ...
170
from ...configuration_utils import PretrainedConfig from ...utils import logging _lowerCAmelCase : List[Any] = logging.get_logger(__name__) _lowerCAmelCase : List[str] = { "google/realm-cc-news-pretrained-embedder": ( "https://huggingface.co/google/realm-cc-news-pretr...
169
0
def _a ( SCREAMING_SNAKE_CASE_ : List[Any] ): __lowerCAmelCase = len(SCREAMING_SNAKE_CASE_ ) for i in range(1 , SCREAMING_SNAKE_CASE_ ): __lowerCAmelCase = collection[i] __lowerCAmelCase = 0 __lowerCAmelCa...
359
import math def _a ( SCREAMING_SNAKE_CASE_ : int ): if 1 < number < 4: # 2 and 3 are primes return True elif number < 2 or number % 2 == 0 or number % 3 == 0: # Negatives, 0, 1, all even numbers, all multiples of 3 are not primes r...
102
0
"""simple docstring""" def SCREAMING_SNAKE_CASE ( ) -> Optional[Any]: return [ a * b * (1000 - a - b) for a in range(1 ,999 ) for b in range(lowercase_ ,999 ) if (a * a + b * b == (1000 - a - b) ** 2) ][0] if __name__ == "__main__": print(F"""{solution(...
44
"""simple docstring""" from json import JSONDecodeError # Workaround for requests.exceptions.JSONDecodeError import requests def _lowerCAmelCase ( lowercase_ = "isbn/0140328726" ): UpperCAmelCase = olid.strip().strip('/' ) # Remove leading/trailing whitespace & ...
78
0
from math import ceil def snake_case_ ( lowerCAmelCase_ : Tuple , lowerCAmelCase_ : Optional[Any] ): __lowercase : List[Any] = list(range(0 , lowerCAmelCase_ ) ) __lowercase : Dict = [item for sublist in list(device_map.values() )...
306
import torch from diffusers import DPMSolverSDEScheduler from diffusers.utils import torch_device from diffusers.utils.testing_utils import require_torchsde from .test_schedulers import SchedulerCommonTest @require_torchsde class lowerCAmelCase ( __a ): '''simple docstring''' _A :...
306
1
'''simple docstring''' import unittest from transformers import AlbertTokenizer, AlbertTokenizerFast from transformers.testing_utils import get_tests_dir, require_sentencepiece, require_tokenizers, slow from ...test_tokenization_common import TokenizerTesterMixin lowerCamelCase : Dict = get_tests_di...
47
'''simple docstring''' import importlib import sys from argparse import REMAINDER, ArgumentParser from pathlib import Path import torch_xla.distributed.xla_multiprocessing as xmp def _lowerCAmelCase ( ) -> Any: """simple docstring""" _SCREAMING_SNAKE_CASE =ArgumentPar...
47
1
'''simple docstring''' import unittest from transformers import JukeboxTokenizer from transformers.testing_utils import require_torch class __magic_name__ ( unittest.TestCase): UpperCamelCase__ = JukeboxTokenizer UpperCamelCase__ = { '''artist''': '''Zac Brown Band''', '''g...
21
'''simple docstring''' from transformers import DistilBertTokenizer, DistilBertTokenizerFast from transformers.testing_utils import require_tokenizers, slow from ..bert.test_tokenization_bert import BertTokenizationTest @require_tokenizers class __magic_name__ ( _UpperCAmelCase): UpperCamelCase__...
21
1
import json import os import shutil import tempfile import unittest import numpy as np import pytest from transformers import CLIPTokenizer, CLIPTokenizerFast from transformers.models.clip.tokenization_clip import VOCAB_FILES_NAMES from transformers.testing_utils import require_vision from transformers.utils impo...
36
from ...configuration_utils import PretrainedConfig from ...utils import logging __lowercase = logging.get_logger(__name__) __lowercase = {'''ctrl''': '''https://huggingface.co/ctrl/resolve/main/config.json'''} class lowerCamelCase_ ( UpperCAmelCase_ ): '''simple docstring'''...
43
0
'''simple docstring''' from __future__ import annotations from cmath import sqrt def a_ ( _UpperCAmelCase : int ,_UpperCAmelCase : int ,_UpperCAmelCase : int ) -> tuple[complex, complex]: if a == 0: raise ValueError('Coefficient \'a\' must ...
364
'''simple docstring''' from typing import TYPE_CHECKING from ...utils import OptionalDependencyNotAvailable, _LazyModule, is_tf_available, is_torch_available A__ : int = { '''configuration_groupvit''': [ '''GROUPVIT_PRETRAINED_CONFIG_ARCHIVE_MAP''', '''GroupViTConfig''', ...
0
0
import os # Precomputes a list of the 100 first triangular numbers lowercase_ = [int(0.5 * n * (n + 1)) for n in range(1, 101)] def _snake_case( ) -> int: '''simple docstring''' A__ = os.path.dirname(os.path.realpath(SCREAMING_SNAKE_CASE__...
7
"""simple docstring""" def lowercase ( _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''' ) __snake_case : Tuple = str(bin(_snake_case ) ...
102
0
'''simple docstring''' from typing import TYPE_CHECKING from ...utils import OptionalDependencyNotAvailable, _LazyModule, is_torch_available __SCREAMING_SNAKE_CASE :List[Any] = { '''configuration_blip_2''': [ '''BLIP_2_PRETRAINED_CONFIG_ARCHIVE_MAP''', '''Blip2Config''', ...
359
'''simple docstring''' def UpperCAmelCase_ ( __lowercase : int , __lowercase : Optional[int] , __lowercase : List[Any] , __lowercase : int ) -> Tuple: '''simple docstring''' _UpperCAmelCase = [False] * l...
156
0
from typing import List, Union import numpy as np from ..utils import add_end_docstrings, is_torch_available, is_vision_available, logging, requires_backends from .base import PIPELINE_INIT_ARGS, Pipeline if is_vision_available(): from PIL import Image from ..image_utils import load_im...
306
def __lowerCamelCase ( snake_case__ ,snake_case__ ,snake_case__ ) -> list: """simple docstring""" _SCREAMING_SNAKE_CASE = len(snake_case__ ) _SCREAMING_SNAKE_CASE = [[0] * n for i in range(snake_case__ )] for i...
306
1
"""simple docstring""" import gc import unittest import numpy as np import torch from diffusers import AutoencoderKL, DDIMScheduler, DiTPipeline, DPMSolverMultistepScheduler, TransformeraDModel from diffusers.utils import is_xformers_available, load_numpy, slow, torch_device from diffus...
289
"""simple docstring""" from typing import TYPE_CHECKING from ...utils import ( OptionalDependencyNotAvailable, _LazyModule, is_torch_available, ) lowercase__ : Dict = { """configuration_falcon""": ["""FALCON_PRETRAINED_CONFIG_ARCHIVE_MAP""", """FalconCon...
289
1
from typing import TYPE_CHECKING from ...utils import OptionalDependencyNotAvailable, _LazyModule, is_sentencepiece_available SCREAMING_SNAKE_CASE : List[str] = {} try: if not is_sentencepiece_available(): raise OptionalDependencyNotAvailable() except OptionalDependencyNotAvailable: pa...
21
from typing import List, Union from ..utils import ( add_end_docstrings, is_tf_available, is_torch_available, is_vision_available, logging, requires_backends, ) from .base import PIPELINE_INIT_ARGS, Pipeline if is_vision_available(): from PIL import Image from ..image_utils import load_...
21
1
from math import factorial, pi def __a ( lowerCAmelCase_ : float ,lowerCAmelCase_ : int = 30 ) -> float: '''simple docstring''' if not isinstance(lowerCAmelCase_ ,(int, float) ): raise ValueError("""maclaurin_sin() requires either an int or...
354
from typing import Dict, List from nltk.translate import gleu_score import datasets from datasets import MetricInfo __A = '''\ @misc{wu2016googles, title={Google\'s Neural Machine Translation System: Bridging the Gap between Human and Machine Translation}, author={Yonghui Wu and Mike Schu...
277
0
import argparse import shlex import runhouse as rh if __name__ == "__main__": # Refer to https://runhouse-docs.readthedocs-hosted.com/en/latest/api/python/cluster.html#hardware-setup for cloud access # setup instructions, if using on-demand hardware # If user passes --user <user> --host <host> -...
205
from typing import TYPE_CHECKING from ...utils import OptionalDependencyNotAvailable, _LazyModule, is_tf_available, is_torch_available UpperCAmelCase__ = { "configuration_groupvit": [ "GROUPVIT_PRETRAINED_CONFIG_ARCHIVE_MAP", "GroupViTConfig", "GroupViTOnnxCo...
0
0
"""simple docstring""" from collections import OrderedDict from typing import Mapping from packaging import version from ...configuration_utils import PretrainedConfig from ...onnx import OnnxConfig from ...utils import logging __A = logging.get_logger(__name__) __A = { "micro...
2
"""simple docstring""" import math from typing import Any, Callable, List, Optional, Tuple, Union import numpy as np import torch from ...models import TaFilmDecoder from ...schedulers import DDPMScheduler from ...utils import is_onnx_available, logging, randn_tensor if is_onnx_available(): from ..onnx...
2
1
"""simple docstring""" import unittest from transformers import GPTSwaTokenizer from transformers.testing_utils import get_tests_dir, require_sentencepiece, require_tokenizers, slow from ...test_tokenization_common import TokenizerTesterMixin __snake_case : Optional[Any] = ...
269
from typing import TYPE_CHECKING from ...utils import OptionalDependencyNotAvailable, _LazyModule, is_torch_available __lowerCAmelCase : str = { "configuration_timesformer": ["TIMESFORMER_PRETRAINED_CONFIG_ARCHIVE_MAP", "TimesformerConfig"], } try: if not is_torch_available(): raise...
156
0
import torch from diffusers import DDIMParallelScheduler from .test_schedulers import SchedulerCommonTest class a__ ( UpperCamelCase__ ): a : Any = (DDIMParallelScheduler,) a : Dict = (("""eta""", 0.0), ("""num_inference_steps""", 50)) def lowerCAm...
350
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 lowercase__ : int = logging.get_logger(__name__) lowercase__ : Dict = "▁" lowercase__...
180
0
"""simple docstring""" from ...configuration_utils import PretrainedConfig from ...utils import logging from ...utils.backbone_utils import BackboneConfigMixin, get_aligned_output_features_output_indices UpperCAmelCase__ = logging.get_logger(__name__) class a ( lowerCAmelCase_ , lowerCA...
289
"""simple docstring""" from __future__ import annotations from collections import Counter from random import random class a : def __init__( self : Union[str, Any] ): _UpperCAmelCase = {} def lowerCAmelCase_ ( self : Optional[int] , __lowerCAmelCase ...
289
1
"""simple docstring""" import os import socket from contextlib import contextmanager import torch from ..commands.config.default import write_basic_config # noqa: F401 from ..state import PartialState from .dataclasses import DistributedType from .imports import is_deepspeed_available, is_tpu_available from...
357
"""simple docstring""" import importlib import os from dataclasses import dataclass from enum import Enum from typing import Any, Dict, Optional, Union import torch from ..utils import BaseOutput UpperCAmelCase : Optional[Any] = 'scheduler_config.json' class lowerCamelCase__ ...
320
0
'''simple docstring''' import json import os import torch from diffusers import UNetaDModel os.makedirs('''hub/hopper-medium-v2/unet/hor32''', exist_ok=True) os.makedirs('''hub/hopper-medium-v2/unet/hor128''', exist_ok=True) os.makedirs('''hub/hopper-medium-v2/value_function''', exist_ok=True) ...
229
from collections import OrderedDict from typing import TYPE_CHECKING, Any, Mapping, Optional, Union from ...configuration_utils import PretrainedConfig from ...onnx import OnnxConfig from ...utils import logging if TYPE_CHECKING: from ... import FeatureExtractionMixin, PreTrainedTokenizerBase, TensorType a_ ...
277
0
import math def A(__a: int = 100 ): lowerCAmelCase_ = sum(i * i for i in range(1 , n + 1 ) ) lowerCAmelCase_ = int(math.pow(sum(range(1 , n + 1 ) ) , 2 ) ) return square_of_sum - sum_of_squares if __name__ == "__main__": print(F'''{solutio...
362
def A(): return [list(range(1000 - i , -1000 - i , -1 ) ) for i in range(1000 )] lowerCamelCase__ = generate_large_matrix() lowerCamelCase__ = ( [[4, 3, 2, -1], [3, 2, 1, -1], [1, 1, -1, -2], [-1, -1, -2, -3]], [[3, 2], [1, 0]], [[7, 7, 6]], [[7...
22
0
'''simple docstring''' from collections import OrderedDict from typing import Mapping from packaging import version from ...configuration_utils import PretrainedConfig from ...onnx import OnnxConfig from ...utils import logging lowerCamelCase : List[str] = logging.get_logger(__name__) lowerCamel...
2
'''simple docstring''' import unittest from transformers import DonutProcessor lowerCamelCase : Tuple = 'naver-clova-ix/donut-base' class __lowerCAmelCase (unittest.TestCase ): '''simple docstring''' def UpperCamelCase__ (self : int ): '...
2
1
'''simple docstring''' def lowercase_ ( lowerCAmelCase__ : int , lowerCAmelCase__ : int ): """simple docstring""" return "\n".join( f'{number} * {i} = {number * i}' for i in range(1 , number_of_terms + 1 ) ) if __name__ == "__main__": ...
16
'''simple docstring''' from statistics import mean import numpy as np def lowercase_ ( lowerCAmelCase__ : list , lowerCAmelCase__ : list , lowerCAmelCase__ : list , lowerCAmelCase__ : int ): """simple docstring""" __UpperCAm...
16
1
"""simple docstring""" import argparse import importlib from pathlib import Path # Test all the extensions added in the setup A: Optional[Any] = [ "kernels/rwkv/wkv_cuda.cu", "kernels/rwkv/wkv_op.cpp", "kernels/deformable_detr/ms_deform_attn.h", "kernels/deformable_detr/cuda/ms_deform_im...
109
from math import isqrt, loga def snake_case ( snake_case__ :int) -> list[int]: _A = [True] * max_number for i in range(2 , isqrt(max_number - 1) + 1): if is_prime[i]: for j in range(i**2 , snake_case__ , snake_case__): ...
180
0
import unittest import numpy as np from transformers.testing_utils import require_torch, require_vision from transformers.utils import is_torch_available, is_vision_available from ...test_image_processing_common import ImageProcessingSavingTestMixin, prepare_video_inputs if is_torch_available...
238
# 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 # # Unless r...
238
1
import functools import operator from ...configuration_utils import PretrainedConfig from ...utils import logging snake_case_ : Optional[Any] = logging.get_logger(__name__) snake_case_ : Tuple = { "asapp/sew-d-tiny-100k": "https://huggingface.co/asapp/sew-d-tiny-100k/re...
51
"""simple docstring""" import argparse import torch from transformers import ( SpeechTaConfig, SpeechTaFeatureExtractor, SpeechTaForSpeechToSpeech, SpeechTaForSpeechToText, SpeechTaForTextToSpeech, SpeechTaProcessor, SpeechTaTokenizer, logging, ) from transformers.tokenization...
320
0
"""simple docstring""" from typing import TYPE_CHECKING # rely on isort to merge the imports from ...utils import OptionalDependencyNotAvailable, _LazyModule, is_torch_available _A = {"""configuration_focalnet""": ["""FOCALNET_PRETRAINED_CONFIG_ARCHIVE_MAP""", """FocalNetConfig"""]} try: ...
212
"""simple docstring""" 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 fr...
212
1
"""simple docstring""" def _lowerCAmelCase ( lowercase_ , lowercase_ ): if b == 0: return 1 if (b % 2) == 0: return actual_power(lowercase_ , int(b / 2 ) ) * actual_power(lowercase_ , int(b / 2 ) ) else: return ...
78
'''simple docstring''' def UpperCAmelCase_ ( __lowercase : int ) -> int: '''simple docstring''' if not isinstance(__lowercase , __lowercase ) or number < 0: raise ValueError("Input must be a non-negative integer" ) _UpperCAmel...
22
0
import numpy as np def UpperCamelCase ( snake_case__ : List[str] ) -> List[Any]: return 1 / (1 + np.exp(-vector )) def UpperCamelCase ( snake_case__ : List[str] ) -> Union[str, Any]: return vector * sigmoid(snake_case__ ) if __name__ == "__main__":...
355
from collections import OrderedDict from typing import Mapping from ...configuration_utils import PretrainedConfig from ...onnx import OnnxConfig from ...utils import logging __UpperCAmelCase = logging.get_logger(__name__) __UpperCAmelCase = { '''facebook/data2vec-text-base''': '''https://hugg...
103
0
"""simple docstring""" def __UpperCAmelCase ( __lowerCamelCase , __lowerCamelCase ) -> str: return "\n".join( f"""{number} * {i} = {number * i}""" for i in range(1 , number_of_terms + 1 ) ) if __name__ == "__main__": print(multiplic...
16
"""simple docstring""" import numpy as np from nltk.translate import meteor_score import datasets from datasets.config import importlib_metadata, version lowerCAmelCase_ = version.parse(importlib_metadata.version('nltk')) if NLTK_VERSION >= version.Version('3.6.4'): f...
16
1
from collections.abc import Iterable from typing import Generic, TypeVar _lowerCamelCase : int = TypeVar("_T") class __snake_case (Generic[_T] ): def __init__( self : Dict , _UpperCAmelCase : Iterable[_T] | None = None ) -> List[Any]: '''simple docs...
368
from __future__ import annotations import time from collections.abc import Sequence from random import randint from matplotlib import pyplot as plt def _UpperCAmelCase (UpperCamelCase_ : Sequence[float] , UpperCamelCase_ : int , UpperCamelCase_ : int ): '''simple docstring''' ...
159
0
"""simple docstring""" import gc import random import unittest import numpy as np import torch from PIL import Image from diffusers import ( DDIMScheduler, KandinskyVaaImgaImgPipeline, KandinskyVaaPriorPipeline, UNetaDConditionModel, VQModel, ) from diffusers.utils import floats_tensor, ...
238
"""simple docstring""" import inspect import tempfile from collections import OrderedDict, UserDict from collections.abc import MutableMapping from contextlib import ExitStack, contextmanager from dataclasses import fields from enum import Enum from typing import Any, ContextManager, List, Tuple import numpy...
238
1
import importlib.util import json import os import warnings from dataclasses import dataclass, field import torch from ..training_args import TrainingArguments from ..utils import cached_property, is_sagemaker_dp_enabled, logging _lowercase: Optional[int] = logging.get_logger(__name__) def ...
358
def a( A : int = 200 ) -> int: """simple docstring""" a = [1, 2, 5, 10, 20, 50, 100, 200] a = [0] * (pence + 1) a = 1 # base case: 1 way to make 0 pence for coin in coins: for i in range(A , pence + 1 , 1 ): ...
71
0
import unittest import numpy as np from transformers.testing_utils import require_torch, require_vision from transformers.utils import is_torch_available, is_vision_available from ...test_image_processing_common import ImageProcessingSavingTestMixin, prepare_image_inputs if is_torch_available(): ...
212
from collections import OrderedDict from typing import Any, List, Mapping, Optional from ... import PreTrainedTokenizer, TensorType, is_torch_available from ...configuration_utils import PretrainedConfig from ...onnx import OnnxConfigWithPast, PatchingSpec from ...utils import logging lowerCamelCase__ ...
212
1
'''simple docstring''' def UpperCAmelCase ( lowerCamelCase_ :int = 10_00 ): '''simple docstring''' return sum(2 * a * ((a - 1) // 2) for a in range(3 , n + 1 ) ) if __name__ == "__main__": print(solution())
8
'''simple docstring''' from typing import TYPE_CHECKING from ...utils import ( OptionalDependencyNotAvailable, _LazyModule, is_flax_available, is_tf_available, is_tokenizers_available, is_torch_available, ) __A : int = { 'configuration_whisper': ['WHISPER_PRETRAINED...
8
1
__A = [ "Audio", "Array2D", "Array3D", "Array4D", "Array5D", "ClassLabel", "Features", "Sequence", "Value", "Image", "Translation", "TranslationVariableLanguages", ] from .audio import Audio from .features import ArrayaD, ArrayaD, Arraya...
90
import gc import unittest from diffusers import FlaxStableDiffusionInpaintPipeline from diffusers.utils import is_flax_available, load_image, slow from diffusers.utils.testing_utils import require_flax if is_flax_available(): import jax import jax.numpy as jnp from flax.jax_utils import replica...
103
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 : List[str] = { "configuration_electra": ["ELECTRA...
21
'''simple docstring''' import os import sys from contextlib import contextmanager # Windows only if os.name == "nt": import ctypes import msvcrt # noqa class __magic_name__ ( ctypes.Structure): # _fields is a specific attr expected by ctypes UpperCamelCase__ ...
21
1
from __future__ import annotations import inspect import unittest import numpy as np from transformers import ResNetConfig from transformers.testing_utils import require_tf, require_vision, slow from transformers.utils import cached_property, is_tf_available, is_vision_available from ...test_configurat...
59
def _lowerCAmelCase ( lowerCAmelCase_ :Union[str, Any] , lowerCAmelCase_ :Tuple , lowerCAmelCase_ :Any )->List[Any]: '''simple docstring''' if n == 0: return 1 elif n % 2 == 1: return (binary_exponentiation(lowerCAmelCase_ , ...
159
0
import copy import os from typing import Union from ...configuration_utils import PretrainedConfig from ...utils import logging A_ : Optional[int] = logging.get_logger(__name__) A_ : str = { 'BridgeTower/bridgetower-base': 'https://huggingface.co/BridgeTower/bridgeto...
292
import time from dataclasses import dataclass from multiprocessing import Pool from unittest import TestCase from unittest.mock import patch import multiprocess import numpy as np import pytest from datasets.utils.py_utils import ( NestedDataStructure, asdict, iflatmap_unordered...
292
1
'''simple docstring''' def _UpperCamelCase ( SCREAMING_SNAKE_CASE__ : str ): '''simple docstring''' UpperCAmelCase__ = [int(a_ ) for i in ip_va_address.split(""".""" ) if i.isdigit()] return len(a_ ) == 4 and all(0 <= int(a_ ) <= 254 for octet in octets ) if _...
346
import os from datetime import datetime as dt from github import Github A_ :str = [ '''good first issue''', '''feature request''', '''wip''', ] def A ( ) -> Any: __UpperCamelCase : Any =Github(os.enviro...
71
0
import unittest import numpy as np import torch from torch import nn from transformers import ( CLIPImageProcessor, CLIPTextConfig, CLIPTextModelWithProjection, CLIPTokenizer, CLIPVisionConfig, CLIPVisionModelWithProjection, ) from diffusers import KandinskyVaaPriorPipeline, PriorTransforme...
267
import numpy as np import datasets UpperCAmelCase = """ Compute the Mahalanobis Distance Mahalonobis distance is the distance between a point and a distribution. And not between two distinct points. It is effectively a multivariate equivalent of the Euclidean distance. It was introduced by Prof. P. C. Mah...
267
1
def __SCREAMING_SNAKE_CASE (SCREAMING_SNAKE_CASE__ = 1000 ): return sum(2 * a * ((a - 1) // 2) for a in range(3 , n + 1 ) ) if __name__ == "__main__": print(solution())
8
from __future__ import annotations def __SCREAMING_SNAKE_CASE (SCREAMING_SNAKE_CASE__ ): return [ord(SCREAMING_SNAKE_CASE__ ) - 96 for elem in plain] def __SCREAMING_SNAKE_CASE (SCREAMING_SNAKE_CASE__ ): return "".join(chr(elem + 96 ) for elem in encoded ...
8
1
import unittest from transformers import AutoTokenizer, FalconConfig, 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 Model...
354
from math import log from scipy.constants import Boltzmann, physical_constants _lowerCamelCase : Tuple = 3_0_0 # TEMPERATURE (unit = K) def a__ ( UpperCAmelCase : float , UpperCAmelCase : float , UpperCAmelCase : float , ) -> f...
99
0
from ...utils import is_note_seq_available, is_transformers_available, is_torch_available from ...utils import OptionalDependencyNotAvailable try: if not (is_transformers_available() and is_torch_available()): raise OptionalDependencyNotAvailable() except OptionalDependencyNotAvailable: from ...utils.dummy_tor...
21
from __future__ import annotations def UpperCamelCase_( lowerCamelCase_ ) -> bool: if len(lowerCamelCase_ ) < 2: raise ValueError('Monogons and Digons are not polygons in the Euclidean space' ) if any(i <= 0 for i in nums ): raise ValueError('All values must be greater tha...
21
1
import multiprocessing import os from typing import BinaryIO, Optional, Union import fsspec from .. import Dataset, Features, NamedSplit, config from ..formatting import query_table from ..packaged_modules.json.json import Json from ..utils import logging from ..utils.typing import NestedDataStructureLike, ...
206
import functools import operator from ...configuration_utils import PretrainedConfig from ...utils import logging _lowerCamelCase : int = logging.get_logger(__name__) _lowerCamelCase : Union[str, Any] = { '''microsoft/unispeech-sat-base-100h-libri-ft''': ( ''...
206
1
"""simple docstring""" import time from dataclasses import dataclass from multiprocessing import Pool from unittest import TestCase from unittest.mock import patch import multiprocess import numpy as np import pytest from datasets.utils.py_utils import ( NestedDataStructure, asdict, iflatmap_unorder...
292
"""simple docstring""" from math import isqrt, loga def A__ ( UpperCamelCase ): A = [True] * max_number for i in range(2 , isqrt(max_number - 1 ) + 1 ): if is_prime[i]: for j in range(i**2 , UpperCamelCase , UpperC...
292
1
import math import time from typing import Dict, List, Optional from torch.utils.data import Dataset from transformers import SeqaSeqTrainer, is_torch_tpu_available from transformers.trainer_utils import PredictionOutput, speed_metrics if is_torch_tpu_available(check_device=False): import torc...
367
import os from typing import Dict, List, Union import tensorflow as tf from keras_nlp.tokenizers import BytePairTokenizer from tensorflow_text import pad_model_inputs from .tokenization_gpta import GPTaTokenizer class __a ( tf.keras.layers.Layer ): def __init__( self , ...
288
0
'''simple docstring''' import os def a__ ( ): """simple docstring""" __SCREAMING_SNAKE_CASE = os.path.join(os.path.dirname(a__ ) , """num.txt""" ) with open(a__ ) as file_hand: return str(sum(int(a__ ) for line in file_hand )...
267
'''simple docstring''' import shutil import tempfile import unittest from transformers import ( SPIECE_UNDERLINE, AddedToken, BatchEncoding, NllbTokenizer, NllbTokenizerFast, is_torch_available, ) from transformers.testing_utils import ( get_tests_dir, nested_simplify, require_...
267
1
from abc import ABC, abstractmethod from argparse import ArgumentParser class __SCREAMING_SNAKE_CASE ( lowerCAmelCase_ ): '''simple docstring''' @staticmethod @abstractmethod def snake_case ( lowerCamelCase : ArgumentParser )-> int: raise NotImplemented...
353
"""simple docstring""" # Usage: # ./gen-card-allenai-wmt16.py import os from pathlib import Path def snake_case__ ( __lowerCamelCase : Union[str, Any] , __lowerCamelCase : int , __lowerCamelCase : Tuple , __lowerCamelCase : Union[str, Any] ): ...
272
0
'''simple docstring''' import os import tempfile import unittest from pathlib import Path from transformers import AutoConfig, is_tf_available from transformers.testing_utils import require_tf if is_tf_available(): import tensorflow as tf from transformers import TensorFlo...
93
def A_ ( A__ ) -> int: stooge(A__ , 0 , len(A__ ) - 1 ) return arr def A_ ( A__ , A__ , A__ ) -> List[Any]: if i >= h: return # If first element is smaller than the last then swap them if arr[i] > arr[h]: ...
99
0
"""simple docstring""" def UpperCAmelCase__ (snake_case__ : int = 10_00 ): """simple docstring""" _snake_case , _snake_case : List[Any] = 1, 1 _snake_case : str = [] for i in range(1 , n + 1 ): _snake_case : Any = prev_num...
132
"""simple docstring""" def UpperCAmelCase__ (snake_case__ : Optional[Any] ): """simple docstring""" _snake_case : Union[str, Any] = [] _snake_case : Dict = set({"""(""", """[""", """{"""} ) _snake_case : Union[str, Any] = set({""")""",...
132
1
'''simple docstring''' from typing import TYPE_CHECKING from ...utils import OptionalDependencyNotAvailable, _LazyModule, is_tensorflow_text_available, is_torch_available lowerCamelCase :Optional[int] = { '''configuration_ernie''': ['''ERNIE_PRETRAINED_CONFIG_ARCHIVE_MAP''', '''ErnieConf...
206
'''simple docstring''' # Author: OMKAR PATHAK, Nwachukwu Chidiebere # Use a Python dictionary to construct the graph. from __future__ import annotations from pprint import pformat from typing import Generic, TypeVar lowerCamelCase :str = TypeVar('''T''') class _lowerCAmelCase (...
206
1
'''simple docstring''' import warnings from ...processing_utils import ProcessorMixin from ...tokenization_utils_base import BatchEncoding class _A ( __snake_case ): lowercase__: Union[str, Any] = ['''image_processor''', '''tokenizer'''] lowercase__: i...
351
'''simple docstring''' from __future__ import annotations import copy import inspect import unittest import numpy as np from transformers import is_tf_available, is_vision_available from transformers.models.auto import get_values from transformers.testing_utils import require_tf, s...
13
0
import unittest from transformers import is_flax_available from transformers.testing_utils import require_flax, require_sentencepiece, require_tokenizers, require_torch, slow if is_flax_available(): import optax from flax.training.common_utils import onehot from transformers import AutoTokenize...
10
"""simple docstring""" import os import time import numpy as np import onnxruntime as ort UpperCAmelCase__ = '1' UpperCAmelCase__ = '0' UpperCAmelCase__ = '1' UpperCAmelCase__ = ort.SessionOptions() UpperCAmelCase__ = ort.GraphOptimizationLevel.ORT_D...
288
0
import inspect from typing import Optional, Union import numpy as np import PIL import torch from torch.nn import functional as F from torchvision import transforms from transformers import CLIPFeatureExtractor, CLIPModel, CLIPTextModel, CLIPTokenizer from diffusers import ( AutoencoderKL, DDIMScheduler, ...
198
import os import zipfile import requests from get_ci_error_statistics import download_artifact, get_artifacts_links def UpperCamelCase ( _A : List[Any] , _A : List[str]=7 )-> Optional[Any]: """simple docstring""" A__ = None if token is ...
198
1
'''simple docstring''' import shutil import tempfile import unittest import numpy as np import pytest from transformers.testing_utils import require_vision from transformers.utils import is_vision_available if is_vision_available(): from PIL import Image from transformers import AutoProcessor, BertTokeniz...
267
'''simple docstring''' from typing import List, Optional import numpy as np from ...processing_utils import ProcessorMixin from ...utils import to_numpy class a__( lowerCAmelCase__ ): '''simple docstring''' UpperCAmelCase_ : str = '''EncodecFeatureExtractor''' Upper...
272
0
"""simple docstring""" class lowercase__ : '''simple docstring''' def __init__( self : Union[str, Any] , _UpperCAmelCase : List[Any] , _UpperCAmelCase : Optional[Any] , _UpperCAmelCase : Dict ) -> int: ...
241
"""simple docstring""" import argparse import gdown import numpy as np import torch from huggingface_hub import hf_hub_download from transformers import ( CLIPTokenizer, CLIPTokenizerFast, VideoMAEImageProcessor, XCLIPConfig, XCLIPModel, XCLIPProcessor, XCL...
241
1
"""simple docstring""" from typing import TYPE_CHECKING from ...utils import ( OptionalDependencyNotAvailable, _LazyModule, is_tf_available, is_torch_available, is_vision_available, ) a :Dict = { "configuration_blip": [ "BLIP_PRETRAINED_CONFIG_ARCHIVE_MAP", "Bli...
132
"""simple docstring""" import inspect import os import unittest import torch import accelerate from accelerate import debug_launcher from accelerate.test_utils import ( execute_subprocess_async, require_cpu, require_huggingface_suite, require_multi_gpu, require_single_gpu, ) from accelerate.ut...
132
1
"""simple docstring""" from typing import Callable, Optional, Union from ...configuration_utils import PretrainedConfig from ...utils import logging A_ = logging.get_logger(__name__) A_ = { '''microsoft/xprophetnet-large-wiki100-cased''': ( '''https:/...
362
"""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 utils/check_copies.py A_ ...
296
0
def lowerCamelCase__ ( snake_case_ : str = "The quick brown fox jumps over the lazy dog" , ) -> bool: __snake_case = set() # Replace all the whitespace in our sentence __snake_case = input_str.replace(''' ''' , '''''' ...
24
class __lowercase : """simple docstring""" def __init__( self : List[Any] , lowerCAmelCase__ : Optional[int] , lowerCAmelCase__ : List[Any]): SCREAMING_SNAKE_CASE_: List[str] = name SCREAMING_SNAKE_CASE_: Union[str, Any] = val ...
13
0
'''simple docstring''' import functools import operator from ...configuration_utils import PretrainedConfig from ...utils import logging _UpperCAmelCase : List[str] = logging.get_logger(__name__) _UpperCAmelCase : int = { """facebook/wav2vec2-base-960h""": """h...
9
'''simple docstring''' import argparse import re from pathlib import Path import requests import torch from PIL import Image from torchvision.transforms import CenterCrop, Compose, Normalize, Resize, ToTensor from transformers import ( EfficientFormerConfig, EfficientFormerForImageClassifi...
9
1
'''simple docstring''' from torch import nn def __UpperCamelCase ( UpperCAmelCase ): 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: {act_fn}""" ) ...
198
'''simple docstring''' import os from argparse import ArgumentParser from typing import List import torch.utils.data from datasets import Dataset, IterableDataset from datasets.distributed import split_dataset_by_node __a: Optional[int] = 4 __a: Optional[Any] = 3 class UpperCAmelCase (...
198
1
"""simple docstring""" from math import sqrt import numpy as np from sympy import symbols # Coefficient # Speed of light (m/s) lowercase__ = 299792458 # Symbols lowercase__ , lowercase__ , lowercase__ , lowercase__ = symbols("""ct x y z""") def __lowerCamelCase ( _...
161
"""simple docstring""" from __future__ import annotations import math class __lowerCamelCase : '''simple docstring''' def __init__( self : Dict , a_ : int ): lowerCAmelCase_ : Union[str, Any] = size # approximate the ove...
161
1
"""simple docstring""" from typing import Dict, List from nltk.translate import gleu_score import datasets from datasets import MetricInfo lowercase__ = """\ @misc{wu2016googles, title={Google's Neural Machine Translation System: Bridging the Gap between Human and Machine Translation}, ...
241
"""simple docstring""" from collections.abc import Iterable from typing import Generic, TypeVar lowercase__ = TypeVar("""_T""") class __lowerCamelCase ( Generic[_T] ): '''simple docstring''' def __init__( self : Optional[int] , a_ : Iterable[_T] | None = No...
241
1
'''simple docstring''' def lowercase__ ( __UpperCamelCase )-> bool: return number & 1 == 0 if __name__ == "__main__": import doctest doctest.testmod()
183
'''simple docstring''' from timeit import timeit def lowercase__ ( __UpperCamelCase )-> int: if number < 0: raise ValueError("""the value of input must not be negative""" ) UpperCamelCase = 0 while number: number &= number...
183
1
from __future__ import annotations def _lowercase ( lowercase__ ): __lowerCAmelCase : str = str(_SCREAMING_SNAKE_CASE ) return len(_SCREAMING_SNAKE_CASE ) == 9 and set(_SCREAMING_SNAKE_CASE ) == set('''123456789''' ) def _lowercase ( ): ...
275
import itertools import os import random import tempfile import unittest import numpy as np from transformers import TvltFeatureExtractor, is_datasets_available from transformers.testing_utils import check_json_file_has_correct_format, require_torch, require_torchaudio from transformers.utils.im...
296
0
'''simple docstring''' from copy import deepcopy from typing import Optional, Union import numpy as np from ...processing_utils import ProcessorMixin from ...tokenization_utils_base import BatchEncoding from ...utils import TensorType, is_tf_available, is_torch_available if is_torch_available(): import ...
337
'''simple docstring''' from binascii import hexlify from hashlib import shaaaa from os import urandom # RFC 3526 - More Modular Exponential (MODP) Diffie-Hellman groups for # Internet Key Exchange (IKE) https://tools.ietf.org/html/rfc3526 _lowerCamelCase : Any = { # 1536-bit 5: { ...
337
1
import functools import operator from ...configuration_utils import PretrainedConfig from ...utils import logging __lowerCAmelCase : Optional[Any] =logging.get_logger(__name__) __lowerCAmelCase : List[str] ={ 'facebook/wav2vec2-base-960h': 'https://huggingface.co/facebook/wav2vec2-base-960h/resolve...
9
import unittest import numpy as np from transformers.testing_utils import require_torch, require_vision from transformers.utils import is_torch_available, is_vision_available from ...test_image_processing_common import ImageProcessingSavingTestMixin, prepare_video_inputs if is_torch_available(): import to...
9
1
"""simple docstring""" from __future__ import annotations from collections.abc import Iterable, Iterator from dataclasses import dataclass UpperCAmelCase = (3, 9, -11, 0, 7, 5, 1, -1) UpperCAmelCase = (4, 6, 2, 0, 8, 10, 3, -2) @dataclass class __magic_name__ : __A : int ...
172
"""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 UpperCAmelCase = logging.get_logger(__name__) UpperCAmelCase = '...
172
1
'''simple docstring''' from typing import TYPE_CHECKING from ...utils import OptionalDependencyNotAvailable, _LazyModule, is_flax_available, is_torch_available a__ : Tuple = { "configuration_gpt_neo": ["GPT_NEO_PRETRAINED_CONFIG_ARCHIVE_MAP", "GPTNeoConfig", "GPTNeoOnnxConfi...
161
'''simple docstring''' from typing import Optional import torch import torch.utils.checkpoint from torch import Tensor, nn from torch.nn import BCEWithLogitsLoss, CrossEntropyLoss, MSELoss from ...activations import ACTaFN from ...file_utils import add_code_sample_docstrings, add_start_docstrings...
161
1
from random import randint, random def A ( a_ ,a_ ,a_ ,a_ = False ,a_ = False ,a_ = 5 ,) -> list: __UpperCamelCase : Dict =[[-1] * number_of_cells] # Create a highway without any car __UpperCamelCase : Union[str, Any...
359
def A ( a_ ) -> bool: if number < 0: raise ValueError('number must not be negative' ) return number & (number - 1) == 0 if __name__ == "__main__": import doctest doctest.testmod()
245
0
"""simple docstring""" import argparse import os import torch from transformers import FlavaImageCodebook, FlavaImageCodebookConfig def lowerCamelCase__ ( _lowerCamelCase : int , _lowerCamelCase : Optional[int] , _lowerCamelCase ...
183
"""simple docstring""" from typing import Any, Callable, Dict, List, Optional, Union import torch from transformers import CLIPImageProcessor, CLIPTextModel, CLIPTokenizer from diffusers import ( AutoencoderKL, DDIMScheduler, DiffusionPipeline, LMSDiscreteScheduler, ...
183
1
"""simple docstring""" import copy import unittest from transformers.models.auto import get_values from transformers.testing_utils import require_torch, slow, torch_device from transformers.utils import cached_property, is_torch_available, is_vision_available from ...test_configuration_common import ConfigTes...
149
"""simple docstring""" import itertools import os import random import tempfile import unittest import numpy as np from transformers import TvltFeatureExtractor, is_datasets_available from transformers.testing_utils import check_json_file_has_correct_format, require_torch, require_torchaudio from transform...
149
1
from copy import deepcopy from typing import Optional, Union import numpy as np from ...processing_utils import ProcessorMixin from ...tokenization_utils_base import BatchEncoding from ...utils import TensorType, is_tf_available, is_torch_available if is_torch_available(): import torch if is_tf_available(): ...
337
import warnings from ...utils import logging from .image_processing_deit import DeiTImageProcessor __a = logging.get_logger(__name__) class __SCREAMING_SNAKE_CASE ( A__ ): def __init__( self , *SCREAMING_SNAKE_CASE__ , **SCREAMING_SNAKE_CASE__ ): ...
337
1
'''simple docstring''' import json from typing import List, Optional, Tuple from tokenizers import normalizers from ...tokenization_utils_fast import PreTrainedTokenizerFast from ...utils import logging from .tokenization_funnel import FunnelTokenizer _lowerCAmelCase = logging.ge...
367
'''simple docstring''' from typing import TYPE_CHECKING from ...utils import OptionalDependencyNotAvailable, _LazyModule, is_torch_available, is_vision_available _lowerCAmelCase = {"configuration_glpn": ["GLPN_PRETRAINED_CONFIG_ARCHIVE_MAP", "GLPNConfig"]} try: if not is_vision_available():...
98
0
"""simple docstring""" import unittest import numpy as np from transformers import BertConfig, is_flax_available from transformers.testing_utils import require_flax, slow from ...test_modeling_flax_common import FlaxModelTesterMixin, floats_tensor, ids_tensor, random_attention_mask if is_f...
172
"""simple docstring""" from ...configuration_utils import PretrainedConfig from ...utils import logging _a : int= logging.get_logger(__name__) _a : Optional[Any]= { "SCUT-DLVCLab/lilt-roberta-en-base": ( "https://huggingface.co/SCUT-DLVCLab/lilt-roberta-en-base/reso...
172
1
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 AutoFeatureExtractor, WavaVecaFeatureExtractor from transformers.testing_utils import TOKEN, USER, g...
71
import warnings from ...processing_utils import ProcessorMixin from ...tokenization_utils_base import BatchEncoding class _lowercase ( lowerCAmelCase ): """simple docstring""" __A = ["image_processor", "tokenizer"] __A = "ViTImageProcessor" __A ...
71
1
'''simple docstring''' from ...configuration_utils import PretrainedConfig from ...utils import logging lowercase_ = logging.get_logger(__name__) lowercase_ = { """facebook/nllb-moe-54B""": """https://huggingface.co/facebook/nllb-moe-54b/resolve/main/config.json""", } class a_ ( snak...
58
import re from filelock import FileLock try: import nltk UpperCAmelCase__ : Tuple = True except (ImportError, ModuleNotFoundError): UpperCAmelCase__ : Optional[Any] = False if NLTK_AVAILABLE: with FileLock(""".lock""") as lock: nltk.download("""punkt""", quie...
245
0
"""simple docstring""" __UpperCamelCase : Optional[Any] = '''ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/''' def __SCREAMING_SNAKE_CASE ( A_ ): # Make sure the supplied data is a bytes-like object if not isinstance(A_ , A_ ): lowerCAmelCase__ : ...
74
"""simple docstring""" import os from collections import namedtuple import pytest from datasets import ClassLabel, Features, Sequence, Value from datasets.commands.test import TestCommand from datasets.info import DatasetInfo, DatasetInfosDict __UpperCamelCase : Union[str, Any] = namedtuple( ...
74
1
import argparse import os import evaluate import torch from datasets import load_dataset from torch.optim import AdamW from torch.utils.data import DataLoader from transformers import AutoModelForSequenceClassification, AutoTokenizer, get_linear_schedule_with_warmup, set_seed from accelerate imp...
149
import sys from typing import Tuple import numpy as np import torch from PIL import Image from torch import nn from transformers.image_utils import PILImageResampling from utils import img_tensorize class _a : """simple docstring""" def __init__( self: ...
149
1
"""simple docstring""" from unittest.mock import patch import pyspark from datasets.packaged_modules.spark.spark import ( Spark, SparkExamplesIterable, _generate_iterable_examples, ) from ..utils import ( require_dill_gt_0_3_2, require_not_windows, ) d...
128
"""simple docstring""" from __future__ import annotations import math def a_ ( _lowercase , _lowercase , _lowercase , _lowercase , _lowercase ): if depth < 0: raise ValueError('''Depth cannot be less than 0''' ) ...
128
1
"""simple docstring""" from operator import delitem, getitem, setitem import pytest from data_structures.hashing.hash_map import HashMap def SCREAMING_SNAKE_CASE ( _lowerCamelCase : Optional[Any] ) -> Tuple: return getitem, k def SCREAMING_SNAKE_CASE ( _...
44
"""simple docstring""" import requests from bsa import BeautifulSoup def a_ ( lowerCamelCase , lowerCamelCase ): UpperCAmelCase__ = BeautifulSoup(requests.get(lowerCamelCase , params=lowerCamelCase ).content , 'html.parser' ) UpperCAmelCa...
98
0
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_inputs if is_tor...
19
import unittest from transformers.models.xlm_prophetnet.tokenization_xlm_prophetnet import SPIECE_UNDERLINE, XLMProphetNetTokenizer from transformers.testing_utils import get_tests_dir, require_sentencepiece, slow from transformers.utils import cached_property from ...test_tokenization_common import TokenizerTesterM...
19
1
def A ( a_ ,a_ ) -> int: return int((input_a, input_a).count(1 ) != 0 ) def A ( ) -> None: assert or_gate(0 ,0 ) == 0 assert or_gate(0 ,1 ) == 1 assert or_gate(1 ,0 ) ==...
71
import argparse import json import os import re import torch from transformers import BloomConfig, BloomModel from transformers.file_utils import CONFIG_NAME, WEIGHTS_NAME from transformers.utils import logging logging.set_verbosity_info() A_ :List[str] = [ '''word...
71
1
'''simple docstring''' import os import tempfile from functools import partial from unittest import TestCase from unittest.mock import patch import datasets import datasets.config from .utils import require_beam class SCREAMING_SNAKE_CASE__ ( datasets.BeamBasedBuilder ): """simple docs...
360
'''simple docstring''' from datetime import datetime as dt import os from github import Github lowerCAmelCase__ : Union[str, Any] = [ "good first issue", "good second issue", "good difficult issue", "feature request", "new model", "wip", ] def __UpperCamelCase ( ): ...
37
0
"""simple docstring""" # tests directory-specific settings - this file is run automatically # by pytest before any tests are run import doctest import sys import warnings from os.path import abspath, dirname, join import _pytest from transformers.testing_utils import HfDoctestModule, HfDocTestParser # allow hav...
74
"""simple docstring""" from string import ascii_uppercase _lowercase = {char: i for i, char in enumerate(ascii_uppercase)} _lowercase = dict(enumerate(ascii_uppercase)) def _snake_case ( snake_case__ : str , snake_case__ : str ): A = len(snak...
74
1
def __lowerCamelCase ( UpperCAmelCase_ : int = 100 ): """simple docstring""" a :Union[str, Any] = n * (n + 1) * (2 * n + 1) / 6 a :List[str] = (n * (n + 1) / 2) ** 2 return int(square_of_sum - sum_of_squares ) ...
358
import os import re from shutil import copyfile from typing import List, Optional, Tuple from ...tokenization_utils import PreTrainedTokenizer from ...utils import logging snake_case : List[str] = logging.get_logger(__name__) snake_case : Optional[Any] = { '''vocab_file''': '''vocab...
281
0
UpperCAmelCase : List[str] ={0: [2, 3], 1: [0], 2: [1], 3: [4], 4: []} UpperCAmelCase : Any ={0: [1, 2, 3], 1: [2], 2: [0], 3: [4], 4: [5], 5: [3]} def _lowerCAmelCase (_lowerCAmelCase , _lowerCAmelCase , _lowerCAmelCase): UpperCamelCase_ ...
128
from __future__ import annotations from collections.abc import Iterator from typing import Generic, TypeVar UpperCAmelCase : Dict =TypeVar("""T""") class _lowercase (Generic[T] ): '''simple docstring''' def __init__( self , snake_case__ ): ...
128
1
from typing import List, Optional, Tuple, Union import torch from ...utils import logging, randn_tensor from ..pipeline_utils import AudioPipelineOutput, DiffusionPipeline snake_case_ = logging.get_logger(__name__) # pylint: disable=invalid-name class SCREAMING_SNAKE_CASE__ ...
238
# Lint as: python3 import sys from collections.abc import Mapping from typing import TYPE_CHECKING import numpy as np import pyarrow as pa from .. import config from ..utils.py_utils import map_nested from .formatting import TensorFormatter if TYPE_CHECKING: import torch class SCR...
238
1
import json from typing import List, Optional, Tuple from tokenizers import normalizers from ...tokenization_utils_fast import PreTrainedTokenizerFast from .tokenization_lxmert import LxmertTokenizer __A ={'''vocab_file''': '''vocab.txt''', '''tokenizer_file''': '''tokenizer.json'''} __A ={ '''vocab_fil...
19
from typing import TYPE_CHECKING from ...utils import OptionalDependencyNotAvailable, _LazyModule, is_torch_available __A ={'''configuration_wavlm''': ['''WAVLM_PRETRAINED_CONFIG_ARCHIVE_MAP''', '''WavLMConfig''']} try: if not is_torch_available(): raise OptionalDependencyNotAvailable() except Optional...
19
1
import math _A = 10 _A = 7 _A = BALLS_PER_COLOUR * NUM_COLOURS def __UpperCamelCase ( _A = 20 ): lowerCAmelCase_ = math.comb(_A , _A ) lowerCAmelCase_ = math.comb(NUM_BALLS - BALLS_PER_COLOUR , _A ) lowerCAmelCase_ ...
167
from typing import List, Optional, TypeVar from .arrow_dataset import Dataset, _concatenate_map_style_datasets, _interleave_map_style_datasets from .dataset_dict import DatasetDict, IterableDatasetDict from .info import DatasetInfo from .iterable_dataset import IterableDataset, _concatenate_iterable_datasets, _in...
167
1
"""simple docstring""" import json import os import unittest from transformers import BatchEncoding, MvpTokenizer, MvpTokenizerFast from transformers.models.roberta.tokenization_roberta import VOCAB_FILES_NAMES from transformers.testing_utils import require_tokenizers, require_torch from transformers.utils impor...
98
'''simple docstring''' from sklearn.metrics import fa_score, matthews_corrcoef import datasets from .record_evaluation import evaluate as evaluate_record _lowerCAmelCase = '''\ @article{wang2019superglue, title={SuperGLUE: A Stickier Benchmark for General-Purpose Language Understanding Systems...
37
0
"""simple docstring""" import re from filelock import FileLock try: import nltk A = True except (ImportError, ModuleNotFoundError): A = False if NLTK_AVAILABLE: with FileLock('''.lock''') as lock: nltk.download('''punkt''', quiet=True) def ...
188
"""simple docstring""" import argparse import os from transformers.utils import direct_transformers_import # All paths are set with the intent you should run this script from the root of the repo with the command # python utils/check_task_guides.py A = '''src/transformers'''...
188
1
import os import pytest from datasets import ( get_dataset_config_info, get_dataset_config_names, get_dataset_infos, get_dataset_split_names, inspect_dataset, inspect_metric, ) __lowerCamelCase : int = pytest.mark.integration @pytest.mark.parametrize("""path"...
219
import math def lowerCAmelCase_ ( _snake_case : float , _snake_case : float ) -> float: '''simple docstring''' return math.pow(_snake_case , 2 ) - a def lowerCAmelCase_ ( _snake_case : float ) -> float: '''simple docstri...
281
0
import argparse import json import os import torch from transformers.file_utils import has_file from diffusers import UNetaDConditionModel, UNetaDModel snake_case = False snake_case = True snake_case = False if __name__ == "__main__": snake_case = argp...
319
# coding=utf-8 # Copyright 2023 The HuggingFace Inc. team. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by app...
319
1
"""simple docstring""" # Imports import numpy as np class __SCREAMING_SNAKE_CASE : '''simple docstring''' def __init__( self : Any, lowerCamelCase : List[Any]=None, lowerCamelCase : Union[str, Any]=None, lowerCamelCase : Dict=None, lowerCamelCase ...
238
"""simple docstring""" from collections import OrderedDict from typing import TYPE_CHECKING, Any, Mapping, Optional, Union from ...configuration_utils import PretrainedConfig from ...onnx import OnnxConfig from ...utils import logging if TYPE_CHECKING: from ... import FeatureExtractionMixin, PreTrainedTo...
238
1
"""simple docstring""" def _a ( _snake_case ): """simple docstring""" UpperCAmelCase = [False] * len(__lowerCAmelCase ) UpperCAmelCase = [-1] * len(__lowerCAmelCase ) def dfs(_snake_case , _snake_case ): Upper...
362
"""simple docstring""" from __future__ import annotations def _a ( _snake_case , _snake_case = None , _snake_case = None ): """simple docstring""" if start is None: UpperCAmelCase = 0 if end is None: UpperCAmelCase =...
234
0