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 math import factorial A__ : Optional[int] = {str(digit): factorial(digit) for digit in range(10)} def a ( lowerCamelCase_ ): '''simple docstring''' if not isinstance(__UpperCamelCase , __UpperCamelCase ): raise TypeError('''Parameter num...
708
class _UpperCAmelCase : """simple docstring""" def __init__( self : Optional[int], lowerCamelCase : Union[str, Any] ): '''simple docstring''' # we need a list not a string, so do something to change the type lowercase__ = arr.split('''...
671
0
import unittest from transformers import DebertaVaTokenizer, DebertaVaTokenizerFast from transformers.testing_utils import get_tests_dir, require_sentencepiece, require_tokenizers, slow from ...test_tokenization_common import TokenizerTesterMixin A__ : str = get_tests_dir('fixtures/spiece.mod...
709
from itertools import count def a ( lowerCamelCase_ = 50 ): '''simple docstring''' lowercase__ = [1] * min_block_length for n in count(lowerCamelCase_ ): fill_count_functions.append(1 ) for block_length in range(lowerCamelCase_ , ...
671
0
import inspect import unittest from transformers import ConvNextConfig from transformers.testing_utils import require_torch, require_vision, slow, torch_device from transformers.utils import cached_property, is_torch_available, is_vision_available from ...test_backbone_common import BackboneTesterMixin from ...test_...
710
import copy from typing import Any, Dict, List, Optional, Union import numpy as np import torch from ...audio_utils import mel_filter_bank, spectrogram, window_function from ...feature_extraction_sequence_utils import SequenceFeatureExtractor from ...feature_extraction_utils import BatchFeature from ...utils i...
671
0
def a ( lowerCamelCase_ ): '''simple docstring''' lowercase__ = abs(__UpperCamelCase ) lowercase__ = 0 while n > 0: res += n % 10 n //= 10 return res def a ( lowerCamelCase_ ): '''simple docstrin...
711
from __future__ import annotations from collections import deque from collections.abc import Sequence from dataclasses import dataclass from typing import Any @dataclass class _UpperCAmelCase : """simple docstring""" lowercase__ = 42 lowercase__ = None lowe...
671
0
def a ( lowerCamelCase_ = 1000 ): '''simple docstring''' lowercase__ = -1 lowercase__ = 0 for a in range(1 , n // 3 ): # Solving the two equations a**2+b**2=c**2 and a+b+c=N eliminating c lowercase__ = (n * n - 2 * a * n...
712
from transformers import DistilBertTokenizer, DistilBertTokenizerFast from transformers.testing_utils import require_tokenizers, slow from ..bert.test_tokenization_bert import BertTokenizationTest @require_tokenizers class _UpperCAmelCase ( A__ ): """simple docstring""" lowercase__ ...
671
0
from __future__ import annotations def a ( lowerCamelCase_ ): '''simple docstring''' lowercase__ = len(__snake_case ) // 2 # choose the middle 3 elements lowercase__ = lst[m - 1 : m + 2] # if middle element is peak if three[1] > th...
713
from __future__ import annotations def a ( lowerCamelCase_ ): '''simple docstring''' lowercase__ = 0.00 lowercase__ = 0 for resistor in resistors: if resistor <= 0: lowercase__ = F"""Resistor at index {index} has a n...
671
0
from typing import TYPE_CHECKING from ....utils import OptionalDependencyNotAvailable, _LazyModule, is_torch_available A__ : Optional[Any] = {'configuration_mmbt': ['MMBTConfig']} try: if not is_torch_available(): raise OptionalDependencyNotAvailable() except OptionalDependencyNotAvaila...
714
import argparse import re import requests import torch # git clone https://github.com/salesforce/BLIP.git from models.blip import blip_decoder from models.blip_itm import blip_itm from models.blip_vqa import blip_vqa from PIL import Image from torchvision import transforms from torchvision.transforms.functiona...
671
0
import importlib import os import sys # This is required to make the module import works (when the python process is running from the root of the repo) sys.path.append('.') def a ( lowerCamelCase_ ): '''simple docstring''' lowercase__ = test_file.split(os.path.sep ...
715
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(): impo...
671
0
import json from typing import Iterator, List, Union from tokenizers import AddedToken, Regex, Tokenizer, decoders, normalizers, pre_tokenizers, trainers from tokenizers.implementations.base_tokenizer import BaseTokenizer from tokenizers.models import Unigram from tokenizers.processors import TemplateProcessing...
716
import argparse import os import re A__ : Optional[int] = 'src/transformers' # Pattern that looks at the indentation in a line. A__ : Union[str, Any] = re.compile(r'^(\s*)\S') # Pattern that matches `"key":" and puts `key` in group 0. A__ : List[str] = re.compil...
671
0
import logging import os import sys from dataclasses import dataclass, field from importlib import import_module from typing import Dict, List, Optional, Tuple import numpy as np from seqeval.metrics import accuracy_score, fa_score, precision_score, recall_score from torch import nn from utils_ner import Split,...
717
from math import sqrt def a ( lowerCamelCase_ ): '''simple docstring''' assert isinstance(lowerCamelCase_ , lowerCamelCase_ ) and ( number >= 0 ), "'number' must been an int and positive" lowercase__ = True # 0 and 1 are none primes. ...
671
0
'''simple docstring''' def a ( lowerCamelCase_ = 50 ): '''simple docstring''' lowercase__ = [[0] * 3 for _ in range(length + 1 )] for row_length in range(length + 1 ): for tile_length in range(2 , 5 ): for tile_start in ...
718
import argparse import re from typing import Dict import torch from datasets import Audio, Dataset, load_dataset, load_metric from transformers import AutoFeatureExtractor, pipeline def a ( lowerCamelCase_ , lowerCamelCase_ ): '''simple docstring''' lowercase__ =...
671
0
from typing import TYPE_CHECKING from ...utils import ( OptionalDependencyNotAvailable, _LazyModule, is_flax_available, is_tf_available, is_tokenizers_available, is_torch_available, ) A__ : Any = { 'configuration_blenderbot': [ 'BLENDERBOT_PRETRAINED_CONFIG_...
719
from functools import reduce A__ : Union[str, Any] = ( '73167176531330624919225119674426574742355349194934' '96983520312774506326239578318016984801869478851843' '85861560789112949495459501737958331952853208805511' '12540698747158523863050715693290963295227443043557' '66896648...
671
0
import itertools import json import os import unittest from transformers import AddedToken, LongformerTokenizer, LongformerTokenizerFast from transformers.models.longformer.tokenization_longformer import VOCAB_FILES_NAMES from transformers.testing_utils import require_tokenizers, slow from ...test_tokenization...
720
# DISCLAIMER: This file is strongly influenced by https://github.com/yang-song/score_sde_pytorch import math from dataclasses import dataclass from typing import Optional, Tuple, Union import torch from ..configuration_utils import ConfigMixin, register_to_config from ..utils import BaseOutput, randn_tensor f...
671
0
from functools import reduce A__ : Optional[Any] = ( '73167176531330624919225119674426574742355349194934' '96983520312774506326239578318016984801869478851843' '85861560789112949495459501737958331952853208805511' '12540698747158523863050715693290963295227443043557' ...
721
from collections import defaultdict from math import gcd def a ( lowerCamelCase_ = 150_0000 ): '''simple docstring''' lowercase__ = defaultdict(lowerCamelCase_ ) lowercase__ = 2 while 2 * euclid_m * (euclid_m + 1) <= limit: for eucli...
671
0
from __future__ import annotations import unittest from transformers import DistilBertConfig, is_tf_available from transformers.testing_utils import require_tf, slow from ...test_configuration_common import ConfigTester from ...test_modeling_tf_common import TFModelTesterMixin, ids_tensor, random_attention_ma...
700
import json from typing import List, Optional, Tuple from tokenizers import normalizers from ...tokenization_utils_fast import PreTrainedTokenizerFast from ...utils import logging from .tokenization_bert import BertTokenizer A__ : Dict = logging.get_logger(__name__) A__ : Dict =...
671
0
from .imports import is_rich_available if is_rich_available(): from rich.traceback import install install(show_locals=False) else: raise ModuleNotFoundError('To use the rich extension, install rich with `pip install rich`')
701
from typing import TYPE_CHECKING from ...utils import ( OptionalDependencyNotAvailable, _LazyModule, is_flax_available, is_tf_available, is_torch_available, ) A__ : Any = {'configuration_unispeech': ['UNISPEECH_PRETRAINED_CONFIG_ARCHIVE_MAP', 'UniSpeechConfig']} try: ...
671
0
import argparse from collections import defaultdict import yaml A__ : Dict = 'docs/source/en/_toctree.yml' def a ( lowerCamelCase_ ): '''simple docstring''' lowercase__ = defaultdict(SCREAMING_SNAKE_CASE_ ) for doc in model_doc: ...
702
import json import os import tempfile import transformers import datasets from utils import generate_example_dataset, get_duration A__ : Dict = 50_00_00 A__ , A__ : str = os.path.split(__file__) A__ : Optional[Any] = os.path.join(RESULTS_BASEPATH, 'res...
671
0
import unittest from transformers import AlbertTokenizer, AlbertTokenizerFast from transformers.testing_utils import get_tests_dir, require_sentencepiece, require_tokenizers, slow from ...test_tokenization_common import TokenizerTesterMixin A__ : List[Any] = get_tests_dir('fixtures/spiece.mod...
703
class _UpperCAmelCase : """simple docstring""" def __init__( self : Optional[int], lowerCamelCase : str = "", lowerCamelCase : bool = False ): '''simple docstring''' # Mapping from the first character of the prefix of the node lowercase...
671
0
from ....utils import logging A__ : List[Any] = logging.get_logger(__name__) class _UpperCAmelCase ( __A ): """simple docstring""" def __init__( self : Any, lowerCamelCase : List[Any], lowerCamelCase : str=None, lowerCamelCase : Union[s...
704
import json import os import shutil import tempfile import unittest import numpy as np import pytest from transformers import MgpstrTokenizer from transformers.models.mgp_str.tokenization_mgp_str import VOCAB_FILES_NAMES from transformers.testing_utils import require_torch, require_vision from transformers.uti...
671
0
from __future__ import annotations import math def a ( lowerCamelCase_ ): '''simple docstring''' if 1 < number < 4: # 2 and 3 are primes return True elif number < 2 or number % 2 == 0 or number % 3 == 0: # Negatives, 0, 1, all even numbers, all mu...
705
def a ( lowerCamelCase_ , lowerCamelCase_ , lowerCamelCase_ ): '''simple docstring''' if exponent == 1: return base if exponent % 2 == 0: lowercase__ = _modexpt(lowerCamelCase_ , exponent // 2 , lowerCamelCase_ ) % modulo_value ...
671
0
import inspect import math import tempfile import unittest import numpy as np from transformers import ViTMAEConfig from transformers.testing_utils import require_torch, require_vision, slow, torch_device from transformers.utils import cached_property, is_torch_available, is_vision_available from ...test_configu...
706
import inspect from typing import Callable, List, Optional, Union import torch from transformers import ( CLIPImageProcessor, CLIPTextModel, CLIPTokenizer, WhisperForConditionalGeneration, WhisperProcessor, ) from diffusers import ( AutoencoderKL, DDIMScheduler, DiffusionPipelin...
671
0
import asyncio import os import re import sys import tempfile import unittest from contextlib import contextmanager from copy import deepcopy from distutils.util import strtobool from enum import Enum from importlib.util import find_spec from pathlib import Path from unittest.mock import patch import pyarrow as...
707
from __future__ import annotations from collections import deque from collections.abc import Iterator from dataclasses import dataclass @dataclass class _UpperCAmelCase : """simple docstring""" lowercase__ = 42 lowercase__ = 42 class _UpperCAmelCase ...
671
0
import importlib import os import fsspec import pytest from fsspec import register_implementation from fsspec.registry import _registry as _fsspec_registry from datasets.filesystems import COMPRESSION_FILESYSTEMS, HfFileSystem, extract_path_from_uri, is_remote_filesystem from .utils import require_lza, requir...
708
class _UpperCAmelCase : """simple docstring""" def __init__( self : Optional[int], lowerCamelCase : Union[str, Any] ): '''simple docstring''' # we need a list not a string, so do something to change the type lowercase__ = arr.split('''...
671
0
import logging import os from logging import ( CRITICAL, # NOQA DEBUG, # NOQA ERROR, # NOQA FATAL, # NOQA INFO, # NOQA NOTSET, # NOQA WARN, # NOQA WARNING, # NOQA ) from typing import Optional from tqdm import auto as tqdm_lib A__ : Tuple = { 'debug'...
709
from itertools import count def a ( lowerCamelCase_ = 50 ): '''simple docstring''' lowercase__ = [1] * min_block_length for n in count(lowerCamelCase_ ): fill_count_functions.append(1 ) for block_length in range(lowerCamelCase_ , ...
671
0
from math import log from scipy.constants import Boltzmann, physical_constants A__ : int = 3_00 # TEMPERATURE (unit = K) def a ( lowerCamelCase_ , lowerCamelCase_ , lowerCamelCase_ , ): '''simple docstring''' if donor_conc <= 0: raise ValueError...
710
import copy from typing import Any, Dict, List, Optional, Union import numpy as np import torch from ...audio_utils import mel_filter_bank, spectrogram, window_function from ...feature_extraction_sequence_utils import SequenceFeatureExtractor from ...feature_extraction_utils import BatchFeature from ...utils i...
671
0
def a ( lowerCamelCase_ ): '''simple docstring''' lowercase__ = len(lowerCamelCase_ ) for _ in range(lowerCamelCase_ ): for i in range(_ % 2 , arr_size - 1 , 2 ): if arr[i + 1] < arr[i]: lowercase__ ...
711
from __future__ import annotations from collections import deque from collections.abc import Sequence from dataclasses import dataclass from typing import Any @dataclass class _UpperCAmelCase : """simple docstring""" lowercase__ = 42 lowercase__ = None lowe...
671
0
import argparse import json import os from collections import OrderedDict import numpy as np import tensorflow as tf import torch def a ( lowerCamelCase_ ): '''simple docstring''' lowercase__ = os.path.join(args.tf_model_dir , '''parameters.json''' ) lowe...
712
from transformers import DistilBertTokenizer, DistilBertTokenizerFast from transformers.testing_utils import require_tokenizers, slow from ..bert.test_tokenization_bert import BertTokenizationTest @require_tokenizers class _UpperCAmelCase ( A__ ): """simple docstring""" lowercase__ ...
671
0
import json from typing import List, Optional, Tuple from tokenizers import normalizers from ...tokenization_utils_base import BatchEncoding from ...tokenization_utils_fast import PreTrainedTokenizerFast from ...utils import PaddingStrategy, logging from .tokenization_realm import RealmTokenizer A__ : O...
713
from __future__ import annotations def a ( lowerCamelCase_ ): '''simple docstring''' lowercase__ = 0.00 lowercase__ = 0 for resistor in resistors: if resistor <= 0: lowercase__ = F"""Resistor at index {index} has a n...
671
0
from math import isqrt def a ( lowerCamelCase_ ): '''simple docstring''' lowercase__ = [True] * max_number for i in range(2 , isqrt(max_number - 1 ) + 1 ): if is_prime[i]: for j in range(i**2 , A__ , A__ ): ...
714
import argparse import re import requests import torch # git clone https://github.com/salesforce/BLIP.git from models.blip import blip_decoder from models.blip_itm import blip_itm from models.blip_vqa import blip_vqa from PIL import Image from torchvision import transforms from torchvision.transforms.functiona...
671
0
import os import pytest import yaml from datasets.features.features import Features, Value from datasets.info import DatasetInfo, DatasetInfosDict @pytest.mark.parametrize( '''files''' , [ ['''full:README.md''', '''dataset_infos.json'''], ['''empty:README.md''', '''dataset_infos.json'...
715
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(): impo...
671
0
import enum import warnings from ..tokenization_utils import TruncationStrategy from ..utils import add_end_docstrings, is_tf_available, is_torch_available, logging from .base import PIPELINE_INIT_ARGS, Pipeline if is_tf_available(): import tensorflow as tf from ..models.auto.modeling_tf_auto i...
716
import argparse import os import re A__ : Optional[int] = 'src/transformers' # Pattern that looks at the indentation in a line. A__ : Union[str, Any] = re.compile(r'^(\s*)\S') # Pattern that matches `"key":" and puts `key` in group 0. A__ : List[str] = re.compil...
671
0
import tempfile import unittest from make_student import create_student_by_copying_alternating_layers from transformers import AutoConfig from transformers.file_utils import cached_property from transformers.testing_utils import require_torch A__ : Tuple = 'sshleifer/bart-tiny-random' A__ :...
717
from math import sqrt def a ( lowerCamelCase_ ): '''simple docstring''' assert isinstance(lowerCamelCase_ , lowerCamelCase_ ) and ( number >= 0 ), "'number' must been an int and positive" lowercase__ = True # 0 and 1 are none primes. ...
671
0
'''simple docstring''' from timeit import timeit def a ( lowerCamelCase_ ): '''simple docstring''' if number < 0: raise ValueError('''the value of input must not be negative''' ) lowercase__ = 0 while number: number &= number...
718
import argparse import re from typing import Dict import torch from datasets import Audio, Dataset, load_dataset, load_metric from transformers import AutoFeatureExtractor, pipeline def a ( lowerCamelCase_ , lowerCamelCase_ ): '''simple docstring''' lowercase__ =...
671
0
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_PRETRAINED_CONFIG_ARCHIVE_MAP, DPR_CONTEXT_E...
719
from functools import reduce A__ : Union[str, Any] = ( '73167176531330624919225119674426574742355349194934' '96983520312774506326239578318016984801869478851843' '85861560789112949495459501737958331952853208805511' '12540698747158523863050715693290963295227443043557' '66896648...
671
0
import unittest from transformers import PegasusConfig, PegasusTokenizer, is_flax_available from transformers.testing_utils import require_flax, slow from ...test_configuration_common import ConfigTester from ...test_modeling_flax_common import FlaxModelTesterMixin, ids_tensor if is_flax_available(): ...
720
# DISCLAIMER: This file is strongly influenced by https://github.com/yang-song/score_sde_pytorch import math from dataclasses import dataclass from typing import Optional, Tuple, Union import torch from ..configuration_utils import ConfigMixin, register_to_config from ..utils import BaseOutput, randn_tensor f...
671
0
import numpy as np def a ( lowerCamelCase_ , lowerCamelCase_ ): '''simple docstring''' return np.where(vector > 0 , lowerCamelCase_ , (alpha * (np.exp(lowerCamelCase_ ) - 1)) ) if __name__ == "__main__": import doctest...
721
from collections import defaultdict from math import gcd def a ( lowerCamelCase_ = 150_0000 ): '''simple docstring''' lowercase__ = defaultdict(lowerCamelCase_ ) lowercase__ = 2 while 2 * euclid_m * (euclid_m + 1) <= limit: for eucli...
671
0
import os from pathlib import Path def a ( ): '''simple docstring''' from torch.utils.cpp_extension import load lowercase__ = Path(lowerCamelCase_ ).resolve().parent.parent.parent / '''kernels''' / '''deformable_detr''' lowercase__ = [ ro...
700
import json from typing import List, Optional, Tuple from tokenizers import normalizers from ...tokenization_utils_fast import PreTrainedTokenizerFast from ...utils import logging from .tokenization_bert import BertTokenizer A__ : Dict = logging.get_logger(__name__) A__ : Dict =...
671
0
import argparse import re import torch from CLAP import create_model from transformers import AutoFeatureExtractor, ClapConfig, ClapModel A__ : int = { 'text_branch': 'text_model', 'audio_branch': 'audio_model.audio_encoder', 'attn': 'attention.self', 'self.proj': 'output.dens...
701
from typing import TYPE_CHECKING from ...utils import ( OptionalDependencyNotAvailable, _LazyModule, is_flax_available, is_tf_available, is_torch_available, ) A__ : Any = {'configuration_unispeech': ['UNISPEECH_PRETRAINED_CONFIG_ARCHIVE_MAP', 'UniSpeechConfig']} try: ...
671
0
def a ( lowerCamelCase_ , lowerCamelCase_ ): '''simple docstring''' lowercase__ = [0 for i in range(r + 1 )] # nc0 = 1 lowercase__ = 1 for i in range(1 , n + 1 ): # to compute current row from previous row. lowerc...
702
import json import os import tempfile import transformers import datasets from utils import generate_example_dataset, get_duration A__ : Dict = 50_00_00 A__ , A__ : str = os.path.split(__file__) A__ : Optional[Any] = os.path.join(RESULTS_BASEPATH, 'res...
671
0
from ..models.auto import AutoModelForSeqaSeqLM, AutoTokenizer from .base import PipelineTool A__ : List[str] = { "Acehnese Arabic": "ace_Arab", "Acehnese Latin": "ace_Latn", "Mesopotamian Arabic": "acm_Arab", "Ta'izzi-Adeni Arabic": "acq_Arab", "Tunisian Arabic": "aeb_Arab"...
703
class _UpperCAmelCase : """simple docstring""" def __init__( self : Optional[int], lowerCamelCase : str = "", lowerCamelCase : bool = False ): '''simple docstring''' # Mapping from the first character of the prefix of the node lowercase...
671
0
from __future__ import annotations from collections.abc import Callable from typing import Generic, TypeVar A__ : Union[str, Any] = TypeVar('T') A__ : Any = TypeVar('U') class _UpperCAmelCase ( Generic[T, U] ): """simple docstring""" def __init__( self :...
704
import json import os import shutil import tempfile import unittest import numpy as np import pytest from transformers import MgpstrTokenizer from transformers.models.mgp_str.tokenization_mgp_str import VOCAB_FILES_NAMES from transformers.testing_utils import require_torch, require_vision from transformers.uti...
671
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 ...
705
def a ( lowerCamelCase_ , lowerCamelCase_ , lowerCamelCase_ ): '''simple docstring''' if exponent == 1: return base if exponent % 2 == 0: lowercase__ = _modexpt(lowerCamelCase_ , exponent // 2 , lowerCamelCase_ ) % modulo_value ...
671
0
# Copyright 2023 The HuggingFace Inc. team. All rights reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by ...
706
import inspect from typing import Callable, List, Optional, Union import torch from transformers import ( CLIPImageProcessor, CLIPTextModel, CLIPTokenizer, WhisperForConditionalGeneration, WhisperProcessor, ) from diffusers import ( AutoencoderKL, DDIMScheduler, DiffusionPipelin...
671
0
import argparse import os import pickle import sys import torch from transformers import TransfoXLConfig, TransfoXLLMHeadModel, load_tf_weights_in_transfo_xl from transformers.models.transfo_xl import tokenization_transfo_xl as data_utils from transformers.models.transfo_xl.tokenization_transfo_xl import CORPU...
707
from __future__ import annotations from collections import deque from collections.abc import Iterator from dataclasses import dataclass @dataclass class _UpperCAmelCase : """simple docstring""" lowercase__ = 42 lowercase__ = 42 class _UpperCAmelCase ...
671
0
from typing import TYPE_CHECKING from ...utils import OptionalDependencyNotAvailable, _LazyModule, is_tf_available, is_torch_available A__ : List[Any] = { 'configuration_ctrl': ['CTRL_PRETRAINED_CONFIG_ARCHIVE_MAP', 'CTRLConfig'], 'tokenization_ctrl': ['CTRLTokenizer'], } try: ...
708
class _UpperCAmelCase : """simple docstring""" def __init__( self : Optional[int], lowerCamelCase : Union[str, Any] ): '''simple docstring''' # we need a list not a string, so do something to change the type lowercase__ = arr.split('''...
671
0
import os from shutil import copyfile from typing import Any, Dict, List, Optional, Tuple import sentencepiece as spm from ...tokenization_utils import PreTrainedTokenizer from ...utils import logging A__ : Optional[Any] = logging.get_logger(__name__) A__ : Union[str, Any] = ...
709
from itertools import count def a ( lowerCamelCase_ = 50 ): '''simple docstring''' lowercase__ = [1] * min_block_length for n in count(lowerCamelCase_ ): fill_count_functions.append(1 ) for block_length in range(lowerCamelCase_ , ...
671
0
from typing import TYPE_CHECKING from ...utils import OptionalDependencyNotAvailable, _LazyModule, is_torch_available, is_vision_available A__ : str = { 'configuration_chinese_clip': [ 'CHINESE_CLIP_PRETRAINED_CONFIG_ARCHIVE_MAP', 'ChineseCLIPConfig', 'ChineseCLIPOnnxConf...
710
import copy from typing import Any, Dict, List, Optional, Union import numpy as np import torch from ...audio_utils import mel_filter_bank, spectrogram, window_function from ...feature_extraction_sequence_utils import SequenceFeatureExtractor from ...feature_extraction_utils import BatchFeature from ...utils i...
671
0
from typing import Dict from .base import GenericTensor, Pipeline class _UpperCAmelCase ( lowercase_ ): """simple docstring""" def lowercase__ ( self : List[Any], lowerCamelCase : str=None, lowerCamelCase : List[Any]=None, lowerCamelCase : Li...
711
from __future__ import annotations from collections import deque from collections.abc import Sequence from dataclasses import dataclass from typing import Any @dataclass class _UpperCAmelCase : """simple docstring""" lowercase__ = 42 lowercase__ = None lowe...
671
0
import sys A__ : Union[str, Any] = ( "73167176531330624919225119674426574742355349194934" "96983520312774506326239578318016984801869478851843" "85861560789112949495459501737958331952853208805511" "12540698747158523863050715693290963295227443043557" "668966489504452445231617318564...
712
from transformers import DistilBertTokenizer, DistilBertTokenizerFast from transformers.testing_utils import require_tokenizers, slow from ..bert.test_tokenization_bert import BertTokenizationTest @require_tokenizers class _UpperCAmelCase ( A__ ): """simple docstring""" lowercase__ ...
671
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__ : Optional[Any] = { 'BAAI/AltCLIP': 'https://huggingface.co/BAAI/AltCLIP/resolve/main/conf...
713
from __future__ import annotations def a ( lowerCamelCase_ ): '''simple docstring''' lowercase__ = 0.00 lowercase__ = 0 for resistor in resistors: if resistor <= 0: lowercase__ = F"""Resistor at index {index} has a n...
671
0
import os import tempfile import unittest from transformers import is_torch_available from transformers.testing_utils import require_torch if is_torch_available(): import torch from torch import nn from transformers import ( Adafactor, AdamW, get_constant_schedule, get_constant_...
714
import argparse import re import requests import torch # git clone https://github.com/salesforce/BLIP.git from models.blip import blip_decoder from models.blip_itm import blip_itm from models.blip_vqa import blip_vqa from PIL import Image from torchvision import transforms from torchvision.transforms.functiona...
671
0
from typing import Callable, Optional from .. import Features from ..packaged_modules.generator.generator import Generator from .abc import AbstractDatasetInputStream class _UpperCAmelCase ( A__ ): """simple docstring""" def __init__( self : Union[str, Any], lowerCamelCase : ...
715
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(): impo...
671
0
import io import math from typing import Dict, Optional, Union import numpy as np from huggingface_hub import hf_hub_download from ...image_processing_utils import BaseImageProcessor, BatchFeature from ...image_transforms import convert_to_rgb, normalize, to_channel_dimension_format, to_pil_image from ...image...
716
import argparse import os import re A__ : Optional[int] = 'src/transformers' # Pattern that looks at the indentation in a line. A__ : Union[str, Any] = re.compile(r'^(\s*)\S') # Pattern that matches `"key":" and puts `key` in group 0. A__ : List[str] = re.compil...
671
0
import warnings from ...utils import logging from .image_processing_clip import CLIPImageProcessor A__ : str = logging.get_logger(__name__) class _UpperCAmelCase ( __UpperCAmelCase ): """simple docstring""" def __init__( self : Tuple, *lowerCamelCase : Op...
717
from math import sqrt def a ( lowerCamelCase_ ): '''simple docstring''' assert isinstance(lowerCamelCase_ , lowerCamelCase_ ) and ( number >= 0 ), "'number' must been an int and positive" lowercase__ = True # 0 and 1 are none primes. ...
671
0
'''simple docstring''' from collections import OrderedDict from typing import Mapping from ...configuration_utils import PretrainedConfig from ...onnx import OnnxConfig from ...utils import logging A__ : Optional[int] = logging.get_logger(__name__) A__ : Optional[int] = {...
718
import argparse import re from typing import Dict import torch from datasets import Audio, Dataset, load_dataset, load_metric from transformers import AutoFeatureExtractor, pipeline def a ( lowerCamelCase_ , lowerCamelCase_ ): '''simple docstring''' lowercase__ =...
671
0
from typing import List import numpy as np def a ( lowerCamelCase_ ): '''simple docstring''' lowercase__ = {key: len(snake_case_ ) for key, value in gen_kwargs.items() if isinstance(snake_case_ , snake_case_ )} if len(set(lists_lengths.values...
719
from functools import reduce A__ : Union[str, Any] = ( '73167176531330624919225119674426574742355349194934' '96983520312774506326239578318016984801869478851843' '85861560789112949495459501737958331952853208805511' '12540698747158523863050715693290963295227443043557' '66896648...
671
0
import torch import torch.nn as nn from transformers.modeling_utils import ModuleUtilsMixin from transformers.models.ta.modeling_ta import TaBlock, TaConfig, TaLayerNorm from ...configuration_utils import ConfigMixin, register_to_config from ...models import ModelMixin class _UpperCAmelCase ( lowercase_...
720
# DISCLAIMER: This file is strongly influenced by https://github.com/yang-song/score_sde_pytorch import math from dataclasses import dataclass from typing import Optional, Tuple, Union import torch from ..configuration_utils import ConfigMixin, register_to_config from ..utils import BaseOutput, randn_tensor f...
671
0
import os import unicodedata from shutil import copyfile from typing import Any, Dict, List, Optional, Tuple import sentencepiece as spm from ...tokenization_utils import AddedToken, PreTrainedTokenizer from ...utils import logging A__ : List[Any] = logging.get_logger(__name...
721
from collections import defaultdict from math import gcd def a ( lowerCamelCase_ = 150_0000 ): '''simple docstring''' lowercase__ = defaultdict(lowerCamelCase_ ) lowercase__ = 2 while 2 * euclid_m * (euclid_m + 1) <= limit: for eucli...
671
0
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, ) A__ : Union[str, Any] = {'configuration_mbart': ['MBAR...
700
import json from typing import List, Optional, Tuple from tokenizers import normalizers from ...tokenization_utils_fast import PreTrainedTokenizerFast from ...utils import logging from .tokenization_bert import BertTokenizer A__ : Dict = logging.get_logger(__name__) A__ : Dict =...
671
0
import tempfile import torch from diffusers import PNDMScheduler from .test_schedulers import SchedulerCommonTest class _UpperCAmelCase ( A__ ): """simple docstring""" lowercase__ = (PNDMScheduler,) lowercase__ = (("""num_inference_steps""", 50),) d...
701
from typing import TYPE_CHECKING from ...utils import ( OptionalDependencyNotAvailable, _LazyModule, is_flax_available, is_tf_available, is_torch_available, ) A__ : Any = {'configuration_unispeech': ['UNISPEECH_PRETRAINED_CONFIG_ARCHIVE_MAP', 'UniSpeechConfig']} try: ...
671
0
from typing import TYPE_CHECKING from ...utils import ( OptionalDependencyNotAvailable, _LazyModule, is_tokenizers_available, is_torch_available, is_vision_available, ) A__ : Optional[int] = { 'configuration_perceiver': ['PERCEIVER_PRETRAINED_CONFIG_ARCHIVE_MAP', 'Perce...
702
import json import os import tempfile import transformers import datasets from utils import generate_example_dataset, get_duration A__ : Dict = 50_00_00 A__ , A__ : str = os.path.split(__file__) A__ : Optional[Any] = os.path.join(RESULTS_BASEPATH, 'res...
671
0
from transformers import BertTokenizerFast from .custom_tokenization import CustomTokenizer class _UpperCAmelCase ( A__ ): """simple docstring""" lowercase__ = CustomTokenizer pass
703
class _UpperCAmelCase : """simple docstring""" def __init__( self : Optional[int], lowerCamelCase : str = "", lowerCamelCase : bool = False ): '''simple docstring''' # Mapping from the first character of the prefix of the node lowercase...
671
0
import tempfile import torch from diffusers import ( DEISMultistepScheduler, DPMSolverMultistepScheduler, DPMSolverSinglestepScheduler, UniPCMultistepScheduler, ) from .test_schedulers import SchedulerCommonTest class _UpperCAmelCase ( A__ ): """simple docstring""" lower...
704
import json import os import shutil import tempfile import unittest import numpy as np import pytest from transformers import MgpstrTokenizer from transformers.models.mgp_str.tokenization_mgp_str import VOCAB_FILES_NAMES from transformers.testing_utils import require_torch, require_vision from transformers.uti...
671
0
import itertools import random import unittest import numpy as np from transformers import BatchFeature, SpeechTaFeatureExtractor from transformers.testing_utils import require_torch from transformers.utils.import_utils import is_torch_available from ...test_sequence_feature_extraction_common import SequenceF...
705
def a ( lowerCamelCase_ , lowerCamelCase_ , lowerCamelCase_ ): '''simple docstring''' if exponent == 1: return base if exponent % 2 == 0: lowercase__ = _modexpt(lowerCamelCase_ , exponent // 2 , lowerCamelCase_ ) % modulo_value ...
671
0
# This script creates a super tiny model that is useful inside tests, when we just want to test that # the machinery works, without needing to the check the quality of the outcomes. # # This version creates a tiny model through reduction of a normal pre-trained model, but keeping the # full vocab, merges file, and ...
706
import inspect from typing import Callable, List, Optional, Union import torch from transformers import ( CLIPImageProcessor, CLIPTextModel, CLIPTokenizer, WhisperForConditionalGeneration, WhisperProcessor, ) from diffusers import ( AutoencoderKL, DDIMScheduler, DiffusionPipelin...
671
0
import json import os import tempfile import unittest import unittest.mock as mock from pathlib import Path from requests.exceptions import HTTPError from transformers.utils import ( CONFIG_NAME, FLAX_WEIGHTS_NAME, TF2_WEIGHTS_NAME, TRANSFORMERS_CACHE, WEIGHTS_NAME, cached_file, get...
707
from __future__ import annotations from collections import deque from collections.abc import Iterator from dataclasses import dataclass @dataclass class _UpperCAmelCase : """simple docstring""" lowercase__ = 42 lowercase__ = 42 class _UpperCAmelCase ...
671
0
import os A__ : List[str] = {'I': 1, 'V': 5, 'X': 10, 'L': 50, 'C': 1_00, 'D': 5_00, 'M': 10_00} def a ( lowerCamelCase_ ): '''simple docstring''' lowercase__ = 0 lowercase__ = 0 while index < len(lowerCamelCase_ ) - 1: ...
708
class _UpperCAmelCase : """simple docstring""" def __init__( self : Optional[int], lowerCamelCase : Union[str, Any] ): '''simple docstring''' # we need a list not a string, so do something to change the type lowercase__ = arr.split('''...
671
0
from typing import List, Optional, Union from ...processing_utils import ProcessorMixin from ...tokenization_utils_base import BatchEncoding, PaddingStrategy, PreTokenizedInput, TextInput, TruncationStrategy from ...utils import TensorType class _UpperCAmelCase ( A__ ): """simple docstring""" ...
709
from itertools import count def a ( lowerCamelCase_ = 50 ): '''simple docstring''' lowercase__ = [1] * min_block_length for n in count(lowerCamelCase_ ): fill_count_functions.append(1 ) for block_length in range(lowerCamelCase_ , ...
671
0
import unittest from transformers import BarthezTokenizer, BarthezTokenizerFast, BatchEncoding from transformers.testing_utils import require_sentencepiece, require_tokenizers, require_torch, slow from ...test_tokenization_common import TokenizerTesterMixin @require_tokenizers @require_sentencepiece @slow # see htt...
710
import copy from typing import Any, Dict, List, Optional, Union import numpy as np import torch from ...audio_utils import mel_filter_bank, spectrogram, window_function from ...feature_extraction_sequence_utils import SequenceFeatureExtractor from ...feature_extraction_utils import BatchFeature from ...utils i...
671
0
from typing import TYPE_CHECKING from ...utils import OptionalDependencyNotAvailable, _LazyModule, is_torch_available, is_vision_available A__ : Tuple = { 'configuration_chinese_clip': [ 'CHINESE_CLIP_PRETRAINED_CONFIG_ARCHIVE_MAP', 'ChineseCLIPConfig', 'ChineseCLIP...
711
from __future__ import annotations from collections import deque from collections.abc import Sequence from dataclasses import dataclass from typing import Any @dataclass class _UpperCAmelCase : """simple docstring""" lowercase__ = 42 lowercase__ = None lowe...
671
0
def a ( lowerCamelCase_ ): '''simple docstring''' if not isinstance(lowerCamelCase_ , lowerCamelCase_ ): raise TypeError('''only integers accepted as input''' ) else: lowercase__ = str(abs(lowerCamelCase_ ) ) lowercase_...
712
from transformers import DistilBertTokenizer, DistilBertTokenizerFast from transformers.testing_utils import require_tokenizers, slow from ..bert.test_tokenization_bert import BertTokenizationTest @require_tokenizers class _UpperCAmelCase ( A__ ): """simple docstring""" lowercase__ ...
671
0
def a ( lowerCamelCase_ ): '''simple docstring''' lowercase__ = 0 lowercase__ = len(lowerCamelCase_ ) for i in range(n - 1 ): for j in range(i + 1 , lowerCamelCase_ ): if arr[i] > arr[j]: num_in...
713
from __future__ import annotations def a ( lowerCamelCase_ ): '''simple docstring''' lowercase__ = 0.00 lowercase__ = 0 for resistor in resistors: if resistor <= 0: lowercase__ = F"""Resistor at index {index} has a n...
671
0
import math def a ( lowerCamelCase_ ): '''simple docstring''' return math.sqrt(lowerCamelCase_ ) * math.sqrt(lowerCamelCase_ ) == num def a ( lowerCamelCase_ ): '''simple docstring''' lowercase__ = 0 lowercase__ ...
714
import argparse import re import requests import torch # git clone https://github.com/salesforce/BLIP.git from models.blip import blip_decoder from models.blip_itm import blip_itm from models.blip_vqa import blip_vqa from PIL import Image from torchvision import transforms from torchvision.transforms.functiona...
671
0
from __future__ import annotations from collections.abc import Iterator from typing import Any class _UpperCAmelCase : """simple docstring""" def __init__( self : Union[str, Any], lowerCamelCase : Any ): '''simple docstring''' lowercase__ = d...
715
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(): impo...
671
0
def a ( lowerCamelCase_ ): '''simple docstring''' if isinstance(lowerCamelCase_ , lowerCamelCase_ ): raise TypeError('''\'float\' object cannot be interpreted as an integer''' ) if isinstance(lowerCamelCase_ , lowerCamelCase_ ): raise T...
716
import argparse import os import re A__ : Optional[int] = 'src/transformers' # Pattern that looks at the indentation in a line. A__ : Union[str, Any] = re.compile(r'^(\s*)\S') # Pattern that matches `"key":" and puts `key` in group 0. A__ : List[str] = re.compil...
671
0
from collections import OrderedDict from typing import Mapping from packaging import version from ...configuration_utils import PretrainedConfig from ...onnx import OnnxConfig from ...utils import logging A__ : List[str] = logging.get_logger(__name__) A__ : Optional[Any] = { ...
717
from math import sqrt def a ( lowerCamelCase_ ): '''simple docstring''' assert isinstance(lowerCamelCase_ , lowerCamelCase_ ) and ( number >= 0 ), "'number' must been an int and positive" lowercase__ = True # 0 and 1 are none primes. ...
671
0
'''simple docstring''' def a ( ): '''simple docstring''' return 1 def a ( lowerCamelCase_ ): '''simple docstring''' return 0 if x < 0 else two_pence(x - 2 ) + one_pence() def a ( lowerCamelCase_ ): '''simple do...
718
import argparse import re from typing import Dict import torch from datasets import Audio, Dataset, load_dataset, load_metric from transformers import AutoFeatureExtractor, pipeline def a ( lowerCamelCase_ , lowerCamelCase_ ): '''simple docstring''' lowercase__ =...
671
0
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 GradientAccumul...
719
from functools import reduce A__ : Union[str, Any] = ( '73167176531330624919225119674426574742355349194934' '96983520312774506326239578318016984801869478851843' '85861560789112949495459501737958331952853208805511' '12540698747158523863050715693290963295227443043557' '66896648...
671
0
from __future__ import annotations import inspect import unittest from math import floor import numpy as np from transformers import CvtConfig from transformers.testing_utils import require_tf, require_vision, slow from transformers.utils import cached_property, is_tf_available, is_vision_available from ...t...
720
# DISCLAIMER: This file is strongly influenced by https://github.com/yang-song/score_sde_pytorch import math from dataclasses import dataclass from typing import Optional, Tuple, Union import torch from ..configuration_utils import ConfigMixin, register_to_config from ..utils import BaseOutput, randn_tensor f...
671
0
A__ : int = { 'A': ['B', 'C', 'E'], 'B': ['A', 'D', 'E'], 'C': ['A', 'F', 'G'], 'D': ['B'], 'E': ['A', 'B', 'D'], 'F': ['C'], 'G': ['C'], } def a ( lowerCamelCase_ , lowerCamelCase_ , lowerCamelCase_ ): ...
721
from collections import defaultdict from math import gcd def a ( lowerCamelCase_ = 150_0000 ): '''simple docstring''' lowercase__ = defaultdict(lowerCamelCase_ ) lowercase__ = 2 while 2 * euclid_m * (euclid_m + 1) <= limit: for eucli...
671
0
import argparse import os import re A__ : Dict = 'src/transformers/models/auto' # re pattern that matches mapping introductions: # SUPER_MODEL_MAPPING_NAMES = OrderedDict or SUPER_MODEL_MAPPING = OrderedDict A__ : List[Any] = re.compile(r'[A-Z_]+_MAPPING(\s+|_[A-Z_]+\s+)=\s...
700
import json from typing import List, Optional, Tuple from tokenizers import normalizers from ...tokenization_utils_fast import PreTrainedTokenizerFast from ...utils import logging from .tokenization_bert import BertTokenizer A__ : Dict = logging.get_logger(__name__) A__ : Dict =...
671
0
A__ : Optional[int] = frozenset( [ 'prompt', 'height', 'width', 'guidance_scale', 'negative_prompt', 'prompt_embeds', 'negative_prompt_embeds', 'cross_attention_kwargs', ] ) A__ : str = frozenset(['prompt', '...
701
from typing import TYPE_CHECKING from ...utils import ( OptionalDependencyNotAvailable, _LazyModule, is_flax_available, is_tf_available, is_torch_available, ) A__ : Any = {'configuration_unispeech': ['UNISPEECH_PRETRAINED_CONFIG_ARCHIVE_MAP', 'UniSpeechConfig']} try: ...
671
0
from typing import Callable, Optional, Union from ...configuration_utils import PretrainedConfig from ...utils import logging A__ : Dict = logging.get_logger(__name__) A__ : Tuple = { 'microsoft/xprophetnet-large-wiki100-cased': ( 'https://huggingface.co/microsoft/...
702
import json import os import tempfile import transformers import datasets from utils import generate_example_dataset, get_duration A__ : Dict = 50_00_00 A__ , A__ : str = os.path.split(__file__) A__ : Optional[Any] = os.path.join(RESULTS_BASEPATH, 'res...
671
0
from math import asin, atan, cos, radians, sin, sqrt, tan A__ : str = 6_37_81_37.0 A__ : Tuple = 6_35_67_52.31_42_45 A__ : str = 6_37_81_37 def a ( lowerCamelCase_ , lowerCamelCase_ , lowerCamelCase_ , lowerCamelCase_ ): ...
703
class _UpperCAmelCase : """simple docstring""" def __init__( self : Optional[int], lowerCamelCase : str = "", lowerCamelCase : bool = False ): '''simple docstring''' # Mapping from the first character of the prefix of the node lowercase...
671
0
from typing import TYPE_CHECKING from ...utils import ( OptionalDependencyNotAvailable, _LazyModule, is_tf_available, is_tokenizers_available, is_torch_available, ) A__ : str = { 'configuration_lxmert': ['LXMERT_PRETRAINED_CONFIG_ARCHIVE_MAP', 'LxmertConfig'], 'toke...
704
import json import os import shutil import tempfile import unittest import numpy as np import pytest from transformers import MgpstrTokenizer from transformers.models.mgp_str.tokenization_mgp_str import VOCAB_FILES_NAMES from transformers.testing_utils import require_torch, require_vision from transformers.uti...
671
0
import unittest import torch from diffusers import DDIMScheduler, DDPMScheduler, UNetaDModel from diffusers.training_utils import set_seed from diffusers.utils.testing_utils import slow A__ : Any = False class _UpperCAmelCase ( unittest.TestCase ): """simple docstring""" ...
705
def a ( lowerCamelCase_ , lowerCamelCase_ , lowerCamelCase_ ): '''simple docstring''' if exponent == 1: return base if exponent % 2 == 0: lowercase__ = _modexpt(lowerCamelCase_ , exponent // 2 , lowerCamelCase_ ) % modulo_value ...
671
0
import inspect import unittest from datasets import load_dataset from packaging import version from transformers import BeitConfig from transformers.models.auto import get_values from transformers.testing_utils import require_torch, require_torch_multi_gpu, require_vision, slow, torch_device from transformers.uti...
706
import inspect from typing import Callable, List, Optional, Union import torch from transformers import ( CLIPImageProcessor, CLIPTextModel, CLIPTokenizer, WhisperForConditionalGeneration, WhisperProcessor, ) from diffusers import ( AutoencoderKL, DDIMScheduler, DiffusionPipelin...
671
0
import gc import random import unittest import numpy as np import torch from PIL import Image from transformers import CLIPTextConfig, CLIPTextModel, CLIPTokenizer from diffusers import ( AutoencoderKL, DDIMScheduler, EulerAncestralDiscreteScheduler, LMSDiscreteScheduler, PNDMScheduler, ...
707
from __future__ import annotations from collections import deque from collections.abc import Iterator from dataclasses import dataclass @dataclass class _UpperCAmelCase : """simple docstring""" lowercase__ = 42 lowercase__ = 42 class _UpperCAmelCase ...
671
0
import os import tempfile from functools import partial from unittest import TestCase from unittest.mock import patch import numpy as np import pytest from datasets.arrow_dataset import Dataset from datasets.search import ElasticSearchIndex, FaissIndex, MissingIndex from .utils import require_elasticsearch, r...
708
class _UpperCAmelCase : """simple docstring""" def __init__( self : Optional[int], lowerCamelCase : Union[str, Any] ): '''simple docstring''' # we need a list not a string, so do something to change the type lowercase__ = arr.split('''...
671
0
import gc import random import unittest import numpy as np import torch from PIL import Image from diffusers import ( DDIMScheduler, KandinskyVaaControlnetImgaImgPipeline, KandinskyVaaPriorEmbaEmbPipeline, UNetaDConditionModel, VQModel, ) from diffusers.utils import floats_tensor, load_imag...
709
from itertools import count def a ( lowerCamelCase_ = 50 ): '''simple docstring''' lowercase__ = [1] * min_block_length for n in count(lowerCamelCase_ ): fill_count_functions.append(1 ) for block_length in range(lowerCamelCase_ , ...
671
0
import io import math from typing import Dict, Optional, Union import numpy as np from huggingface_hub import hf_hub_download from ...image_processing_utils import BaseImageProcessor, BatchFeature from ...image_transforms import convert_to_rgb, normalize, to_channel_dimension_format, to_pil_image from ...image_utils...
710
import copy from typing import Any, Dict, List, Optional, Union import numpy as np import torch from ...audio_utils import mel_filter_bank, spectrogram, window_function from ...feature_extraction_sequence_utils import SequenceFeatureExtractor from ...feature_extraction_utils import BatchFeature from ...utils i...
671
0
import inspect import unittest from transformers import DecisionTransformerConfig, 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_c...
711
from __future__ import annotations from collections import deque from collections.abc import Sequence from dataclasses import dataclass from typing import Any @dataclass class _UpperCAmelCase : """simple docstring""" lowercase__ = 42 lowercase__ = None lowe...
671
0
import logging import os import sys from dataclasses import dataclass, field from typing import Optional import evaluate import numpy as np import torch from datasets import load_dataset from PIL import Image from torchvision.transforms import ( CenterCrop, Compose, Normalize, RandomHorizontalFlip, ...
712
from transformers import DistilBertTokenizer, DistilBertTokenizerFast from transformers.testing_utils import require_tokenizers, slow from ..bert.test_tokenization_bert import BertTokenizationTest @require_tokenizers class _UpperCAmelCase ( A__ ): """simple docstring""" lowercase__ ...
671
0
from datetime import datetime as dt import os from github import Github A__ : Any = [ 'good first issue', 'good second issue', 'good difficult issue', 'feature request', 'new model', 'wip', ] def a ( ): '''simple docstring''' lowercase__ ...
713
from __future__ import annotations def a ( lowerCamelCase_ ): '''simple docstring''' lowercase__ = 0.00 lowercase__ = 0 for resistor in resistors: if resistor <= 0: lowercase__ = F"""Resistor at index {index} has a n...
671
0
import collections import os import re from pathlib import Path A__ : Optional[Any] = 'src/transformers' # Matches is_xxx_available() A__ : List[str] = re.compile(r'is\_([a-z_]*)_available()') # Catches a one-line _import_struct = {xxx} A__ : Any = re.compile(r...
714
import argparse import re import requests import torch # git clone https://github.com/salesforce/BLIP.git from models.blip import blip_decoder from models.blip_itm import blip_itm from models.blip_vqa import blip_vqa from PIL import Image from torchvision import transforms from torchvision.transforms.functiona...
671
0
def a ( lowerCamelCase_ ): '''simple docstring''' lowercase__ = 1 lowercase__ = 2 while i * i <= n: lowercase__ = 0 while n % i == 0: n //= i multiplicity += 1 n_divisors *= multiplicity + 1 ...
715
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(): impo...
671
0
def a ( lowerCamelCase_ , lowerCamelCase_ ): '''simple docstring''' if digit_amount > 0: return round(number - int(lowerCamelCase_ ) , lowerCamelCase_ ) return number - int(lowerCamelCase_ ) if __name__ == "__main__": print(decimal_isol...
716
import argparse import os import re A__ : Optional[int] = 'src/transformers' # Pattern that looks at the indentation in a line. A__ : Union[str, Any] = re.compile(r'^(\s*)\S') # Pattern that matches `"key":" and puts `key` in group 0. A__ : List[str] = re.compil...
671
0
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...
717
from math import sqrt def a ( lowerCamelCase_ ): '''simple docstring''' assert isinstance(lowerCamelCase_ , lowerCamelCase_ ) and ( number >= 0 ), "'number' must been an int and positive" lowercase__ = True # 0 and 1 are none primes. ...
671
0
'''simple docstring''' from collections import defaultdict from math import gcd def a ( lowerCamelCase_ = 150_0000 ): '''simple docstring''' lowercase__ = defaultdict(lowerCamelCase_ ) lowercase__ = 2 while 2 * euclid_m * (euclid_m + 1)...
718
import argparse import re from typing import Dict import torch from datasets import Audio, Dataset, load_dataset, load_metric from transformers import AutoFeatureExtractor, pipeline def a ( lowerCamelCase_ , lowerCamelCase_ ): '''simple docstring''' lowercase__ =...
671
0
from collections import OrderedDict from typing import Mapping from ...configuration_utils import PretrainedConfig from ...onnx import OnnxConfig from ...utils import logging A__ : Union[str, Any] = logging.get_logger(__name__) A__ : Tuple = { 'YituTech/conv-bert-base': 'h...
719
from functools import reduce A__ : Union[str, Any] = ( '73167176531330624919225119674426574742355349194934' '96983520312774506326239578318016984801869478851843' '85861560789112949495459501737958331952853208805511' '12540698747158523863050715693290963295227443043557' '66896648...
671
0