code
stringlengths
82
54.1k
code_codestyle
int64
0
699
style_context
stringlengths
111
35.6k
style_context_codestyle
int64
0
699
label
int64
0
1
import unittest from transformers import DebertaVaConfig, is_torch_available from transformers.testing_utils import require_sentencepiece, require_tokenizers, require_torch, slow, torch_device from ...test_configuration_common import ConfigTester from ...test_modeling_common import ModelTesterMixin, ids_tensor ...
100
# 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 app...
612
0
import json import os from typing import Optional, Tuple from ...tokenization_utils import PreTrainedTokenizer from ...utils import logging lowerCAmelCase__ : Tuple =logging.get_logger(__name__) lowerCAmelCase__ : str ={'vocab_file': 'vocab.json'} lowerCAmelCase__ : ...
101
from collections.abc import Sequence def __A(lowerCAmelCase = None ) -> int: """simple docstring""" if nums is None or not nums: raise ValueError("""Input sequence should not be empty""" ) _UpperCamelCase = nums[0] for i in range(1 , len(lowerCAmelCase ) ): _U...
612
0
"""simple docstring""" import os import sys import tempfile import torch from .state import AcceleratorState from .utils import PrecisionType, PrepareForLaunch, is_mps_available, patch_environment def UpperCamelCase (SCREAMING_SNAKE_CASE , SCREAMING_SNAKE_CASE=() ...
102
from __future__ import annotations lowerCamelCase__ = "#" class lowerCAmelCase__ : def __init__( self ) -> None: '''simple docstring''' _UpperCamelCase = {} def A_ ( self , a ) -> None: ''...
612
0
"""simple docstring""" import random from typing import Any def snake_case ( lowerCAmelCase_ ) -> list[Any]: for _ in range(len(lowerCAmelCase_ ) ): _snake_case = random.randint(0 , len(lowerCAmelCase_ ) - 1 ) _snake_case = random.randint(0 ...
103
from abc import ABC, abstractmethod from argparse import ArgumentParser class lowerCAmelCase__ ( __lowercase ): @staticmethod @abstractmethod def A_ ( a ) -> Union[str, Any]: '''simple docstring''' raise NotImplementedError() ...
612
0
"""simple docstring""" # NOTE: This file is deprecated and will be removed in a future version. # It only exists so that temporarely `from diffusers.pipelines import DiffusionPipeline` works from ...utils import deprecate from ..controlnet.multicontrolnet import MultiControlNetModel # noqa: F...
104
import argparse import json import logging import os import shutil import sys import tempfile import unittest from unittest import mock import torch from accelerate.utils import write_basic_config from transformers.testing_utils import TestCasePlus, get_gpu_count, run_command, slow, torch_device from transformers.ut...
612
0
import argparse import torch from transformers import FunnelBaseModel, FunnelConfig, FunnelModel, load_tf_weights_in_funnel from transformers.utils import logging logging.set_verbosity_info() def __UpperCAmelCase ( lowerCamelCase_ : Dict , lowerCamelCase_ : Any , lo...
105
def __A(lowerCAmelCase ) -> bool: """simple docstring""" if not isinstance(lowerCAmelCase , lowerCAmelCase ): raise ValueError("""check_bouncy() accepts only integer arguments""" ) _UpperCamelCase = str(lowerCAmelCase ) _UpperCamelCase = """""".join(sort...
612
0
# Copyright 2021 The HuggingFace Team. All rights reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by appli...
106
import torch from diffusers import KDPMaDiscreteScheduler from diffusers.utils import torch_device from .test_schedulers import SchedulerCommonTest class lowerCAmelCase__ ( __lowercase ): UpperCamelCase_ : int = (KDPMaDiscreteScheduler,) UpperCamelCase_ : Optional[int...
612
0
'''simple docstring''' import faiss # noqa: F401 # Here to have a nice missing dependency error message early on import numpy # noqa: F401 # Here to have a nice missing dependency error message early on import requests # noqa: F401 # Here to have a nice missing dependency error message early on import sklearn ...
107
import datetime import platform import subprocess from typing import Optional, Tuple, Union import numpy as np def __A(lowerCAmelCase , lowerCAmelCase ) -> np.array: """simple docstring""" _UpperCamelCase = F'{sampling_rate}' _UpperCamelCase = """1""" _UpperCam...
612
0
from __future__ import annotations from collections.abc import Iterator class SCREAMING_SNAKE_CASE__ : '''simple docstring''' def __init__( self : Optional[Any] , lowerCamelCase : int ) -> None: """simple docstring""" _UpperCAmelCase = va...
108
import pprint import requests lowerCamelCase__ = "https://zenquotes.io/api" def __A() -> list: """simple docstring""" return requests.get(API_ENDPOINT_URL + """/today""" ).json() def __A() -> list: """simple docstring""" return requests.get(API_ENDPOINT_URL + """...
612
0
'''simple docstring''' import sacrebleu as scb from packaging import version from sacrebleu import CHRF import datasets a = "\\n@inproceedings{popovic-2015-chrf,\n title = \"chr{F}: character n-gram {F}-score for automatic {MT} evaluation\",\n author = \"Popovi{\'c}, Maja\",\n booktitle = \"Pro...
109
from __future__ import annotations def __A(lowerCAmelCase , lowerCAmelCase ) -> list[list[int]]: """simple docstring""" _UpperCamelCase = [] _UpperCamelCase = [] _UpperCamelCase = 0 _UpperCamelCase = sum(lowerCAmelCase ) create_st...
612
0
'''simple docstring''' from typing import TYPE_CHECKING from ...utils import ( OptionalDependencyNotAvailable, _LazyModule, is_flax_available, is_tf_available, is_torch_available, ) __magic_name__ : List[str] ={ 'configuration_vision_encoder_decoder': ['VisionEncoderDecoderConfig', 'Vi...
664
import copy import os from typing import Union from ...configuration_utils import PretrainedConfig from ...utils import logging lowerCamelCase__ = logging.get_logger(__name__) lowerCamelCase__ = { "google/pix2struct-textcaps-base": ( "https://huggingface.co/google/pix2struct-textcaps-ba...
612
0
'''simple docstring''' class __lowercase : def __init__( self , UpperCamelCase ) -> None: __a = len(UpperCamelCase ) __a = [0] * len_array if len_array > 0: __a = array[0] for i in range...
539
import random import unittest from torch.utils.data import BatchSampler, DataLoader, IterableDataset from accelerate import Accelerator from accelerate.data_loader import ( BatchSamplerShard, DataLoaderDispatcher, DataLoaderShard, IterableDatasetShard, SkipBatchSampler, SkipDataLoader, sk...
612
0
'''simple docstring''' from __future__ import annotations from random import random from typing import Generic, TypeVar _lowerCamelCase : Any = TypeVar("KT") _lowerCamelCase : List[Any] = TypeVar("VT") class SCREAMING_SNAKE_CASE ( Generic[KT, VT] ...
430
import unittest import numpy as np import torch from diffusers import PNDMPipeline, PNDMScheduler, UNetaDModel from diffusers.utils.testing_utils import enable_full_determinism, require_torch, slow, torch_device enable_full_determinism() class lowerCAmelCase__ ( unittest.TestCase ): @pr...
612
0
from collections import deque from math import floor from random import random from time import time class __A : '''simple docstring''' def __init__( self ): _lowerCAmelCase : Any = {} def SCREAMING_SNAKE_CASE__ ( self , _snake_case , _snake_case ...
424
import os from typing import BinaryIO, Optional, Union import numpy as np import pyarrow.parquet as pq from .. import Audio, Dataset, Features, Image, NamedSplit, Value, config from ..features.features import FeatureType, _visit from ..formatting import query_table from ..packaged_modules import _PACKAGED_DATASETS_M...
612
0
import json import os from dataclasses import dataclass from functools import partial from typing import Callable import flax.linen as nn import jax import jax.numpy as jnp import joblib import optax import wandb from flax import jax_utils, struct, traverse_util from flax.serialization import from_bytes, to_byt...
385
import argparse import json import os from collections import OrderedDict import numpy as np import tensorflow as tf import torch def __A(lowerCAmelCase ) -> Dict: """simple docstring""" _UpperCamelCase = os.path.join(args.tf_model_dir , """parameters.json""" ) _UpperCamelC...
612
0
'''simple docstring''' import logging import os import sys from dataclasses import dataclass, field from typing import Optional from seqaseq_trainer import SeqaSeqTrainer from seqaseq_training_args import SeqaSeqTrainingArguments import transformers from transformers import ( AutoConfig, AutoModelForSeqaSeqL...
585
import warnings from .generation import TFGenerationMixin class lowerCAmelCase__ ( __lowercase ): # warning at import time warnings.warn( "Importing `TFGenerationMixin` from `src/transformers/generation_tf_utils.py` is deprecated and will " "be removed in Transform...
612
0
def _lowerCAmelCase ( A__ , A__ ): lowercase__ = len(A__ ) lowercase__ = [] for i in range(len(A__ ) - pat_len + 1 ): lowercase__ = True for j in range(A__ ): if s[i + j] != pattern[j]: lowercase__...
622
from typing import TYPE_CHECKING from ...utils import OptionalDependencyNotAvailable, _LazyModule, is_torch_available lowerCamelCase__ = { "configuration_upernet": ["UperNetConfig"], } try: if not is_torch_available(): raise OptionalDependencyNotAvailable() except OptionalDependencyNotAvailable: ...
612
0
"""simple docstring""" from ...configuration_utils import PretrainedConfig from ...utils import logging UpperCamelCase__ :Optional[int] = logging.get_logger(__name__) UpperCamelCase__ :Optional[int] = { """facebook/s2t-small-librispeech-asr""": ( """https://huggingface.co/faceboo...
355
from typing import Dict, List, Optional, Union import numpy as np from ...image_processing_utils import BaseImageProcessor, BatchFeature, get_size_dict from ...image_transforms import ( center_crop, get_resize_output_image_size, normalize, rescale, resize, to_channel_dimension_format, ) from ...
612
0
"""simple docstring""" import importlib import sys from argparse import REMAINDER, ArgumentParser from pathlib import Path import torch_xla.distributed.xla_multiprocessing as xmp def lowerCAmelCase_ ( ) -> Optional[int]: a_ : Dict = ArgumentParser( description=( "...
237
import datasets import faiss import numpy as np import streamlit as st import torch from elasticsearch import Elasticsearch from elia_utils import ( embed_questions_for_retrieval, make_qa_sas_model, qa_sas_generate, query_es_index, query_qa_dense_index, ) import transformers from transformers impo...
612
0
import math def lowerCAmelCase ( UpperCamelCase__ : List[str] , UpperCamelCase__ : str ) -> Union[str, Any]: """simple docstring""" if 0 not in (x, y): # We use the relation x^y = y*log10(x), where 10 is the base. return y * math.logaa...
202
from typing import Dict, List, Optional, Union import numpy as np from ...image_processing_utils import BaseImageProcessor, BatchFeature, get_size_dict from ...image_transforms import center_crop, normalize, rescale, resize, to_channel_dimension_format from ...image_utils import ( IMAGENET_STANDARD_MEAN, IMA...
612
0
"""simple docstring""" from __future__ import annotations _lowerCAmelCase = """#""" class __UpperCamelCase : def __init__( self ): '''simple docstring''' _lowerCAmelCase : Optional[int] = {} def __lowerCamelCase ( self ...
259
from __future__ import annotations from collections.abc import Callable from typing import Generic, TypeVar lowerCamelCase__ = TypeVar("T") lowerCamelCase__ = TypeVar("U") class lowerCAmelCase__ ( Generic[T, U] ): def __init__( self , a , a ) ...
612
0
'''simple docstring''' from typing import List, Optional, Union from ...configuration_utils import PretrainedConfig from ...utils import logging __magic_name__ : Any =logging.get_logger(__name__) __magic_name__ : Union[str, Any] ={ 'huggingface/informer-tourism-monthly': ( 'https://huggingfac...
664
import gc import unittest from parameterized import parameterized from diffusers import FlaxUNetaDConditionModel from diffusers.utils import is_flax_available from diffusers.utils.testing_utils import load_hf_numpy, require_flax, slow if is_flax_available(): import jax import jax.numpy as jnp @slow @req...
612
0
'''simple docstring''' import importlib import json import os from collections import OrderedDict from typing import Dict, Optional, Union # Build the list of all image processors from ...configuration_utils import PretrainedConfig from ...dynamic_module_utils import get_class_from_dynamic_modul...
539
# 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 app...
612
0
'''simple docstring''' from typing import TYPE_CHECKING from ...utils import ( OptionalDependencyNotAvailable, _LazyModule, is_flax_available, is_tf_available, is_torch_available, ) _lowerCamelCase : Any = { "configuration_resnet": ["RESNET_PRETRAINE...
430
from collections.abc import Sequence def __A(lowerCAmelCase = None ) -> int: """simple docstring""" if nums is None or not nums: raise ValueError("""Input sequence should not be empty""" ) _UpperCamelCase = nums[0] for i in range(1 , len(lowerCAmelCase ) ): _U...
612
0
import math def UpperCamelCase_ ( lowerCAmelCase__ ): """simple docstring""" _lowerCAmelCase : Optional[int] = math.loga(math.sqrt(4 * positive_integer + 1 ) / 2 + 1 / 2 ) return exponent == int(lowerCAmelCase__ ) def UpperCamelCase_ ( lowerC...
424
from __future__ import annotations lowerCamelCase__ = "#" class lowerCAmelCase__ : def __init__( self ) -> None: '''simple docstring''' _UpperCamelCase = {} def A_ ( self , a ) -> None: ''...
612
0
import copy import os from typing import Union from ...configuration_utils import PretrainedConfig from ...utils import logging __lowerCamelCase : Tuple = logging.get_logger(__name__) __lowerCamelCase : str = { """microsoft/git-base""": """https://huggingface.co/microsoft/gi...
385
from abc import ABC, abstractmethod from argparse import ArgumentParser class lowerCAmelCase__ ( __lowercase ): @staticmethod @abstractmethod def A_ ( a ) -> Union[str, Any]: '''simple docstring''' raise NotImplementedError() ...
612
0
'''simple docstring''' import numpy # List of input, output pairs __lowerCAmelCase = ( ((5, 2, 3), 15), ((6, 5, 9), 25), ((11, 12, 13), 41), ((1, 1, 1), 8), ((11, 12, 13), 41), ) __lowerCAmelCase = (((515, 22, 13), 555), ((61, 35, 49), 150)) __lowerCAmelCase = [2, 4, 1, 5] __lowe...
585
import argparse import json import logging import os import shutil import sys import tempfile import unittest from unittest import mock import torch from accelerate.utils import write_basic_config from transformers.testing_utils import TestCasePlus, get_gpu_count, run_command, slow, torch_device from transformers.ut...
612
0
def _lowerCAmelCase ( A__ , A__ ): lowercase__ = int(A__ ) # Initialize Result lowercase__ = [] # Traverse through all denomination for denomination in reversed(A__ ): # Find denominations while int(A__ ) >= int(A__ ): ...
622
def __A(lowerCAmelCase ) -> bool: """simple docstring""" if not isinstance(lowerCAmelCase , lowerCAmelCase ): raise ValueError("""check_bouncy() accepts only integer arguments""" ) _UpperCamelCase = str(lowerCAmelCase ) _UpperCamelCase = """""".join(sort...
612
0
"""simple docstring""" import numpy as np from numpy import ndarray from scipy.optimize import Bounds, LinearConstraint, minimize def A_ ( snake_case__ ) -> float: return np.dot(snake_case__ , snake_case__ ) class A: """simple docstring""" def __init__( s...
355
import torch from diffusers import KDPMaDiscreteScheduler from diffusers.utils import torch_device from .test_schedulers import SchedulerCommonTest class lowerCAmelCase__ ( __lowercase ): UpperCamelCase_ : int = (KDPMaDiscreteScheduler,) UpperCamelCase_ : Optional[int...
612
0
"""simple docstring""" from __future__ import annotations def lowerCAmelCase_ ( SCREAMING_SNAKE_CASE__ ) -> int: if not nums: return 0 a_ : Any = nums[0] a_ : Optional[int] = 0 for num in nums[1:]: a_ , a_ : Optional[int] = ( ...
237
import datetime import platform import subprocess from typing import Optional, Tuple, Union import numpy as np def __A(lowerCAmelCase , lowerCAmelCase ) -> np.array: """simple docstring""" _UpperCamelCase = F'{sampling_rate}' _UpperCamelCase = """1""" _UpperCam...
612
0
import os def lowerCAmelCase ( UpperCamelCase__ : Optional[Any] ) -> Optional[Any]: """simple docstring""" __SCREAMING_SNAKE_CASE: Any = len(grid[0] ) __SCREAMING_SNAKE_CASE: Any = len(UpperCamelCase__ ) __SCREAMING_SNAK...
202
import pprint import requests lowerCamelCase__ = "https://zenquotes.io/api" def __A() -> list: """simple docstring""" return requests.get(API_ENDPOINT_URL + """/today""" ).json() def __A() -> list: """simple docstring""" return requests.get(API_ENDPOINT_URL + """...
612
0
"""simple docstring""" import copy from ...configuration_utils import PretrainedConfig from ...utils import logging from ..auto.configuration_auto import CONFIG_MAPPING _lowerCAmelCase = logging.get_logger(__name__) class __UpperCamelCase ( __lowercas...
259
from __future__ import annotations def __A(lowerCAmelCase , lowerCAmelCase ) -> list[list[int]]: """simple docstring""" _UpperCamelCase = [] _UpperCamelCase = [] _UpperCamelCase = 0 _UpperCamelCase = sum(lowerCAmelCase ) create_st...
612
0
'''simple docstring''' __magic_name__ : Optional[int] =6_55_21 def __snake_case ( lowerCamelCase_ : Optional[Any] ): '''simple docstring''' __magic_name__ = 1 __magic_name__ = 0 for plain_chr in plain_text: __magic_name__ = (a + ord(l...
664
import copy import os from typing import Union from ...configuration_utils import PretrainedConfig from ...utils import logging lowerCamelCase__ = logging.get_logger(__name__) lowerCamelCase__ = { "google/pix2struct-textcaps-base": ( "https://huggingface.co/google/pix2struct-textcaps-ba...
612
0
'''simple docstring''' from ...configuration_utils import PretrainedConfig from ...utils import logging UpperCAmelCase_ = logging.get_logger(__name__) UpperCAmelCase_ = { "tanreinama/GPTSAN-2.8B-spout_is_uniform": ( "https://huggingface.co/tanreinama/GPTSAN-2.8B-spout_i...
539
import random import unittest from torch.utils.data import BatchSampler, DataLoader, IterableDataset from accelerate import Accelerator from accelerate.data_loader import ( BatchSamplerShard, DataLoaderDispatcher, DataLoaderShard, IterableDatasetShard, SkipBatchSampler, SkipDataLoader, sk...
612
0
'''simple docstring''' import json import os import subprocess import unittest from ast import literal_eval import pytest from parameterized import parameterized_class from . import is_sagemaker_available if is_sagemaker_available(): from sagemaker import Session, TrainingJobAnalytics ...
430
import unittest import numpy as np import torch from diffusers import PNDMPipeline, PNDMScheduler, UNetaDModel from diffusers.utils.testing_utils import enable_full_determinism, require_torch, slow, torch_device enable_full_determinism() class lowerCAmelCase__ ( unittest.TestCase ): @pr...
612
0
from typing import TYPE_CHECKING from ...utils import OptionalDependencyNotAvailable, _LazyModule, is_speech_available, is_torch_available snake_case = { "configuration_audio_spectrogram_transformer": [ "AUDIO_SPECTROGRAM_TRANSFORMER_PRETRAINED_CONFIG_ARCHIVE_MAP", "ASTConfig", ] } t...
424
import os from typing import BinaryIO, Optional, Union import numpy as np import pyarrow.parquet as pq from .. import Audio, Dataset, Features, Image, NamedSplit, Value, config from ..features.features import FeatureType, _visit from ..formatting import query_table from ..packaged_modules import _PACKAGED_DATASETS_M...
612
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 ...
385
import argparse import json import os from collections import OrderedDict import numpy as np import tensorflow as tf import torch def __A(lowerCAmelCase ) -> Dict: """simple docstring""" _UpperCamelCase = os.path.join(args.tf_model_dir , """parameters.json""" ) _UpperCamelC...
612
0
'''simple docstring''' import json import os import torch from diffusers import UNetaDModel os.makedirs('hub/hopper-medium-v2/unet/hor32', exist_ok=True) os.makedirs('hub/hopper-medium-v2/unet/hor128', exist_ok=True) os.makedirs('hub/hopper-medium-v2/value_function', exist_ok=True) def __SCREAMING_SNAKE_...
585
import warnings from .generation import TFGenerationMixin class lowerCAmelCase__ ( __lowercase ): # warning at import time warnings.warn( "Importing `TFGenerationMixin` from `src/transformers/generation_tf_utils.py` is deprecated and will " "be removed in Transform...
612
0
import os from shutil import copyfile from typing import List, Optional, Tuple from ...tokenization_utils import AddedToken from ...tokenization_utils_fast import PreTrainedTokenizerFast from ...utils import is_sentencepiece_available, logging if is_sentencepiece_available(): from .tokenization_big_bird i...
622
from typing import TYPE_CHECKING from ...utils import OptionalDependencyNotAvailable, _LazyModule, is_torch_available lowerCamelCase__ = { "configuration_upernet": ["UperNetConfig"], } try: if not is_torch_available(): raise OptionalDependencyNotAvailable() except OptionalDependencyNotAvailable: ...
612
0
"""simple docstring""" import os import time from dataclasses import dataclass, field from enum import Enum from typing import Dict, List, Optional, Union import torch from filelock import FileLock from torch.utils.data import Dataset from ...models.auto.modeling_auto import MODEL_FOR_QUESTION_ANSWERING_MAPP...
355
from typing import Dict, List, Optional, Union import numpy as np from ...image_processing_utils import BaseImageProcessor, BatchFeature, get_size_dict from ...image_transforms import ( center_crop, get_resize_output_image_size, normalize, rescale, resize, to_channel_dimension_format, ) from ...
612
0
"""simple docstring""" import argparse import os import torch from transformers import ( XLNetConfig, XLNetForQuestionAnswering, XLNetForSequenceClassification, XLNetLMHeadModel, load_tf_weights_in_xlnet, ) from transformers.utils import CONFIG_NAME, WEIGHTS_NAME, logging SCREAMING_SNAKE_CAS...
237
import datasets import faiss import numpy as np import streamlit as st import torch from elasticsearch import Elasticsearch from elia_utils import ( embed_questions_for_retrieval, make_qa_sas_model, qa_sas_generate, query_es_index, query_qa_dense_index, ) import transformers from transformers impo...
612
0
def lowerCAmelCase ( UpperCamelCase__ : str ) -> list: """simple docstring""" __SCREAMING_SNAKE_CASE: Dict = int(UpperCamelCase__ ) if n_element < 1: __SCREAMING_SNAKE_CASE: Any = ValueError('''a should be a positive number''...
202
from typing import Dict, List, Optional, Union import numpy as np from ...image_processing_utils import BaseImageProcessor, BatchFeature, get_size_dict from ...image_transforms import center_crop, normalize, rescale, resize, to_channel_dimension_format from ...image_utils import ( IMAGENET_STANDARD_MEAN, IMA...
612
0
"""simple docstring""" import logging import os import threading import time try: import warnings except ImportError: _lowerCAmelCase = None try: import msvcrt except ImportError: _lowerCAmelCase = None try: import fcntl except ImportError: _lowerC...
259
from __future__ import annotations from collections.abc import Callable from typing import Generic, TypeVar lowerCamelCase__ = TypeVar("T") lowerCamelCase__ = TypeVar("U") class lowerCAmelCase__ ( Generic[T, U] ): def __init__( self , a , a ) ...
612
0
'''simple docstring''' import inspect import re from transformers.utils import direct_transformers_import # All paths are set with the intent you should run this script from the root of the repo with the command # python utils/check_config_docstrings.py __magic_name__ : List[str] ='src/transformers' # This ...
664
import gc import unittest from parameterized import parameterized from diffusers import FlaxUNetaDConditionModel from diffusers.utils import is_flax_available from diffusers.utils.testing_utils import load_hf_numpy, require_flax, slow if is_flax_available(): import jax import jax.numpy as jnp @slow @req...
612
0
'''simple docstring''' from ..utils import DummyObject, requires_backends class __lowercase ( metaclass=__lowercase ): _a = ["onnx"] def __init__( self , *UpperCamelCase , **UpperCamelCase ) -> List[str]: requires_backends(s...
539
# 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 app...
612
0
'''simple docstring''' # Copyright 2021 The HuggingFace Team. All rights reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LI...
430
from collections.abc import Sequence def __A(lowerCAmelCase = None ) -> int: """simple docstring""" if nums is None or not nums: raise ValueError("""Input sequence should not be empty""" ) _UpperCamelCase = nums[0] for i in range(1 , len(lowerCAmelCase ) ): _U...
612
0
from __future__ import annotations def UpperCamelCase_ ( lowerCAmelCase__ ): """simple docstring""" return [ord(lowerCAmelCase__ ) - 96 for elem in plain] def UpperCamelCase_ ( lowerCAmelCase__ ): """simple docstring""" return "".join(chr(elem + 9...
424
from __future__ import annotations lowerCamelCase__ = "#" class lowerCAmelCase__ : def __init__( self ) -> None: '''simple docstring''' _UpperCamelCase = {} def A_ ( self , a ) -> None: ''...
612
0
import argparse import json import logging import os import shutil import sys import tempfile import unittest from unittest import mock import torch from accelerate.utils import write_basic_config from transformers.testing_utils import TestCasePlus, get_gpu_count, run_command, slow, torch_device from transform...
385
from abc import ABC, abstractmethod from argparse import ArgumentParser class lowerCAmelCase__ ( __lowercase ): @staticmethod @abstractmethod def A_ ( a ) -> Union[str, Any]: '''simple docstring''' raise NotImplementedError() ...
612
0
'''simple docstring''' def __SCREAMING_SNAKE_CASE ( _SCREAMING_SNAKE_CASE ): _snake_case = len(_SCREAMING_SNAKE_CASE ) _snake_case = sum(_SCREAMING_SNAKE_CASE ) _snake_case = [[False for x in range(s + 1 )] for y in range(n + 1 )] for i in range(1 , n + 1 ): ...
585
import argparse import json import logging import os import shutil import sys import tempfile import unittest from unittest import mock import torch from accelerate.utils import write_basic_config from transformers.testing_utils import TestCasePlus, get_gpu_count, run_command, slow, torch_device from transformers.ut...
612
0
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 TokenizerTesterMixin a__ : Opt...
622
def __A(lowerCAmelCase ) -> bool: """simple docstring""" if not isinstance(lowerCAmelCase , lowerCAmelCase ): raise ValueError("""check_bouncy() accepts only integer arguments""" ) _UpperCamelCase = str(lowerCAmelCase ) _UpperCamelCase = """""".join(sort...
612
0
"""simple docstring""" from typing import Optional, Tuple, Union import flax import flax.linen as nn import jax import jax.numpy as jnp from flax.core.frozen_dict import FrozenDict from ..configuration_utils import ConfigMixin, flax_register_to_config from ..utils import BaseOutput from .embeddings_flax impo...
355
import torch from diffusers import KDPMaDiscreteScheduler from diffusers.utils import torch_device from .test_schedulers import SchedulerCommonTest class lowerCAmelCase__ ( __lowercase ): UpperCamelCase_ : int = (KDPMaDiscreteScheduler,) UpperCamelCase_ : Optional[int...
612
0
"""simple docstring""" from __future__ import annotations import unittest from transformers import AutoTokenizer, MBartConfig, is_tf_available from transformers.testing_utils import require_sentencepiece, require_tf, require_tokenizers, slow from transformers.utils import cached_property from ...test_configurati...
237
import datetime import platform import subprocess from typing import Optional, Tuple, Union import numpy as np def __A(lowerCAmelCase , lowerCAmelCase ) -> np.array: """simple docstring""" _UpperCamelCase = F'{sampling_rate}' _UpperCamelCase = """1""" _UpperCam...
612
0
import html from ...feature_extraction_utils import BatchFeature, FeatureExtractionMixin from ...utils import is_bsa_available, logging, requires_backends if is_bsa_available(): import bsa from bsa import BeautifulSoup lowerCAmelCase : List[str] = logging.get_logger(__name__) ...
202
import pprint import requests lowerCamelCase__ = "https://zenquotes.io/api" def __A() -> list: """simple docstring""" return requests.get(API_ENDPOINT_URL + """/today""" ).json() def __A() -> list: """simple docstring""" return requests.get(API_ENDPOINT_URL + """...
612
0
"""simple docstring""" import unittest import numpy as np import torch from diffusers import PNDMPipeline, PNDMScheduler, UNetaDModel from diffusers.utils.testing_utils import enable_full_determinism, require_torch, slow, torch_device enable_full_determinism() class __...
259
from __future__ import annotations def __A(lowerCAmelCase , lowerCAmelCase ) -> list[list[int]]: """simple docstring""" _UpperCamelCase = [] _UpperCamelCase = [] _UpperCamelCase = 0 _UpperCamelCase = sum(lowerCAmelCase ) create_st...
612
0
'''simple docstring''' def __snake_case ( lowerCamelCase_ : List[Any] , lowerCamelCase_ : List[Any] ): '''simple docstring''' if density <= 0: raise ValueError("Impossible fluid density" ) if bulk_modulus <= 0: raise ValueError("Impossible bulk mod...
664
import copy import os from typing import Union from ...configuration_utils import PretrainedConfig from ...utils import logging lowerCamelCase__ = logging.get_logger(__name__) lowerCamelCase__ = { "google/pix2struct-textcaps-base": ( "https://huggingface.co/google/pix2struct-textcaps-ba...
612
0
'''simple docstring''' import gc import random import unittest import numpy as np import torch from transformers import CLIPImageProcessor, CLIPVisionConfig, CLIPVisionModel from diffusers import HeunDiscreteScheduler, PriorTransformer, ShapEImgaImgPipeline from diffusers.pipelines.shap_e impo...
539
import random import unittest from torch.utils.data import BatchSampler, DataLoader, IterableDataset from accelerate import Accelerator from accelerate.data_loader import ( BatchSamplerShard, DataLoaderDispatcher, DataLoaderShard, IterableDatasetShard, SkipBatchSampler, SkipDataLoader, sk...
612
0
'''simple docstring''' import os import tempfile import unittest from pathlib import Path from transformers import AutoConfig, is_tf_available from transformers.testing_utils import require_tf if is_tf_available(): import tensorflow as tf from transformers import TensorFlowBenchmark, ...
430
import unittest import numpy as np import torch from diffusers import PNDMPipeline, PNDMScheduler, UNetaDModel from diffusers.utils.testing_utils import enable_full_determinism, require_torch, slow, torch_device enable_full_determinism() class lowerCAmelCase__ ( unittest.TestCase ): @pr...
612
0
from collections import OrderedDict from typing import Mapping from ...configuration_utils import PretrainedConfig from ...onnx import OnnxConfig from ...utils import logging snake_case = logging.get_logger(__name__) snake_case = { "kssteven/ibert-roberta-base": "https://huggingface.co/kssteven/...
424
import os from typing import BinaryIO, Optional, Union import numpy as np import pyarrow.parquet as pq from .. import Audio, Dataset, Features, Image, NamedSplit, Value, config from ..features.features import FeatureType, _visit from ..formatting import query_table from ..packaged_modules import _PACKAGED_DATASETS_M...
612
0
from ...configuration_utils import PretrainedConfig __lowerCamelCase : str = { """google/tapas-base-finetuned-sqa""": ( """https://huggingface.co/google/tapas-base-finetuned-sqa/resolve/main/config.json""" ), """google/tapas-base-finetuned-wtq""": ( """https://hugging...
385
import argparse import json import os from collections import OrderedDict import numpy as np import tensorflow as tf import torch def __A(lowerCAmelCase ) -> Dict: """simple docstring""" _UpperCamelCase = os.path.join(args.tf_model_dir , """parameters.json""" ) _UpperCamelC...
612
0
'''simple docstring''' import unittest from transformers import SPIECE_UNDERLINE, ReformerTokenizer, ReformerTokenizerFast from transformers.testing_utils import get_tests_dir, require_sentencepiece, require_tokenizers, require_torch, slow from transformers.utils import cached_property from ...test_tokenization_comm...
585
import warnings from .generation import TFGenerationMixin class lowerCAmelCase__ ( __lowercase ): # warning at import time warnings.warn( "Importing `TFGenerationMixin` from `src/transformers/generation_tf_utils.py` is deprecated and will " "be removed in Transform...
612
0
import unittest from transformers import XLMConfig, 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 ModelTesterMixin, ids...
622
from typing import TYPE_CHECKING from ...utils import OptionalDependencyNotAvailable, _LazyModule, is_torch_available lowerCamelCase__ = { "configuration_upernet": ["UperNetConfig"], } try: if not is_torch_available(): raise OptionalDependencyNotAvailable() except OptionalDependencyNotAvailable: ...
612
0
"""simple docstring""" import re import string from collections import Counter import sacrebleu import sacremoses from packaging import version import datasets UpperCamelCase__ :Dict = """\n@inproceedings{xu-etal-2016-optimizing,\n title = {Optimizing Statistical Machine Translation for Text Sim...
355
from typing import Dict, List, Optional, Union import numpy as np from ...image_processing_utils import BaseImageProcessor, BatchFeature, get_size_dict from ...image_transforms import ( center_crop, get_resize_output_image_size, normalize, rescale, resize, to_channel_dimension_format, ) from ...
612
0
"""simple docstring""" from math import pow, sqrt def lowerCAmelCase_ ( *SCREAMING_SNAKE_CASE__ ) -> bool: a_ : Union[str, Any] = len(SCREAMING_SNAKE_CASE__ ) > 0 and all(value > 0.0 for value in values ) return result def lowerCAmelCase_ ( SCREAMI...
237
import datasets import faiss import numpy as np import streamlit as st import torch from elasticsearch import Elasticsearch from elia_utils import ( embed_questions_for_retrieval, make_qa_sas_model, qa_sas_generate, query_es_index, query_qa_dense_index, ) import transformers from transformers impo...
612
0
import os from shutil import copyfile from typing import List, Optional, Tuple from ...tokenization_utils import AddedToken from ...tokenization_utils_fast import PreTrainedTokenizerFast from ...utils import is_sentencepiece_available, logging if is_sentencepiece_available(): from .tokenization_fnet imp...
202
from typing import Dict, List, Optional, Union import numpy as np from ...image_processing_utils import BaseImageProcessor, BatchFeature, get_size_dict from ...image_transforms import center_crop, normalize, rescale, resize, to_channel_dimension_format from ...image_utils import ( IMAGENET_STANDARD_MEAN, IMA...
612
0
"""simple docstring""" from typing import TYPE_CHECKING from ...utils import ( OptionalDependencyNotAvailable, _LazyModule, is_sentencepiece_available, is_tokenizers_available, is_torch_available, ) _lowerCAmelCase = {"""configuration_fnet""": ["""FNET_PRE...
259
from __future__ import annotations from collections.abc import Callable from typing import Generic, TypeVar lowerCamelCase__ = TypeVar("T") lowerCamelCase__ = TypeVar("U") class lowerCAmelCase__ ( Generic[T, U] ): def __init__( self , a , a ) ...
612
0
'''simple docstring''' import argparse from pathlib import Path import requests import torch from PIL import Image from transformers import ( RobertaTokenizer, TrOCRConfig, TrOCRForCausalLM, TrOCRProcessor, VisionEncoderDecoderModel, ViTConfig, ViTImageProcessor, ViTModel, ) from tr...
664
import gc import unittest from parameterized import parameterized from diffusers import FlaxUNetaDConditionModel from diffusers.utils import is_flax_available from diffusers.utils.testing_utils import load_hf_numpy, require_flax, slow if is_flax_available(): import jax import jax.numpy as jnp @slow @req...
612
0
'''simple docstring''' import json from typing import List, Optional, Tuple from tokenizers import pre_tokenizers, processors from ...tokenization_utils_base import AddedToken, BatchEncoding from ...tokenization_utils_fast import PreTrainedTokenizerFast from ...utils import logging from .tokeni...
539
# 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 app...
612
0
'''simple docstring''' from __future__ import annotations from typing import Dict from ...configuration_utils import PretrainedConfig _lowerCamelCase : List[Any] = { "susnato/ernie-m-base_pytorch": "https://huggingface.co/susnato/ernie-m-base_pytorch/blob/main/config.json"...
430
from collections.abc import Sequence def __A(lowerCAmelCase = None ) -> int: """simple docstring""" if nums is None or not nums: raise ValueError("""Input sequence should not be empty""" ) _UpperCamelCase = nums[0] for i in range(1 , len(lowerCAmelCase ) ): _U...
612
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 snake_case = logging.get_logger(__name__) snake_case = { "google/mobilenet_v2_1.4_224": "h...
424
from __future__ import annotations lowerCamelCase__ = "#" class lowerCAmelCase__ : def __init__( self ) -> None: '''simple docstring''' _UpperCamelCase = {} def A_ ( self , a ) -> None: ''...
612
0
import unittest import numpy as np from transformers.testing_utils import require_pytesseract, require_torch from transformers.utils import is_pytesseract_available, is_torch_available from ...test_image_processing_common import ImageProcessingSavingTestMixin, prepare_image_inputs if is_torch_available(): ...
385
from abc import ABC, abstractmethod from argparse import ArgumentParser class lowerCAmelCase__ ( __lowercase ): @staticmethod @abstractmethod def A_ ( a ) -> Union[str, Any]: '''simple docstring''' raise NotImplementedError() ...
612
0
'''simple docstring''' import tempfile import torch from diffusers import PNDMScheduler from .test_schedulers import SchedulerCommonTest class _lowerCAmelCase ( __lowercase ): '''simple docstring''' lowerCAmelCase_ = (PNDMScheduler,) lowerCAmelCase_ = (("num...
585
import argparse import json import logging import os import shutil import sys import tempfile import unittest from unittest import mock import torch from accelerate.utils import write_basic_config from transformers.testing_utils import TestCasePlus, get_gpu_count, run_command, slow, torch_device from transformers.ut...
612
0
from typing import Callable, List, Optional, Tuple, Union import torch from transformers import CLIPTextModel, CLIPTokenizer from ...configuration_utils import ConfigMixin, register_to_config from ...models import ModelMixin, TransformeraDModel, VQModel from ...schedulers import VQDiffusionScheduler from ...utils...
622
def __A(lowerCAmelCase ) -> bool: """simple docstring""" if not isinstance(lowerCAmelCase , lowerCAmelCase ): raise ValueError("""check_bouncy() accepts only integer arguments""" ) _UpperCamelCase = str(lowerCAmelCase ) _UpperCamelCase = """""".join(sort...
612
0
"""simple docstring""" from __future__ import annotations from collections.abc import Callable from typing import Generic, TypeVar UpperCamelCase__ :List[str] = TypeVar("""T""") UpperCamelCase__ :Union[str, Any] = TypeVar("""U""") class A( Generic[T, U] ): """simple docstring"...
355
import torch from diffusers import KDPMaDiscreteScheduler from diffusers.utils import torch_device from .test_schedulers import SchedulerCommonTest class lowerCAmelCase__ ( __lowercase ): UpperCamelCase_ : int = (KDPMaDiscreteScheduler,) UpperCamelCase_ : Optional[int...
612
0
"""simple docstring""" import fire from utils import calculate_rouge, save_json def lowerCAmelCase_ ( SCREAMING_SNAKE_CASE__, SCREAMING_SNAKE_CASE__, SCREAMING_SNAKE_CASE__=None, **SCREAMING_SNAKE_CASE__ ) -> Any: a_ : Any = [x.strip() for x in open(SCREAMING_SNAKE_CAS...
237
import datetime import platform import subprocess from typing import Optional, Tuple, Union import numpy as np def __A(lowerCAmelCase , lowerCAmelCase ) -> np.array: """simple docstring""" _UpperCamelCase = F'{sampling_rate}' _UpperCamelCase = """1""" _UpperCam...
612
0
lowerCAmelCase : Dict = """Alexander Joslin""" import operator as op from .stack import Stack def lowerCAmelCase ( UpperCamelCase__ : str ) -> int: """simple docstring""" __SCREAMING_SNAKE_CASE: List[str] = {'''*''': op.mul, '''/''': op....
202
import pprint import requests lowerCamelCase__ = "https://zenquotes.io/api" def __A() -> list: """simple docstring""" return requests.get(API_ENDPOINT_URL + """/today""" ).json() def __A() -> list: """simple docstring""" return requests.get(API_ENDPOINT_URL + """...
612
0
"""simple docstring""" from __future__ import annotations def lowerCamelCase__ ( _lowerCamelCase , _lowerCamelCase ): '''simple docstring''' _lowerCAmelCase : int = get_failure_array(_lowerCamelCase ) # 2) Step through text searching for pattern _lo...
259
from __future__ import annotations def __A(lowerCAmelCase , lowerCAmelCase ) -> list[list[int]]: """simple docstring""" _UpperCamelCase = [] _UpperCamelCase = [] _UpperCamelCase = 0 _UpperCamelCase = sum(lowerCAmelCase ) create_st...
612
0
'''simple docstring''' import argparse import os import evaluate import torch from datasets import load_dataset from torch.optim import AdamW from torch.utils.data import DataLoader from transformers import AutoModelForSequenceClassification, AutoTokenizer, get_linear_schedule_with_warmup, set_seed from accelerate...
664
import copy import os from typing import Union from ...configuration_utils import PretrainedConfig from ...utils import logging lowerCamelCase__ = logging.get_logger(__name__) lowerCamelCase__ = { "google/pix2struct-textcaps-base": ( "https://huggingface.co/google/pix2struct-textcaps-ba...
612
0
'''simple docstring''' import inspect from typing import Optional, Union import numpy as np import PIL import torch from torch.nn import functional as F from torchvision import transforms from transformers import CLIPFeatureExtractor, CLIPModel, CLIPTextModel, CLIPTokenizer from diffusers imp...
539
import random import unittest from torch.utils.data import BatchSampler, DataLoader, IterableDataset from accelerate import Accelerator from accelerate.data_loader import ( BatchSamplerShard, DataLoaderDispatcher, DataLoaderShard, IterableDatasetShard, SkipBatchSampler, SkipDataLoader, sk...
612
0
'''simple docstring''' import math def __lowerCamelCase ( A__ ) -> list: """simple docstring""" UpperCamelCase = [True] * n UpperCamelCase = False UpperCamelCase = False UpperCamelCase ...
430
import unittest import numpy as np import torch from diffusers import PNDMPipeline, PNDMScheduler, UNetaDModel from diffusers.utils.testing_utils import enable_full_determinism, require_torch, slow, torch_device enable_full_determinism() class lowerCAmelCase__ ( unittest.TestCase ): @pr...
612
0
import os import socket from contextlib import contextmanager import torch from ..commands.config.default import write_basic_config # noqa: F401 from ..state import PartialState from .dataclasses import DistributedType from .imports import is_deepspeed_available, is_tpu_available from .transformer_engine import conv...
424
import os from typing import BinaryIO, Optional, Union import numpy as np import pyarrow.parquet as pq from .. import Audio, Dataset, Features, Image, NamedSplit, Value, config from ..features.features import FeatureType, _visit from ..formatting import query_table from ..packaged_modules import _PACKAGED_DATASETS_M...
612
0
import os from collections.abc import Iterator def A__ ( _a : Optional[int] = "." ): '''simple docstring''' for dir_path, dir_names, filenames in os.walk(_a ): snake_case__ : Any =[d for d in dir_names if d != """scripts""" and d[0] not in """._"""]...
385
import argparse import json import os from collections import OrderedDict import numpy as np import tensorflow as tf import torch def __A(lowerCAmelCase ) -> Dict: """simple docstring""" _UpperCamelCase = os.path.join(args.tf_model_dir , """parameters.json""" ) _UpperCamelC...
612
0
'''simple docstring''' from typing import TYPE_CHECKING from ...utils import ( OptionalDependencyNotAvailable, _LazyModule, is_flax_available, is_sentencepiece_available, is_tf_available, is_tokenizers_available, is_torch_available, ) __lowerCAmelCase = {'configuration_mbart': ['MB...
585
import warnings from .generation import TFGenerationMixin class lowerCAmelCase__ ( __lowercase ): # warning at import time warnings.warn( "Importing `TFGenerationMixin` from `src/transformers/generation_tf_utils.py` is deprecated and will " "be removed in Transform...
612
0
import copy import os from typing import Union from ...configuration_utils import PretrainedConfig from ...utils import logging a__ : Optional[Any] = logging.get_logger(__name__) a__ : str = { "google/pix2struct-textcaps-base": ( "https://huggingface.co/google/pix2s...
622
from typing import TYPE_CHECKING from ...utils import OptionalDependencyNotAvailable, _LazyModule, is_torch_available lowerCamelCase__ = { "configuration_upernet": ["UperNetConfig"], } try: if not is_torch_available(): raise OptionalDependencyNotAvailable() except OptionalDependencyNotAvailable: ...
612
0
"""simple docstring""" from ...configuration_utils import PretrainedConfig from ...utils import logging UpperCamelCase__ :Optional[Any] = logging.get_logger(__name__) UpperCamelCase__ :Union[str, Any] = { """google/canine-s""": """https://huggingface.co/google/canine-s/resolve/main/confi...
355
from typing import Dict, List, Optional, Union import numpy as np from ...image_processing_utils import BaseImageProcessor, BatchFeature, get_size_dict from ...image_transforms import ( center_crop, get_resize_output_image_size, normalize, rescale, resize, to_channel_dimension_format, ) from ...
612
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, DPMSolverMultistepI...
237
import datasets import faiss import numpy as np import streamlit as st import torch from elasticsearch import Elasticsearch from elia_utils import ( embed_questions_for_retrieval, make_qa_sas_model, qa_sas_generate, query_es_index, query_qa_dense_index, ) import transformers from transformers impo...
612
0
import os from typing import Optional import fsspec from fsspec.archive import AbstractArchiveFileSystem from fsspec.utils import DEFAULT_BLOCK_SIZE class a ( __lowercase ): SCREAMING_SNAKE_CASE__ : Dict = "" SCREAMING_SNAKE_CASE__ : str = ( Non...
202
from typing import Dict, List, Optional, Union import numpy as np from ...image_processing_utils import BaseImageProcessor, BatchFeature, get_size_dict from ...image_transforms import center_crop, normalize, rescale, resize, to_channel_dimension_format from ...image_utils import ( IMAGENET_STANDARD_MEAN, IMA...
612
0
"""simple docstring""" from typing import Dict, List, Optional, Union import numpy as np from ...image_processing_utils import BaseImageProcessor, BatchFeature, get_size_dict from ...image_transforms import center_crop, normalize, rescale, resize, to_channel_dimension_format from ...image_utils...
259
from __future__ import annotations from collections.abc import Callable from typing import Generic, TypeVar lowerCamelCase__ = TypeVar("T") lowerCamelCase__ = TypeVar("U") class lowerCAmelCase__ ( Generic[T, U] ): def __init__( self , a , a ) ...
612
0
'''simple docstring''' __magic_name__ : List[Any] ='Input must be a string of 8 numbers plus letter' __magic_name__ : Dict ='TRWAGMYFPDXBNJZSQVHLCKE' def __snake_case ( lowerCamelCase_ : Any ): '''simple docstring''' if not isinstance(lowerCamelCase_ , lowerCamelCa...
664
import gc import unittest from parameterized import parameterized from diffusers import FlaxUNetaDConditionModel from diffusers.utils import is_flax_available from diffusers.utils.testing_utils import load_hf_numpy, require_flax, slow if is_flax_available(): import jax import jax.numpy as jnp @slow @req...
612
0
'''simple docstring''' import argparse import json from pathlib import Path import requests import timm import torch from huggingface_hub import hf_hub_download from PIL import Image from transformers import DeiTConfig, DeiTForImageClassificationWithTeacher, DeiTImageProcessor from transform...
539
# 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 app...
612
0
'''simple docstring''' def __lowerCamelCase ( ) -> Tuple: """simple docstring""" UpperCamelCase = 0 for i in range(1 , 1_001 ): total += i**i return str(A__ )[-10:] if __name__ == "__main__": print(solution()...
430
from collections.abc import Sequence def __A(lowerCAmelCase = None ) -> int: """simple docstring""" if nums is None or not nums: raise ValueError("""Input sequence should not be empty""" ) _UpperCamelCase = nums[0] for i in range(1 , len(lowerCAmelCase ) ): _U...
612
0
from __future__ import annotations import requests snake_case = set( "approved_at_utc approved_by author_flair_background_color\nauthor_flair_css_class author_flair_richtext author_flair_template_id author_fullname\nauthor_premium can_mod_post category clicked content_categories created_utc downs\nedited ...
424
from __future__ import annotations lowerCamelCase__ = "#" class lowerCAmelCase__ : def __init__( self ) -> None: '''simple docstring''' _UpperCamelCase = {} def A_ ( self , a ) -> None: ''...
612
0
from PIL import Image def A__ ( _a : Tuple , _a : Optional[Any] ): '''simple docstring''' snake_case__ : List[str] =(259 * (level + 255)) / (255 * (259 - level)) def contrast(_a : int ) -> int: return int(128 + factor * (c - 128) ...
385
from abc import ABC, abstractmethod from argparse import ArgumentParser class lowerCAmelCase__ ( __lowercase ): @staticmethod @abstractmethod def A_ ( a ) -> Union[str, Any]: '''simple docstring''' raise NotImplementedError() ...
612
0
'''simple docstring''' from copy import deepcopy from typing import Optional, Union import numpy as np from ...processing_utils import ProcessorMixin from ...tokenization_utils_base import BatchEncoding from ...utils import TensorType, is_tf_available, is_torch_available if is_torch_available(): import torch ...
585
import argparse import json import logging import os import shutil import sys import tempfile import unittest from unittest import mock import torch from accelerate.utils import write_basic_config from transformers.testing_utils import TestCasePlus, get_gpu_count, run_command, slow, torch_device from transformers.ut...
612
0
import copy import os import tempfile from unittest import TestCase from unittest.mock import patch import numpy as np import pyarrow as pa import pyarrow.parquet as pq import pytest from datasets.arrow_writer import ArrowWriter, OptimizedTypedSequence, ParquetWriter, TypedSequence from datasets.features import A...
622
def __A(lowerCAmelCase ) -> bool: """simple docstring""" if not isinstance(lowerCAmelCase , lowerCAmelCase ): raise ValueError("""check_bouncy() accepts only integer arguments""" ) _UpperCamelCase = str(lowerCAmelCase ) _UpperCamelCase = """""".join(sort...
612
0
"""simple docstring""" import enum import os from hashlib import shaaaa from typing import Optional from .. import config from .logging import get_logger UpperCamelCase__ :Optional[Any] = get_logger(__name__) class A( enum.Enum ): """simple docstring""" A = "all_check...
355
import torch from diffusers import KDPMaDiscreteScheduler from diffusers.utils import torch_device from .test_schedulers import SchedulerCommonTest class lowerCAmelCase__ ( __lowercase ): UpperCamelCase_ : int = (KDPMaDiscreteScheduler,) UpperCamelCase_ : Optional[int...
612
0
"""simple docstring""" import os import pytest from attr import dataclass SCREAMING_SNAKE_CASE_ = """us-east-1""" # defaults region @dataclass class snake_case_ : __lowerCAmelCase = 42 __lowerCAmelCase = "arn:aws:iam::558105141721:role/sa...
237
import datetime import platform import subprocess from typing import Optional, Tuple, Union import numpy as np def __A(lowerCAmelCase , lowerCAmelCase ) -> np.array: """simple docstring""" _UpperCamelCase = F'{sampling_rate}' _UpperCamelCase = """1""" _UpperCam...
612
0
import math import os from copy import deepcopy import datasets import evaluate import torch import transformers from datasets import load_dataset from torch.utils.data import DataLoader from transformers import AutoModelForSequenceClassification, AutoTokenizer from accelerate import Accelerator from accelerate...
202
import pprint import requests lowerCamelCase__ = "https://zenquotes.io/api" def __A() -> list: """simple docstring""" return requests.get(API_ENDPOINT_URL + """/today""" ).json() def __A() -> list: """simple docstring""" return requests.get(API_ENDPOINT_URL + """...
612
0
"""simple docstring""" import inspect import tempfile import unittest from huggingface_hub import hf_hub_download from transformers import is_torch_available from transformers.testing_utils import is_flaky, require_torch, slow, torch_device from ...test_configuration_common import ConfigTes...
259
from __future__ import annotations def __A(lowerCAmelCase , lowerCAmelCase ) -> list[list[int]]: """simple docstring""" _UpperCamelCase = [] _UpperCamelCase = [] _UpperCamelCase = 0 _UpperCamelCase = sum(lowerCAmelCase ) create_st...
612
0
'''simple docstring''' from collections import OrderedDict from typing import TYPE_CHECKING, Any, List, Mapping, Optional, Union from ...configuration_utils import PretrainedConfig from ...onnx import OnnxConfig from ...utils import TensorType, logging if TYPE_CHECKING: from ...onnx.config import PatchingSp...
664
import copy import os from typing import Union from ...configuration_utils import PretrainedConfig from ...utils import logging lowerCamelCase__ = logging.get_logger(__name__) lowerCamelCase__ = { "google/pix2struct-textcaps-base": ( "https://huggingface.co/google/pix2struct-textcaps-ba...
612
0
'''simple docstring''' import argparse import os from . import ( ALBERT_PRETRAINED_CONFIG_ARCHIVE_MAP, BART_PRETRAINED_MODEL_ARCHIVE_LIST, BERT_PRETRAINED_CONFIG_ARCHIVE_MAP, CAMEMBERT_PRETRAINED_CONFIG_ARCHIVE_MAP, CTRL_PRETRAINED_CONFIG_ARCHIVE_MAP, DISTILBERT_PRETRAIN...
539
import random import unittest from torch.utils.data import BatchSampler, DataLoader, IterableDataset from accelerate import Accelerator from accelerate.data_loader import ( BatchSamplerShard, DataLoaderDispatcher, DataLoaderShard, IterableDatasetShard, SkipBatchSampler, SkipDataLoader, sk...
612
0