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
# 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't be considered # since ...
82
import argparse import glob import logging import os import sys import time from collections import defaultdict from pathlib import Path from typing import Dict, List, Tuple import numpy as np import pytorch_lightning as pl import torch from callbacks import SeqaSeqLoggingCallback, get_checkpoint_callback, get_ear...
82
1
from pathlib import Path import numpy as np from PIL import Image def lowerCAmelCase__ ( lowerCamelCase_ : np.ndarray): '''simple docstring''' lowerCAmelCase__ , lowerCAmelCase__ , lowerCAmelCase__ : Any = rgb[:, :, 0], rgb[:, :, 1], rgb[:, :, 2] ...
94
def lowerCAmelCase__ ( lowerCamelCase_ : int = 1000): '''simple docstring''' lowerCAmelCase__ , lowerCAmelCase__ : int = 1, 1 lowerCAmelCase__ : Any = 2 while True: lowerCAmelCase__ : Optional[Any] = 0 ...
94
1
'''simple docstring''' 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__ ...
181
'''simple docstring''' import json import os import shutil import tempfile import unittest from multiprocessing import get_context from pathlib import Path import datasets import numpy as np from datasets import load_dataset from parameterized import parameterized from transformers import AutoProc...
181
1
"""simple docstring""" import logging import random import ray from transformers import RagConfig, RagRetriever, RagTokenizer from transformers.models.rag.retrieval_rag import CustomHFIndex lowerCamelCase = logging.getLogger(__name__) class lowercase__ : ...
241
"""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, ) ...
241
1
import inspect import os import unittest from pathlib import Path import torch import accelerate from accelerate.test_utils import execute_subprocess_async from accelerate.test_utils.testing import run_command class UpperCAmelCase_ ( unittest.TestCase ): '''simple docstring''' ...
88
'''simple docstring''' def lowercase__( __UpperCamelCase: str ): """simple docstring""" SCREAMING_SNAKE_CASE : Optional[int] = [int(__UpperCamelCase ) for i in ip_va_address.split('.' ) if i.isdigit()] return len(__UpperCamelCase ) == 4 and all(0 <...
251
0
"""simple docstring""" from typing import Dict, List, Optional from ...tokenization_utils import AddedToken, PreTrainedTokenizer from ...utils import logging UpperCamelCase__ = logging.get_logger(__name__) UpperCamelCase__ = { 'nielsr/canine-s': 2_0_4_8, } # Unicode d...
363
from ...utils import ( OptionalDependencyNotAvailable, is_torch_available, is_transformers_available, is_transformers_version, ) try: if not (is_transformers_available() and is_torch_available()): raise OptionalDependencyNotAvailable() except OptionalDependencyNotAvailable...
143
0
import warnings from ...utils import logging from .image_processing_donut import DonutImageProcessor _snake_case = logging.get_logger(__name__) class lowercase ( UpperCamelCase__ ): def __init__( self , *_a , **_a ) -> None: warnings...
26
def lowerCAmelCase_ ( snake_case_ ): if n_term == "": return [] _A : list = [] for temp in range(int(snake_case_ ) ): series.append(f'''1/{temp + 1}''' if series else """1""" ) return series if __name__ == "__main__": _sna...
26
1
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_determinism, load_numpy, ...
362
import logging import sys from dataclasses import dataclass, field from typing import Any, Dict, List, Optional, Union import librosa import torch from datasets import DatasetDict, load_dataset from packaging import version from torch import nn from transformers import ( HfArgumentParser, Trainer, Tra...
118
0
'''simple docstring''' import os import textwrap import pyarrow as pa import pytest from datasets import ClassLabel, Features, Image from datasets.packaged_modules.csv.csv import Csv from ..utils import require_pil @pytest.fixture def UpperCamelCase_( snake_case : int ): '''s...
85
"""simple docstring""" import warnings warnings.warn( """memory_utils has been reorganized to utils.memory. Import `find_executable_batchsize` from the main `__init__`: """ """`from accelerate import find_executable_batch_size` to avoid this warning.""", FutureWarning, )
289
0
"""simple docstring""" import argparse import os from . import ( ALBERT_PRETRAINED_CONFIG_ARCHIVE_MAP, BART_PRETRAINED_MODEL_ARCHIVE_LIST, BERT_PRETRAINED_CONFIG_ARCHIVE_MAP, CAMEMBERT_PRETRAINED_CONFIG_ARCHIVE_MAP, CTRL_PRETRAINED_CONFIG_ARCHIVE_MAP, DISTILBERT_PRETRAIN...
366
"""simple docstring""" from ...configuration_utils import PretrainedConfig from ...utils import logging lowercase_ = logging.get_logger(__name__) lowercase_ = { "RWKV/rwkv-4-169m-pile": "https://huggingface.co/RWKV/rwkv-4-169m-pile/resolve/main/config.json", "RWKV...
11
0
'''simple docstring''' import importlib import os from dataclasses import dataclass from enum import Enum from typing import Any, Dict, Optional, Union import torch from ..utils import BaseOutput lowercase_ = """scheduler_config.json""" class a_ ( snake_case_ ): '''simple docstri...
58
"""simple docstring""" from collections import OrderedDict from typing import Mapping from ...configuration_utils import PretrainedConfig from ...onnx import OnnxConfig from ...utils import logging lowerCamelCase_ = logging.get_logger(__name__) lowerCamelCase_ = { "facebo...
191
0
'''simple docstring''' import math import random def a_ ( lowerCamelCase : float , lowerCamelCase : bool = False ): if deriv: return value * (1 - value) return 1 / (1 + math.exp(-value )) # Initial Value __snake_case =0.0_2 ...
55
'''simple docstring''' from __future__ import annotations from collections.abc import Iterator from typing import Generic, TypeVar __snake_case =TypeVar("""T""") class UpperCAmelCase_ ( Generic[T] ): def __init__( self : int , UpperCAmelCase__ : T )...
55
1
import numpy as np import torch from torch.utils.data import Dataset from utils import logger class UpperCAmelCase_ ( a): def __init__( self, __a, __a): '''simple docstring''' _lowerCAmelCase : List[Any] = params _lowerC...
36
def A ( _lowerCamelCase ): '''simple docstring''' if bit_count < 0: raise ValueError("The given input must be positive" ) # get the generated string sequence _lowerCAmelCase : List[str] = gray_code_sequence_string(_lowerCamelCase ) ...
36
1
from collections import OrderedDict from typing import Mapping from ...configuration_utils import PretrainedConfig from ...onnx import OnnxConfig lowerCamelCase__ : str = { 'albert-base-v1': 'https://huggingface.co/albert-base-v1/resolve/main/config.json', 'albert-large-v1': 'https...
210
from abc import ABC, abstractmethod from argparse import ArgumentParser class lowerCamelCase_ ( _SCREAMING_SNAKE_CASE ): '''simple docstring''' @staticmethod @abstractmethod def lowerCAmelCase_ ( _lowerCAmelCase : ArgumentParser ): raise NotImplementedError() ...
210
1
"""simple docstring""" import html from ...feature_extraction_utils import BatchFeature, FeatureExtractionMixin from ...utils import is_bsa_available, logging, requires_backends if is_bsa_available(): import bsa from bsa import BeautifulSoup lowerCamelCase_ : List[str] = logging.g...
286
"""simple docstring""" import inspect import jax import jax.lax as lax import jax.numpy as jnp from ..utils import add_start_docstrings from ..utils.logging import get_logger lowerCamelCase_ : Dict = get_logger(__name__) lowerCamelCase_ : List[str] = r'\n Args:\n ...
286
1
from typing import Optional import pyspark from .. import Features, NamedSplit from ..download import DownloadMode from ..packaged_modules.spark.spark import Spark from .abc import AbstractDatasetReader class lowerCamelCase__( __lowerCamelCase): def __init__( self: Optional[int] , UpperCamel...
356
import os from math import logaa def lowerCamelCase__ ( A__ : str = "base_exp.txt" ): '''simple docstring''' __lowerCamelCase = 0 __lowerCamelCase = 0 for i, line in enumerate(open(os.path.join(os.path.dirname(A__ ) , A__ ) )...
29
0
"""simple docstring""" import argparse import random import joblib import numpy as np import torch from igf.igf import ( SecondaryLearner, collect_objective_set, compute_perplexity, generate_datasets, load_gpta, recopy_gpta, set_seed, train_secondary_learner, ) from torch.utils.dat...
57
"""simple docstring""" def lowercase ( A_ , A_ )-> float: '''simple docstring''' if mass < 0: raise ValueError("The mass of a body cannot be negative" ) return 0.5 * mass * abs(A_ ) * abs(A_ ) if __name__ == "__main__": im...
40
0
'''simple docstring''' import logging import os from .state import PartialState class lowerCAmelCase__ ( logging.LoggerAdapter ): @staticmethod def _snake_case ( __SCREAMING_SNAKE_CASE ): """simple docstring""" ...
264
'''simple docstring''' from typing import TYPE_CHECKING from ...utils import OptionalDependencyNotAvailable, _LazyModule, is_torch_available _lowercase : List[Any] = { "configuration_x_clip": [ "XCLIP_PRETRAINED_CONFIG_ARCHIVE_MAP", "XCLIPConfig", "XC...
264
1
'''simple docstring''' from math import sqrt def a_ ( lowerCamelCase : int ): assert isinstance(lowerCamelCase , lowerCamelCase ) and ( number >= 0 ), "'number' must been an int and positive" lowerCAmelCase = True # 0 and 1 are none primes. ...
4
from __future__ import annotations UpperCAmelCase__ = list[list[int]] # assigning initial values to the grid UpperCAmelCase__ = [ [3, 0, 6, 5, 0, 8, 4, 0, 0], [5, 2, 0, 0, 0, 0, 0, 0, 0], [0, 8, 7, 0, 0, 0, 0, 3, 1], [0, 0, 3, 0, 1, 0, 0, 8, 0], [9, 0, 0, 8, 6...
0
0
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_utils import GenerationTesterMixin from ...
288
import argparse import os import jax as jnp import numpy as onp import torch import torch.nn as nn from music_spectrogram_diffusion import inference from tax import checkpoints from diffusers import DDPMScheduler, OnnxRuntimeModel, SpectrogramDiffusionPipeline from diffusers.pipelines.spectrogram_dif...
288
1
'''simple docstring''' __a = { "joule": 1.0, "kilojoule": 1000, "megajoule": 100_0000, "gigajoule": 10_0000_0000, "wattsecond": 1.0, "watthour": 3600, "kilowatthour": 360_0000, "newtonmeter": 1.0, "calorie_nutr": 4186.8, "kilocalorie_nutr": 418_6800.00, "el...
35
'''simple docstring''' import warnings from ...utils import logging from .image_processing_beit import BeitImageProcessor __a = logging.get_logger(__name__) class UpperCAmelCase_ ( _a ): """simple docstring""" def __init__( self : List[str] , *s...
35
1
from typing import Dict, List, Optional, Tuple, Union import numpy as np from ...image_processing_utils import BaseImageProcessor, BatchFeature, get_size_dict from ...image_transforms import ( center_crop, flip_channel_order, get_resize_output_image_size, rescale, resize, to_channel...
143
import unittest from transformers import BigBirdTokenizer, BigBirdTokenizerFast from transformers.testing_utils import get_tests_dir, require_sentencepiece, require_tokenizers, require_torch, slow from transformers.utils import cached_property from ...test_tokenization_common import TokenizerTesterMixin Up...
143
1
"""simple docstring""" import argparse import shutil import time from json import JSONDecodeError from logging import getLogger from pathlib import Path from typing import Dict, List import torch from torch.utils.data import DataLoader from tqdm import tqdm from transformers import AutoModelF...
197
"""simple docstring""" from ..utils import DummyObject, requires_backends class _A ( metaclass=lowerCAmelCase ): snake_case__ : Optional[int] = ['torch', 'torchsde'] def __init__( self , *__lowerCAmelCase , **__lowerCAmelCase ): ...
197
1
from __future__ import annotations import unittest from transformers import EsmConfig, is_tf_available from transformers.testing_utils import require_tf, slow from ...test_configuration_common import ConfigTester from ...test_modeling_tf_common import TFModelTesterMixin, floats_tensor, ids_tensor, random_attention_...
354
from typing import TYPE_CHECKING from ...utils import OptionalDependencyNotAvailable, _LazyModule, is_torch_available A : str = { 'configuration_time_series_transformer': [ 'TIME_SERIES_TRANSFORMER_PRETRAINED_CONFIG_ARCHIVE_MAP', 'TimeSeriesTransformerConfig', ], } try: ...
33
0
'''simple docstring''' import io import json import unittest from parameterized import parameterized from transformers import FSMTForConditionalGeneration, FSMTTokenizer from transformers.testing_utils import get_tests_dir, require_torch, slow, torch_device from utils import calculate_bleu _SCREAMING_SNAK...
85
'''simple docstring''' from __future__ import annotations import json import requests from bsa import BeautifulSoup from fake_useragent import UserAgent a__ : Optional[Any] = {"UserAgent": UserAgent().random} def snake_case ( UpperCAmelCase )-> dict:...
161
0
import unittest import numpy as np import torch from transformers import CLIPTextConfig, CLIPTextModel from diffusers import DDIMScheduler, LDMPipeline, UNetaDModel, VQModel from diffusers.utils.testing_utils import enable_full_determinism, require_torch, slow, torch_device enable_full_determinism() class __a...
185
from typing import TYPE_CHECKING from ...utils import ( OptionalDependencyNotAvailable, _LazyModule, is_flax_available, is_torch_available, is_vision_available, ) lowerCAmelCase__ :Tuple = {'''configuration_beit''': ['''BEIT_PRETRAINED_CONFIG_ARCHIVE_MAP''', '''BeitConfig'''...
185
1
"""simple docstring""" import argparse import torch from transformers import OpenAIGPTConfig, OpenAIGPTModel, load_tf_weights_in_openai_gpt from transformers.utils import CONFIG_NAME, WEIGHTS_NAME, logging logging.set_verbosity_info() def lowercase ( _snake_case : List[Any] , _s...
102
"""simple docstring""" from __future__ import annotations def lowercase ( _snake_case : int | str ) ->bool: """simple docstring""" __snake_case : List[str] = str(_snake_case ) return n == n[::-1] def lowercase ( _snake_case : in...
102
1
"""simple docstring""" import math from collections.abc import Iterator from itertools import takewhile def __lowercase ( snake_case_ : int ) ->bool: '''simple docstring''' if 1 < number < 4: # 2 and 3 are primes return True elif number < 2 ...
291
"""simple docstring""" import doctest import glob import importlib import inspect import os import re from contextlib import contextmanager from functools import wraps from unittest.mock import patch import numpy as np import pytest from absl.testing import parameterized import datasets from datasets import ...
291
1
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''': [ '''LAYOUTLMV3_PRETR...
230
import math import sys def _lowerCAmelCase ( __lowerCAmelCase ) -> str: """simple docstring""" snake_case__ : Optional[Any] = '''''' try: with open(__lowerCAmelCase , '''rb''' ) as binary_file: snake_case__ : int ...
230
1
"""simple docstring""" import importlib import sys from argparse import REMAINDER, ArgumentParser from pathlib import Path import torch_xla.distributed.xla_multiprocessing as xmp def lowercase_ ( ) -> str: '''simple docstring''' __lowerCamelCase : Tuple = Argume...
64
"""simple docstring""" import copy from ...configuration_utils import PretrainedConfig from ...utils import logging from ..auto import CONFIG_MAPPING __A = logging.get_logger(__name__) __A = { '''ut/deta''': '''https://huggingface.co/ut/deta/resolve/main/config.json''', } class _snake_case ...
64
1
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 import DUMM...
36
import os import pytest from attr import dataclass _UpperCAmelCase : List[str] = "us-east-1" # defaults region @dataclass class __lowerCAmelCase : _a = 42 _a = '''arn:aws:iam::558105141721:role/sagemaker_execution_role''' _a = { ...
236
0
from typing import TYPE_CHECKING from ...utils import ( OptionalDependencyNotAvailable, _LazyModule, is_flax_available, is_torch_available, is_vision_available, ) lowerCamelCase = {'''configuration_beit''': ['''BEIT_PRETRAINED_CONFIG_ARCHIVE_MAP''', '''BeitConfig''', '''Bei...
211
from collections.abc import Iterable from typing import Any class _a : def __init__( self : Union[str, Any] , _SCREAMING_SNAKE_CASE : int | None = None )-> Tuple: lowerCAmelCase__ : Union[str, Any] = value lowerCAmelCase__ : Node | No...
211
1
def a ( snake_case__: int , snake_case__: list ): '''simple docstring''' _enforce_args(snake_case__ , snake_case__ ) if n == 0: return 0 lowercase_ = float('''-inf''' ) for i in range(1 , n + 1 ): lowe...
30
import argparse import json from pathlib import Path import requests import torch from huggingface_hub import cached_download, hf_hub_download, hf_hub_url from PIL import Image from transformers import DetaConfig, DetaForObjectDetection, DetaImageProcessor, SwinConfig from transformers.utils i...
114
0
'''simple docstring''' import unittest from transformers import LiltConfig, is_torch_available from transformers.testing_utils import require_torch, slow, torch_device from ...generation.test_utils import GenerationTesterMixin from ...test_configuration_common import ConfigTester from ...test_modeling_common...
364
'''simple docstring''' import sys __lowerCamelCase = ( '''73167176531330624919225119674426574742355349194934''' '''96983520312774506326239578318016984801869478851843''' '''85861560789112949495459501737958331952853208805511''' '''12540698747158523863050715693290963295227443043557'...
101
0
'''simple docstring''' import unittest from transformers.testing_utils import CaptureStdout from transformers.tools.python_interpreter import evaluate def _UpperCamelCase ( UpperCamelCase__ ): return x + 2 class _snake_case ( unittest.TestCase ): ...
163
'''simple docstring''' import os from typing import List, Optional, Union from ...image_processing_utils import BatchFeature from ...image_utils import ImageInput from ...processing_utils import ProcessorMixin from ...tokenization_utils_base import PaddingStrategy, PreTokenizedInput, TextInput, Trun...
163
1
def UpperCamelCase ( __lowerCamelCase : int , __lowerCamelCase : int ): return numa ^ numa < 0 if __name__ == "__main__": import doctest doctest.testmod()
10
from __future__ import annotations __lowerCamelCase = { """A""": ["""B""", """C""", """E"""], """B""": ["""A""", """D""", """E"""], """C""": ["""A""", """F""", """G"""], """D""": ["""B"""], """E""": ["""A""", """B""", """D"""], """F""": ["""C"""], """G""": ["""C"""], } ...
10
1
'''simple docstring''' from collections import OrderedDict from typing import Mapping from packaging import version from ...configuration_utils import PretrainedConfig from ...onnx import OnnxConfig from ...utils import logging lowerCAmelCase :Union[str, Any] = logging.get_logger(__name__) lowerCAme...
331
'''simple docstring''' from ..utils import DummyObject, requires_backends class _lowerCamelCase ( metaclass=lowercase__ ): '''simple docstring''' A_ : Optional[Any] = ["""flax""", """transformers"""] def __init__( self : Union[str, Any] , *_A : ...
331
1
import shutil import tempfile import unittest import numpy as np import pytest from transformers.testing_utils import require_vision from transformers.utils import is_vision_available if is_vision_available(): from PIL import Image from transformers import ( AutoProcessor, B...
224
from ...utils import ( OptionalDependencyNotAvailable, is_torch_available, is_transformers_available, is_transformers_version, ) try: if not (is_transformers_available() and is_torch_available() and is_transformers_version(""">=""", """4.25.0""")): raise OptionalDependencyNotA...
224
1
'''simple docstring''' from __future__ import annotations __lowerCAmelCase = 8.988e9 # units = N * m^s * C^-2 def __lowerCamelCase ( lowerCAmelCase_ , lowerCAmelCase_ , lowerCAmelCase_ , lowerCAmelCase_ ) -> dict[str, float]: _a : Tuple = ...
89
'''simple docstring''' import doctest import logging import os import unittest from pathlib import Path from typing import List, Union import transformers from transformers.testing_utils import require_tf, require_torch, slow __lowerCAmelCase = logging.getLogger() @unittest.skip('Temporarily disable ...
89
1
from math import cos, sin, sqrt, tau from audio_filters.iir_filter import IIRFilter def UpperCamelCase ( _a , _a , _a = 1 / sqrt(2 ) ) -> IIRFilter: '''simple docstring''' lowercase_ :Dict = tau * frequency / samplerate ...
252
from ...configuration_utils import PretrainedConfig from ...utils import logging SCREAMING_SNAKE_CASE : List[Any] = logging.get_logger(__name__) SCREAMING_SNAKE_CASE : Any = { "edbeeching/decision-transformer-gym-hopper-medium": ( "https://hugging...
252
1
"""simple docstring""" import os from shutil import copyfile from typing import List, Optional, Tuple import sentencepiece as spm from ...tokenization_utils import PreTrainedTokenizer from ...utils import logging lowerCamelCase__ : Tuple = logging.get_logger(__name__) l...
246
"""simple docstring""" def UpperCamelCase ( _lowerCAmelCase : int, _lowerCAmelCase : int ) -> int: _UpperCAmelCase : str = 1 # To kept the Calculated Value # Since C(n, k) = C(n, n-k) if k > (n - k): _UpperCAmelCase : Dict = n - k # Calculat...
246
1
import json import os import unittest from transformers.models.biogpt.tokenization_biogpt import VOCAB_FILES_NAMES, BioGptTokenizer from transformers.testing_utils import slow from ...test_tokenization_common import TokenizerTesterMixin class __lowerCAmelCase ( _a, unittest.TestCase ): lower...
279
import asyncio import os import shutil import subprocess import sys import tempfile import unittest from distutils.util import strtobool from functools import partial from pathlib import Path from typing import List, Union from unittest import mock import torch from ..state import AcceleratorState, PartialState...
279
1
import inspect import unittest class lowerCamelCase (unittest.TestCase ): """simple docstring""" def __A ( self : List[str] ) -> int: try: import diffusers # noqa: F401 except ImportError: assert False def ...
118
from ....configuration_utils import PretrainedConfig from ....utils import logging A : str = logging.get_logger(__name__) # TODO: upload to AWS A : Dict = { "yjernite/retribert-base-uncased": ( "https://huggingface.co/yjernite/retribert-base-uncased/resolve/main/config.json"...
118
1
'''simple docstring''' import importlib.metadata import warnings from copy import deepcopy from packaging import version from ..utils import logging from .import_utils import is_accelerate_available, is_bitsandbytes_available if is_bitsandbytes_available(): import bitsandbytes as bnb import t...
361
'''simple docstring''' # Copyright 2023 The HuggingFace Inc. 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/...
4
0
from ...configuration_utils import PretrainedConfig from ...utils import logging lowerCAmelCase : str = logging.get_logger(__name__) lowerCAmelCase : List[Any] = { '''alibaba-damo/mgp-str-base''': '''https://huggingface.co/alibaba-damo/mgp-str-base/resolve/main/config.json''', } c...
253
from typing import TYPE_CHECKING from ...utils import _LazyModule lowercase__ : int = {'''tokenization_wav2vec2_phoneme''': ['''Wav2Vec2PhonemeCTCTokenizer''']} if TYPE_CHECKING: from .tokenization_wavaveca_phoneme import WavaVecaPhonemeCTCTokenizer else: import sys lowercase__ : Option...
338
0
import json import os import shutil 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 AutoConfig, BertConfig, GPTaConfig from transformers.configuration_...
169
from typing import TYPE_CHECKING from ...utils import OptionalDependencyNotAvailable, _LazyModule, is_tokenizers_available, is_torch_available __snake_case = { """configuration_nezha""": ["""NEZHA_PRETRAINED_CONFIG_ARCHIVE_MAP""", """NezhaConfig"""], } try: if not is_torch_available(): ...
169
1
"""simple docstring""" from __future__ import annotations def lowercase__ ( _UpperCAmelCase , _UpperCAmelCase ) -> int: '''simple docstring''' if len(_UpperCAmelCase ) < k or k < 0: raise ValueError('Invalid Input' ) lowercase : ...
255
"""simple docstring""" import argparse import os import re import numpy as np import PIL import torch from timm import create_model from torch.optim.lr_scheduler import OneCycleLR from torch.utils.data import DataLoader, Dataset from torchvision.transforms import Compose, RandomResizedCrop, ...
255
1
from math import pow, sqrt def lowerCAmelCase_ ( *UpperCamelCase_ ) -> bool: UpperCamelCase_ = len(UpperCamelCase_ ) > 0 and all(value > 0.0 for value in values ) return result def lowerCAmelCase_ ( UpperCamelCase_ , UpperCamelCase_ ...
328
import torch from torch import nn from ...configuration_utils import ConfigMixin, register_to_config from ...models import ModelMixin class _UpperCamelCase ( lowerCAmelCase_ , lowerCAmelCase_ ): @register_to_config def __init__( self: List[str] , *, _SC...
328
1
"""simple docstring""" import logging import os from .state import PartialState class lowerCamelCase__ ( logging.LoggerAdapter ): @staticmethod def lowerCamelCase_ ( SCREAMING_SNAKE_CASE ): """simple docstring""" snake_case : Opti...
148
"""simple docstring""" import unittest import numpy as np from transformers import RoFormerConfig, is_flax_available from transformers.testing_utils import require_flax, slow from ...test_modeling_flax_common import FlaxModelTesterMixin, ids_tensor, random_attention_mask if is_flax_available...
148
1
import importlib import inspect import json import os import re import shutil import sys from pathlib import Path from typing import Dict, Optional, Union from urllib import request from huggingface_hub import HfFolder, cached_download, hf_hub_download, model_info from packaging import version from .. import __ve...
363
import logging import numpy as np import pytest from scipy.linalg import eigh logging.basicConfig(level=logging.INFO, format='''%(message)s''') def lowerCamelCase_ ( _a : np.ndarray ): '''simple docstring''' return input_array.reshape((input_array.size, 1) ) def ...
59
0
"""simple docstring""" from __future__ import annotations def lowercase ( __snake_case : tuple[int, int] , __snake_case : int ): lowercase_ , lowercase_ : int = position lowercase_ : Optional[Any] = [ (y + 1, x + 2),...
33
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 import DUMMY_UN...
343
0
'''simple docstring''' from PIL import Image def __a ( _UpperCamelCase: Image , _UpperCamelCase: int ) -> Image: """simple docstring""" _snake_case = (259 * (level + 255)) / (255 * (259 - level)) def contrast(_UpperCamelCase: int ) -> int: ...
359
'''simple docstring''' from ...configuration_utils import PretrainedConfig from ...utils import logging UpperCamelCase_ : int = logging.get_logger(__name__) UpperCamelCase_ : Tuple = { '''sayakpaul/vit-msn-base''': '''https://huggingface.co/sayakpaul/vit-msn-ba...
142
0
'''simple docstring''' from typing import TYPE_CHECKING from ...utils import OptionalDependencyNotAvailable, _LazyModule, is_sentencepiece_available __UpperCAmelCase ={} try: if not is_sentencepiece_available(): raise OptionalDependencyNotAvailable() except OptionalDependencyNotAvailable: pas...
67
import math def lowerCamelCase_ ( lowerCamelCase__ , lowerCamelCase__ = 0 , lowerCamelCase__ = 0 ): lowerCamelCase_ = end or len(lowerCamelCase__ ) for i in range(lowerCamelCase__ , lowerCamelCase__ ): lowerCamelCase_ = i lowerCamelCase_ = array[i] ...
19
0
'''simple docstring''' from ...configuration_utils import PretrainedConfig from ...utils import logging lowerCamelCase : str = logging.get_logger(__name__) lowerCamelCase : Optional[Any] = { "facebook/xglm-564M": "https://huggingface.co/facebook/xglm-564M/resolve/main/config.json", ...
369
'''simple docstring''' 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_att...
114
0
from typing import TYPE_CHECKING from ...utils import ( OptionalDependencyNotAvailable, _LazyModule, is_tf_available, is_tokenizers_available, is_torch_available, ) snake_case_ = { '''configuration_deberta''': ['''DEBERTA_PRETRAINED_CONFIG_ARCHIVE_MAP''', '''DebertaConfig''', '''Deberta...
214
from collections import OrderedDict from typing import Any, Mapping, Optional from ... import PreTrainedTokenizer from ...configuration_utils import PretrainedConfig from ...file_utils import TensorType, is_torch_available from ...onnx import OnnxConfig, OnnxConfigWithPast, OnnxSeqaSeqConfigWithPast from ...onnx.ut...
94
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.scheduling_ddpm i...
362
import gc import random import unittest import numpy as np import torch from PIL import Image from diffusers import ( DDIMScheduler, KandinskyVaaControlnetImgaImgPipeline, KandinskyVaaPriorEmbaEmbPipeline, UNetaDConditionModel, VQModel, ) from diffusers.utils import floats_tensor, load_image, loa...
110
0
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 ...
322
def _a ( SCREAMING_SNAKE_CASE : Optional[int] ) -> Optional[int]: """simple docstring""" __lowerCAmelCase: List[Any] = 0 __lowerCAmelCase: Optional[int] = len(SCREAMING_SNAKE_CASE ) for i in range(n - 1 ): for j in range(i + 1 , SCREAMING_SNAKE...
322
1
"""simple docstring""" import math_equivalence # From: git+https://github.com/hendrycks/math.git import datasets _lowerCAmelCase : Dict = """\ @article{hendrycksmath2021, title={Measuring Mathematical Problem Solving With the MATH Dataset}, author={Dan Hendrycks and Collin Burns a...
364
"""simple docstring""" import copy import os from collections import OrderedDict from typing import TYPE_CHECKING, Any, Dict, Mapping, Optional, Union if TYPE_CHECKING: from ...processing_utils import ProcessorMixin from ...utils import TensorType from ...configuration_utils import PretrainedConfig from .....
202
0
import copy import os from collections import OrderedDict from typing import TYPE_CHECKING, Any, Dict, Mapping, Optional, Union if TYPE_CHECKING: from ...processing_utils import ProcessorMixin from ...utils import TensorType from ...configuration_utils import PretrainedConfig f...
114
"""simple docstring""" from __future__ import annotations def lowerCamelCase__ ( __snake_case, __snake_case ) -> float: """simple docstring""" _UpperCamelCase = sorted(numsa + numsa ) _UpperCamelCase , _UpperCamelCase = divmod(len(...
194
0
import unittest from .lib import ( Matrix, Vector, axpy, square_zero_matrix, unit_basis_vector, zero_vector, ) class __snake_case ( unittest.TestCase ): def UpperCAmelCase__ ( self ) -> None: '''simple docstring''' UpperCAmelCase ...
352
import sys def lowerCAmelCase_ ( __lowerCAmelCase )-> Any: '''simple docstring''' UpperCAmelCase : Optional[Any] =len(__lowerCAmelCase ) UpperCAmelCase : List[str] =[[0 for x in range(__lowerCAmelCase )] for x in range(__lowerCAmelCase )] ...
78
0
'''simple docstring''' import gc import random import unittest import torch from diffusers import ( IFImgaImgPipeline, IFImgaImgSuperResolutionPipeline, IFInpaintingPipeline, IFInpaintingSuperResolutionPipeline, IFPipeline, IFSuperResolutionPipeline, ) from diffusers.mod...
174
'''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()): raise OptionalDependencyNotAvailable() except OptionalDepen...
174
1
import importlib import sys from argparse import REMAINDER, ArgumentParser from pathlib import Path import torch_xla.distributed.xla_multiprocessing as xmp def _lowerCAmelCase ( ) -> List[Any]: """simple docstring""" snake_case__ : Any = ArgumentParser( ...
359
import unittest from transformers import GPTNeoXJapaneseConfig, is_torch_available from transformers.models.gpt_neox_japanese.tokenization_gpt_neox_japanese import GPTNeoXJapaneseTokenizer from transformers.testing_utils import require_torch, slow, torch_device from ...test_configuration_common import C...
44
0
import argparse from pathlib import Path import requests import torch from PIL import Image from transformers import ( RobertaTokenizer, TrOCRConfig, TrOCRForCausalLM, TrOCRProcessor, VisionEncoderDecoderModel, ViTConfig, ViTImageProcessor, ViTModel, ) from transformers.utils impor...
119
'''simple docstring''' import torch from diffusers import KDPMaDiscreteScheduler from diffusers.utils import torch_device from .test_schedulers import SchedulerCommonTest class a ( _SCREAMING_SNAKE_CASE ): _lowerCAmelCase = (KDPMaDiscreteScheduler,) _lower...
168
0
import numpy as np from sklearn.datasets import fetch_california_housing from sklearn.metrics import mean_absolute_error, mean_squared_error from sklearn.model_selection import train_test_split from xgboost import XGBRegressor def _a ( lowerCamelCase: dict ) -> tuple: ...
250
from typing import TYPE_CHECKING from ...utils import ( OptionalDependencyNotAvailable, _LazyModule, is_flax_available, is_tf_available, is_tokenizers_available, is_torch_available, ) snake_case__ : Union[str, Any] = { 'configuration_blenderb...
250
1
def SCREAMING_SNAKE_CASE_ ( __magic_name__ : str ) -> bool: """simple docstring""" UpperCamelCase :Union[str, Any] = [int(__magic_name__ ) for i in ip_va_address.split(""".""" ) if i.isdigit()] return len(__magic_name__ ) == 4 and all(0 <= int(__mag...
38
import math import numpy as np import qiskit from qiskit import Aer, ClassicalRegister, QuantumCircuit, QuantumRegister, execute def SCREAMING_SNAKE_CASE_ ( __magic_name__ : int = 3 ) -> qiskit.result.counts.Counts: """simple docstring""" if isinstance(__magic_name__ , _...
38
1
from __future__ import annotations def UpperCAmelCase_ (_lowerCAmelCase : list , _lowerCAmelCase : int | None = None , _lowerCAmelCase : int | None = None ): if start is None: __UpperCamelCase : List[str] = 0 if end is None: __Upp...
171
from math import sqrt def UpperCAmelCase_ (_lowerCAmelCase : int = 1_00_00_00 ): __UpperCamelCase : int = 0 __UpperCamelCase : int = 0 __UpperCamelCase : int while num_cuboids <= limit: max_cuboid_size += 1 for sum_shortest_si...
171
1
lowercase = { "km/h": 1.0, "m/s": 3.6, "mph": 1.60_9344, "knot": 1.852, } lowercase = { "km/h": 1.0, "m/s": 0.2_7777_7778, "mph": 0.6_2137_1192, "knot": 0.5_3995_6803, } def __UpperCAmelCase ( a_ , a_ , a_): if u...
178
import unittest from transformers import is_torch_available, is_vision_available from transformers.testing_utils import require_torch, require_vision, slow, torch_device if is_torch_available(): import torch from transformers import AutoModelForImageClassification if is_vision_available(): from transform...
178
1
"""simple docstring""" import math def _A ( UpperCamelCase_ : str, UpperCamelCase_ : str) -> Optional[int]: '''simple docstring''' if 0 not in (x, y): # We use the relation x^y = y*log10(x), where 10 is the base. return y * math.logaa(UpperCamelCase_) else: ...
144
"""simple docstring""" import argparse import shlex import runhouse as rh if __name__ == "__main__": # Refer to https://runhouse-docs.readthedocs-hosted.com/en/latest/api/python/cluster.html#hardware-setup for cloud access # setup instructions, if using on-demand hardware # If user passes --user <us...
144
1
import copy import tempfile import unittest from transformers import MaMaaaConfig, is_torch_available from transformers.testing_utils import require_sentencepiece, require_tokenizers, require_torch, slow, torch_device from transformers.utils import cached_property from ...generation.test_utils import GenerationTeste...
122
import os from shutil import copyfile from typing import Any, Dict, List, Optional, Tuple import sentencepiece as spm from ...tokenization_utils import AddedToken, PreTrainedTokenizer from ...utils import logging _A = logging.get_logger(__name__) _A = '''▁''' _A = {'''vocab_file''': ''...
122
1
"""simple docstring""" def lowercase_ ( ) -> int: return [ a * b * (1000 - a - b) for a in range(1 , 999 ) for b in range(__UpperCAmelCase , 999 ) if (a * a + b * b == (1000 - a - b) ** 2) ][0] if __name__ == "__main__": print...
359
"""simple docstring""" import argparse from transformers import TaConfig, TaForConditionalGeneration, load_tf_weights_in_ta from transformers.utils import logging logging.set_verbosity_info() def lowercase_ ( __UpperCAmelCase , __UpperCAmelCase , __UpperCAmelCase ) -> List[Any]: ...
212
0
def snake_case( __magic_name__ , __magic_name__ , __magic_name__ , __magic_name__ ) -> str: '''simple docstring''' lowercase : Union[str, Any] = [False] * len(__magic_name__ ) lowercase : Optional[int] = [] queue.append(__m...
308
# Lint as: python3 import os import re import urllib.parse from pathlib import Path from typing import Callable, List, Optional, Union from zipfile import ZipFile from ..utils.file_utils import cached_path, hf_github_url from ..utils.logging import get_logger from ..utils.version import Version ...
308
1
'''simple docstring''' from typing import Mapping from ...configuration_utils import PretrainedConfig from ...onnx import OnnxSeqaSeqConfigWithPast from ...utils import logging __lowercase: Any = logging.get_logger(__name__) __lowercase: Union[str, Any] = { "t5-sma...
31
'''simple docstring''' import os from pickle import UnpicklingError from typing import Dict, Tuple import jax import jax.numpy as jnp import numpy as np from flax.serialization import from_bytes from flax.traverse_util import flatten_dict, unflatten_dict import transformers from .utils import lo...
31
1
'''simple docstring''' 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 lowercase_ (lowerCamelCase__ ): """simple docstring"...
104
'''simple docstring''' import argparse from pathlib import Path import torch from packaging import version from torch.onnx import export from diffusers import AutoencoderKL lowerCAmelCase__ = version.parse(version.parse(torch.__version__).base_version) < version.parse('''1.11''') def _A ( ...
104
1
import gc import unittest import numpy as np import torch from diffusers import AutoencoderKL, DDIMScheduler, DiTPipeline, DPMSolverMultistepScheduler, TransformeraDModel from diffusers.utils import is_xformers_available, load_numpy, slow, torch_device from diffusers.utils.testing_utils import enable_full_determin...
185
import warnings from contextlib import contextmanager from ....processing_utils import ProcessorMixin class __a ( UpperCAmelCase ): _a : Optional[int] = 'MCTCTFeatureExtractor' _a : int = 'AutoTokenizer' def __init__( self , _SCREAMING_SNAKE_CASE...
185
1
'''simple docstring''' import argparse import torch from diffusers.pipelines.stable_diffusion.convert_from_ckpt import download_from_original_stable_diffusion_ckpt if __name__ == "__main__": UpperCamelCase__: List[Any] = argparse.ArgumentParser() parser.add_arg...
23
'''simple docstring''' from __future__ import annotations def snake_case_ ( _lowerCAmelCase : str , _lowerCAmelCase : str ) -> bool: UpperCAmelCase : str = get_failure_array(_lowerCAmelCase ) # 2) Step through text searching ...
23
1
"""simple docstring""" import warnings from ...utils import logging from .image_processing_imagegpt import ImageGPTImageProcessor UpperCAmelCase = logging.get_logger(__name__) class UpperCAmelCase_ ( a__): def __init__( self : Optional[Any] , *__UpperCamelCase :...
354
"""simple docstring""" from __future__ import annotations from PIL import Image # Define glider example UpperCAmelCase = [ [0, 1, 0, 0, 0, 0, 0, 0], [0, 0, 1, 0, 0, 0, 0, 0], [1, 1, 1, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0], [0,...
54
0
from dataclasses import asdict, dataclass from typing import Optional from ...configuration_utils import PretrainedConfig from ...utils import logging UpperCamelCase__ = logging.get_logger(__name__) # TODO Update this UpperCamelCase__ = { 'facebook/esm-1b': 'https://huggin...
65
"""simple docstring""" 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 a__ ( __SCREAMING_SNAKE_CASE , __SCREAMING_SNAKE_...
217
0
'''simple docstring''' import collections import json import os import re from typing import TYPE_CHECKING, List, Optional, Tuple import numpy as np from ...tokenization_utils_fast import PreTrainedTokenizer from ...utils import logging if TYPE_CHECKING: from transformers.pipeli...
264
'''simple docstring''' from maths.is_square_free import is_square_free from maths.prime_factors import prime_factors def snake_case_ ( __SCREAMING_SNAKE_CASE : int ): """simple docstring""" lowercase_ : Tuple = prime_factors(__SCREAMING_S...
264
1
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 from .embeddings import GaussianFourierProjection, TimestepEmbedding, Timesteps from .model...
51
'''simple docstring''' from typing import List, Optional, Union import numpy as np import torch import torchaudio.compliance.kaldi as ta_kaldi from ...feature_extraction_sequence_utils import SequenceFeatureExtractor from ...feature_extraction_utils import BatchFeature from ...utils import PaddingStr...
55
0
from math import sqrt def _lowercase ( _UpperCAmelCase = 1_00_00_00 ) -> int: lowerCamelCase =0 lowerCamelCase =0 lowerCamelCase =42 while num_cuboids <= limit: max_cuboid_size += 1 for sum_shortest_sides in range(2 , 2 * max_cuboid_size + 1 ): ...
262
from ...configuration_utils import PretrainedConfig from ...utils import logging UpperCAmelCase__ : Union[str, Any] =logging.get_logger(__name__) UpperCAmelCase__ : Any ={ '''sayakpaul/vit-msn-base''': '''https://huggingface.co/sayakpaul/vit-msn-base/resolve/main/config.json''', # S...
262
1
import argparse import json from collections import OrderedDict from pathlib import Path import requests import torch from huggingface_hub import hf_hub_download from PIL import Image from transformers import ( SegformerConfig, SegformerForImageClassification, SegformerForSemanticSegmentation...
338
"""simple docstring""" import argparse import pytorch_lightning as pl import torch from torch import nn from transformers import LongformerForQuestionAnswering, LongformerModel class _lowerCAmelCase ( pl.LightningModule ): """simple docstring""" def __init__( self : Option...
17
0
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_ = { """kssteven/ibert-roberta-base""": """...
360
import enum import warnings from .. import MODEL_FOR_CAUSAL_LM_MAPPING, TF_MODEL_FOR_CAUSAL_LM_MAPPING from ..utils import add_end_docstrings, is_tf_available from .base import PIPELINE_INIT_ARGS, Pipeline if is_tf_available(): import tensorflow as tf class UpperCamelCase_ ( enum.Enum ): ...
295
0
"""simple docstring""" 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 ( BertTokenizer, ViltConfig, ViltForImageAndTextRetrieval, ViltForImagesAndTextClassification, Vilt...
74
"""simple docstring""" import math def a_ ( lowerCamelCase , lowerCamelCase ): if ( not isinstance(lowerCamelCase , (int, float) ) or power_factor < -1 or power_factor > 1 ): raise ValueError('power_factor must be a valid float value be...
98
0
"""simple docstring""" import importlib import json import os from collections import OrderedDict from typing import Dict, Optional, Union # Build the list of all feature extractors from ...configuration_utils import PretrainedConfig from ...dynamic_module_utils import get_class_from_dynamic_module, resolve_trust_r...
233
"""simple docstring""" import gc import random import unittest import numpy as np import torch from transformers import CLIPTextConfig, CLIPTextModel, CLIPTokenizer from diffusers import AutoencoderKL, CycleDiffusionPipeline, DDIMScheduler, UNetaDConditionModel from diffusers.utils import floats_tensor, load_image...
233
1
from ...processing_utils import ProcessorMixin class _lowerCamelCase( _a ): lowercase_ : List[Any] = """WhisperFeatureExtractor""" lowercase_ : List[str] = """WhisperTokenizer""" def __init__( self, lowerCamelCase, lowerCamelCase) -> Dict: ...
21
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 import ConfigTester fro...
225
0
"""simple docstring""" import numpy as np import torch import tqdm from ...models.unet_ad import UNetaDModel from ...pipelines import DiffusionPipeline from ...utils import randn_tensor from ...utils.dummy_pt_objects import DDPMScheduler class SCREAMING_SNAKE_CASE__ ( UpperCAmelCase__ ): def __init__...
76
"""simple docstring""" import sys from typing import Tuple import numpy as np import torch from PIL import Image from torch import nn from transformers.image_utils import PILImageResampling from utils import img_tensorize class SCREAMING_SNAKE_CASE__ : def __init__( self , _SCREAMING_SNAK...
76
1
import os import time import pytest from datasets.utils.filelock import FileLock, Timeout def UpperCAmelCase_ ( __snake_case ) -> List[Any]: """simple docstring""" _lowercase =FileLock(str(tmpdir / '''foo.lock''' ) ) _lowercase =FileLock(str(tm...
5
import logging import os from logging import ( CRITICAL, # NOQA DEBUG, # NOQA ERROR, # NOQA FATAL, # NOQA INFO, # NOQA NOTSET, # NOQA WARN, # NOQA WARNING, # NOQA ) from typing import Optional from tqdm import auto as tqdm_lib A__: Optional[int] ...
149
0
from typing import TYPE_CHECKING from ...utils import OptionalDependencyNotAvailable, _LazyModule, is_tf_available, is_torch_available __magic_name__ = { "configuration_data2vec_audio": ["DATA2VEC_AUDIO_PRETRAINED_CONFIG_ARCHIVE_MAP", "Data2VecAudioConfig"], "configuration_data2vec_text": [ ...
359
from typing import TYPE_CHECKING from ...utils import ( OptionalDependencyNotAvailable, _LazyModule, is_sentencepiece_available, is_tokenizers_available, is_torch_available, ) __magic_name__ = {} try: if not is_sentencepiece_available(): raise Optio...
152
0
'''simple docstring''' class _lowercase : '''simple docstring''' def __init__( self : Any , SCREAMING_SNAKE_CASE__ : str = "" , SCREAMING_SNAKE_CASE__ : bool = False ) -> None: # Mapping from the first character of the prefix of the node __...
229
'''simple docstring''' from typing import Optional, Tuple, Union import flax import flax.linen as nn import jax import jax.numpy as jnp from flax.core.frozen_dict import FrozenDict from ..configuration_utils import ConfigMixin, flax_register_to_config from ..utils import BaseOutput from .embeddings_flax ...
229
1
import warnings from contextlib import contextmanager from ...processing_utils import ProcessorMixin class snake_case_ ( __lowercase ): A_ = 'Speech2TextFeatureExtractor' A_ = 'Speech2TextTokenizer' def __init__( self : List[str] , ...
232
_UpperCAmelCase = {0: [2, 3], 1: [0], 2: [1], 3: [4], 4: []} _UpperCAmelCase = {0: [1, 2, 3], 1: [2], 2: [0], 3: [4], 4: [5], 5: [3]} def _SCREAMING_SNAKE_CASE ( SCREAMING_SNAKE_CASE :dict[int, list[int]] , SCREAMING_SNAKE_CASE :int , SCREAMING_SNAKE_CAS...
232
1
"""simple docstring""" import copy from collections import OrderedDict from typing import Dict, Mapping from packaging import version from ...configuration_utils import PretrainedConfig from ...onnx import OnnxConfig from ...utils import logging from ..auto import CONFIG_MAPPING __magic_name__ = loggi...
100
"""simple docstring""" import argparse import pickle import numpy as np import torch from torch import nn from transformers import ReformerConfig, ReformerModelWithLMHead from transformers.utils import logging logging.set_verbosity_info() def __lowerCamelCase ( a_ : ...
191
0
from ....utils import logging lowerCamelCase__ = logging.get_logger(__name__) class _UpperCAmelCase ( lowerCAmelCase ): '''simple docstring''' def __init__( self : List[Any] , lowercase_ : List[Any] , lowercase_ : List[Any]=None , lowercase_ ...
63
import json from typing import List, Optional, Tuple from tokenizers import normalizers from ...tokenization_utils_fast import PreTrainedTokenizerFast from ...utils import logging from .tokenization_funnel import FunnelTokenizer lowerCamelCase__ = logging.get_logger(__name__) lowerCamelCase__ = {''...
63
1
def _a ( a :int , a :int ) -> int: return int((input_a, input_a).count(0 ) != 0 ) def _a ( ) -> None: assert nand_gate(0 , 0 ) == 1 assert nand_gate(0 , 1 ) == 1 assert nand_gate(1 , 0 ) == 1 assert nand_gate(1 , 1 ) == 0...
0
from __future__ import annotations import time import numpy as np UpperCAmelCase__ = [8, 5, 9, 7] UpperCAmelCase__ = [ [2, 0, 1, 1], [0, 1, 2, 1], [4, 0, 0, 3], [0, 2, 1, 0], [1, 0, 3, 0], ] UpperCAmelCase__ = [ [3, 2, 1, 4], [0, 2, 5, 2]...
0
1
import os from argparse import ArgumentParser, Namespace from ..data import SingleSentenceClassificationProcessor as Processor from ..pipelines import TextClassificationPipeline from ..utils import is_tf_available, is_torch_available, logging from . import BaseTransformersCLICommand if not is_tf_available() and...
355
import argparse import os.path as osp import re import torch from safetensors.torch import load_file, save_file # =================# # UNet Conversion # # =================# lowerCAmelCase__ = [ # (stable-diffusion, HF Diffusers) ('''time_embed.0.weight''', '''time_embedding.linear_1.weight'''), ...
121
0
'''simple docstring''' import requests from bsa import BeautifulSoup def snake_case_ ( lowerCAmelCase_ = "https://www.worldometers.info/coronavirus" )-> dict: '''simple docstring''' _UpperCAmelCase : str = BeautifulSoup(requests.get(lowerCAmelCase_ ).text ...
215
'''simple docstring''' 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 ...
215
1
'''simple docstring''' import unittest from transformers import is_vision_available from transformers.pipelines import pipeline from transformers.testing_utils import ( is_pipeline_test, nested_simplify, require_tf, require_torch, require_vision, slow, ) from .test_pipelines_common import ...
353
'''simple docstring''' from transformers import DistilBertTokenizer, DistilBertTokenizerFast from transformers.testing_utils import require_tokenizers, slow from ..bert.test_tokenization_bert import BertTokenizationTest @require_tokenizers class __magic_name__ ( _UpperCAmelCase): UpperCamelCase__...
21
0
'''simple docstring''' import json import os import tempfile from unittest.mock import patch import torch from torch.utils.data import DataLoader, TensorDataset from accelerate import DistributedType, infer_auto_device_map, init_empty_weights from accelerate.accelerator import Accelerator ...
168
import inspect import os import unittest from dataclasses import dataclass import torch from accelerate import Accelerator, DistributedDataParallelKwargs, GradScalerKwargs from accelerate.state import AcceleratorState from accelerate.test_utils import execute_subprocess_async, require_cuda, require_mul...
310
0
"""simple docstring""" from collections import OrderedDict from typing import Mapping from ...configuration_utils import PretrainedConfig from ...onnx import OnnxConfig _A = { """albert-base-v1""": """https://huggingface.co/albert-base-v1/resolve/main/config.json""", """albert-large-v1""": ""...
166
"""simple docstring""" import torch from diffusers import DDIMParallelScheduler from .test_schedulers import SchedulerCommonTest class lowerCamelCase ( lowerCAmelCase__ ): '''simple docstring''' SCREAMING_SNAKE_CASE = (DDIMParallelScheduler,) SCREAMING_SNAKE_CASE = ...
166
1
from collections.abc import Generator from math import sin def A ( _lowerCamelCase ): '''simple docstring''' if len(_lowerCamelCase ) != 32: raise ValueError("Input must be of length 32" ) _lowerCAmelCase : Optional[Any] = b"" f...
36
def A ( _lowerCamelCase ): '''simple docstring''' if bit_count < 0: raise ValueError("The given input must be positive" ) # get the generated string sequence _lowerCAmelCase : List[str] = gray_code_sequence_string(_lowerCamelCase ) ...
36
1
"""simple docstring""" import os from shutil import copyfile from typing import List, Optional, Tuple from tokenizers import processors from ...tokenization_utils import AddedToken, BatchEncoding from ...tokenization_utils_fast import PreTrainedTokenizerFast from ...utils import is_sentencepiec...
11
"""simple docstring""" from typing import TYPE_CHECKING from ...utils import ( OptionalDependencyNotAvailable, _LazyModule, is_tf_available, is_torch_available, is_vision_available, ) lowercase_ = { "configuration_efficientformer": [ "EFFICIENTFO...
11
1