code
stringlengths
81
54k
code_codestyle
int64
0
721
style_context
stringlengths
91
41.9k
style_context_codestyle
int64
0
699
label
int64
0
1
from ...utils import is_note_seq_available, is_transformers_available, is_torch_available from ...utils import OptionalDependencyNotAvailable try: if not (is_transformers_available() and is_torch_available()): raise OptionalDependencyNotAvailable() except OptionalDependencyNotAvailable: from ...utils.dummy_torc...
626
from __future__ import annotations def lowerCAmelCase__ ( SCREAMING_SNAKE_CASE_: list[int] , SCREAMING_SNAKE_CASE_: list[int] , SCREAMING_SNAKE_CASE_: list[int] , SCREAMING_SNAKE_CASE_: list[list[str]] , SCREAMING_SNAKE_CASE_: int , ) -> ...
626
1
import os lowerCAmelCase__ = {"""I""": 1, """V""": 5, """X""": 1_0, """L""": 5_0, """C""": 1_0_0, """D""": 5_0_0, """M""": 1_0_0_0} def lowerCAmelCase__ ( SCREAMING_SNAKE_CASE_: str ) -> int: '''simple docstring''' A__ = 0 A__ = 0 while i...
626
from __future__ import annotations import copy import tempfile import unittest from transformers import CONFIG_MAPPING, AutoConfig, BertConfig, GPTaConfig, TaConfig, TapasConfig, is_tf_available from transformers.testing_utils import ( DUMMY_UNKNOWN_IDENTIFIER, SMALL_MODEL_IDENTIFIER, RequestCounter, ...
626
1
import collections from typing import List, Optional, Union from ...tokenization_utils_base import BatchEncoding from ...utils import TensorType, add_end_docstrings, add_start_docstrings, logging from ..bert.tokenization_bert_fast import BertTokenizerFast from .tokenization_dpr import DPRContextEncoderTokenizer, DPR...
626
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 lowerCAmelCase__ = """src/transformers""" # This is to make sure the transforme...
626
1
def lowerCAmelCase__ ( SCREAMING_SNAKE_CASE_: int ) -> int: '''simple docstring''' if divisor % 5 == 0 or divisor % 2 == 0: return 0 A__ = 1 A__ = 1 while repunit: A__ = (1_0 * repunit + 1) % divisor repunit_i...
626
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 torch i...
626
1
from math import factorial lowerCAmelCase__ = {str(digit): factorial(digit) for digit in range(1_0)} def lowerCAmelCase__ ( SCREAMING_SNAKE_CASE_: int ) -> int: '''simple docstring''' if not isinstance(SCREAMING_SNAKE_CASE_ , SCREAMING_SNAKE_CASE_ ): ...
626
import datasets from .evaluate import evaluate lowerCAmelCase__ = """\ @inproceedings{Rajpurkar2016SQuAD10, title={SQuAD: 100, 000+ Questions for Machine Comprehension of Text}, author={Pranav Rajpurkar and Jian Zhang and Konstantin Lopyrev and Percy Liang}, booktitle={EMNLP}, year={2016} } """ lowerCA...
626
1
import argparse import fairseq import torch from transformers import UniSpeechSatConfig, UniSpeechSatForCTC, UniSpeechSatForPreTraining, logging logging.set_verbosity_info() lowerCAmelCase__ = logging.get_logger(__name__) lowerCAmelCase__ = { """post_extract_proj""": """feature_projection.projection"""...
626
from ..utils import is_flax_available, is_torch_available if is_torch_available(): from .autoencoder_kl import AutoencoderKL from .controlnet import ControlNetModel from .dual_transformer_ad import DualTransformeraDModel from .modeling_utils import ModelMixin from .prior_transformer import PriorTransformer fr...
626
1
def lowerCAmelCase__ ( SCREAMING_SNAKE_CASE_: int ) -> int: '''simple docstring''' A__ = [[0 for _ in range(SCREAMING_SNAKE_CASE_ )] for _ in range(m + 1 )] for i in range(m + 1 ): A__ = 1 for n in range(m + 1 ): ...
626
from math import factorial def lowerCAmelCase__ ( SCREAMING_SNAKE_CASE_: int = 1_0_0 ) -> int: '''simple docstring''' return sum(map(SCREAMING_SNAKE_CASE_ , str(factorial(SCREAMING_SNAKE_CASE_ ) ) ) ) if __name__ == "__main__": print(soluti...
626
1
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__ = logging.get_logger(__name__) lowerCAmelCase__ = { ...
626
lowerCAmelCase__ = """ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/""" def lowerCAmelCase__ ( SCREAMING_SNAKE_CASE_: bytes ) -> bytes: '''simple docstring''' if not isinstance(SCREAMING_SNAKE_CASE_ , SCREAMING_SNAKE_CASE_ ): A__...
626
1
from typing import List, Optional, Union import torch from transformers import ( XLMRobertaTokenizer, ) from ...models import UNetaDConditionModel, VQModel from ...pipelines import DiffusionPipeline from ...pipelines.pipeline_utils import ImagePipelineOutput from ...schedulers import DDIMScheduler, DDPMSchedule...
626
import logging import os import sys from dataclasses import dataclass, field from itertools import chain from typing import Optional, Union import datasets import numpy as np import torch from datasets import load_dataset import transformers from transformers import ( AutoConfig, AutoModelForMultipleChoice,...
626
1
# Copyright 2023 The HuggingFace Team. All rights reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applica...
626
def lowerCAmelCase__ ( SCREAMING_SNAKE_CASE_: int ) -> int: '''simple docstring''' if divisor % 5 == 0 or divisor % 2 == 0: return 0 A__ = 1 A__ = 1 while repunit: A__ = (1_0 * repunit + 1) % divisor repunit_i...
626
1
import unittest from transformers import is_tf_available from transformers.testing_utils import require_tf if is_tf_available(): import tensorflow as tf from tensorflow.python.eager import context from tensorflow.python.framework import ops from transformers import GradientAccumulator, create_optimizer @requ...
626
from __future__ import annotations from collections.abc import Iterator from typing import Any class a__ : """simple docstring""" def __init__( self , lowercase ) -> int: '''simple docstring''' A__ = data A__ = None class ...
626
1
import sys import webbrowser import requests from bsa import BeautifulSoup from fake_useragent import UserAgent if __name__ == "__main__": print("""Googling.....""") lowerCAmelCase__ = """https://www.google.com/search?q=""" + """ """.join(sys.argv[1:]) lowerCAmelCase__ = requests.get(url, headers={"""UserA...
626
import math lowerCAmelCase__ = 1_0 lowerCAmelCase__ = 7 lowerCAmelCase__ = BALLS_PER_COLOUR * NUM_COLOURS def lowerCAmelCase__ ( SCREAMING_SNAKE_CASE_: int = 2_0 ) -> str: '''simple docstring''' A__ = math.comb(SCREAMING_SNAKE_CASE_ , SCREAMING...
626
1
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_module, resolve_trust_remote_code from ...image_p...
626
from typing import Union import fire import torch from tqdm import tqdm def lowerCAmelCase__ ( SCREAMING_SNAKE_CASE_: str , SCREAMING_SNAKE_CASE_: str = "cpu" , SCREAMING_SNAKE_CASE_: Union[str, None] = None ) -> None: '''simple docstring''' A_...
626
1
from typing import TYPE_CHECKING from ...utils import ( OptionalDependencyNotAvailable, _LazyModule, is_sentencepiece_available, is_tokenizers_available, is_torch_available, ) lowerCAmelCase__ = { """configuration_llama""": ["""LLAMA_PRETRAINED_CONFIG_ARCHIVE_MAP""", """LlamaConfig"""], ...
626
from dataclasses import dataclass, field from typing import Optional from transformers import AutoConfig, AutoImageProcessor, AutoTokenizer, FlaxVisionEncoderDecoderModel, HfArgumentParser @dataclass class a__ : """simple docstring""" __lowerCamelCase = field( metadata={'h...
626
1
def lowerCAmelCase__ ( SCREAMING_SNAKE_CASE_: int = 1_0_0 ) -> int: '''simple docstring''' A__ = set() A__ = 0 A__ = n + 1 # maximum limit for a in range(2 , SCREAMING_SNAKE_CASE_ ): for b in range(2 , SC...
626
import collections import importlib.util import os import re from pathlib import Path lowerCAmelCase__ = """src/transformers""" # Matches is_xxx_available() lowerCAmelCase__ = re.compile(R"""is\_([a-z_]*)_available()""") # Catches a one-line _import_struct = {xxx} lowerCAmelCase__ = re.compile(R"""^_impo...
626
1
import json import os import unittest from typing import Tuple from transformers import WavaVecaPhonemeCTCTokenizer from transformers.models.wavaveca.tokenization_wavaveca import VOCAB_FILES_NAMES from transformers.models.wavaveca_phoneme.tokenization_wavaveca_phoneme import WavaVecaPhonemeCTCTokenizerOutput from tr...
626
import warnings from ...utils import logging from .image_processing_clip import CLIPImageProcessor lowerCAmelCase__ = logging.get_logger(__name__) class a__ ( snake_case ): """simple docstring""" def __init__( self , *lowercase , **lowercase ) -> ...
626
1
import os from collections import namedtuple import pytest from datasets import ClassLabel, Features, Sequence, Value from datasets.commands.test import TestCommand from datasets.info import DatasetInfo, DatasetInfosDict lowerCAmelCase__ = namedtuple( """_TestCommandArgs""", [ """dataset""", ...
626
from __future__ import annotations def lowerCAmelCase__ ( SCREAMING_SNAKE_CASE_: str , SCREAMING_SNAKE_CASE_: list[str] | None = None ) -> list[list[str]]: '''simple docstring''' A__ = word_bank or [] # create a table A__ = len(SCR...
626
1
from __future__ import annotations def lowerCAmelCase__ ( SCREAMING_SNAKE_CASE_: list ) -> float: '''simple docstring''' if not nums: raise ValueError("List is empty" ) return sum(SCREAMING_SNAKE_CASE_ ) / len(SCREAMING_SNAKE_CASE_ ) if __n...
626
import argparse import shutil from pathlib import Path from tqdm import tqdm from transformers import AutoTokenizer def lowerCAmelCase__ ( SCREAMING_SNAKE_CASE_: List[str] , SCREAMING_SNAKE_CASE_: List[str] , SCREAMING_SNAKE_CASE_: List[str] , SCREAMING_SNAKE_CASE_:...
626
1
def lowerCAmelCase__ ( SCREAMING_SNAKE_CASE_: str , SCREAMING_SNAKE_CASE_: str ) -> list: '''simple docstring''' A__ = len(SCREAMING_SNAKE_CASE_ ) A__ = [] for i in range(len(SCREAMING_SNAKE_CASE_ ) - pat_len + 1 ): ...
626
from argparse import ArgumentParser, Namespace from ..utils import logging from . import BaseTransformersCLICommand def lowerCAmelCase__ ( SCREAMING_SNAKE_CASE_: Namespace ) -> Tuple: '''simple docstring''' return ConvertCommand( args.model_type , args.t...
626
1
from math import pi def lowerCAmelCase__ ( SCREAMING_SNAKE_CASE_: int , SCREAMING_SNAKE_CASE_: int ) -> float: '''simple docstring''' return 2 * pi * radius * (angle / 3_6_0) if __name__ == "__main__": print(arc_length(9_0, 1_0))
626
import json import pathlib import unittest import numpy as np from transformers.testing_utils import require_torch, require_vision, slow from transformers.utils import is_torch_available, is_vision_available from ...test_image_processing_common import ImageProcessingSavingTestMixin, prepare_image_inputs if is_to...
626
1
from __future__ import annotations def lowerCAmelCase__ ( SCREAMING_SNAKE_CASE_: list , SCREAMING_SNAKE_CASE_: int | None = None , SCREAMING_SNAKE_CASE_: int | None = None ) -> None: '''simple docstring''' if start is None: A__ = ...
626
from __future__ import annotations import unittest from transformers import is_tf_available from transformers.testing_utils import require_sentencepiece, require_tf, require_tokenizers, slow if is_tf_available(): import numpy as np import tensorflow as tf from transformers import TFCamembertModel @require_tf...
626
1
import gc import random import unittest import numpy as np import torch from transformers import CLIPTextConfig, CLIPTextModel, CLIPTokenizer import diffusers from diffusers import ( AutoencoderKL, EulerDiscreteScheduler, StableDiffusionLatentUpscalePipeline, StableDiffusionPipeline, UNetaDCondi...
626
import gc import unittest import numpy as np import torch from diffusers import DanceDiffusionPipeline, IPNDMScheduler, UNetaDModel from diffusers.utils import slow, torch_device from diffusers.utils.testing_utils import enable_full_determinism, require_torch_gpu, skip_mps from ..pipeline_params import UNCONDITION...
626
1
import warnings from ...utils import logging from .image_processing_clip import CLIPImageProcessor lowerCAmelCase__ = logging.get_logger(__name__) class a__ ( snake_case ): """simple docstring""" def __init__( self , *lowercase , **lowercase ) -> ...
626
from __future__ import annotations def lowerCAmelCase__ ( SCREAMING_SNAKE_CASE_: list[int] , SCREAMING_SNAKE_CASE_: list[int] , SCREAMING_SNAKE_CASE_: list[int] , SCREAMING_SNAKE_CASE_: list[list[str]] , SCREAMING_SNAKE_CASE_: int , ) -> ...
626
1
import pytest from datasets import Dataset, DatasetDict, Features, NamedSplit, Value from datasets.io.text import TextDatasetReader from ..utils import assert_arrow_memory_doesnt_increase, assert_arrow_memory_increases def lowerCAmelCase__ ( SCREAMING_SNAKE_CASE_: List[Any] , SCREAMING_SNA...
626
from __future__ import annotations import copy import tempfile import unittest from transformers import CONFIG_MAPPING, AutoConfig, BertConfig, GPTaConfig, TaConfig, TapasConfig, is_tf_available from transformers.testing_utils import ( DUMMY_UNKNOWN_IDENTIFIER, SMALL_MODEL_IDENTIFIER, RequestCounter, ...
626
1
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 @require_fl...
626
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 lowerCAmelCase__ = """src/transformers""" # This is to make sure the transforme...
626
1
import absl # noqa: F401 # Here to have a nice missing dependency error message early on import nltk # 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 six # noqa: F401 # Here to have a nice ...
626
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 torch i...
626
1
from __future__ import annotations import math def lowerCAmelCase__ ( SCREAMING_SNAKE_CASE_: int ) -> list[int]: '''simple docstring''' if num <= 0: A__ = F'{num}: Invalid input, please enter a positive integer.' raise ValueError(SCREAMING_SNA...
626
import datasets from .evaluate import evaluate lowerCAmelCase__ = """\ @inproceedings{Rajpurkar2016SQuAD10, title={SQuAD: 100, 000+ Questions for Machine Comprehension of Text}, author={Pranav Rajpurkar and Jian Zhang and Konstantin Lopyrev and Percy Liang}, booktitle={EMNLP}, year={2016} } """ lowerCA...
626
1
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 import Accelerator, Dis...
626
from ..utils import is_flax_available, is_torch_available if is_torch_available(): from .autoencoder_kl import AutoencoderKL from .controlnet import ControlNetModel from .dual_transformer_ad import DualTransformeraDModel from .modeling_utils import ModelMixin from .prior_transformer import PriorTransformer fr...
626
1
import warnings from ...utils import logging from .image_processing_imagegpt import ImageGPTImageProcessor lowerCAmelCase__ = logging.get_logger(__name__) class a__ ( snake_case ): """simple docstring""" def __init__( self , *lowercase , **lowercase ) ...
626
from math import factorial def lowerCAmelCase__ ( SCREAMING_SNAKE_CASE_: int = 1_0_0 ) -> int: '''simple docstring''' return sum(map(SCREAMING_SNAKE_CASE_ , str(factorial(SCREAMING_SNAKE_CASE_ ) ) ) ) if __name__ == "__main__": print(soluti...
626
1
from __future__ import annotations def lowerCAmelCase__ ( SCREAMING_SNAKE_CASE_: float , SCREAMING_SNAKE_CASE_: float , SCREAMING_SNAKE_CASE_: float ) -> dict[str, float]: '''simple docstring''' if (voltage, current, resistance).count(0 ) !...
626
lowerCAmelCase__ = """ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/""" def lowerCAmelCase__ ( SCREAMING_SNAKE_CASE_: bytes ) -> bytes: '''simple docstring''' if not isinstance(SCREAMING_SNAKE_CASE_ , SCREAMING_SNAKE_CASE_ ): A__...
626
1
import itertools import random import unittest import numpy as np from transformers import WAV_2_VEC_2_PRETRAINED_MODEL_ARCHIVE_LIST, WavaVecaConfig, WavaVecaFeatureExtractor from transformers.testing_utils import require_torch, slow from ...test_sequence_feature_extraction_common import SequenceFeatureExtractionT...
626
import logging import os import sys from dataclasses import dataclass, field from itertools import chain from typing import Optional, Union import datasets import numpy as np import torch from datasets import load_dataset import transformers from transformers import ( AutoConfig, AutoModelForMultipleChoice,...
626
1
from typing import TYPE_CHECKING from ...utils import ( OptionalDependencyNotAvailable, _LazyModule, is_flax_available, is_tf_available, is_torch_available, ) lowerCAmelCase__ = { """configuration_vision_text_dual_encoder""": ["""VisionTextDualEncoderConfig"""], """processing_vision_...
626
def lowerCAmelCase__ ( SCREAMING_SNAKE_CASE_: int ) -> int: '''simple docstring''' if divisor % 5 == 0 or divisor % 2 == 0: return 0 A__ = 1 A__ = 1 while repunit: A__ = (1_0 * repunit + 1) % divisor repunit_i...
626
1
import os # Precomputes a list of the 100 first triangular numbers lowerCAmelCase__ = [int(0.5 * n * (n + 1)) for n in range(1, 1_0_1)] def lowerCAmelCase__ ( ) -> List[str]: '''simple docstring''' A__ = os.path.dirname(os.path.realpath(SCREAMING_SNAKE_CASE_ ) ...
626
from __future__ import annotations from collections.abc import Iterator from typing import Any class a__ : """simple docstring""" def __init__( self , lowercase ) -> int: '''simple docstring''' A__ = data A__ = None class ...
626
1
import inspect import os import torch from transformers import AutoModel from transformers.testing_utils import mockenv_context from transformers.trainer_utils import set_seed import accelerate from accelerate.accelerator import Accelerator from accelerate.state import AcceleratorState from accelerate.test_utils.te...
626
import math lowerCAmelCase__ = 1_0 lowerCAmelCase__ = 7 lowerCAmelCase__ = BALLS_PER_COLOUR * NUM_COLOURS def lowerCAmelCase__ ( SCREAMING_SNAKE_CASE_: int = 2_0 ) -> str: '''simple docstring''' A__ = math.comb(SCREAMING_SNAKE_CASE_ , SCREAMING...
626
1
from collections import defaultdict from typing import Optional from ..image_utils import load_image from ..utils import ( add_end_docstrings, is_torch_available, logging, requires_backends, ) from .base import PIPELINE_INIT_ARGS, ChunkPipeline if is_torch_available(): import torch from ..models...
626
from typing import Union import fire import torch from tqdm import tqdm def lowerCAmelCase__ ( SCREAMING_SNAKE_CASE_: str , SCREAMING_SNAKE_CASE_: str = "cpu" , SCREAMING_SNAKE_CASE_: Union[str, None] = None ) -> None: '''simple docstring''' A_...
626
1
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 lowerCAmelCase__ = logging.getLogger(__name__) @dataclass class a__ ...
626
from dataclasses import dataclass, field from typing import Optional from transformers import AutoConfig, AutoImageProcessor, AutoTokenizer, FlaxVisionEncoderDecoderModel, HfArgumentParser @dataclass class a__ : """simple docstring""" __lowerCamelCase = field( metadata={'h...
626
1
import warnings from typing import List import numpy as np from ...processing_utils import ProcessorMixin from ...tokenization_utils_base import BatchEncoding from ...utils import is_flax_available, is_tf_available, is_torch_available class a__ ( snake_case ): """simple docstring""" __...
626
import collections import importlib.util import os import re from pathlib import Path lowerCAmelCase__ = """src/transformers""" # Matches is_xxx_available() lowerCAmelCase__ = re.compile(R"""is\_([a-z_]*)_available()""") # Catches a one-line _import_struct = {xxx} lowerCAmelCase__ = re.compile(R"""^_impo...
626
1
from math import factorial def lowerCAmelCase__ ( SCREAMING_SNAKE_CASE_: int = 1_0_0 ) -> int: '''simple docstring''' return sum(map(SCREAMING_SNAKE_CASE_ , str(factorial(SCREAMING_SNAKE_CASE_ ) ) ) ) if __name__ == "__main__": print(soluti...
626
import warnings from ...utils import logging from .image_processing_clip import CLIPImageProcessor lowerCAmelCase__ = logging.get_logger(__name__) class a__ ( snake_case ): """simple docstring""" def __init__( self , *lowercase , **lowercase ) -> ...
626
1
# 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 ap...
626
from __future__ import annotations def lowerCAmelCase__ ( SCREAMING_SNAKE_CASE_: str , SCREAMING_SNAKE_CASE_: list[str] | None = None ) -> list[list[str]]: '''simple docstring''' A__ = word_bank or [] # create a table A__ = len(SCR...
626
1
from typing import Any class a__ : """simple docstring""" def __init__( self , lowercase ) -> Tuple: '''simple docstring''' A__ = data A__ = None class a__ : """simple docstring""" def __init__( se...
626
import argparse import shutil from pathlib import Path from tqdm import tqdm from transformers import AutoTokenizer def lowerCAmelCase__ ( SCREAMING_SNAKE_CASE_: List[str] , SCREAMING_SNAKE_CASE_: List[str] , SCREAMING_SNAKE_CASE_: List[str] , SCREAMING_SNAKE_CASE_:...
626
1
import itertools import math def lowerCAmelCase__ ( SCREAMING_SNAKE_CASE_: int ) -> bool: '''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, al...
626
from argparse import ArgumentParser, Namespace from ..utils import logging from . import BaseTransformersCLICommand def lowerCAmelCase__ ( SCREAMING_SNAKE_CASE_: Namespace ) -> Tuple: '''simple docstring''' return ConvertCommand( args.model_type , args.t...
626
1
def lowerCAmelCase__ ( SCREAMING_SNAKE_CASE_: str ) -> str: '''simple docstring''' if not all(char in "01" for char in bin_string ): raise ValueError("Non-binary value was passed to the function" ) if not bin_string: raise ValueError("Empty s...
626
import json import pathlib import unittest import numpy as np from transformers.testing_utils import require_torch, require_vision, slow from transformers.utils import is_torch_available, is_vision_available from ...test_image_processing_common import ImageProcessingSavingTestMixin, prepare_image_inputs if is_to...
626
1
from collections import defaultdict class a__ : """simple docstring""" def __init__( self , lowercase , lowercase ) -> Tuple: '''simple docstring''' A__ = total # total no of tasks (N) # DP table will have a dimension of ...
626
from __future__ import annotations import unittest from transformers import is_tf_available from transformers.testing_utils import require_sentencepiece, require_tf, require_tokenizers, slow if is_tf_available(): import numpy as np import tensorflow as tf from transformers import TFCamembertModel @require_tf...
626
1
import requests from bsa import BeautifulSoup def lowerCAmelCase__ ( SCREAMING_SNAKE_CASE_: str , SCREAMING_SNAKE_CASE_: dict ) -> str: '''simple docstring''' A__ = BeautifulSoup(requests.get(SCREAMING_SNAKE_CASE_ , params=SCREAMING_SNAKE_CAS...
626
import gc import unittest import numpy as np import torch from diffusers import DanceDiffusionPipeline, IPNDMScheduler, UNetaDModel from diffusers.utils import slow, torch_device from diffusers.utils.testing_utils import enable_full_determinism, require_torch_gpu, skip_mps from ..pipeline_params import UNCONDITION...
626
1
from math import isclose, sqrt def lowerCAmelCase__ ( SCREAMING_SNAKE_CASE_: float , SCREAMING_SNAKE_CASE_: float , SCREAMING_SNAKE_CASE_: float ) -> tuple[float, float, float]: '''simple docstring''' A__ = point_y / 4 / point_x A__...
626
from __future__ import annotations def lowerCAmelCase__ ( SCREAMING_SNAKE_CASE_: list[int] , SCREAMING_SNAKE_CASE_: list[int] , SCREAMING_SNAKE_CASE_: list[int] , SCREAMING_SNAKE_CASE_: list[list[str]] , SCREAMING_SNAKE_CASE_: int , ) -> ...
626
1
from typing import Dict, List, Optional, Tuple, 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,...
626
from __future__ import annotations import copy import tempfile import unittest from transformers import CONFIG_MAPPING, AutoConfig, BertConfig, GPTaConfig, TaConfig, TapasConfig, is_tf_available from transformers.testing_utils import ( DUMMY_UNKNOWN_IDENTIFIER, SMALL_MODEL_IDENTIFIER, RequestCounter, ...
626
1
from typing import List, Optional, Tuple from ...tokenization_utils_fast import PreTrainedTokenizerFast from ...utils import logging from .tokenization_herbert import HerbertTokenizer lowerCAmelCase__ = logging.get_logger(__name__) lowerCAmelCase__ = {"""vocab_file""": """vocab.json""", """merges_file""": "...
626
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 lowerCAmelCase__ = """src/transformers""" # This is to make sure the transforme...
626
1
from maths.prime_check import is_prime def lowerCAmelCase__ ( SCREAMING_SNAKE_CASE_: int ) -> int: '''simple docstring''' if not isinstance(SCREAMING_SNAKE_CASE_ , SCREAMING_SNAKE_CASE_ ): A__ = F'Input value of [number={number}] must be an ...
626
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 torch i...
626
1
import unittest from huggingface_hub import hf_hub_download from transformers import MODEL_FOR_VIDEO_CLASSIFICATION_MAPPING, VideoMAEFeatureExtractor from transformers.pipelines import VideoClassificationPipeline, pipeline from transformers.testing_utils import ( is_pipeline_test, nested_simplify, requi...
626
import datasets from .evaluate import evaluate lowerCAmelCase__ = """\ @inproceedings{Rajpurkar2016SQuAD10, title={SQuAD: 100, 000+ Questions for Machine Comprehension of Text}, author={Pranav Rajpurkar and Jian Zhang and Konstantin Lopyrev and Percy Liang}, booktitle={EMNLP}, year={2016} } """ lowerCA...
626
1
import argparse from tax import checkpoints from transformers import AutoConfig, FlaxAutoModelForSeqaSeqLM def lowerCAmelCase__ ( SCREAMING_SNAKE_CASE_: str , SCREAMING_SNAKE_CASE_: Tuple , SCREAMING_SNAKE_CASE_: Optional[int] ) -> Dict: '''simple docst...
700
from ..utils import is_flax_available, is_torch_available if is_torch_available(): from .autoencoder_kl import AutoencoderKL from .controlnet import ControlNetModel from .dual_transformer_ad import DualTransformeraDModel from .modeling_utils import ModelMixin from .prior_transformer import PriorTransformer fr...
626
0
import argparse import os import re # All paths are set with the intent you should run this script from the root of the repo with the command # python utils/check_dummies.py lowerCAmelCase__ = """src/diffusers""" # Matches is_xxx_available() lowerCAmelCase__ = re.compile(R"""is\_([a-z_]*)_available\(\)""") #...
701
from math import factorial def lowerCAmelCase__ ( SCREAMING_SNAKE_CASE_: int = 1_0_0 ) -> int: '''simple docstring''' return sum(map(SCREAMING_SNAKE_CASE_ , str(factorial(SCREAMING_SNAKE_CASE_ ) ) ) ) if __name__ == "__main__": print(soluti...
626
0
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, AutoModelForSeqaSeqLM, AutoTokenizer, ...
702
lowerCAmelCase__ = """ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/""" def lowerCAmelCase__ ( SCREAMING_SNAKE_CASE_: bytes ) -> bytes: '''simple docstring''' if not isinstance(SCREAMING_SNAKE_CASE_ , SCREAMING_SNAKE_CASE_ ): A__...
626
0
from typing import List from ...configuration_utils import PretrainedConfig from ...utils import logging lowerCAmelCase__ = logging.get_logger(__name__) lowerCAmelCase__ = { "snap-research/efficientformer-l1-300": ( "https://huggingface.co/snap-research/efficientformer-l1-300/resolve/main/config...
703
import logging import os import sys from dataclasses import dataclass, field from itertools import chain from typing import Optional, Union import datasets import numpy as np import torch from datasets import load_dataset import transformers from transformers import ( AutoConfig, AutoModelForMultipleChoice,...
626
0
import argparse from collections import defaultdict def lowerCAmelCase__ ( SCREAMING_SNAKE_CASE_: List[str] , SCREAMING_SNAKE_CASE_: List[str] , SCREAMING_SNAKE_CASE_: List[Any] , SCREAMING_SNAKE_CASE_: int , SCREAMING_SNAKE_CASE_: Any ) -> ...
704
def lowerCAmelCase__ ( SCREAMING_SNAKE_CASE_: int ) -> int: '''simple docstring''' if divisor % 5 == 0 or divisor % 2 == 0: return 0 A__ = 1 A__ = 1 while repunit: A__ = (1_0 * repunit + 1) % divisor repunit_i...
626
0
from typing import TYPE_CHECKING from ...utils import ( OptionalDependencyNotAvailable, _LazyModule, is_flax_available, is_tf_available, is_tokenizers_available, is_torch_available, is_vision_available, ) lowerCAmelCase__ = { "configuration_clip": [ "CLIP_PRETRAINED_CONFIG_...
705
from __future__ import annotations from collections.abc import Iterator from typing import Any class a__ : """simple docstring""" def __init__( self , lowercase ) -> int: '''simple docstring''' A__ = data A__ = None class ...
626
0
import os import warnings from typing import List, Optional from ...tokenization_utils_base import BatchEncoding from ...utils import logging from .configuration_rag import RagConfig lowerCAmelCase__ = logging.get_logger(__name__) class a__ : """simple docstring""" def __init__( self ...
706
import math lowerCAmelCase__ = 1_0 lowerCAmelCase__ = 7 lowerCAmelCase__ = BALLS_PER_COLOUR * NUM_COLOURS def lowerCAmelCase__ ( SCREAMING_SNAKE_CASE_: int = 2_0 ) -> str: '''simple docstring''' A__ = math.comb(SCREAMING_SNAKE_CASE_ , SCREAMING...
626
0
def lowerCAmelCase__ ( SCREAMING_SNAKE_CASE_: list[list[float]] ) -> list[list[float]]: '''simple docstring''' A__ = [] for data in source_data: for i, el in enumerate(SCREAMING_SNAKE_CASE_ ): if len(SCREAMING_SNAKE_CA...
707
from typing import Union import fire import torch from tqdm import tqdm def lowerCAmelCase__ ( SCREAMING_SNAKE_CASE_: str , SCREAMING_SNAKE_CASE_: str = "cpu" , SCREAMING_SNAKE_CASE_: Union[str, None] = None ) -> None: '''simple docstring''' A_...
626
0
def lowerCAmelCase__ ( SCREAMING_SNAKE_CASE_: int , SCREAMING_SNAKE_CASE_: int ) -> int: '''simple docstring''' while b: A__ = b, a % b return a def lowerCAmelCase__ ( SCREAMING_SNAKE_CASE_: int , SCREAMING_SNA...
708
from dataclasses import dataclass, field from typing import Optional from transformers import AutoConfig, AutoImageProcessor, AutoTokenizer, FlaxVisionEncoderDecoderModel, HfArgumentParser @dataclass class a__ : """simple docstring""" __lowerCamelCase = field( metadata={'h...
626
0
'''simple docstring''' import argparse from transformers import BigBirdConfig, BigBirdForPreTraining, BigBirdForQuestionAnswering, load_tf_weights_in_big_bird from transformers.utils import logging logging.set_verbosity_info() def lowerCAmelCase__ ( SCREAMING_SNAKE_CASE_: Union[str, Any] ,...
709
import collections import importlib.util import os import re from pathlib import Path lowerCAmelCase__ = """src/transformers""" # Matches is_xxx_available() lowerCAmelCase__ = re.compile(R"""is\_([a-z_]*)_available()""") # Catches a one-line _import_struct = {xxx} lowerCAmelCase__ = re.compile(R"""^_impo...
626
0
import math class a__ : """simple docstring""" def UpperCamelCase ( self , lowercase , lowercase ) -> Union[str, Any]: '''simple docstring''' A__ = 0.0 A__ = 0.0 for i in range(l...
710
import warnings from ...utils import logging from .image_processing_clip import CLIPImageProcessor lowerCAmelCase__ = logging.get_logger(__name__) class a__ ( snake_case ): """simple docstring""" def __init__( self , *lowercase , **lowercase ) -> ...
626
0
def lowerCAmelCase__ ( SCREAMING_SNAKE_CASE_: int = 4_0_0_0_0_0_0 ) -> List[str]: '''simple docstring''' A__ = [] A__ = 0, 1 while b <= n: if b % 2 == 0: even_fibs.append(_lowerCAmelCase ) A__ = b, a + b ...
711
from __future__ import annotations def lowerCAmelCase__ ( SCREAMING_SNAKE_CASE_: str , SCREAMING_SNAKE_CASE_: list[str] | None = None ) -> list[list[str]]: '''simple docstring''' A__ = word_bank or [] # create a table A__ = len(SCR...
626
0
from __future__ import annotations # This is the precision for this function which can be altered. # It is recommended for users to keep this number greater than or equal to 10. lowerCAmelCase__ = 1_0 def lowerCAmelCase__ ( SCREAMING_SNAKE_CASE_: List[str] , SCREAMING_SNAKE_CASE_: ...
712
import argparse import shutil from pathlib import Path from tqdm import tqdm from transformers import AutoTokenizer def lowerCAmelCase__ ( SCREAMING_SNAKE_CASE_: List[str] , SCREAMING_SNAKE_CASE_: List[str] , SCREAMING_SNAKE_CASE_: List[str] , SCREAMING_SNAKE_CASE_:...
626
0
'''simple docstring''' def lowerCAmelCase__ ( SCREAMING_SNAKE_CASE_: Optional[Any] ) -> bool: '''simple docstring''' if not isinstance(__UpperCAmelCase , __UpperCAmelCase ): A__ = F'Input value of [number={number}] must be an integer' ...
713
from argparse import ArgumentParser, Namespace from ..utils import logging from . import BaseTransformersCLICommand def lowerCAmelCase__ ( SCREAMING_SNAKE_CASE_: Namespace ) -> Tuple: '''simple docstring''' return ConvertCommand( args.model_type , args.t...
626
0
from collections import deque from math import floor from random import random from time import time class a__ : """simple docstring""" def __init__( self ) -> Union[str, Any]: '''simple docstring''' A__ = {} def UpperCamelCase ( self ...
714
import json import pathlib import unittest import numpy as np from transformers.testing_utils import require_torch, require_vision, slow from transformers.utils import is_torch_available, is_vision_available from ...test_image_processing_common import ImageProcessingSavingTestMixin, prepare_image_inputs if is_to...
626
0
import logging import os from dataclasses import dataclass, field from typing import Dict, Optional import datasets import numpy as np import tensorflow as tf from transformers import ( AutoConfig, AutoTokenizer, EvalPrediction, HfArgumentParser, PreTrainedTokenizer, TFAutoModelForSequenceCl...
715
from __future__ import annotations import unittest from transformers import is_tf_available from transformers.testing_utils import require_sentencepiece, require_tf, require_tokenizers, slow if is_tf_available(): import numpy as np import tensorflow as tf from transformers import TFCamembertModel @require_tf...
626
0
import warnings from ...utils import logging from .image_processing_dpt import DPTImageProcessor lowerCAmelCase__ = logging.get_logger(__name__) class a__ ( a__ ): def __init__( self , *lowercase , **lowercase ) -> Union[str, Any]: '''simple docstr...
716
import gc import unittest import numpy as np import torch from diffusers import DanceDiffusionPipeline, IPNDMScheduler, UNetaDModel from diffusers.utils import slow, torch_device from diffusers.utils.testing_utils import enable_full_determinism, require_torch_gpu, skip_mps from ..pipeline_params import UNCONDITION...
626
0
import copy from typing import Dict, List, Optional from ...configuration_utils import PretrainedConfig from ...utils import logging from ..auto import CONFIG_MAPPING lowerCAmelCase__ = { """facebook/mask2former-swin-small-coco-instance""": ( """https://huggingface.co/facebook/mask2former-swin-small...
717
from __future__ import annotations def lowerCAmelCase__ ( SCREAMING_SNAKE_CASE_: list[int] , SCREAMING_SNAKE_CASE_: list[int] , SCREAMING_SNAKE_CASE_: list[int] , SCREAMING_SNAKE_CASE_: list[list[str]] , SCREAMING_SNAKE_CASE_: int , ) -> ...
626
0
from typing import TYPE_CHECKING from ...utils import OptionalDependencyNotAvailable, _LazyModule, is_flax_available, is_torch_available lowerCAmelCase__ = { "configuration_gpt_neo": ["GPT_NEO_PRETRAINED_CONFIG_ARCHIVE_MAP", "GPTNeoConfig", "GPTNeoOnnxConfig"], } try: if not is_torch_available(): raise ...
718
from __future__ import annotations import copy import tempfile import unittest from transformers import CONFIG_MAPPING, AutoConfig, BertConfig, GPTaConfig, TaConfig, TapasConfig, is_tf_available from transformers.testing_utils import ( DUMMY_UNKNOWN_IDENTIFIER, SMALL_MODEL_IDENTIFIER, RequestCounter, ...
626
0
import io import json import fsspec import pytest from datasets import Dataset, DatasetDict, Features, NamedSplit, Value from datasets.io.json import JsonDatasetReader, JsonDatasetWriter from ..utils import assert_arrow_memory_doesnt_increase, assert_arrow_memory_increases def lowerCAmelCase...
719
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 lowerCAmelCase__ = """src/transformers""" # This is to make sure the transforme...
626
0
import argparse import os import subprocess from packaging.version import Version, parse from accelerate.commands.config.config_args import default_config_file, load_config_from_file lowerCAmelCase__ = """Run commands across TPU VMs for initial setup before running `accelerate launch`.""" def lowerCAme...
720
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 torch i...
626
0
import heapq def lowerCAmelCase__ ( SCREAMING_SNAKE_CASE_: dict ) -> Optional[Any]: '''simple docstring''' A__ = [] # for each node and his adjacency list add them and the rank of the node to queue # using heapq module the queue will be filled like a ...
721
import datasets from .evaluate import evaluate lowerCAmelCase__ = """\ @inproceedings{Rajpurkar2016SQuAD10, title={SQuAD: 100, 000+ Questions for Machine Comprehension of Text}, author={Pranav Rajpurkar and Jian Zhang and Konstantin Lopyrev and Percy Liang}, booktitle={EMNLP}, year={2016} } """ lowerCA...
626
0
import math def lowerCAmelCase__ ( SCREAMING_SNAKE_CASE_: list , SCREAMING_SNAKE_CASE_: int ) -> Optional[Any]: '''simple docstring''' A__ = len(snake_case__ ) A__ = int(math.floor(math.sqrt(snake_case__ ) ) ) A_...
700
from ..utils import is_flax_available, is_torch_available if is_torch_available(): from .autoencoder_kl import AutoencoderKL from .controlnet import ControlNetModel from .dual_transformer_ad import DualTransformeraDModel from .modeling_utils import ModelMixin from .prior_transformer import PriorTransformer fr...
626
0
from typing import List, Optional, Tuple from ...tokenization_utils_fast import PreTrainedTokenizerFast from ...utils import logging from .tokenization_herbert import HerbertTokenizer lowerCAmelCase__ = logging.get_logger(__name__) lowerCAmelCase__ = {"""vocab_file""": """vocab.json""", """merges_file""": "...
701
from math import factorial def lowerCAmelCase__ ( SCREAMING_SNAKE_CASE_: int = 1_0_0 ) -> int: '''simple docstring''' return sum(map(SCREAMING_SNAKE_CASE_ , str(factorial(SCREAMING_SNAKE_CASE_ ) ) ) ) if __name__ == "__main__": print(soluti...
626
0
import argparse import json import requests import timm import torch from huggingface_hub import hf_hub_download from PIL import Image from transformers import AutoImageProcessor, SwinConfig, SwinForImageClassification def lowerCAmelCase__ ( SCREAMING_SNAKE_CASE_: str ) -> Tuple: ...
702
lowerCAmelCase__ = """ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/""" def lowerCAmelCase__ ( SCREAMING_SNAKE_CASE_: bytes ) -> bytes: '''simple docstring''' if not isinstance(SCREAMING_SNAKE_CASE_ , SCREAMING_SNAKE_CASE_ ): A__...
626
0
from dataclasses import dataclass from typing import Dict, Optional, Union import torch import torch.nn.functional as F from torch import nn from ..configuration_utils import ConfigMixin, register_to_config from ..utils import BaseOutput from .attention import BasicTransformerBlock from .attention_processor import ...
703
import logging import os import sys from dataclasses import dataclass, field from itertools import chain from typing import Optional, Union import datasets import numpy as np import torch from datasets import load_dataset import transformers from transformers import ( AutoConfig, AutoModelForMultipleChoice,...
626
0
from __future__ import annotations def lowerCAmelCase__ ( SCREAMING_SNAKE_CASE_: Any , SCREAMING_SNAKE_CASE_: Any , SCREAMING_SNAKE_CASE_: int , SCREAMING_SNAKE_CASE_: Union[str, Any] ) -> str: # noqa: E741 '''simple docstring''' wh...
704
def lowerCAmelCase__ ( SCREAMING_SNAKE_CASE_: int ) -> int: '''simple docstring''' if divisor % 5 == 0 or divisor % 2 == 0: return 0 A__ = 1 A__ = 1 while repunit: A__ = (1_0 * repunit + 1) % divisor repunit_i...
626
0
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, convert_to_rgb, get_resize_output_image_size, normalize, rescale, resize, to_channel_dimens...
705
from __future__ import annotations from collections.abc import Iterator from typing import Any class a__ : """simple docstring""" def __init__( self , lowercase ) -> int: '''simple docstring''' A__ = data A__ = None class ...
626
0
from typing import Any class a__ : """simple docstring""" def __init__( self , lowercase ) -> str: '''simple docstring''' A__ = data A__ = None class a__ : """simple docstring""" def __init__( self...
706
import math lowerCAmelCase__ = 1_0 lowerCAmelCase__ = 7 lowerCAmelCase__ = BALLS_PER_COLOUR * NUM_COLOURS def lowerCAmelCase__ ( SCREAMING_SNAKE_CASE_: int = 2_0 ) -> str: '''simple docstring''' A__ = math.comb(SCREAMING_SNAKE_CASE_ , SCREAMING...
626
0
import argparse import torch from torch import nn from transformers import MBartConfig, MBartForConditionalGeneration def lowerCAmelCase__ ( SCREAMING_SNAKE_CASE_: List[str] ) -> List[Any]: '''simple docstring''' A__ = [ "encod...
707
from typing import Union import fire import torch from tqdm import tqdm def lowerCAmelCase__ ( SCREAMING_SNAKE_CASE_: str , SCREAMING_SNAKE_CASE_: str = "cpu" , SCREAMING_SNAKE_CASE_: Union[str, None] = None ) -> None: '''simple docstring''' A_...
626
0
import tempfile import torch from diffusers import IPNDMScheduler from .test_schedulers import SchedulerCommonTest class a__ ( _UpperCAmelCase ): """simple docstring""" __lowerCamelCase = (IPNDMScheduler,) __lowerCamelCase = (('num_inference_steps', 50)...
708
from dataclasses import dataclass, field from typing import Optional from transformers import AutoConfig, AutoImageProcessor, AutoTokenizer, FlaxVisionEncoderDecoderModel, HfArgumentParser @dataclass class a__ : """simple docstring""" __lowerCamelCase = field( metadata={'h...
626
0
'''simple docstring''' from transformers import BertTokenizer, EncoderDecoderModel, SeqaSeqTrainer, SeqaSeqTrainingArguments from transformers.testing_utils import TestCasePlus, require_torch, slow from transformers.utils import is_datasets_available if is_datasets_available(): import datasets class a__...
709
import collections import importlib.util import os import re from pathlib import Path lowerCAmelCase__ = """src/transformers""" # Matches is_xxx_available() lowerCAmelCase__ = re.compile(R"""is\_([a-z_]*)_available()""") # Catches a one-line _import_struct = {xxx} lowerCAmelCase__ = re.compile(R"""^_impo...
626
0
from __future__ import annotations def lowerCAmelCase__ ( SCREAMING_SNAKE_CASE_: int ) -> Optional[int]: '''simple docstring''' A__ = str(UpperCAmelCase__ ) return len(UpperCAmelCase__ ) == 9 and set(UpperCAmelCase__ ) == s...
710
import warnings from ...utils import logging from .image_processing_clip import CLIPImageProcessor lowerCAmelCase__ = logging.get_logger(__name__) class a__ ( snake_case ): """simple docstring""" def __init__( self , *lowercase , **lowercase ) -> ...
626
0
import importlib.util import os import platform from argparse import ArgumentParser import huggingface_hub from .. import __version__ as version from ..utils import ( is_accelerate_available, is_flax_available, is_safetensors_available, is_tf_available, is_torch_available, ) from . import BaseTr...
711
from __future__ import annotations def lowerCAmelCase__ ( SCREAMING_SNAKE_CASE_: str , SCREAMING_SNAKE_CASE_: list[str] | None = None ) -> list[list[str]]: '''simple docstring''' A__ = word_bank or [] # create a table A__ = len(SCR...
626
0
import pprint import requests lowerCAmelCase__ = 'https://zenquotes.io/api' def lowerCAmelCase__ ( ) -> int: '''simple docstring''' return requests.get(API_ENDPOINT_URL + "/today" ).json() def lowerCAmelCase__ ( ) -> str: '''simple docstring...
712
import argparse import shutil from pathlib import Path from tqdm import tqdm from transformers import AutoTokenizer def lowerCAmelCase__ ( SCREAMING_SNAKE_CASE_: List[str] , SCREAMING_SNAKE_CASE_: List[str] , SCREAMING_SNAKE_CASE_: List[str] , SCREAMING_SNAKE_CASE_:...
626
0
'''simple docstring''' import os from pathlib import Path def lowerCAmelCase__ ( SCREAMING_SNAKE_CASE_: Tuple , SCREAMING_SNAKE_CASE_: Optional[int] , SCREAMING_SNAKE_CASE_: Optional[Any] , SCREAMING_SNAKE_CASE_: Tuple ) -> Any: '''simpl...
713
from argparse import ArgumentParser, Namespace from ..utils import logging from . import BaseTransformersCLICommand def lowerCAmelCase__ ( SCREAMING_SNAKE_CASE_: Namespace ) -> Tuple: '''simple docstring''' return ConvertCommand( args.model_type , args.t...
626
0
from typing import TYPE_CHECKING from ...utils import ( OptionalDependencyNotAvailable, _LazyModule, is_tf_available, is_torch_available, is_vision_available, ) lowerCAmelCase__ = {"""configuration_deit""": ["""DEIT_PRETRAINED_CONFIG_ARCHIVE_MAP""", """DeiTConfig""", """DeiTOnnxConfig"""]} ...
714
import json import pathlib import unittest import numpy as np from transformers.testing_utils import require_torch, require_vision, slow from transformers.utils import is_torch_available, is_vision_available from ...test_image_processing_common import ImageProcessingSavingTestMixin, prepare_image_inputs if is_to...
626
0
import argparse import json import requests import torch from huggingface_hub import hf_hub_download from PIL import Image from transformers import ConvNextConfig, SegformerImageProcessor, UperNetConfig, UperNetForSemanticSegmentation def lowerCAmelCase__ ( SCREAMING_SNAKE_CASE_: List[Any] ...
715
from __future__ import annotations import unittest from transformers import is_tf_available from transformers.testing_utils import require_sentencepiece, require_tf, require_tokenizers, slow if is_tf_available(): import numpy as np import tensorflow as tf from transformers import TFCamembertModel @require_tf...
626
0
from __future__ import annotations from random import random from typing import Generic, TypeVar lowerCAmelCase__ = TypeVar("""KT""") lowerCAmelCase__ = TypeVar("""VT""") class a__ ( Generic[KT, VT] ): def __init__( self , lowercase = "root" , lowercase = None ...
716
import gc import unittest import numpy as np import torch from diffusers import DanceDiffusionPipeline, IPNDMScheduler, UNetaDModel from diffusers.utils import slow, torch_device from diffusers.utils.testing_utils import enable_full_determinism, require_torch_gpu, skip_mps from ..pipeline_params import UNCONDITION...
626
0
import os from shutil import copyfile from typing import List, Optional, Tuple import sentencepiece as spm from ...tokenization_utils import PreTrainedTokenizer from ...utils import logging lowerCAmelCase__ = logging.get_logger(__name__) lowerCAmelCase__ = {'''vocab_file''': '''sentencepiece.model'''} low...
717
from __future__ import annotations def lowerCAmelCase__ ( SCREAMING_SNAKE_CASE_: list[int] , SCREAMING_SNAKE_CASE_: list[int] , SCREAMING_SNAKE_CASE_: list[int] , SCREAMING_SNAKE_CASE_: list[list[str]] , SCREAMING_SNAKE_CASE_: int , ) -> ...
626
0
import functools import operator from ...configuration_utils import PretrainedConfig from ...utils import logging lowerCAmelCase__ = logging.get_logger(__name__) lowerCAmelCase__ = { """asapp/sew-d-tiny-100k""": """https://huggingface.co/asapp/sew-d-tiny-100k/resolve/main/config.json""", # See all S...
718
from __future__ import annotations import copy import tempfile import unittest from transformers import CONFIG_MAPPING, AutoConfig, BertConfig, GPTaConfig, TaConfig, TapasConfig, is_tf_available from transformers.testing_utils import ( DUMMY_UNKNOWN_IDENTIFIER, SMALL_MODEL_IDENTIFIER, RequestCounter, ...
626
0
import heapq def lowerCAmelCase__ ( SCREAMING_SNAKE_CASE_: Optional[Any] ) -> Optional[int]: '''simple docstring''' A__ = [] # for each node and his adjacency list add them and the rank of the node to queue # using heapq module the...
719
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 lowerCAmelCase__ = """src/transformers""" # This is to make sure the transforme...
626
0
import inspect import os import unittest import torch import accelerate from accelerate import debug_launcher from accelerate.test_utils import ( execute_subprocess_async, require_cpu, require_huggingface_suite, require_multi_gpu, require_single_gpu, ) from accelerate.utils import patch_environm...
720
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 torch i...
626
0
import importlib import shutil import threading import warnings from typing import List import fsspec import fsspec.asyn from . import compression from .hffilesystem import HfFileSystem lowerCAmelCase__ = importlib.util.find_spec("""s3fs""") is not None if _has_safs: from .safilesystem import SaFileSystem #...
721
import datasets from .evaluate import evaluate lowerCAmelCase__ = """\ @inproceedings{Rajpurkar2016SQuAD10, title={SQuAD: 100, 000+ Questions for Machine Comprehension of Text}, author={Pranav Rajpurkar and Jian Zhang and Konstantin Lopyrev and Percy Liang}, booktitle={EMNLP}, year={2016} } """ lowerCA...
626
0
import argparse import json from collections import OrderedDict from functools import partial from pathlib import Path import timm import torch from huggingface_hub import hf_hub_download from transformers import LevitConfig, LevitForImageClassificationWithTeacher, LevitImageProcessor from transformers.utils import ...
700
from ..utils import is_flax_available, is_torch_available if is_torch_available(): from .autoencoder_kl import AutoencoderKL from .controlnet import ControlNetModel from .dual_transformer_ad import DualTransformeraDModel from .modeling_utils import ModelMixin from .prior_transformer import PriorTransformer fr...
626
0
from math import factorial lowerCAmelCase__ = {str(d): factorial(d) for d in range(1_0)} def lowerCAmelCase__ ( SCREAMING_SNAKE_CASE_: Dict ) -> int: '''simple docstring''' return sum(DIGIT_FACTORIAL[d] for d in str(_SCREAMING_SNAKE_CASE ) ) def l...
701
from math import factorial def lowerCAmelCase__ ( SCREAMING_SNAKE_CASE_: int = 1_0_0 ) -> int: '''simple docstring''' return sum(map(SCREAMING_SNAKE_CASE_ , str(factorial(SCREAMING_SNAKE_CASE_ ) ) ) ) if __name__ == "__main__": print(soluti...
626
0
import os import zipfile import pytest from datasets.utils.extract import ( BzipaExtractor, Extractor, GzipExtractor, LzaExtractor, SevenZipExtractor, TarExtractor, XzExtractor, ZipExtractor, ZstdExtractor, ) from .utils import require_lza, require_pyazr, require_zstandard @p...
702
lowerCAmelCase__ = """ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/""" def lowerCAmelCase__ ( SCREAMING_SNAKE_CASE_: bytes ) -> bytes: '''simple docstring''' if not isinstance(SCREAMING_SNAKE_CASE_ , SCREAMING_SNAKE_CASE_ ): A__...
626
0
import math import tensorflow as tf from packaging import version def lowerCAmelCase__ ( SCREAMING_SNAKE_CASE_: Dict ) -> List[Any]: '''simple docstring''' A__ = tf.convert_to_tensor(lowerCAmelCase_ ) A__ = 0.5 * (1.0 + tf.math.erf(x / tf.ca...
703
import logging import os import sys from dataclasses import dataclass, field from itertools import chain from typing import Optional, Union import datasets import numpy as np import torch from datasets import load_dataset import transformers from transformers import ( AutoConfig, AutoModelForMultipleChoice,...
626
0
import argparse import requests import torch from PIL import Image from transformers import CLIPProcessor, GroupViTConfig, GroupViTModel def lowerCAmelCase__ ( SCREAMING_SNAKE_CASE_: int ) -> Optional[int]: '''simple docstring''' if "img_encoder.pos_embed" in name: ...
704
def lowerCAmelCase__ ( SCREAMING_SNAKE_CASE_: int ) -> int: '''simple docstring''' if divisor % 5 == 0 or divisor % 2 == 0: return 0 A__ = 1 A__ = 1 while repunit: A__ = (1_0 * repunit + 1) % divisor repunit_i...
626
0
import warnings from ...utils import logging from .image_processing_beit import BeitImageProcessor lowerCAmelCase__ = logging.get_logger(__name__) class a__ ( __SCREAMING_SNAKE_CASE ): """simple docstring""" def __init__( self , *lowercase , **lowercase )...
705
from __future__ import annotations from collections.abc import Iterator from typing import Any class a__ : """simple docstring""" def __init__( self , lowercase ) -> int: '''simple docstring''' A__ = data A__ = None class ...
626
0
import collections import inspect import unittest from typing import Dict, List, Tuple from transformers import MaskFormerSwinConfig from transformers.testing_utils import require_torch, require_torch_multi_gpu, torch_device from transformers.utils import is_torch_available from ...test_backbone_common import Backb...
706
import math lowerCAmelCase__ = 1_0 lowerCAmelCase__ = 7 lowerCAmelCase__ = BALLS_PER_COLOUR * NUM_COLOURS def lowerCAmelCase__ ( SCREAMING_SNAKE_CASE_: int = 2_0 ) -> str: '''simple docstring''' A__ = math.comb(SCREAMING_SNAKE_CASE_ , SCREAMING...
626
0