code
stringlengths
87
55.2k
code_codestyle
int64
0
349
style_context
stringlengths
135
49.1k
style_context_codestyle
int64
0
349
label
int64
0
1
"""simple docstring""" import copy import os from typing import Union from ...configuration_utils import PretrainedConfig from ...models.auto.modeling_auto import MODEL_FOR_CAUSAL_LM_MAPPING_NAMES from ...utils import logging from ..auto import CONFIG_MAPPING lowerCamelCase_ : Dict...
81
from ...configuration_utils import PretrainedConfig from ...utils import logging from ...utils.backbone_utils import BackboneConfigMixin, get_aligned_output_features_output_indices a__ = logging.get_logger(__name__) a__ = { '''google/bit-50''': '''https://huggingface.co/google/bit-50/resolve/...
235
0
import math def _UpperCAmelCase ( snake_case ): """simple docstring""" if 1 < number < 4: # 2 and 3 are primes return True elif number < 2 or number % 2 == 0 or number % 3 == 0: # Negatives, 0, 1, all even numbers, all multiples of 3 are not primes ...
82
def __UpperCAmelCase ( __a : str ) -> int: """simple docstring""" assert column_title.isupper() _a : Optional[Any] = 0 _a : List[Any] = len(__a ) - 1 _a : List[str] = 0 while index >= 0: _a : Dict = ...
235
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 lowercase__ ( ...
83
from collections import OrderedDict from typing import Mapping from ...configuration_utils import PretrainedConfig from ...onnx import OnnxConfig from ...utils import logging a__ = logging.get_logger(__name__) a__ = { '''junnyu/roformer_chinese_small''': '''https://huggingface.co/junnyu/r...
235
0
"""simple docstring""" def _snake_case ( lowercase__ : Optional[Any] , lowercase__ : Dict ) -> Dict: '''simple docstring''' lowerCAmelCase_ :Any = 0 while b > 0: if b & 1: res += a a += a b >>= 1 ret...
84
import math from typing import Dict, Iterable, List, Optional, Tuple, Union import numpy as np from ...image_processing_utils import BaseImageProcessor, BatchFeature, get_size_dict from ...image_transforms import normalize, rescale, resize, to_channel_dimension_format from ...image_utils import ( IMAG...
235
0
'''simple docstring''' def UpperCamelCase_( snake_case : int ): '''simple docstring''' if not isinstance(snake_case , snake_case ): raise ValueError("Input must be an integer" ) if input_num <= 0: raise ValueError("I...
85
import warnings from ...processing_utils import ProcessorMixin from ...tokenization_utils_base import BatchEncoding class UpperCAmelCase_ ( __lowercase ): """simple docstring""" UpperCAmelCase__ : Union[str, Any] = ["image_processor", "tokenizer"] ...
235
0
"""simple docstring""" import fire from transformers import AutoConfig, AutoModelForSeqaSeqLM, AutoTokenizer def __lowerCAmelCase (_UpperCamelCase , _UpperCamelCase , **_UpperCamelCase ): __lowerCAmelCase : List[Any] = AutoConfig.from_pretrained(_UpperCamelCase ...
86
import torch from diffusers import DDPMScheduler from .test_schedulers import SchedulerCommonTest class UpperCAmelCase_ ( __lowercase ): """simple docstring""" UpperCAmelCase__ : List[Any] = (DDPMScheduler,) def __lowercase ( sel...
235
0
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 import ConfigTester from ...
87
import operator as op a__ = '''scaler.pt''' a__ = '''pytorch_model''' a__ = '''random_states''' a__ = '''optimizer''' a__ = '''scheduler''' a__ = '''pytorch_model.bin''' a__ = '''pytorch_model.bin.index.json''' a__ = '''model.safetensors''' a__ = '''model.safetensors...
235
0
import comet # From: unbabel-comet import torch import datasets __lowerCAmelCase : Union[str, Any] = datasets.logging.get_logger(__name__) __lowerCAmelCase : Union[str, Any] = '\\n@inproceedings{rei-EtAl:2020:WMT,\n author = {Rei, Ricardo and Stewart, Craig and...
88
from diffusers.utils.testing_utils import require_onnxruntime @require_onnxruntime class UpperCAmelCase_ : """simple docstring""" pass
235
0
'''simple docstring''' from ...configuration_utils import PretrainedConfig from ...utils import logging __lowerCAmelCase = logging.get_logger(__name__) __lowerCAmelCase = { '''s-JoL/Open-Llama-V1''': '''https://huggingface.co/s-JoL/Open-Llama-V1/blob/main/config.json''', } class __magi...
89
import unittest from transformers import EsmConfig, is_torch_available from transformers.testing_utils import TestCasePlus, require_torch, slow, torch_device from ...test_configuration_common import ConfigTester from ...test_modeling_common import ModelTesterMixin, ids_tensor, random_attention_mask from .....
235
0
def lowerCamelCase_ ( UpperCamelCase__ : int , UpperCamelCase__ : int ) -> str: """simple docstring""" if number < 0 or shift_amount < 0: raise ValueError('both inputs must be positive integers' ) __lowerCamelCase ...
90
import warnings from ...processing_utils import ProcessorMixin from ...tokenization_utils_base import BatchEncoding class UpperCAmelCase_ ( __lowercase ): """simple docstring""" UpperCAmelCase__ : str = ["image_processor", "tokenizer"] UpperCAm...
235
0
"""simple docstring""" from ....configuration_utils import PretrainedConfig from ....utils import logging UpperCAmelCase_ : Optional[int] = logging.get_logger(__name__) UpperCAmelCase_ : int = { """speechbrain/m-ctc-t-large""": """https://huggingface.co/speechbrain/m-ctc-t-large/resolv...
91
from typing import TYPE_CHECKING from ....utils import OptionalDependencyNotAvailable, _LazyModule, is_torch_available a__ = {'''configuration_mmbt''': ['''MMBTConfig''']} try: if not is_torch_available(): raise OptionalDependencyNotAvailable() except OptionalDependencyNotAvailable: p...
235
0
from dataclasses import dataclass, field from typing import Tuple from ..utils import cached_property, is_torch_available, is_torch_tpu_available, logging, requires_backends from .benchmark_args_utils import BenchmarkArguments if is_torch_available(): import torch if is_torch_tpu_available(check_device=Fa...
92
import requests a__ = '''YOUR API KEY''' def __UpperCAmelCase ( __a : str ,__a : str = giphy_api_key ) -> list: """simple docstring""" _a : Optional[Any] = '''+'''.join(query.split() ) _a : Union[str, Any] = F"""https://api.giphy.co...
235
0
'''simple docstring''' import random def snake_case_ ( __SCREAMING_SNAKE_CASE : list , __SCREAMING_SNAKE_CASE : str ): """simple docstring""" lowercase_ , lowercase_ , lowercase_ : Optional[int] = [], [], []...
93
from collections.abc import Callable class UpperCAmelCase_ : """simple docstring""" def __init__( self , _a = None ) -> None: # Stores actual heap items. _a : list = [] # Stores indexes of each item fo...
235
0
# Copyright 2023 The HuggingFace Inc. team. All rights reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by a...
94
import re import jax.numpy as jnp from flax.traverse_util import flatten_dict, unflatten_dict from jax.random import PRNGKey from ..utils import logging a__ = logging.get_logger(__name__) def __UpperCAmelCase ( __a : Dict ) -> Tuple: """simple docstring""" _a ...
235
0
UpperCAmelCase : Optional[int] = [ """DownloadConfig""", """DownloadManager""", """DownloadMode""", """StreamingDownloadManager""", ] from .download_config import DownloadConfig from .download_manager import DownloadManager, DownloadMode from .streaming_download_manager...
95
import logging from transformers import PretrainedConfig a__ = logging.getLogger(__name__) a__ = { '''bertabs-finetuned-cnndm''': '''https://huggingface.co/remi/bertabs-finetuned-cnndm-extractive-abstractive-summarization/resolve/main/config.json''', } class UpperCAmelCase_ ( __...
235
0
"""simple docstring""" import unittest import numpy as np from transformers import RobertaConfig, is_flax_available from transformers.testing_utils import require_flax, slow from ...test_modeling_flax_common import FlaxModelTesterMixin, floats_tensor, ids_tensor, random_attention_mask ...
96
def __UpperCAmelCase ( __a : float ) -> float: """simple docstring""" return 10 - x * x def __UpperCAmelCase ( __a : float ,__a : float ) -> float: """simple docstring""" if equation(__a ) * equation(__a ) >= 0: raise ValueErr...
235
0
'''simple docstring''' # Function to print upper half of diamond (pyramid) def a ( __a ) -> str: '''simple docstring''' for i in range(0 , __a ): for _ in range(0 , n - i - 1 ): # printing spaces print(''' ''' , end='''''' ) for ...
97
import datasets from .nmt_bleu import compute_bleu # From: https://github.com/tensorflow/nmt/blob/master/nmt/scripts/bleu.py a__ = '''\ @INPROCEEDINGS{Papineni02bleu:a, author = {Kishore Papineni and Salim Roukos and Todd Ward and Wei-jing Zhu}, title = {BLEU: a Method for Automatic Evaluation ...
235
0
"""simple docstring""" import os import numpy import onnx def a_ ( lowerCamelCase , lowerCamelCase ): UpperCAmelCase__ = a.name UpperCAmelCase__ = b.name UpperCAmelCase__ = '' UpperCAmelCase__ = '' ...
98
a__ = '''0.18.2''' from .configuration_utils import ConfigMixin from .utils import ( OptionalDependencyNotAvailable, is_flax_available, is_inflect_available, is_invisible_watermark_available, is_k_diffusion_available, is_k_diffusion_version, is_librosa_available, is_n...
235
0
import os import sys lowercase : List[str] = os.path.join(os.path.dirname(__file__), """src""") sys.path.append(SRC_DIR) from transformers import ( AutoConfig, AutoModel, AutoModelForCausalLM, AutoModelForMaskedLM, AutoModelForQuestionAnswering, AutoModelForSequenceC...
99
import os import time import warnings from dataclasses import dataclass, field from enum import Enum from typing import List, Optional, Union import torch from filelock import FileLock from torch.utils.data import Dataset from ...tokenization_utils_base import PreTrainedTokenizerBase from ...utils imp...
235
0
"""simple docstring""" from ...configuration_utils import PretrainedConfig from ...utils import logging __magic_name__ = logging.get_logger(__name__) __magic_name__ = { "facebook/dpr-ctx_encoder-single-nq-base": ( "https://huggingface.co/facebook/dpr-ctx_encoder-single-nq-base/resol...
100
import json import os import unittest from transformers import AutoTokenizer, GPTaTokenizer, GPTaTokenizerFast from transformers.models.gpta.tokenization_gpta import VOCAB_FILES_NAMES from transformers.testing_utils import require_tokenizers from ...test_tokenization_common import TokenizerTesterMixin ...
235
0
import logging import os import sys from dataclasses import dataclass, field from typing import Optional import evaluate import numpy as np import torch from datasets import load_dataset from PIL import Image from torchvision.transforms import ( CenterCrop, Compose, Normalize, RandomHorizontalFlip, ...
101
from math import ceil def __UpperCAmelCase ( __a : int = 1_001 ) -> int: """simple docstring""" _a : List[Any] = 1 for i in range(1 ,int(ceil(n / 2.0 ) ) ): _a : Optional[Any] = 2 * i + 1 _a : Optional[int] = 2...
235
0
"""simple docstring""" from typing import TYPE_CHECKING from ...utils import ( OptionalDependencyNotAvailable, _LazyModule, is_flax_available, is_torch_available, is_vision_available, ) SCREAMING_SNAKE_CASE : Tuple = {"""configuration_beit""": ["""BEIT_PRETRAINED_CONFIG_ARCHIVE_M...
102
def __UpperCAmelCase ( __a : int ,__a : list[int] ,__a : int ) -> int: """simple docstring""" def count_of_possible_combinations(__a : int ) -> int: if target < 0: return 0 if target == 0: return 1 ...
235
0
import gc import unittest import numpy as np import torch from transformers import CLIPTextConfig, CLIPTextModelWithProjection, CLIPTokenizer from diffusers import HeunDiscreteScheduler, PriorTransformer, ShapEPipeline from diffusers.pipelines.shap_e import ShapERenderer from diffusers.utils import load_numpy, sl...
103
from ...configuration_utils import PretrainedConfig from ...utils import logging from ...utils.backbone_utils import BackboneConfigMixin, get_aligned_output_features_output_indices a__ = logging.get_logger(__name__) a__ = { '''google/bit-50''': '''https://huggingface.co/google/bit-50/resolve/...
235
0
'''simple docstring''' class lowercase_ : """simple docstring""" def __init__( self : Optional[int] ,lowercase__ : Tuple ,lowercase__ : int ,lowercase__ : Dict ): __lowercase = name __lowercase = value __lowercase = weigh...
104
def __UpperCAmelCase ( __a : str ) -> int: """simple docstring""" assert column_title.isupper() _a : Optional[Any] = 0 _a : List[Any] = len(__a ) - 1 _a : List[str] = 0 while index >= 0: _a : Dict = ...
235
0
"""simple docstring""" from ...utils import ( OptionalDependencyNotAvailable, is_torch_available, is_transformers_available, is_transformers_version, ) try: if not (is_transformers_available() and is_torch_available() and is_transformers_version('''>=''', '''4.25.0'''))...
105
from collections import OrderedDict from typing import Mapping from ...configuration_utils import PretrainedConfig from ...onnx import OnnxConfig from ...utils import logging a__ = logging.get_logger(__name__) a__ = { '''junnyu/roformer_chinese_small''': '''https://huggingface.co/junnyu/r...
235
0
"""simple docstring""" from typing import Mapping from ...configuration_utils import PretrainedConfig from ...onnx import OnnxSeqaSeqConfigWithPast from ...utils import logging __UpperCamelCase : List[Any] = logging.get_logger(__name__) __UpperCamelCase : List[Any] = { ...
106
import math from typing import Dict, Iterable, List, Optional, Tuple, Union import numpy as np from ...image_processing_utils import BaseImageProcessor, BatchFeature, get_size_dict from ...image_transforms import normalize, rescale, resize, to_channel_dimension_format from ...image_utils import ( IMAG...
235
0
from __future__ import annotations from scipy.special import comb # type: ignore class snake_case__ : """simple docstring""" def __init__( self : Any , __lowerCamelCase : list[tuple[float, float]] ) -> Tuple: a = list_of_points ...
107
import warnings from ...processing_utils import ProcessorMixin from ...tokenization_utils_base import BatchEncoding class UpperCAmelCase_ ( __lowercase ): """simple docstring""" UpperCAmelCase__ : Union[str, Any] = ["image_processor", "tokenizer"] ...
235
0
"""simple docstring""" from typing import TYPE_CHECKING from ...utils import _LazyModule lowerCAmelCase__ = {'''tokenization_bertweet''': ['''BertweetTokenizer''']} if TYPE_CHECKING: from .tokenization_bertweet import BertweetTokenizer else: import sys lowerCAmelCase__ ...
108
import torch from diffusers import DDPMScheduler from .test_schedulers import SchedulerCommonTest class UpperCAmelCase_ ( __lowercase ): """simple docstring""" UpperCAmelCase__ : List[Any] = (DDPMScheduler,) def __lowercase ( sel...
235
0
"""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: Tuple = { ...
109
import operator as op a__ = '''scaler.pt''' a__ = '''pytorch_model''' a__ = '''random_states''' a__ = '''optimizer''' a__ = '''scheduler''' a__ = '''pytorch_model.bin''' a__ = '''pytorch_model.bin.index.json''' a__ = '''model.safetensors''' a__ = '''model.safetensors...
235
0
'''simple docstring''' import math import time from transformers import Trainer, is_torch_tpu_available from transformers.trainer_utils import PredictionOutput, speed_metrics if is_torch_tpu_available(check_device=False): import torch_xla.core.xla_model as xm import torch_xla.debu...
276
from diffusers.utils.testing_utils import require_onnxruntime @require_onnxruntime class UpperCAmelCase_ : """simple docstring""" pass
235
0
import logging import os from dataclasses import dataclass from enum import Enum from typing import List, Optional, Union from filelock import FileLock from transformers import PreTrainedTokenizer, is_tf_available, is_torch_available _SCREAMING_SNAKE_CASE = logging.getLogger(__name...
327
import unittest from transformers import EsmConfig, is_torch_available from transformers.testing_utils import TestCasePlus, require_torch, slow, torch_device from ...test_configuration_common import ConfigTester from ...test_modeling_common import ModelTesterMixin, ids_tensor, random_attention_mask from .....
235
0
"""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 ConfigTest...
171
import warnings from ...processing_utils import ProcessorMixin from ...tokenization_utils_base import BatchEncoding class UpperCAmelCase_ ( __lowercase ): """simple docstring""" UpperCAmelCase__ : str = ["image_processor", "tokenizer"] UpperCAm...
235
0
from math import ceil def __A ( __lowerCAmelCase = 1_001 )-> int: """simple docstring""" _UpperCAmelCase = 1 for i in range(1 , int(ceil(n / 2.0 ) ) ): _UpperCAmelCase = 2 * i + 1 _UpperCAmelCase = ...
39
from typing import TYPE_CHECKING from ....utils import OptionalDependencyNotAvailable, _LazyModule, is_torch_available a__ = {'''configuration_mmbt''': ['''MMBTConfig''']} try: if not is_torch_available(): raise OptionalDependencyNotAvailable() except OptionalDependencyNotAvailable: p...
235
0
"""simple docstring""" from __future__ import annotations import unittest from transformers import RoFormerConfig, is_tf_available from transformers.testing_utils import require_tf, slow from ...test_configuration_common import ConfigTester from ...test_modeling_tf_common import TFModelTesterMixin, ids_tensor,...
315
import requests a__ = '''YOUR API KEY''' def __UpperCAmelCase ( __a : str ,__a : str = giphy_api_key ) -> list: """simple docstring""" _a : Optional[Any] = '''+'''.join(query.split() ) _a : Union[str, Any] = F"""https://api.giphy.co...
235
0
import unittest from diffusers import FlaxAutoencoderKL from diffusers.utils import is_flax_available from diffusers.utils.testing_utils import require_flax from .test_modeling_common_flax import FlaxModelTesterMixin if is_flax_available(): import jax @require_flax class A ( __lowercase , un...
278
from collections.abc import Callable class UpperCAmelCase_ : """simple docstring""" def __init__( self , _a = None ) -> None: # Stores actual heap items. _a : list = [] # Stores indexes of each item fo...
235
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...
17
import re import jax.numpy as jnp from flax.traverse_util import flatten_dict, unflatten_dict from jax.random import PRNGKey from ..utils import logging a__ = logging.get_logger(__name__) def __UpperCAmelCase ( __a : Dict ) -> Tuple: """simple docstring""" _a ...
235
0
from dataclasses import dataclass, field from typing import Optional @dataclass class lowerCamelCase : '''simple docstring''' _snake_case : Optional[str] = field( default='''codeparrot/codeparrot''' , metadata={'''help''': '''Model name ...
29
import logging from transformers import PretrainedConfig a__ = logging.getLogger(__name__) a__ = { '''bertabs-finetuned-cnndm''': '''https://huggingface.co/remi/bertabs-finetuned-cnndm-extractive-abstractive-summarization/resolve/main/config.json''', } class UpperCAmelCase_ ( __...
235
0
'''simple docstring''' from google.protobuf import descriptor as _descriptor from google.protobuf import descriptor_pool as _descriptor_pool from google.protobuf import symbol_database as _symbol_database from google.protobuf.internal import builder as _builder # @@protoc_insertion_point(imports) Uppe...
181
def __UpperCAmelCase ( __a : float ) -> float: """simple docstring""" return 10 - x * x def __UpperCAmelCase ( __a : float ,__a : float ) -> float: """simple docstring""" if equation(__a ) * equation(__a ) >= 0: raise ValueErr...
235
0
import copy from typing import TYPE_CHECKING, Any, Mapping, Optional, OrderedDict from packaging import version from ...configuration_utils import PretrainedConfig from ...onnx import OnnxConfig from ...utils import logging from ..auto.configuration_auto import AutoConfig if TYPE_CHECKING: from ... import ...
209
import datasets from .nmt_bleu import compute_bleu # From: https://github.com/tensorflow/nmt/blob/master/nmt/scripts/bleu.py a__ = '''\ @INPROCEEDINGS{Papineni02bleu:a, author = {Kishore Papineni and Salim Roukos and Todd Ward and Wei-jing Zhu}, title = {BLEU: a Method for Automatic Evaluation ...
235
0
import re import time from typing import Optional import IPython.display as disp from ..trainer_callback import TrainerCallback from ..trainer_utils import IntervalStrategy, has_length def a__ ( _UpperCamelCase : Any ): __lowerCamelCase = int(__a ) __lowerCamelCas...
330
a__ = '''0.18.2''' from .configuration_utils import ConfigMixin from .utils import ( OptionalDependencyNotAvailable, is_flax_available, is_inflect_available, is_invisible_watermark_available, is_k_diffusion_available, is_k_diffusion_version, is_librosa_available, is_n...
235
0
'''simple docstring''' from ...configuration_utils import PretrainedConfig from ...utils import logging A__: Any = logging.get_logger(__name__) A__: List[str] = { '''tanreinama/GPTSAN-2.8B-spout_is_uniform''': ( '''https://huggingface.co/tanr...
276
import os import time import warnings from dataclasses import dataclass, field from enum import Enum from typing import List, Optional, Union import torch from filelock import FileLock from torch.utils.data import Dataset from ...tokenization_utils_base import PreTrainedTokenizerBase from ...utils imp...
235
0
import argparse import json import os import fairseq import torch from fairseq.data import Dictionary from transformers import ( HubertConfig, HubertForCTC, HubertModel, WavaVecaCTCTokenizer, WavaVecaFeatureExtractor, WavaVecaProcessor, logging, ) logging.s...
327
import json import os import unittest from transformers import AutoTokenizer, GPTaTokenizer, GPTaTokenizerFast from transformers.models.gpta.tokenization_gpta import VOCAB_FILES_NAMES from transformers.testing_utils import require_tokenizers from ...test_tokenization_common import TokenizerTesterMixin ...
235
0
"""simple docstring""" import gc import random import tempfile import unittest import numpy as np import torch from PIL import Image from transformers import CLIPTextConfig, CLIPTextModel, CLIPTokenizer from diffusers import ( AutoencoderKL, DDIMInverseScheduler, DDIMScheduler, DPMSolverMultistepInv...
171
from math import ceil def __UpperCAmelCase ( __a : int = 1_001 ) -> int: """simple docstring""" _a : List[Any] = 1 for i in range(1 ,int(ceil(n / 2.0 ) ) ): _a : Optional[Any] = 2 * i + 1 _a : Optional[int] = 2...
235
0
from argparse import ArgumentParser from . import BaseTransformersCLICommand def __A ( __lowerCAmelCase )-> Optional[Any]: """simple docstring""" return DownloadCommand(args.model , args.cache_dir , args.force , args.trust_remote_code ) class __...
39
def __UpperCAmelCase ( __a : int ,__a : list[int] ,__a : int ) -> int: """simple docstring""" def count_of_possible_combinations(__a : int ) -> int: if target < 0: return 0 if target == 0: return 1 ...
235
0
"""simple docstring""" import copy import unittest from transformers.models.auto import get_values from transformers.testing_utils import require_torch, slow, torch_device from transformers.utils import cached_property, is_torch_available, is_vision_available from ...test_configuration_common import ConfigTeste...
315
from ...configuration_utils import PretrainedConfig from ...utils import logging from ...utils.backbone_utils import BackboneConfigMixin, get_aligned_output_features_output_indices a__ = logging.get_logger(__name__) a__ = { '''google/bit-50''': '''https://huggingface.co/google/bit-50/resolve/...
235
0
import os import time import warnings from dataclasses import dataclass, field from enum import Enum from typing import List, Optional, Union import torch from filelock import FileLock from torch.utils.data import Dataset from ...tokenization_utils_base import PreTrainedTokenizerBase from ...utils import logging...
278
def __UpperCAmelCase ( __a : str ) -> int: """simple docstring""" assert column_title.isupper() _a : Optional[Any] = 0 _a : List[Any] = len(__a ) - 1 _a : List[str] = 0 while index >= 0: _a : Dict = ...
235
0
"""simple docstring""" import argparse import struct import unittest class _lowerCAmelCase : """simple docstring""" def __init__( self : List[Any], UpperCAmelCase__ : List[Any] ): __lowercase = data # Initialize hash values __lowercase ...
17
from collections import OrderedDict from typing import Mapping from ...configuration_utils import PretrainedConfig from ...onnx import OnnxConfig from ...utils import logging a__ = logging.get_logger(__name__) a__ = { '''junnyu/roformer_chinese_small''': '''https://huggingface.co/junnyu/r...
235
0
import shutil import tempfile import unittest import numpy as np import pytest from transformers.testing_utils import require_vision from transformers.utils import is_vision_available if is_vision_available(): from PIL import Image from transformers import AutoProcessor, BlipaProces...
29
import math from typing import Dict, Iterable, List, Optional, Tuple, Union import numpy as np from ...image_processing_utils import BaseImageProcessor, BatchFeature, get_size_dict from ...image_transforms import normalize, rescale, resize, to_channel_dimension_format from ...image_utils import ( IMAG...
235
0
'''simple docstring''' UpperCamelCase__ = '''Alexander Joslin''' import operator as op from .stack import Stack def a__ ( lowerCAmelCase__ ) -> int: UpperCAmelCase__ : Union[str, Any] = {'''*''': op.mul, '''/''': op.truediv, '''+''': op....
181
import warnings from ...processing_utils import ProcessorMixin from ...tokenization_utils_base import BatchEncoding class UpperCAmelCase_ ( __lowercase ): """simple docstring""" UpperCAmelCase__ : Union[str, Any] = ["image_processor", "tokenizer"] ...
235
0
import importlib import inspect import json import os import re import shutil import sys from pathlib import Path from typing import Dict, Optional, Union from urllib import request from huggingface_hub import HfFolder, cached_download, hf_hub_download, model_info from packaging import version from .. import __...
209
import torch from diffusers import DDPMScheduler from .test_schedulers import SchedulerCommonTest class UpperCAmelCase_ ( __lowercase ): """simple docstring""" UpperCAmelCase__ : List[Any] = (DDPMScheduler,) def __lowercase ( sel...
235
0
import math from enum import Enum from typing import Optional, Union from torch.optim import Optimizer from torch.optim.lr_scheduler import LambdaLR from .utils import logging a_ = logging.get_logger(__name__) class __lowerCAmelCase ( __lowercase ): lowerCAmelCase__ = "li...
330
import operator as op a__ = '''scaler.pt''' a__ = '''pytorch_model''' a__ = '''random_states''' a__ = '''optimizer''' a__ = '''scheduler''' a__ = '''pytorch_model.bin''' a__ = '''pytorch_model.bin.index.json''' a__ = '''model.safetensors''' a__ = '''model.safetensors...
235
0
'''simple docstring''' from collections.abc import Generator def SCREAMING_SNAKE_CASE_ ( ) -> Generator[int, None, None]: _a : Any =0, 1 while True: _a : List[str] =b, a + b yield b def SCREAMING_SNAKE_CASE_ ...
276
from diffusers.utils.testing_utils import require_onnxruntime @require_onnxruntime class UpperCAmelCase_ : """simple docstring""" pass
235
0
from __future__ import annotations import math def SCREAMING_SNAKE_CASE__ ( __a ): if 1 < number < 4: # 2 and 3 are primes return True elif number < 2 or number % 2 == 0 or number % 3 == 0: # Negatives, 0, 1, all even numbers, all multiples of 3 are not primes return...
327
import unittest from transformers import EsmConfig, is_torch_available from transformers.testing_utils import TestCasePlus, require_torch, slow, torch_device from ...test_configuration_common import ConfigTester from ...test_modeling_common import ModelTesterMixin, ids_tensor, random_attention_mask from .....
235
0
"""simple docstring""" import time from contextlib import contextmanager from pathlib import Path import pytest import requests from huggingface_hub.hf_api import HfApi, HfFolder _A = """__DUMMY_TRANSFORMERS_USER__""" _A = """Dummy User""" _A = """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""" _...
171
import warnings from ...processing_utils import ProcessorMixin from ...tokenization_utils_base import BatchEncoding class UpperCAmelCase_ ( __lowercase ): """simple docstring""" UpperCAmelCase__ : str = ["image_processor", "tokenizer"] UpperCAm...
235
0
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 = logging.get_logger(__name__) _a = { '''microsoft/beit-base-p...
39
from typing import TYPE_CHECKING from ....utils import OptionalDependencyNotAvailable, _LazyModule, is_torch_available a__ = {'''configuration_mmbt''': ['''MMBTConfig''']} try: if not is_torch_available(): raise OptionalDependencyNotAvailable() except OptionalDependencyNotAvailable: p...
235
0
"""simple docstring""" from __future__ import annotations from fractions import Fraction def _snake_case ( _snake_case : int , _snake_case : int ) -> bool: '''simple docstring''' return ( num != den and num % 10 == den // 10 a...
315
import requests a__ = '''YOUR API KEY''' def __UpperCAmelCase ( __a : str ,__a : str = giphy_api_key ) -> list: """simple docstring""" _a : Optional[Any] = '''+'''.join(query.split() ) _a : Union[str, Any] = F"""https://api.giphy.co...
235
0
import os import sys import warnings from dataclasses import dataclass, field from io import BytesIO from typing import TYPE_CHECKING, Any, ClassVar, Dict, List, Optional, Union import numpy as np import pyarrow as pa from .. import config from ..download.streaming_download_manager import xopen from ..table impo...
278
from collections.abc import Callable class UpperCAmelCase_ : """simple docstring""" def __init__( self , _a = None ) -> None: # Stores actual heap items. _a : list = [] # Stores indexes of each item fo...
235
0
"""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...
17
import re import jax.numpy as jnp from flax.traverse_util import flatten_dict, unflatten_dict from jax.random import PRNGKey from ..utils import logging a__ = logging.get_logger(__name__) def __UpperCAmelCase ( __a : Dict ) -> Tuple: """simple docstring""" _a ...
235
0
def lowercase__ ( __snake_case : int = 1_000 ): '''simple docstring''' UpperCAmelCase_ : List[Any] = 1, 1 UpperCAmelCase_ : Union[str, Any] = 2 while True: UpperCAmelCase_ : Optional[...
29
import logging from transformers import PretrainedConfig a__ = logging.getLogger(__name__) a__ = { '''bertabs-finetuned-cnndm''': '''https://huggingface.co/remi/bertabs-finetuned-cnndm-extractive-abstractive-summarization/resolve/main/config.json''', } class UpperCAmelCase_ ( __...
235
0
'''simple docstring''' import copy import inspect import unittest import numpy as np from huggingface_hub import hf_hub_download from transformers import VideoMAEConfig from transformers.models.auto import get_values from transformers.testing_utils import require_torch, require_vision, slow, torch_dev...
181
def __UpperCAmelCase ( __a : float ) -> float: """simple docstring""" return 10 - x * x def __UpperCAmelCase ( __a : float ,__a : float ) -> float: """simple docstring""" if equation(__a ) * equation(__a ) >= 0: raise ValueErr...
235
0
from typing import Union from ..utils import add_end_docstrings, is_torch_available, is_vision_available, logging from .base import PIPELINE_INIT_ARGS, Pipeline if is_vision_available(): from PIL import Image from ..image_utils import load_image if is_torch_available(): from ..models.auto.modeling_a...
209
import datasets from .nmt_bleu import compute_bleu # From: https://github.com/tensorflow/nmt/blob/master/nmt/scripts/bleu.py a__ = '''\ @INPROCEEDINGS{Papineni02bleu:a, author = {Kishore Papineni and Salim Roukos and Todd Ward and Wei-jing Zhu}, title = {BLEU: a Method for Automatic Evaluation ...
235
0
from transformers import HfArgumentParser, TensorFlowBenchmark, TensorFlowBenchmarkArguments def a__ ( ): __lowerCamelCase = HfArgumentParser(__a ) __lowerCamelCase = parser.parse_args_into_dataclasses()[0] __lowerCamelCase = TensorFlowBenchmark(args=__a ...
330
a__ = '''0.18.2''' from .configuration_utils import ConfigMixin from .utils import ( OptionalDependencyNotAvailable, is_flax_available, is_inflect_available, is_invisible_watermark_available, is_k_diffusion_available, is_k_diffusion_version, is_librosa_available, is_n...
235
0
'''simple docstring''' from dataclasses import dataclass from typing import List, Optional, Union import numpy as np import PIL from PIL import Image from ...utils import ( BaseOutput, OptionalDependencyNotAvailable, is_flax_available, is_k_diffusion_available, is_...
276
import os import time import warnings from dataclasses import dataclass, field from enum import Enum from typing import List, Optional, Union import torch from filelock import FileLock from torch.utils.data import Dataset from ...tokenization_utils_base import PreTrainedTokenizerBase from ...utils imp...
235
0
from ...configuration_utils import PretrainedConfig from ...utils import logging from ...utils.backbone_utils import BackboneConfigMixin, get_aligned_output_features_output_indices _SCREAMING_SNAKE_CASE = logging.get_logger(__name__) _SCREAMING_SNAKE_CASE = { """google/b...
327
import json import os import unittest from transformers import AutoTokenizer, GPTaTokenizer, GPTaTokenizerFast from transformers.models.gpta.tokenization_gpta import VOCAB_FILES_NAMES from transformers.testing_utils import require_tokenizers from ...test_tokenization_common import TokenizerTesterMixin ...
235
0
"""simple docstring""" from ...processing_utils import ProcessorMixin class lowerCamelCase ( __lowercase ): '''simple docstring''' SCREAMING_SNAKE_CASE = "SpeechT5FeatureExtractor" SCREAMING_SNAKE_CASE = "SpeechT5Tokenizer" def __init__(self , _lowerCamelCase , _lowe...
171
from math import ceil def __UpperCAmelCase ( __a : int = 1_001 ) -> int: """simple docstring""" _a : List[Any] = 1 for i in range(1 ,int(ceil(n / 2.0 ) ) ): _a : Optional[Any] = 2 * i + 1 _a : Optional[int] = 2...
235
0
from __future__ import annotations class __lowerCamelCase : """simple docstring""" def __init__( self , UpperCAmelCase ): """simple docstring""" _UpperCAmelCase = TypeError( 'Matrices must be formed ...
39
def __UpperCAmelCase ( __a : int ,__a : list[int] ,__a : int ) -> int: """simple docstring""" def count_of_possible_combinations(__a : int ) -> int: if target < 0: return 0 if target == 0: return 1 ...
235
0
"""simple docstring""" import timeit import numpy as np import datasets from datasets.arrow_writer import ArrowWriter from datasets.features.features import _ArrayXD def _snake_case ( _snake_case : str ) -> Optional[int]: '''simple docstring''' def ...
315
from ...configuration_utils import PretrainedConfig from ...utils import logging from ...utils.backbone_utils import BackboneConfigMixin, get_aligned_output_features_output_indices a__ = logging.get_logger(__name__) a__ = { '''google/bit-50''': '''https://huggingface.co/google/bit-50/resolve/...
235
0
import unittest import numpy as np from transformers.testing_utils import require_torch, require_vision from transformers.utils import is_torch_available, is_vision_available from ...test_image_processing_common import ImageProcessingSavingTestMixin, prepare_image_inputs if is_torch_available(): import ...
278
def __UpperCAmelCase ( __a : str ) -> int: """simple docstring""" assert column_title.isupper() _a : Optional[Any] = 0 _a : List[Any] = len(__a ) - 1 _a : List[str] = 0 while index >= 0: _a : Dict = ...
235
0
"""simple docstring""" from ..utils import DummyObject, requires_backends class _lowerCAmelCase ( metaclass=__lowercase ): """simple docstring""" __UpperCAmelCase : Any = ["note_seq"] def __init__( self : Dict, *UpperCAmelCase__ : int, **UpperCAmel...
17
from collections import OrderedDict from typing import Mapping from ...configuration_utils import PretrainedConfig from ...onnx import OnnxConfig from ...utils import logging a__ = logging.get_logger(__name__) a__ = { '''junnyu/roformer_chinese_small''': '''https://huggingface.co/junnyu/r...
235
0
from ...processing_utils import ProcessorMixin from ...tokenization_utils_base import BatchEncoding class lowerCamelCase (__lowercase ): '''simple docstring''' _snake_case : Dict = ["image_processor", "tokenizer"] _snake_case : Dict ...
29
import math from typing import Dict, Iterable, List, Optional, Tuple, Union import numpy as np from ...image_processing_utils import BaseImageProcessor, BatchFeature, get_size_dict from ...image_transforms import normalize, rescale, resize, to_channel_dimension_format from ...image_utils import ( IMAG...
235
0
'''simple docstring''' import os from shutil import copyfile from typing import Any, Dict, List, Optional, Tuple import sentencepiece as spm from ...tokenization_utils import AddedToken, BatchEncoding, PreTrainedTokenizer from ...utils import logging UpperCamelCase__ = logging.get_logg...
181
import warnings from ...processing_utils import ProcessorMixin from ...tokenization_utils_base import BatchEncoding class UpperCAmelCase_ ( __lowercase ): """simple docstring""" UpperCAmelCase__ : Union[str, Any] = ["image_processor", "tokenizer"] ...
235
0
from collections import defaultdict def lowerCAmelCase__(__snake_case ,__snake_case ) -> bool: '''simple docstring''' lowerCamelCase__ = first_str.lower().strip() lowerCamelCase__ = second_str.lower().strip() # Remove whitespace lowerCamelCase__ ...
209
import torch from diffusers import DDPMScheduler from .test_schedulers import SchedulerCommonTest class UpperCAmelCase_ ( __lowercase ): """simple docstring""" UpperCAmelCase__ : List[Any] = (DDPMScheduler,) def __lowercase ( sel...
235
0
from collections import namedtuple import requests from lxml import html # type: ignore a_ = namedtuple("""covid_data""", """cases deaths recovered""") def a__ ( _UpperCamelCase : str = "https://www.worldometers.info/coronavirus/" ): __lowerCamelCase = '''//div[...
330
import operator as op a__ = '''scaler.pt''' a__ = '''pytorch_model''' a__ = '''random_states''' a__ = '''optimizer''' a__ = '''scheduler''' a__ = '''pytorch_model.bin''' a__ = '''pytorch_model.bin.index.json''' a__ = '''model.safetensors''' a__ = '''model.safetensors...
235
0
'''simple docstring''' import argparse import torch from transformers import ( SpeechTaConfig, SpeechTaFeatureExtractor, SpeechTaForSpeechToSpeech, SpeechTaForSpeechToText, SpeechTaForTextToSpeech, SpeechTaProcessor, SpeechTaTokenizer, logging, ) from...
276
from diffusers.utils.testing_utils import require_onnxruntime @require_onnxruntime class UpperCAmelCase_ : """simple docstring""" pass
235
0
from typing import TYPE_CHECKING from ....utils import OptionalDependencyNotAvailable, _LazyModule, is_torch_available _SCREAMING_SNAKE_CASE = {"""configuration_mmbt""": ["""MMBTConfig"""]} try: if not is_torch_available(): raise OptionalDependencyNotAvailable() ex...
327
import unittest from transformers import EsmConfig, is_torch_available from transformers.testing_utils import TestCasePlus, require_torch, slow, torch_device from ...test_configuration_common import ConfigTester from ...test_modeling_common import ModelTesterMixin, ids_tensor, random_attention_mask from .....
235
0
"""simple docstring""" from typing import TYPE_CHECKING from ...utils import OptionalDependencyNotAvailable, _LazyModule, is_tokenizers_available, is_torch_available _A = { """configuration_graphormer""": ["""GRAPHORMER_PRETRAINED_CONFIG_ARCHIVE_MAP""", """GraphormerConfig"""], } try: if not is_to...
171
import warnings from ...processing_utils import ProcessorMixin from ...tokenization_utils_base import BatchEncoding class UpperCAmelCase_ ( __lowercase ): """simple docstring""" UpperCAmelCase__ : str = ["image_processor", "tokenizer"] UpperCAm...
235
0
import warnings from ...utils import logging from .image_processing_videomae import VideoMAEImageProcessor _a = logging.get_logger(__name__) class __lowerCamelCase ( __lowercase): """simple docstring""" def __init__( self , *UpperCAm...
39
from typing import TYPE_CHECKING from ....utils import OptionalDependencyNotAvailable, _LazyModule, is_torch_available a__ = {'''configuration_mmbt''': ['''MMBTConfig''']} try: if not is_torch_available(): raise OptionalDependencyNotAvailable() except OptionalDependencyNotAvailable: p...
235
0
"""simple docstring""" import argparse import ast import logging import os import sys import pandas as pd import torch from tqdm import tqdm from transformers import BartForConditionalGeneration, RagRetriever, RagSequenceForGeneration, RagTokenForGeneration from transformers import logging as transformers_loggi...
315
import requests a__ = '''YOUR API KEY''' def __UpperCAmelCase ( __a : str ,__a : str = giphy_api_key ) -> list: """simple docstring""" _a : Optional[Any] = '''+'''.join(query.split() ) _a : Union[str, Any] = F"""https://api.giphy.co...
235
0
import warnings from ...processing_utils import ProcessorMixin from ...tokenization_utils_base import BatchEncoding class A ( __lowercase ): __snake_case = ["image_processor", "tokenizer"] __snake_case = "ChineseCLIPImageProcessor" __snake_case = ("BertTokenizer", "Ber...
278
from collections.abc import Callable class UpperCAmelCase_ : """simple docstring""" def __init__( self , _a = None ) -> None: # Stores actual heap items. _a : list = [] # Stores indexes of each item fo...
235
0
"""simple docstring""" import tempfile import unittest from make_student import create_student_by_copying_alternating_layers from transformers import AutoConfig from transformers.file_utils import cached_property from transformers.testing_utils import require_torch _a = 'sshleifer/bart-tiny-rando...
17
import re import jax.numpy as jnp from flax.traverse_util import flatten_dict, unflatten_dict from jax.random import PRNGKey from ..utils import logging a__ = logging.get_logger(__name__) def __UpperCAmelCase ( __a : Dict ) -> Tuple: """simple docstring""" _a ...
235
0
from ...configuration_utils import PretrainedConfig __UpperCAmelCase = { 'google/tapas-base-finetuned-sqa': ( 'https://huggingface.co/google/tapas-base-finetuned-sqa/resolve/main/config.json' ), 'google/tapas-base-finetuned-wtq': ( 'https://huggingface.co/...
29
import logging from transformers import PretrainedConfig a__ = logging.getLogger(__name__) a__ = { '''bertabs-finetuned-cnndm''': '''https://huggingface.co/remi/bertabs-finetuned-cnndm-extractive-abstractive-summarization/resolve/main/config.json''', } class UpperCAmelCase_ ( __...
235
0
'''simple docstring''' import re import jax.numpy as jnp from flax.traverse_util import flatten_dict, unflatten_dict from jax.random import PRNGKey from ..utils import logging UpperCamelCase__ = logging.get_logger(__name__) def a__ ( lowerCAmelCase__ ) ...
181
def __UpperCAmelCase ( __a : float ) -> float: """simple docstring""" return 10 - x * x def __UpperCAmelCase ( __a : float ,__a : float ) -> float: """simple docstring""" if equation(__a ) * equation(__a ) >= 0: raise ValueErr...
235
0
import requests _a = "YOUR API KEY" def lowerCAmelCase__(__snake_case ,__snake_case = giphy_api_key ) -> list: '''simple docstring''' lowerCamelCase__ = '''+'''.join(query.split() ) lowerCamelCase__ = F'https://api.giphy.com/v1/gifs/searc...
209
import datasets from .nmt_bleu import compute_bleu # From: https://github.com/tensorflow/nmt/blob/master/nmt/scripts/bleu.py a__ = '''\ @INPROCEEDINGS{Papineni02bleu:a, author = {Kishore Papineni and Salim Roukos and Todd Ward and Wei-jing Zhu}, title = {BLEU: a Method for Automatic Evaluation ...
235
0
from diffusers.utils.testing_utils import require_onnxruntime @require_onnxruntime class __lowerCAmelCase : pass
330
a__ = '''0.18.2''' from .configuration_utils import ConfigMixin from .utils import ( OptionalDependencyNotAvailable, is_flax_available, is_inflect_available, is_invisible_watermark_available, is_k_diffusion_available, is_k_diffusion_version, is_librosa_available, is_n...
235
0
'''simple docstring''' import numpy as np from matplotlib import pyplot as plt from sklearn.datasets import load_iris from sklearn.metrics import ConfusionMatrixDisplay from sklearn.model_selection import train_test_split from xgboost import XGBClassifier def SCREAMING_SNAKE_CASE_ ( ...
276
import os import time import warnings from dataclasses import dataclass, field from enum import Enum from typing import List, Optional, Union import torch from filelock import FileLock from torch.utils.data import Dataset from ...tokenization_utils_base import PreTrainedTokenizerBase from ...utils imp...
235
0
import argparse import logging import sys from unittest.mock import patch import run_glue_deebert from transformers.testing_utils import TestCasePlus, get_gpu_count, require_torch_non_multi_gpu, slow logging.basicConfig(level=logging.DEBUG) _SCREAMING_SNAKE_CASE = logging.getLogg...
327
import json import os import unittest from transformers import AutoTokenizer, GPTaTokenizer, GPTaTokenizerFast from transformers.models.gpta.tokenization_gpta import VOCAB_FILES_NAMES from transformers.testing_utils import require_tokenizers from ...test_tokenization_common import TokenizerTesterMixin ...
235
0
"""simple docstring""" import copy from ...configuration_utils import PretrainedConfig from ...utils import add_start_docstrings _A = R""" [`RagConfig`] stores the configuration of a *RagModel*. Configuration objects inherit from [`PretrainedConfig`] and can be used to control the model outputs. Re...
171
from math import ceil def __UpperCAmelCase ( __a : int = 1_001 ) -> int: """simple docstring""" _a : List[Any] = 1 for i in range(1 ,int(ceil(n / 2.0 ) ) ): _a : Optional[Any] = 2 * i + 1 _a : Optional[int] = 2...
235
0
import json import os import tempfile from transformers.testing_utils import check_json_file_has_correct_format class __lowerCamelCase : """simple docstring""" UpperCamelCase__ = None def UpperCamelCase ( self ): """simpl...
39
def __UpperCAmelCase ( __a : int ,__a : list[int] ,__a : int ) -> int: """simple docstring""" def count_of_possible_combinations(__a : int ) -> int: if target < 0: return 0 if target == 0: return 1 ...
235
0
"""simple docstring""" import unittest import numpy as np from transformers import is_flax_available from transformers.testing_utils import require_flax from ..test_modeling_flax_common import ids_tensor if is_flax_available(): import jax import jax.numpy as jnp from transformers.genera...
315
from ...configuration_utils import PretrainedConfig from ...utils import logging from ...utils.backbone_utils import BackboneConfigMixin, get_aligned_output_features_output_indices a__ = logging.get_logger(__name__) a__ = { '''google/bit-50''': '''https://huggingface.co/google/bit-50/resolve/...
235
0
import unittest import numpy as np import torch from torch import nn from transformers import ( CLIPImageProcessor, CLIPTextConfig, CLIPTextModelWithProjection, CLIPTokenizer, CLIPVisionConfig, CLIPVisionModelWithProjection, ) from diffusers import KandinskyVaaPriorPipeline, PriorTransfor...
278
def __UpperCAmelCase ( __a : str ) -> int: """simple docstring""" assert column_title.isupper() _a : Optional[Any] = 0 _a : List[Any] = len(__a ) - 1 _a : List[str] = 0 while index >= 0: _a : Dict = ...
235
0
"""simple docstring""" import argparse import fairseq import torch from transformers import UniSpeechSatConfig, UniSpeechSatForCTC, UniSpeechSatForPreTraining, logging logging.set_verbosity_info() _a = logging.get_logger(__name__) _a = { 'post_extract_proj': 'feature_projection.p...
17
from collections import OrderedDict from typing import Mapping from ...configuration_utils import PretrainedConfig from ...onnx import OnnxConfig from ...utils import logging a__ = logging.get_logger(__name__) a__ = { '''junnyu/roformer_chinese_small''': '''https://huggingface.co/junnyu/r...
235
0
import warnings from ...processing_utils import ProcessorMixin from ...tokenization_utils_base import BatchEncoding class lowerCamelCase (__lowercase ): '''simple docstring''' _snake_case : str = ["image_processor", "tokenizer"] _snake_ca...
29
import math from typing import Dict, Iterable, List, Optional, Tuple, Union import numpy as np from ...image_processing_utils import BaseImageProcessor, BatchFeature, get_size_dict from ...image_transforms import normalize, rescale, resize, to_channel_dimension_format from ...image_utils import ( IMAG...
235
0
'''simple docstring''' import argparse import torch from transformers import GPTaConfig, GPTaModel, load_tf_weights_in_gpta from transformers.utils import CONFIG_NAME, WEIGHTS_NAME, logging logging.set_verbosity_info() def a__ ( lowerCAmelCase__ , lowerCAmelCase__ , ...
181
import warnings from ...processing_utils import ProcessorMixin from ...tokenization_utils_base import BatchEncoding class UpperCAmelCase_ ( __lowercase ): """simple docstring""" UpperCAmelCase__ : Union[str, Any] = ["image_processor", "tokenizer"] ...
235
0
import collections import json import math import os import re import time from fnmatch import fnmatch from typing import Dict import requests from slack_sdk import WebClient _a = WebClient(token=os.environ["CI_SLACK_BOT_TOKEN"]) def lowerCAmelCase__(__snake_case ) -> List[Any]: ...
209
import torch from diffusers import DDPMScheduler from .test_schedulers import SchedulerCommonTest class UpperCAmelCase_ ( __lowercase ): """simple docstring""" UpperCAmelCase__ : List[Any] = (DDPMScheduler,) def __lowercase ( sel...
235
0
import unittest from transformers import MraConfig, 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, floats_tensor, ids_tensor, random_attention_mask if is_torch...
330
import operator as op a__ = '''scaler.pt''' a__ = '''pytorch_model''' a__ = '''random_states''' a__ = '''optimizer''' a__ = '''scheduler''' a__ = '''pytorch_model.bin''' a__ = '''pytorch_model.bin.index.json''' a__ = '''model.safetensors''' a__ = '''model.safetensors...
235
0
'''simple docstring''' import logging from transformers import PretrainedConfig A__: List[Any] = logging.getLogger(__name__) A__: Optional[Any] = { '''bertabs-finetuned-cnndm''': '''https://huggingface.co/remi/bertabs-finetuned-cnndm-extractive-ab...
276
from diffusers.utils.testing_utils import require_onnxruntime @require_onnxruntime class UpperCAmelCase_ : """simple docstring""" pass
235
0
from argparse import ArgumentParser from .env import EnvironmentCommand def SCREAMING_SNAKE_CASE__ ( ): snake_case_ : int = ArgumentParser('Diffusers CLI tool' , usage='diffusers-cli <command> [<args>]' ) snake_case_ : str = parser.add_subparsers(h...
327
import unittest from transformers import EsmConfig, is_torch_available from transformers.testing_utils import TestCasePlus, require_torch, slow, torch_device from ...test_configuration_common import ConfigTester from ...test_modeling_common import ModelTesterMixin, ids_tensor, random_attention_mask from .....
235
0
"""simple docstring""" import functools import operator from ...configuration_utils import PretrainedConfig from ...utils import logging _A = logging.get_logger(__name__) _A = { """microsoft/unispeech-large-1500h-cv""": ( """https://huggingface.co/microsoft/unispeech-large-1500h-cv/res...
171
import warnings from ...processing_utils import ProcessorMixin from ...tokenization_utils_base import BatchEncoding class UpperCAmelCase_ ( __lowercase ): """simple docstring""" UpperCAmelCase__ : str = ["image_processor", "tokenizer"] UpperCAm...
235
0
import pandas as pd from matplotlib import pyplot as plt from sklearn.linear_model import LinearRegression # Splitting the dataset into the Training set and Test set from sklearn.model_selection import train_test_split # Fitting Polynomial Regression to the dataset from sklearn.preprocessing imp...
39
from typing import TYPE_CHECKING from ....utils import OptionalDependencyNotAvailable, _LazyModule, is_torch_available a__ = {'''configuration_mmbt''': ['''MMBTConfig''']} try: if not is_torch_available(): raise OptionalDependencyNotAvailable() except OptionalDependencyNotAvailable: p...
235
0
"""simple docstring""" from typing import Optional from torch import nn from .transformer_ad import TransformeraDModel, TransformeraDModelOutput class lowercase_ ( nn.Module ): '''simple docstring''' def __init__( self : Dict , _UpperCAmelCase : Tu...
315
import requests a__ = '''YOUR API KEY''' def __UpperCAmelCase ( __a : str ,__a : str = giphy_api_key ) -> list: """simple docstring""" _a : Optional[Any] = '''+'''.join(query.split() ) _a : Union[str, Any] = F"""https://api.giphy.co...
235
0