code
stringlengths
81
54k
code_codestyle
int64
0
721
style_context
stringlengths
91
41.9k
style_context_codestyle
int64
0
699
label
int64
0
1
"""simple docstring""" from dataclasses import dataclass, field from typing import ClassVar, Dict from ..features import Features, Value from .base import TaskTemplate @dataclass(frozen=snake_case_ ) class a_ ( snake_case_ ): '''simple docstring''' lowerCamelCase__ : str ...
696
"""simple docstring""" import sys import webbrowser import requests from bsa import BeautifulSoup from fake_useragent import UserAgent if __name__ == "__main__": print("Googling.....") A_ : Optional[int] = "https://www.google.com/search?q=" + " ".join(sys.argv[1:]) A_ : L...
696
1
"""simple docstring""" def lowerCamelCase_ ( _lowerCamelCase ): return number & 1 == 0 if __name__ == "__main__": import doctest doctest.testmod()
696
"""simple docstring""" import os import tempfile import unittest import numpy as np from diffusers.utils import is_flax_available from diffusers.utils.testing_utils import require_flax, slow if is_flax_available(): import jax import jax.numpy as jnp from flax.jax_utils import replicate ...
696
1
"""simple docstring""" import re def lowerCamelCase_ ( _lowerCamelCase ): return [char.split() for char in re.split(r'[^ a-z A-Z 0-9 \s]' , str_ )] def lowerCamelCase_ ( _lowerCamelCase ): lowerCamelCase__ : Optional[int] = split_input(str_ ...
696
"""simple docstring""" from typing import List, Optional, Tuple, Union import torch from ...utils import logging, randn_tensor from ..pipeline_utils import AudioPipelineOutput, DiffusionPipeline A_ : Dict = logging.get_logger(__name__) # pylint: disable=invalid-name class a_ ( snake_c...
696
1
"""simple docstring""" import os def lowerCamelCase_ ( ): with open(os.path.dirname(_lowerCamelCase ) + '/p022_names.txt' ) as file: lowerCamelCase__ : Union[str, Any] = str(file.readlines()[0] ) lowerCamelCase__ : int = names.replace('"' , '' ...
696
"""simple docstring""" import unittest from pathlib import Path from tempfile import NamedTemporaryFile, TemporaryDirectory from transformers import BertConfig, BertTokenizerFast, FeatureExtractionPipeline from transformers.convert_graph_to_onnx import ( convert, ensure_valid_input, generate_identif...
696
1
"""simple docstring""" import itertools from dataclasses import dataclass from typing import Optional import pandas as pd import pyarrow as pa import datasets from datasets.table import table_cast @dataclass class a_ ( datasets.BuilderConfig ): '''simple docstring''' lowerCamelCa...
696
"""simple docstring""" 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 f...
696
1
"""simple docstring""" def lowerCamelCase_ ( _lowerCamelCase = 400_0000 ): lowerCamelCase__ : Union[str, Any] = [] lowerCamelCase__ , lowerCamelCase__ : int = 0, 1 while b <= n: if b % 2 == 0: even_fibs.append(_lowerCamelCase ) lowerCamelCase__ ...
696
"""simple docstring""" A_ : List[str] = { "Pillow": "Pillow<10.0.0", "accelerate": "accelerate>=0.20.3", "av": "av==9.2.0", "beautifulsoup4": "beautifulsoup4", "black": "black~=23.1", "codecarbon": "codecarbon==1.2.0", "cookiecutter": "cookiecutter==1.7.3", "datacla...
696
1
"""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 ViTConfig, ViTForImageClassification, ViTImageProcessor, ViTModel from transformers.utils import logging logging....
696
"""simple docstring""" from binascii import hexlify from hashlib import shaaaa from os import urandom # RFC 3526 - More Modular Exponential (MODP) Diffie-Hellman groups for # Internet Key Exchange (IKE) https://tools.ietf.org/html/rfc3526 A_ : Optional[int] = { # 1536-bit 5: { "p...
696
1
"""simple docstring""" from ..utils import DummyObject, requires_backends class a_ ( metaclass=snake_case_ ): '''simple docstring''' lowerCamelCase__ : str = ['onnx'] def __init__(self, *lowerCamelCase_, **lowerCamelCase_ ): '''simple docstring''...
696
"""simple docstring""" def lowerCamelCase_ ( _lowerCamelCase , _lowerCamelCase ): if mass < 0: raise ValueError('The mass of a body cannot be negative' ) return 0.5 * mass * abs(_lowerCamelCase ) * abs(_lowerCamelCase ) if __name__ == "__main__": import doctest ...
696
1
"""simple docstring""" from __future__ import annotations import unittest from transformers import is_tf_available from transformers.testing_utils import require_sentencepiece, require_tf, require_tokenizers, slow from ...test_configuration_common import ConfigTester from ...test_modeling_tf_common import TFM...
696
"""simple docstring""" 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 fro...
696
1
"""simple docstring""" def lowerCamelCase_ ( _lowerCamelCase , _lowerCamelCase ): # "extended trapezoidal rule" # int(f) = dx/2 * (f1 + 2f2 + ... + fn) lowerCamelCase__ : Tuple = (boundary[1] - boundary[0]) / steps lowerCamelCase__ : List[str] = boundary[0] lowe...
696
"""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 a_ ( snake_case_ ): '''simple docstring''' ...
696
1
"""simple docstring""" import unittest from transformers import CamembertTokenizer, CamembertTokenizerFast from transformers.testing_utils import get_tests_dir, require_sentencepiece, require_tokenizers, slow from transformers.utils import is_torch_available from ...test_tokenization_common import TokenizerTes...
696
"""simple docstring""" from __future__ import annotations import math from collections import Counter from string import ascii_lowercase def lowerCamelCase_ ( _lowerCamelCase ): lowerCamelCase__ , lowerCamelCase__ : List[str] = analyze_text(_lowerCamelCase ) lowerC...
696
1
"""simple docstring""" from typing import TYPE_CHECKING from ...utils import ( OptionalDependencyNotAvailable, _LazyModule, is_tokenizers_available, is_torch_available, is_vision_available, ) A_ : List[Any] = { "configuration_perceiver": ["PERCEIVER_PRETRAINED_CONFIG_ARC...
696
"""simple docstring""" import os def lowerCamelCase_ ( ): with open(os.path.dirname(_lowerCamelCase ) + '/p022_names.txt' ) as file: lowerCamelCase__ : Union[str, Any] = str(file.readlines()[0] ) lowerCamelCase__ : int = names.replace('"' , '' ...
696
1
"""simple docstring""" from typing import List, Optional, Tuple, Union import torch from ...utils import logging, randn_tensor from ..pipeline_utils import AudioPipelineOutput, DiffusionPipeline A_ : Dict = logging.get_logger(__name__) # pylint: disable=invalid-name class a_ ( snake_c...
696
"""simple docstring""" import warnings from contextlib import contextmanager from ...processing_utils import ProcessorMixin class a_ ( snake_case_ ): '''simple docstring''' lowerCamelCase__ : int = 'Speech2TextFeatureExtractor' lowerCamelCase__ : Dict = ...
696
1
"""simple docstring""" from typing import TYPE_CHECKING from ...utils import ( OptionalDependencyNotAvailable, _LazyModule, is_flax_available, is_tf_available, is_tokenizers_available, is_torch_available, is_vision_available, ) A_ : List[Any] = { "configuration_o...
696
"""simple docstring""" import unittest from transformers import MobileBertConfig, is_torch_available from transformers.models.auto import get_values from transformers.testing_utils import require_sentencepiece, require_tokenizers, require_torch, slow, torch_device from ...test_configuration_common import Confi...
696
1
"""simple docstring""" from typing import Any import numpy as np def lowerCamelCase_ ( _lowerCamelCase ): return np.array_equal(_lowerCamelCase , matrix.conjugate().T ) def lowerCamelCase_ ( _lowerCamelCase , _lowerCamelCase ): lowerCamelCase__ : U...
696
"""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 im...
696
1
"""simple docstring""" import inspect import unittest from transformers import MobileNetVaConfig 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_configuration_common imp...
696
"""simple docstring""" from ..utils import DummyObject, requires_backends class a_ ( metaclass=snake_case_ ): '''simple docstring''' lowerCamelCase__ : str = ['speech'] def __init__(self, *lowerCamelCase_, **lowerCamelCase_ ): '''simple docstring...
696
1
"""simple docstring""" from typing import TYPE_CHECKING from ...utils import OptionalDependencyNotAvailable, _LazyModule, is_tf_available, is_torch_available A_ : Union[str, Any] = { "configuration_tapas": ["TAPAS_PRETRAINED_CONFIG_ARCHIVE_MAP", "TapasConfig"], "tokenization_tapas": ["T...
696
"""simple docstring""" def lowerCamelCase_ ( _lowerCamelCase ): lowerCamelCase__ : Union[str, Any] = 1 for i in range(1 , num + 1 ): fact *= i return fact def lowerCamelCase_ ( _lowerCamelCase ): lowerCamelCase__ : Optional[Any] = 0 wh...
696
1
"""simple docstring""" def lowerCamelCase_ ( _lowerCamelCase ): lowerCamelCase__ : list[list[int]] = [[0 for _ in range(_lowerCamelCase )] for _ in range(m + 1 )] for i in range(m + 1 ): lowerCamelCase__ : Any = 1 for n in range(m + 1 ): for ...
696
"""simple docstring""" import json import os import re import shutil import tempfile import unittest from typing import Tuple from transformers import AddedToken, BatchEncoding, PerceiverTokenizer from transformers.utils import cached_property, is_tf_available, is_torch_available from ...test_tokenization_comm...
696
1
"""simple docstring""" def lowerCamelCase_ ( _lowerCamelCase , _lowerCamelCase ): if a < 0 or b < 0: raise ValueError('the value of both inputs must be positive' ) lowerCamelCase__ : int = str(bin(_lowerCamelCase ) )[2:] # remove the leading "0b" lowerCam...
696
"""simple docstring""" from math import pi, sqrt, tan def lowerCamelCase_ ( _lowerCamelCase ): if side_length < 0: raise ValueError('surface_area_cube() only accepts non-negative values' ) return 6 * side_length**2 def lowerCamelCase_ ( _lowerCamelCase , _lowerCam...
696
1
"""simple docstring""" import os import warnings from typing import List, Optional from ...tokenization_utils_base import BatchEncoding from ...utils import logging from .configuration_rag import RagConfig A_ : Optional[int] = logging.get_logger(__name__) class a_ : '''simple...
696
"""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_co...
696
1
"""simple docstring""" from collections import OrderedDict from typing import Any, Mapping, Optional from ... import PreTrainedTokenizer, TensorType, is_torch_available from ...configuration_utils import PretrainedConfig from ...onnx import OnnxConfigWithPast from ...utils import logging A_ : Union[str,...
696
"""simple docstring""" import importlib import inspect import os import re # All paths are set with the intent you should run this script from the root of the repo with the command # python utils/check_config_docstrings.py A_ : Dict = "src/transformers" # This is to make sure the transformers ...
696
1
"""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 logging A_ ...
696
"""simple docstring""" from typing import TYPE_CHECKING from ...utils import ( OptionalDependencyNotAvailable, _LazyModule, is_sentencepiece_available, is_tokenizers_available, is_torch_available, ) A_ : Tuple = { "configuration_llama": ["LLAMA_PRETRAINED_CONFIG_ARCHIVE_...
696
1
"""simple docstring""" from packaging import version from .import_utils import is_accelerate_available if is_accelerate_available(): import accelerate def lowerCamelCase_ ( _lowerCamelCase ): if not is_accelerate_available(): return method lowerCamelCase__ : int = ver...
696
"""simple docstring""" import sys import webbrowser import requests from bsa import BeautifulSoup from fake_useragent import UserAgent if __name__ == "__main__": print("Googling.....") A_ : Optional[int] = "https://www.google.com/search?q=" + " ".join(sys.argv[1:]) A_ : L...
696
1
"""simple docstring""" class a_ : '''simple docstring''' def __init__(self, lowerCamelCase_, lowerCamelCase_, lowerCamelCase_ ): '''simple docstring''' lowerCamelCase__ : Any = None lowerCamelCase__ : List[str] = None lowerC...
696
"""simple docstring""" import os import tempfile import unittest import numpy as np from diffusers.utils import is_flax_available from diffusers.utils.testing_utils import require_flax, slow if is_flax_available(): import jax import jax.numpy as jnp from flax.jax_utils import replicate ...
696
1
"""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, random_attention_mask ...
696
"""simple docstring""" from typing import List, Optional, Tuple, Union import torch from ...utils import logging, randn_tensor from ..pipeline_utils import AudioPipelineOutput, DiffusionPipeline A_ : Dict = logging.get_logger(__name__) # pylint: disable=invalid-name class a_ ( snake_c...
696
1
"""simple docstring""" from ...configuration_utils import PretrainedConfig from ...utils import logging from ...utils.backbone_utils import BackboneConfigMixin, get_aligned_output_features_output_indices A_ : Union[str, Any] = logging.get_logger(__name__) A_ : Optional[Any] = { ...
696
"""simple docstring""" import unittest from pathlib import Path from tempfile import NamedTemporaryFile, TemporaryDirectory from transformers import BertConfig, BertTokenizerFast, FeatureExtractionPipeline from transformers.convert_graph_to_onnx import ( convert, ensure_valid_input, generate_identif...
696
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 A_ : List[str] = logging.get_logger(__name__) A_ : Dict ...
696
"""simple docstring""" 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 f...
696
1
"""simple docstring""" import warnings from ...utils import logging from .image_processing_perceiver import PerceiverImageProcessor A_ : Optional[int] = logging.get_logger(__name__) class a_ ( snake_case_ ): '''simple docstring''' def __init__(self, *lowerCamelCa...
696
"""simple docstring""" A_ : List[str] = { "Pillow": "Pillow<10.0.0", "accelerate": "accelerate>=0.20.3", "av": "av==9.2.0", "beautifulsoup4": "beautifulsoup4", "black": "black~=23.1", "codecarbon": "codecarbon==1.2.0", "cookiecutter": "cookiecutter==1.7.3", "datacla...
696
1
"""simple docstring""" import sys import webbrowser import requests from bsa import BeautifulSoup from fake_useragent import UserAgent if __name__ == "__main__": print("Googling.....") A_ : Optional[int] = "https://www.google.com/search?q=" + " ".join(sys.argv[1:]) A_ : L...
696
"""simple docstring""" from binascii import hexlify from hashlib import shaaaa from os import urandom # RFC 3526 - More Modular Exponential (MODP) Diffie-Hellman groups for # Internet Key Exchange (IKE) https://tools.ietf.org/html/rfc3526 A_ : Optional[int] = { # 1536-bit 5: { "p...
696
1
"""simple docstring""" def lowerCamelCase_ ( _lowerCamelCase ): lowerCamelCase__ : Union[str, Any] = 1 for i in range(1 , num + 1 ): fact *= i return fact def lowerCamelCase_ ( _lowerCamelCase ): lowerCamelCase__ : Optional[Any] = 0 wh...
696
"""simple docstring""" def lowerCamelCase_ ( _lowerCamelCase , _lowerCamelCase ): if mass < 0: raise ValueError('The mass of a body cannot be negative' ) return 0.5 * mass * abs(_lowerCamelCase ) * abs(_lowerCamelCase ) if __name__ == "__main__": import doctest ...
696
1
"""simple docstring""" def lowerCamelCase_ ( _lowerCamelCase = 6008_5147_5143 ): try: lowerCamelCase__ : Tuple = int(_lowerCamelCase ) except (TypeError, ValueError): raise TypeError('Parameter n must be int or castable to int.' ) if n <= 0: raise ValueError('Param...
696
"""simple docstring""" 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 fro...
696
1
"""simple docstring""" import argparse import os from pathlib import Path from typing import Dict import tensorflow as tf import torch from tqdm import tqdm from transformers import PegasusConfig, PegasusForConditionalGeneration, PegasusTokenizer from transformers.models.pegasus.configuration_pegasus import DE...
696
"""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 a_ ( snake_case_ ): '''simple docstring''' ...
696
1
"""simple docstring""" from __future__ import annotations def lowerCamelCase_ ( _lowerCamelCase , _lowerCamelCase , _lowerCamelCase , _lowerCamelCase , _lowerCamelCase , ): lowerCamelCase__ : Dict = len(_lowerCamelCase ) # If row is equal to t...
696
"""simple docstring""" from __future__ import annotations import math from collections import Counter from string import ascii_lowercase def lowerCamelCase_ ( _lowerCamelCase ): lowerCamelCase__ , lowerCamelCase__ : List[str] = analyze_text(_lowerCamelCase ) lowerC...
696
1
"""simple docstring""" import re def lowerCamelCase_ ( _lowerCamelCase ): if len(re.findall('[ATCG]' , _lowerCamelCase ) ) != len(_lowerCamelCase ): raise ValueError('Invalid Strand' ) return dna.translate(dna.maketrans('ATCG' , 'TAGC' ) ...
696
"""simple docstring""" import os def lowerCamelCase_ ( ): with open(os.path.dirname(_lowerCamelCase ) + '/p022_names.txt' ) as file: lowerCamelCase__ : Union[str, Any] = str(file.readlines()[0] ) lowerCamelCase__ : int = names.replace('"' , '' ...
696
1
"""simple docstring""" import inspect import unittest import numpy as np from transformers import ViTConfig, is_flax_available from transformers.testing_utils import require_flax, slow from ...test_configuration_common import ConfigTester from ...test_modeling_flax_common import FlaxModelTesterMixin, floats_t...
696
"""simple docstring""" import warnings from contextlib import contextmanager from ...processing_utils import ProcessorMixin class a_ ( snake_case_ ): '''simple docstring''' lowerCamelCase__ : int = 'Speech2TextFeatureExtractor' lowerCamelCase__ : Dict = ...
696
1
"""simple docstring""" from __future__ import annotations import string from itertools import cycle, product from pathlib import Path A_ : str = ( string.ascii_letters + string.digits + string.punctuation + string.whitespace ) A_ : list[int] = [ord(letter) for letter in string...
696
"""simple docstring""" import unittest from transformers import MobileBertConfig, is_torch_available from transformers.models.auto import get_values from transformers.testing_utils import require_sentencepiece, require_tokenizers, require_torch, slow, torch_device from ...test_configuration_common import Confi...
696
1
"""simple docstring""" import os def lowerCamelCase_ ( _lowerCamelCase ): lowerCamelCase__ : Optional[Any] = len(grid[0] ) lowerCamelCase__ : str = len(_lowerCamelCase ) lowerCamelCase__ : Optional[int] = 0 lowerCamelCase__ : Tuple ...
696
"""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 im...
696
1
"""simple docstring""" from jiwer import compute_measures import datasets A_ : List[str] = "\\n@inproceedings{inproceedings,\n author = {Morris, Andrew and Maier, Viktoria and Green, Phil},\n year = {2004},\n month = {01},\n pages = {},\n title = {From WER and RIL to MER and WIL:...
696
"""simple docstring""" from ..utils import DummyObject, requires_backends class a_ ( metaclass=snake_case_ ): '''simple docstring''' lowerCamelCase__ : str = ['speech'] def __init__(self, *lowerCamelCase_, **lowerCamelCase_ ): '''simple docstring...
696
1
"""simple docstring""" from datetime import datetime import requests def lowerCamelCase_ ( _lowerCamelCase ): lowerCamelCase__ : Any = 'https://downloadgram.net/wp-json/wppress/video-downloader/video?url=' lowerCamelCase__ : Union[str, Any] = requests.get(base_url ...
696
"""simple docstring""" def lowerCamelCase_ ( _lowerCamelCase ): lowerCamelCase__ : Union[str, Any] = 1 for i in range(1 , num + 1 ): fact *= i return fact def lowerCamelCase_ ( _lowerCamelCase ): lowerCamelCase__ : Optional[Any] = 0 wh...
696
1
"""simple docstring""" from ...configuration_utils import PretrainedConfig from ...utils import logging A_ : int = logging.get_logger(__name__) class a_ ( snake_case_ ): '''simple docstring''' lowerCamelCase__ : str = 'timm_backbone' def __init...
696
"""simple docstring""" import json import os import re import shutil import tempfile import unittest from typing import Tuple from transformers import AddedToken, BatchEncoding, PerceiverTokenizer from transformers.utils import cached_property, is_tf_available, is_torch_available from ...test_tokenization_comm...
696
1
"""simple docstring""" import importlib import torch import yaml from omegaconf import OmegaConf from taming.models.vqgan import VQModel def lowerCamelCase_ ( _lowerCamelCase , _lowerCamelCase=False ): lowerCamelCase__ : List[str] = OmegaConf.load(_lowerCamelCase ) ...
696
"""simple docstring""" from math import pi, sqrt, tan def lowerCamelCase_ ( _lowerCamelCase ): if side_length < 0: raise ValueError('surface_area_cube() only accepts non-negative values' ) return 6 * side_length**2 def lowerCamelCase_ ( _lowerCamelCase , _lowerCam...
696
1
"""simple docstring""" import os import tempfile import unittest import numpy as np from diffusers.utils import is_flax_available from diffusers.utils.testing_utils import require_flax, slow if is_flax_available(): import jax import jax.numpy as jnp from flax.jax_utils import replicate ...
696
"""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_co...
696
1
"""simple docstring""" # This is the module that test_patching.py uses to test patch_submodule() import os # noqa: this is just for tests import os as renamed_os # noqa: this is just for tests from os import path # noqa: this is just for tests from os import path as renamed_path # noqa: this is just for tes...
696
"""simple docstring""" import importlib import inspect import os import re # All paths are set with the intent you should run this script from the root of the repo with the command # python utils/check_config_docstrings.py A_ : Dict = "src/transformers" # This is to make sure the transformers ...
696
1
"""simple docstring""" import inspect import unittest import numpy as np from transformers import BeitConfig from transformers.testing_utils import require_flax, require_vision, slow from transformers.utils import cached_property, is_flax_available, is_vision_available from ...test_configuration_common import...
696
"""simple docstring""" from typing import TYPE_CHECKING from ...utils import ( OptionalDependencyNotAvailable, _LazyModule, is_sentencepiece_available, is_tokenizers_available, is_torch_available, ) A_ : Tuple = { "configuration_llama": ["LLAMA_PRETRAINED_CONFIG_ARCHIVE_...
696
1
"""simple docstring""" from __future__ import annotations import unittest from transformers import MobileBertConfig, is_tf_available from transformers.models.auto import get_values from transformers.testing_utils import require_tf, slow from ...test_configuration_common import ConfigTester from ...test_modeli...
696
"""simple docstring""" import sys import webbrowser import requests from bsa import BeautifulSoup from fake_useragent import UserAgent if __name__ == "__main__": print("Googling.....") A_ : Optional[int] = "https://www.google.com/search?q=" + " ".join(sys.argv[1:]) A_ : L...
696
1
"""simple docstring""" import logging import os from .state import PartialState class a_ ( logging.LoggerAdapter ): '''simple docstring''' @staticmethod def a__ (lowerCamelCase_ ): '''simple docstring''' lowerCamelCase__ : Union[str, Any]...
696
"""simple docstring""" import os import tempfile import unittest import numpy as np from diffusers.utils import is_flax_available from diffusers.utils.testing_utils import require_flax, slow if is_flax_available(): import jax import jax.numpy as jnp from flax.jax_utils import replicate ...
696
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 A_ : Optional[Any] = logging.get_logger(__name__) A_ : str ...
696
"""simple docstring""" from typing import List, Optional, Tuple, Union import torch from ...utils import logging, randn_tensor from ..pipeline_utils import AudioPipelineOutput, DiffusionPipeline A_ : Dict = logging.get_logger(__name__) # pylint: disable=invalid-name class a_ ( snake_c...
696
1
"""simple docstring""" import unittest from transformers import ( MODEL_FOR_OBJECT_DETECTION_MAPPING, AutoFeatureExtractor, AutoModelForObjectDetection, ObjectDetectionPipeline, is_vision_available, pipeline, ) from transformers.testing_utils import ( is_pipeline_test, nested_sim...
696
"""simple docstring""" import unittest from pathlib import Path from tempfile import NamedTemporaryFile, TemporaryDirectory from transformers import BertConfig, BertTokenizerFast, FeatureExtractionPipeline from transformers.convert_graph_to_onnx import ( convert, ensure_valid_input, generate_identif...
696
1
"""simple docstring""" def lowerCamelCase_ ( _lowerCamelCase , _lowerCamelCase ): lowerCamelCase__ : Optional[int] = 1 # To kept the Calculated Value # Since C(n, k) = C(n, n-k) if k > (n - k): lowerCamelCase__ : Optional[Any] = n - k # Calculate C(n,k) for i...
696
"""simple docstring""" 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 f...
696
1
"""simple docstring""" import os from typing import Dict, List, Union import tensorflow as tf from keras_nlp.tokenizers import BytePairTokenizer from tensorflow_text import pad_model_inputs from .tokenization_gpta import GPTaTokenizer class a_ ( tf.keras.layers.Layer ): '''simple docstr...
696
"""simple docstring""" A_ : List[str] = { "Pillow": "Pillow<10.0.0", "accelerate": "accelerate>=0.20.3", "av": "av==9.2.0", "beautifulsoup4": "beautifulsoup4", "black": "black~=23.1", "codecarbon": "codecarbon==1.2.0", "cookiecutter": "cookiecutter==1.7.3", "datacla...
696
1
"""simple docstring""" from dataclasses import dataclass from typing import List, Optional, Union import numpy as np import torch from ...utils import BaseOutput, OptionalDependencyNotAvailable, is_torch_available, is_transformers_available @dataclass class a_ ( snake_case_ ): '''simple...
696
"""simple docstring""" from binascii import hexlify from hashlib import shaaaa from os import urandom # RFC 3526 - More Modular Exponential (MODP) Diffie-Hellman groups for # Internet Key Exchange (IKE) https://tools.ietf.org/html/rfc3526 A_ : Optional[int] = { # 1536-bit 5: { "p...
696
1
"""simple docstring""" from collections.abc import Iterable from typing import Any class a_ : '''simple docstring''' def __init__(self, lowerCamelCase_ = None ): '''simple docstring''' lowerCamelCase__ : Any = value lowerCamelCase__ : Node...
696
"""simple docstring""" def lowerCamelCase_ ( _lowerCamelCase , _lowerCamelCase ): if mass < 0: raise ValueError('The mass of a body cannot be negative' ) return 0.5 * mass * abs(_lowerCamelCase ) * abs(_lowerCamelCase ) if __name__ == "__main__": import doctest ...
696
1
"""simple docstring""" import importlib import inspect import os import re # All paths are set with the intent you should run this script from the root of the repo with the command # python utils/check_config_docstrings.py A_ : Dict = "src/transformers" # This is to make sure the transformers ...
696
"""simple docstring""" 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 fro...
696
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/LICENSE-2...
696
"""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 a_ ( snake_case_ ): '''simple docstring''' ...
696
1
"""simple docstring""" import json import os import re import unittest from transformers import CodeGenTokenizer, CodeGenTokenizerFast from transformers.models.codegen.tokenization_codegen import VOCAB_FILES_NAMES from transformers.testing_utils import require_tokenizers, slow from ...test_tokenization_common ...
696
"""simple docstring""" from __future__ import annotations import math from collections import Counter from string import ascii_lowercase def lowerCamelCase_ ( _lowerCamelCase ): lowerCamelCase__ , lowerCamelCase__ : List[str] = analyze_text(_lowerCamelCase ) lowerC...
696
1
"""simple docstring""" A_ : dict[str, float] = { "km/h": 1.0, "m/s": 3.6, "mph": 1.609344, "knot": 1.852, } A_ : dict[str, float] = { "km/h": 1.0, "m/s": 0.277777778, "mph": 0.621371192, "knot": 0.539956803, } def lowerCamelCase_ ( _lowe...
696
"""simple docstring""" import os def lowerCamelCase_ ( ): with open(os.path.dirname(_lowerCamelCase ) + '/p022_names.txt' ) as file: lowerCamelCase__ : Union[str, Any] = str(file.readlines()[0] ) lowerCamelCase__ : int = names.replace('"' , '' ...
696
1
"""simple docstring""" import argparse import json import os from pathlib import Path import requests import torch from transformers import JukeboxConfig, JukeboxModel from transformers.utils import logging logging.set_verbosity_info() A_ : Tuple = logging.get_logger(__name__) A_ : Lis...
696
"""simple docstring""" import warnings from contextlib import contextmanager from ...processing_utils import ProcessorMixin class a_ ( snake_case_ ): '''simple docstring''' lowerCamelCase__ : int = 'Speech2TextFeatureExtractor' lowerCamelCase__ : Dict = ...
696
1
"""simple docstring""" from __future__ import annotations import json import requests from bsa import BeautifulSoup from fake_useragent import UserAgent A_ : Union[str, Any] = {"UserAgent": UserAgent().random} def lowerCamelCase_ ( _lowerCamelCase ): lowerCamelCase__ : i...
696
"""simple docstring""" import unittest from transformers import MobileBertConfig, is_torch_available from transformers.models.auto import get_values from transformers.testing_utils import require_sentencepiece, require_tokenizers, require_torch, slow, torch_device from ...test_configuration_common import Confi...
696
1
"""simple docstring""" 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 fro...
696
"""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 im...
696
1
"""simple docstring""" import inspect import unittest from typing import List import numpy as np from transformers import EfficientFormerConfig from transformers.testing_utils import require_tf, require_vision, slow from transformers.utils import cached_property, is_tf_available, is_vision_available from ...t...
696
"""simple docstring""" from ..utils import DummyObject, requires_backends class a_ ( metaclass=snake_case_ ): '''simple docstring''' lowerCamelCase__ : str = ['speech'] def __init__(self, *lowerCamelCase_, **lowerCamelCase_ ): '''simple docstring...
696
1
"""simple docstring""" from typing import TYPE_CHECKING from ...utils import ( OptionalDependencyNotAvailable, _LazyModule, is_flax_available, is_tensorflow_text_available, is_tf_available, is_tokenizers_available, is_torch_available, ) A_ : List[str] = { "config...
696
"""simple docstring""" def lowerCamelCase_ ( _lowerCamelCase ): lowerCamelCase__ : Union[str, Any] = 1 for i in range(1 , num + 1 ): fact *= i return fact def lowerCamelCase_ ( _lowerCamelCase ): lowerCamelCase__ : Optional[Any] = 0 wh...
696
1
"""simple docstring""" import os from datetime import datetime as dt from github import Github A_ : List[str] = [ "good first issue", "good second issue", "good difficult issue", "enhancement", "new pipeline/model", "new scheduler", "wip", ] def lowerCamelCase...
696
"""simple docstring""" import json import os import re import shutil import tempfile import unittest from typing import Tuple from transformers import AddedToken, BatchEncoding, PerceiverTokenizer from transformers.utils import cached_property, is_tf_available, is_torch_available from ...test_tokenization_comm...
696
1
"""simple docstring""" import datetime import platform import subprocess from typing import Optional, Tuple, Union import numpy as np def lowerCamelCase_ ( _lowerCamelCase , _lowerCamelCase ): lowerCamelCase__ : Optional[int] = f'''{sampling_rate}''' lowerCamelCase__ : ...
696
"""simple docstring""" from math import pi, sqrt, tan def lowerCamelCase_ ( _lowerCamelCase ): if side_length < 0: raise ValueError('surface_area_cube() only accepts non-negative values' ) return 6 * side_length**2 def lowerCamelCase_ ( _lowerCamelCase , _lowerCam...
696
1
"""simple docstring""" import unittest from queue import Empty from threading import Thread from transformers import AutoTokenizer, TextIteratorStreamer, TextStreamer, is_torch_available from transformers.testing_utils import CaptureStdout, require_torch, torch_device from ..test_modeling_common import ids_ten...
696
"""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_co...
696
1
"""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 lowerCamelCase_ ( _lowerCamelCase , _lowerCamelCase , _lowe...
696
"""simple docstring""" import importlib import inspect import os import re # All paths are set with the intent you should run this script from the root of the repo with the command # python utils/check_config_docstrings.py A_ : Dict = "src/transformers" # This is to make sure the transformers ...
696
1
"""simple docstring""" from __future__ import annotations from collections.abc import Sequence from typing import Literal def lowerCamelCase_ ( _lowerCamelCase , _lowerCamelCase ): lowerCamelCase__ : str = list(_lowerCamelCase ) lowerCamelCase__ : Optional[int]...
696
"""simple docstring""" from typing import TYPE_CHECKING from ...utils import ( OptionalDependencyNotAvailable, _LazyModule, is_sentencepiece_available, is_tokenizers_available, is_torch_available, ) A_ : Tuple = { "configuration_llama": ["LLAMA_PRETRAINED_CONFIG_ARCHIVE_...
696
1
"""simple docstring""" from __future__ import annotations import math from collections import Counter from string import ascii_lowercase def lowerCamelCase_ ( _lowerCamelCase ): lowerCamelCase__ , lowerCamelCase__ : List[str] = analyze_text(_lowerCamelCase ) lowerC...
696
"""simple docstring""" import sys import webbrowser import requests from bsa import BeautifulSoup from fake_useragent import UserAgent if __name__ == "__main__": print("Googling.....") A_ : Optional[int] = "https://www.google.com/search?q=" + " ".join(sys.argv[1:]) A_ : L...
696
1
"""simple docstring""" import gc import random import unittest import numpy as np import torch from PIL import Image from transformers import CLIPTextConfig, CLIPTextModel, CLIPTokenizer from diffusers import ( AutoencoderKL, DDIMScheduler, EulerAncestralDiscreteScheduler, LMSDiscreteScheduler,...
696
"""simple docstring""" import os import tempfile import unittest import numpy as np from diffusers.utils import is_flax_available from diffusers.utils.testing_utils import require_flax, slow if is_flax_available(): import jax import jax.numpy as jnp from flax.jax_utils import replicate ...
696
1
"""simple docstring""" import unittest from pathlib import Path from tempfile import NamedTemporaryFile, TemporaryDirectory from transformers import BertConfig, BertTokenizerFast, FeatureExtractionPipeline from transformers.convert_graph_to_onnx import ( convert, ensure_valid_input, generate_identif...
696
"""simple docstring""" from typing import List, Optional, Tuple, Union import torch from ...utils import logging, randn_tensor from ..pipeline_utils import AudioPipelineOutput, DiffusionPipeline A_ : Dict = logging.get_logger(__name__) # pylint: disable=invalid-name class a_ ( snake_c...
696
1
"""simple docstring""" def lowerCamelCase_ ( _lowerCamelCase = 10**9 ): lowerCamelCase__ : Optional[int] = 1 lowerCamelCase__ : int = 2 lowerCamelCase__ : int = 0 lowerCamelCase__ : Tuple = 0 lowerCamelCase__ : str = 0 while per...
696
"""simple docstring""" import unittest from pathlib import Path from tempfile import NamedTemporaryFile, TemporaryDirectory from transformers import BertConfig, BertTokenizerFast, FeatureExtractionPipeline from transformers.convert_graph_to_onnx import ( convert, ensure_valid_input, generate_identif...
696
1
"""simple docstring""" import argparse import os import pickle import sys import torch from transformers import TransfoXLConfig, TransfoXLLMHeadModel, load_tf_weights_in_transfo_xl from transformers.models.transfo_xl import tokenization_transfo_xl as data_utils from transformers.models.transfo_xl.tokenization_...
696
"""simple docstring""" 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 f...
696
1
"""simple docstring""" import unittest from transformers import SqueezeBertConfig, is_torch_available from transformers.testing_utils import require_sentencepiece, require_tokenizers, require_torch, slow, torch_device from ...test_configuration_common import ConfigTester from ...test_modeling_common import Mod...
696
"""simple docstring""" A_ : List[str] = { "Pillow": "Pillow<10.0.0", "accelerate": "accelerate>=0.20.3", "av": "av==9.2.0", "beautifulsoup4": "beautifulsoup4", "black": "black~=23.1", "codecarbon": "codecarbon==1.2.0", "cookiecutter": "cookiecutter==1.7.3", "datacla...
696
1
"""simple docstring""" from __future__ import annotations def lowerCamelCase_ ( _lowerCamelCase ): lowerCamelCase__ : Optional[int] = 0.00 lowerCamelCase__ : int = 0 for resistor in resistors: if resistor <= 0: lowerCamelCase__ : Union[str, Any] = ...
696
"""simple docstring""" from binascii import hexlify from hashlib import shaaaa from os import urandom # RFC 3526 - More Modular Exponential (MODP) Diffie-Hellman groups for # Internet Key Exchange (IKE) https://tools.ietf.org/html/rfc3526 A_ : Optional[int] = { # 1536-bit 5: { "p...
696
1
"""simple docstring""" from typing import TYPE_CHECKING from ...utils import ( OptionalDependencyNotAvailable, _LazyModule, is_tf_available, is_tokenizers_available, is_torch_available, ) A_ : str = { "configuration_lxmert": ["LXMERT_PRETRAINED_CONFIG_ARCHIVE_MAP", "Lxme...
696
"""simple docstring""" def lowerCamelCase_ ( _lowerCamelCase , _lowerCamelCase ): if mass < 0: raise ValueError('The mass of a body cannot be negative' ) return 0.5 * mass * abs(_lowerCamelCase ) * abs(_lowerCamelCase ) if __name__ == "__main__": import doctest ...
696
1
"""simple docstring""" def lowerCamelCase_ ( _lowerCamelCase ): if length <= 0 or not isinstance(_lowerCamelCase , _lowerCamelCase ): raise ValueError('Length must be a positive integer.' ) return [n * (2 * n - 1) for n in range(_lowerCamelCase )] if __name__ == "__ma...
696
"""simple docstring""" 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 fro...
696
1
"""simple docstring""" from __future__ import annotations class a_ : '''simple docstring''' def __init__(self, lowerCamelCase_, lowerCamelCase_ ): '''simple docstring''' lowerCamelCase__ , lowerCamelCase__ : Optional[Any] = text, pattern ...
696
"""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 a_ ( snake_case_ ): '''simple docstring''' ...
696
1
"""simple docstring""" import time import unittest from transformers import is_torch_available from transformers.testing_utils import require_torch, torch_device from ..test_modeling_common import ids_tensor if is_torch_available(): import torch from transformers.generation import ( Ma...
696
"""simple docstring""" from __future__ import annotations import math from collections import Counter from string import ascii_lowercase def lowerCamelCase_ ( _lowerCamelCase ): lowerCamelCase__ , lowerCamelCase__ : List[str] = analyze_text(_lowerCamelCase ) lowerC...
696
1
"""simple docstring""" from typing import Any def lowerCamelCase_ ( _lowerCamelCase , _lowerCamelCase , _lowerCamelCase , _lowerCamelCase , _lowerCamelCase , ): _validation( _lowerCamelCase , _lowerCamelCase , _lowerCamelCase , _lowerCame...
696
"""simple docstring""" import os def lowerCamelCase_ ( ): with open(os.path.dirname(_lowerCamelCase ) + '/p022_names.txt' ) as file: lowerCamelCase__ : Union[str, Any] = str(file.readlines()[0] ) lowerCamelCase__ : int = names.replace('"' , '' ...
696
1
"""simple docstring""" import math def lowerCamelCase_ ( _lowerCamelCase , _lowerCamelCase ): lowerCamelCase__ : Union[str, Any] = len(_lowerCamelCase ) lowerCamelCase__ : Optional[int] = int(math.floor(math.sqrt(_lowerCamelCase ) ) ) ...
696
"""simple docstring""" import warnings from contextlib import contextmanager from ...processing_utils import ProcessorMixin class a_ ( snake_case_ ): '''simple docstring''' lowerCamelCase__ : int = 'Speech2TextFeatureExtractor' lowerCamelCase__ : Dict = ...
696
1
"""simple docstring""" import numpy as np from numpy import ndarray from scipy.optimize import Bounds, LinearConstraint, minimize def lowerCamelCase_ ( _lowerCamelCase ): return np.dot(_lowerCamelCase , _lowerCamelCase ) class a_ : '''simple docstring''' ...
696
"""simple docstring""" import unittest from transformers import MobileBertConfig, is_torch_available from transformers.models.auto import get_values from transformers.testing_utils import require_sentencepiece, require_tokenizers, require_torch, slow, torch_device from ...test_configuration_common import Confi...
696
1
"""simple docstring""" import tempfile import torch from diffusers import PNDMScheduler from .test_schedulers import SchedulerCommonTest class a_ ( snake_case_ ): '''simple docstring''' lowerCamelCase__ : Union[str, Any] = (PNDMScheduler,) lowerCamelCase__ : ...
696
"""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 im...
696
1
"""simple docstring""" from ..utils import DummyObject, requires_backends class a_ ( metaclass=snake_case_ ): '''simple docstring''' lowerCamelCase__ : str = ['speech'] def __init__(self, *lowerCamelCase_, **lowerCamelCase_ ): '''simple docstring...
696
"""simple docstring""" from ..utils import DummyObject, requires_backends class a_ ( metaclass=snake_case_ ): '''simple docstring''' lowerCamelCase__ : str = ['speech'] def __init__(self, *lowerCamelCase_, **lowerCamelCase_ ): '''simple docstring...
696
1
"""simple docstring""" from scipy.stats import pearsonr import datasets A_ : Any = "\nPearson correlation coefficient and p-value for testing non-correlation.\nThe Pearson correlation coefficient measures the linear relationship between two datasets. The calculation of the p-value relies on the...
696
"""simple docstring""" def lowerCamelCase_ ( _lowerCamelCase ): lowerCamelCase__ : Union[str, Any] = 1 for i in range(1 , num + 1 ): fact *= i return fact def lowerCamelCase_ ( _lowerCamelCase ): lowerCamelCase__ : Optional[Any] = 0 wh...
696
1
"""simple docstring""" # this script reports modified .py files under the desired list of top-level sub-dirs passed as a list of arguments, e.g.: # python ./utils/get_modified_files.py utils src tests examples # # it uses git to find the forking point and which files were modified - i.e. files not under git wo...
696
"""simple docstring""" import json import os import re import shutil import tempfile import unittest from typing import Tuple from transformers import AddedToken, BatchEncoding, PerceiverTokenizer from transformers.utils import cached_property, is_tf_available, is_torch_available from ...test_tokenization_comm...
696
1
"""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 YolosConfig, YolosForObjectDetection, YolosImageProcessor from transformers.utils import logging logging.set_verb...
696
"""simple docstring""" from math import pi, sqrt, tan def lowerCamelCase_ ( _lowerCamelCase ): if side_length < 0: raise ValueError('surface_area_cube() only accepts non-negative values' ) return 6 * side_length**2 def lowerCamelCase_ ( _lowerCamelCase , _lowerCam...
696
1
"""simple docstring""" import dataclasses import json import sys import types from argparse import ArgumentDefaultsHelpFormatter, ArgumentParser, ArgumentTypeError from copy import copy from enum import Enum from inspect import isclass from pathlib import Path from typing import Any, Callable, Dict, Iterable, Li...
696
"""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_co...
696
1
"""simple docstring""" def lowerCamelCase_ ( _lowerCamelCase ): if not isinstance(_lowerCamelCase , _lowerCamelCase ): raise TypeError('only integers accepted as input' ) else: lowerCamelCase__ : List[Any] = str(abs(_lowerCamelCase ) ) lowerCamelC...
696
"""simple docstring""" import importlib import inspect import os import re # All paths are set with the intent you should run this script from the root of the repo with the command # python utils/check_config_docstrings.py A_ : Dict = "src/transformers" # This is to make sure the transformers ...
696
1
"""simple docstring""" import PIL.Image import PIL.ImageOps from packaging import version from PIL import Image if version.parse(version.parse(PIL.__version__).base_version) >= version.parse("9.1.0"): A_ : Dict = { "linear": PIL.Image.Resampling.BILINEAR, "bilinear": PI...
696
"""simple docstring""" from typing import TYPE_CHECKING from ...utils import ( OptionalDependencyNotAvailable, _LazyModule, is_sentencepiece_available, is_tokenizers_available, is_torch_available, ) A_ : Tuple = { "configuration_llama": ["LLAMA_PRETRAINED_CONFIG_ARCHIVE_...
696
1
"""simple docstring""" from __future__ import annotations import unittest import numpy as np from transformers import OPTConfig, is_tf_available from transformers.testing_utils import require_sentencepiece, require_tf, slow from ...test_configuration_common import ConfigTester from ...test_modeling_tf_common...
696
"""simple docstring""" import sys import webbrowser import requests from bsa import BeautifulSoup from fake_useragent import UserAgent if __name__ == "__main__": print("Googling.....") A_ : Optional[int] = "https://www.google.com/search?q=" + " ".join(sys.argv[1:]) A_ : L...
696
1
"""simple docstring""" def lowerCamelCase_ ( _lowerCamelCase , _lowerCamelCase , _lowerCamelCase ): if principal <= 0: raise Exception('Principal borrowed must be > 0' ) if rate_per_annum < 0: raise Exception('Rate of interest must be >= 0' ) if years_to_repay <= 0 o...
696
"""simple docstring""" import os import tempfile import unittest import numpy as np from diffusers.utils import is_flax_available from diffusers.utils.testing_utils import require_flax, slow if is_flax_available(): import jax import jax.numpy as jnp from flax.jax_utils import replicate ...
696
1
"""simple docstring""" def lowerCamelCase_ ( _lowerCamelCase , _lowerCamelCase ): lowerCamelCase__ : int = len(_lowerCamelCase ) lowerCamelCase__ : int = len(_lowerCamelCase ) lowerCamelCase__ : int = ( first_str_length if first_str_l...
696
"""simple docstring""" from typing import List, Optional, Tuple, Union import torch from ...utils import logging, randn_tensor from ..pipeline_utils import AudioPipelineOutput, DiffusionPipeline A_ : Dict = logging.get_logger(__name__) # pylint: disable=invalid-name class a_ ( snake_c...
696
1
"""simple docstring""" import warnings from ..trainer import Trainer from ..utils import logging A_ : Dict = logging.get_logger(__name__) class a_ ( snake_case_ ): '''simple docstring''' def __init__(self, lowerCamelCase_=None, **lowerCamelCase_ ): ...
696
"""simple docstring""" import unittest from pathlib import Path from tempfile import NamedTemporaryFile, TemporaryDirectory from transformers import BertConfig, BertTokenizerFast, FeatureExtractionPipeline from transformers.convert_graph_to_onnx import ( convert, ensure_valid_input, generate_identif...
696
1
"""simple docstring""" import unittest from transformers import MobileBertConfig, is_torch_available from transformers.models.auto import get_values from transformers.testing_utils import require_sentencepiece, require_tokenizers, require_torch, slow, torch_device from ...test_configuration_common import Confi...
696
"""simple docstring""" 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 f...
696
1
"""simple docstring""" import warnings from diffusers import StableDiffusionImgaImgPipeline # noqa F401 warnings.warn( "The `image_to_image.py` script is outdated. Please use directly `from diffusers import" " StableDiffusionImg2ImgPipeline` instead." )
696
"""simple docstring""" A_ : List[str] = { "Pillow": "Pillow<10.0.0", "accelerate": "accelerate>=0.20.3", "av": "av==9.2.0", "beautifulsoup4": "beautifulsoup4", "black": "black~=23.1", "codecarbon": "codecarbon==1.2.0", "cookiecutter": "cookiecutter==1.7.3", "datacla...
696
1
"""simple docstring""" import os import unittest from transformers.models.bartpho.tokenization_bartpho import VOCAB_FILES_NAMES, BartphoTokenizer from transformers.testing_utils import get_tests_dir from ...test_tokenization_common import TokenizerTesterMixin A_ : Tuple = get_tests_dir("fixtur...
696
"""simple docstring""" from binascii import hexlify from hashlib import shaaaa from os import urandom # RFC 3526 - More Modular Exponential (MODP) Diffie-Hellman groups for # Internet Key Exchange (IKE) https://tools.ietf.org/html/rfc3526 A_ : Optional[int] = { # 1536-bit 5: { "p...
696
1
"""simple docstring""" from collections import OrderedDict from typing import TYPE_CHECKING, Any, List, Mapping, Optional, Union from ...configuration_utils import PretrainedConfig from ...onnx import OnnxConfig from ...utils import TensorType, logging if TYPE_CHECKING: from ...onnx.config import Patchi...
696
"""simple docstring""" def lowerCamelCase_ ( _lowerCamelCase , _lowerCamelCase ): if mass < 0: raise ValueError('The mass of a body cannot be negative' ) return 0.5 * mass * abs(_lowerCamelCase ) * abs(_lowerCamelCase ) if __name__ == "__main__": import doctest ...
696
1
"""simple docstring""" from typing import TYPE_CHECKING from ...utils import OptionalDependencyNotAvailable, _LazyModule, is_speech_available, is_torch_available A_ : Union[str, Any] = { "configuration_audio_spectrogram_transformer": [ "AUDIO_SPECTROGRAM_TRANSFORMER_PRETRAINED_CONFI...
696
"""simple docstring""" 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 fro...
696
1
"""simple docstring""" import itertools import os import random import tempfile import unittest import numpy as np from datasets import load_dataset from transformers import is_speech_available from transformers.testing_utils import check_json_file_has_correct_format, require_torch, require_torchaudio from tra...
696
"""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 a_ ( snake_case_ ): '''simple docstring''' ...
696
1
"""simple docstring""" from random import shuffle import tensorflow as tf from numpy import array def lowerCamelCase_ ( _lowerCamelCase , _lowerCamelCase ): lowerCamelCase__ : str = int(_lowerCamelCase ) assert noofclusters < len(_lowerCamelCase ) # Find ou...
696
"""simple docstring""" from __future__ import annotations import math from collections import Counter from string import ascii_lowercase def lowerCamelCase_ ( _lowerCamelCase ): lowerCamelCase__ , lowerCamelCase__ : List[str] = analyze_text(_lowerCamelCase ) lowerC...
696
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_ ( _lowerCamelCase , _lowerCamelCase , _lowerCamelCase )...
696
"""simple docstring""" import os def lowerCamelCase_ ( ): with open(os.path.dirname(_lowerCamelCase ) + '/p022_names.txt' ) as file: lowerCamelCase__ : Union[str, Any] = str(file.readlines()[0] ) lowerCamelCase__ : int = names.replace('"' , '' ...
696
1