code
stringlengths
86
54.5k
code_codestyle
int64
0
371
style_context
stringlengths
87
49.2k
style_context_codestyle
int64
0
349
label
int64
0
1
"""simple docstring""" def lowercase ( a__ : int , a__ : int ) -> str: if b == 0: return 1 if (b % 2) == 0: return actual_power(a__ , int(b / 2 ) ) * actual_power(a__ , int(b / 2 ) ) else: return a * actual_power(a__ , int(b / 2 ...
256
"""simple docstring""" from typing import List import numpy as np def lowercase ( a__ : dict ) -> int: _UpperCamelCase = {key: len(a__ ) for key, value in gen_kwargs.items() if isinstance(a__ , a__ )} if len(set(lists_lengths.values() ) ) > 1: ...
256
1
"""simple docstring""" from ...configuration_utils import PretrainedConfig from ...utils import logging a = logging.get_logger(__name__) a = { "abeja/gpt-neox-japanese-2.7b": "https://huggingface.co/abeja/gpt-neox-japanese-2.7b/resolve/main/config.json", } class __a (__SCREAMING_SNAKE...
350
"""simple docstring""" def _lowercase ( __lowerCAmelCase ) -> bool: if number < 0: raise ValueError("""number must not be negative""" ) return number & (number - 1) == 0 if __name__ == "__main__": import doctest doctest.testmod()
56
0
import math from datetime import datetime, timedelta def __a ( SCREAMING_SNAKE_CASE ) -> datetime: '''simple docstring''' __UpperCAmelCase = year % 1_9 __UpperCAmelCase = year % 4 __UpperCAmelCase = year % 7 __UpperCAmelCase = math.fl...
333
from typing import TYPE_CHECKING from ...utils import OptionalDependencyNotAvailable, _LazyModule, is_torch_available, is_vision_available A_ : Optional[int] = { 'configuration_poolformer': [ 'POOLFORMER_PRETRAINED_CONFIG_ARCHIVE_MAP', 'PoolFormerConfig', 'PoolFor...
333
1
'''simple docstring''' # Lint as: python3 import itertools import os import re __lowerCAmelCase = re.compile(r'([A-Z]+)([A-Z][a-z])') __lowerCAmelCase = re.compile(r'([a-z\d])([A-Z])') __lowerCAmelCase = re.compile(r'(?<!_)_(?!_)') __lowerCAmelCase = re.compile(r'(_{2,})'...
270
'''simple docstring''' from urllib.parse import quote import pytest from datasets.utils.hub import hf_hub_url @pytest.mark.parametrize("""repo_id""" , ["""canonical_dataset_name""", """org-name/dataset-name"""] ) @pytest.mark.parametrize("""path""" , ["""filename.csv""", """filename with blanks....
270
1
"""simple docstring""" import argparse import os from pathlib import Path from typing import Dict import tensorflow as tf import torch from tqdm import tqdm from transformers import PegasusConfig, PegasusForConditionalGeneration, PegasusTokenizer from transformers.models.pegasus.configuration_pegasus impor...
150
"""simple docstring""" # Logistic Regression from scratch # In[62]: # In[63]: # importing all the required libraries import numpy as np from matplotlib import pyplot as plt from sklearn import datasets def lowerCAmelCase__ ( _UpperCamelCase : Optional[int] ) -> Tuple: ...
150
1
"""simple docstring""" import unittest import numpy as np import requests 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, prepar...
371
import argparse import intel_extension_for_pytorch as ipex import torch from diffusers import DPMSolverMultistepScheduler, StableDiffusionPipeline a =argparse.ArgumentParser("""Stable Diffusion script with intel optimization""", add_help=False) parser.add_argument("""--dpm""", action="""store_true""",...
113
0
'''simple docstring''' import unittest from parameterized import parameterized from transformers import LlamaConfig, is_torch_available, set_seed from transformers.testing_utils import require_torch, slow, torch_device from ...generation.test_utils import GenerationTesterMixin from ...test_configuration_common im...
318
'''simple docstring''' 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 __lowercase ( tf.keras.layers.Layer ): def __init__(self , ...
318
1
import math def UpperCAmelCase ( _lowerCamelCase ): 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 return False # All...
256
import argparse import torch from diffusers.pipelines.stable_diffusion.convert_from_ckpt import download_from_original_stable_diffusion_ckpt if __name__ == "__main__": __SCREAMING_SNAKE_CASE = argparse.ArgumentParser() parser.add_argument( """--checkpoint_path...
256
1
from __future__ import annotations from decimal import Decimal from numpy import array def lowerCAmelCase_ ( __UpperCAmelCase: list[list[float]] ) -> list[list[float]]: UpperCamelCase__ : Any = Decimal # Check if the provided matrix has 2 r...
201
import re from pathlib import Path from unittest import TestCase import pytest @pytest.mark.integration class lowercase__ ( __lowerCamelCase ): '''simple docstring''' def UpperCamelCase__ ( self, __magic_name__ ) -> Union[str, Any]: ...
201
1
from typing import List from ...configuration_utils import PretrainedConfig from ...utils import logging __a = logging.get_logger(__name__) __a = { 'snap-research/efficientformer-l1-300': ( 'https://huggingface.co/snap-research/efficientformer-l1-300/resolve/main/config.json' ...
357
def lowerCamelCase__ ( _lowercase , _lowercase ): '''simple docstring''' return (pointa[0] - pointa[0]) ** 2 + (pointa[1] - pointa[1]) ** 2 def lowerCamelCase__ ( _lowercase , _lowercase=0 ): '''simple docstring''' return sorted(_lowercase ...
235
0
'''simple docstring''' from typing import Dict from .base import GenericTensor, Pipeline class lowercase ( _lowerCamelCase ): """simple docstring""" def _snake_case ( self ,a_=None ,a_=None ,a_=None ,**a_ ) -> Dict: if tokenize_kwargs is None: ...
215
'''simple docstring''' from torch import nn class lowercase ( nn.Module ): """simple docstring""" def __init__( self ,a_ ,a_ ) -> List[Any]: super().__init__() _UpperCAmelCase : Dict = class_size _UpperCAmelCase : Union[str,...
215
1
"""simple docstring""" import itertools import random import unittest import numpy as np from transformers import BatchFeature, SpeechTaFeatureExtractor from transformers.testing_utils import require_torch from transformers.utils.import_utils import is_torch_available from ...test_sequence_feature_extraction...
368
import argparse import json import os from pathlib import Path import requests import torch from transformers import JukeboxConfig, JukeboxModel from transformers.utils import logging logging.set_verbosity_info() __A = logging.get_logger(__name__) __A = '''https://openaipublic.azureedge....
277
0
'''simple docstring''' import unittest from transformers import MODEL_FOR_DOCUMENT_QUESTION_ANSWERING_MAPPING, AutoTokenizer, is_vision_available from transformers.pipelines import pipeline from transformers.pipelines.document_question_answering import apply_tesseract from transformers.te...
70
'''simple docstring''' import argparse import json from tqdm import tqdm def UpperCamelCase__ ( ): """simple docstring""" _lowerCAmelCase = argparse.ArgumentParser() # Required parameters parser.add_argument( ...
70
1
def lowerCAmelCase_ ( _snake_case : int ) -> int: '''simple docstring''' if not isinstance(_snake_case , _snake_case ): __magic_name__ : List[str] = F'''Input value of [number={number}] must be an integer''' raise TypeError(_snake_case ) if nu...
41
from typing import Any class _snake_case : def __init__( self , _a ): __magic_name__ : Union[str, Any] = data __magic_name__ : str = None class _snake_case : def __init__( self ): __magic_name__ : List[str] ...
41
1
def _a ( SCREAMING_SNAKE_CASE : int ) -> Union[str, Any]: """simple docstring""" return sum(i for i in range(1 , number // 2 + 1 ) if number % i == 0 ) == number if __name__ == "__main__": print('''Program to check whether a number is a Perfect number or not...''')...
322
"""simple docstring""" from __future__ import annotations from collections.abc import Iterator from typing import Generic, TypeVar _UpperCamelCase : Any = TypeVar('T') class a ( Generic[T] ): def __init__( self , _lowerCamelCase ): lowercase = ...
220
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 required by app...
295
import math import torch from torch import nn from ..configuration_utils import ConfigMixin, register_to_config from .attention_processor import Attention from .embeddings import get_timestep_embedding from .modeling_utils import ModelMixin class UpperCamelCase_ ( _lowerCamelCase , _lowe...
295
1
from __future__ import annotations import collections import pprint from pathlib import Path def A ( _lowerCamelCase ): '''simple docstring''' return "".join(sorted(SCREAMING_SNAKE_CASE_ ) ) def A ( _lowerCamelCase ): '''simple docstring''' ...
36
"""simple docstring""" import unittest import numpy as np from diffusers import OnnxStableDiffusionInpaintPipelineLegacy from diffusers.utils.testing_utils import ( is_onnx_available, load_image, load_numpy, nightly, require_onnxruntime, require_torch_gpu, ) if ...
113
0
"""simple docstring""" import json import os import re import shutil import tempfile import unittest from typing import Tuple from transformers import AddedToken, BatchEncoding, PerceiverTokenizer from transformers.utils import cached_property, is_tf_available, is_torch_available from ...test_tokenization_common...
370
"""simple docstring""" import importlib import json import os from collections import OrderedDict from typing import Dict, Optional, Union # Build the list of all image processors from ...configuration_utils import PretrainedConfig from ...dynamic_module_utils import get_class_from_dynamic_module, resolve_trust_r...
64
0
"""simple docstring""" from typing import Optional, Tuple import jax import jax.numpy as jnp from flax import linen as nn from flax.core.frozen_dict import FrozenDict from transformers import CLIPConfig, FlaxPreTrainedModel from transformers.models.clip.modeling_flax_clip import FlaxCLIPVisionModule def ...
320
from typing import Optional from .. import Features, NamedSplit from ..packaged_modules.text.text import Text from ..utils.typing import NestedDataStructureLike, PathLike from .abc import AbstractDatasetReader class lowerCAmelCase__ ( __lowercase ): def __init__( self : Tuple , SCREA...
270
0
'''simple docstring''' from transformers import HfArgumentParser, TensorFlowBenchmark, TensorFlowBenchmarkArguments def __UpperCAmelCase ( ): _UpperCAmelCase : str = HfArgumentParser(a_ ) _UpperCAmelCase : Optional[Any] = parser.parse_args...
360
'''simple docstring''' from importlib import import_module from .logging import get_logger __a = get_logger(__name__) class A__ : """simple docstring""" def __init__( self : List[str] , lowerCAmelCase__ : List[Any] , lowerCAmelCase__ : O...
17
0
"""simple docstring""" from __future__ import annotations from collections.abc import Callable from typing import Generic, TypeVar __lowerCamelCase = TypeVar("T") __lowerCamelCase = TypeVar("U") class UpperCamelCase__( Generic[T, U] ): def __init__( s...
221
"""simple docstring""" from __future__ import annotations import unittest from transformers import is_tf_available from transformers.testing_utils import require_tf, slow from ...test_configuration_common import ConfigTester from ...test_modeling_tf_common import TFModelTesterMixin, ids_tensor, rand...
221
1
"""simple docstring""" import argparse import json import logging import os import sys from unittest.mock import patch from transformers.testing_utils import TestCasePlus, get_gpu_count, slow _lowerCAmelCase : Tuple = [ os.path.join(os.path.dirname(__file__), dirname) for dirname i...
359
"""simple docstring""" from typing import TYPE_CHECKING from ...utils import OptionalDependencyNotAvailable, _LazyModule, is_sentencepiece_available _lowerCAmelCase : Tuple = {} try: if not is_sentencepiece_available(): raise OptionalDependencyNotAvailable() except OptionalDependencyN...
298
0
from dataclasses import asdict, dataclass from typing import Optional from ...configuration_utils import PretrainedConfig from ...utils import logging lowercase__ :str = logging.get_logger(__name__) # TODO Update this lowercase__ :List[str] = { "facebook/esm-1b": "https://huggingface.co/facebook/es...
101
'''simple docstring''' import datasets import faiss import numpy as np import streamlit as st import torch from elasticsearch import Elasticsearch from elia_utils import ( embed_questions_for_retrieval, make_qa_sas_model, qa_sas_generate, query_es_index, query_qa_dense_index, ) import transfo...
27
0
from __future__ import annotations from dataclasses import dataclass @dataclass class lowerCamelCase_ : '''simple docstring''' a__ = 42 a__ = None a__ = None def UpperCAmelCase ( _lowerCamelCase ): # Valid...
256
import re import jax.numpy as jnp from flax.traverse_util import flatten_dict, unflatten_dict from jax.random import PRNGKey from ..utils import logging __SCREAMING_SNAKE_CASE = logging.get_logger(__name__) def UpperCAmelCase ( _lowerCamelCase ): A : List[...
256
1
'''simple docstring''' from typing import TYPE_CHECKING from ...utils import OptionalDependencyNotAvailable, _LazyModule, is_torch_available, is_vision_available lowercase__ : List[Any] = { '''configuration_maskformer''': ['''MASKFORMER_PRETRAINED_CONFIG_ARCHIVE_MAP''',...
190
'''simple docstring''' import json from typing import List, Optional, Tuple from tokenizers import normalizers from tokenizers.pre_tokenizers import BertPreTokenizer, PreTokenizer from ...tokenization_utils_fast import PreTrainedTokenizerFast from ...utils import logging from .tokenization_roformer import Ro...
35
0
from __future__ import annotations def UpperCamelCase( lowercase_ , lowercase_ ) -> list[tuple[int, int]]: '''simple docstring''' snake_case_ = position snake_case_ = [ (y + 1, x + 2), (y - 1, x + 2), (y + 1, x - 2), (y - 1, x - 2), ...
367
import numpy as np from matplotlib import pyplot as plt from sklearn.datasets import load_iris from sklearn.metrics import ConfusionMatrixDisplay from sklearn.model_selection import train_test_split from xgboost import XGBClassifier def UpperCamelCase( lowercase_ ) -> tuple: '''simple do...
34
0
from __future__ import annotations def _lowerCamelCase( lowercase__ ) -> list[int]: '''simple docstring''' __lowercase= [True] * limit __lowercase= False __lowercase= False __lowercase= True for i in range(3 , int(limit**0.5 + 1 ) , 2 ): __lowercase= i * 2 ...
295
from dataclasses import dataclass from typing import Optional, Tuple, Union import torch import torch.nn as nn from ..configuration_utils import ConfigMixin, register_to_config from ..utils import BaseOutput, apply_forward_hook from .modeling_utils import ModelMixin from .vae import Decoder, DecoderOutput, Encoder...
295
1
"""simple docstring""" def lowercase__ ( lowercase_ ,lowercase_ ,lowercase_ ,lowercase_ ,lowercase_ ) -> int: """simple docstring""" if index == number_of_items: return 0 _UpperCamelCase : List[str] = 0 _UpperCamelCase : Tup...
310
"""simple docstring""" import importlib import shutil import threading import warnings from typing import List import fsspec import fsspec.asyn from . import compression from .hffilesystem import HfFileSystem lowerCamelCase__ = importlib.util.find_spec("s3fs") is not None if _has_safs: from .sa...
310
1
def SCREAMING_SNAKE_CASE__ ( lowerCamelCase__ ) -> list: if len(lowerCamelCase__ ) <= 1: return [tuple(lowerCamelCase__ )] __lowerCamelCase : str = [] def generate(lowerCamelCase__ , lowerCamelCase__ ): __lowerCamelCase : List[Any] = [0] * n...
73
'''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, rescale, resize, ...
139
0
"""simple docstring""" def UpperCAmelCase__ (lowerCAmelCase_ ): '''simple docstring''' if not numbers: return 0 if not isinstance(__snake_case , (list, tuple) ) or not all( isinstance(__snake_case , __snake_case ) for number in numbers...
364
"""simple docstring""" import numpy as np import torch import torch.nn as nn from transformers import CLIPConfig, CLIPVisionModelWithProjection, PreTrainedModel from ...utils import logging a__ : Optional[Any] = logging.get_logger(__name__) class UpperCamelCase_ ( Upper...
195
0
"""simple docstring""" __lowerCamelCase = 8.3_1_4_4_5_9_8 def UpperCAmelCase ( UpperCamelCase__ , UpperCamelCase__ ): """simple docstring""" if temperature < 0: raise Exception('Temperature cannot be less than 0 K' ) ...
221
"""simple docstring""" import random import unittest import numpy as np import torch from diffusers import ( DPMSolverMultistepScheduler, EulerAncestralDiscreteScheduler, EulerDiscreteScheduler, LMSDiscreteScheduler, OnnxStableDiffusionUpscalePipeline, PNDMScheduler, ) from diffusers.ut...
17
0
from typing import Dict, List, Optional, Union import numpy as np from transformers.utils import is_vision_available from transformers.utils.generic import TensorType from ...image_processing_utils import BaseImageProcessor, BatchFeature, get_size_dict from ...image_transforms import ( center_crop, ...
360
import json import sys import tempfile import unittest from pathlib import Path import transformers from transformers import ( CONFIG_MAPPING, FEATURE_EXTRACTOR_MAPPING, AutoConfig, AutoFeatureExtractor, WavaVecaConfig, WavaVecaFeatureExtractor, ) from transformers.testing_utils ...
204
0
from math import log from scipy.constants import Boltzmann, physical_constants a_ : Any = 3_00 # TEMPERATURE (unit = K) def lowerCamelCase__ (_UpperCAmelCase , _UpperCAmelCase , _UpperCAmelCase , ): if donor_conc <= 0: raise ValueError('Donor concent...
137
# Copyright 2022 The HuggingFace Team. All rights reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by ap...
137
1
"""simple docstring""" def _SCREAMING_SNAKE_CASE ( _lowercase : int , _lowercase : int ) ->int: '''simple docstring''' return int((input_a, input_a).count(0 ) == 0 ) def _SCREAMING_SNAKE_CASE ( ) ->None: ''...
351
"""simple docstring""" # limitations under the License. # NOTE: This file is deprecated and will be removed in a future version. # It only exists so that temporarely `from diffusers.pipelines import DiffusionPipeline` works from .pipelines import DiffusionPipeline, ImagePipelineOutput # noq...
79
0
"""simple docstring""" import os import string import sys snake_case__ : Optional[int] = 1 << 8 snake_case__ : Union[str, Any] = { '''tab''': ord('''\t'''), '''newline''': ord('''\r'''), '''esc''': 27, '''up''': 65 + ARROW_KEY_FLAG, '''down''': 66 + ARROW_KEY_FLAG, ...
60
"""simple docstring""" import datasets import faiss import numpy as np import streamlit as st import torch from elasticsearch import Elasticsearch from elia_utils import ( embed_questions_for_retrieval, make_qa_sas_model, qa_sas_generate, query_es_index, query_qa_dense_index, ) import trans...
60
1
'''simple docstring''' # 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 f...
46
'''simple docstring''' import os from shutil import copyfile from typing import Any, Dict, List, Optional, Tuple import sentencepiece as spm from ...tokenization_utils import AddedToken, PreTrainedTokenizer from ...utils import logging _a : Dict = logging.get_logger(__name__) _a : Optional[i...
46
1
"""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 _UpperCamelCase : List[Any] = logging.get_logger(__name__) _UpperCa...
77
from typing import TYPE_CHECKING from ...utils import ( OptionalDependencyNotAvailable, _LazyModule, is_tf_available, is_torch_available, is_vision_available, ) __a = {'configuration_deit': ['DEIT_PRETRAINED_CONFIG_ARCHIVE_MAP', 'DeiTConfig', 'DeiTOnnxConfig']} try: ...
30
0
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, EfficientFormerForImageClassificationWithTeacher, EfficientFormer...
235
from dataclasses import dataclass, field from typing import Optional @dataclass class __a: """simple docstring""" lowerCAmelCase = field( default='''codeparrot/codeparrot''' , metadata={'''help''': '''Model name or path of model to be trained.'''} ) lowerCA...
235
1
from __future__ import annotations from collections.abc import Generator def _UpperCAmelCase ( ): __UpperCamelCase ={} __UpperCamelCase =2 while True: __UpperCamelCase =factor_map.pop(SCREAMING_SNAKE_CASE__ , SCREAMING_SNAKE_CASE__ ) ...
62
from pathlib import Path import cva import numpy as np from matplotlib import pyplot as plt def lowerCAmelCase_ ( A_ ,A_ ,A_ ,A_ ,A_): UpperCamelCase__: List[str] = cva.getAffineTransform(A_ ,A_) return cva.warpAffine(A_ ,A_ ,(rows, cols)) if...
149
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 = logging.get_logger(__name__) UpperCAmelCase = { """facebook/xlm-roberta-xl""": """...
370
"""simple docstring""" # NOTE: This file is deprecated and will be removed in a future version. # It only exists so that temporarely `from diffusers.pipelines import DiffusionPipeline` works from ...utils import deprecate from ..controlnet.pipeline_flax_controlnet import FlaxStableDiffusionControlNetPipeline # noqa:...
54
0
import json from typing import TYPE_CHECKING, List, Optional, Tuple from tokenizers import pre_tokenizers from ...tokenization_utils_base import BatchEncoding from ...tokenization_utils_fast import PreTrainedTokenizerFast from ...utils import logging if TYPE_CHECKING: from transformers.pipelines.conversatio...
233
lowerCamelCase : Optional[Any] = '''ABCDEFGHIJKLMNOPQRSTUVWXYZ''' def snake_case_ ( ): __lowercase : List[str] = input("""Enter message: """ ) __lowercase : int = input("""Enter key [alphanumeric]: """ ) __lowercase : ...
233
1
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 as np from .import_utils...
360
# limitations under the License. # NOTE: This file is deprecated and will be removed in a future version. # It only exists so that temporarely `from diffusers.pipelines import DiffusionPipeline` works from .pipelines import DiffusionPipeline, ImagePipelineOutput # noqa: F401 from .utils import deprecate dep...
319
0
"""simple docstring""" from __future__ import annotations _a = { """A""": ["""B""", """C""", """E"""], """B""": ["""A""", """D""", """E"""], """C""": ["""A""", """F""", """G"""], """D""": ["""B"""], """E""": ["""A""", """B""", """D"""], """F""": ["""C"""], ...
194
from typing import Dict, List, Optional, Union import numpy as np from ...image_processing_utils import BaseImageProcessor, BatchFeature, get_size_dict from ...image_transforms import ( center_crop, get_resize_output_image_size, normalize, rescale, resize, to_channel_dimen...
308
0
import warnings from ...utils import is_sklearn_available, requires_backends if is_sklearn_available(): from scipy.stats import pearsonr, spearmanr from sklearn.metrics import fa_score, matthews_corrcoef lowerCamelCase__ = ( '''This metric will be removed from the library soon, metrics sh...
22
from collections import OrderedDict from typing import Mapping from packaging import version from ...configuration_utils import PretrainedConfig from ...onnx import OnnxConfig from ...utils import logging lowerCamelCase__ = logging.get_logger(__name__) lowerCamelCase__ = { '''goog...
22
1
"""simple docstring""" from typing import TYPE_CHECKING from ...utils import _LazyModule _SCREAMING_SNAKE_CASE : List[str] = {'''tokenization_bertweet''': ['''BertweetTokenizer''']} if TYPE_CHECKING: from .tokenization_bertweet import BertweetTokenizer els...
183
"""simple docstring""" def lowerCamelCase__ ( _lowerCamelCase : int , _lowerCamelCase : int ) -> int: lowerCamelCase_ = 1 # To kept the Calculated Value # Since C(n, k) = C(n, n-k) if k > (n - k): lowerCamelCase_ = ...
183
1
import shutil import tempfile import unittest from transformers import ClapFeatureExtractor, ClapProcessor, RobertaTokenizer, RobertaTokenizerFast from transformers.testing_utils import require_sentencepiece, require_torchaudio from .test_feature_extraction_clap import floats_list @require_torchau...
369
import argparse import json import math import os import time import traceback import zipfile from collections import Counter import requests def SCREAMING_SNAKE_CASE__ ( __a , __a=None ): snake_case_ : Optional[int] = None if token is not None: snake_c...
88
0
"""simple docstring""" def _snake_case ( lowercase__ : int = 1_0 ) -> str: '''simple docstring''' if not isinstance(lowercase__ , lowercase__ ) or n < 0: raise ValueError("""Invalid input""" ) lowerCAmelCase_ :List[str] = 1_0**n ...
84
'''simple docstring''' from collections import OrderedDict from typing import Any, List, Mapping, Optional from ... import PreTrainedTokenizer, TensorType, is_torch_available from ...configuration_utils import PretrainedConfig from ...onnx import OnnxConfigWithPast, PatchingSpec from ...utils import logging ...
211
0
from typing import TYPE_CHECKING from ...utils import ( OptionalDependencyNotAvailable, _LazyModule, is_torch_available, ) SCREAMING_SNAKE_CASE__ : List[Any] = { "configuration_gpt_bigcode": ["GPT_BIGCODE_PRETRAINED_CONFIG_ARCHIVE_MAP", "GPTBigCodeConfig"], } try: ...
370
from __future__ import annotations def __magic_name__ ( __lowerCAmelCase : list[int] ) -> bool: return len(set(__lowerCAmelCase ) ) == len(__lowerCAmelCase ) if __name__ == "__main__": import doctest doctest.testmod()
339
0
import inspect import logging import os import random import shutil import tempfile import unittest import pytest import torch from torch import nn from torch.utils.data import DataLoader, TensorDataset from accelerate import Accelerator from accelerate.test_utils import execute_subprocess_async, require_cuda ...
259
import math def _A ( SCREAMING_SNAKE_CASE__ : int = 100 ): UpperCamelCase :Dict = sum(i * i for i in range(1 , n + 1 ) ) UpperCamelCase :List[str] = int(math.pow(sum(range(1 , n + 1 ) ) , 2 ) ) return squ...
259
1
'''simple docstring''' def UpperCamelCase ( a ) -> int: '''simple docstring''' if n == 1 or not isinstance(a , a ): return 0 elif n == 2: return 1 else: __magic_name__ = [0, 1] for i in range(2 , n + 1 ...
98
'''simple docstring''' import unittest from transformers import ( MODEL_FOR_SEQ_TO_SEQ_CAUSAL_LM_MAPPING, TF_MODEL_FOR_SEQ_TO_SEQ_CAUSAL_LM_MAPPING, TextaTextGenerationPipeline, pipeline, ) from transformers.testing_utils import is_pipeline_test, require_tf, require_torch from transformers.utils ...
98
1
"""simple docstring""" import inspect import unittest import numpy as np from transformers import ViTConfig, is_flax_available from transformers.testing_utils import require_flax, slow from ...test_configuration_common import ConfigTester from ...test_modeling_flax_common import FlaxModelTesterMixin, floats_ten...
57
"""simple docstring""" def UpperCAmelCase__ (lowerCAmelCase_ ): '''simple docstring''' if number > 0: raise ValueError("input must be a negative integer" ) __SCREAMING_SNAKE_CASE = len(bin(lowerCAmelCase_ )[3:] ) __SCREAMING_SNAKE_CASE = ...
54
0
"""simple docstring""" import os from huggingface_hub.constants import HUGGINGFACE_HUB_CACHE, hf_cache_home _lowerCamelCase : int = HUGGINGFACE_HUB_CACHE _lowerCamelCase : Tuple = '''config.json''' _lowerCamelCase : Optional[Any] = '''diffusion_pytorch_model....
367
import argparse import json import os from collections import OrderedDict import torch from transformers import LukeConfig, LukeForMaskedLM, MLukeTokenizer, XLMRobertaTokenizer from transformers.tokenization_utils_base import AddedToken @torch.no_grad() def a_ ( __lowercase : Optional[Any] , __lowe...
130
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, ) _UpperCamelCase = { 'configuration_...
208
'''simple docstring''' import argparse import os import pickle import sys import torch from transformers import TransfoXLConfig, TransfoXLLMHeadModel, load_tf_weights_in_transfo_xl from transformers.models.transfo_xl import tokenization_transfo_xl as data_utils from transformers.models.tra...
208
1
'''simple docstring''' import os import shutil import tempfile from unittest import TestCase from unittest.mock import patch import numpy as np from datasets import Dataset from transformers.models.realm.configuration_realm import RealmConfig from transformers.models.realm.retrieval_realm imp...
222
'''simple docstring''' from __future__ import annotations import os from collections.abc import Mapping a_ = tuple[int, int] class __SCREAMING_SNAKE_CASE : def __init__( self : Any , __lowercase : set[int] , __lowercase : Mapping[EdgeT, in...
222
1
'''simple docstring''' from collections.abc import Iterator, MutableMapping from dataclasses import dataclass from typing import Generic, TypeVar __SCREAMING_SNAKE_CASE :int = TypeVar('''KEY''') __SCREAMING_SNAKE_CASE :List[Any] = TypeVar('''VAL''') @dataclass(frozen=lowerCAm...
22
'''simple docstring''' import inspect import unittest import numpy as np from tests.test_modeling_common import floats_tensor from transformers import DetrConfig, MaskFormerConfig, SwinConfig, is_torch_available, is_vision_available from transformers.testing_utils import require_torch, require_torch_multi_g...
22
1
from typing import Tuple, Union from ...modeling_outputs import BackboneOutput from ...modeling_utils import PreTrainedModel from ...utils import is_timm_available, is_torch_available, requires_backends from ...utils.backbone_utils import BackboneMixin from .configuration_timm_backbone import TimmBac...
88
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 SCREAMING_SNAKE_CASE_ ( snake_case_ ...
88
1
'''simple docstring''' from typing import TYPE_CHECKING from ...utils import ( OptionalDependencyNotAvailable, _LazyModule, is_flax_available, is_sentencepiece_available, is_tf_available, is_tokenizers_available, is_torch_available, ) A__ : List[...
70
'''simple docstring''' import re import warnings from contextlib import contextmanager from ...processing_utils import ProcessorMixin class UpperCAmelCase ( snake_case_ ): _lowercase: Union[str, Any] = ['''image_processor''', '''tokenizer'''] _...
70
1
"""simple docstring""" import tempfile import unittest from pathlib import Path from shutil import copyfile from transformers import MaMaaaTokenizer, is_torch_available from transformers.testing_utils import ( get_tests_dir, nested_simplify, require_sentencepiece, require_tok...
355
"""simple docstring""" from ...configuration_utils import PretrainedConfig from ...utils import logging SCREAMING_SNAKE_CASE = logging.get_logger(__name__) SCREAMING_SNAKE_CASE = { "SCUT-DLVCLab/lilt-roberta-en-base": ( "https://huggingface.co/SCUT-DLVCLab/lilt-roberta-en-base/resolve/main/...
230
0
'''simple docstring''' import json from typing import List, Optional, Tuple from tokenizers import pre_tokenizers, processors from ...tokenization_utils_base import AddedToken, BatchEncoding from ...tokenization_utils_fast import PreTrainedTokenizerFast from ...utils import logging from .tokenization_mvp im...
297
'''simple docstring''' from typing import Mapping from ...configuration_utils import PretrainedConfig from ...onnx import OnnxSeqaSeqConfigWithPast from ...utils import logging lowerCAmelCase: Union[str, Any] = logging.get_logger(__name__) lowerCAmelCase: List[str] = ...
297
1
'''simple docstring''' from __future__ import annotations import collections import pprint from pathlib import Path def __lowerCamelCase ( lowerCAmelCase_ ) -> str: return "".join(sorted(lowerCAmelCase_ ) ) def __lowerCamelCase ( lowerCAmelCase_ ) -> list[str]: ...
107
'''simple docstring''' import os import random import sys from . import cryptomath_module as cryptomath from . import rabin_miller __lowerCAmelCase = 3 def __lowerCamelCase ( lowerCAmelCase_ ) -> int: print('Generating primitive root of p' ) while True: _a : ...
107
1
from typing import TYPE_CHECKING from ...utils import OptionalDependencyNotAvailable, _LazyModule, is_torch_available _UpperCAmelCase : Any = { "configuration_x_clip": [ "XCLIP_PRETRAINED_CONFIG_ARCHIVE_MAP", "XCLIPConfig", "XCLIPTextConfig", "XCLIPVisionConfig", ], ...
236
import torch def UpperCAmelCase__ ( ): if torch.cuda.is_available(): lowercase :Optional[int] = torch.cuda.device_count() else: lowercase :Dict = 0 print(F"Successfully ran on {num_gpus} GPUs" ) if __name__ == "__main__": main()
236
1
import os from shutil import copyfile from typing import List, Optional, Tuple from ...tokenization_utils import AddedToken from ...tokenization_utils_fast import PreTrainedTokenizerFast from ...utils import is_sentencepiece_available, logging if is_sentencepiece_available(): from .tokenization_fnet impor...
344
import os import unicodedata from shutil import copyfile from typing import Any, Dict, List, Optional, Tuple import sentencepiece as spm from ...tokenization_utils import AddedToken, PreTrainedTokenizer from ...utils import SPIECE_UNDERLINE, logging UpperCamelCase_ = logging.get_logger(__name__) Upp...
344
1
"""simple docstring""" import re import tempfile from pathlib import Path import pytest import yaml from datasets.utils.readme import ReadMe # @pytest.fixture # def example_yaml_structure(): _UpperCAmelCase = yaml.safe_load( """\ name: \"\" allow_empty: false allow_empty_text: true sub...
173
"""simple docstring""" import functools import gc import inspect import torch from .imports import is_npu_available, is_xpu_available def __magic_name__ ( *lowercase ): if not isinstance(lowercase , lowercase ): SCREAMING_SNAKE_CASE_: Optional[Any]...
173
1
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_torch_availa...
354
import os import re import shutil import sys import tempfile import unittest import black __UpperCAmelCase = 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...
145
0
# DISCLAIMER: This file is strongly influenced by https://github.com/ermongroup/ddim from dataclasses import dataclass from typing import Optional, Tuple, Union import flax import jax import jax.numpy as jnp from ..configuration_utils import ConfigMixin, register_to_config from .scheduling_utils_...
90
from typing import TYPE_CHECKING from ...utils import ( OptionalDependencyNotAvailable, _LazyModule, is_flax_available, is_tf_available, is_torch_available, ) _A = {'configuration_vit_mae': ['VIT_MAE_PRETRAINED_CONFIG_ARCHIVE_MAP', 'ViTMAEConfig']} try: if not is_torch_availab...
62
0
"""simple docstring""" from collections import defaultdict from typing import Optional from ..image_utils import load_image from ..utils import ( add_end_docstrings, is_torch_available, logging, requires_backends, ) from .base import PIPELINE_INIT_ARGS, ChunkPipeline if is_t...
350
"""simple docstring""" from torch import nn class _SCREAMING_SNAKE_CASE( nn.Module ): def __init__( self ,SCREAMING_SNAKE_CASE__ ,SCREAMING_SNAKE_CASE__ ) -> List[str]: """simple docstring""" super()...
239
0
'''simple docstring''' import random import unittest import torch from diffusers import IFInpaintingPipeline from diffusers.utils import floats_tensor from diffusers.utils.import_utils import is_xformers_available from diffusers.utils.testing_utils import skip_mps, torch_device from ..pipe...
223
'''simple docstring''' import math def UpperCAmelCase_ ( __lowerCamelCase : int ): lowercase_ :Dict = [] lowercase_ :List[Any] = 2 lowercase_ :Optional[Any] = int(math.sqrt(__lowerCamelCase ) ) # Size of every segment lowercase_ :Optional...
223
1
"""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_docstrin...
357
"""simple docstring""" from ...utils import ( OptionalDependencyNotAvailable, is_torch_available, is_transformers_available, is_transformers_version, ) try: if not (is_transformers_available() and is_torch_available() and is_transformers_version('''>=''', '''4.25.0''')): ra...
74
0
"""simple docstring""" from ...configuration_utils import PretrainedConfig from ...utils import logging _UpperCamelCase: List[Any] = logging.get_logger(__name__) _UpperCamelCase: int = { # See all MEGATRON_BERT models at https://huggingface.co/models?filter=bert ...
255
"""simple docstring""" from __future__ import annotations import unittest from transformers import is_tf_available from transformers.testing_utils import require_sentencepiece, require_tf, require_tokenizers, slow if is_tf_available(): import tensorflow as tf from transformers...
255
1
import argparse from typing import Dict import tensorflow as tf import torch from tqdm import tqdm from transformers import BigBirdPegasusConfig, BigBirdPegasusForConditionalGeneration UpperCAmelCase = [ # tf -> hf ('''/''', '''.'''), ('''layer_''', '''layers.'''), ('''kernel''', '''weight...
364
import tempfile import unittest from transformers import TaConfig, is_torch_available from transformers.testing_utils import ( require_sentencepiece, require_tokenizers, require_torch, slow, torch_device, ) from ...generation.test_utils import GenerationTesterMixin from ...test_modeling_common ...
267
0
from sympy import diff, lambdify, symbols from sympy.functions import * # noqa: F403 def _UpperCamelCase ( lowercase__ , lowercase__ , lowercase__ = "x" , lowercase__ = 10**-10 , lowercase__ = 1 , ): __SCREAMING_SNAKE_CASE : Optional[An...
9
'''simple docstring''' import operator def __magic_name__( lowerCamelCase, lowerCamelCase = False, lowerCamelCase = None): __lowerCAmelCase = operator.lt if reverse else operator.gt __lowerCAmelCase = solution or [] if not arr: return solution ...
174
0
"""simple docstring""" import argparse import logging import pickle from collections import Counter logging.basicConfig( format="""%(asctime)s - %(levelname)s - %(name)s - %(message)s""", datefmt="""%m/%d/%Y %H:%M:%S""", level=logging.INFO ) _lowerCAmelCase : List[str] = logging.getLogg...
358
"""simple docstring""" import inspect import unittest from transformers import DecisionTransformerConfig, is_torch_available from transformers.testing_utils import require_torch, slow, torch_device from ...generation.test_utils import GenerationTesterMixin from ...test_configuration_common import ConfigTest...
298
0
"""simple docstring""" import random import timeit from functools import wraps from typing import Callable, Optional from ..configuration_utils import PretrainedConfig from ..models.auto.modeling_tf_auto import TF_MODEL_MAPPING, TF_MODEL_WITH_LM_HEAD_MAPPING from ..utils import is_pyanvml_available, is_tf_available...
261
"""simple docstring""" from operator import delitem, getitem, setitem import pytest from data_structures.hashing.hash_map import HashMap def _lowerCamelCase( a ): return getitem, k def _lowerCamelCase( a , a ): return setitem, k, v def _lowerCamelCase(...
261
1
"""simple docstring""" import gc import unittest import numpy as np import torch from transformers import CLIPTextConfig, CLIPTextModel, CLIPTokenizer from diffusers import AutoencoderKL, DDIMScheduler, LDMTextToImagePipeline, UNetaDConditionModel from diffusers.utils.testing_utils import ( enable_full_d...
363
"""simple docstring""" import multiprocessing import time from arguments import PretokenizationArguments from datasets import load_dataset from transformers import AutoTokenizer, HfArgumentParser def lowerCamelCase_( _lowerCamelCase ) -> Tuple: '''simple docstring''' _lowerC...
340
0
'''simple docstring''' from typing import TYPE_CHECKING from ...utils import OptionalDependencyNotAvailable, _LazyModule, is_torch_available UpperCamelCase = { '''configuration_clipseg''': [ '''CLIPSEG_PRETRAINED_CONFIG_ARCHIVE_MAP''', '''CLIPSegConfig''', ...
319
'''simple docstring''' from typing import TYPE_CHECKING from ...utils import ( OptionalDependencyNotAvailable, _LazyModule, is_flax_available, is_tf_available, is_torch_available, ) UpperCamelCase = { '''configuration_vision_encoder_decoder''': ['''VisionEn...
319
1
from typing import Dict, List, Optional, Union import numpy as np from ...image_processing_utils import BaseImageProcessor, BatchFeature, get_size_dict from ...image_transforms import ( center_crop, get_resize_output_image_size, normalize, rescale, resize, to_channel_dimension_format, )...
286
from __future__ import annotations import os import tempfile import unittest from transformers import ConvBertConfig, is_tf_available from transformers.testing_utils import require_tf, slow from ...test_configuration_common import ConfigTester from ...test_modeling_tf_common import TFModelTesterMixin, ids_ten...
286
1
def _a ( lowerCamelCase: int = 10_00 ) -> int: '''simple docstring''' __A = 3 __A = 0 while a < n: if a % 3 == 0 or a % 5 == 0: result += a elif a % 15 == 0: ...
117
import argparse import torch from transformers import BertForMaskedLM if __name__ == "__main__": snake_case__ : Optional[int] = argparse.ArgumentParser( description=( 'Extraction some layers of the full BertForMaskedLM or RObertaForMas...
117
1
"""simple docstring""" from typing import TYPE_CHECKING # rely on isort to merge the imports from ...utils import OptionalDependencyNotAvailable, _LazyModule, is_torch_available a_ = { """configuration_informer""": [ """INFORMER_PRETRAINED_CONFIG_ARCHIVE_MAP""", """InformerConfig"...
291
"""simple docstring""" import json import os import unittest from transformers.models.xlm.tokenization_xlm import VOCAB_FILES_NAMES, XLMTokenizer from transformers.testing_utils import slow from ...test_tokenization_common import TokenizerTesterMixin class __snake_case ( SCREAMING_SNAKE_CASE__ ...
291
1
import importlib import shutil import threading import warnings from typing import List import fsspec import fsspec.asyn from . import compression from .hffilesystem import HfFileSystem __UpperCAmelCase = importlib.util.find_spec('s3fs') is not None if _has_safs: from .s...
29
import random import unittest import torch from diffusers import IFImgaImgSuperResolutionPipeline from diffusers.utils import floats_tensor from diffusers.utils.import_utils import is_xformers_available from diffusers.utils.testing_utils import skip_mps, torch_device from ..pipeline_params im...
29
1
import math def _a ( SCREAMING_SNAKE_CASE_ : float , SCREAMING_SNAKE_CASE_ : float ): if initial_intensity < 0: raise ValueError("The value of intensity cannot be negative" ) # handling of negative values of initial intensity if ang...
350
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''' from __future__ import annotations def __lowercase ( __lowercase , __lowercase = None , __lowercase = None ) -> None: '''simple docstring''' if start is None: _A = 0 if end is None: _A = len...
79
'''simple docstring''' from typing import TYPE_CHECKING from ....utils import OptionalDependencyNotAvailable, _LazyModule, is_torch_available lowercase__ : Tuple = { 'configuration_mctct': ['MCTCT_PRETRAINED_CONFIG_ARCHIVE_MAP', 'MCTCTConfig'], 'feature_extraction_mctct': ['MCTCTFeatur...
324
0
'''simple docstring''' # Copyright 2021 The HuggingFace Team. All rights reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licen...
89
'''simple docstring''' import json from typing import List, Optional, Tuple from tokenizers import normalizers from ...tokenization_utils_fast import PreTrainedTokenizerFast from .tokenization_lxmert import LxmertTokenizer __A : Any = {"vocab_file": "vocab.txt", "tokenizer_...
89
1
import inspect import unittest import numpy as np from tests.test_modeling_common import floats_tensor from transformers import MaskaFormerConfig, is_torch_available, is_vision_available from transformers.testing_utils import require_torch, require_torch_multi_gpu, require_vision, slow, torch_device from trans...
207
import inspect import unittest from transformers import DPTConfig from transformers.file_utils import is_torch_available, is_vision_available from transformers.models.auto import get_values from transformers.testing_utils import require_torch, require_vision, slow, torch_device from ...test_configuration_commo...
207
1
'''simple docstring''' from typing import TYPE_CHECKING from ...utils import ( OptionalDependencyNotAvailable, _LazyModule, is_tf_available, is_torch_available, is_vision_available, ) A__ : Optional[int] ={ '''configuration_convnext''...
360
'''simple docstring''' def UpperCamelCase__ ( lowerCAmelCase = 4_00_00_00 ): """simple docstring""" _lowerCAmelCase = [] _lowerCAmelCase , _lowerCAmelCase = 0, 1 while b <= n: if b % 2...
220
0
"""simple docstring""" import functools def a_ ( _lowerCAmelCase : str , _lowerCAmelCase : Optional[int] ): '''simple docstring''' if not isinstance(A__ , A__ ) or not all(isinstance(A__ , A__ ) for day in days ): raise ValueError('The par...
77
from ...utils import is_torch_available, is_transformers_available if is_transformers_available() and is_torch_available(): from .pipeline_vq_diffusion import LearnedClassifierFreeSamplingEmbeddings, VQDiffusionPipeline
99
0
import os from typing import Any, Callable, Dict, List, Optional, Tuple, Union import torch from torch import nn from ...models.controlnet import ControlNetModel, ControlNetOutput from ...models.modeling_utils import ModelMixin from ...utils import logging UpperCamelCase_ = logging.get_logger(__name_...
366
import math import os import re import sys import unittest from pathlib import Path from typing import Tuple from unittest.mock import patch from parameterized import parameterized from transformers.testing_utils import ( CaptureStderr, ExtendSysPath, TestCasePlus, execute_subprocess_async, ge...
344
0
from typing import TYPE_CHECKING from ...utils import ( OptionalDependencyNotAvailable, _LazyModule, is_torch_available, ) __lowerCAmelCase : List[Any] = { '''configuration_mega''': ['''MEGA_PRETRAINED_CONFIG_ARCHIVE_MAP''', '''MegaConfig''', '''MegaOnnxConfig'''], } try: if not...
107
"""simple docstring""" import argparse from transformers import CLIPImageProcessor, CLIPVisionModelWithProjection from diffusers import UnCLIPImageVariationPipeline, UnCLIPPipeline if __name__ == "__main__": __A : str = argparse.ArgumentParser() parser.add_ar...
33
0
'''simple docstring''' from urllib.parse import quote import pytest from datasets.utils.hub import hf_hub_url @pytest.mark.parametrize('''repo_id''', ['''canonical_dataset_name''', '''org-name/dataset-name'''] ) @pytest.mark.parametrize('''path''', ['''filename.csv''', '''filename...
361
'''simple docstring''' import gc import unittest import numpy as np import torch from diffusers import StableDiffusionKDiffusionPipeline from diffusers.utils import slow, torch_device from diffusers.utils.testing_utils import enable_full_determinism, require_torch_gpu enable_full_determini...
222
0
"""simple docstring""" from typing import TYPE_CHECKING from ....utils import OptionalDependencyNotAvailable, _LazyModule, is_torch_available lowerCAmelCase : Union[str, Any] = { """configuration_trajectory_transformer""": [ """TRAJECTORY_TRANSFORMER_PRETRAINED_CONFIG_AR...
291
"""simple docstring""" from math import ceil def a__ ( snake_case__ , snake_case__ ) -> Optional[int]: lowerCamelCase = list(range(0 , snake_case__ ) ) lowerCamelCase = [item for sublist in list(device_map.values() ) for item in sublist]...
291
1
"""simple docstring""" from collections.abc import Callable import numpy as np def lowerCamelCase ( _UpperCamelCase : Callable , _UpperCamelCase : float , _UpperCamelCase : float , _UpperCamelCase : float , _UpperCamelCase : float ) -> np.ndarray: ...
360
"""simple docstring""" from ..utils import ( OptionalDependencyNotAvailable, is_flax_available, is_scipy_available, is_torch_available, is_torchsde_available, ) try: if not is_torch_available(): raise OptionalDependencyNotAvailable() except OptionalDependencyNotAvaila...
320
0
'''simple docstring''' import os import tempfile import unittest from transformers import NezhaConfig, is_torch_available from transformers.models.auto import get_values from transformers.testing_utils import require_torch, require_torch_gpu, slow, torch_device from ...generation.test_u...
298
from functools import reduce UpperCAmelCase__ = ( "73167176531330624919225119674426574742355349194934" "96983520312774506326239578318016984801869478851843" "85861560789112949495459501737958331952853208805511" "12540698747158523863050715693290963295227443043557" "668966489504452445231617...
339
0
from manim import * class UpperCamelCase ( _UpperCAmelCase ): def __A ( self ): A__ = Rectangle(height=0.5 , width=0.5 ) A__ = Rectangle(height=0.46 , width=0.46 ).set_stroke(width=0 ) A__ = [mem.copy() for i...
198
import argparse import struct import unittest class UpperCamelCase : def __init__( self , UpperCAmelCase__ ): A__ = data # Initialize hash values A__ = [ 0x6A_09E_667, 0xBB_67A_E85, 0x3C_6EF_372, 0xA...
198
1
"""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, PNDMScheduler, StableDiff...
289
"""simple docstring""" import gc import math import unittest import torch from diffusers import UNetaDModel from diffusers.utils import floats_tensor, logging, slow, torch_all_close, torch_device from diffusers.utils.testing_utils import enable_full_determinism from .test_modeling_common import ModelTesterMixin, U...
289
1
def _UpperCamelCase ( snake_case__, snake_case__, snake_case__, snake_case__, snake_case__ ) -> int: if index == number_of_items: return 0 __UpperCAmelCase : List[Any] = 0 __UpperCAmelCase : Optional[Any] ...
342
import argparse from typing import Dict import tensorflow as tf import torch from tqdm import tqdm from transformers import BigBirdPegasusConfig, BigBirdPegasusForConditionalGeneration _snake_case = [ # tf -> hf ('''/''', '''.'''), ('''layer_''', '''layers.'''), ('''kernel''', ...
342
1
"""simple docstring""" def snake_case ( A__ ,A__ ,A__ = 0 ,A__ = 0 ): UpperCAmelCase_ : List[Any] = right or len(A__ ) - 1 if left > right: return -1 elif list_data[left] == key: return left elif list_data[right] == key: return right else: ...
268
"""simple docstring""" from ...configuration_utils import PretrainedConfig from ...utils import logging lowerCamelCase_ = logging.get_logger(__name__) lowerCamelCase_ = { '''RWKV/rwkv-4-169m-pile''': '''https://huggingface.co/RWKV/rwkv-4-169m-pile/resolve/main/config.json''', '''RWKV...
268
1
"""simple docstring""" import random import unittest import numpy as np from diffusers import ( DPMSolverMultistepScheduler, EulerAncestralDiscreteScheduler, EulerDiscreteScheduler, LMSDiscreteScheduler, OnnxStableDiffusionImgaImgPipeline, PNDMScheduler, ) from diffusers.utils import flo...
57
"""simple docstring""" from __future__ import annotations class __UpperCamelCase : def __init__(self : Tuple , __SCREAMING_SNAKE_CASE : int = 0): A = key def SCREAMING_SNAKE_CASE__ (self : str , __SCREAMING_SNAKE_CASE : str , __SCREAMING_...
57
1
import string import numpy def snake_case__ ( SCREAMING_SNAKE_CASE_ : int , SCREAMING_SNAKE_CASE_ : int ): '''simple docstring''' return b if a == 0 else greatest_common_divisor(b % a , SCREAMING_SNAKE_CASE_ ) class SCREAMING_SNAKE_CASE__ : __lowerCamelCas...
214
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 snake_case_ = logging.get_logger(__name__) def snake_case__ ( SCREAMING_SNAKE_CASE_ : Tuple , SCREAMING_SNAKE_CASE_ : ...
214
1
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 a__: List[str] = logging.get_logger(__name__) a__: List[str] = '▁' a__:...
39
from __future__ import annotations from collections.abc import Iterator from typing import Any class SCREAMING_SNAKE_CASE__ : def __init__( self,__lowerCamelCase ): A__ = data A__ = None class SCREAMING_SNAKE_CASE__ : ...
39
1
"""simple docstring""" import unittest import numpy as np import torch from diffusers import VersatileDiffusionImageVariationPipeline from diffusers.utils.testing_utils import load_image, require_torch_gpu, slow, torch_device lowerCAmelCase__ = False class __snake_case ( unitt...
72
"""simple docstring""" import argparse import json import requests import torch from huggingface_hub import hf_hub_download from PIL import Image from transformers import ConvNextConfig, SegformerImageProcessor, UperNetConfig, UperNetForSemanticSegmentation def _snake_case ( lowerCamelCase__ : T...
144
0
import argparse from transformers import BigBirdConfig, BigBirdForPreTraining, BigBirdForQuestionAnswering, load_tf_weights_in_big_bird from transformers.utils import logging logging.set_verbosity_info() def _SCREAMING_SNAKE_CASE ( lowercase : Optional[Any] , lowerca...
208
from ..utils import DummyObject, requires_backends class A( metaclass=UpperCamelCase ): '''simple docstring''' UpperCamelCase = ['''transformers''', '''torch''', '''note_seq'''] def __init__( self : Any , *A_ : Any , **A...
208
1