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 __future__ import annotations def lowerCamelCase_ ( _lowerCamelCase ): if len(_lowerCamelCase ) < 2: raise ValueError('Monogons and Digons are not polygons in the Euclidean space' ) if any(i <= 0 for i in nums ): raise ValueError('All ...
709
"""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
0
"""simple docstring""" import PIL.Image import PIL.ImageOps from packaging import version from PIL import Image if version.parse(version.parse(PIL.__version__).base_version) >= version.parse("9.1.0"): A_ : Union[str, Any] = { "linear": PIL.Image.Resampling.BILINEAR, "bi...
710
"""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
0
"""simple docstring""" from collections import OrderedDict from typing import Mapping from ...configuration_utils import PretrainedConfig from ...onnx import OnnxConfig from ...utils import logging A_ : Dict = logging.get_logger(__name__) A_ : Dict = { 'kssteven/ibert-robert...
711
"""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
0
"""simple docstring""" import json import os import re import shutil import tempfile import unittest from typing import Tuple from transformers import AddedToken, BatchEncoding, ByTaTokenizer from transformers.utils import cached_property, is_tf_available, is_torch_available from ...test_tokenization_common impor...
712
"""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
0
"""simple docstring""" from typing import Mapping from ...configuration_utils import PretrainedConfig from ...onnx import OnnxSeqaSeqConfigWithPast from ...utils import logging A_ : List[Any] = logging.get_logger(__name__) A_ : Dict = { "google/umt5-small": "https://huggingf...
713
"""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
0
"""simple docstring""" import random def lowerCamelCase_ ( _lowerCamelCase , _lowerCamelCase , _lowerCamelCase = False ): lowerCamelCase__ : Dict = {i: [] for i in range(a__ )} # if probability is greater or equal than 1, then generate a complete graph if p...
714
"""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
0
"""simple docstring""" import pytest from datasets.splits import SplitDict, SplitInfo from datasets.utils.py_utils import asdict @pytest.mark.parametrize( 'split_dict' , [ SplitDict(), SplitDict({'train': SplitInfo(name='train' , num_bytes=1337 , num_examples=42 , ...
715
"""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
0
"""simple docstring""" import os from pathlib import Path def lowerCamelCase_ ( ): from torch.utils.cpp_extension import load lowerCamelCase__ : str = Path(_UpperCAmelCase ).resolve().parent.parent.parent / 'kernels' / 'deformable_detr' lowerCamelCase__ : Tuple = ...
716
"""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
0
"""simple docstring""" from typing import TYPE_CHECKING from ....utils import OptionalDependencyNotAvailable, _LazyModule, is_torch_available, is_vision_available A_ : Union[str, Any] = {"configuration_van": ["VAN_PRETRAINED_CONFIG_ARCHIVE_MAP", "VanConfig"]} try: if not is_torch_availabl...
717
"""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
0
"""simple docstring""" import argparse import json import os import fairseq import torch from torch import nn from transformers import ( SpeechaTextaConfig, SpeechaTextaForCausalLM, SpeechaTextaTokenizer, SpeechEncoderDecoderConfig, SpeechEncoderDecoderModel, WavaVecaConfig, WavaVec...
718
"""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
0
"""simple docstring""" from __future__ import annotations from collections import deque from collections.abc import Iterator from dataclasses import dataclass @dataclass class a_ : '''simple docstring''' lowerCamelCase__ : Any = 42 lowerCamelCase__ : Any = 4...
719
"""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
0
"""simple docstring""" def lowerCamelCase_ ( _lowerCamelCase = 1000 ): lowerCamelCase__ : Dict = -1 lowerCamelCase__ : str = 0 for a in range(1 , n // 3 ): # Solving the two equations a**2+b**2=c**2 and a+b+c=N eliminating c lowerCamelCase__ : Option...
720
"""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
0
"""simple docstring""" import unittest from typing import Tuple import torch from diffusers.utils import floats_tensor, randn_tensor, torch_all_close, torch_device from diffusers.utils.testing_utils import require_torch @require_torch class a_ : '''simple docstring''' @property ...
721
"""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
0
"""simple docstring""" from __future__ import annotations from typing import Any class a_ ( snake_case_ ): '''simple docstring''' pass class a_ : '''simple docstring''' def __init__(self, lowerCamelCase_ ): '''simple docstring''' l...
700
"""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
0
"""simple docstring""" from __future__ import annotations from typing import Any def lowerCamelCase_ ( _lowerCamelCase ): create_state_space_tree(_lowerCamelCase , [] , 0 ) def lowerCamelCase_ ( _lowerCamelCase , _lowerCamelCase , _low...
701
"""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
0
"""simple docstring""" import math import sys def lowerCamelCase_ ( _lowerCamelCase ): lowerCamelCase__ : Optional[Any] = "" try: with open(SCREAMING_SNAKE_CASE_ , 'rb' ) as binary_file: lowerCamelCase__ : List[Any] = binary_file.read() for dat i...
702
"""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
0
"""simple docstring""" from collections.abc import Iterator, MutableMapping from dataclasses import dataclass from typing import Generic, TypeVar A_ : str = TypeVar("KEY") A_ : List[str] = TypeVar("VAL") @dataclass(frozen=snake_case_ , slots=snake_case_ ) class a_ ( ...
703
"""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
0
"""simple docstring""" import unittest from transformers import is_torch_available from transformers.testing_utils import require_torch if is_torch_available(): import torch from transformers.activations import gelu_new, gelu_python, get_activation @require_torch class a_ ( unittest.TestCase ...
704
"""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
0
"""simple docstring""" from typing import TYPE_CHECKING from ...utils import ( OptionalDependencyNotAvailable, _LazyModule, is_sentencepiece_available, is_tokenizers_available, is_torch_available, ) A_ : Optional[int] = {"configuration_plbart": ["PLBART_PRETRAINED_CONFIG_ARC...
705
"""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
0
"""simple docstring""" from sklearn.metrics import matthews_corrcoef import datasets A_ : Optional[Any] = ''' Compute the Matthews correlation coefficient (MCC) The Matthews correlation coefficient is used in machine learning as a measure of the quality of binary and multiclass cl...
706
"""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
0
"""simple docstring""" import asyncio import os import re import sys import tempfile import unittest from contextlib import contextmanager from copy import deepcopy from distutils.util import strtobool from enum import Enum from importlib.util import find_spec from pathlib import Path from unittest.mock import p...
707
"""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
0
"""simple docstring""" import logging import os import quant_trainer import torch from torch.utils.data import DataLoader from transformers import Trainer, is_torch_tpu_available from transformers.trainer_utils import PredictionOutput A_ : Dict = logging.getLogger(__name__) if is_torch_tpu_av...
708
"""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
0
"""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 A_ : Tuple = logging.get_logger(__name__) A_ : str = {'vocab_file...
709
"""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
0
"""simple docstring""" # tests directory-specific settings - this file is run automatically # by pytest before any tests are run import sys import warnings from os.path import abspath, dirname, join # allow having multiple repository checkouts and not needing to remember to rerun # 'pip install -e .[dev]' whe...
710
"""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
0
"""simple docstring""" from __future__ import annotations from collections.abc import Callable def lowerCamelCase_ ( _lowerCamelCase , _lowerCamelCase , _lowerCamelCase , _lowerCamelCase = 100 , ): '''simple docstring''' lowerCamelCase__ : Any = x_st...
711
"""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
0
"""simple docstring""" from typing import Callable, List, Optional, Union import PIL import torch from transformers import ( CLIPImageProcessor, CLIPSegForImageSegmentation, CLIPSegProcessor, CLIPTextModel, CLIPTokenizer, ) from diffusers import DiffusionPipeline from diffusers.configuration_u...
712
"""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
0
"""simple docstring""" import unittest import numpy as np import torch from diffusers import ScoreSdeVePipeline, ScoreSdeVeScheduler, UNetaDModel from diffusers.utils.testing_utils import enable_full_determinism, require_torch, slow, torch_device enable_full_determinism() class a_ ( unittest.TestCase...
713
"""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
0
"""simple docstring""" import warnings from transformers import AutoTokenizer from transformers.utils import is_torch_available from transformers.utils.generic import ExplicitEnum from ...processing_utils import ProcessorMixin if is_torch_available(): import torch class a_ ( __lowerCamelCase ...
714
"""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
0
"""simple docstring""" import inspect import unittest from transformers import SegformerConfig, is_torch_available, is_vision_available from transformers.models.auto import get_values from transformers.testing_utils import require_torch, slow, torch_device from ...test_configuration_common import ConfigTester from...
715
"""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
0
"""simple docstring""" import argparse import collections import json import os import re import string import sys import numpy as np A_ : List[str] = re.compile(r"\b(a|an|the)\b", re.UNICODE) A_ : Optional[int] = None def lowerCamelCase_ ( ): lowerCamelCase__ : ...
716
"""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
0
"""simple docstring""" def lowerCamelCase_ ( _lowerCamelCase ): lowerCamelCase__ : List[Any] = len(snake_case__ ) for i in range(snake_case__ ): for j in range(i + 1 , snake_case__ ): if numbers[j] < numbers[i]: lowerCamelCase__ , lowerCamelCas...
717
"""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
0
"""simple docstring""" import unittest from transformers import is_torch_available from transformers.testing_utils import require_torch, slow, torch_device from ...generation.test_utils import GenerationTesterMixin from ...test_configuration_common import ConfigTester from ...test_modeling_common import ModelT...
718
"""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
0
"""simple docstring""" import argparse import json import os import fairseq import torch from fairseq.data import Dictionary from transformers import ( WavaVecaConfig, WavaVecaCTCTokenizer, WavaVecaFeatureExtractor, WavaVecaForCTC, WavaVecaForPreTraining, WavaVecaProcessor, logging,...
719
"""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
0
"""simple docstring""" from typing import TYPE_CHECKING from ...utils import ( OptionalDependencyNotAvailable, _LazyModule, is_torch_available, ) A_ : List[Any] = { "configuration_swiftformer": [ "SWIFTFORMER_PRETRAINED_CONFIG_ARCHIVE_MAP", "SwiftFormerConfig", ...
720
"""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
0
"""simple docstring""" from typing import TYPE_CHECKING from ...utils import OptionalDependencyNotAvailable, _LazyModule, is_tokenizers_available, is_torch_available A_ : Union[str, Any] = { """configuration_nezha""": ["""NEZHA_PRETRAINED_CONFIG_ARCHIVE_MAP""", """NezhaConfig"""], } try: ...
721
"""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
0
"""simple docstring""" from collections import OrderedDict from typing import Mapping from ...configuration_utils import PretrainedConfig from ...onnx import OnnxConfig from ...utils import logging A_ : List[str] = logging.get_logger(__name__) A_ : Tuple = { "facebook/xlm-ro...
700
"""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
0
"""simple docstring""" from typing import TYPE_CHECKING from ...utils import OptionalDependencyNotAvailable, _LazyModule, is_torch_available A_ : Tuple = { "configuration_nllb_moe": [ "NLLB_MOE_PRETRAINED_CONFIG_ARCHIVE_MAP", "NllbMoeConfig", ] } try: if not is_to...
701
"""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
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_available(): from...
702
"""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
0
"""simple docstring""" def lowerCamelCase_ ( _lowerCamelCase = 10 ): if not isinstance(UpperCamelCase__ , UpperCamelCase__ ) or n < 0: raise ValueError('Invalid input' ) lowerCamelCase__ : str = 10**n lowerCamelCase__ : Tuple = 2_8433 * (pow(2 ...
703
"""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
0
"""simple docstring""" from __future__ import annotations from collections.abc import Callable from typing import Generic, TypeVar A_ : str = TypeVar("T") A_ : Any = TypeVar("U") class a_ ( Generic[T, U] ): '''simple docstring''' def __init__(self, ...
704
"""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
0
"""simple docstring""" import argparse import json from pathlib import Path import requests import torch from huggingface_hub import hf_hub_download from PIL import Image from transformers import YolosConfig, YolosForObjectDetection, YolosImageProcessor from transformers.utils import logging logging.set_verb...
705
"""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
0
"""simple docstring""" from unittest import TestCase from datasets import Sequence, Value from datasets.arrow_dataset import Dataset class a_ ( __lowercase ): '''simple docstring''' def a__ (self ): '''simple docstring''' ...
706
"""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
0
"""simple docstring""" 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 AutoImageProcessor, ViTImageProcessor from transformers.testing_utils impo...
707
"""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
0
"""simple docstring""" from ...configuration_utils import PretrainedConfig from ...utils import logging A_ : Union[str, Any] = logging.get_logger(__name__) A_ : int = { "facebook/nllb-moe-54B": "https://huggingface.co/facebook/nllb-moe-54b/resolve/main/config.json", } clas...
708
"""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
0
"""simple docstring""" from typing import TYPE_CHECKING from ...utils import ( OptionalDependencyNotAvailable, _LazyModule, is_flax_available, is_tf_available, is_torch_available, ) A_ : List[str] = {"configuration_vit_mae": ["VIT_MAE_PRETRAINED_CONFIG_ARCHIVE_MAP", "ViTMAEC...
709
"""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
0
"""simple docstring""" from manim import * class a_ ( a__ ): '''simple docstring''' def a__ (self ): '''simple docstring''' lowerCamelCase__ : Union[str, Any] = Rectangle(height=0.5, width=0.5 ) lowerCamelCase__ : Any ...
710
"""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
0
"""simple docstring""" from ...configuration_utils import PretrainedConfig from ...utils import logging A_ : int = logging.get_logger(__name__) A_ : Tuple = { "facebook/dpr-ctx_encoder-single-nq-base": ( "https://huggingface.co/facebook/dpr-ctx_encoder-single-nq-base/...
711
"""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
0
"""simple docstring""" import argparse import logging import os from pathlib import Path from typing import Any, Dict import pytorch_lightning as pl from pytorch_lightning.utilities import rank_zero_info from transformers import ( AdamW, AutoConfig, AutoModel, AutoModelForPreTraining, AutoMode...
712
"""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
0
"""simple docstring""" def lowerCamelCase_ ( _lowerCamelCase , _lowerCamelCase ): lowerCamelCase__ : Dict = len(a_ ) print('The following activities are selected:' ) # The first activity is always selected lowerCamelCase__ : Optional[int] = 0 print(...
713
"""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
0
"""simple docstring""" class a_ : '''simple docstring''' def __init__(self ): '''simple docstring''' lowerCamelCase__ : Dict = {} # Mapping from char to TrieNode lowerCamelCase__ : int = False def a__ (self, lowe...
714
"""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
0
"""simple docstring""" def lowerCamelCase_ ( _lowerCamelCase , _lowerCamelCase ): return 1 if input_a == input_a else 0 def lowerCamelCase_ ( ): assert xnor_gate(0 , 0 ) == 1 assert xnor_gate(0 , 1 ) == 0 assert xnor_gate(1 , 0 ) == 0 asser...
715
"""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
0
"""simple docstring""" import unittest from transformers import is_vision_available from transformers.pipelines import pipeline from transformers.testing_utils import ( is_pipeline_test, nested_simplify, require_tf, require_torch, require_vision, slow, ) from .test_pipelines_common impo...
716
"""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
0
"""simple docstring""" from __future__ import annotations import typing from collections import Counter def lowerCamelCase_ ( _lowerCamelCase ): lowerCamelCase__ : Dict = Counter() for base in range(1 , max_perimeter + 1 ): for perpendicular in range(_lowerCamelC...
717
"""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
0
"""simple docstring""" from itertools import product from cva import COLOR_BGR2GRAY, cvtColor, imread, imshow, waitKey from numpy import dot, exp, mgrid, pi, ravel, square, uinta, zeros def lowerCamelCase_ ( _lowerCamelCase , _lowerCamelCase ): lowerCamelCase__ : int = k_...
718
"""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
0
"""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 accelera...
719
"""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
0
"""simple docstring""" from ...configuration_utils import PretrainedConfig class a_ ( lowercase_ ): '''simple docstring''' lowerCamelCase__ : Union[str, Any] = '''bert-generation''' def __init__(self, lowerCamelCase_=5_0_3_5_8, lowerCamelCase_=1_0_2_4, lower...
720
"""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
0
"""simple docstring""" import inspect import os import unittest import torch import accelerate from accelerate import debug_launcher from accelerate.test_utils import ( execute_subprocess_async, require_cpu, require_huggingface_suite, require_multi_gpu, require_single_gpu, ) from accelerate...
721
"""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
0
"""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__ : ...
700
"""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
0
"""simple docstring""" def lowerCamelCase_ ( _lowerCamelCase , _lowerCamelCase ): return price * (1 + tax_rate) if __name__ == "__main__": print(f"{price_plus_tax(1_00, 0.25) = }") print(f"{price_plus_tax(125.50, 0.05) = }")
701
"""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
0
"""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...
702
"""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
0
"""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:...
703
"""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
0
"""simple docstring""" from dataclasses import dataclass from typing import Optional, Tuple import torch from torch import nn from transformers import RobertaPreTrainedModel, XLMRobertaConfig, XLMRobertaModel from transformers.utils import ModelOutput @dataclass class a_ ( snake_case_ ): ...
704
"""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
0
"""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...
705
"""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
0
"""simple docstring""" import numpy as np from transformers import Pipeline def lowerCamelCase_ ( _lowerCamelCase ): lowerCamelCase__ : List[str] = np.max(_lowerCamelCase , axis=-1 , keepdims=_lowerCamelCase ) lowerCamelCase__ : List[A...
706
"""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
0
"""simple docstring""" def lowerCamelCase_ ( _lowerCamelCase ): '''simple docstring''' return number & 1 == 0 if __name__ == "__main__": import doctest doctest.testmod()
707
"""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
0
"""simple docstring""" import math def lowerCamelCase_ ( _lowerCamelCase ): if not isinstance(_lowerCamelCase , _lowerCamelCase ): lowerCamelCase__ : List[Any] = f'''Input value of [number={number}] must be an integer''' raise TypeError(_lowerCamelCase ) ...
708
"""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
0
"""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...
709
"""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
0
"""simple docstring""" import argparse from tax import checkpoints from transformers import AutoConfig, FlaxAutoModelForSeqaSeqLM def lowerCamelCase_ ( _lowerCamelCase , _lowerCamelCase , _lowerCamelCase ): lowerCamelCase__ : List[str] = AutoConfig.from_pretrained...
710
"""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
0
"""simple docstring""" def lowerCamelCase_ ( _lowerCamelCase ): # noqa: E741 '''simple docstring''' lowerCamelCase__ : int = len(_lowerCamelCase ) lowerCamelCase__ : int = 0 lowerCamelCase__ : Any = [0] * n lowerCamelCase__ : str =...
711
"""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
0
"""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] = f'...
712
"""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
0
"""simple docstring""" from __future__ import annotations import math def lowerCamelCase_ ( _lowerCamelCase , _lowerCamelCase , _lowerCamelCase , _lowerCamelCase , _lowerCamelCase ): if depth < 0: raise ValueError('Depth cannot be less than 0' ) if not ...
713
"""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
0
"""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...
714
"""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
0
"""simple docstring""" def lowerCamelCase_ ( _lowerCamelCase , _lowerCamelCase = False ): if n == 2: return True if not n % 2 or n < 2: return False if n > 5 and n % 10 not in (1, 3, 7, 9): # can quickly check last digit return False if n > 3_3170_4406_4679_8873_8596_1981 and not allow...
715
"""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
0
"""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''' ...
716
"""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
0
"""simple docstring""" def lowerCamelCase_ ( _lowerCamelCase ): lowerCamelCase__ : List[str] = False while is_sorted is False: # Until all the indices are traversed keep looping lowerCamelCase__ : Dict = True for i in range(0 , len(_lowerCamelCase ) - 1 ...
717
"""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
0
"""simple docstring""" from typing import TYPE_CHECKING from ...utils import ( OptionalDependencyNotAvailable, _LazyModule, is_flax_available, is_tf_available, is_tokenizers_available, is_torch_available, is_vision_available, ) A_ : List[Any] = { "configuration_o...
718
"""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
0
"""simple docstring""" from typing import TYPE_CHECKING from ...utils import OptionalDependencyNotAvailable, _LazyModule, is_torch_available A_ : Dict = { "configuration_time_series_transformer": [ "TIME_SERIES_TRANSFORMER_PRETRAINED_CONFIG_ARCHIVE_MAP", "TimeSeriesTransform...
719
"""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
0
"""simple docstring""" import math from dataclasses import dataclass from typing import List, Optional, Tuple, Union import numpy as np import torch from diffusers.configuration_utils import ConfigMixin, register_to_config from diffusers.schedulers.scheduling_utils import SchedulerMixin from diffusers.utils im...
720
"""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
0
"""simple docstring""" import json import os import shutil import tempfile import unittest import numpy as np import pytest from transformers import CLIPTokenizer, CLIPTokenizerFast from transformers.models.clip.tokenization_clip import VOCAB_FILES_NAMES from transformers.testing_utils import require_vision fr...
721
"""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
0
"""simple docstring""" from typing import List, Optional, Union import numpy as np from ....audio_utils import mel_filter_bank, optimal_fft_length, spectrogram, window_function from ....feature_extraction_sequence_utils import SequenceFeatureExtractor from ....feature_extraction_utils import BatchFeature from ...
700
"""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
0
"""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...
701
"""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
0
"""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...
702
"""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
0
"""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...
703
"""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
0
"""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...
704
"""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
0
"""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 ...
705
"""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
0
"""simple docstring""" from __future__ import annotations class a_ : '''simple docstring''' def __init__(self, lowerCamelCase_, lowerCamelCase_ ): '''simple docstring''' lowerCamelCase__ : Optional[Any] = text, pattern ...
706
"""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
0
"""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...
707
"""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
0
"""simple docstring""" import json from typing import List, Optional, Tuple from tokenizers import normalizers from ...tokenization_utils_fast import PreTrainedTokenizerFast from ...utils import logging from .tokenization_mobilebert import MobileBertTokenizer A_ : List[Any] = logging.get_logge...
708
"""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
0
"""simple docstring""" import unittest from diffusers.models.unet_ad_blocks import * # noqa F403 from diffusers.utils import torch_device from .test_unet_blocks_common import UNetBlockTesterMixin class a_ ( snake_case_ , unittest.TestCase ): '''simple docstring''' lowerCam...
709
"""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
0
"""simple docstring""" def lowerCamelCase_ ( _lowerCamelCase ): if not isinstance(_lowerCamelCase , _lowerCamelCase ): raise ValueError('check_bouncy() accepts only integer arguments' ) lowerCamelCase__ : List[Any] = str(_lowerCamelCase ) lowerCamelCase__ ...
710
"""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
0
"""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...
711
"""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
0
"""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''' lowerCamelCase_...
712
"""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
0
"""simple docstring""" from ...configuration_utils import PretrainedConfig from ...utils import logging A_ : Optional[int] = logging.get_logger(__name__) A_ : Optional[int] = { # See all MEGATRON_BERT models at https://huggingface.co/models?filter=bert } class a_ ( sn...
713
"""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
0
"""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...
714
"""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
0
"""simple docstring""" import json from typing import List, Optional, Tuple from tokenizers import normalizers from ...tokenization_utils_fast import PreTrainedTokenizerFast from ...utils import logging from .tokenization_funnel import FunnelTokenizer A_ : Union[str, Any] = logging.get_logger(__na...
715
"""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
0
"""simple docstring""" from sklearn.metrics import matthews_corrcoef import datasets A_ : Union[str, Any] = "\nCompute the Matthews correlation coefficient (MCC)\n\nThe Matthews correlation coefficient is used in machine learning as a\nmeasure of the quality of binary and multiclass classificat...
716
"""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
0
"""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...
717
"""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
0
"""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_ ...
718
"""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
0
"""simple docstring""" import copy import inspect import unittest from transformers import PretrainedConfig, SwiftFormerConfig from transformers.testing_utils import ( require_torch, require_vision, slow, torch_device, ) from transformers.utils import cached_property, is_torch_available, is_visi...
719
"""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
0
"""simple docstring""" import numpy as np import torch import tqdm from ...models.unet_ad import UNetaDModel from ...pipelines import DiffusionPipeline from ...utils import randn_tensor from ...utils.dummy_pt_objects import DDPMScheduler class a_ ( snake_case_ ): '''simple docstring''' ...
720
"""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
0