code
stringlengths
82
54.1k
code_codestyle
int64
0
699
style_context
stringlengths
111
35.6k
style_context_codestyle
int64
0
699
label
int64
0
1
import gc import random import unittest import numpy as np import torch from diffusers import DDIMScheduler, KandinskyVaaPipeline, KandinskyVaaPriorPipeline, UNetaDConditionModel, VQModel from diffusers.utils import floats_tensor, load_numpy, slow, torch_device from diffusers.utils.testing_utils import enable_...
0
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 import ModelTesterMixin, ...
32
0
from typing import List, Optional, Union import numpy as np import tensorflow as tf from .utils import logging __snake_case = logging.get_logger(__name__) def _A ( _lowercase ) -> List[int]: """simple docstring""" if isinstance(_lowercase , n...
1
from ...configuration_utils import PretrainedConfig from ...utils import logging UpperCAmelCase_ = logging.get_logger(__name__) UpperCAmelCase_ = { "RWKV/rwkv-4-169m-pile": "https://huggingface.co/RWKV/rwkv-4-169m-pile/resolve/main/config.json", "RWKV/rwkv-4-430m-pile": "https://hug...
32
0
import gc import random import unittest import torch from diffusers import ( IFImgaImgPipeline, IFImgaImgSuperResolutionPipeline, IFInpaintingPipeline, IFInpaintingSuperResolutionPipeline, IFPipeline, IFSuperResolutionPipeline, ) from diffusers.models.attention_processor ...
2
def A__ ( SCREAMING_SNAKE_CASE_ : int , SCREAMING_SNAKE_CASE_ : int ) -> str: """simple docstring""" if a < 0 or b < 0: raise ValueError('''the value of both inputs must be positive''' ) _UpperCAmelCase = str(bin(SCREAMING_SNAKE_C...
32
0
'''simple docstring''' import operator as op def A_( A : Union[str, Any]): UpperCamelCase = [] UpperCamelCase = lambda A , A: int(x / y) # noqa: E731 integer division operation UpperCamelCase = { '^': op.pow, ...
3
from ...configuration_utils import PretrainedConfig from ...utils import logging UpperCAmelCase_ = logging.get_logger(__name__) UpperCAmelCase_ = { "tiiuae/falcon-40b": "https://huggingface.co/tiiuae/falcon-40b/resolve/main/config.json", "tiiuae/falcon-7b": "https://huggingface.co/t...
32
0
"""simple docstring""" from collections import deque class a : def __init__( self , _snake_case , _snake_case , _snake_case ): """simple docstring""" lowerCAmelCase = process_name # process name lowerCAmelCase = arrival_ti...
4
from math import sqrt def A__ ( SCREAMING_SNAKE_CASE_ : int ) -> bool: """simple docstring""" 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 mult...
32
0
'''simple docstring''' import os from shutil import copyfile from typing import List, Optional, Tuple from ...tokenization_utils import AddedToken from ...tokenization_utils_fast import PreTrainedTokenizerFast from ...utils import is_sentencepiece_available, logging if is_sentencepiece_available(): from .t...
5
def A__ ( SCREAMING_SNAKE_CASE_ : int ) -> bool: """simple docstring""" if not isinstance(SCREAMING_SNAKE_CASE_ , SCREAMING_SNAKE_CASE_ ): _UpperCAmelCase = F'''Input value of [number={number}] must be an integer''' raise TypeError(SCR...
32
0
import os from typing import Optional import fsspec from fsspec.archive import AbstractArchiveFileSystem from fsspec.utils import DEFAULT_BLOCK_SIZE class UpperCamelCase_ ( UpperCamelCase__ ): lowerCamelCase_ = "" lowerCamelCase_ = ( None...
6
from dataclasses import dataclass, field from typing import ClassVar, Dict from ..features import Features, Value from .base import TaskTemplate @dataclass(frozen=A__ ) class __UpperCamelCase ( A__ ): __A : str = field(default="""language-modeling""" , metadata={"""include_i...
32
0
"""simple docstring""" import pytest from datasets.splits import SplitDict, SplitInfo from datasets.utils.py_utils import asdict @pytest.mark.parametrize( 'split_dict' , [ SplitDict(), SplitDict({'train': SplitInfo(name='train' , num_bytes=13_37 , num_examples...
7
import os import re import warnings from shutil import copyfile from typing import TYPE_CHECKING, Any, Dict, List, Optional, Tuple import sentencepiece as spm from ...tokenization_utils import PreTrainedTokenizer if TYPE_CHECKING: from ...tokenization_utils_base import TextInput from ...utils import loggin...
32
0
'''simple docstring''' import argparse import torch from transformers import BertForMaskedLM if __name__ == "__main__": lowercase__ : Optional[int] = argparse.ArgumentParser( description=( '''Extraction some layers of the full BertForMaskedLM or R...
8
from __future__ import annotations def A__ ( SCREAMING_SNAKE_CASE_ : int ) -> bool: """simple docstring""" _UpperCAmelCase = str(SCREAMING_SNAKE_CASE_ ) return len(SCREAMING_SNAKE_CASE_ ) == 9 and set(SCREAMING_SNAKE_CASE_ ) == set('''12...
32
0
import warnings from typing import List, Optional, Union from ...processing_utils import ProcessorMixin from ...tokenization_utils_base import BatchEncoding, PaddingStrategy, PreTokenizedInput, TextInput, TruncationStrategy from ...utils import TensorType class __lowerCAmelCase ( UpperCAmelCase_ ): ""...
9
import numpy as np def A__ ( SCREAMING_SNAKE_CASE_ : np.ndarray , SCREAMING_SNAKE_CASE_ : float ) -> np.ndarray: """simple docstring""" return np.where(vector > 0 , SCREAMING_SNAKE_CASE_ , (alpha * (np.exp(SCREAMING_SNAKE_CASE_ ) - 1)) ) i...
32
0
import functools import operator from ...configuration_utils import PretrainedConfig from ...utils import logging _lowerCAmelCase = logging.get_logger(__name__) _lowerCAmelCase = { "microsoft/unispeech-sat-base-100h-libri-ft": ( "https://huggingface.co/microsoft/unispeech-sat-base-100h-lib...
10
UpperCAmelCase_ = { "A": ".-", "B": "-...", "C": "-.-.", "D": "-..", "E": ".", "F": "..-.", "G": "--.", "H": "....", "I": "..", "J": ".---", "K": "-.-", "L": ".-..", "M": "--", "N": "-.", "O": "---", "P": ".--.", "Q": "--.-", "R": ".-.", "S": "...", "T": "-", "U": "..-", "V": "...-", "W"...
32
0
'''simple docstring''' import os import re from shutil import copyfile from typing import List, Optional, Tuple from ...tokenization_utils import PreTrainedTokenizer from ...utils import logging lowercase_ = logging.get_logger(__name__) lowercase_ = { "vocab_file": "vocab.txt", ...
11
import gc import unittest import numpy as np import torch from diffusers import DanceDiffusionPipeline, IPNDMScheduler, UNetaDModel from diffusers.utils import slow, torch_device from diffusers.utils.testing_utils import enable_full_determinism, require_torch_gpu, skip_mps from ..pipeline_params import UNCONDI...
32
0
from __future__ import annotations def UpperCamelCase ( lowercase_ , lowercase_ ) -> list[int]: '''simple docstring''' lowercase__ : List[str] = 0 lowercase__ : List[Any] = len(lowercase_ ) - 1 while i < j: if nums[i] + nums[j] == target: ...
12
from collections import OrderedDict from ...utils import logging from .auto_factory import _BaseAutoModelClass, _LazyAutoMapping, auto_class_update from .configuration_auto import CONFIG_MAPPING_NAMES UpperCAmelCase_ = logging.get_logger(__name__) UpperCAmelCase_ = OrderedDict( [ ...
32
0
'''simple docstring''' import math def UpperCAmelCase__ ( UpperCAmelCase_ : int ) -> bool: return math.sqrt(UpperCAmelCase_ ) * math.sqrt(UpperCAmelCase_ ) == num def UpperCAmelCase__ ( UpperCAmelCase_ : int ) -> bool: __lowerCa...
13
import baseaa def A__ ( SCREAMING_SNAKE_CASE_ : str ) -> bytes: """simple docstring""" return baseaa.baaencode(string.encode('''utf-8''' ) ) def A__ ( SCREAMING_SNAKE_CASE_ : bytes ) -> str: """simple docstring""" ...
32
0
def __UpperCAmelCase ( __a : int ) -> int: """simple docstring""" _a : str = abs(__a ) _a : Any = 0 while n > 0: res += n % 10 n //= 10 return res def __UpperCAmelCase ( __a : ...
14
from typing import Dict, List, Optional, Union import numpy as np from ...image_processing_utils import BaseImageProcessor, BatchFeature, get_size_dict from ...image_transforms import ( center_crop, get_resize_output_image_size, normalize, rescale, resize, to_channel_dimension_format, ) ...
32
0
# This is the module that test_patching.py uses to test patch_submodule() import os # noqa: this is just for tests import os as renamed_os # noqa: this is just for tests from os import path # noqa: this is just for tests from os import path as renamed_path # noqa: this is just for tests from os.path im...
15
from ..utils import DummyObject, requires_backends class __UpperCamelCase ( metaclass=A__ ): __A : str = ["""torch""", """scipy"""] def __init__( self , *_UpperCamelCase , **_UpperCamelCase ): requires_backends(self , ['''torc...
32
0
# 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 TensorFormatter if...
16
def A__ ( SCREAMING_SNAKE_CASE_ : int = 2_00_00_00 ) -> int: """simple docstring""" _UpperCAmelCase = [0 for i in range(n + 1 )] _UpperCAmelCase = 1 _UpperCAmelCase = 1 for i in range(2 , int(n**0.5 ) + 1 ...
32
0
from typing import TYPE_CHECKING from ...utils import OptionalDependencyNotAvailable, _LazyModule, is_tokenizers_available, is_torch_available UpperCAmelCase_ : Optional[Any] = { '''configuration_altclip''': [ '''ALTCLIP_PRETRAINED_CONFIG_ARCHIVE_MAP''', '''AltCLIPConfig''', ...
17
import warnings from ...utils import logging from .image_processing_glpn import GLPNImageProcessor UpperCAmelCase_ = logging.get_logger(__name__) class __UpperCamelCase ( A__ ): def __init__( self , *_UpperCamelCase , **_UpperCamelCase ): ...
32
0
'''simple docstring''' import functools def __a(SCREAMING_SNAKE_CASE_ : str , SCREAMING_SNAKE_CASE_ : str ): '''simple docstring''' _lowerCAmelCase = len(SCREAMING_SNAKE_CASE_ ) _lowerCAmelCase = len(SCREAMING_SNAKE_CASE_ ) ...
18
from typing import List, Optional, Union from ...processing_utils import ProcessorMixin from ...tokenization_utils_base import BatchEncoding, PaddingStrategy, PreTokenizedInput, TextInput, TruncationStrategy from ...utils import TensorType class __UpperCamelCase ( A__ ): __A : Dict ...
32
0
"""simple docstring""" def lowerCamelCase__ ( __snake_case, __snake_case, __snake_case, __snake_case ) -> bool: """simple docstring""" if graph[path[curr_ind - 1]][next_ver] == 0: return False # 2. Validate that next vertex is not already ...
19
from typing import TYPE_CHECKING from ...utils import OptionalDependencyNotAvailable, _LazyModule, is_tf_available, is_torch_available UpperCAmelCase_ = { "configuration_xlm": ["XLM_PRETRAINED_CONFIG_ARCHIVE_MAP", "XLMConfig", "XLMOnnxConfig"], "tokenization_xlm": ["XLMTokenizer"], } try: ...
32
0
from collections import OrderedDict from typing import Mapping from ...configuration_utils import PretrainedConfig from ...onnx import OnnxConfig from ...utils import logging _lowerCAmelCase: str = logging.get_logger(__name__) _lowerCAmelCase: Any = { 'google/bigbird-roberta...
20
from ...configuration_utils import PretrainedConfig from ...utils import logging UpperCAmelCase_ = logging.get_logger(__name__) UpperCAmelCase_ = { "microsoft/biogpt": "https://huggingface.co/microsoft/biogpt/resolve/main/config.json", # See all BioGPT models at https://huggingface....
32
0
class __A : def __init__( self :Any , __snake_case :str = "" , __snake_case :bool = False ): '''simple docstring''' __magic_name__ : dict[str, RadixNode] ={} # A node will be a leaf if the tree contains its word __m...
21
from typing import List from .keymap import KEYMAP, get_character def A__ ( SCREAMING_SNAKE_CASE_ : str ) -> List[str]: """simple docstring""" def decorator(SCREAMING_SNAKE_CASE_ : List[Any] ): _UpperCAmelCase = getattr(SCREAMING_SNAKE_...
32
0
'''simple docstring''' import unittest import torch from torch import nn from accelerate.test_utils import require_cuda from accelerate.utils.memory import find_executable_batch_size, release_memory def snake_case_ (): '''simple docstring''' raise Runtim...
22
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 import ModelTesterMixin, ...
32
0
from typing import Any, Callable, Dict, List, Optional, Union import torch from transformers import CLIPImageProcessor, CLIPTextModel, CLIPTokenizer from diffusers import ( AutoencoderKL, DDIMScheduler, DiffusionPipeline, LMSDiscreteScheduler, PNDMScheduler, StableDiff...
23
from ...configuration_utils import PretrainedConfig from ...utils import logging UpperCAmelCase_ = logging.get_logger(__name__) UpperCAmelCase_ = { "RWKV/rwkv-4-169m-pile": "https://huggingface.co/RWKV/rwkv-4-169m-pile/resolve/main/config.json", "RWKV/rwkv-4-430m-pile": "https://hug...
32
0
'''simple docstring''' from collections import OrderedDict from typing import Any, Mapping, Optional from ... import PreTrainedTokenizer from ...configuration_utils import PretrainedConfig from ...onnx import OnnxConfig, OnnxConfigWithPast, OnnxSeqaSeqConfigWithPast from ...onnx.utils import compute_effective_...
24
def A__ ( SCREAMING_SNAKE_CASE_ : int , SCREAMING_SNAKE_CASE_ : int ) -> str: """simple docstring""" if a < 0 or b < 0: raise ValueError('''the value of both inputs must be positive''' ) _UpperCAmelCase = str(bin(SCREAMING_SNAKE_C...
32
0
from typing import Optional from urllib.parse import quote import huggingface_hub as hfh from packaging import version def lowerCamelCase__ ( _a , _a , _a = None): if version.parse(hfh.__version__).release < version.parse("0.11.0").release: # old versions of hfh don't url-encode the fi...
25
from ...configuration_utils import PretrainedConfig from ...utils import logging UpperCAmelCase_ = logging.get_logger(__name__) UpperCAmelCase_ = { "tiiuae/falcon-40b": "https://huggingface.co/tiiuae/falcon-40b/resolve/main/config.json", "tiiuae/falcon-7b": "https://huggingface.co/t...
32
0
'''simple docstring''' import comet # From: unbabel-comet import torch import datasets __UpperCamelCase = datasets.logging.get_logger(__name__) __UpperCamelCase = "\\n@inproceedings{rei-EtAl:2020:WMT,\n author = {Rei, Ricardo and Stewart, Craig and Farinha,...
26
from math import sqrt def A__ ( SCREAMING_SNAKE_CASE_ : int ) -> bool: """simple docstring""" 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 mult...
32
0
import argparse import hashlib # hashlib is only used inside the Test class import struct class lowerCamelCase: '''simple docstring''' def __init__( self , snake_case_ ): _A = data _A = [0X6745_2301, 0XEFCD_AB89, ...
27
def A__ ( SCREAMING_SNAKE_CASE_ : int ) -> bool: """simple docstring""" if not isinstance(SCREAMING_SNAKE_CASE_ , SCREAMING_SNAKE_CASE_ ): _UpperCAmelCase = F'''Input value of [number={number}] must be an integer''' raise TypeError(SCR...
32
0
'''simple docstring''' def lowercase__( __UpperCamelCase: int ): """simple docstring""" SCREAMING_SNAKE_CASE : Any = [1] SCREAMING_SNAKE_CASE , SCREAMING_SNAKE_CASE , SCREAMING_SNAKE_CASE : List[str] = ...
28
from dataclasses import dataclass, field from typing import ClassVar, Dict from ..features import Features, Value from .base import TaskTemplate @dataclass(frozen=A__ ) class __UpperCamelCase ( A__ ): __A : str = field(default="""language-modeling""" , metadata={"""include_i...
32
0
"""simple docstring""" from cva import destroyAllWindows, imread, imshow, waitKey def lowercase ( lowerCAmelCase__ ): # getting number of pixels in the image lowerCamelCase_ , lowerCamelCase_ = img.shape[0], img.shape[1] # converting each pixel's color to its negative for i in ran...
29
import os import re import warnings from shutil import copyfile from typing import TYPE_CHECKING, Any, Dict, List, Optional, Tuple import sentencepiece as spm from ...tokenization_utils import PreTrainedTokenizer if TYPE_CHECKING: from ...tokenization_utils_base import TextInput from ...utils import loggin...
32
0
import argparse import json 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 import A...
30
from __future__ import annotations def A__ ( SCREAMING_SNAKE_CASE_ : int ) -> bool: """simple docstring""" _UpperCAmelCase = str(SCREAMING_SNAKE_CASE_ ) return len(SCREAMING_SNAKE_CASE_ ) == 9 and set(SCREAMING_SNAKE_CASE_ ) == set('''12...
32
0
lowerCamelCase__ : int = tuple[float, float, float] lowerCamelCase__ : Optional[Any] = tuple[float, float, float] def UpperCAmelCase_ ( __UpperCAmelCase : Pointad , __UpperCAmelCase : Pointad ) -> Vectorad: SCREAMING_SNAKE_CASE_ ...
31
import numpy as np def A__ ( SCREAMING_SNAKE_CASE_ : np.ndarray , SCREAMING_SNAKE_CASE_ : float ) -> np.ndarray: """simple docstring""" return np.where(vector > 0 , SCREAMING_SNAKE_CASE_ , (alpha * (np.exp(SCREAMING_SNAKE_CASE_ ) - 1)) ) i...
32
0
from typing import TYPE_CHECKING from ...utils import ( OptionalDependencyNotAvailable, _LazyModule, is_tf_available, is_tokenizers_available, is_torch_available, ) lowerCamelCase__ : str = { """configuration_deberta""": ["""DEBERTA_PRETRAINED_CONFIG_...
33
UpperCAmelCase_ = { "A": ".-", "B": "-...", "C": "-.-.", "D": "-..", "E": ".", "F": "..-.", "G": "--.", "H": "....", "I": "..", "J": ".---", "K": "-.-", "L": ".-..", "M": "--", "N": "-.", "O": "---", "P": ".--.", "Q": "--.-", "R": ".-.", "S": "...", "T": "-", "U": "..-", "V": "...-", "W"...
32
0
"""simple docstring""" import unittest import numpy as np from transformers.testing_utils import require_torch, require_vision from transformers.utils import is_torch_available, is_vision_available from ...test_image_processing_common import ImageProcessingSavingTestMixin, prepare_image_inputs if is_to...
34
import gc import unittest import numpy as np import torch from diffusers import DanceDiffusionPipeline, IPNDMScheduler, UNetaDModel from diffusers.utils import slow, torch_device from diffusers.utils.testing_utils import enable_full_determinism, require_torch_gpu, skip_mps from ..pipeline_params import UNCONDI...
32
0
import os import zipfile import pytest from datasets.utils.extract import ( BzipaExtractor, Extractor, GzipExtractor, LzaExtractor, SevenZipExtractor, TarExtractor, XzExtractor, ZipExtractor, ZstdExtractor, ) from .utils import require_lza, require_pyazr, require_zstandard ...
35
from collections import OrderedDict from ...utils import logging from .auto_factory import _BaseAutoModelClass, _LazyAutoMapping, auto_class_update from .configuration_auto import CONFIG_MAPPING_NAMES UpperCAmelCase_ = logging.get_logger(__name__) UpperCAmelCase_ = OrderedDict( [ ...
32
0
import fire from transformers import AutoConfig, AutoModelForSeqaSeqLM, AutoTokenizer def lowercase ( __A : str , __A : str , **__A : Optional[int] ) -> Optional[Any]: '''simple docstring''' snake_case : int = AutoConfig.from_pretrained(__A , ...
36
import baseaa def A__ ( SCREAMING_SNAKE_CASE_ : str ) -> bytes: """simple docstring""" return baseaa.baaencode(string.encode('''utf-8''' ) ) def A__ ( SCREAMING_SNAKE_CASE_ : bytes ) -> str: """simple docstring""" ...
32
0
import gc import threading import time import psutil import torch class A__ : """simple docstring""" def __init__( self : int ): a__ : Optional[int] = psutil.Process() a__ : Union[str, Any] = False def _UpperCamelCase( self : Any ): a__ ...
37
from typing import Dict, List, Optional, Union import numpy as np from ...image_processing_utils import BaseImageProcessor, BatchFeature, get_size_dict from ...image_transforms import ( center_crop, get_resize_output_image_size, normalize, rescale, resize, to_channel_dimension_format, ) ...
32
0
'''simple docstring''' from typing import Callable, Optional from .. import Features from ..packaged_modules.generator.generator import Generator from .abc import AbstractDatasetInputStream class __snake_case ( __SCREAMING_SNAKE_CASE ): '''simple docstring''' def __init__( ...
38
from ..utils import DummyObject, requires_backends class __UpperCamelCase ( metaclass=A__ ): __A : str = ["""torch""", """scipy"""] def __init__( self , *_UpperCamelCase , **_UpperCamelCase ): requires_backends(self , ['''torc...
32
0
from typing import TYPE_CHECKING from ...utils import ( OptionalDependencyNotAvailable, _LazyModule, is_tf_available, is_tokenizers_available, is_torch_available, ) lowerCAmelCase_ = { '''configuration_longformer''': [ '''LONGFORMER_PRETRAINED_CONFIG_ARCH...
39
def A__ ( SCREAMING_SNAKE_CASE_ : int = 2_00_00_00 ) -> int: """simple docstring""" _UpperCAmelCase = [0 for i in range(n + 1 )] _UpperCAmelCase = 1 _UpperCAmelCase = 1 for i in range(2 , int(n**0.5 ) + 1 ...
32
0
def UpperCamelCase ( snake_case__ : list[list[int | float]] ) -> int: UpperCamelCase : Tuple = len(snake_case__ ) UpperCamelCase : Tuple = len(matrix[0] ) UpperCamelCase : Tuple = min(snake_case__ , sna...
40
import warnings from ...utils import logging from .image_processing_glpn import GLPNImageProcessor UpperCAmelCase_ = logging.get_logger(__name__) class __UpperCamelCase ( A__ ): def __init__( self , *_UpperCamelCase , **_UpperCamelCase ): ...
32
0
'''simple docstring''' from __future__ import annotations def _A ( A__ , A__ , A__ ): """simple docstring""" __lowercase = list(range(len(A__ ) ) ) __lowercase = [v / w for v, w in zip(A__ , A__ )] index.sort(key=lambda A__ : ratio[i] , re...
41
from typing import List, Optional, Union from ...processing_utils import ProcessorMixin from ...tokenization_utils_base import BatchEncoding, PaddingStrategy, PreTokenizedInput, TextInput, TruncationStrategy from ...utils import TensorType class __UpperCamelCase ( A__ ): __A : Dict ...
32
0
'''simple docstring''' def _UpperCamelCase ( __UpperCamelCase ) -> int: assert column_title.isupper() lowerCamelCase_ = 0 lowerCamelCase_ = len(__UpperCamelCase ) - 1 lowerCamelCase_ = 0 while index >= 0: lowerCamelCase_ = (or...
42
from typing import TYPE_CHECKING from ...utils import OptionalDependencyNotAvailable, _LazyModule, is_tf_available, is_torch_available UpperCAmelCase_ = { "configuration_xlm": ["XLM_PRETRAINED_CONFIG_ARCHIVE_MAP", "XLMConfig", "XLMOnnxConfig"], "tokenization_xlm": ["XLMTokenizer"], } try: ...
32
0
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 _a ( UpperCamelCase__ ): def __init__( self: int , U...
43
from ...configuration_utils import PretrainedConfig from ...utils import logging UpperCAmelCase_ = logging.get_logger(__name__) UpperCAmelCase_ = { "microsoft/biogpt": "https://huggingface.co/microsoft/biogpt/resolve/main/config.json", # See all BioGPT models at https://huggingface....
32
0
'''simple docstring''' from collections import OrderedDict from typing import Mapping from ...configuration_utils import PretrainedConfig from ...onnx import OnnxConfig from ...utils import logging UpperCAmelCase_ : Union[str, Any] = logging.get_logger(__name__) UpperCAmelCase_ : Any = ...
44
from typing import List from .keymap import KEYMAP, get_character def A__ ( SCREAMING_SNAKE_CASE_ : str ) -> List[str]: """simple docstring""" def decorator(SCREAMING_SNAKE_CASE_ : List[Any] ): _UpperCAmelCase = getattr(SCREAMING_SNAKE_...
32
0
import inspect import unittest import warnings from math import ceil, floor from transformers import LevitConfig from transformers.file_utils import cached_property, is_torch_available, is_vision_available from transformers.models.auto import get_values from transformers.testing_utils import require_torch, requ...
45
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 import ModelTesterMixin, ...
32
0
"""simple docstring""" from dataclasses import asdict, dataclass from typing import Optional from ...configuration_utils import PretrainedConfig from ...utils import logging _lowerCAmelCase : Union[str, Any] = logging.get_logger(__name__) # TODO Update this _lowerCAmelCase : Option...
46
from ...configuration_utils import PretrainedConfig from ...utils import logging UpperCAmelCase_ = logging.get_logger(__name__) UpperCAmelCase_ = { "RWKV/rwkv-4-169m-pile": "https://huggingface.co/RWKV/rwkv-4-169m-pile/resolve/main/config.json", "RWKV/rwkv-4-430m-pile": "https://hug...
32
0
import copy import os from collections import OrderedDict from typing import TYPE_CHECKING, Any, Dict, Mapping, Optional, Union if TYPE_CHECKING: from ...processing_utils import ProcessorMixin from ...utils import TensorType from ...configuration_utils import PretrainedConfig f...
47
def A__ ( SCREAMING_SNAKE_CASE_ : int , SCREAMING_SNAKE_CASE_ : int ) -> str: """simple docstring""" if a < 0 or b < 0: raise ValueError('''the value of both inputs must be positive''' ) _UpperCAmelCase = str(bin(SCREAMING_SNAKE_C...
32
0
'''simple docstring''' import os import pytest import yaml from datasets.features.features import Features, Value from datasets.info import DatasetInfo, DatasetInfosDict @pytest.mark.parametrize( "files" , [ ["full:README.md", "dataset_infos.json"], ["empty:README.md", "dataset_in...
48
from ...configuration_utils import PretrainedConfig from ...utils import logging UpperCAmelCase_ = logging.get_logger(__name__) UpperCAmelCase_ = { "tiiuae/falcon-40b": "https://huggingface.co/tiiuae/falcon-40b/resolve/main/config.json", "tiiuae/falcon-7b": "https://huggingface.co/t...
32
0
"""simple docstring""" import argparse import math import traceback import dateutil.parser as date_parser import requests def lowercase__ ( snake_case_ :Dict ): __UpperCAmelCase = {} __UpperCAmelCase = job['''started_at'''] __UpperCAmelCase ...
49
from math import sqrt def A__ ( SCREAMING_SNAKE_CASE_ : int ) -> bool: """simple docstring""" 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 mult...
32
0
'''simple docstring''' import collections import tempfile import unittest import numpy as np from transformers.testing_utils import ( is_pt_flax_cross_test, require_flax, require_torch, require_vision, slow, torch_device, ) from transformers.utils import is_flax_available, is_tor...
50
def A__ ( SCREAMING_SNAKE_CASE_ : int ) -> bool: """simple docstring""" if not isinstance(SCREAMING_SNAKE_CASE_ , SCREAMING_SNAKE_CASE_ ): _UpperCAmelCase = F'''Input value of [number={number}] must be an integer''' raise TypeError(SCR...
32
0
'''simple docstring''' from __future__ import annotations import requests def __snake_case ( SCREAMING_SNAKE_CASE_ : str ) -> dict: """simple docstring""" UpperCAmelCase = f"https://hacker-news.firebaseio.com/v0/item/{story_id}.json?print=pretty" return requests...
51
from dataclasses import dataclass, field from typing import ClassVar, Dict from ..features import Features, Value from .base import TaskTemplate @dataclass(frozen=A__ ) class __UpperCamelCase ( A__ ): __A : str = field(default="""language-modeling""" , metadata={"""include_i...
32
0
"""simple docstring""" 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 Trans...
52
import os import re import warnings from shutil import copyfile from typing import TYPE_CHECKING, Any, Dict, List, Optional, Tuple import sentencepiece as spm from ...tokenization_utils import PreTrainedTokenizer if TYPE_CHECKING: from ...tokenization_utils_base import TextInput from ...utils import loggin...
32
0
from __future__ import annotations import requests _snake_case : Any = set( 'approved_at_utc approved_by author_flair_background_color\nauthor_flair_css_class author_flair_richtext author_flair_template_id author_fullname\nauthor_premium can_mod_post category clicked content_categories c...
53
from __future__ import annotations def A__ ( SCREAMING_SNAKE_CASE_ : int ) -> bool: """simple docstring""" _UpperCAmelCase = str(SCREAMING_SNAKE_CASE_ ) return len(SCREAMING_SNAKE_CASE_ ) == 9 and set(SCREAMING_SNAKE_CASE_ ) == set('''12...
32
0
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, load_i...
54
import numpy as np def A__ ( SCREAMING_SNAKE_CASE_ : np.ndarray , SCREAMING_SNAKE_CASE_ : float ) -> np.ndarray: """simple docstring""" return np.where(vector > 0 , SCREAMING_SNAKE_CASE_ , (alpha * (np.exp(SCREAMING_SNAKE_CASE_ ) - 1)) ) i...
32
0
import subprocess import sys from transformers import BertConfig, BertModel, BertTokenizer, pipeline from transformers.testing_utils import TestCasePlus, require_torch class UpperCAmelCase ( __SCREAMING_SNAKE_CASE ): '''simple docstring''' @require_torch def UpperCamelCase_ ( se...
55
UpperCAmelCase_ = { "A": ".-", "B": "-...", "C": "-.-.", "D": "-..", "E": ".", "F": "..-.", "G": "--.", "H": "....", "I": "..", "J": ".---", "K": "-.-", "L": ".-..", "M": "--", "N": "-.", "O": "---", "P": ".--.", "Q": "--.-", "R": ".-.", "S": "...", "T": "-", "U": "..-", "V": "...-", "W"...
32
0
'''simple docstring''' from diffusers.utils.testing_utils import require_onnxruntime @require_onnxruntime class _lowercase : pass
56
import gc import unittest import numpy as np import torch from diffusers import DanceDiffusionPipeline, IPNDMScheduler, UNetaDModel from diffusers.utils import slow, torch_device from diffusers.utils.testing_utils import enable_full_determinism, require_torch_gpu, skip_mps from ..pipeline_params import UNCONDI...
32
0
class _lowerCAmelCase: """simple docstring""" def __init__( self , _lowerCamelCase , _lowerCamelCase , _lowerCamelCase ): UpperCamelCase_: Any = name UpperCamelCase_: Any = value ...
57
from collections import OrderedDict from ...utils import logging from .auto_factory import _BaseAutoModelClass, _LazyAutoMapping, auto_class_update from .configuration_auto import CONFIG_MAPPING_NAMES UpperCAmelCase_ = logging.get_logger(__name__) UpperCAmelCase_ = OrderedDict( [ ...
32
0
"""simple docstring""" from collections import OrderedDict from typing import Mapping from ...configuration_utils import PretrainedConfig from ...onnx import OnnxConfig from ...utils import logging __lowerCAmelCase : List[Any] = logging.get_logger(__name__) __...
58
import baseaa def A__ ( SCREAMING_SNAKE_CASE_ : str ) -> bytes: """simple docstring""" return baseaa.baaencode(string.encode('''utf-8''' ) ) def A__ ( SCREAMING_SNAKE_CASE_ : bytes ) -> str: """simple docstring""" ...
32
0
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 = { "YituTech/conv-bert-base": "https://huggingface.co/YituTec...
59
from typing import Dict, List, Optional, Union import numpy as np from ...image_processing_utils import BaseImageProcessor, BatchFeature, get_size_dict from ...image_transforms import ( center_crop, get_resize_output_image_size, normalize, rescale, resize, to_channel_dimension_format, ) ...
32
0
def lowerCamelCase_ ( _UpperCamelCase ) -> list[int]: """simple docstring""" snake_case_ : Optional[int] = [0 for i in range(len(_UpperCamelCase ) )] # initialize interval's left pointer and right pointer snake_case_ , snake_case_ : ...
60
from ..utils import DummyObject, requires_backends class __UpperCamelCase ( metaclass=A__ ): __A : str = ["""torch""", """scipy"""] def __init__( self , *_UpperCamelCase , **_UpperCamelCase ): requires_backends(self , ['''torc...
32
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 if is_torch_available(): import torch ...
61
def A__ ( SCREAMING_SNAKE_CASE_ : int = 2_00_00_00 ) -> int: """simple docstring""" _UpperCAmelCase = [0 for i in range(n + 1 )] _UpperCAmelCase = 1 _UpperCAmelCase = 1 for i in range(2 , int(n**0.5 ) + 1 ...
32
0
def lowerCamelCase__ ( lowercase , lowercase ): """simple docstring""" SCREAMING_SNAKE_CASE : List[str] = len(lowercase ) print("The following activities are selected:" ) # The first activity is always selected SCREAMING_SNAKE_CASE : Optional[...
62
import warnings from ...utils import logging from .image_processing_glpn import GLPNImageProcessor UpperCAmelCase_ = logging.get_logger(__name__) class __UpperCamelCase ( A__ ): def __init__( self , *_UpperCamelCase , **_UpperCamelCase ): ...
32
0
def lowerCamelCase__ ( __lowerCamelCase : List[Any] , __lowerCamelCase : Union[str, Any] ): __UpperCAmelCase : Tuple = 0 while b > 0: if b & 1: res += a a += a b >>= 1 return res def lowerCamelCase__ ( ...
63
from typing import List, Optional, Union from ...processing_utils import ProcessorMixin from ...tokenization_utils_base import BatchEncoding, PaddingStrategy, PreTokenizedInput, TextInput, TruncationStrategy from ...utils import TensorType class __UpperCamelCase ( A__ ): __A : Dict ...
32
0
from typing import TYPE_CHECKING from ...utils import OptionalDependencyNotAvailable, _LazyModule, is_torch_available, is_vision_available lowercase_ : Optional[int] = {'configuration_glpn': ['GLPN_PRETRAINED_CONFIG_ARCHIVE_MAP', 'GLPNConfig']} try: if not is_vision_available(): raise ...
64
from typing import TYPE_CHECKING from ...utils import OptionalDependencyNotAvailable, _LazyModule, is_tf_available, is_torch_available UpperCAmelCase_ = { "configuration_xlm": ["XLM_PRETRAINED_CONFIG_ARCHIVE_MAP", "XLMConfig", "XLMOnnxConfig"], "tokenization_xlm": ["XLMTokenizer"], } try: ...
32
0
"""simple docstring""" import argparse from collections import defaultdict import yaml __UpperCAmelCase = 'docs/source/en/_toctree.yml' def lowerCAmelCase ( __UpperCamelCase ): '''simple docstring''' UpperCAmelCase__ : List[str] = defaultdict(__U...
65
from ...configuration_utils import PretrainedConfig from ...utils import logging UpperCAmelCase_ = logging.get_logger(__name__) UpperCAmelCase_ = { "microsoft/biogpt": "https://huggingface.co/microsoft/biogpt/resolve/main/config.json", # See all BioGPT models at https://huggingface....
32
0
import sys UpperCamelCase = ( "73167176531330624919225119674426574742355349194934" "96983520312774506326239578318016984801869478851843" "85861560789112949495459501737958331952853208805511" "12540698747158523863050715693290963295227443043557" "66896648950445244523161731856403098711121...
66
from typing import List from .keymap import KEYMAP, get_character def A__ ( SCREAMING_SNAKE_CASE_ : str ) -> List[str]: """simple docstring""" def decorator(SCREAMING_SNAKE_CASE_ : List[Any] ): _UpperCAmelCase = getattr(SCREAMING_SNAKE_...
32
0
# 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...
67
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 import ModelTesterMixin, ...
32
0
from typing import TYPE_CHECKING from ...utils import OptionalDependencyNotAvailable, _LazyModule, is_tf_available, is_torch_available __A = { "configuration_tapas": ["TAPAS_PRETRAINED_CONFIG_ARCHIVE_MAP", "TapasConfig"], "tokenization_tapas": ["TapasTokenizer"], } try: if not is_torch_availab...
68
from ...configuration_utils import PretrainedConfig from ...utils import logging UpperCAmelCase_ = logging.get_logger(__name__) UpperCAmelCase_ = { "RWKV/rwkv-4-169m-pile": "https://huggingface.co/RWKV/rwkv-4-169m-pile/resolve/main/config.json", "RWKV/rwkv-4-430m-pile": "https://hug...
32
0
'''simple docstring''' import mpmath # for roots of unity import numpy as np class SCREAMING_SNAKE_CASE__ : def __init__( self : Tuple , a_ : Optional[int]=None , a_ : int=None ): """simple docstring""" __s...
69
def A__ ( SCREAMING_SNAKE_CASE_ : int , SCREAMING_SNAKE_CASE_ : int ) -> str: """simple docstring""" if a < 0 or b < 0: raise ValueError('''the value of both inputs must be positive''' ) _UpperCAmelCase = str(bin(SCREAMING_SNAKE_C...
32
0
from __future__ import annotations import matplotlib.pyplot as plt # type: ignore import numpy # initial triangle of Koch snowflake lowerCamelCase : Optional[Any] = numpy.array([0, 0]) lowerCamelCase : Optional[int] = numpy.array([0.5, 0.866_0254]) lowe...
70
from ...configuration_utils import PretrainedConfig from ...utils import logging UpperCAmelCase_ = logging.get_logger(__name__) UpperCAmelCase_ = { "tiiuae/falcon-40b": "https://huggingface.co/tiiuae/falcon-40b/resolve/main/config.json", "tiiuae/falcon-7b": "https://huggingface.co/t...
32
0
'''simple docstring''' from __future__ import annotations from collections.abc import Callable def a__ ( _SCREAMING_SNAKE_CASE : Callable[[int | float], int | float] , _SCREAMING_SNAKE_CASE : int | float , _SCREAMING_SNAKE_CASE : int | float , _SCREAMING_SNAKE_CAS...
71
from math import sqrt def A__ ( SCREAMING_SNAKE_CASE_ : int ) -> bool: """simple docstring""" 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 mult...
32
0
'''simple docstring''' import os from typing import List, Optional, Union from ...image_processing_utils import BatchFeature from ...image_utils import ImageInput from ...processing_utils import ProcessorMixin from ...tokenization_utils_base import PaddingStrategy, PreTokenizedInput, TextInput, TruncationStrategy fr...
72
def A__ ( SCREAMING_SNAKE_CASE_ : int ) -> bool: """simple docstring""" if not isinstance(SCREAMING_SNAKE_CASE_ , SCREAMING_SNAKE_CASE_ ): _UpperCAmelCase = F'''Input value of [number={number}] must be an integer''' raise TypeError(SCR...
32
0
import functools import operator from ...configuration_utils import PretrainedConfig from ...utils import logging a_ : Tuple = logging.get_logger(__name__) a_ : Optional[int] = { 'facebook/wav2vec2-base-960h': 'https://huggingface.co/facebook/wav2vec2-base-960h/resolve/m...
73
from dataclasses import dataclass, field from typing import ClassVar, Dict from ..features import Features, Value from .base import TaskTemplate @dataclass(frozen=A__ ) class __UpperCamelCase ( A__ ): __A : str = field(default="""language-modeling""" , metadata={"""include_i...
32
0
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 lowercase_ = logging.get_logger(__name__) def a__ ( snake_case , snake_case ): """simple docstri...
74
import os import re import warnings from shutil import copyfile from typing import TYPE_CHECKING, Any, Dict, List, Optional, Tuple import sentencepiece as spm from ...tokenization_utils import PreTrainedTokenizer if TYPE_CHECKING: from ...tokenization_utils_base import TextInput from ...utils import loggin...
32
0
'''simple docstring''' from typing import Callable, List, Optional, Union import PIL import torch from transformers import ( CLIPImageProcessor, CLIPSegForImageSegmentation, CLIPSegProcessor, CLIPTextModel, CLIPTokenizer, ) from diffusers import DiffusionPipeline from diffusers...
75
from __future__ import annotations def A__ ( SCREAMING_SNAKE_CASE_ : int ) -> bool: """simple docstring""" _UpperCAmelCase = str(SCREAMING_SNAKE_CASE_ ) return len(SCREAMING_SNAKE_CASE_ ) == 9 and set(SCREAMING_SNAKE_CASE_ ) == set('''12...
32
0
"""simple docstring""" import numpy as np import torch import tqdm from ...models.unet_ad import UNetaDModel from ...pipelines import DiffusionPipeline from ...utils import randn_tensor from ...utils.dummy_pt_objects import DDPMScheduler class UpperCAmelCase_ ( snake_case ): def...
76
import numpy as np def A__ ( SCREAMING_SNAKE_CASE_ : np.ndarray , SCREAMING_SNAKE_CASE_ : float ) -> np.ndarray: """simple docstring""" return np.where(vector > 0 , SCREAMING_SNAKE_CASE_ , (alpha * (np.exp(SCREAMING_SNAKE_CASE_ ) - 1)) ) i...
32
0
"""simple docstring""" A = """Input must be a string of 8 numbers plus letter""" A = """TRWAGMYFPDXBNJZSQVHLCKE""" def _UpperCamelCase ( UpperCamelCase ) -> bool: """simple docstring""" if not isinstance(UpperCamelCase , UpperCamelCase ): ...
77
UpperCAmelCase_ = { "A": ".-", "B": "-...", "C": "-.-.", "D": "-..", "E": ".", "F": "..-.", "G": "--.", "H": "....", "I": "..", "J": ".---", "K": "-.-", "L": ".-..", "M": "--", "N": "-.", "O": "---", "P": ".--.", "Q": "--.-", "R": ".-.", "S": "...", "T": "-", "U": "..-", "V": "...-", "W"...
32
0
'''simple docstring''' from collections import OrderedDict from typing import Any, Mapping, Optional, Union from ...configuration_utils import PretrainedConfig from ...feature_extraction_utils import FeatureExtractionMixin from ...onnx import OnnxConfig from ...onnx.utils import compute_effective_axis_dimension f...
78
import gc import unittest import numpy as np import torch from diffusers import DanceDiffusionPipeline, IPNDMScheduler, UNetaDModel from diffusers.utils import slow, torch_device from diffusers.utils.testing_utils import enable_full_determinism, require_torch_gpu, skip_mps from ..pipeline_params import UNCONDI...
32
0
SCREAMING_SNAKE_CASE__ : Dict = 6_55_21 def _lowerCamelCase ( __lowerCamelCase ) -> int: '''simple docstring''' UpperCAmelCase__ : str = 1 UpperCAmelCase__ : Tuple = 0 for plain_chr in plain_text: ...
79
from collections import OrderedDict from ...utils import logging from .auto_factory import _BaseAutoModelClass, _LazyAutoMapping, auto_class_update from .configuration_auto import CONFIG_MAPPING_NAMES UpperCAmelCase_ = logging.get_logger(__name__) UpperCAmelCase_ = OrderedDict( [ ...
32
0
def snake_case ( lowerCamelCase , lowerCamelCase ): '''simple docstring''' __lowercase = len(lowerCamelCase ) + 1 __lowercase = len(lowerCamelCase ) + 1 # dp is a 2d matrix where dp[i][j] denotes whether prefix string of # length i of input_string ma...
80
import baseaa def A__ ( SCREAMING_SNAKE_CASE_ : str ) -> bytes: """simple docstring""" return baseaa.baaencode(string.encode('''utf-8''' ) ) def A__ ( SCREAMING_SNAKE_CASE_ : bytes ) -> str: """simple docstring""" ...
32
0
import torch from diffusers import DDIMParallelScheduler from .test_schedulers import SchedulerCommonTest class a (_lowerCAmelCase ): """simple docstring""" __UpperCAmelCase : List[str] = (DDIMParallelScheduler,) __UpperCAmelCase : Tuple = (("...
81
from typing import Dict, List, Optional, Union import numpy as np from ...image_processing_utils import BaseImageProcessor, BatchFeature, get_size_dict from ...image_transforms import ( center_crop, get_resize_output_image_size, normalize, rescale, resize, to_channel_dimension_format, ) ...
32
0
"""simple docstring""" import os from shutil import copyfile from typing import List, Optional, Tuple from ...tokenization_utils_fast import PreTrainedTokenizerFast from ...utils import is_sentencepiece_available, logging if is_sentencepiece_available(): from .tokenization_pegasus impor...
82
from ..utils import DummyObject, requires_backends class __UpperCamelCase ( metaclass=A__ ): __A : str = ["""torch""", """scipy"""] def __init__( self , *_UpperCamelCase , **_UpperCamelCase ): requires_backends(self , ['''torc...
32
0
"""simple docstring""" import argparse import json from collections import OrderedDict from functools import partial from pathlib import Path import timm import torch from huggingface_hub import hf_hub_download from transformers import LevitConfig, LevitForImageClassificationWithTeacher, LevitImageProcessor...
83
def A__ ( SCREAMING_SNAKE_CASE_ : int = 2_00_00_00 ) -> int: """simple docstring""" _UpperCAmelCase = [0 for i in range(n + 1 )] _UpperCAmelCase = 1 _UpperCAmelCase = 1 for i in range(2 , int(n**0.5 ) + 1 ...
32
0
import warnings from typing import Dict, List, Optional, Tuple from ...tokenization_utils import AddedToken, PreTrainedTokenizer from ...utils import logging UpperCAmelCase = logging.get_logger(__name__) class A_ ( __lowerCamelCase ): '''simple docstring''' _UpperCamelCase : List[A...
84
import warnings from ...utils import logging from .image_processing_glpn import GLPNImageProcessor UpperCAmelCase_ = logging.get_logger(__name__) class __UpperCamelCase ( A__ ): def __init__( self , *_UpperCamelCase , **_UpperCamelCase ): ...
32
0
import json import unittest import numpy as np from huggingface_hub import hf_hub_download from transformers.testing_utils import require_torch, require_vision from transformers.utils import is_torch_available, is_vision_available from ...test_image_processing_common import ImageProcessingSavingTestMixin, prepare_im...
85
from typing import List, Optional, Union from ...processing_utils import ProcessorMixin from ...tokenization_utils_base import BatchEncoding, PaddingStrategy, PreTokenizedInput, TextInput, TruncationStrategy from ...utils import TensorType class __UpperCamelCase ( A__ ): __A : Dict ...
32
0
from __future__ import annotations def __snake_case ( __UpperCamelCase : str ): """simple docstring""" return [ord(__UpperCamelCase ) - 96 for elem in plain] def __snake_case ( __UpperCamelCase : list[int] ): """simple docstring""" ret...
86
from typing import TYPE_CHECKING from ...utils import OptionalDependencyNotAvailable, _LazyModule, is_tf_available, is_torch_available UpperCAmelCase_ = { "configuration_xlm": ["XLM_PRETRAINED_CONFIG_ARCHIVE_MAP", "XLMConfig", "XLMOnnxConfig"], "tokenization_xlm": ["XLMTokenizer"], } try: ...
32
0
import math from collections.abc import Iterator from itertools import takewhile def SCREAMING_SNAKE_CASE ( lowercase_ ) -> bool: """simple docstring""" if 1 < number < 4: # 2 and 3 are primes return True elif number < 2 or number % 2 == 0 or ...
87
from ...configuration_utils import PretrainedConfig from ...utils import logging UpperCAmelCase_ = logging.get_logger(__name__) UpperCAmelCase_ = { "microsoft/biogpt": "https://huggingface.co/microsoft/biogpt/resolve/main/config.json", # See all BioGPT models at https://huggingface....
32
0
"""simple docstring""" import unittest from transformers import AutoTokenizer, NystromformerConfig, is_torch_available from transformers.testing_utils import require_torch, slow, torch_device from ...test_configuration_common import ConfigTester from ...test_modeling_common import ModelTesterMixin, ids_t...
88
from typing import List from .keymap import KEYMAP, get_character def A__ ( SCREAMING_SNAKE_CASE_ : str ) -> List[str]: """simple docstring""" def decorator(SCREAMING_SNAKE_CASE_ : List[Any] ): _UpperCAmelCase = getattr(SCREAMING_SNAKE_...
32
0
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, prepare_image_inputs if is_torch_available(): impo...
89
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 import ModelTesterMixin, ...
32
0
'''simple docstring''' from typing import TYPE_CHECKING from ...utils import ( OptionalDependencyNotAvailable, _LazyModule, is_sentencepiece_available, is_tf_available, is_tokenizers_available, is_torch_available, ) __UpperCAmelCase = {'''configu...
90
from ...configuration_utils import PretrainedConfig from ...utils import logging UpperCAmelCase_ = logging.get_logger(__name__) UpperCAmelCase_ = { "RWKV/rwkv-4-169m-pile": "https://huggingface.co/RWKV/rwkv-4-169m-pile/resolve/main/config.json", "RWKV/rwkv-4-430m-pile": "https://hug...
32
0
"""simple docstring""" import unittest from transformers import is_torch_available from transformers.testing_utils import require_sentencepiece, require_tokenizers, require_torch, slow if is_torch_available(): import torch from transformers import XLMRobertaModel @require_sentencepiece @require_tokeni...
91
def A__ ( SCREAMING_SNAKE_CASE_ : int , SCREAMING_SNAKE_CASE_ : int ) -> str: """simple docstring""" if a < 0 or b < 0: raise ValueError('''the value of both inputs must be positive''' ) _UpperCAmelCase = str(bin(SCREAMING_SNAKE_C...
32
0
'''simple docstring''' import os try: from .build_directory_md import good_file_paths except ImportError: from build_directory_md import good_file_paths # type: ignore UpperCamelCase_ = list(good_file_paths()) assert filepaths, "good_file_paths() failed!" UpperCamelCase_ ...
92
from ...configuration_utils import PretrainedConfig from ...utils import logging UpperCAmelCase_ = logging.get_logger(__name__) UpperCAmelCase_ = { "tiiuae/falcon-40b": "https://huggingface.co/tiiuae/falcon-40b/resolve/main/config.json", "tiiuae/falcon-7b": "https://huggingface.co/t...
32
0
"""simple docstring""" import os import re import shutil import sys import tempfile import unittest import black __A = os.path.abspath(os.path.dirname(os.path.dirname(os.path.dirname(__file__)))) sys.path.append(os.path.join(git_repo_path, """utils""")) import check_copies # noqa: E402 ...
93
from math import sqrt def A__ ( SCREAMING_SNAKE_CASE_ : int ) -> bool: """simple docstring""" 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 mult...
32
0
'''simple docstring''' import argparse import collections import os import re from transformers.utils import direct_transformers_import # All paths are set with the intent you should run this script from the root of the repo with the command # python utils/check_table.py SCREAMING_SNAKE_CASE = '...
94
def A__ ( SCREAMING_SNAKE_CASE_ : int ) -> bool: """simple docstring""" if not isinstance(SCREAMING_SNAKE_CASE_ , SCREAMING_SNAKE_CASE_ ): _UpperCAmelCase = F'''Input value of [number={number}] must be an integer''' raise TypeError(SCR...
32
0
"""simple docstring""" import os from typing import Optional import fsspec from fsspec.archive import AbstractArchiveFileSystem from fsspec.utils import DEFAULT_BLOCK_SIZE class UpperCamelCase_ (__A ): __magic_name__ = '''''' __magic_name__ = ( None # protocol passe...
95
from dataclasses import dataclass, field from typing import ClassVar, Dict from ..features import Features, Value from .base import TaskTemplate @dataclass(frozen=A__ ) class __UpperCamelCase ( A__ ): __A : str = field(default="""language-modeling""" , metadata={"""include_i...
32
0
"""simple docstring""" from typing import Dict, List, Optional, Union import numpy as np from ...image_processing_utils import BaseImageProcessor, BatchFeature, get_size_dict from ...image_transforms import ( center_crop, get_resize_output_image_size, normalize, resca...
96
import os import re import warnings from shutil import copyfile from typing import TYPE_CHECKING, Any, Dict, List, Optional, Tuple import sentencepiece as spm from ...tokenization_utils import PreTrainedTokenizer if TYPE_CHECKING: from ...tokenization_utils_base import TextInput from ...utils import loggin...
32
0
def a ( snake_case__: int ): '''simple docstring''' if not isinstance(snake_case__ , snake_case__ ): raise ValueError('''multiplicative_persistence() only accepts integral values''' ) if num < 0: raise ValueError('''multiplicative_persistence() does not acce...
97
from __future__ import annotations def A__ ( SCREAMING_SNAKE_CASE_ : int ) -> bool: """simple docstring""" _UpperCAmelCase = str(SCREAMING_SNAKE_CASE_ ) return len(SCREAMING_SNAKE_CASE_ ) == 9 and set(SCREAMING_SNAKE_CASE_ ) == set('''12...
32
0
'''simple docstring''' import tempfile import unittest import numpy as np from diffusers import ( DDIMScheduler, DPMSolverMultistepScheduler, EulerAncestralDiscreteScheduler, EulerDiscreteScheduler, LMSDiscreteScheduler, OnnxStableDiffusionPipeline, PNDMScheduler, ) from diffusers.u...
98
import numpy as np def A__ ( SCREAMING_SNAKE_CASE_ : np.ndarray , SCREAMING_SNAKE_CASE_ : float ) -> np.ndarray: """simple docstring""" return np.where(vector > 0 , SCREAMING_SNAKE_CASE_ , (alpha * (np.exp(SCREAMING_SNAKE_CASE_ ) - 1)) ) i...
32
0
def a (lowerCAmelCase__ ): if not numbers: return 0 if not isinstance(lowerCAmelCase__ , (list, tuple) ) or not all( isinstance(lowerCAmelCase__ , lowerCAmelCase__ ) for number in numbers ): raise ValueError("""numbers must be an iterable of integers""" ) ...
99
UpperCAmelCase_ = { "A": ".-", "B": "-...", "C": "-.-.", "D": "-..", "E": ".", "F": "..-.", "G": "--.", "H": "....", "I": "..", "J": ".---", "K": "-.-", "L": ".-..", "M": "--", "N": "-.", "O": "---", "P": ".--.", "Q": "--.-", "R": ".-.", "S": "...", "T": "-", "U": "..-", "V": "...-", "W"...
32
0
def __snake_case ( lowerCAmelCase_ ) -> int: SCREAMING_SNAKE_CASE__ = 0 while num > 0: digit_sum += num % 1_0 num //= 1_0 return digit_sum def __snake_case ( lowerCAmelCase_ = 1_0_0 ) -> int: SCREAMING_SNAKE_CASE__ ...
100
import gc import unittest import numpy as np import torch from diffusers import DanceDiffusionPipeline, IPNDMScheduler, UNetaDModel from diffusers.utils import slow, torch_device from diffusers.utils.testing_utils import enable_full_determinism, require_torch_gpu, skip_mps from ..pipeline_params import UNCONDI...
32
0