code
stringlengths
82
54.1k
code_codestyle
int64
0
699
style_context
stringlengths
111
35.6k
style_context_codestyle
int64
0
699
label
int64
0
1
import pytest from datasets.parallel import ParallelBackendConfig, parallel_backend from datasets.utils.py_utils import map_nested from .utils import require_dill_gt_0_3_2, require_joblibspark, require_not_windows def UpperCamelCase ( snake_case__ : Tuple ) -> Dict: # picklable for ...
40
from math import asin, atan, cos, radians, sin, sqrt, tan lowerCAmelCase : Union[str, Any] = 637_8137.0 lowerCAmelCase : int = 635_6752.31_4245 lowerCAmelCase : Union[str, Any] = 6378137 def A_ ( _UpperCAmelCase , _UpperCAmelCase , _Up...
671
0
'''simple docstring''' # coding=utf-8 # Copyright 2023 The HuggingFace Inc. team. # # 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 # ...
41
import argparse import torch from transformers import BertConfig, BertForPreTraining, load_tf_weights_in_bert from transformers.utils import logging logging.set_verbosity_info() def A_ ( _UpperCAmelCase , _UpperCAmelCase , _UpperCAmelCase ): # Initialise PyTorch...
671
0
'''simple docstring''' 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 Batch...
42
import math def A_ ( _UpperCAmelCase ): if 1 < number < 4: # 2 and 3 are primes return True elif number < 2 or number % 2 == 0 or number % 3 == 0: # Negatives, 0, 1, all even numbers, all multiples of 3 are not primes return False ...
671
0
from __future__ import annotations import copy import inspect import json import math import os import tempfile import unittest from importlib import import_module import numpy as np from transformers import ViTMAEConfig from transformers.file_utils import cached_property, is_tf_available, is_vis...
43
import re def A_ ( _UpperCAmelCase ): return [char.split() for char in re.split(R"[^ a-z A-Z 0-9 \s]" , str_ )] def A_ ( _UpperCAmelCase ): SCREAMING_SNAKE_CASE_: int = split_input(str_ ) return "".join( ...
671
0
'''simple docstring''' import os import tempfile import unittest from pathlib import Path from transformers import AutoConfig, is_tf_available from transformers.testing_utils import require_tf if is_tf_available(): import tensorflow as tf from transformers import TensorFlowBenchmark, TensorFlowBenchmarkArg...
44
import copy from ...configuration_utils import PretrainedConfig from ...utils import logging from ..auto.configuration_auto import CONFIG_MAPPING lowerCAmelCase : Union[str, Any] = logging.get_logger(__name__) class __lowercase ( UpperCAmelCase_ ): """simple docstring""" ...
671
0
import unicodedata from dataclasses import dataclass from typing import Optional, Union import numpy as np from transformers.data.data_collator import DataCollatorMixin from transformers.file_utils import PaddingStrategy from transformers.tokenization_utils_base import PreTrainedTokenizerBase def A ( ...
45
import pickle import unittest import torch from accelerate import Accelerator from accelerate.state import AcceleratorState from accelerate.test_utils import require_cpu @require_cpu class __lowercase ( unittest.TestCase ): """simple docstring""" def _SCREAMING_SNAKE_CASE ...
671
0
"""simple docstring""" from typing import TYPE_CHECKING from ...utils import ( OptionalDependencyNotAvailable, _LazyModule, is_flax_available, is_tf_available, is_tokenizers_available, is_torch_available, ) _lowerCAmelCase : List[Any] = { '''configuration_electra'...
46
from itertools import count def A_ ( _UpperCAmelCase = 50 ): SCREAMING_SNAKE_CASE_: Union[str, Any] = [1] * min_block_length for n in count(_UpperCAmelCase ): fill_count_functions.append(1 ) for block_length in range(_UpperCAmelC...
671
0
def UpperCAmelCase__ ( lowerCamelCase_ : str ): if n_term == "": return [] __a : list = [] for temp in range(int(lowerCamelCase_ ) ): series.append(f'''1/{temp + 1}''' if series else '1' ) return series if __name__ =...
47
def A_ ( _UpperCAmelCase ): if not isinstance(_UpperCAmelCase , _UpperCAmelCase ): raise TypeError("only integers accepted as input" ) else: SCREAMING_SNAKE_CASE_: List[Any] = str(abs(_UpperCAmelCase ) ) ...
671
0
'''simple docstring''' import argparse import json import math import os import time import traceback import zipfile from collections import Counter import requests def A ( UpperCamelCase_ : Tuple , UpperCamelCase_ : Optional[int]=None ) -> List[str]: '''simpl...
48
from __future__ import annotations from collections.abc import Iterator from typing import Any class __lowercase : """simple docstring""" def __init__( self : List[str] , lowerCAmelCase__ : Any): SCREAMING_SNAKE_CASE_: Any = data SCREAMING_SN...
671
0
"""simple docstring""" def lowercase__ ( snake_case_ :List[str]=28_123 ): __UpperCAmelCase = [1] * (limit + 1) for i in range(2 , int(limit**0.5 ) + 1 ): sum_divs[i * i] += i for k in range(i + 1 , limit // i + 1 ): sum_divs[k * i] += k + i __...
49
from collections import defaultdict from math import ceil, sqrt def A_ ( _UpperCAmelCase = 1_00_00_00 , _UpperCAmelCase = 10 ): SCREAMING_SNAKE_CASE_: defaultdict = defaultdict(_UpperCAmelCase ) for outer_width in range(3 , (t_limit // 4)...
671
0
'''simple docstring''' from ...configuration_utils import PretrainedConfig from ...utils import logging UpperCamelCase : Optional[Any] = logging.get_logger(__name__) UpperCamelCase : Optional[int] = { 'alibaba-damo/mgp-str-base': 'https://huggingface.co/alibaba-damo/mgp-st...
50
from typing import TYPE_CHECKING from ...utils import OptionalDependencyNotAvailable, _LazyModule, is_tf_available, is_torch_available lowerCAmelCase : str = { """configuration_xlm""": ["""XLM_PRETRAINED_CONFIG_ARCHIVE_MAP""", """XLMConfig""", """XLMOnnxConfig"""], """tokenization_xlm""": [""...
671
0
'''simple docstring''' import numpy as np import pandas as pd from sklearn.preprocessing import MinMaxScaler from tensorflow.keras.layers import LSTM, Dense from tensorflow.keras.models import Sequential if __name__ == "__main__": a__ : Optional[Any] = pd.read_csv('sample_data.csv', ...
51
lowerCAmelCase : List[str] = { """A""": ["""B""", """C""", """E"""], """B""": ["""A""", """D""", """E"""], """C""": ["""A""", """F""", """G"""], """D""": ["""B"""], """E""": ["""A""", """B""", """D"""], """F""": ["""C"""], """G""": ["""C"""], } def A_ ( _Upp...
671
0
"""simple docstring""" from __future__ import annotations from typing import Any def __A ( a_ :list[Any]) -> None: create_state_space_tree(a_ , [] , 0) def __A ( a_ :list[Any] , a_ :list[Any] , a_ :int) -> None: ...
52
from __future__ import annotations from math import pi from typing import Protocol import matplotlib.pyplot as plt import numpy as np class __lowercase ( UpperCAmelCase_ ): """simple docstring""" def _SCREAMING_SNAKE_CASE ( self : List[Any] , lowerCAmelCase__ ...
671
0
from dataclasses import dataclass from typing import Optional import torch from torch import nn from ..configuration_utils import ConfigMixin, register_to_config from ..utils import BaseOutput from .attention import BasicTransformerBlock from .modeling_utils import ModelMixin @dataclass class _UpperCA...
53
from __future__ import annotations from math import ceil, floor, sqrt def A_ ( _UpperCAmelCase = 2_00_00_00 ): SCREAMING_SNAKE_CASE_: list[int] = [0] SCREAMING_SNAKE_CASE_: int for idx in range(1 , ceil(sqrt(target * 2 ) * 1.1 ) ...
671
0
import heapq def a__ ( lowercase__ ): '''simple docstring''' UpperCAmelCase_ =[] # 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 Priority Queue ...
54
from typing import TYPE_CHECKING from ...utils import ( OptionalDependencyNotAvailable, _LazyModule, is_tf_available, is_tokenizers_available, is_torch_available, ) lowerCAmelCase : Optional[int] = { """configuration_longformer""": [ """LONGFORMER_PRETRAINED_CONFIG_ARC...
671
0
from collections import namedtuple import requests from lxml import html # type: ignore SCREAMING_SNAKE_CASE :int = namedtuple('covid_data', 'cases deaths recovered') def UpperCAmelCase ( a_ = "https://www.worldometers.info/coronavirus/" ) -> covid_data: """simple...
55
import argparse import os.path as osp import re import torch from safetensors.torch import load_file, save_file # =================# # UNet Conversion # # =================# lowerCAmelCase : Optional[int] = [ # (stable-diffusion, HF Diffusers) ("""time_embed.0.weight""", """time_embedding.li...
671
0
'''simple docstring''' from math import cos, sin, sqrt, tau from audio_filters.iir_filter import IIRFilter def _a (lowercase__ : int , lowercase__ : int , lowercase__ : float = 1 / sqrt(2 ) ) -> IIRFilter: """simple docstring""" __snake_case ...
56
from typing import Callable, Optional, Union from ...configuration_utils import PretrainedConfig from ...utils import logging lowerCAmelCase : int = logging.get_logger(__name__) lowerCAmelCase : Dict = { """microsoft/xprophetnet-large-wiki100-cased""": ( """https://huggingf...
671
0
import gc import unittest from diffusers import FlaxControlNetModel, FlaxStableDiffusionControlNetPipeline from diffusers.utils import is_flax_available, load_image, slow from diffusers.utils.testing_utils import require_flax if is_flax_available(): import jax import jax.numpy as jnp ...
57
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 rescale, resize, to_channel_dimension_format from ...image_utils import ( ChannelDimension, ImageInput, PILImageResampli...
671
0
"""simple docstring""" from .glue import glue_convert_examples_to_features, glue_output_modes, glue_processors, glue_tasks_num_labels from .squad import SquadExample, SquadFeatures, SquadVaProcessor, SquadVaProcessor, squad_convert_examples_to_features from .utils import DataProcessor, InputExample...
58
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 import BertTokenizer lowerCAmelCase : Optional[int] = logging.get_logger(__...
671
0
from __future__ import annotations from collections.abc import Callable from typing import Any, Generic, TypeVar __A = TypeVar("T") class _SCREAMING_SNAKE_CASE ( Generic[T] ): '''simple docstring''' def __init__(self : Optional[Any] , UpperCAmelCase_ ...
59
from transformers import DistilBertTokenizer, DistilBertTokenizerFast from transformers.testing_utils import require_tokenizers, slow from ..bert.test_tokenization_bert import BertTokenizationTest @require_tokenizers class __lowercase ( UpperCAmelCase_ ): """simple docstring""" ...
671
0
import tempfile import unittest from pathlib import Path from shutil import copyfile from transformers import MaMaaaTokenizer, is_torch_available from transformers.testing_utils import ( get_tests_dir, nested_simplify, require_sentencepiece, require_tokenizers, require_torch, slow, ) from...
60
import collections import json import math import os import re import time from fnmatch import fnmatch from typing import Dict import requests from slack_sdk import WebClient lowerCAmelCase : List[Any] = WebClient(token=os.environ["""CI_SLACK_BOT_TOKEN"""]) def A_ ( _UpperCAmelCase ...
671
0
# NOTE: This file is deprecated and will be removed in a future version. # It only exists so that temporarely `from diffusers.pipelines import DiffusionPipeline` works from ...utils import deprecate from ..controlnet.pipeline_flax_controlnet import FlaxStableDiffusionControlNetPipeline # noqa: F401 ...
61
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...
671
0
import os import pickle import unittest from transformers import AutoTokenizer from transformers.models.bert.tokenization_bert import BertTokenizer from transformers.models.bert_japanese.tokenization_bert_japanese import ( VOCAB_FILES_NAMES, BertJapaneseTokenizer, CharacterTokenizer, JumanppToke...
62
from math import asin, atan, cos, radians, sin, sqrt, tan lowerCAmelCase : Union[str, Any] = 637_8137.0 lowerCAmelCase : int = 635_6752.31_4245 lowerCAmelCase : Union[str, Any] = 6378137 def A_ ( _UpperCAmelCase , _UpperCAmelCase , _Up...
671
0
def lowerCamelCase__ ( __lowerCamelCase : int , __lowerCamelCase : float , __lowerCamelCase : float ): return round(float(moles / volume ) * nfactor ) def lowerCamelCase__ ( __lowerCamelCase : float , __lowerC...
63
import argparse import torch from transformers import BertConfig, BertForPreTraining, load_tf_weights_in_bert from transformers.utils import logging logging.set_verbosity_info() def A_ ( _UpperCAmelCase , _UpperCAmelCase , _UpperCAmelCase ): # Initialise PyTorch...
671
0
import argparse from transformers import CLIPImageProcessor, CLIPVisionModelWithProjection from diffusers import UnCLIPImageVariationPipeline, UnCLIPPipeline if __name__ == "__main__": lowercase_ : List[Any] = argparse.ArgumentParser() parser.add_argument('--dump_path', default=None, type=s...
64
import math def A_ ( _UpperCAmelCase ): if 1 < number < 4: # 2 and 3 are primes return True elif number < 2 or number % 2 == 0 or number % 3 == 0: # Negatives, 0, 1, all even numbers, all multiples of 3 are not primes return False ...
671
0
"""simple docstring""" from typing import TYPE_CHECKING from ...utils import ( OptionalDependencyNotAvailable, _LazyModule, is_sentencepiece_available, is_tokenizers_available, is_torch_available, ) __UpperCAmelCase = {} try: if not is_sentencepiece_availab...
65
import re def A_ ( _UpperCAmelCase ): return [char.split() for char in re.split(R"[^ a-z A-Z 0-9 \s]" , str_ )] def A_ ( _UpperCAmelCase ): SCREAMING_SNAKE_CASE_: int = split_input(str_ ) return "".join( ...
671
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 ...
66
import copy from ...configuration_utils import PretrainedConfig from ...utils import logging from ..auto.configuration_auto import CONFIG_MAPPING lowerCAmelCase : Union[str, Any] = logging.get_logger(__name__) class __lowercase ( UpperCAmelCase_ ): """simple docstring""" ...
671
0
def SCREAMING_SNAKE_CASE__ ( snake_case__ :str ) -> Union[str, Any]: _lowercase = len(snake_case__ ) _lowercase = sum(snake_case__ ) _lowercase = [[False for x in range(s + 1 )] for y in range(n + 1 )] for i in range(1 , n + 1 ): ...
67
import pickle import unittest import torch from accelerate import Accelerator from accelerate.state import AcceleratorState from accelerate.test_utils import require_cpu @require_cpu class __lowercase ( unittest.TestCase ): """simple docstring""" def _SCREAMING_SNAKE_CASE ...
671
0
import pytest import requests from datasets.utils.file_utils import http_head from .utils import OfflineSimulationMode, RequestWouldHangIndefinitelyError, offline @pytest.mark.integration def lowercase__ ( ) -> Union[str, Any]: """simple docstring""" with offline(...
68
from itertools import count def A_ ( _UpperCAmelCase = 50 ): SCREAMING_SNAKE_CASE_: Union[str, Any] = [1] * min_block_length for n in count(_UpperCAmelCase ): fill_count_functions.append(1 ) for block_length in range(_UpperCAmelC...
671
0
'''simple docstring''' import inspect import unittest from transformers import ViTMSNConfig from transformers.testing_utils import require_torch, require_vision, slow, torch_device from transformers.utils import cached_property, is_torch_available, is_vision_available from ...test_configuration_co...
69
def A_ ( _UpperCAmelCase ): if not isinstance(_UpperCAmelCase , _UpperCAmelCase ): raise TypeError("only integers accepted as input" ) else: SCREAMING_SNAKE_CASE_: List[Any] = str(abs(_UpperCAmelCase ) ) ...
671
0
import json from typing import TYPE_CHECKING, List, Optional, Tuple from tokenizers import pre_tokenizers from ...tokenization_utils_fast import PreTrainedTokenizerFast from ...utils import logging if TYPE_CHECKING: from transformers.pipelines.conversational import Conversation lowerCamelC...
70
from __future__ import annotations from collections.abc import Iterator from typing import Any class __lowercase : """simple docstring""" def __init__( self : List[str] , lowerCAmelCase__ : Any): SCREAMING_SNAKE_CASE_: Any = data SCREAMING_SN...
671
0
'''simple docstring''' import unittest from transformers import is_torch_available, is_vision_available from transformers.testing_utils import require_torch, require_vision, slow, torch_device if is_torch_available(): import torch from transformers import AutoModelForImageClassification i...
71
from collections import defaultdict from math import ceil, sqrt def A_ ( _UpperCAmelCase = 1_00_00_00 , _UpperCAmelCase = 10 ): SCREAMING_SNAKE_CASE_: defaultdict = defaultdict(_UpperCAmelCase ) for outer_width in range(3 , (t_limit // 4)...
671
0
'''simple docstring''' from collections import Counter import numpy as np from sklearn import datasets from sklearn.model_selection import train_test_split _UpperCAmelCase : List[Any] = datasets.load_iris() _UpperCAmelCase : Dict = np.array(data['''data''']) _UpperCAmelCase : Union[str, Any] = np.array...
72
from typing import TYPE_CHECKING from ...utils import OptionalDependencyNotAvailable, _LazyModule, is_tf_available, is_torch_available lowerCAmelCase : str = { """configuration_xlm""": ["""XLM_PRETRAINED_CONFIG_ARCHIVE_MAP""", """XLMConfig""", """XLMOnnxConfig"""], """tokenization_xlm""": [""...
671
0
import unittest from transformers import BigBirdTokenizer, BigBirdTokenizerFast from transformers.testing_utils import get_tests_dir, require_sentencepiece, require_tokenizers, require_torch, slow from transformers.utils import cached_property from ...test_tokenization_common import TokenizerTesterMixin a_ ...
73
lowerCAmelCase : List[str] = { """A""": ["""B""", """C""", """E"""], """B""": ["""A""", """D""", """E"""], """C""": ["""A""", """F""", """G"""], """D""": ["""B"""], """E""": ["""A""", """B""", """D"""], """F""": ["""C"""], """G""": ["""C"""], } def A_ ( _Upp...
671
0
import gc import random import unittest import torch from diffusers import ( IFImgaImgPipeline, IFImgaImgSuperResolutionPipeline, IFInpaintingPipeline, IFInpaintingSuperResolutionPipeline, IFPipeline, IFSuperResolutionPipeline, ) from diffusers.models.attention_processor import AttnAddedKVPro...
74
from __future__ import annotations from math import pi from typing import Protocol import matplotlib.pyplot as plt import numpy as np class __lowercase ( UpperCAmelCase_ ): """simple docstring""" def _SCREAMING_SNAKE_CASE ( self : List[Any] , lowerCAmelCase__ ...
671
0
'''simple docstring''' import os from dataclasses import dataclass, field from io import BytesIO from typing import TYPE_CHECKING, Any, ClassVar, Dict, Optional, Union import numpy as np import pyarrow as pa from .. import config from ..download.streaming_download_manager import xopen, xsplitext from...
75
from __future__ import annotations from math import ceil, floor, sqrt def A_ ( _UpperCAmelCase = 2_00_00_00 ): SCREAMING_SNAKE_CASE_: list[int] = [0] SCREAMING_SNAKE_CASE_: int for idx in range(1 , ceil(sqrt(target * 2 ) * 1.1 ) ...
671
0
"""simple docstring""" import json import os import subprocess import unittest from ast import literal_eval import pytest from parameterized import parameterized, parameterized_class from . import is_sagemaker_available if is_sagemaker_available(): from sagemaker import Session, T...
76
from typing import TYPE_CHECKING from ...utils import ( OptionalDependencyNotAvailable, _LazyModule, is_tf_available, is_tokenizers_available, is_torch_available, ) lowerCAmelCase : Optional[int] = { """configuration_longformer""": [ """LONGFORMER_PRETRAINED_CONFIG_ARC...
671
0
"""simple docstring""" def _UpperCamelCase ( UpperCamelCase , UpperCamelCase ) -> str: """simple docstring""" __UpperCAmelCase : Any = "" for word_or_phrase in separated: if not isinstance(UpperCamelCase , UpperCamelCase...
77
import argparse import os.path as osp import re import torch from safetensors.torch import load_file, save_file # =================# # UNet Conversion # # =================# lowerCAmelCase : Optional[int] = [ # (stable-diffusion, HF Diffusers) ("""time_embed.0.weight""", """time_embedding.li...
671
0
'''simple docstring''' import inspect import unittest import numpy as np from tests.test_modeling_common import floats_tensor from transformers import DetrConfig, MaskFormerConfig, SwinConfig, is_torch_available, is_vision_available from transformers.testing_utils import require_torch, require_torch_multi_gpu, r...
78
from typing import Callable, Optional, Union from ...configuration_utils import PretrainedConfig from ...utils import logging lowerCAmelCase : int = logging.get_logger(__name__) lowerCAmelCase : Dict = { """microsoft/xprophetnet-large-wiki100-cased""": ( """https://huggingf...
671
0
import json import os import tempfile import unittest import numpy as np from datasets import load_dataset 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 im...
79
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 rescale, resize, to_channel_dimension_format from ...image_utils import ( ChannelDimension, ImageInput, PILImageResampli...
671
0
from typing import TYPE_CHECKING from ...utils import OptionalDependencyNotAvailable, _LazyModule, is_sentencepiece_available __UpperCamelCase : Union[str, Any] = {} try: if not is_sentencepiece_available(): raise OptionalDependencyNotAvailable() except OptionalDependencyNotAvai...
80
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 import BertTokenizer lowerCAmelCase : Optional[int] = logging.get_logger(__...
671
0
from collections import OrderedDict from typing import Any, List, Mapping, Optional from ... import PreTrainedTokenizer, TensorType, is_torch_available from ...configuration_utils import PretrainedConfig from ...onnx import OnnxConfigWithPast, PatchingSpec from ...utils import logging _snake_case : str ...
81
from transformers import DistilBertTokenizer, DistilBertTokenizerFast from transformers.testing_utils import require_tokenizers, slow from ..bert.test_tokenization_bert import BertTokenizationTest @require_tokenizers class __lowercase ( UpperCAmelCase_ ): """simple docstring""" ...
671
0
"""simple docstring""" def a__ ( lowerCAmelCase__ ): if len(lowerCAmelCase__ ) <= 1: return lst UpperCAmelCase_ = 1 while i < len(lowerCAmelCase__ ): if lst[i - 1] <= lst[i]: i += 1 else: ...
82
import collections import json import math import os import re import time from fnmatch import fnmatch from typing import Dict import requests from slack_sdk import WebClient lowerCAmelCase : List[Any] = WebClient(token=os.environ["""CI_SLACK_BOT_TOKEN"""]) def A_ ( _UpperCAmelCase ...
671
0
"""simple docstring""" import contextlib import copy import random from typing import Any, Dict, Iterable, Optional, Union import numpy as np import torch from .utils import deprecate, is_transformers_available if is_transformers_available(): import transformers def snake_case_ ( A_ : ...
83
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...
671
0
from dataclasses import dataclass, field from typing import Tuple from ..utils import cached_property, is_tf_available, logging, requires_backends from .benchmark_args_utils import BenchmarkArguments if is_tf_available(): import tensorflow as tf UpperCAmelCase = logging.get_logger(__name__) @dat...
84
from math import asin, atan, cos, radians, sin, sqrt, tan lowerCAmelCase : Union[str, Any] = 637_8137.0 lowerCAmelCase : int = 635_6752.31_4245 lowerCAmelCase : Union[str, Any] = 6378137 def A_ ( _UpperCAmelCase , _UpperCAmelCase , _Up...
671
0
import qiskit def _a ( lowercase__ : int = 2 ): '''simple docstring''' SCREAMING_SNAKE_CASE__ : Optional[int] = qubits # Using Aer's simulator SCREAMING_SNAKE_CASE__ : Optional[Any] = qiskit.Aer.get_backend('aer_simulator' ) # Cr...
85
import argparse import torch from transformers import BertConfig, BertForPreTraining, load_tf_weights_in_bert from transformers.utils import logging logging.set_verbosity_info() def A_ ( _UpperCAmelCase , _UpperCAmelCase , _UpperCAmelCase ): # Initialise PyTorch...
671
0
import argparse import json import os import torch from transformers import LukeConfig, LukeModel, LukeTokenizer, RobertaTokenizer from transformers.tokenization_utils_base import AddedToken @torch.no_grad() def __snake_case ( __UpperCamelCase : Tuple ,__UpperCamelCase : Dict ,__UpperC...
86
import math def A_ ( _UpperCAmelCase ): if 1 < number < 4: # 2 and 3 are primes return True elif number < 2 or number % 2 == 0 or number % 3 == 0: # Negatives, 0, 1, all even numbers, all multiples of 3 are not primes return False ...
671
0
from typing import TYPE_CHECKING from ....utils import OptionalDependencyNotAvailable, _LazyModule, is_torch_available _lowerCamelCase : Any = { """configuration_mctct""": ["""MCTCT_PRETRAINED_CONFIG_ARCHIVE_MAP""", """MCTCTConfig"""], """feature_extraction_mctct""": ["""MCTCTFeatureExt...
87
import re def A_ ( _UpperCAmelCase ): return [char.split() for char in re.split(R"[^ a-z A-Z 0-9 \s]" , str_ )] def A_ ( _UpperCAmelCase ): SCREAMING_SNAKE_CASE_: int = split_input(str_ ) return "".join( ...
671
0
"""simple docstring""" def _snake_case ( __snake_case : str , __snake_case : str ): """simple docstring""" _lowerCamelCase : str = len(__snake_case ) _lowerCamelCase : Union[str, Any] = len(__snake_case ) _lowerCamelC...
88
import copy from ...configuration_utils import PretrainedConfig from ...utils import logging from ..auto.configuration_auto import CONFIG_MAPPING lowerCAmelCase : Union[str, Any] = logging.get_logger(__name__) class __lowercase ( UpperCAmelCase_ ): """simple docstring""" ...
671
0
from __future__ import annotations import unittest from transformers import FunnelConfig, is_tf_available from transformers.testing_utils import require_tf from ...test_configuration_common import ConfigTester from ...test_modeling_tf_common import TFModelTesterMixin, ids_tensor, random_attention_mask from ...tes...
89
import pickle import unittest import torch from accelerate import Accelerator from accelerate.state import AcceleratorState from accelerate.test_utils import require_cpu @require_cpu class __lowercase ( unittest.TestCase ): """simple docstring""" def _SCREAMING_SNAKE_CASE ...
671
0
'''simple docstring''' from __future__ import annotations def _snake_case ( A , A ) -> float: lowerCAmelCase__ = sorted(numsa + numsa ) lowerCAmelCase__ , lowerCAmelCase__ = divmod(len(A ) , 2 ) if mod == 1: ...
90
from itertools import count def A_ ( _UpperCAmelCase = 50 ): SCREAMING_SNAKE_CASE_: Union[str, Any] = [1] * min_block_length for n in count(_UpperCAmelCase ): fill_count_functions.append(1 ) for block_length in range(_UpperCAmelC...
671
0
"""simple docstring""" from typing import TYPE_CHECKING from ...utils import OptionalDependencyNotAvailable, _LazyModule, is_tf_available, is_torch_available _lowercase = { '''configuration_groupvit''': [ '''GROUPVIT_PRETRAINED_CONFIG_ARCHIVE_MAP''', '''GroupViTConfig''', '''Gr...
91
def A_ ( _UpperCAmelCase ): if not isinstance(_UpperCAmelCase , _UpperCAmelCase ): raise TypeError("only integers accepted as input" ) else: SCREAMING_SNAKE_CASE_: List[Any] = str(abs(_UpperCAmelCase ) ) ...
671
0
'''simple docstring''' # Imports import numpy as np class __SCREAMING_SNAKE_CASE : def __init__( self : Union[str, Any] , UpperCAmelCase__ : Optional[Any]=None , UpperCAmelCase__ : Union[str, Any]=None , UpperCAmelCase__ : str=None , UpperCAme...
92
from __future__ import annotations from collections.abc import Iterator from typing import Any class __lowercase : """simple docstring""" def __init__( self : List[str] , lowerCAmelCase__ : Any): SCREAMING_SNAKE_CASE_: Any = data SCREAMING_SN...
671
0
"""simple docstring""" import json import os import unittest from transformers import DebertaTokenizer, DebertaTokenizerFast from transformers.models.deberta.tokenization_deberta import VOCAB_FILES_NAMES from transformers.testing_utils import slow from ...test_tokenization_common import TokenizerTesterMixi...
93
from collections import defaultdict from math import ceil, sqrt def A_ ( _UpperCAmelCase = 1_00_00_00 , _UpperCAmelCase = 10 ): SCREAMING_SNAKE_CASE_: defaultdict = defaultdict(_UpperCAmelCase ) for outer_width in range(3 , (t_limit // 4)...
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 SCREAMING_SNAKE_CASE = logging.get_logger(__name__) SCREAMING_SNAKE_CASE = { 'dist...
94
from typing import TYPE_CHECKING from ...utils import OptionalDependencyNotAvailable, _LazyModule, is_tf_available, is_torch_available lowerCAmelCase : str = { """configuration_xlm""": ["""XLM_PRETRAINED_CONFIG_ARCHIVE_MAP""", """XLMConfig""", """XLMOnnxConfig"""], """tokenization_xlm""": [""...
671
0
"""simple docstring""" 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 impor...
95
lowerCAmelCase : List[str] = { """A""": ["""B""", """C""", """E"""], """B""": ["""A""", """D""", """E"""], """C""": ["""A""", """F""", """G"""], """D""": ["""B"""], """E""": ["""A""", """B""", """D"""], """F""": ["""C"""], """G""": ["""C"""], } def A_ ( _Upp...
671
0
"""simple docstring""" def a ( __UpperCAmelCase : str ) -> bool: if not all(x.isalpha() for x in string ): raise ValueError("""String must only contain alphabetic characters.""" ) __magic_name__: Optional[Any] = sorted(string...
96
from __future__ import annotations from math import pi from typing import Protocol import matplotlib.pyplot as plt import numpy as np class __lowercase ( UpperCAmelCase_ ): """simple docstring""" def _SCREAMING_SNAKE_CASE ( self : List[Any] , lowerCAmelCase__ ...
671
0
from typing import TYPE_CHECKING from ...utils import ( OptionalDependencyNotAvailable, _LazyModule, is_flax_available, is_tf_available, is_torch_available, ) __a = {'configuration_vit_mae': ['VIT_MAE_PRETRAINED_CONFIG_ARCHIVE_MAP', 'ViTMAEConfig']} try: if not is...
97
from __future__ import annotations from math import ceil, floor, sqrt def A_ ( _UpperCAmelCase = 2_00_00_00 ): SCREAMING_SNAKE_CASE_: list[int] = [0] SCREAMING_SNAKE_CASE_: int for idx in range(1 , ceil(sqrt(target * 2 ) * 1.1 ) ...
671
0
'''simple docstring''' from datetime import datetime as dt import os from github import Github lowercase__ : Optional[int] = [ 'good first issue', 'good second issue', 'good difficult issue', 'feature request', 'new model', 'wip', ] def a__ ( ) -...
98
from typing import TYPE_CHECKING from ...utils import ( OptionalDependencyNotAvailable, _LazyModule, is_tf_available, is_tokenizers_available, is_torch_available, ) lowerCAmelCase : Optional[int] = { """configuration_longformer""": [ """LONGFORMER_PRETRAINED_CONFIG_ARC...
671
0
import logging import re import pytorch_quantization import pytorch_quantization.nn as quant_nn import torch from pytorch_quantization import calib from pytorch_quantization.tensor_quant import QuantDescriptor SCREAMING_SNAKE_CASE = logging.getLogger(__name__) SCREAMING_SNAKE_CASE ...
99
import argparse import os.path as osp import re import torch from safetensors.torch import load_file, save_file # =================# # UNet Conversion # # =================# lowerCAmelCase : Optional[int] = [ # (stable-diffusion, HF Diffusers) ("""time_embed.0.weight""", """time_embedding.li...
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 : Any = {"""configuration_xglm""": ["""XGLM_PRETRAINED_C...
100
from typing import Callable, Optional, Union from ...configuration_utils import PretrainedConfig from ...utils import logging lowerCAmelCase : int = logging.get_logger(__name__) lowerCAmelCase : Dict = { """microsoft/xprophetnet-large-wiki100-cased""": ( """https://huggingf...
671
0
import argparse import requests import torch from PIL import Image from transformers import ViTMAEConfig, ViTMAEForPreTraining, ViTMAEImageProcessor def a__ ( A__ ): if "cls_token" in name: SCREAMING_SNAKE_CASE_ : int = name.replace('cls_token', 'vit...
101
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 rescale, resize, to_channel_dimension_format from ...image_utils import ( ChannelDimension, ImageInput, PILImageResampli...
671
0
"""simple docstring""" import unittest from transformers import MPNetConfig, is_torch_available from transformers.testing_utils import require_torch, slow, torch_device from ...test_configuration_common import ConfigTester from ...test_modeling_common import ModelTesterMixin, ids_tensor, random...
102
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 import BertTokenizer lowerCAmelCase : Optional[int] = logging.get_logger(__...
671
0
"""simple docstring""" from ...configuration_utils import PretrainedConfig from ...utils import logging snake_case = logging.get_logger(__name__) snake_case = { '''google/switch-base-8''': '''https://huggingface.co/google/switch-base-8/blob/main/config.json''', } ...
103
from transformers import DistilBertTokenizer, DistilBertTokenizerFast from transformers.testing_utils import require_tokenizers, slow from ..bert.test_tokenization_bert import BertTokenizationTest @require_tokenizers class __lowercase ( UpperCAmelCase_ ): """simple docstring""" ...
671
0
"""simple docstring""" 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,...
104
import collections import json import math import os import re import time from fnmatch import fnmatch from typing import Dict import requests from slack_sdk import WebClient lowerCAmelCase : List[Any] = WebClient(token=os.environ["""CI_SLACK_BOT_TOKEN"""]) def A_ ( _UpperCAmelCase ...
671
0
def __UpperCAmelCase ( lowerCamelCase_ : str ) -> bool: """simple docstring""" SCREAMING_SNAKE_CASE_ : Any = 0 for ch in input_str: SCREAMING_SNAKE_CASE_ : Union[str, Any] = ord(lowerCamelCase_ ) SCREAMING_SNAKE_CASE_ : Tup...
105
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...
671
0
import logging from transformers import PretrainedConfig __snake_case :int =logging.getLogger(__name__) __snake_case :Tuple ={ 'bertabs-finetuned-cnndm': 'https://huggingface.co/remi/bertabs-finetuned-cnndm-extractive-abstractive-summarization/resolve/main/config.json', } class...
106
from math import asin, atan, cos, radians, sin, sqrt, tan lowerCAmelCase : Union[str, Any] = 637_8137.0 lowerCAmelCase : int = 635_6752.31_4245 lowerCAmelCase : Union[str, Any] = 6378137 def A_ ( _UpperCAmelCase , _UpperCAmelCase , _Up...
671
0
'''simple docstring''' import warnings from typing import List, Optional, Union from ...image_utils import ImageInput from ...processing_utils import ProcessorMixin from ...tokenization_utils_base import BatchEncoding, PaddingStrategy, PreTokenizedInput, TextInput, TruncationStrategy from ...utils import TensorT...
107
import argparse import torch from transformers import BertConfig, BertForPreTraining, load_tf_weights_in_bert from transformers.utils import logging logging.set_verbosity_info() def A_ ( _UpperCAmelCase , _UpperCAmelCase , _UpperCAmelCase ): # Initialise PyTorch...
671
0
from typing import List, Optional, Union import numpy as np from ....audio_utils import mel_filter_bank, optimal_fft_length, spectrogram, window_function from ....feature_extraction_sequence_utils import SequenceFeatureExtractor from ....feature_extraction_utils import BatchFeature from ....file_utils import P...
108
import math def A_ ( _UpperCAmelCase ): if 1 < number < 4: # 2 and 3 are primes return True elif number < 2 or number % 2 == 0 or number % 3 == 0: # Negatives, 0, 1, all even numbers, all multiples of 3 are not primes return False ...
671
0
'''simple docstring''' import os import tempfile import unittest from transformers.models.marian.convert_marian_tatoeba_to_pytorch import DEFAULT_REPO, TatoebaConverter from transformers.testing_utils import slow from transformers.utils import cached_property @unittest.skipUnless(os.path.exists(_snake_ca...
109
import re def A_ ( _UpperCAmelCase ): return [char.split() for char in re.split(R"[^ a-z A-Z 0-9 \s]" , str_ )] def A_ ( _UpperCAmelCase ): SCREAMING_SNAKE_CASE_: int = split_input(str_ ) return "".join( ...
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...
668
import copy from ...configuration_utils import PretrainedConfig from ...utils import logging from ..auto.configuration_auto import CONFIG_MAPPING lowerCAmelCase : Union[str, Any] = logging.get_logger(__name__) class __lowercase ( UpperCAmelCase_ ): """simple docstring""" ...
671
0
import argparse from copy import deepcopy import numpy as np from datasets import ClassLabel, DatasetDict, load_dataset from evaluate import load from transformers import ( AutoModelForSequenceClassification, AutoTokenizer, DataCollatorWithPadding, Trainer, TrainerCallback,...
121
import pickle import unittest import torch from accelerate import Accelerator from accelerate.state import AcceleratorState from accelerate.test_utils import require_cpu @require_cpu class __lowercase ( unittest.TestCase ): """simple docstring""" def _SCREAMING_SNAKE_CASE ...
671
0
from __future__ import annotations from math import pi from typing import Protocol import matplotlib.pyplot as plt import numpy as np class _lowerCamelCase( UpperCAmelCase_ ): def UpperCamelCase ( self, lowerCamelCase) -> Union[str, Any]: """simple docstring""" r...
89
from itertools import count def A_ ( _UpperCAmelCase = 50 ): SCREAMING_SNAKE_CASE_: Union[str, Any] = [1] * min_block_length for n in count(_UpperCAmelCase ): fill_count_functions.append(1 ) for block_length in range(_UpperCAmelC...
671
0
from __future__ import annotations from collections.abc import Iterator from typing import Any class lowerCAmelCase__ : def __init__( self , a ) -> Dict: '''simple docstring''' _UpperCamelCase = data _UpperCamelCase = ...
612
def A_ ( _UpperCAmelCase ): if not isinstance(_UpperCAmelCase , _UpperCAmelCase ): raise TypeError("only integers accepted as input" ) else: SCREAMING_SNAKE_CASE_: List[Any] = str(abs(_UpperCAmelCase ) ) ...
671
0
"""simple docstring""" lowercase__ = frozenset( [ """prompt""", """height""", """width""", """guidance_scale""", """negative_prompt""", """prompt_embeds""", """negative_prompt_embeds""", """cross_attention_kwargs""", ] ) lowercase_...
610
from __future__ import annotations from collections.abc import Iterator from typing import Any class __lowercase : """simple docstring""" def __init__( self : List[str] , lowerCAmelCase__ : Any): SCREAMING_SNAKE_CASE_: Any = data SCREAMING_SN...
671
0
import os from shutil import copyfile from typing import List, Optional, Tuple from ...tokenization_utils import AddedToken from ...tokenization_utils_fast import PreTrainedTokenizerFast from ...utils import is_sentencepiece_available, logging if is_sentencepiece_available(): from .tokenization_c...
519
from collections import defaultdict from math import ceil, sqrt def A_ ( _UpperCAmelCase = 1_00_00_00 , _UpperCAmelCase = 10 ): SCREAMING_SNAKE_CASE_: defaultdict = defaultdict(_UpperCAmelCase ) for outer_width in range(3 , (t_limit // 4)...
671
0
class lowerCamelCase_ : '''simple docstring''' def __init__( self : Any , _lowerCAmelCase : str = "" , _lowerCAmelCase : bool = False ): # Mapping from the first character of the prefix of the node SCREAMING_SNAKE_CASE_ = ...
31
from typing import TYPE_CHECKING from ...utils import OptionalDependencyNotAvailable, _LazyModule, is_tf_available, is_torch_available lowerCAmelCase : str = { """configuration_xlm""": ["""XLM_PRETRAINED_CONFIG_ARCHIVE_MAP""", """XLMConfig""", """XLMOnnxConfig"""], """tokenization_xlm""": [""...
671
0
"""simple docstring""" def snake_case__ ( _lowerCamelCase ) ->Any: """simple docstring""" if isinstance(_UpperCAmelCase, _UpperCAmelCase ): raise TypeError("'float' object cannot be interpreted as an integer" ) if isinstance(_UpperCAmelCase, _UpperCAmelCase...
575
lowerCAmelCase : List[str] = { """A""": ["""B""", """C""", """E"""], """B""": ["""A""", """D""", """E"""], """C""": ["""A""", """F""", """G"""], """D""": ["""B"""], """E""": ["""A""", """B""", """D"""], """F""": ["""C"""], """G""": ["""C"""], } def A_ ( _Upp...
671
0
'''simple docstring''' from typing import List, Optional, Tuple, Union import PIL import torch from torchvision import transforms from diffusers.pipeline_utils import DiffusionPipeline, ImagePipelineOutput from diffusers.schedulers import DDIMScheduler from diffusers.utils import randn_tensor _a...
168
from __future__ import annotations from math import pi from typing import Protocol import matplotlib.pyplot as plt import numpy as np class __lowercase ( UpperCAmelCase_ ): """simple docstring""" def _SCREAMING_SNAKE_CASE ( self : List[Any] , lowerCAmelCase__ ...
671
0
import warnings warnings.warn( 'memory_utils has been reorganized to utils.memory. Import `find_executable_batchsize` from the main `__init__`: ' '`from accelerate import find_executable_batch_size` to avoid this warning.', FutureWarning, )
417
from __future__ import annotations from math import ceil, floor, sqrt def A_ ( _UpperCAmelCase = 2_00_00_00 ): SCREAMING_SNAKE_CASE_: list[int] = [0] SCREAMING_SNAKE_CASE_: int for idx in range(1 , ceil(sqrt(target * 2 ) * 1.1 ) ...
671
0
"""simple docstring""" import argparse import gdown import numpy as np import torch from huggingface_hub import hf_hub_download from transformers import ( CLIPTokenizer, CLIPTokenizerFast, VideoMAEImageProcessor, XCLIPConfig, XCLIPModel, XCLIPProcessor, XCLIPTextConfig, XCLIPVisio...
646
from typing import TYPE_CHECKING from ...utils import ( OptionalDependencyNotAvailable, _LazyModule, is_tf_available, is_tokenizers_available, is_torch_available, ) lowerCAmelCase : Optional[int] = { """configuration_longformer""": [ """LONGFORMER_PRETRAINED_CONFIG_ARC...
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 ...
668
import argparse import os.path as osp import re import torch from safetensors.torch import load_file, save_file # =================# # UNet Conversion # # =================# lowerCAmelCase : Optional[int] = [ # (stable-diffusion, HF Diffusers) ("""time_embed.0.weight""", """time_embedding.li...
671
0
import argparse _lowerCamelCase : Optional[Any] = """docs/source/_static/js/custom.js""" def _lowerCAmelCase ( __magic_name__ :str ): with open(_UpperCAmelCase , encoding='''utf-8''' , newline='''\n''' ) as f: UpperCAmelCa...
121
from typing import Callable, Optional, Union from ...configuration_utils import PretrainedConfig from ...utils import logging lowerCAmelCase : int = logging.get_logger(__name__) lowerCAmelCase : Dict = { """microsoft/xprophetnet-large-wiki100-cased""": ( """https://huggingf...
671
0
import functools import operator from ...configuration_utils import PretrainedConfig from ...utils import logging SCREAMING_SNAKE_CASE : Any = logging.get_logger(__name__) SCREAMING_SNAKE_CASE : Dict = { """microsoft/unispeech-sat-base-100h-libri-ft""": ( """https://huggingfac...
89
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 rescale, resize, to_channel_dimension_format from ...image_utils import ( ChannelDimension, ImageInput, PILImageResampli...
671
0
from transformers import DistilBertTokenizer, DistilBertTokenizerFast from transformers.testing_utils import require_tokenizers, slow from ..bert.test_tokenization_bert import BertTokenizationTest @require_tokenizers class lowerCAmelCase__ ( UpperCAmelCase_ ): UpperCamelCase_ : Optiona...
612
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 import BertTokenizer lowerCAmelCase : Optional[int] = logging.get_logger(__...
671
0
"""simple docstring""" import json import logging import math import os import sys from dataclasses import dataclass, field from typing import Optional from datasets import Dataset, load_dataset import transformers from transformers import ( CONFIG_MAPPING, MODEL_FOR_MASKED_LM_MAPPING, AutoConfig,...
610
from transformers import DistilBertTokenizer, DistilBertTokenizerFast from transformers.testing_utils import require_tokenizers, slow from ..bert.test_tokenization_bert import BertTokenizationTest @require_tokenizers class __lowercase ( UpperCAmelCase_ ): """simple docstring""" ...
671
0
import argparse from tax import checkpoints from transformers import AutoConfig, FlaxAutoModelForSeqaSeqLM def _UpperCAmelCase ( UpperCAmelCase : List[str] , UpperCAmelCase : Union[str, Any] , UpperCAmelCase : Tuple ): """simple docstring""" ...
519
import collections import json import math import os import re import time from fnmatch import fnmatch from typing import Dict import requests from slack_sdk import WebClient lowerCAmelCase : List[Any] = WebClient(token=os.environ["""CI_SLACK_BOT_TOKEN"""]) def A_ ( _UpperCAmelCase ...
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, ...
31
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...
671
0
"""simple docstring""" class lowerCAmelCase__ : """simple docstring""" def __init__( self : Tuple , lowercase__ : list ): __lowercase : Union[str, Any] = set_counts __lowercase : Optional[Any] = max(lowerCAmelC...
575
from math import asin, atan, cos, radians, sin, sqrt, tan lowerCAmelCase : Union[str, Any] = 637_8137.0 lowerCAmelCase : int = 635_6752.31_4245 lowerCAmelCase : Union[str, Any] = 6378137 def A_ ( _UpperCAmelCase , _UpperCAmelCase , _Up...
671
0
'''simple docstring''' def _lowercase ( lowerCamelCase__ ) -> Optional[int]: """simple docstring""" __UpperCAmelCase : Optional[int] = 1 __UpperCAmelCase : Dict = 2 while i * i <= n: __UpperCAmelC...
168
import argparse import torch from transformers import BertConfig, BertForPreTraining, load_tf_weights_in_bert from transformers.utils import logging logging.set_verbosity_info() def A_ ( _UpperCAmelCase , _UpperCAmelCase , _UpperCAmelCase ): # Initialise PyTorch...
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 _lowercase ( UpperCAmelCase_ ): lowercase = ['''...
417
import math def A_ ( _UpperCAmelCase ): if 1 < number < 4: # 2 and 3 are primes return True elif number < 2 or number % 2 == 0 or number % 3 == 0: # Negatives, 0, 1, all even numbers, all multiples of 3 are not primes return False ...
671
0
"""simple docstring""" import collections import os import re from pathlib import Path __A = """src/transformers""" # Matches is_xxx_available() __A = re.compile(R'''is\_([a-z_]*)_available()''') # Catches a one-line _import_struct = {xxx} __A = re.compile(R'''^_import_structure\s+=\s+\{([^\}]+)\}'...
646
import re def A_ ( _UpperCAmelCase ): return [char.split() for char in re.split(R"[^ a-z A-Z 0-9 \s]" , str_ )] def A_ ( _UpperCAmelCase ): SCREAMING_SNAKE_CASE_: int = split_input(str_ ) return "".join( ...
671
0
from __future__ import annotations from math import ceil, floor, sqrt def lowerCAmelCase_ (lowercase__ : Tuple = 2_00_00_00 ) -> Any: '''simple docstring''' lowerCAmelCase__ = [0] lowerCAmelCase__ = 42 for idx in range(1 , ceil(...
668
import copy from ...configuration_utils import PretrainedConfig from ...utils import logging from ..auto.configuration_auto import CONFIG_MAPPING lowerCAmelCase : Union[str, Any] = logging.get_logger(__name__) class __lowercase ( UpperCAmelCase_ ): """simple docstring""" ...
671
0
from ..utils import DummyObject, requires_backends class snake_case__ ( metaclass=UpperCAmelCase_ ): '''simple docstring''' __A = ['''onnx'''] def __init__( self : List[str] , *lowerCAmelCase_ : Optional[i...
121
import pickle import unittest import torch from accelerate import Accelerator from accelerate.state import AcceleratorState from accelerate.test_utils import require_cpu @require_cpu class __lowercase ( unittest.TestCase ): """simple docstring""" def _SCREAMING_SNAKE_CASE ...
671
0
import gc import random import unittest import numpy as np import torch from transformers import ( CLIPImageProcessor, CLIPTextConfig, CLIPTextModel, CLIPTokenizer, CLIPVisionConfig, CLIPVisionModelWithProjection, ) from diffusers import AutoencoderKL, DDIMScheduler, DDPMScheduler, StableUn...
89
from itertools import count def A_ ( _UpperCAmelCase = 50 ): SCREAMING_SNAKE_CASE_: Union[str, Any] = [1] * min_block_length for n in count(_UpperCAmelCase ): fill_count_functions.append(1 ) for block_length in range(_UpperCAmelC...
671
0
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 tensorflow as tf from transformers import AutoTokenizer, TFAutoModelForSeqaSeqLM @r...
612
def A_ ( _UpperCAmelCase ): if not isinstance(_UpperCAmelCase , _UpperCAmelCase ): raise TypeError("only integers accepted as input" ) else: SCREAMING_SNAKE_CASE_: List[Any] = str(abs(_UpperCAmelCase ) ) ...
671
0
"""simple docstring""" import inspect import unittest from transformers import RegNetConfig from transformers.file_utils import cached_property, is_torch_available, is_vision_available from transformers.testing_utils import require_torch, require_vision, slow, torch_device from ...test_configuration_common im...
610
from __future__ import annotations from collections.abc import Iterator from typing import Any class __lowercase : """simple docstring""" def __init__( self : List[str] , lowerCAmelCase__ : Any): SCREAMING_SNAKE_CASE_: Any = data SCREAMING_SN...
671
0
def _UpperCAmelCase ( UpperCAmelCase : int , UpperCAmelCase : List[str] ): """simple docstring""" __lowerCamelCase : int = len(_UpperCAmelCase ) __lowerCamelCase : List[str] = [[False] * (required_sum + 1) for _ in rang...
519
from collections import defaultdict from math import ceil, sqrt def A_ ( _UpperCAmelCase = 1_00_00_00 , _UpperCAmelCase = 10 ): SCREAMING_SNAKE_CASE_: defaultdict = defaultdict(_UpperCAmelCase ) for outer_width in range(3 , (t_limit // 4)...
671
0
from ..utils import DummyObject, requires_backends class lowerCamelCase_ ( metaclass=UpperCAmelCase_ ): '''simple docstring''' lowercase_ = ['''flax'''] def __init__( self : Union[str, Any] , *_lowerCAmelCase : int , **_lower...
31
from typing import TYPE_CHECKING from ...utils import OptionalDependencyNotAvailable, _LazyModule, is_tf_available, is_torch_available lowerCAmelCase : str = { """configuration_xlm""": ["""XLM_PRETRAINED_CONFIG_ARCHIVE_MAP""", """XLMConfig""", """XLMOnnxConfig"""], """tokenization_xlm""": [""...
671
0
"""simple docstring""" 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 ...
575
lowerCAmelCase : List[str] = { """A""": ["""B""", """C""", """E"""], """B""": ["""A""", """D""", """E"""], """C""": ["""A""", """F""", """G"""], """D""": ["""B"""], """E""": ["""A""", """B""", """D"""], """F""": ["""C"""], """G""": ["""C"""], } def A_ ( _Upp...
671
0