code
stringlengths
87
55.2k
code_codestyle
int64
0
349
style_context
stringlengths
135
49.1k
style_context_codestyle
int64
0
349
label
int64
0
1
"""simple docstring""" import argparse import torch from transformers import BlenderbotConfig, BlenderbotForConditionalGeneration from transformers.utils import logging logging.set_verbosity_info() lowerCamelCase_ : Optional[int] = logging.get_logger(__name__) lowerCame...
81
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 from...
240
0
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 A__ = logging.get_logger(__name__) A__ = ...
82
from abc import ABC, abstractmethod from argparse import ArgumentParser class snake_case_ (lowerCamelCase_ ): @staticmethod @abstractmethod def lowerCamelCase__( __snake_case :ArgumentParser ) -> Dict: raise NotImplementedError() @abstractme...
240
0
'''simple docstring''' snake_case_ : str = 9.8_06_65 def A__ ( UpperCAmelCase_ , UpperCAmelCase_ , UpperCAmelCase_ = g ): if fluid_density <= 0: raise ValueError('Impossible fluid density' ) if volume < 0: raise ValueError('Impossible Object...
83
import sys from .dependency_versions_table import deps from .utils.versions import require_version, require_version_core # define which module versions we always want to check at run time # (usually the ones defined in `install_requires` in setup.py) # # order specific notes: # - tqdm must be checked before token...
240
0
"""simple docstring""" from collections import deque from .hash_table import HashTable class _SCREAMING_SNAKE_CASE ( A__ ): def __init__( self , *__A , **__A ) -> List[str]: super().__init__(*__A , **__A ) ...
84
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_ (lowerCamelCase_ , unittest.TestCase ): ...
240
0
'''simple docstring''' from typing import List from .keymap import KEYMAP, get_character def UpperCamelCase_( snake_case : str ): '''simple docstring''' def decorator(snake_case : List[str] ): snake_case_ = getattr(snake_case...
85
def __lowercase ( __lowerCAmelCase : list[int] ): a__ = [] if len(__lowerCAmelCase ) == 1: return [nums.copy()] for _ in range(len(__lowerCAmelCase ) ): a__ = nums.pop(0 ) a__ = ...
240
0
"""simple docstring""" import math def __lowerCAmelCase (_UpperCamelCase ): __lowerCAmelCase : Tuple = [] __lowerCAmelCase : Dict = 2 __lowerCAmelCase : Any = int(math.sqrt(_UpperCamelCase ) ) # Size of every segment __lowerCAmelCase :...
86
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 snake_case : Union[str, Any] = logging.get_logger(__name__) snake_case : ...
240
0
import glob import os import random from string import ascii_lowercase, digits import cva UpperCamelCase = '''''' UpperCamelCase = '''''' UpperCamelCase = '''''' UpperCamelCase = 1 # (0 is vertical, 1 is horizontal) def lowercase_ ( ): lower...
87
import argparse snake_case : int = '''docs/source/_static/js/custom.js''' def __lowercase ( __lowerCAmelCase : Optional[Any] ): with open(__lowerCAmelCase , encoding='utf-8' , newline='\n' ) as f: a__ = f.readlin...
240
0
from collections.abc import Iterable from typing import Any class UpperCAmelCase_ : '''simple docstring''' def __init__( self : Optional[Any] , UpperCamelCase__ : int | None = None ) -> List[Any]: """simple docstring""" __...
88
from argparse import ArgumentParser from .env import EnvironmentCommand def __lowercase ( ): a__ = ArgumentParser('Diffusers CLI tool' , usage='diffusers-cli <command> [<args>]' ) a__ = parser.add_subparsers(help='diffusers-cli command helpers' ...
240
0
'''simple docstring''' import logging import os from typing import Dict, List, Optional, Union import torch import torch.nn as nn from accelerate.utils.imports import ( is_abit_bnb_available, is_abit_bnb_available, is_bnb_available, ) from ..big_modeling import dispatch_model, init_empty_weights fro...
89
import math def __lowercase ( __lowerCAmelCase : int ): a__ = [True] * n a__ = False a__ = False a__ = True for i in range(3 , int(n**0.5 + 1 ) , 2 ): a__ ...
240
0
from itertools import permutations def lowerCamelCase_ ( UpperCamelCase__ : tuple ) -> bool: """simple docstring""" if num[3] % 2 != 0: return False if (num[2] + num[3] + num[4]) % 3 != 0: return False if n...
90
def __lowercase ( __lowerCAmelCase : int , __lowerCAmelCase : float , __lowerCAmelCase : float ): return round(float(moles / volume ) * nfactor ) def __lowercase ( __lowerCAmelCase : float , __lowerCAmelCase : floa...
240
0
"""simple docstring""" import collections from typing import List, Optional, Union from ...tokenization_utils_base import BatchEncoding from ...utils import TensorType, add_end_docstrings, add_start_docstrings, logging from ..bert.tokenization_bert_fast import BertTokenizerFast from .tokenization_dpr impo...
91
import os import tempfile import unittest from pathlib import Path from transformers import AutoConfig, is_torch_available from transformers.testing_utils import require_torch, torch_device if is_torch_available(): from transformers import PyTorchBenchmark, PyTorchBenchmarkArguments @require_torch cl...
240
0
# Lint as: python3 import dataclasses import re from dataclasses import dataclass from functools import total_ordering from typing import Optional, Union UpperCamelCase__ = re.compile(R"""^(?P<major>\d+)""" R"""\.(?P<minor>\d+)""" R"""\.(?P<patch>\d+)$""") @total_ordering @dataclass class a__ : ...
92
import gc import unittest import numpy as np import torch from transformers import CLIPTextConfig, CLIPTextModel, CLIPTokenizer from diffusers import ( AutoencoderKL, DDIMScheduler, StableDiffusionAttendAndExcitePipeline, UNetaDConditionModel, ) from diffusers.utils import load_numpy, skip_mps, slo...
240
0
'''simple docstring''' import datetime import platform import subprocess from typing import Optional, Tuple, Union import numpy as np def snake_case_ ( __SCREAMING_SNAKE_CASE : bytes , __SCREAMING_SNAKE_CASE : int ): """simple docstring""" ...
93
import argparse import torch from transformers import GPTaConfig, GPTaModel, load_tf_weights_in_gpta from transformers.utils import CONFIG_NAME, WEIGHTS_NAME, logging logging.set_verbosity_info() def __lowercase ( __lowerCAmelCase : str , __lowerCAmelCase : Any , __...
240
0
from ...configuration_utils import PretrainedConfig from ...utils import logging snake_case : Tuple = logging.get_logger(__name__) snake_case : Dict = { '''transfo-xl-wt103''': '''https://huggingface.co/transfo-xl-wt103/resolve/main/config.json''', } class _sna...
94
def __lowercase ( __lowerCAmelCase : str , __lowerCAmelCase : str ): def get_matched_characters(__lowerCAmelCase : str , __lowerCAmelCase : str ) -> str: a__ = [] a__ = min(len(_stra )...
240
0
import unittest from transformers import AutoTokenizer, FalconConfig, is_torch_available from transformers.testing_utils import require_torch, slow, torch_device from ...generation.test_utils import GenerationTesterMixin from ...test_configuration_common import ConfigTester from ...test_modeling_co...
95
import coval # From: git+https://github.com/ns-moosavi/coval.git # noqa: F401 from coval.conll import reader, util from coval.eval import evaluator import datasets snake_case : List[Any] = datasets.logging.get_logger(__name__) snake_case : List[str] = '''\ @InPro...
240
0
"""simple docstring""" import csv import tweepy # Twitter API credentials lowercase__ = """""" lowercase__ = """""" lowercase__ = """""" lowercase__ = """""" def _snake_case ( lowercase__ ): # aut...
96
import copy from dataclasses import dataclass, field from typing import ClassVar, Dict from ..features import Audio, ClassLabel, Features from .base import TaskTemplate @dataclass(frozen=lowerCamelCase_ ) class snake_case_ (lowerCamelCase_ ): UpperCAmelCase__ : str = ...
240
0
'''simple docstring''' import PIL.Image import PIL.ImageOps from packaging import version from PIL import Image if version.parse(version.parse(PIL.__version__).base_version) >= version.parse('''9.1.0'''): __snake_case = { '''linear''': PIL.Image.Resampling.BILINEAR, '''bilinear''': PI...
97
import os import random import sys from . import cryptomath_module as cryptoMath # noqa: N812 from . import rabin_miller as rabinMiller # noqa: N812 def __lowercase ( ): print('Making key files...' ) make_key_files('rsa' , 1_0_2_4 ) print('Key files generation succes...
240
0
"""simple docstring""" import functools from typing import Any def a_ ( lowerCamelCase , lowerCamelCase ): # Validation if not isinstance(lowerCamelCase , lowerCamelCase ) or len(lowerCamelCase ) == 0: raise ValueError('the string should be not empty st...
98
from typing import TYPE_CHECKING from ...utils import OptionalDependencyNotAvailable, _LazyModule, is_tf_available, is_torch_available snake_case : str = { '''configuration_rag''': ['''RagConfig'''], '''retrieval_rag''': ['''RagRetriever'''], '''tokenization_rag''': ['''RagToke...
240
0
from typing import TYPE_CHECKING from ...utils import OptionalDependencyNotAvailable, _LazyModule, is_torch_available lowercase : List[Any] = { """configuration_timesformer""": ["""TIMESFORMER_PRETRAINED_CONFIG_ARCHIVE_MAP""", """TimesformerConfig"""], } try: if not is_torch_availa...
99
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, ) fro...
240
0
"""simple docstring""" # this script reports modified .py files under the desired list of top-level sub-dirs passed as a list of arguments, e.g.: # python ./utils/get_modified_files.py utils src tests examples # # it uses git to find the forking point and which files were modified - i.e. files not under git won...
100
import json import os import subprocess import unittest from ast import literal_eval import pytest from parameterized import parameterized_class from . import is_sagemaker_available if is_sagemaker_available(): from sagemaker import Session, TrainingJobAnalytics from sagemaker.huggingface import Hugg...
240
0
from typing import List, Optional, Union from ...configuration_utils import PretrainedConfig from ...utils import logging lowercase__ :Tuple = logging.get_logger(__name__) lowercase__ :int = { "huggingface/time-series-transformer-tourism-monthly": ( "https://huggingface.co/huggingface/time-...
101
import logging import re import pytorch_quantization import pytorch_quantization.nn as quant_nn import torch from pytorch_quantization import calib from pytorch_quantization.tensor_quant import QuantDescriptor snake_case : List[Any] = logging.getLogger(__name__) snake_case : O...
240
0
"""simple docstring""" import random def lowercase ( _snake_case : List[Any] , _snake_case : Union[str, Any] , _snake_case : Optional[int] ) ->int: """simple docstring""" __snake_case : List[str] = a[left_index] __snake_case : ...
102
import json from typing import List, Optional, Tuple from tokenizers import normalizers from ...tokenization_utils_fast import PreTrainedTokenizerFast from ...utils import logging from .tokenization_distilbert import DistilBertTokenizer snake_case : Dict = logging.get_logger(__name__) sn...
240
0
import unittest from diffusers import FlaxAutoencoderKL from diffusers.utils import is_flax_available from diffusers.utils.testing_utils import require_flax from .test_modeling_common_flax import FlaxModelTesterMixin if is_flax_available(): import jax @require_flax class __snake_case ( Upp...
103
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 from...
240
0
'''simple docstring''' def _A ( A__ ): """simple docstring""" if not grid or not grid[0]: raise TypeError('''The grid does not contain the appropriate information''' ) for cell_n in range(1 , len(grid[0] ) ): grid[0][cell_n] += grid[0][cell_n - 1] __lowercas...
104
from abc import ABC, abstractmethod from argparse import ArgumentParser class snake_case_ (lowerCamelCase_ ): @staticmethod @abstractmethod def lowerCamelCase__( __snake_case :ArgumentParser ) -> Dict: raise NotImplementedError() @abstractme...
240
0
"""simple docstring""" 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 a : Tuple = ( '''This metric will be...
105
import sys from .dependency_versions_table import deps from .utils.versions import require_version, require_version_core # define which module versions we always want to check at run time # (usually the ones defined in `install_requires` in setup.py) # # order specific notes: # - tqdm must be checked before token...
240
0
"""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 numpy as np import tensorflow as tf from tra...
106
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_ (lowerCamelCase_ , unittest.TestCase ): ...
240
0
import unittest import numpy as np import timeout_decorator # noqa from transformers import BlenderbotSmallConfig, is_flax_available from transformers.testing_utils import require_flax, slow from ...generation.test_flax_utils import FlaxGenerationTesterMixin from ...test_modeling_flax_common import FlaxModelTe...
107
def __lowercase ( __lowerCAmelCase : list[int] ): a__ = [] if len(__lowerCAmelCase ) == 1: return [nums.copy()] for _ in range(len(__lowerCAmelCase ) ): a__ = nums.pop(0 ) a__ = ...
240
0
"""simple docstring""" from scipy.stats import pearsonr, spearmanr from sklearn.metrics import fa_score, matthews_corrcoef import datasets lowerCAmelCase__ = '''\ @inproceedings{wang2019glue, title={{GLUE}: A Multi-Task Benchmark and Analysis Platform for Natural Language Understanding}, aut...
108
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 snake_case : Union[str, Any] = logging.get_logger(__name__) snake_case : ...
240
0
"""simple docstring""" import logging import os import sys from pathlib import Path from unittest.mock import patch from parameterized import parameterized from run_eval import run_generate from run_eval_search import run_search from transformers.testing_utils import CaptureStdout, TestCasePlus, slow from utils i...
109
import argparse snake_case : int = '''docs/source/_static/js/custom.js''' def __lowercase ( __lowerCAmelCase : Optional[Any] ): with open(__lowerCAmelCase , encoding='utf-8' , newline='\n' ) as f: a__ = f.readlin...
240
0
import math def _SCREAMING_SNAKE_CASE ( _lowerCamelCase : float , _lowerCamelCase : float) -> List[Any]: '''simple docstring''' if initial_intensity < 0: raise ValueError("The value of intensity cannot be negative") # ...
232
from argparse import ArgumentParser from .env import EnvironmentCommand def __lowercase ( ): a__ = ArgumentParser('Diffusers CLI tool' , usage='diffusers-cli <command> [<args>]' ) a__ = parser.add_subparsers(help='diffusers-cli command helpers' ...
240
0
"""simple docstring""" from ...configuration_utils import PretrainedConfig from ...utils import logging _a : Any= logging.get_logger(__name__) _a : Any= { '''microsoft/biogpt''': '''https://huggingface.co/microsoft/biogpt/resolve/main/config.json''', # See all BioGPT mo...
172
import math def __lowercase ( __lowerCAmelCase : int ): a__ = [True] * n a__ = False a__ = False a__ = True for i in range(3 , int(n**0.5 + 1 ) , 2 ): a__ ...
240
0
from typing import TYPE_CHECKING from ...utils import OptionalDependencyNotAvailable, _LazyModule, is_torch_available UpperCamelCase_ = { '''configuration_xlm_roberta_xl''': [ '''XLM_ROBERTA_XL_PRETRAINED_CONFIG_ARCHIVE_MAP''', '''XLMRobertaXLConfig''', '''XLMRobertaXLOnn...
345
def __lowercase ( __lowerCAmelCase : int , __lowerCAmelCase : float , __lowerCAmelCase : float ): return round(float(moles / volume ) * nfactor ) def __lowercase ( __lowerCAmelCase : float , __lowerCAmelCase : floa...
240
0
import os import sys import unittest lowerCAmelCase : List[Any] = 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_dummies # noqa: E402 from check_dummies import create_dummy_files, create_dummy_object, f...
253
import os import tempfile import unittest from pathlib import Path from transformers import AutoConfig, is_torch_available from transformers.testing_utils import require_torch, torch_device if is_torch_available(): from transformers import PyTorchBenchmark, PyTorchBenchmarkArguments @require_torch cl...
240
0
import os from shutil import copyfile from typing import Any, Dict, List, Optional, Tuple import sentencepiece as spm from ...tokenization_utils import AddedToken, BatchEncoding, PreTrainedTokenizer from ...utils import logging A__ : int = logging.get_logger(__name__) A__ : List[str] = '''▁'''...
207
import gc import unittest import numpy as np import torch from transformers import CLIPTextConfig, CLIPTextModel, CLIPTokenizer from diffusers import ( AutoencoderKL, DDIMScheduler, StableDiffusionAttendAndExcitePipeline, UNetaDConditionModel, ) from diffusers.utils import load_numpy, skip_mps, slo...
240
0
'''simple docstring''' import unittest from transformers import PegasusConfig, PegasusTokenizer, is_flax_available from transformers.testing_utils import require_flax, slow from ...test_configuration_common import ConfigTester from ...test_modeling_flax_common import FlaxModelTesterMixin, ids_t...
93
import argparse import torch from transformers import GPTaConfig, GPTaModel, load_tf_weights_in_gpta from transformers.utils import CONFIG_NAME, WEIGHTS_NAME, logging logging.set_verbosity_info() def __lowercase ( __lowerCAmelCase : str , __lowerCAmelCase : Any , __...
240
0
'''simple docstring''' from typing import TYPE_CHECKING from ...utils import OptionalDependencyNotAvailable, _LazyModule, is_tf_available, is_torch_available __A ={ '''configuration_rag''': ['''RagConfig'''], '''retrieval_rag''': ['''RagRetriever'''], '''tokenization_rag''': ['''Rag...
163
def __lowercase ( __lowerCAmelCase : str , __lowerCAmelCase : str ): def get_matched_characters(__lowerCAmelCase : str , __lowerCAmelCase : str ) -> str: a__ = [] a__ = min(len(_stra )...
240
0
import sys import tempfile import unittest import unittest.mock as mock from pathlib import Path from huggingface_hub import HfFolder, delete_repo from requests.exceptions import HTTPError from transformers import AutoFeatureExtractor, WavaVecaFeatureExtractor from transformers.testing_utils import TOKEN, USER, g...
128
import coval # From: git+https://github.com/ns-moosavi/coval.git # noqa: F401 from coval.conll import reader, util from coval.eval import evaluator import datasets snake_case : List[Any] = datasets.logging.get_logger(__name__) snake_case : List[str] = '''\ @InPro...
240
0
import unittest from transformers import DebertaConfig, is_torch_available from transformers.testing_utils import require_sentencepiece, require_tokenizers, require_torch, slow, torch_device from ...test_configuration_common import ConfigTester from ...test_modeling_common import ModelTesterMixin, ids_tensor ...
30
import copy from dataclasses import dataclass, field from typing import ClassVar, Dict from ..features import Audio, ClassLabel, Features from .base import TaskTemplate @dataclass(frozen=lowerCamelCase_ ) class snake_case_ (lowerCamelCase_ ): UpperCAmelCase__ : str = ...
240
0
from ..utils import DummyObject, requires_backends class __UpperCAmelCase (metaclass=lowerCamelCase_ ): __snake_case : int = ['''flax''', '''transformers'''] def __init__( self: Tuple , *UpperCAmelCase_: Optional[Any] , **UpperCAmelCas...
306
import os import random import sys from . import cryptomath_module as cryptoMath # noqa: N812 from . import rabin_miller as rabinMiller # noqa: N812 def __lowercase ( ): print('Making key files...' ) make_key_files('rsa' , 1_0_2_4 ) print('Key files generation succes...
240
0
import re from flax.core.frozen_dict import freeze from flax.traverse_util import flatten_dict, unflatten_dict from jax.experimental import PartitionSpec as P # Sentinels _A = object() # For specifying empty leaf dict `{}` _A = object() def lowerCamelCase__ ( a__ : List[Any] , ...
122
from typing import TYPE_CHECKING from ...utils import OptionalDependencyNotAvailable, _LazyModule, is_tf_available, is_torch_available snake_case : str = { '''configuration_rag''': ['''RagConfig'''], '''retrieval_rag''': ['''RagRetriever'''], '''tokenization_rag''': ['''RagToke...
240
0
lowercase : Optional[Any] = { '''A''': '''.-''', '''B''': '''-...''', '''C''': '''-.-.''', '''D''': '''-..''', '''E''': '''.''', '''F''': '''..-.''', '''G''': '''--.''', '''H''': '''....''', '''I''': '''..''', '''J''': '''.---''', '''K''': '''-.-''', '''L''': '''.-..''', '''M''': '''-...
232
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, ) fro...
240
0
"""simple docstring""" from __future__ import annotations from math import ceil, floor, sqrt def __UpperCAmelCase ( UpperCAmelCase_ : int = 2_00_00_00 ) -> List[str]: '''simple docstring''' __snake_case : str = [0] __snake_case : int ...
172
import json import os import subprocess import unittest from ast import literal_eval import pytest from parameterized import parameterized_class from . import is_sagemaker_available if is_sagemaker_available(): from sagemaker import Session, TrainingJobAnalytics from sagemaker.huggingface import Hugg...
240
0
import argparse import json from pathlib import Path import requests import torch from huggingface_hub import hf_hub_download from PIL import Image from transformers import ( MobileViTConfig, MobileViTForImageClassification, MobileViTForSemanticSegmentation, MobileViTImageProcessor, ) from transfo...
345
import logging import re import pytorch_quantization import pytorch_quantization.nn as quant_nn import torch from pytorch_quantization import calib from pytorch_quantization.tensor_quant import QuantDescriptor snake_case : List[Any] = logging.getLogger(__name__) snake_case : O...
240
0
import unittest from transformers import ( MODEL_FOR_SEQUENCE_CLASSIFICATION_MAPPING, TF_MODEL_FOR_SEQUENCE_CLASSIFICATION_MAPPING, Pipeline, ZeroShotClassificationPipeline, pipeline, ) from transformers.testing_utils import is_pipeline_test, nested_simplify, require_tf, require_torch, slow from...
253
import json from typing import List, Optional, Tuple from tokenizers import normalizers from ...tokenization_utils_fast import PreTrainedTokenizerFast from ...utils import logging from .tokenization_distilbert import DistilBertTokenizer snake_case : Dict = logging.get_logger(__name__) sn...
240
0
import os import tempfile import unittest from transformers import FlaubertConfig, is_torch_available from transformers.testing_utils import require_torch, require_torch_gpu, slow, torch_device from ...test_configuration_common import ConfigTester from ...test_modeling_common import ModelTesterMixin, ids_tenso...
207
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 from...
240
0
'''simple docstring''' from dataclasses import dataclass from typing import Dict, Optional, Union import torch import torch.nn.functional as F from torch import nn from ..configuration_utils import ConfigMixin, register_to_config from ..utils import BaseOutput from .attention import BasicTra...
93
from abc import ABC, abstractmethod from argparse import ArgumentParser class snake_case_ (lowerCamelCase_ ): @staticmethod @abstractmethod def lowerCamelCase__( __snake_case :ArgumentParser ) -> Dict: raise NotImplementedError() @abstractme...
240
0
'''simple docstring''' from typing import TYPE_CHECKING from ...utils import ( OptionalDependencyNotAvailable, _LazyModule, is_tf_available, is_tokenizers_available, is_torch_available, is_vision_available, ) __A ={ '''configuration_layoutlmv3''': [ '''...
163
import sys from .dependency_versions_table import deps from .utils.versions import require_version, require_version_core # define which module versions we always want to check at run time # (usually the ones defined in `install_requires` in setup.py) # # order specific notes: # - tqdm must be checked before token...
240
0
from ...configuration_utils import PretrainedConfig from ...utils import logging UpperCAmelCase : Tuple =logging.get_logger(__name__) UpperCAmelCase : Union[str, Any] ={ '''bigcode/gpt_bigcode-santacoder''': '''https://huggingface.co/bigcode/gpt_bigcode-santaco...
128
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_ (lowerCamelCase_ , unittest.TestCase ): ...
240
0
from typing import Optional, Tuple, Union import torch from einops import rearrange, reduce from diffusers import DDIMScheduler, DDPMScheduler, DiffusionPipeline, ImagePipelineOutput, UNetaDConditionModel from diffusers.schedulers.scheduling_ddim import DDIMSchedulerOutput from diffusers.schedulers.schedulin...
30
def __lowercase ( __lowerCAmelCase : list[int] ): a__ = [] if len(__lowerCAmelCase ) == 1: return [nums.copy()] for _ in range(len(__lowerCAmelCase ) ): a__ = nums.pop(0 ) a__ = ...
240
0
import unittest import numpy as np from transformers.testing_utils import require_torch, require_vision from transformers.utils import is_torch_available, is_vision_available from ...test_image_processing_common import ImageProcessingSavingTestMixin, prepare_image_inputs if is_torch_availab...
306
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 snake_case : Union[str, Any] = logging.get_logger(__name__) snake_case : ...
240
0
import coval # From: git+https://github.com/ns-moosavi/coval.git # noqa: F401 from coval.conll import reader, util from coval.eval import evaluator import datasets _A = datasets.logging.get_logger(__name__) _A = '''\ @InProceedings{moosavi2019minimum, author = { Nafise Sadat Moosavi, Leo Bo...
122
import argparse snake_case : int = '''docs/source/_static/js/custom.js''' def __lowercase ( __lowerCAmelCase : Optional[Any] ): with open(__lowerCAmelCase , encoding='utf-8' , newline='\n' ) as f: a__ = f.readlin...
240
0
import argparse import gdown import numpy as np import torch from huggingface_hub import hf_hub_download from transformers import ( CLIPTokenizer, CLIPTokenizerFast, VideoMAEImageProcessor, XCLIPConfig, XCLIPModel, XCLIPProcessor, XCLIPTextConfig, XCLIPVisionConfig, )...
232
from argparse import ArgumentParser from .env import EnvironmentCommand def __lowercase ( ): a__ = ArgumentParser('Diffusers CLI tool' , usage='diffusers-cli <command> [<args>]' ) a__ = parser.add_subparsers(help='diffusers-cli command helpers' ...
240
0
"""simple docstring""" import string import numpy def __UpperCAmelCase ( UpperCAmelCase_ : int , UpperCAmelCase_ : int ) -> Tuple: '''simple docstring''' return b if a == 0 else greatest_common_divisor(b % a , __lowerCAmelCase ) class ...
172
import math def __lowercase ( __lowerCAmelCase : int ): a__ = [True] * n a__ = False a__ = False a__ = True for i in range(3 , int(n**0.5 + 1 ) , 2 ): a__ ...
240
0
from typing import TYPE_CHECKING from ...utils import ( OptionalDependencyNotAvailable, _LazyModule, is_flax_available, is_tf_available, is_torch_available, ) UpperCamelCase_ = { '''configuration_resnet''': ['''RESNET_PRETRAINED_CONFIG_ARCHIVE_MAP''', '''ResNetConfig''', '''R...
345
def __lowercase ( __lowerCAmelCase : int , __lowerCAmelCase : float , __lowerCAmelCase : float ): return round(float(moles / volume ) * nfactor ) def __lowercase ( __lowerCAmelCase : float , __lowerCAmelCase : floa...
240
0
import unittest from transformers import 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, ids_tensor from ...
253
import os import tempfile import unittest from pathlib import Path from transformers import AutoConfig, is_torch_available from transformers.testing_utils import require_torch, torch_device if is_torch_available(): from transformers import PyTorchBenchmark, PyTorchBenchmarkArguments @require_torch cl...
240
0
from typing import TYPE_CHECKING from ...utils import ( OptionalDependencyNotAvailable, _LazyModule, is_tokenizers_available, is_torch_available, is_vision_available, ) A__ : Any = { '''configuration_layoutlmv2''': ['''LAYOUTLMV2_PRETRAINED_CONFIG_ARCHIVE_MAP''', '''LayoutLMv2Co...
207
import gc import unittest import numpy as np import torch from transformers import CLIPTextConfig, CLIPTextModel, CLIPTokenizer from diffusers import ( AutoencoderKL, DDIMScheduler, StableDiffusionAttendAndExcitePipeline, UNetaDConditionModel, ) from diffusers.utils import load_numpy, skip_mps, slo...
240
0
'''simple docstring''' from __future__ import annotations def snake_case_ ( __SCREAMING_SNAKE_CASE : str , __SCREAMING_SNAKE_CASE : list[str] | None = None , __SCREAMING_SNAKE_CASE : dict[str, float] | None = None , __SCREAMING_SNAKE_CASE : bool =...
93
import argparse import torch from transformers import GPTaConfig, GPTaModel, load_tf_weights_in_gpta from transformers.utils import CONFIG_NAME, WEIGHTS_NAME, logging logging.set_verbosity_info() def __lowercase ( __lowerCAmelCase : str , __lowerCAmelCase : Any , __...
240
0
'''simple docstring''' from typing import TYPE_CHECKING from ...utils import OptionalDependencyNotAvailable, _LazyModule, is_torch_available __A ={ '''configuration_lilt''': ['''LILT_PRETRAINED_CONFIG_ARCHIVE_MAP''', '''LiltConfig'''], } try: if not is_torch_available(): raise Opt...
163
def __lowercase ( __lowerCAmelCase : str , __lowerCAmelCase : str ): def get_matched_characters(__lowerCAmelCase : str , __lowerCAmelCase : str ) -> str: a__ = [] a__ = min(len(_stra )...
240
0
import copy from dataclasses import dataclass, field from typing import ClassVar, Dict from ..features import Audio, ClassLabel, Features from .base import TaskTemplate @dataclass(frozen=lowerCamelCase_ ) class _lowercase (lowerCamelCase_ ): '''simple docstring''' lowercase__ ...
128
import coval # From: git+https://github.com/ns-moosavi/coval.git # noqa: F401 from coval.conll import reader, util from coval.eval import evaluator import datasets snake_case : List[Any] = datasets.logging.get_logger(__name__) snake_case : List[str] = '''\ @InPro...
240
0
from typing import List, Optional from ...configuration_utils import PretrainedConfig from ...utils import logging __a = logging.get_logger(__name__) __a = { '''huggingface/autoformer-tourism-monthly''': '''https://huggingface.co/huggingface/autoformer-tourism-monthly/resolve/main/con...
30
import copy from dataclasses import dataclass, field from typing import ClassVar, Dict from ..features import Audio, ClassLabel, Features from .base import TaskTemplate @dataclass(frozen=lowerCamelCase_ ) class snake_case_ (lowerCamelCase_ ): UpperCAmelCase__ : str = ...
240
0
from typing import Dict import numpy as np import torch from . import residue_constants as rc from .tensor_utils import tensor_tree_map, tree_map def __lowerCamelCase ( snake_case__ ) -> List[str]: """simple docstring""" _SCREAMING_SNAKE_CAS...
306
import os import random import sys from . import cryptomath_module as cryptoMath # noqa: N812 from . import rabin_miller as rabinMiller # noqa: N812 def __lowercase ( ): print('Making key files...' ) make_key_files('rsa' , 1_0_2_4 ) print('Key files generation succes...
240
0
import gc import random import unittest import numpy as np import torch from transformers import CLIPTextConfig, CLIPTextModel, CLIPTextModelWithProjection, CLIPTokenizer from diffusers import ( AutoencoderKL, DiffusionPipeline, EulerDiscreteScheduler, StableDiffusionXLImgaImgPipeline, UNetaDCond...
122
from typing import TYPE_CHECKING from ...utils import OptionalDependencyNotAvailable, _LazyModule, is_tf_available, is_torch_available snake_case : str = { '''configuration_rag''': ['''RagConfig'''], '''retrieval_rag''': ['''RagRetriever'''], '''tokenization_rag''': ['''RagToke...
240
0
import math def _SCREAMING_SNAKE_CASE ( _lowerCamelCase : int) -> Any: '''simple docstring''' __UpperCamelCase : str = [True] * n __UpperCamelCase : List[str] = False __UpperCamelCase : Union[str, Any] = Fal...
232
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, ) fro...
240
0
"""simple docstring""" from typing import Optional import numpy as np import torch from torch import nn from transformers import GPTaConfig, GPTaLMHeadModel from transformers.modeling_utils import ModuleUtilsMixin from ...configuration_utils import ConfigMixin, register_to_config from ...model...
172
import json import os import subprocess import unittest from ast import literal_eval import pytest from parameterized import parameterized_class from . import is_sagemaker_available if is_sagemaker_available(): from sagemaker import Session, TrainingJobAnalytics from sagemaker.huggingface import Hugg...
240
0
import os import tempfile import unittest from pathlib import Path from transformers import AutoConfig, is_tf_available from transformers.testing_utils import require_tf if is_tf_available(): import tensorflow as tf from transformers import TensorFlowBenchmark, TensorFlowBenchmarkArguments @r...
345
import logging import re import pytorch_quantization import pytorch_quantization.nn as quant_nn import torch from pytorch_quantization import calib from pytorch_quantization.tensor_quant import QuantDescriptor snake_case : List[Any] = logging.getLogger(__name__) snake_case : O...
240
0
import argparse from typing import Dict import tensorflow as tf import torch from tqdm import tqdm from transformers import BigBirdPegasusConfig, BigBirdPegasusForConditionalGeneration lowerCAmelCase : Tuple = [ # tf -> hf ('''/''', '''.'''), ('''layer_''', '''layers.'''), ('''kerne...
253
import json from typing import List, Optional, Tuple from tokenizers import normalizers from ...tokenization_utils_fast import PreTrainedTokenizerFast from ...utils import logging from .tokenization_distilbert import DistilBertTokenizer snake_case : Dict = logging.get_logger(__name__) sn...
240
0
from __future__ import annotations from collections.abc import Callable A__ : List[str] = list[list[float | int]] def a ( lowerCamelCase_ , lowerCamelCase_ ): '''simple docstring''' lowercase__ = len(__lowerCAmelCase ) lowercase__ = [[0 for _ in range(...
207
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 from...
240
0
'''simple docstring''' import logging import random import ray from transformers import RagConfig, RagRetriever, RagTokenizer from transformers.models.rag.retrieval_rag import CustomHFIndex _lowercase : Any = logging.getLogger(__name__) class lowerCAmelCase__...
93
from abc import ABC, abstractmethod from argparse import ArgumentParser class snake_case_ (lowerCamelCase_ ): @staticmethod @abstractmethod def lowerCamelCase__( __snake_case :ArgumentParser ) -> Dict: raise NotImplementedError() @abstractme...
240
0
'''simple docstring''' from multiprocessing import Lock, Pipe, Process # lock used to ensure that two processes do not access a pipe at the same time __A =Lock() def _UpperCamelCase ( UpperCamelCase__ , UpperCamelCase__ , UpperCamelCase__ , Uppe...
163
import sys from .dependency_versions_table import deps from .utils.versions import require_version, require_version_core # define which module versions we always want to check at run time # (usually the ones defined in `install_requires` in setup.py) # # order specific notes: # - tqdm must be checked before token...
240
0
from __future__ import annotations def _lowerCAmelCase (_lowerCAmelCase): UpperCamelCase_ = str(__lowerCAmelCase) return n == n[::-1] def _lowerCAmelCase (_lowerCAmelCase = 1_00_00_00): UpperCamelCase_ = 0 for i in range(1 , __lowerCAmel...
128
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_ (lowerCamelCase_ , unittest.TestCase ): ...
240
0
import argparse import json from pathlib import Path import requests import torch from huggingface_hub import hf_hub_download from PIL import Image from transformers import ( SwiftFormerConfig, SwiftFormerForImageClassification, ViTImageProcessor, ) from transformers.utils import logging ...
30
def __lowercase ( __lowerCAmelCase : list[int] ): a__ = [] if len(__lowerCAmelCase ) == 1: return [nums.copy()] for _ in range(len(__lowerCAmelCase ) ): a__ = nums.pop(0 ) a__ = ...
240
0
import sacrebleu as scb from packaging import version from sacrebleu import CHRF import datasets UpperCamelCase = '''\ @inproceedings{popovic-2015-chrf, title = "chr{F}: character n-gram {F}-score for automatic {MT} evaluation", author = "Popovi{\'c}, Maja", booktitle = "Proceedi...
306
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 snake_case : Union[str, Any] = logging.get_logger(__name__) snake_case : ...
240
0
def lowerCamelCase__ ( a__ : str , a__ : str ) -> List[Any]: UpperCamelCase_ = len(__lowerCAmelCase ) UpperCamelCase_ = len(__lowerCAmelCase ) UpperCamelCase_ = ( first_str_length if first_str_length > second_str_...
122
import argparse snake_case : int = '''docs/source/_static/js/custom.js''' def __lowercase ( __lowerCAmelCase : Optional[Any] ): with open(__lowerCAmelCase , encoding='utf-8' , newline='\n' ) as f: a__ = f.readlin...
240
0
import json import pathlib import unittest import numpy as np from transformers.testing_utils import require_torch, require_vision, slow from transformers.utils import is_torch_available, is_vision_available from ...test_image_processing_common import ImageProcessingSavingTestMixin, prepare_image_inputs ...
232
from argparse import ArgumentParser from .env import EnvironmentCommand def __lowercase ( ): a__ = ArgumentParser('Diffusers CLI tool' , usage='diffusers-cli <command> [<args>]' ) a__ = parser.add_subparsers(help='diffusers-cli command helpers' ...
240
0
"""simple docstring""" def __UpperCAmelCase ( UpperCAmelCase_ : list[int] ) -> Dict: '''simple docstring''' __snake_case : Optional[Any] = [] if len(__lowerCAmelCase ) == 1: return [nums.copy()] for _ in range(len(__lowerCAmelCase ) ): __...
172
import math def __lowercase ( __lowerCAmelCase : int ): a__ = [True] * n a__ = False a__ = False a__ = True for i in range(3 , int(n**0.5 + 1 ) , 2 ): a__ ...
240
0
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, UNetTesterMixin Uppe...
345
def __lowercase ( __lowerCAmelCase : int , __lowerCAmelCase : float , __lowerCAmelCase : float ): return round(float(moles / volume ) * nfactor ) def __lowercase ( __lowerCAmelCase : float , __lowerCAmelCase : floa...
240
0
from typing import TYPE_CHECKING from ...utils import ( OptionalDependencyNotAvailable, _LazyModule, is_tf_available, is_tokenizers_available, is_torch_available, ) lowerCAmelCase : List[str] = { '''configuration_deberta''': ['''DEBERTA_PRETRAINED_CONFIG_ARCHIVE_MAP''', '''De...
253
import os import tempfile import unittest from pathlib import Path from transformers import AutoConfig, is_torch_available from transformers.testing_utils import require_torch, torch_device if is_torch_available(): from transformers import PyTorchBenchmark, PyTorchBenchmarkArguments @require_torch cl...
240
0
def a ( lowerCamelCase_ , lowerCamelCase_ , lowerCamelCase_ ): '''simple docstring''' return round(float(moles / volume ) * nfactor ) def a ( lowerCamelCase_ , lowerCamelCase_ , lowerCamelCase_ ): '''simple docstring''' return round(floa...
207
import gc import unittest import numpy as np import torch from transformers import CLIPTextConfig, CLIPTextModel, CLIPTokenizer from diffusers import ( AutoencoderKL, DDIMScheduler, StableDiffusionAttendAndExcitePipeline, UNetaDConditionModel, ) from diffusers.utils import load_numpy, skip_mps, slo...
240
0
'''simple docstring''' import logging import re import pytorch_quantization import pytorch_quantization.nn as quant_nn import torch from pytorch_quantization import calib from pytorch_quantization.tensor_quant import QuantDescriptor _lowercase : List[Any] = logging.getLogg...
93
import argparse import torch from transformers import GPTaConfig, GPTaModel, load_tf_weights_in_gpta from transformers.utils import CONFIG_NAME, WEIGHTS_NAME, logging logging.set_verbosity_info() def __lowercase ( __lowerCAmelCase : str , __lowerCAmelCase : Any , __...
240
0
'''simple docstring''' def _UpperCamelCase ( UpperCamelCase__ = 6_0_0_8_5_1_4_7_5_1_4_3 ): try: UpperCAmelCase__ : List[Any] = int(__lowerCAmelCase ) except (TypeError, ValueError): raise TypeError("""Parameter n must be int or castable to int.""" ...
163
def __lowercase ( __lowerCAmelCase : str , __lowerCAmelCase : str ): def get_matched_characters(__lowerCAmelCase : str , __lowerCAmelCase : str ) -> str: a__ = [] a__ = min(len(_stra )...
240
0
import argparse import io import requests import torch from omegaconf import OmegaConf from diffusers import AutoencoderKL from diffusers.pipelines.stable_diffusion.convert_from_ckpt import ( assign_to_checkpoint, conv_attn_to_linear, create_vae_diffusers_config, renew_vae_attention_paths, ren...
128
import coval # From: git+https://github.com/ns-moosavi/coval.git # noqa: F401 from coval.conll import reader, util from coval.eval import evaluator import datasets snake_case : List[Any] = datasets.logging.get_logger(__name__) snake_case : List[str] = '''\ @InPro...
240
0
from functools import reduce __a = ( '''73167176531330624919225119674426574742355349194934''' '''96983520312774506326239578318016984801869478851843''' '''85861560789112949495459501737958331952853208805511''' '''12540698747158523863050715693290963295227443043557''' '''66896648950445...
30
import copy from dataclasses import dataclass, field from typing import ClassVar, Dict from ..features import Audio, ClassLabel, Features from .base import TaskTemplate @dataclass(frozen=lowerCamelCase_ ) class snake_case_ (lowerCamelCase_ ): UpperCAmelCase__ : str = ...
240
0
import warnings from ...utils import logging from .image_processing_deit import DeiTImageProcessor UpperCamelCase = logging.get_logger(__name__) class __UpperCAmelCase (lowerCamelCase_ ): def __init__( self: Tuple , *UpperCAmelCase_: List[str] , ...
306
import os import random import sys from . import cryptomath_module as cryptoMath # noqa: N812 from . import rabin_miller as rabinMiller # noqa: N812 def __lowercase ( ): print('Making key files...' ) make_key_files('rsa' , 1_0_2_4 ) print('Key files generation succes...
240
0
import gc import unittest import numpy as np import torch from transformers import CLIPTextConfig, CLIPTextModel, CLIPTokenizer from diffusers import ( AutoencoderKL, DDIMScheduler, StableDiffusionAttendAndExcitePipeline, UNetaDConditionModel, ) from diffusers.utils import load_numpy, skip_mps, slow ...
122
from typing import TYPE_CHECKING from ...utils import OptionalDependencyNotAvailable, _LazyModule, is_tf_available, is_torch_available snake_case : str = { '''configuration_rag''': ['''RagConfig'''], '''retrieval_rag''': ['''RagRetriever'''], '''tokenization_rag''': ['''RagToke...
240
0
from .constants import ( MODEL_NAME, OPTIMIZER_NAME, RNG_STATE_NAME, SAFE_WEIGHTS_INDEX_NAME, SAFE_WEIGHTS_NAME, SCALER_NAME, SCHEDULER_NAME, TORCH_LAUNCH_PARAMS, WEIGHTS_INDEX_NAME, WEIGHTS_NAME, ) from .dataclasses import ( BnbQuantizationConfig, Compute...
232
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, ) fro...
240
0
"""simple docstring""" import logging import os import threading import time try: import warnings except ImportError: _a : Optional[int]= None try: import msvcrt except ImportError: _a : Dict= None try: import fcntl except ImportError: _a : List[Any]= ...
172
import json import os import subprocess import unittest from ast import literal_eval import pytest from parameterized import parameterized_class from . import is_sagemaker_available if is_sagemaker_available(): from sagemaker import Session, TrainingJobAnalytics from sagemaker.huggingface import Hugg...
240
0
import gc import unittest import numpy as np import torch from diffusers import ( AudioDiffusionPipeline, AutoencoderKL, DDIMScheduler, DDPMScheduler, DiffusionPipeline, Mel, UNetaDConditionModel, UNetaDModel, ) from diffusers.utils import slow, torch_device from diffusers.utils.te...
345
import logging import re import pytorch_quantization import pytorch_quantization.nn as quant_nn import torch from pytorch_quantization import calib from pytorch_quantization.tensor_quant import QuantDescriptor snake_case : List[Any] = logging.getLogger(__name__) snake_case : O...
240
0
def A_ ( a = 1_0_0 ): """simple docstring""" SCREAMING_SNAKE_CASE_ : List[str] = set() SCREAMING_SNAKE_CASE_ : Tuple = 0 SCREAMING_SNAKE_CASE_ : Optional[Any] = n + 1 # maximum limit for a in range(2 , __lowerCAmelCa...
253
import json from typing import List, Optional, Tuple from tokenizers import normalizers from ...tokenization_utils_fast import PreTrainedTokenizerFast from ...utils import logging from .tokenization_distilbert import DistilBertTokenizer snake_case : Dict = logging.get_logger(__name__) sn...
240
0
from typing import TYPE_CHECKING from ....utils import OptionalDependencyNotAvailable, _LazyModule, is_torch_available A__ : Tuple = { '''configuration_trajectory_transformer''': [ '''TRAJECTORY_TRANSFORMER_PRETRAINED_CONFIG_ARCHIVE_MAP''', '''TrajectoryTransformerConfig''', ], ...
207
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 from...
240
0
'''simple docstring''' import argparse _lowercase : int = '''docs/source/_static/js/custom.js''' def snake_case_ ( __SCREAMING_SNAKE_CASE : Optional[Any] ): """simple docstring""" with open(__lowerCAmelCase , encoding='''...
93
from abc import ABC, abstractmethod from argparse import ArgumentParser class snake_case_ (lowerCamelCase_ ): @staticmethod @abstractmethod def lowerCamelCase__( __snake_case :ArgumentParser ) -> Dict: raise NotImplementedError() @abstractme...
240
0
'''simple docstring''' import math def _UpperCamelCase ( UpperCamelCase__ ): assert isinstance(__lowerCAmelCase , __lowerCAmelCase ) and ( number >= 0 ), "'number' must been an int and positive" if 1 < number < 4: # 2 and 3 are primes ...
163
import sys from .dependency_versions_table import deps from .utils.versions import require_version, require_version_core # define which module versions we always want to check at run time # (usually the ones defined in `install_requires` in setup.py) # # order specific notes: # - tqdm must be checked before token...
240
0
import itertools import random import unittest import numpy as np from transformers import WAV_2_VEC_2_PRETRAINED_MODEL_ARCHIVE_LIST, WavaVecaConfig, WavaVecaFeatureExtractor from transformers.testing_utils import require_torch, slow from ...test_sequence_feature_extraction_common import SequenceFeatureExtractio...
128
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_ (lowerCamelCase_ , unittest.TestCase ): ...
240
0
__a = '''Tobias Carryer''' from time import time class lowercase__: """simple docstring""" def __init__( self : List[str] , SCREAMING_SNAKE_CASE_ : Optional[int] , SCREAMING_SNAKE_CASE_ : Optional[int] , SCREAMING_SNAKE_CASE_ : List[...
30
def __lowercase ( __lowerCAmelCase : list[int] ): a__ = [] if len(__lowerCAmelCase ) == 1: return [nums.copy()] for _ in range(len(__lowerCAmelCase ) ): a__ = nums.pop(0 ) a__ = ...
240
0
import os import tempfile import unittest from pathlib import Path from transformers import AutoConfig, is_torch_available from transformers.testing_utils import require_torch, torch_device if is_torch_available(): from transformers import PyTorchBenchmark, PyTorchBenchmarkArguments ...
306
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 snake_case : Union[str, Any] = logging.get_logger(__name__) snake_case : ...
240
0
def lowerCamelCase__ ( ) -> Optional[int]: return [list(range(1000 - i , -1000 - i , -1 ) ) for i in range(1000 )] _A = generate_large_matrix() _A = ( [[4, 3, 2, -1], [3, 2, 1, -1], [1, 1, -1, -2], [-1, -1, -2, -3]], [[3, 2], [1, 0]], [[7, 7, 6]], [[7,...
122
import argparse snake_case : int = '''docs/source/_static/js/custom.js''' def __lowercase ( __lowerCAmelCase : Optional[Any] ): with open(__lowerCAmelCase , encoding='utf-8' , newline='\n' ) as f: a__ = f.readlin...
240
0
from dataclasses import dataclass from typing import Tuple import numpy as np import torch @dataclass class lowerCamelCase__ : '''simple docstring''' _A = 42 # [batch_size x 3] _A = 42 # [batch_size x 3] _A = 42 # [batch_size x 3] _A ...
232
from argparse import ArgumentParser from .env import EnvironmentCommand def __lowercase ( ): a__ = ArgumentParser('Diffusers CLI tool' , usage='diffusers-cli <command> [<args>]' ) a__ = parser.add_subparsers(help='diffusers-cli command helpers' ...
240
0
"""simple docstring""" import json import os import shutil import tempfile import unittest import numpy as np from transformers import BertTokenizerFast from transformers.models.bert.tokenization_bert import VOCAB_FILES_NAMES, BertTokenizer from transformers.testing_utils import require_token...
172
import math def __lowercase ( __lowerCAmelCase : int ): a__ = [True] * n a__ = False a__ = False a__ = True for i in range(3 , int(n**0.5 + 1 ) , 2 ): a__ ...
240
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 fro...
345
def __lowercase ( __lowerCAmelCase : int , __lowerCAmelCase : float , __lowerCAmelCase : float ): return round(float(moles / volume ) * nfactor ) def __lowercase ( __lowerCAmelCase : float , __lowerCAmelCase : floa...
240
0
from __future__ import annotations from typing import Any class _A ( lowerCamelCase_): pass class _A : def __init__( self , _SCREAMING_SNAKE_CASE ): """simple docstring""" SCREAMING_SNAKE_CASE_ : int = data SCREAMING_SNAKE_...
253
import os import tempfile import unittest from pathlib import Path from transformers import AutoConfig, is_torch_available from transformers.testing_utils import require_torch, torch_device if is_torch_available(): from transformers import PyTorchBenchmark, PyTorchBenchmarkArguments @require_torch cl...
240
0
import argparse import requests import torch # pip3 install salesforce-lavis # I'm actually installing a slightly modified version: pip3 install git+https://github.com/nielsrogge/LAVIS.git@fix_lavis from lavis.models import load_model_and_preprocess from PIL import Image from transformers import ( AutoTok...
207
import gc import unittest import numpy as np import torch from transformers import CLIPTextConfig, CLIPTextModel, CLIPTokenizer from diffusers import ( AutoencoderKL, DDIMScheduler, StableDiffusionAttendAndExcitePipeline, UNetaDConditionModel, ) from diffusers.utils import load_numpy, skip_mps, slo...
240
0