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 from transformers import TaConfig, TaForConditionalGeneration, load_tf_weights_in_ta from transformers.utils import logging logging.set_verbosity_info() def lowerCamelCase__ ( _lowerCamelCase : Union[str, Any...
183
from collections import defaultdict from math import gcd def __lowercase ( _SCREAMING_SNAKE_CASE = 1_50_00_00 ) -> int: '''simple docstring''' SCREAMING_SNAKE_CASE = defaultdict(_SCREAMING_SNAKE_CASE ) SCREAMING_SNAKE_CASE = 2 while 2 * euc...
296
0
from argparse import ArgumentParser from .env import EnvironmentCommand def UpperCAmelCase_ ( ) -> Dict: __lowercase : Any = ArgumentParser('''Diffusers CLI tool''' , usage='''diffusers-cli <command> [<args>]''' ) __lowercase : Optional[Any] = parser.add_s...
156
from argparse import ArgumentParser from .env import EnvironmentCommand def __lowercase ( ) -> Dict: '''simple docstring''' SCREAMING_SNAKE_CASE = ArgumentParser("""Diffusers CLI tool""" , usage="""diffusers-cli <command> [<args>]""" ) SCREAMING_...
296
0
"""simple docstring""" def __a ( __lowerCamelCase ): UpperCAmelCase_ : Dict = len(_SCREAMING_SNAKE_CASE ) while cur > 1: # Find the maximum number in arr UpperCAmelCase_ : Union[str, Any] = arr.index(max(arr[0:cur] ) ) # Reverse from 0 to mi ...
61
import argparse import json import requests import timm import torch from huggingface_hub import hf_hub_download from PIL import Image from transformers import AutoImageProcessor, SwinConfig, SwinForImageClassification def __lowercase ( _SCREAMING_SNAKE_CASE ) -> Union[str, Any...
296
0
"""simple docstring""" import os import string import sys _UpperCamelCase : Optional[Any] = 1 << 8 _UpperCamelCase : str = { "tab": ord("\t"), "newline": ord("\r"), "esc": 27, "up": 65 + ARROW_KEY_FLAG, "down": 66 + ARROW_KEY_FLAG, "right": 67 + ARROW_KEY_FL...
77
import os from distutils.util import strtobool def __lowercase ( _SCREAMING_SNAKE_CASE , _SCREAMING_SNAKE_CASE ) -> Tuple: '''simple docstring''' for e in env_keys: SCREAMING_SNAKE_CASE = int(os.environ.get(_SCREAMING_SNAKE_CASE , -1 ) )...
296
0
'''simple docstring''' import argparse import json import requests import timm import torch from huggingface_hub import hf_hub_download from PIL import Image from transformers import AutoImageProcessor, SwinConfig, SwinForImageClassification def snake_case_ ( _lowerCAmelCas...
23
import dataclasses import json import warnings from dataclasses import dataclass, field from time import time from typing import List from ..utils import logging SCREAMING_SNAKE_CASE_ = logging.get_logger(__name__) def __lowercase ( _SCREAMING_SNAKE_CASE=None , ...
296
0
"""simple docstring""" import itertools from dataclasses import dataclass from typing import Any, Callable, Dict, List, Optional, Union import pandas as pd import pyarrow as pa import datasets import datasets.config from datasets.features.features import require_storage_cast from datasets.table...
260
import math import unittest def __lowercase ( _SCREAMING_SNAKE_CASE ) -> bool: '''simple docstring''' assert isinstance(_SCREAMING_SNAKE_CASE , _SCREAMING_SNAKE_CASE ) and ( number >= 0 ), "'number' must been an int and positive" if 1...
296
0
'''simple docstring''' from collections import OrderedDict from ...utils import logging from .auto_factory import _BaseAutoModelClass, _LazyAutoMapping, auto_class_update from .configuration_auto import CONFIG_MAPPING_NAMES lowerCAmelCase: int = logging.get_logger(__name__) lowerCAme...
297
import random class UpperCamelCase__ : '''simple docstring''' @staticmethod def SCREAMING_SNAKE_CASE__ ( lowerCamelCase__ : str ) -> tuple[list[int], list[int]]: '''simple docstring''' SCREAMING_SNAKE_CASE = ...
296
0
import argparse import os from transformers.utils import direct_transformers_import # All paths are set with the intent you should run this script from the root of the repo with the command # python utils/check_task_guides.py _UpperCamelCase = "src/transformers" _UpperCamelCase = "docs/source/en/tasks" ...
275
from typing import List from ...configuration_utils import PretrainedConfig from ...utils import logging SCREAMING_SNAKE_CASE_ = logging.get_logger(__name__) SCREAMING_SNAKE_CASE_ = { """snap-research/efficientformer-l1-300""": ( """https://huggingface.c...
296
0
from typing import Callable, Optional, Union from ...configuration_utils import PretrainedConfig from ...utils import logging UpperCAmelCase : str = logging.get_logger(__name__) UpperCAmelCase : Tuple = { """microsoft/xprophetnet-large-wiki100-cased""": ( ""...
95
import importlib import shutil import threading import warnings from typing import List import fsspec import fsspec.asyn from . import compression from .hffilesystem import HfFileSystem SCREAMING_SNAKE_CASE_ = importlib.util.find_spec("""s3fs""") is not None if _has_safs: ...
296
0
import json import os from typing import Dict, List, Optional, Tuple import regex as re from ...tokenization_utils import PreTrainedTokenizer from ...utils import logging _UpperCAmelCase : Optional[int] = logging.get_logger(__name__) _UpperCAmelCase : int = { "vocab_file": "vocab.json", "merg...
236
import unittest import numpy as np import torch from diffusers import KarrasVePipeline, KarrasVeScheduler, UNetaDModel from diffusers.utils.testing_utils import enable_full_determinism, require_torch, slow, torch_device enable_full_determinism() class UpperCamelCase__ ( unittest.TestC...
296
0
import copy from typing import Any, Dict, List, Optional, Union import numpy as np from ...audio_utils import mel_filter_bank, spectrogram, window_function from ...feature_extraction_sequence_utils import SequenceFeatureExtractor from ...feature_extraction_utils import BatchFeature from ...utils import TensorType, l...
281
from typing import Callable, Optional from .. import Features from ..packaged_modules.generator.generator import Generator from .abc import AbstractDatasetInputStream class UpperCamelCase__ ( lowerCAmelCase_ ): '''simple docstring''' def __init__( self : Un...
296
0
"""simple docstring""" import unittest from transformers import is_flax_available from transformers.testing_utils import require_flax, require_sentencepiece, require_tokenizers, require_torch, slow if is_flax_available(): import optax from flax.training.common_utils import onehot...
183
import logging from dataclasses import dataclass, field from typing import Optional from seqaseq_trainer import arg_to_scheduler from transformers import TrainingArguments SCREAMING_SNAKE_CASE_ = logging.getLogger(__name__) @dataclass class UpperCamelCase__ ( lowerCAmel...
296
0
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 AutoProcessor from transformers.mod...
156
import unittest import numpy as np import torch from transformers import CLIPTextConfig, CLIPTextModel, CLIPTokenizer from diffusers import ( AutoencoderKL, DDIMScheduler, DPMSolverMultistepScheduler, TextToVideoSDPipeline, UNetaDConditionModel, ) from diffusers.utils impo...
296
0
"""simple docstring""" from PIL import Image def __a ( __lowerCamelCase, __lowerCamelCase ): def brightness(__lowerCamelCase ) -> float: return 128 + level + (c - 128) if not -255.0 <= level <= 255.0: raise ValueError("level must be between -255.0 (black) and 255.0 (white)" )...
61
def __lowercase ( _SCREAMING_SNAKE_CASE = 10 ) -> str: '''simple docstring''' if not isinstance(_SCREAMING_SNAKE_CASE , _SCREAMING_SNAKE_CASE ) or n < 0: raise ValueError("""Invalid input""" ) SCREAMING_SNAKE_CASE = 10**n SCREAMING_SNAK...
296
0
"""simple docstring""" import unittest from parameterized import parameterized from transformers import AutoTokenizer, GPTNeoXConfig, is_torch_available, set_seed from transformers.testing_utils import require_torch, slow, torch_device from ...generation.test_utils import GenerationTesterMixin from ...test_conf...
77
from typing import TYPE_CHECKING from ...utils import ( OptionalDependencyNotAvailable, _LazyModule, is_sentencepiece_available, is_tokenizers_available, is_torch_available, ) SCREAMING_SNAKE_CASE_ = { """configuration_llama""": ["""LLAMA_PRETRAINED_CONFI...
296
0
'''simple docstring''' from typing import TYPE_CHECKING from ...utils import ( OptionalDependencyNotAvailable, _LazyModule, is_flax_available, is_tf_available, is_torch_available, is_vision_available, ) UpperCamelCase__: Dict = {"configuration_vit":...
23
from pathlib import Path import fire def __lowercase ( _SCREAMING_SNAKE_CASE , _SCREAMING_SNAKE_CASE , _SCREAMING_SNAKE_CASE ) -> List[str]: '''simple docstring''' SCREAMING_SNAKE_CASE = Path(_SCREAMING_SNAKE_CASE ) SCREAMING_SNAKE_CASE = ...
296
0
"""simple docstring""" from __future__ import annotations from decimal import Decimal from math import * # noqa: F403 from sympy import diff def lowercase ( _SCREAMING_SNAKE_CASE : Any , _SCREAMING_SNAKE_CASE : Tuple , _SCREAMING_SNAKE_CASE : T...
260
import importlib import json import os import sys import tempfile import unittest from pathlib import Path import transformers import transformers.models.auto from transformers.models.auto.configuration_auto import CONFIG_MAPPING, AutoConfig from transformers.models.bert.configuration_bert impor...
296
0
'''simple docstring''' # Author: OMKAR PATHAK, Nwachukwu Chidiebere # Use a Python dictionary to construct the graph. from __future__ import annotations from pprint import pformat from typing import Generic, TypeVar lowerCAmelCase: Union[str, Any] = TypeVar('T') class a__( ...
297
import copy import os from typing import Union from ...configuration_utils import PretrainedConfig from ...utils import logging SCREAMING_SNAKE_CASE_ = logging.get_logger(__name__) SCREAMING_SNAKE_CASE_ = { """microsoft/git-base""": """https://huggingface.co/mi...
296
0
import argparse import json import requests import torch from huggingface_hub import hf_hub_download from PIL import Image from torchvision import transforms from transformers import BitImageProcessor, FocalNetConfig, FocalNetForImageClassification from transformers.image_utils import IMAGENET_DEFAULT_MEAN, IMAGENE...
275
import itertools import os import random import tempfile import unittest import numpy as np from transformers import TvltFeatureExtractor, is_datasets_available from transformers.testing_utils import check_json_file_has_correct_format, require_torch, require_torchaudio from transformers.utils.im...
296
0
import os import sys import unittest UpperCAmelCase : Tuple = 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...
95
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, MobileViTImageProc...
296
0
# limitations under the License. # NOTE: This file is deprecated and will be removed in a future version. # It only exists so that temporarely `from diffusers.pipelines import DiffusionPipeline` works from .pipelines import DiffusionPipeline, ImagePipelineOutput # noqa: F401 from .utils import deprecate depre...
236
from collections import OrderedDict from ...utils import logging from .auto_factory import _BaseAutoModelClass, _LazyAutoMapping, auto_class_update from .configuration_auto import CONFIG_MAPPING_NAMES SCREAMING_SNAKE_CASE_ = logging.get_logger(__name__) SCREAMING_SNAKE_CASE_ ...
296
0
from collections.abc import Callable class _snake_case : def __init__( self , _a = None ): __magic_name__ : int = [] # Stores indexes of each item for supporting updates and deletion. __magic_name__ : List[str] = {} # Stores current size of heap. ...
281
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 from ..auto import CONFIG_MAPPING SCREAMING_SNAKE_CASE_ = logging.get_logg...
296
0
"""simple docstring""" from __future__ import annotations from math import gcd def lowerCamelCase__ ( _lowerCamelCase : List[Any] , _lowerCamelCase : List[Any] = 2 , _lowerCamelCase : str = 1 , _lowerCamelCase : Tuple = ...
183
from collections import defaultdict from math import gcd def __lowercase ( _SCREAMING_SNAKE_CASE = 1_50_00_00 ) -> int: '''simple docstring''' SCREAMING_SNAKE_CASE = defaultdict(_SCREAMING_SNAKE_CASE ) SCREAMING_SNAKE_CASE = 2 while 2 * euc...
296
0
import argparse import json import os import numpy as np import PIL import requests import tensorflow.keras.applications.efficientnet as efficientnet import torch from huggingface_hub import hf_hub_download from PIL import Image from tensorflow.keras.preprocessing import image from transformers import ...
156
from argparse import ArgumentParser from .env import EnvironmentCommand def __lowercase ( ) -> Dict: '''simple docstring''' SCREAMING_SNAKE_CASE = ArgumentParser("""Diffusers CLI tool""" , usage="""diffusers-cli <command> [<args>]""" ) SCREAMING_...
296
0
"""simple docstring""" import math import unittest def __a ( __lowerCamelCase ): assert isinstance(_SCREAMING_SNAKE_CASE, _SCREAMING_SNAKE_CASE ) and ( number >= 0 ), "'number' must been an int and positive" if 1 < number < 4: # 2 and 3 are primes return True elif n...
61
import argparse import json import requests import timm import torch from huggingface_hub import hf_hub_download from PIL import Image from transformers import AutoImageProcessor, SwinConfig, SwinForImageClassification def __lowercase ( _SCREAMING_SNAKE_CASE ) -> Union[str, Any...
296
0
"""simple docstring""" def a_ ( _lowerCAmelCase : str = 1000 ): '''simple docstring''' lowercase__ : Optional[Any] = 2**power lowercase__ : str = str(_SCREAMING_SNAKE_CASE ) lowercase__ : str = list(_SCREAMING_SNAKE_CASE ) ...
77
import os from distutils.util import strtobool def __lowercase ( _SCREAMING_SNAKE_CASE , _SCREAMING_SNAKE_CASE ) -> Tuple: '''simple docstring''' for e in env_keys: SCREAMING_SNAKE_CASE = int(os.environ.get(_SCREAMING_SNAKE_CASE , -1 ) )...
296
0
'''simple docstring''' import argparse import glob import importlib.util import os import re import black from doc_builder.style_doc import style_docstrings_in_code # All paths are set with the intent you should run this script from the root of the repo with the command # python utils...
23
import dataclasses import json import warnings from dataclasses import dataclass, field from time import time from typing import List from ..utils import logging SCREAMING_SNAKE_CASE_ = logging.get_logger(__name__) def __lowercase ( _SCREAMING_SNAKE_CASE=None , ...
296
0
"""simple docstring""" import unittest import torch from torch import nn from accelerate.test_utils import require_cuda from accelerate.utils.memory import find_executable_batch_size, release_memory def lowercase ( ): '''simple docstring''' rai...
260
import math import unittest def __lowercase ( _SCREAMING_SNAKE_CASE ) -> bool: '''simple docstring''' assert isinstance(_SCREAMING_SNAKE_CASE , _SCREAMING_SNAKE_CASE ) and ( number >= 0 ), "'number' must been an int and positive" if 1...
296
0
'''simple docstring''' from argparse import ArgumentParser from datasets.commands.convert import ConvertCommand from datasets.commands.dummy_data import DummyDataCommand from datasets.commands.env import EnvironmentCommand from datasets.commands.run_beam import RunBeamCommand from datasets.commands.test impo...
297
import random class UpperCamelCase__ : '''simple docstring''' @staticmethod def SCREAMING_SNAKE_CASE__ ( lowerCamelCase__ : str ) -> tuple[list[int], list[int]]: '''simple docstring''' SCREAMING_SNAKE_CASE = ...
296
0
import argparse import OmegaConf import torch from diffusers import DDIMScheduler, LDMPipeline, UNetLDMModel, VQModel def _lowercase ( lowercase__ , lowercase__ , lowercase__ ): __lowerCAmelCase : Optional[int] = OmegaConf.load(_SCREAMING_SNAKE_CASE ) __lowerC...
275
from typing import List from ...configuration_utils import PretrainedConfig from ...utils import logging SCREAMING_SNAKE_CASE_ = logging.get_logger(__name__) SCREAMING_SNAKE_CASE_ = { """snap-research/efficientformer-l1-300""": ( """https://huggingface.c...
296
0
from __future__ import annotations class __lowerCAmelCase : def __init__( self , lowerCAmelCase__ ) -> None: '''simple docstring''' a__ : List[Any] =order # a_{0} ... a_{k} a_...
95
import importlib import shutil import threading import warnings from typing import List import fsspec import fsspec.asyn from . import compression from .hffilesystem import HfFileSystem SCREAMING_SNAKE_CASE_ = importlib.util.find_spec("""s3fs""") is not None if _has_safs: ...
296
0
# 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/licenses/LICENSE-2.0 # # Unless required by...
236
import unittest import numpy as np import torch from diffusers import KarrasVePipeline, KarrasVeScheduler, UNetaDModel from diffusers.utils.testing_utils import enable_full_determinism, require_torch, slow, torch_device enable_full_determinism() class UpperCamelCase__ ( unittest.TestC...
296
0
import unittest import numpy as np import torch from transformers import CLIPTextConfig, CLIPTextModel, CLIPTokenizer from diffusers import ( AutoencoderKL, DDIMScheduler, DPMSolverMultistepScheduler, TextToVideoSDPipeline, UNetaDConditionModel, ) from diffusers.utils import is_xformers_available...
281
from typing import Callable, Optional from .. import Features from ..packaged_modules.generator.generator import Generator from .abc import AbstractDatasetInputStream class UpperCamelCase__ ( lowerCAmelCase_ ): '''simple docstring''' def __init__( self : Un...
296
0
"""simple docstring""" import unittest from transformers import MPNetConfig, is_torch_available from transformers.testing_utils import require_torch, slow, torch_device from ...test_configuration_common import ConfigTester from ...test_modeling_common import ModelTesterMixin, ids_tensor...
183
import logging from dataclasses import dataclass, field from typing import Optional from seqaseq_trainer import arg_to_scheduler from transformers import TrainingArguments SCREAMING_SNAKE_CASE_ = logging.getLogger(__name__) @dataclass class UpperCamelCase__ ( lowerCAmel...
296
0
import argparse import gc import json import os import re import torch from huggingface_hub import hf_hub_download from transformers import AutoModelForCausalLM, AutoTokenizer, PreTrainedTokenizerFast, RwkvConfig from transformers.modeling_utils import WEIGHTS_INDEX_NAME, shard_checkpoint __lowerCAme...
156
import unittest import numpy as np import torch from transformers import CLIPTextConfig, CLIPTextModel, CLIPTokenizer from diffusers import ( AutoencoderKL, DDIMScheduler, DPMSolverMultistepScheduler, TextToVideoSDPipeline, UNetaDConditionModel, ) from diffusers.utils impo...
296
0
"""simple docstring""" def __a ( __lowerCamelCase, __lowerCamelCase, __lowerCamelCase ): return round(float(moles / volume ) * nfactor ) def __a ( __lowerCamelCase, __lowerCamelCase, __lowerCamelCase ): return round(float((moles * 0.0821 * temperature) / (volume) ) ) def ...
61
def __lowercase ( _SCREAMING_SNAKE_CASE = 10 ) -> str: '''simple docstring''' if not isinstance(_SCREAMING_SNAKE_CASE , _SCREAMING_SNAKE_CASE ) or n < 0: raise ValueError("""Invalid input""" ) SCREAMING_SNAKE_CASE = 10**n SCREAMING_SNAK...
296
0
"""simple docstring""" 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 UpperCAmelCase_ ( lowerCAmelCase_ , ...
77
from typing import TYPE_CHECKING from ...utils import ( OptionalDependencyNotAvailable, _LazyModule, is_sentencepiece_available, is_tokenizers_available, is_torch_available, ) SCREAMING_SNAKE_CASE_ = { """configuration_llama""": ["""LLAMA_PRETRAINED_CONFI...
296
0
'''simple docstring''' import inspect import unittest from huggingface_hub import hf_hub_download from transformers import ASTConfig from transformers.testing_utils import require_torch, require_torchaudio, slow, torch_device from transformers.utils import cached_property, is_torch_availab...
23
from pathlib import Path import fire def __lowercase ( _SCREAMING_SNAKE_CASE , _SCREAMING_SNAKE_CASE , _SCREAMING_SNAKE_CASE ) -> List[str]: '''simple docstring''' SCREAMING_SNAKE_CASE = Path(_SCREAMING_SNAKE_CASE ) SCREAMING_SNAKE_CASE = ...
296
0
"""simple docstring""" def lowercase ( _SCREAMING_SNAKE_CASE : str = 100_0000 ): '''simple docstring''' _UpperCAmelCase = 1 _UpperCAmelCase = 1 _UpperCAmelCase = {1: 1} for inputa in range(2 , _SCREAMING_SNAKE_CASE ...
260
import importlib import json import os import sys import tempfile import unittest from pathlib import Path import transformers import transformers.models.auto from transformers.models.auto.configuration_auto import CONFIG_MAPPING, AutoConfig from transformers.models.bert.configuration_bert impor...
296
0
'''simple docstring''' import json import os import shutil import tempfile import unittest from transformers import BatchEncoding, CanineTokenizer from transformers.testing_utils import require_tokenizers, require_torch from transformers.tokenization_utils import AddedToken from transformers.utils import cac...
297
import copy import os from typing import Union from ...configuration_utils import PretrainedConfig from ...utils import logging SCREAMING_SNAKE_CASE_ = logging.get_logger(__name__) SCREAMING_SNAKE_CASE_ = { """microsoft/git-base""": """https://huggingface.co/mi...
296
0
from __future__ import annotations def _lowercase ( lowercase__ ): __lowerCAmelCase : str = str(_SCREAMING_SNAKE_CASE ) return len(_SCREAMING_SNAKE_CASE ) == 9 and set(_SCREAMING_SNAKE_CASE ) == set('''123456789''' ) def _lowercase ( ): ...
275
import itertools import os import random import tempfile import unittest import numpy as np from transformers import TvltFeatureExtractor, is_datasets_available from transformers.testing_utils import check_json_file_has_correct_format, require_torch, require_torchaudio from transformers.utils.im...
296
0
from torch import nn def _A ( SCREAMING_SNAKE_CASE : str ): """simple docstring""" if act_fn in ["swish", "silu"]: return nn.SiLU() elif act_fn == "mish": return nn.Mish() elif act_fn == "gelu": return nn.GELU() else: raise ValueErro...
95
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, MobileViTImageProc...
296
0
def UpperCAmelCase__ ( lowerCamelCase ): if not isinstance(_SCREAMING_SNAKE_CASE, _SCREAMING_SNAKE_CASE ): raise ValueError("Input series is not valid, valid series - [2, 4, 6]" ) if len(_SCREAMING_SNAKE_CASE ) == 0: raise ValueError("Input list must be a non empty list...
236
from collections import OrderedDict from ...utils import logging from .auto_factory import _BaseAutoModelClass, _LazyAutoMapping, auto_class_update from .configuration_auto import CONFIG_MAPPING_NAMES SCREAMING_SNAKE_CASE_ = logging.get_logger(__name__) SCREAMING_SNAKE_CASE_ ...
296
0
from math import factorial, radians def lowerCAmelCase_ ( _snake_case : List[str] , _snake_case : Union[str, Any] = 18 , _snake_case : List[Any] = 10 ) -> float: '''simple docstring''' __magic_name__ : Tuple = angle_in_degrees - ((angle_in_degr...
281
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 from ..auto import CONFIG_MAPPING SCREAMING_SNAKE_CASE_ = logging.get_logg...
296
0
"""simple docstring""" import tempfile import numpy as np import torch from transformers import AutoTokenizer, TaEncoderModel from diffusers import DDPMScheduler, UNetaDConditionModel from diffusers.models.attention_processor import AttnAddedKVProcessor from diffusers.pipelines.deepfl...
183
from collections import defaultdict from math import gcd def __lowercase ( _SCREAMING_SNAKE_CASE = 1_50_00_00 ) -> int: '''simple docstring''' SCREAMING_SNAKE_CASE = defaultdict(_SCREAMING_SNAKE_CASE ) SCREAMING_SNAKE_CASE = 2 while 2 * euc...
296
0
def UpperCAmelCase_ ( __lowerCAmelCase ) -> Optional[Any]: stooge(_SCREAMING_SNAKE_CASE , 0 , len(_SCREAMING_SNAKE_CASE ) - 1 ) return arr def UpperCAmelCase_ ( __lowerCAmelCase , __lowerCAmelCase , __lowerCAmelCase ) -> str: if i >= h: ...
156
from argparse import ArgumentParser from .env import EnvironmentCommand def __lowercase ( ) -> Dict: '''simple docstring''' SCREAMING_SNAKE_CASE = ArgumentParser("""Diffusers CLI tool""" , usage="""diffusers-cli <command> [<args>]""" ) SCREAMING_...
296
0
"""simple docstring""" import operator as op _a = 'scaler.pt' _a = 'pytorch_model' _a = 'random_states' _a = 'optimizer' _a = 'scheduler' _a = 'pytorch_model.bin' _a = 'pytorch_model.bin.index.json' _a = ...
61
import argparse import json import requests import timm import torch from huggingface_hub import hf_hub_download from PIL import Image from transformers import AutoImageProcessor, SwinConfig, SwinForImageClassification def __lowercase ( _SCREAMING_SNAKE_CASE ) -> Union[str, Any...
296
0
"""simple docstring""" _UpperCamelCase : Union[str, Any] = "\n# Transformers installation\n! pip install transformers datasets\n# To install from source instead of the last release, comment the command above and uncomment the following one.\n# ! pip install git+https://github.com/huggingface/transfo...
77
import os from distutils.util import strtobool def __lowercase ( _SCREAMING_SNAKE_CASE , _SCREAMING_SNAKE_CASE ) -> Tuple: '''simple docstring''' for e in env_keys: SCREAMING_SNAKE_CASE = int(os.environ.get(_SCREAMING_SNAKE_CASE , -1 ) )...
296
0
'''simple docstring''' from __future__ import annotations import time from collections.abc import Sequence from random import randint from matplotlib import pyplot as plt def snake_case_ ( _lowerCAmelCase : Optional[Any] , _lowerCAmelCase : Union[str, Any] ...
23
import dataclasses import json import warnings from dataclasses import dataclass, field from time import time from typing import List from ..utils import logging SCREAMING_SNAKE_CASE_ = logging.get_logger(__name__) def __lowercase ( _SCREAMING_SNAKE_CASE=None , ...
296
0
"""simple docstring""" 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 : List[Any] = object() # For specifying empty leaf dict `{}` __A : ...
260
import math import unittest def __lowercase ( _SCREAMING_SNAKE_CASE ) -> bool: '''simple docstring''' assert isinstance(_SCREAMING_SNAKE_CASE , _SCREAMING_SNAKE_CASE ) and ( number >= 0 ), "'number' must been an int and positive" if 1...
296
0
'''simple docstring''' import collections import importlib.util import os import re from pathlib import Path lowerCAmelCase: Optional[int] = 'src/transformers' # Matches is_xxx_available() lowerCAmelCase: Dict = re.compile(r'is\_([a-z_]*)_available()') # Catches a...
297
import random class UpperCamelCase__ : '''simple docstring''' @staticmethod def SCREAMING_SNAKE_CASE__ ( lowerCamelCase__ : str ) -> tuple[list[int], list[int]]: '''simple docstring''' SCREAMING_SNAKE_CASE = ...
296
0
import contextlib import copy import random from typing import Any, Dict, Iterable, Optional, Union import numpy as np import torch from .utils import deprecate, is_transformers_available if is_transformers_available(): import transformers def _lowercase ( lowercase__ ): random.seed(_SCRE...
275
from typing import List from ...configuration_utils import PretrainedConfig from ...utils import logging SCREAMING_SNAKE_CASE_ = logging.get_logger(__name__) SCREAMING_SNAKE_CASE_ = { """snap-research/efficientformer-l1-300""": ( """https://huggingface.c...
296
0
def _A ( SCREAMING_SNAKE_CASE : List[Any] = 100 ): """simple docstring""" a__ : str =n * (n + 1) * (2 * n + 1) / 6 a__ : int =(n * (n + 1) / 2) ** 2 return int(square_of_sum - sum_of_squares ) if __name__ == "__main__": ...
95
import importlib import shutil import threading import warnings from typing import List import fsspec import fsspec.asyn from . import compression from .hffilesystem import HfFileSystem SCREAMING_SNAKE_CASE_ = importlib.util.find_spec("""s3fs""") is not None if _has_safs: ...
296
0
def UpperCAmelCase__ ( lowerCamelCase = 1000000 ): lowercase :str = set(range(3, _SCREAMING_SNAKE_CASE, 2 ) ) primes.add(2 ) for p in range(3, _SCREAMING_SNAKE_CASE, 2 ): if p not in primes: continue primes.difference_update(set(range(p * p, _SCREAMI...
236
import unittest import numpy as np import torch from diffusers import KarrasVePipeline, KarrasVeScheduler, UNetaDModel from diffusers.utils.testing_utils import enable_full_determinism, require_torch, slow, torch_device enable_full_determinism() class UpperCamelCase__ ( unittest.TestC...
296
0
# Copyright 2022 The HuggingFace Team. All rights reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicab...
281
from typing import Callable, Optional from .. import Features from ..packaged_modules.generator.generator import Generator from .abc import AbstractDatasetInputStream class UpperCamelCase__ ( lowerCAmelCase_ ): '''simple docstring''' def __init__( self : Un...
296
0
"""simple docstring""" import importlib import json import os import sys import tempfile import unittest from pathlib import Path import transformers import transformers.models.auto from transformers.models.auto.configuration_auto import CONFIG_MAPPING, AutoConfig from transformers....
183
import logging from dataclasses import dataclass, field from typing import Optional from seqaseq_trainer import arg_to_scheduler from transformers import TrainingArguments SCREAMING_SNAKE_CASE_ = logging.getLogger(__name__) @dataclass class UpperCamelCase__ ( lowerCAmel...
296
0
from ...configuration_utils import PretrainedConfig from ...utils import logging __lowerCAmelCase : List[Any] = logging.get_logger(__name__) __lowerCAmelCase : int = { "EleutherAI/gpt-neox-20b": "https://huggingface.co/EleutherAI/gpt-neox-20b/resolve/main/config.json", # S...
156
import unittest import numpy as np import torch from transformers import CLIPTextConfig, CLIPTextModel, CLIPTokenizer from diffusers import ( AutoencoderKL, DDIMScheduler, DPMSolverMultistepScheduler, TextToVideoSDPipeline, UNetaDConditionModel, ) from diffusers.utils impo...
296
0
"""simple docstring""" import os import unittest from tempfile import TemporaryDirectory import torch import torch.nn as nn from accelerate.utils import ( OffloadedWeightsLoader, extract_submodules_state_dict, load_offloaded_weight, offload_state_dict, offload_weight, ) class A_ (nn.Module...
61
def __lowercase ( _SCREAMING_SNAKE_CASE = 10 ) -> str: '''simple docstring''' if not isinstance(_SCREAMING_SNAKE_CASE , _SCREAMING_SNAKE_CASE ) or n < 0: raise ValueError("""Invalid input""" ) SCREAMING_SNAKE_CASE = 10**n SCREAMING_SNAK...
296
0
"""simple docstring""" import os import unittest from transformers import FunnelTokenizer, FunnelTokenizerFast from transformers.models.funnel.tokenization_funnel import VOCAB_FILES_NAMES from transformers.testing_utils import require_tokenizers from ...test_tokenization_common import TokenizerTesterMixin @req...
77
from typing import TYPE_CHECKING from ...utils import ( OptionalDependencyNotAvailable, _LazyModule, is_sentencepiece_available, is_tokenizers_available, is_torch_available, ) SCREAMING_SNAKE_CASE_ = { """configuration_llama""": ["""LLAMA_PRETRAINED_CONFI...
296
0
'''simple docstring''' from __future__ import annotations import inspect import unittest from math import floor import numpy as np from transformers import CvtConfig from transformers.testing_utils import require_tf, require_vision, slow from transformers.utils import cached_property, ...
23
from pathlib import Path import fire def __lowercase ( _SCREAMING_SNAKE_CASE , _SCREAMING_SNAKE_CASE , _SCREAMING_SNAKE_CASE ) -> List[str]: '''simple docstring''' SCREAMING_SNAKE_CASE = Path(_SCREAMING_SNAKE_CASE ) SCREAMING_SNAKE_CASE = ...
296
0
"""simple docstring""" import copy import os from typing import Union from ...configuration_utils import PretrainedConfig from ...utils import logging __A : Any = logging.get_logger(__name__) __A : str = { "microsoft/git-base": "https://huggingface.co/...
260
import importlib import json import os import sys import tempfile import unittest from pathlib import Path import transformers import transformers.models.auto from transformers.models.auto.configuration_auto import CONFIG_MAPPING, AutoConfig from transformers.models.bert.configuration_bert impor...
296
0
'''simple docstring''' class a__( lowerCAmelCase_ ): pass class a__( lowerCAmelCase_ ): pass class a__: def __init__( self : List[Any] ): a : Tuple = [ [], [], [], ] def lowercas...
297
import copy import os from typing import Union from ...configuration_utils import PretrainedConfig from ...utils import logging SCREAMING_SNAKE_CASE_ = logging.get_logger(__name__) SCREAMING_SNAKE_CASE_ = { """microsoft/git-base""": """https://huggingface.co/mi...
296
0
from typing import Callable, Optional from .. import Features from ..packaged_modules.generator.generator import Generator from .abc import AbstractDatasetInputStream class __lowercase (lowerCAmelCase_ ): def __init__( self , A_ , A_ = None , A_ = None , ...
275
import itertools import os import random import tempfile import unittest import numpy as np from transformers import TvltFeatureExtractor, is_datasets_available from transformers.testing_utils import check_json_file_has_correct_format, require_torch, require_torchaudio from transformers.utils.im...
296
0
import warnings from ...utils import logging from .image_processing_layoutlmva import LayoutLMvaImageProcessor UpperCAmelCase : Union[str, Any] = logging.get_logger(__name__) class __lowerCAmelCase ( lowerCAmelCase_): def __init__( sel...
95
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, MobileViTImageProc...
296
0
def UpperCAmelCase__ ( lowerCamelCase ): if not isinstance(_SCREAMING_SNAKE_CASE, _SCREAMING_SNAKE_CASE ): raise TypeError("Input value must be an 'int' type" ) lowercase :List[Any] = 0 while number: position += 1 number >>= 1 return position if __name__...
236
from collections import OrderedDict from ...utils import logging from .auto_factory import _BaseAutoModelClass, _LazyAutoMapping, auto_class_update from .configuration_auto import CONFIG_MAPPING_NAMES SCREAMING_SNAKE_CASE_ = logging.get_logger(__name__) SCREAMING_SNAKE_CASE_ ...
296
0
import unittest import numpy as np def lowerCAmelCase_ ( _snake_case : str , _snake_case : Dict , _snake_case : Tuple , _snake_case : str = None , ) -> np.ndarray: '''simple docstring''' __magic_name__ : Optional[Any] = np.sh...
281
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 from ..auto import CONFIG_MAPPING SCREAMING_SNAKE_CASE_ = logging.get_logg...
296
0
"""simple docstring""" def lowerCamelCase__ ( _lowerCamelCase : Optional[int] ) -> bool: lowerCamelCase_ = (1 + 24 * n) ** 0.5 return ((1 + root) / 6) % 1 == 0 def lowerCamelCase__ ( _lowerCamelCase : Tupl...
183
from collections import defaultdict from math import gcd def __lowercase ( _SCREAMING_SNAKE_CASE = 1_50_00_00 ) -> int: '''simple docstring''' SCREAMING_SNAKE_CASE = defaultdict(_SCREAMING_SNAKE_CASE ) SCREAMING_SNAKE_CASE = 2 while 2 * euc...
296
0
from typing import TYPE_CHECKING from ...utils import OptionalDependencyNotAvailable, _LazyModule, is_tokenizers_available, is_torch_available __lowerCAmelCase : Dict = { "configuration_mvp": ["MVP_PRETRAINED_CONFIG_ARCHIVE_MAP", "MvpConfig", "MvpOnnxConfig"], "tokenization_mvp": ["MvpT...
156
from argparse import ArgumentParser from .env import EnvironmentCommand def __lowercase ( ) -> Dict: '''simple docstring''' SCREAMING_SNAKE_CASE = ArgumentParser("""Diffusers CLI tool""" , usage="""diffusers-cli <command> [<args>]""" ) SCREAMING_...
296
0
"""simple docstring""" from typing import Union from ..utils import add_end_docstrings, is_torch_available, is_vision_available, logging from .base import PIPELINE_INIT_ARGS, Pipeline if is_vision_available(): from PIL import Image from ..image_utils import load_image if is_torch_available(): fro...
61
import argparse import json import requests import timm import torch from huggingface_hub import hf_hub_download from PIL import Image from transformers import AutoImageProcessor, SwinConfig, SwinForImageClassification def __lowercase ( _SCREAMING_SNAKE_CASE ) -> Union[str, Any...
296
0
"""simple docstring""" from collections.abc import Iterator, MutableMapping from dataclasses import dataclass from typing import Generic, TypeVar _UpperCamelCase : int = TypeVar("KEY") _UpperCamelCase : int = TypeVar("VAL") @dataclass(frozen=lowerCAmelCase_ , slots=lowerCAmel...
77
import os from distutils.util import strtobool def __lowercase ( _SCREAMING_SNAKE_CASE , _SCREAMING_SNAKE_CASE ) -> Tuple: '''simple docstring''' for e in env_keys: SCREAMING_SNAKE_CASE = int(os.environ.get(_SCREAMING_SNAKE_CASE , -1 ) )...
296
0
'''simple docstring''' def snake_case_ ( _lowerCAmelCase : Dict , _lowerCAmelCase : int , _lowerCAmelCase : Tuple , _lowerCAmelCase : Tuple , _lowerCAmelCase : Union[str, Any] ) -> int: if index == number_of_item...
23
import dataclasses import json import warnings from dataclasses import dataclass, field from time import time from typing import List from ..utils import logging SCREAMING_SNAKE_CASE_ = logging.get_logger(__name__) def __lowercase ( _SCREAMING_SNAKE_CASE=None , ...
296
0
"""simple docstring""" import os from shutil import copyfile from typing import List, Optional, Tuple from ...tokenization_utils import AddedToken from ...tokenization_utils_fast import PreTrainedTokenizerFast from ...utils import is_sentencepiece_available, logging if is_sentencepiece_availabl...
260
import math import unittest def __lowercase ( _SCREAMING_SNAKE_CASE ) -> bool: '''simple docstring''' assert isinstance(_SCREAMING_SNAKE_CASE , _SCREAMING_SNAKE_CASE ) and ( number >= 0 ), "'number' must been an int and positive" if 1...
296
0
'''simple docstring''' from __future__ import annotations def lowerCamelCase__ ( _A , _A ): a : Union[str, Any] = get_failure_array(_SCREAMING_SNAKE_CASE ) # 2) Step through text searching for pattern a , a : str = 0, 0 # index into te...
297
import random class UpperCamelCase__ : '''simple docstring''' @staticmethod def SCREAMING_SNAKE_CASE__ ( lowerCamelCase__ : str ) -> tuple[list[int], list[int]]: '''simple docstring''' SCREAMING_SNAKE_CASE = ...
296
0
from unittest import TestCase from datasets import Dataset from minhash_deduplication import deduplicate_dataset, make_duplicate_clusters def _lowercase ( ): __lowerCAmelCase : Optional[Any] = { '''repo_name''': ['''test_repo1''', '''test_repo2''', '''test_repo3'''], ...
275
from typing import List from ...configuration_utils import PretrainedConfig from ...utils import logging SCREAMING_SNAKE_CASE_ = logging.get_logger(__name__) SCREAMING_SNAKE_CASE_ = { """snap-research/efficientformer-l1-300""": ( """https://huggingface.c...
296
0
from dataclasses import dataclass, field from typing import Tuple from ..utils import cached_property, is_torch_available, is_torch_tpu_available, logging, requires_backends from .benchmark_args_utils import BenchmarkArguments if is_torch_available(): import torch if is_torch_tpu_availabl...
95
import importlib import shutil import threading import warnings from typing import List import fsspec import fsspec.asyn from . import compression from .hffilesystem import HfFileSystem SCREAMING_SNAKE_CASE_ = importlib.util.find_spec("""s3fs""") is not None if _has_safs: ...
296
0
from collections import defaultdict from math import gcd def UpperCAmelCase__ ( lowerCamelCase = 1500000 ): lowercase :str = defaultdict(_SCREAMING_SNAKE_CASE ) lowercase :List[str] = 2 while 2 * euclid_m * (euclid_m + 1) <= limit: for euclid_n in range((euclid_m...
236
import unittest import numpy as np import torch from diffusers import KarrasVePipeline, KarrasVeScheduler, UNetaDModel from diffusers.utils.testing_utils import enable_full_determinism, require_torch, slow, torch_device enable_full_determinism() class UpperCamelCase__ ( unittest.TestC...
296
0
from math import ceil, sqrt def lowerCAmelCase_ ( _snake_case : Union[str, Any] = 1000000 ) -> int: '''simple docstring''' __magic_name__ : Tuple = 0 for outer_width in range(3 , (limit // 4) + 2 ): if outer_width**2 > limit: __magic_name__ : Optional[...
281
from typing import Callable, Optional from .. import Features from ..packaged_modules.generator.generator import Generator from .abc import AbstractDatasetInputStream class UpperCamelCase__ ( lowerCAmelCase_ ): '''simple docstring''' def __init__( self : Un...
296
0
"""simple docstring""" from ..utils import DummyObject, requires_backends class a ( metaclass=lowerCAmelCase_ ): SCREAMING_SNAKE_CASE : Optional[int] = ["sentencepiece"] def __init__( self : List[Any] , *...
183
import logging from dataclasses import dataclass, field from typing import Optional from seqaseq_trainer import arg_to_scheduler from transformers import TrainingArguments SCREAMING_SNAKE_CASE_ = logging.getLogger(__name__) @dataclass class UpperCamelCase__ ( lowerCAmel...
296
0
def UpperCAmelCase_ ( __lowerCAmelCase = 1_000_000 ) -> int: __lowercase : Dict = limit + 1 __lowercase : Optional[Any] = [0] * limit for first_term in range(1 , _SCREAMING_SNAKE_CASE ): for n in range(_SCREAMING_SNAKE_CASE , _SCREAMING_SNAKE_CA...
156
import unittest import numpy as np import torch from transformers import CLIPTextConfig, CLIPTextModel, CLIPTokenizer from diffusers import ( AutoencoderKL, DDIMScheduler, DPMSolverMultistepScheduler, TextToVideoSDPipeline, UNetaDConditionModel, ) from diffusers.utils impo...
296
0
'''simple docstring''' from __future__ import annotations import os import tempfile import unittest from transformers import ConvBertConfig, is_tf_available from transformers.testing_utils import require_tf, slow from ...test_configuration_common import ConfigTester from ...test_modeling_tf_common import T...
297
'''simple docstring''' def lowerCamelCase__ ( _A , _A , _A , _A , _A , ): a : Dict = [redshift, radiation_density, matter_density, dark_energy] if any(p < 0 for p in parameters ): raise ValueError('All input parameters must be positive' ) if any(...
297
1
'''simple docstring''' import inspect import unittest from datasets import load_dataset from packaging import version from transformers import BeitConfig from transformers.models.auto import get_values from transformers.testing_utils import require_torch, require_torch_multi_gpu, require_vision, slow, torch...
297
'''simple docstring''' from __future__ import annotations import math class a__: def __init__( self : List[str] , __snake_case : int ): a : str = size # approximate the overall size of segment tree with given value a : Optional[i...
297
1
'''simple docstring''' def lowerCamelCase__ ( _A ): a : Optional[Any] = len(_A ) a : Optional[Any] = sum(_A ) a : Optional[int] = [[False for x in range(s + 1 )] for y in range(n + 1 )] for i in range(1 , n...
297
'''simple docstring''' def lowerCamelCase__ ( _A , _A ): while second != 0: a : Union[str, Any] = first & second first ^= second a : Tuple = c << 1 return first if __name__ == "__main__": import doctest doctest.testmod(...
297
1
'''simple docstring''' import os from distutils.util import strtobool def lowerCamelCase__ ( _A , _A ): for e in env_keys: a : Optional[int] = int(os.environ.get(_A , -1 ) ) if val >= 0: return val return default def lowerCamelCase__ ...
297
'''simple docstring''' import io import json import fsspec import pytest from datasets import Dataset, DatasetDict, Features, NamedSplit, Value from datasets.io.json import JsonDatasetReader, JsonDatasetWriter from ..utils import assert_arrow_memory_doesnt_increase, assert_arrow_memory_increases def ...
297
1
'''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, TruncationStr...
297
'''simple docstring''' from itertools import zip_longest import requests from bsa import BeautifulSoup from pandas import DataFrame def lowerCamelCase__ ( _A = "laptop" ): a : Any = f"""https://www.amazon.in/laptop/s?k={product}""" a : Tuple = {...
297
1
'''simple docstring''' import os import unittest from transformers.models.transfo_xl.tokenization_transfo_xl import VOCAB_FILES_NAMES, TransfoXLTokenizer from ...test_tokenization_common import TokenizerTesterMixin class a__( lowerCamelCase__ , unittest.TestCase ): lowercase__ = TransfoX...
297
'''simple docstring''' import gc import random import unittest import numpy as np import torch from transformers import ( CLIPImageProcessor, CLIPTextConfig, CLIPTextModel, CLIPTokenizer, CLIPVisionConfig, CLIPVisionModelWithProjection, ) from diffusers import AutoencoderKL, DDIMSche...
297
1
'''simple docstring''' import argparse import torch from transformers import BertConfig, BertForPreTraining, load_tf_weights_in_bert from transformers.utils import logging logging.set_verbosity_info() def lowerCamelCase__ ( _A , _A , _A ): # Initialise PyTorch model a : ...
297
'''simple docstring''' from typing import Mapping from ...configuration_utils import PretrainedConfig from ...onnx import OnnxSeqaSeqConfigWithPast from ...utils import logging lowerCAmelCase: Union[str, Any] = logging.get_logger(__name__) lowerCAmelCase: List[str] = ...
297
1
'''simple docstring''' import json import os import unittest from transformers.models.ctrl.tokenization_ctrl import VOCAB_FILES_NAMES, CTRLTokenizer from ...test_tokenization_common import TokenizerTesterMixin class a__( lowerCamelCase__ , unittest.TestCase ): lowercase__ = CTRLTokenizer...
297
'''simple docstring''' from __future__ import annotations from math import pi, sqrt def lowerCamelCase__ ( _A , _A ): if inductance <= 0: raise ValueError('Inductance cannot be 0 or negative' ) elif capacitance <= 0: raise ValueError('Capacitance cannot be 0 or negative...
297
1
'''simple docstring''' from typing import TYPE_CHECKING from ...utils import ( OptionalDependencyNotAvailable, _LazyModule, is_flax_available, is_torch_available, is_vision_available, ) lowerCAmelCase: Optional[int] = {'configuration_beit': ['BEIT_PRETRAINED_CONFIG_...
297
'''simple docstring''' import collections import os from typing import List, Optional, Tuple from transformers.utils import is_jieba_available, requires_backends if is_jieba_available(): import jieba from ...tokenization_utils import PreTrainedTokenizer from ...utils import logging lowerCAmelCase: ...
297
1
'''simple docstring''' import unittest from parameterized import parameterized from transformers import AutoTokenizer, GPTNeoXConfig, is_torch_available, set_seed from transformers.testing_utils import require_torch, slow, torch_device from ...generation.test_utils import GenerationTesterMixin from ...test...
297
'''simple docstring''' from __future__ import annotations import unittest from transformers import is_tf_available, is_torch_available from transformers.testing_utils import DUMMY_UNKNOWN_IDENTIFIER, SMALL_MODEL_IDENTIFIER, is_pt_tf_cross_test, slow if is_tf_available(): from transformers import ( ...
297
1
'''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/licenses/LICENS...
297
'''simple docstring''' from collections import OrderedDict from typing import Mapping from ...configuration_utils import PretrainedConfig from ...onnx import OnnxConfig from ...utils import logging lowerCAmelCase: List[Any] = logging.get_logger(__name__) lowerCAmelCase: List[Any] ...
297
1
'''simple docstring''' from ...configuration_utils import PretrainedConfig from ...utils import logging lowerCAmelCase: Optional[int] = logging.get_logger(__name__) class a__( lowerCamelCase__ ): lowercase__ = """timm_backbone""" def __init__( self : ...
297
'''simple docstring''' def lowerCamelCase__ ( _A ): return 10 - x * x def lowerCamelCase__ ( _A , _A ): # Bolzano theory in order to find if there is a root between a and b if equation(_A ) * equation(_A ) >= 0: raise ValueError('Wrong space!' ) ...
297
1
'''simple docstring''' import argparse lowerCAmelCase: Union[str, Any] = 'docs/source/_static/js/custom.js' def lowerCamelCase__ ( _A ): with open(_A , encoding='utf-8' , newline='\n' ) as f: a : Tuple = f.readlines() a : U...
297
'''simple docstring''' import unittest from transformers import EsmConfig, is_torch_available from transformers.testing_utils import TestCasePlus, require_torch, slow, torch_device from ...test_configuration_common import ConfigTester from ...test_modeling_common import ModelTesterMixin, ids_tensor, random_...
297
1
'''simple docstring''' # Copyright 2023 The HuggingFace Team. All rights reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0...
297
'''simple docstring''' from typing import Optional from torch import nn from .transformer_ad import TransformeraDModel, TransformeraDModelOutput class a__( nn.Module ): def __init__( self : Any , __snake_case : int = 16 , __snake_case : int = 88 , __snake_...
297
1
'''simple docstring''' import random import unittest import torch from diffusers import IFInpaintingPipeline from diffusers.utils import floats_tensor from diffusers.utils.import_utils import is_xformers_available from diffusers.utils.testing_utils import skip_mps, torch_device from ..pipeline_params impor...
297
'''simple docstring''' from typing import TYPE_CHECKING from ...utils import ( OptionalDependencyNotAvailable, _LazyModule, is_sentencepiece_available, is_torch_available, ) lowerCAmelCase: Union[str, Any] = { 'configuration_speecht5': [ 'SPEECHT5_PRETRAINED...
297
1
'''simple docstring''' from typing import Callable, Dict, Optional, Tuple import torch from torch import nn from torch.distributions import ( AffineTransform, Distribution, Independent, NegativeBinomial, Normal, StudentT, TransformedDistribution, ) class a__( lowerCame...
297
'''simple docstring''' # Copyright 2023 The HuggingFace Team. All rights reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0...
297
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: str = logging.get_logger(__name__) lowerCAmelCase: ...
297
'''simple docstring''' import json from typing import Dict, List, Optional, Tuple, Union from tokenizers import pre_tokenizers, processors from ...tokenization_utils_base import AddedToken, BatchEncoding, EncodedInput from ...tokenization_utils_fast import PreTrainedTokenizerFast from ...utils import Paddin...
297
1
'''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 ...models import Model...
297
'''simple docstring''' import copy import os import cva import numpy as np from matplotlib import pyplot as plt class a__: def __init__( self : Tuple ): a : Optional[int] = '' a : Optional[Any] = '' a : str = ...
297
1
'''simple docstring''' from typing import Mapping from ...configuration_utils import PretrainedConfig from ...onnx import OnnxSeqaSeqConfigWithPast from ...utils import logging lowerCAmelCase: Union[str, Any] = logging.get_logger(__name__) lowerCAmelCase: List[str] = ...
297
'''simple docstring''' import baseaa import io import json import os from copy import deepcopy from ..optimizer import AcceleratedOptimizer from ..scheduler import AcceleratedScheduler class a__: def __init__( self : List[Any] , __snake_case : Union[str, Any] ): if isin...
297
1
'''simple docstring''' import copy import re class a__: lowercase__ = """hp""" lowercase__ = {} lowercase__ = None @classmethod def lowercase_ ( cls : Optional[Any] , __snake_case : Optional[int] , __snake_case : Tuple ): a ...
297
'''simple docstring''' import ast import os import re import shutil import tempfile import unittest from unittest import mock import torch from accelerate.test_utils.examples import compare_against_test from accelerate.test_utils.testing import TempDirTestCase, require_trackers, run_command, slow from accel...
297
1
'''simple docstring''' import collections import inspect import unittest from transformers import FocalNetConfig from transformers.testing_utils import require_torch, require_vision, slow, torch_device from transformers.utils import cached_property, is_torch_available, is_vision_available from ...test_backb...
297
'''simple docstring''' import json import multiprocessing import os import re from collections import defaultdict import torch from accelerate import Accelerator from accelerate.utils import set_seed from arguments import HumanEvalArguments from datasets import load_dataset, load_metric from torch.utils.data...
297
1