code
stringlengths
86
54.5k
code_codestyle
int64
0
371
style_context
stringlengths
87
49.2k
style_context_codestyle
int64
0
349
label
int64
0
1
'''simple docstring''' from typing import Dict import numpy as np from ..utils import add_end_docstrings, is_tf_available, is_torch_available, logging from .base import PIPELINE_INIT_ARGS, GenericTensor, Pipeline, PipelineException if is_tf_available(): import tensorflow as tf from ..tf_utils impor...
359
'''simple docstring''' def __a ( UpperCAmelCase , UpperCAmelCase ) ->Tuple: """simple docstring""" if b == 0: return 1 if (b % 2) == 0: return actual_power(UpperCAmelCase , int(b / 2 ) ) * actual_power(UpperCAmelCase , int(b / 2 ) ) else:...
337
0
'''simple docstring''' import math def __a ( UpperCAmelCase ) ->Optional[int]: """simple docstring""" if not isinstance(__lowerCamelCase , __lowerCamelCase ): A = f"""Input value of [number={number}] must be an integer""" raise TypeError(__lowerCamel...
360
'''simple docstring''' from __future__ import annotations import collections import tempfile import unittest import numpy as np from transformers.testing_utils import require_tf, require_vision, slow from transformers.utils import is_tf_available, is_vision_available from ...test_modeling_tf_common import f...
337
0
'''simple docstring''' import torch from diffusers import EulerDiscreteScheduler from diffusers.utils import torch_device from .test_schedulers import SchedulerCommonTest class __UpperCAmelCase ( __SCREAMING_SNAKE_CASE ): '''simple docstring''' __lowerCAmelCase = (E...
361
'''simple docstring''' from collections import OrderedDict from ...utils import logging from .auto_factory import _BaseAutoModelClass, _LazyAutoMapping, auto_class_update from .configuration_auto import CONFIG_MAPPING_NAMES _lowerCamelCase : List[str] = logging.get_logger(__name__) _lowerCame...
337
0
'''simple docstring''' _lowerCamelCase : Optional[Any] = { 'km/h': 1.0, 'm/s': 3.6, 'mph': 1.6_0_9_3_4_4, 'knot': 1.8_5_2, } _lowerCamelCase : List[Any] = { 'km/h': 1.0, 'm/s': 0.2_7_7_7_7_7_7_7_8, 'mph': 0.6_2_1_3_7_1_1_9_2, 'knot': 0.5_3_9_9_5_6_8_0...
362
'''simple docstring''' import unittest from datasets import load_dataset from transformers.pipelines import pipeline from transformers.testing_utils import is_pipeline_test, nested_simplify, require_torch, slow @is_pipeline_test @require_torch class __UpperCAmelCase ( unittest.TestCase ): ...
337
0
'''simple docstring''' from ..utils import DummyObject, requires_backends class __UpperCAmelCase ( metaclass=__lowercase ): '''simple docstring''' __lowerCAmelCase = ['''transformers''', '''torch''', '''note_seq'''] def __init__(self : Dict , *_lowerCAmelCas...
363
'''simple docstring''' import argparse import glob import importlib.util import os import re import black from doc_builder.style_doc import style_docstrings_in_code # All paths are set with the intent you should run this script from the root of the repo with the command # python utils/check_copies.py _lowerC...
337
0
'''simple docstring''' 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, ...
364
'''simple docstring''' def __a ( UpperCAmelCase ) ->bool: """simple docstring""" return credit_card_number.startswith(("""34""", """35""", """37""", """4""", """5""", """6""") ) def __a ( UpperCAmelCase ) ->bool: """simple docstring""" A ...
337
0
'''simple docstring''' def __a ( UpperCAmelCase ) ->list: """simple docstring""" if len(__a ) <= 1: return [tuple(__a )] A = [] def generate(UpperCAmelCase , UpperCAmelCase ): if k == 1: res.append(tuple(arr[:] ) ) return generat...
365
'''simple docstring''' import heapq as hq import math from collections.abc import Iterator class __UpperCAmelCase : '''simple docstring''' def __init__(self : Any , _lowerCAmelCase : List[Any] ): A = str(id_ ) A = None A = None A ...
337
0
'''simple docstring''' import unittest from transformers import AutoTokenizer, FalconConfig, 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...
366
'''simple docstring''' from collections import OrderedDict from typing import Any, Mapping, Optional, Union from ...configuration_utils import PretrainedConfig from ...feature_extraction_utils import FeatureExtractionMixin from ...onnx import OnnxConfig from ...onnx.utils import compute_effective_axis_dimensio...
337
0
'''simple docstring''' from pathlib import Path import fire from tqdm import tqdm def __a ( UpperCAmelCase="ro" , UpperCAmelCase="en" , UpperCAmelCase="wmt16" , UpperCAmelCase=None ) ->Tuple: """simple docstring""" try: import datasets except (ModuleNotFou...
367
'''simple docstring''' import math class __UpperCAmelCase : '''simple docstring''' def __init__(self : int , _lowerCAmelCase : List[Any]=0 ): # a graph with Node 0,1,...,N-1 A = n A = [ [math.inf for j in range(0 , _lowerCAmelCase )] for i in...
337
0
'''simple docstring''' import copy import random from transformers import CLIPTokenizer class __UpperCAmelCase ( _UpperCamelCase ): '''simple docstring''' def __init__(self : Tuple , *_lowerCAmelCase : Tuple , **_lowerCAmelCase : int ): super().__init__(*_SCREAMING_SNA...
368
'''simple docstring''' import json import re from typing import TYPE_CHECKING, List, Optional, Tuple, Union import numpy as np from ...utils import is_tf_available, is_torch_available, logging if TYPE_CHECKING: if is_torch_available(): import torch if is_tf_available(): import tensor...
337
0
_lowerCamelCase : Dict = [ '''Audio''', '''Array2D''', '''Array3D''', '''Array4D''', '''Array5D''', '''ClassLabel''', '''Features''', '''Sequence''', '''Value''', '''Image''', '''Translation''', '''TranslationVariableLanguages''', ] from .audio import ...
369
'''simple docstring''' from typing import TYPE_CHECKING from ...utils import OptionalDependencyNotAvailable, _LazyModule, is_torch_available _lowerCamelCase : Optional[Any] = { 'configuration_swinv2': ['SWINV2_PRETRAINED_CONFIG_ARCHIVE_MAP', 'Swinv2Config'], } try: if not is_torch_ava...
337
0
'''simple docstring''' import argparse import json from typing import List from ltp import LTP from transformers.models.bert.tokenization_bert import BertTokenizer def __a ( UpperCAmelCase ) ->Tuple: """simple docstring""" if ( (cp >= 0X4E_00 and cp <= 0X9F_FF) or (cp ...
370
'''simple docstring''' 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 __UpperCAmelCase ( unittest.TestCase ): '''simple docstring''' ...
337
0
'''simple docstring''' import argparse import torch from torch import nn from transformers import MaMaaaConfig, MaMaaaForConditionalGeneration def __a ( UpperCAmelCase ) ->Tuple: """simple docstring""" A = [ """encoder.version""", """decoder.version""", ...
371
'''simple docstring''' from ..utils import DummyObject, requires_backends class __UpperCAmelCase ( metaclass=A__ ): '''simple docstring''' __lowerCAmelCase = ['''torch''', '''transformers''', '''onnx'''] def __init__(self : Tuple , *_lowerCAmelCase : Option...
337
0
'''simple docstring''' import math from collections.abc import Iterator from itertools import takewhile def __a ( UpperCAmelCase ) ->List[Any]: """simple docstring""" if 1 < number < 4: # 2 and 3 are primes return True elif number < 2 or number % 2 == 0 or number % 3 == 0: ...
350
'''simple docstring''' 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, TrainerCa...
337
0
'''simple docstring''' import os from shutil import copyfile from typing import List, Optional, Tuple import sentencepiece as spm from ...tokenization_utils import PreTrainedTokenizer from ...utils import logging _lowerCamelCase : Any = logging.get_logger(__name__) _lowerCamelCase : List[A...
351
'''simple docstring''' import json import os from typing import Optional, Tuple import regex as re from ...tokenization_utils import PreTrainedTokenizer from ...utils import logging _lowerCamelCase : Dict = logging.get_logger(__name__) _lowerCamelCase : List[str] = { 'vocab_...
337
0
from __future__ import annotations from itertools import permutations from random import randint from timeit import repeat def __a ( ) ->tuple[list[int], int]: """simple docstring""" A = [randint(-1000 , 1000 ) for i in range(10 )] A = randint(-50...
352
'''simple docstring''' _lowerCamelCase : List[Any] = 'Input must be a string of 8 numbers plus letter' _lowerCamelCase : str = 'TRWAGMYFPDXBNJZSQVHLCKE' def __a ( UpperCAmelCase ) ->bool: """simple docstring""" if not isinstance(UpperCAmelCase , ...
337
0
'''simple docstring''' import os from shutil import copyfile from typing import List, Optional, Tuple from tokenizers import processors from ...tokenization_utils import AddedToken, BatchEncoding from ...tokenization_utils_fast import PreTrainedTokenizerFast from ...utils import is_sentencepiece_available, logg...
353
'''simple docstring''' from typing import Mapping from ...configuration_utils import PretrainedConfig from ...onnx import OnnxSeqaSeqConfigWithPast from ...utils import logging _lowerCamelCase : Dict = logging.get_logger(__name__) _lowerCamelCase : Any = { 'google/umt5-small'...
337
0
'''simple docstring''' from transformers import BertTokenizer, EncoderDecoderModel, SeqaSeqTrainer, SeqaSeqTrainingArguments from transformers.testing_utils import TestCasePlus, require_torch, slow from transformers.utils import is_datasets_available if is_datasets_available(): import datasets class ...
354
'''simple docstring''' from collections import OrderedDict from typing import Mapping from packaging import version from ...configuration_utils import PretrainedConfig from ...onnx import OnnxConfig from ...utils import logging _lowerCamelCase : List[Any] = logging.get_logger(__name__) _lower...
337
0
from typing import Any class __UpperCAmelCase : '''simple docstring''' def __init__(self : Any , _lowerCAmelCase : Any ): A = data A = None def __repr__(self : List[Any] ): return F"""Node({self.data})""" class __UpperCAmelCas...
355
'''simple docstring''' from __future__ import annotations def __a ( UpperCAmelCase ) ->list[int]: """simple docstring""" return [ord(UpperCAmelCase ) - 96 for elem in plain] def __a ( UpperCAmelCase ) ->str: """simple docstring""" return "".join...
337
0
'''simple docstring''' import warnings from ...utils import logging from .image_processing_chinese_clip import ChineseCLIPImageProcessor _lowerCamelCase : Optional[int] = logging.get_logger(__name__) class __UpperCAmelCase ( __UpperCamelCase ): '''simple docstring''' ...
356
'''simple docstring''' import os def __a ( ) ->List[Any]: """simple docstring""" A = os.path.join(os.path.dirname(UpperCAmelCase ) , """num.txt""" ) with open(UpperCAmelCase ) as file_hand: return str(sum(int(UpperCAmelCase ) for line in file_ha...
337
0
'''simple docstring''' from collections import OrderedDict from typing import Mapping from packaging import version from ...configuration_utils import PretrainedConfig from ...onnx import OnnxConfig from ...utils import logging _lowerCamelCase : Union[str, Any] = logging.get_logger(__name__) ...
357
'''simple docstring''' from typing import List, Optional, Union import numpy as np import tensorflow as tf from .utils import logging _lowerCamelCase : List[Any] = logging.get_logger(__name__) def __a ( UpperCAmelCase ) ->List[int]: """simple docstring""" if isin...
337
0
'''simple docstring''' from __future__ import annotations import unittest from transformers import EsmConfig, is_tf_available from transformers.testing_utils import require_tf, slow from ...test_configuration_common import ConfigTester from ...test_modeling_tf_common import TFModelTesterMixin, floats_tensor,...
358
'''simple docstring''' from binascii import hexlify from hashlib import shaaaa from os import urandom # RFC 3526 - More Modular Exponential (MODP) Diffie-Hellman groups for # Internet Key Exchange (IKE) https://tools.ietf.org/html/rfc3526 _lowerCamelCase : Any = { # 1536-bit 5: { ...
337
0
'''simple docstring''' from collections import OrderedDict from typing import Mapping from packaging import version from ...configuration_utils import PretrainedConfig from ...onnx import OnnxConfig from ...utils import logging _lowerCamelCase : int = logging.get_logger(__name__) _lowerCamelC...
359
'''simple docstring''' def __a ( UpperCAmelCase , UpperCAmelCase ) ->Tuple: """simple docstring""" if b == 0: return 1 if (b % 2) == 0: return actual_power(UpperCAmelCase , int(b / 2 ) ) * actual_power(UpperCAmelCase , int(b / 2 ) ) else:...
337
0
'''simple docstring''' from __future__ import annotations import random import unittest from transformers import TransfoXLConfig, is_tf_available from transformers.testing_utils import require_tf, slow from ...test_configuration_common import ConfigTester from ...test_modeling_tf_common import TFModelTesterM...
360
'''simple docstring''' from __future__ import annotations import collections import tempfile import unittest import numpy as np from transformers.testing_utils import require_tf, require_vision, slow from transformers.utils import is_tf_available, is_vision_available from ...test_modeling_tf_common import f...
337
0
'''simple docstring''' from scipy.stats import pearsonr, spearmanr from sklearn.metrics import fa_score, matthews_corrcoef import datasets _lowerCamelCase : Dict = '\\n@inproceedings{wang2019glue,\n title={{GLUE}: A Multi-Task Benchmark and Analysis Platform for Natural Language Understanding}...
361
'''simple docstring''' from collections import OrderedDict from ...utils import logging from .auto_factory import _BaseAutoModelClass, _LazyAutoMapping, auto_class_update from .configuration_auto import CONFIG_MAPPING_NAMES _lowerCamelCase : List[str] = logging.get_logger(__name__) _lowerCame...
337
0
'''simple docstring''' import os # Precomputes a list of the 100 first triangular numbers _lowerCamelCase : str = [int(0.5 * n * (n + 1)) for n in range(1, 101)] def __a ( ) ->List[Any]: """simple docstring""" A = os.path.dirname(os.path.realpath(lowercase_ ...
362
'''simple docstring''' import unittest from datasets import load_dataset from transformers.pipelines import pipeline from transformers.testing_utils import is_pipeline_test, nested_simplify, require_torch, slow @is_pipeline_test @require_torch class __UpperCAmelCase ( unittest.TestCase ): ...
337
0
'''simple docstring''' from ...configuration_utils import PretrainedConfig from ...utils import logging from ...utils.backbone_utils import BackboneConfigMixin, get_aligned_output_features_output_indices _lowerCamelCase : str = logging.get_logger(__name__) class __UpperCAmelCase ( ...
363
'''simple docstring''' import argparse import glob import importlib.util import os import re import black from doc_builder.style_doc import style_docstrings_in_code # All paths are set with the intent you should run this script from the root of the repo with the command # python utils/check_copies.py _lowerC...
337
0
'''simple docstring''' import unittest import numpy as np import torch from transformers import CLIPTextConfig, CLIPTextModel, CLIPTokenizer from diffusers import ( AutoencoderKL, DDIMScheduler, DPMSolverMultistepScheduler, TextToVideoSDPipeline, UNetaDConditionModel, ) from diffusers.util...
364
'''simple docstring''' def __a ( UpperCAmelCase ) ->bool: """simple docstring""" return credit_card_number.startswith(("""34""", """35""", """37""", """4""", """5""", """6""") ) def __a ( UpperCAmelCase ) ->bool: """simple docstring""" A ...
337
0
'''simple docstring''' import pytest from datasets.utils.sharding import _distribute_shards, _number_of_shards_in_gen_kwargs, _split_gen_kwargs @pytest.mark.parametrize( """kwargs, expected""" , [ ({"""num_shards""": 0, """max_num_jobs""": 1}, []), ({"""num_shards""": 10, """max_num_...
365
'''simple docstring''' import heapq as hq import math from collections.abc import Iterator class __UpperCAmelCase : '''simple docstring''' def __init__(self : Any , _lowerCAmelCase : List[Any] ): A = str(id_ ) A = None A = None A ...
337
0
'''simple docstring''' def __a ( UpperCAmelCase ) ->int: """simple docstring""" A = len(SCREAMING_SNAKE_CASE_ ) while cur > 1: # Find the maximum number in arr A = arr.index(max(arr[0:cur] ) ) # Reverse from 0 to mi A = arr[mi::...
366
'''simple docstring''' from collections import OrderedDict from typing import Any, Mapping, Optional, Union from ...configuration_utils import PretrainedConfig from ...feature_extraction_utils import FeatureExtractionMixin from ...onnx import OnnxConfig from ...onnx.utils import compute_effective_axis_dimensio...
337
0
'''simple docstring''' import os from shutil import copyfile from typing import Any, Dict, List, Optional, Tuple import sentencepiece as spm from ...tokenization_utils import AddedToken, PreTrainedTokenizer from ...utils import logging _lowerCamelCase : int = logging.get_logger(__name__) _low...
367
'''simple docstring''' import math class __UpperCAmelCase : '''simple docstring''' def __init__(self : int , _lowerCAmelCase : List[Any]=0 ): # a graph with Node 0,1,...,N-1 A = n A = [ [math.inf for j in range(0 , _lowerCAmelCase )] for i in...
337
0
'''simple docstring''' import os import tempfile import unittest from pathlib import Path from transformers import AutoConfig, is_torch_available from transformers.testing_utils import require_torch, torch_device if is_torch_available(): from transformers import PyTorchBenchmark, PyTorchBenchmarkArgument...
368
'''simple docstring''' import json import re from typing import TYPE_CHECKING, List, Optional, Tuple, Union import numpy as np from ...utils import is_tf_available, is_torch_available, logging if TYPE_CHECKING: if is_torch_available(): import torch if is_tf_available(): import tensor...
337
0
from ...configuration_utils import PretrainedConfig from ...utils import logging _lowerCamelCase : Dict = logging.get_logger(__name__) _lowerCamelCase : Optional[int] = { "naver-clova-ix/donut-base": "https://huggingface.co/naver-clova-ix/donut-base/resolve/main/config.json", ...
369
'''simple docstring''' from typing import TYPE_CHECKING from ...utils import OptionalDependencyNotAvailable, _LazyModule, is_torch_available _lowerCamelCase : Optional[Any] = { 'configuration_swinv2': ['SWINV2_PRETRAINED_CONFIG_ARCHIVE_MAP', 'Swinv2Config'], } try: if not is_torch_ava...
337
0
'''simple docstring''' import gc import tempfile import unittest import numpy as np import torch from diffusers import VersatileDiffusionTextToImagePipeline from diffusers.utils.testing_utils import nightly, require_torch_gpu, torch_device _lowerCamelCase : List[str] = False class __...
370
'''simple docstring''' 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 __UpperCAmelCase ( unittest.TestCase ): '''simple docstring''' ...
337
0
'''simple docstring''' from __future__ import annotations from PIL import Image # Define glider example _lowerCamelCase : List[str] = [ [0, 1, 0, 0, 0, 0, 0, 0], [0, 0, 1, 0, 0, 0, 0, 0], [1, 1, 1, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0], [0, 0,...
371
'''simple docstring''' from ..utils import DummyObject, requires_backends class __UpperCAmelCase ( metaclass=A__ ): '''simple docstring''' __lowerCAmelCase = ['''torch''', '''transformers''', '''onnx'''] def __init__(self : Tuple , *_lowerCAmelCase : Option...
337
0
'''simple docstring''' import argparse import torch from torch import nn from transformers import MBartConfig, MBartForConditionalGeneration def __a ( UpperCAmelCase ) ->int: """simple docstring""" A = [ '''encoder.version''', '''decoder.version''', '''...
350
'''simple docstring''' 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, TrainerCa...
337
0
'''simple docstring''' import unittest from transformers import AutoTokenizer, is_flax_available from transformers.testing_utils import require_flax, require_sentencepiece, require_tokenizers, slow if is_flax_available(): import jax.numpy as jnp from transformers import FlaxXLMRobertaModel @requi...
351
'''simple docstring''' import json import os from typing import Optional, Tuple import regex as re from ...tokenization_utils import PreTrainedTokenizer from ...utils import logging _lowerCamelCase : Dict = logging.get_logger(__name__) _lowerCamelCase : List[str] = { 'vocab_...
337
0
def __a ( UpperCAmelCase , UpperCAmelCase = " " ) ->list: """simple docstring""" A = [] A = 0 for index, char in enumerate(UpperCAmelCase ): if char == separator: split_words.append(string[last_index:index] ) A = index + 1 e...
352
'''simple docstring''' _lowerCamelCase : List[Any] = 'Input must be a string of 8 numbers plus letter' _lowerCamelCase : str = 'TRWAGMYFPDXBNJZSQVHLCKE' def __a ( UpperCAmelCase ) ->bool: """simple docstring""" if not isinstance(UpperCAmelCase , ...
337
0
'''simple docstring''' 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 _lowerCamelCase : Union[str, Any]...
353
'''simple docstring''' from typing import Mapping from ...configuration_utils import PretrainedConfig from ...onnx import OnnxSeqaSeqConfigWithPast from ...utils import logging _lowerCamelCase : Dict = logging.get_logger(__name__) _lowerCamelCase : Any = { 'google/umt5-small'...
337
0
'''simple docstring''' class __UpperCAmelCase : '''simple docstring''' def __init__(self : Tuple , _lowerCAmelCase : list ): A = set_counts A = max(_lowerCAmelCase ) A = len(_lowerCAmelCase ) A = [1] * num_sets A ...
354
'''simple docstring''' from collections import OrderedDict from typing import Mapping from packaging import version from ...configuration_utils import PretrainedConfig from ...onnx import OnnxConfig from ...utils import logging _lowerCamelCase : List[Any] = logging.get_logger(__name__) _lower...
337
0
from typing import List, Optional from ...configuration_utils import PretrainedConfig from ...utils import logging _lowerCamelCase : str = logging.get_logger(__name__) _lowerCamelCase : Optional[Any] = { 'huggingface/autoformer-tourism-monthly': 'https://huggingface.co/huggingf...
355
'''simple docstring''' from __future__ import annotations def __a ( UpperCAmelCase ) ->list[int]: """simple docstring""" return [ord(UpperCAmelCase ) - 96 for elem in plain] def __a ( UpperCAmelCase ) ->str: """simple docstring""" return "".join...
337
0
'''simple docstring''' from ...configuration_utils import PretrainedConfig from ...utils import logging _lowerCamelCase : Any = logging.get_logger(__name__) _lowerCamelCase : Dict = { 'tanreinama/GPTSAN-2.8B-spout_is_uniform': ( 'https://huggingface.co/tanreinama/GPTSA...
356
'''simple docstring''' import os def __a ( ) ->List[Any]: """simple docstring""" A = os.path.join(os.path.dirname(UpperCAmelCase ) , """num.txt""" ) with open(UpperCAmelCase ) as file_hand: return str(sum(int(UpperCAmelCase ) for line in file_ha...
337
0
'''simple docstring''' 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 ...
357
'''simple docstring''' from typing import List, Optional, Union import numpy as np import tensorflow as tf from .utils import logging _lowerCamelCase : List[Any] = logging.get_logger(__name__) def __a ( UpperCAmelCase ) ->List[int]: """simple docstring""" if isin...
337
0
'''simple docstring''' import argparse import os import evaluate import torch from datasets import load_dataset from torch.optim import AdamW from torch.utils.data import DataLoader from transformers import AutoModelForSequenceClassification, AutoTokenizer, get_linear_schedule_with_warmup, set_seed from accel...
358
'''simple docstring''' from binascii import hexlify from hashlib import shaaaa from os import urandom # RFC 3526 - More Modular Exponential (MODP) Diffie-Hellman groups for # Internet Key Exchange (IKE) https://tools.ietf.org/html/rfc3526 _lowerCamelCase : Any = { # 1536-bit 5: { ...
337
0
'''simple docstring''' import collections import json import os import re from typing import TYPE_CHECKING, List, Optional, Tuple import numpy as np from ...tokenization_utils_fast import PreTrainedTokenizer from ...utils import logging if TYPE_CHECKING: from transformers.pipelines.conversational import...
359
'''simple docstring''' def __a ( UpperCAmelCase , UpperCAmelCase ) ->Tuple: """simple docstring""" if b == 0: return 1 if (b % 2) == 0: return actual_power(UpperCAmelCase , int(b / 2 ) ) * actual_power(UpperCAmelCase , int(b / 2 ) ) else:...
337
0
'''simple docstring''' from typing import Optional from urllib.parse import quote import huggingface_hub as hfh from packaging import version def __a ( UpperCAmelCase , UpperCAmelCase , UpperCAmelCase = None ) ->str: """simple docstring""" if version.parse(hfh._...
360
'''simple docstring''' from __future__ import annotations import collections import tempfile import unittest import numpy as np from transformers.testing_utils import require_tf, require_vision, slow from transformers.utils import is_tf_available, is_vision_available from ...test_modeling_tf_common import f...
337
0
'''simple docstring''' _lowerCamelCase : List[str] = 'Tobias Carryer' from time import time class __UpperCAmelCase : '''simple docstring''' def __init__(self : Union[str, Any] , _lowerCAmelCase : Tuple , _lowerCAmelCase : int , _lowerCAmelCase : Any , _lowerCAm...
361
'''simple docstring''' from collections import OrderedDict from ...utils import logging from .auto_factory import _BaseAutoModelClass, _LazyAutoMapping, auto_class_update from .configuration_auto import CONFIG_MAPPING_NAMES _lowerCamelCase : List[str] = logging.get_logger(__name__) _lowerCame...
337
0
'''simple docstring''' import os from shutil import copyfile from typing import Any, Dict, List, Optional, Tuple import sentencepiece as spm from ...tokenization_utils import AddedToken, PreTrainedTokenizer from ...utils import logging _lowerCamelCase : str = logging.get_logger(__name__) _low...
362
'''simple docstring''' import unittest from datasets import load_dataset from transformers.pipelines import pipeline from transformers.testing_utils import is_pipeline_test, nested_simplify, require_torch, slow @is_pipeline_test @require_torch class __UpperCAmelCase ( unittest.TestCase ): ...
337
0
'''simple docstring''' import argparse import json from collections import OrderedDict from pathlib import Path import requests import torch from huggingface_hub import hf_hub_download from PIL import Image from transformers import PoolFormerConfig, PoolFormerForImageClassification, PoolFormerImageProcessor f...
363
'''simple docstring''' import argparse import glob import importlib.util import os import re import black from doc_builder.style_doc import style_docstrings_in_code # All paths are set with the intent you should run this script from the root of the repo with the command # python utils/check_copies.py _lowerC...
337
0
'''simple docstring''' def __a ( UpperCAmelCase ) ->int: """simple docstring""" if not numbers: return 0 if not isinstance(__snake_case , (list, tuple) ) or not all( isinstance(__snake_case , __snake_case ) for number in numbers ): raise ValueEr...
364
'''simple docstring''' def __a ( UpperCAmelCase ) ->bool: """simple docstring""" return credit_card_number.startswith(("""34""", """35""", """37""", """4""", """5""", """6""") ) def __a ( UpperCAmelCase ) ->bool: """simple docstring""" A ...
337
0
'''simple docstring''' import inspect import os import unittest from pathlib import Path import torch import accelerate from accelerate.test_utils import execute_subprocess_async from accelerate.test_utils.testing import run_command class __UpperCAmelCase ( unittest.TestCase ): '''simpl...
365
'''simple docstring''' import heapq as hq import math from collections.abc import Iterator class __UpperCAmelCase : '''simple docstring''' def __init__(self : Any , _lowerCAmelCase : List[Any] ): A = str(id_ ) A = None A = None A ...
337
0
'''simple docstring''' import argparse import logging import os from datetime import datetime import numpy as np import torch from torch import nn from torch.utils.data import DataLoader, RandomSampler, TensorDataset from tqdm import tqdm from transformers import GPTaLMHeadModel _lowerCamelCase : Union[s...
366
'''simple docstring''' from collections import OrderedDict from typing import Any, Mapping, Optional, Union from ...configuration_utils import PretrainedConfig from ...feature_extraction_utils import FeatureExtractionMixin from ...onnx import OnnxConfig from ...onnx.utils import compute_effective_axis_dimensio...
337
0
'''simple docstring''' import argparse import json from collections import OrderedDict from pathlib import Path import requests import torch from huggingface_hub import hf_hub_download from PIL import Image from transformers import ( ConditionalDetrConfig, ConditionalDetrForObjectDetection, Condit...
367
'''simple docstring''' import math class __UpperCAmelCase : '''simple docstring''' def __init__(self : int , _lowerCAmelCase : List[Any]=0 ): # a graph with Node 0,1,...,N-1 A = n A = [ [math.inf for j in range(0 , _lowerCAmelCase )] for i in...
337
0
'''simple docstring''' import math def __a ( UpperCAmelCase ) ->int: """simple docstring""" if not isinstance(UpperCAmelCase , UpperCAmelCase ): A = f"""Input value of [number={number}] must be an integer""" raise TypeError(UpperCAmelCase ) if num...
368
'''simple docstring''' import json import re from typing import TYPE_CHECKING, List, Optional, Tuple, Union import numpy as np from ...utils import is_tf_available, is_torch_available, logging if TYPE_CHECKING: if is_torch_available(): import torch if is_tf_available(): import tensor...
337
0
import numpy class __UpperCAmelCase : '''simple docstring''' def __init__(self : Optional[int] , _lowerCAmelCase : numpy.ndarray , _lowerCAmelCase : numpy.ndarray ): A = input_array # Random initial weights are assigned where first argument is the # number o...
369
'''simple docstring''' from typing import TYPE_CHECKING from ...utils import OptionalDependencyNotAvailable, _LazyModule, is_torch_available _lowerCamelCase : Optional[Any] = { 'configuration_swinv2': ['SWINV2_PRETRAINED_CONFIG_ARCHIVE_MAP', 'Swinv2Config'], } try: if not is_torch_ava...
337
0
'''simple docstring''' def __a ( UpperCAmelCase , UpperCAmelCase , UpperCAmelCase , UpperCAmelCase=None ) ->Dict: """simple docstring""" A = (path or []) + [u] for v in graph[u]: if visited_edge[u][v] is False: A = True, True A ...
370
'''simple docstring''' 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 __UpperCAmelCase ( unittest.TestCase ): '''simple docstring''' ...
337
0
'''simple docstring''' import math from dataclasses import dataclass from typing import Optional, Tuple, Union import numpy as np import torch from ..configuration_utils import ConfigMixin, register_to_config from ..utils import BaseOutput, randn_tensor from .scheduling_utils import SchedulerMixin @datacla...
371
'''simple docstring''' from ..utils import DummyObject, requires_backends class __UpperCAmelCase ( metaclass=A__ ): '''simple docstring''' __lowerCAmelCase = ['''torch''', '''transformers''', '''onnx'''] def __init__(self : Tuple , *_lowerCAmelCase : Option...
337
0
'''simple docstring''' import json import os import unittest from transformers.models.ctrl.tokenization_ctrl import VOCAB_FILES_NAMES, CTRLTokenizer from ...test_tokenization_common import TokenizerTesterMixin class __UpperCAmelCase ( a_ , unittest.TestCase ): '''simple docst...
350
'''simple docstring''' 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, TrainerCa...
337
0
'''simple docstring''' import gc import random import unittest import torch from diffusers import ( IFImgaImgPipeline, IFImgaImgSuperResolutionPipeline, IFInpaintingPipeline, IFInpaintingSuperResolutionPipeline, IFPipeline, IFSuperResolutionPipeline, ) from diffusers.models.attention_p...
351
'''simple docstring''' import json import os from typing import Optional, Tuple import regex as re from ...tokenization_utils import PreTrainedTokenizer from ...utils import logging _lowerCamelCase : Dict = logging.get_logger(__name__) _lowerCamelCase : List[str] = { 'vocab_...
337
0
from typing import TYPE_CHECKING from ...utils import OptionalDependencyNotAvailable, _LazyModule, is_torch_available _lowerCamelCase : Tuple = { 'configuration_instructblip': [ 'INSTRUCTBLIP_PRETRAINED_CONFIG_ARCHIVE_MAP', 'InstructBlipConfig', 'InstructBlipQFormerCon...
352
'''simple docstring''' _lowerCamelCase : List[Any] = 'Input must be a string of 8 numbers plus letter' _lowerCamelCase : str = 'TRWAGMYFPDXBNJZSQVHLCKE' def __a ( UpperCAmelCase ) ->bool: """simple docstring""" if not isinstance(UpperCAmelCase , ...
337
0
'''simple docstring''' import argparse import glob import logging import os from argparse import Namespace from importlib import import_module import numpy as np import torch from lightning_base import BaseTransformer, add_generic_args, generic_train from seqeval.metrics import accuracy_score, fa_score, precisio...
353
'''simple docstring''' from typing import Mapping from ...configuration_utils import PretrainedConfig from ...onnx import OnnxSeqaSeqConfigWithPast from ...utils import logging _lowerCamelCase : Dict = logging.get_logger(__name__) _lowerCamelCase : Any = { 'google/umt5-small'...
337
0
'''simple docstring''' import logging import os from dataclasses import dataclass from typing import List, Optional, Union import tqdm from filelock import FileLock from transformers import ( BartTokenizer, BartTokenizerFast, DataProcessor, PreTrainedTokenizer, RobertaTokenizer, Robert...
354
'''simple docstring''' from collections import OrderedDict from typing import Mapping from packaging import version from ...configuration_utils import PretrainedConfig from ...onnx import OnnxConfig from ...utils import logging _lowerCamelCase : List[Any] = logging.get_logger(__name__) _lower...
337
0
def __a ( UpperCAmelCase = 1000 ) ->int: """simple docstring""" A = 2**power A = 0 while n: A , A = r + n % 10, n // 10 return r if __name__ == "__main__": print(solution(int(str(input()).strip())))
355
'''simple docstring''' from __future__ import annotations def __a ( UpperCAmelCase ) ->list[int]: """simple docstring""" return [ord(UpperCAmelCase ) - 96 for elem in plain] def __a ( UpperCAmelCase ) ->str: """simple docstring""" return "".join...
337
0
'''simple docstring''' import os from typing import Any, Callable, Dict, List, Optional, Tuple, Union import torch from torch import nn from ...models.controlnet import ControlNetModel, ControlNetOutput from ...models.modeling_utils import ModelMixin from ...utils import logging _lowerCamelCase : Union[s...
356
'''simple docstring''' import os def __a ( ) ->List[Any]: """simple docstring""" A = os.path.join(os.path.dirname(UpperCAmelCase ) , """num.txt""" ) with open(UpperCAmelCase ) as file_hand: return str(sum(int(UpperCAmelCase ) for line in file_ha...
337
0
'''simple docstring''' import argparse import requests import torch from PIL import Image from torchvision.transforms import Compose, Normalize, Resize, ToTensor from transformers import SwinaSRConfig, SwinaSRForImageSuperResolution, SwinaSRImageProcessor def __a ( UpperCAmelCase ) ->Dict: ...
357
'''simple docstring''' from typing import List, Optional, Union import numpy as np import tensorflow as tf from .utils import logging _lowerCamelCase : List[Any] = logging.get_logger(__name__) def __a ( UpperCAmelCase ) ->List[int]: """simple docstring""" if isin...
337
0
'''simple docstring''' def __a ( UpperCAmelCase , UpperCAmelCase , UpperCAmelCase , UpperCAmelCase ) ->Dict: """simple docstring""" A = [False] * len(A_ ) A = [] queue.append(A_ ) A = True while queue: A ...
358
'''simple docstring''' from binascii import hexlify from hashlib import shaaaa from os import urandom # RFC 3526 - More Modular Exponential (MODP) Diffie-Hellman groups for # Internet Key Exchange (IKE) https://tools.ietf.org/html/rfc3526 _lowerCamelCase : Any = { # 1536-bit 5: { ...
337
0
'''simple docstring''' from io import BytesIO from typing import List, Union import requests from ..utils import add_end_docstrings, is_decord_available, is_torch_available, logging, requires_backends from .base import PIPELINE_INIT_ARGS, Pipeline if is_decord_available(): import numpy as np from de...
359
'''simple docstring''' def __a ( UpperCAmelCase , UpperCAmelCase ) ->Tuple: """simple docstring""" if b == 0: return 1 if (b % 2) == 0: return actual_power(UpperCAmelCase , int(b / 2 ) ) * actual_power(UpperCAmelCase , int(b / 2 ) ) else:...
337
0
'''simple docstring''' import unittest import numpy as np from transformers import RoFormerConfig, is_flax_available from transformers.testing_utils import require_flax, slow from ...test_modeling_flax_common import FlaxModelTesterMixin, ids_tensor, random_attention_mask if is_flax_available(): import ...
360
'''simple docstring''' from __future__ import annotations import collections import tempfile import unittest import numpy as np from transformers.testing_utils import require_tf, require_vision, slow from transformers.utils import is_tf_available, is_vision_available from ...test_modeling_tf_common import f...
337
0
'''simple docstring''' from __future__ import annotations import math from collections.abc import Callable def __a ( UpperCAmelCase , UpperCAmelCase , UpperCAmelCase , UpperCAmelCase = 100 , ) ->Any: """simple docstring""" A = x_start A ...
361
'''simple docstring''' from collections import OrderedDict from ...utils import logging from .auto_factory import _BaseAutoModelClass, _LazyAutoMapping, auto_class_update from .configuration_auto import CONFIG_MAPPING_NAMES _lowerCamelCase : List[str] = logging.get_logger(__name__) _lowerCame...
337
0
'''simple docstring''' from ...utils import is_note_seq_available, is_transformers_available, is_torch_available from ...utils import OptionalDependencyNotAvailable try: if not (is_transformers_available() and is_torch_available()): raise OptionalDependencyNotAvailable() except OptionalDependencyN...
362
'''simple docstring''' import unittest from datasets import load_dataset from transformers.pipelines import pipeline from transformers.testing_utils import is_pipeline_test, nested_simplify, require_torch, slow @is_pipeline_test @require_torch class __UpperCAmelCase ( unittest.TestCase ): ...
337
0
'''simple docstring''' def __a ( UpperCAmelCase = 100 ) ->int: """simple docstring""" A = n * (n + 1) * (2 * n + 1) / 6 A = (n * (n + 1) / 2) ** 2 return int(square_of_sum - sum_of_squares ) if __name__ == "__main__": print(f"{solution() = }")
363
'''simple docstring''' import argparse import glob import importlib.util import os import re import black from doc_builder.style_doc import style_docstrings_in_code # All paths are set with the intent you should run this script from the root of the repo with the command # python utils/check_copies.py _lowerC...
337
0
'''simple docstring''' from datetime import datetime import matplotlib.pyplot as plt import torch def __a ( UpperCAmelCase ) ->Optional[Any]: """simple docstring""" for param in module.parameters(): A = False def __a ( ) ->Tuple: """simple docstring...
364
'''simple docstring''' def __a ( UpperCAmelCase ) ->bool: """simple docstring""" return credit_card_number.startswith(("""34""", """35""", """37""", """4""", """5""", """6""") ) def __a ( UpperCAmelCase ) ->bool: """simple docstring""" A ...
337
0
'''simple docstring''' import os import unittest from transformers.models.transfo_xl.tokenization_transfo_xl import VOCAB_FILES_NAMES, TransfoXLTokenizer from ...test_tokenization_common import TokenizerTesterMixin class __UpperCAmelCase ( __lowerCAmelCase , unittest.TestCase ): ...
365
'''simple docstring''' import heapq as hq import math from collections.abc import Iterator class __UpperCAmelCase : '''simple docstring''' def __init__(self : Any , _lowerCAmelCase : List[Any] ): A = str(id_ ) A = None A = None A ...
337
0
'''simple docstring''' from __future__ import annotations import unittest from transformers import AutoTokenizer, PegasusConfig, is_tf_available from transformers.testing_utils import require_sentencepiece, require_tf, require_tokenizers, slow from transformers.utils import cached_property from ...test_confi...
366
'''simple docstring''' from collections import OrderedDict from typing import Any, Mapping, Optional, Union from ...configuration_utils import PretrainedConfig from ...feature_extraction_utils import FeatureExtractionMixin from ...onnx import OnnxConfig from ...onnx.utils import compute_effective_axis_dimensio...
337
0
'''simple docstring''' from collections import defaultdict from typing import Optional from ..image_utils import load_image from ..utils import ( add_end_docstrings, is_torch_available, logging, requires_backends, ) from .base import PIPELINE_INIT_ARGS, ChunkPipeline if is_torch_available(): ...
367
'''simple docstring''' import math class __UpperCAmelCase : '''simple docstring''' def __init__(self : int , _lowerCAmelCase : List[Any]=0 ): # a graph with Node 0,1,...,N-1 A = n A = [ [math.inf for j in range(0 , _lowerCAmelCase )] for i in...
337
0
'''simple docstring''' import argparse import logging import pickle import random import time import numpy as np from transformers import BertTokenizer, GPTaTokenizer, RobertaTokenizer logging.basicConfig( format='%(asctime)s - %(levelname)s - %(name)s - %(message)s', datefmt='%m/%d/%Y %H:%M:%S', level=...
368
'''simple docstring''' import json import re from typing import TYPE_CHECKING, List, Optional, Tuple, Union import numpy as np from ...utils import is_tf_available, is_torch_available, logging if TYPE_CHECKING: if is_torch_available(): import torch if is_tf_available(): import tensor...
337
0
def __a ( UpperCAmelCase ) ->Any: """simple docstring""" if number > 0: raise ValueError("""input must be a negative integer""" ) A = len(bin(__UpperCamelCase )[3:] ) A = bin(abs(__UpperCamelCase ) - (1 << binary_number_length) )[3:] A...
369
'''simple docstring''' from typing import TYPE_CHECKING from ...utils import OptionalDependencyNotAvailable, _LazyModule, is_torch_available _lowerCamelCase : Optional[Any] = { 'configuration_swinv2': ['SWINV2_PRETRAINED_CONFIG_ARCHIVE_MAP', 'Swinv2Config'], } try: if not is_torch_ava...
337
0
'''simple docstring''' import os import pytest from attr import dataclass _lowerCamelCase : int = 'us-east-1' # defaults region @dataclass class __UpperCAmelCase : '''simple docstring''' __lowerCAmelCase = 42 __lowerCAmelCase = "arn:aws:iam::55...
370
'''simple docstring''' 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 __UpperCAmelCase ( unittest.TestCase ): '''simple docstring''' ...
337
0
'''simple docstring''' from argparse import ArgumentParser, Namespace from typing import Any, List, Optional from ..pipelines import Pipeline, get_supported_tasks, pipeline from ..utils import logging from . import BaseTransformersCLICommand try: from fastapi import Body, FastAPI, HTTPException from ...
371
'''simple docstring''' from ..utils import DummyObject, requires_backends class __UpperCAmelCase ( metaclass=A__ ): '''simple docstring''' __lowerCAmelCase = ['''torch''', '''transformers''', '''onnx'''] def __init__(self : Tuple , *_lowerCAmelCase : Option...
337
0
'''simple docstring''' def __a ( UpperCAmelCase ) ->int: """simple docstring""" if not isinstance(__a , __a ): raise ValueError("""Input series is not valid, valid series - [2, 4, 6]""" ) if len(__a ) == 0: raise ValueError("""Input list must be a non empty ...
350
'''simple docstring''' 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, TrainerCa...
337
0
'''simple docstring''' from maths.prime_check import is_prime def __a ( UpperCAmelCase ) ->str: """simple docstring""" if not isinstance(A__ , A__ ): A = f"""Input value of [number={number}] must be an integer""" raise TypeError(A__ ) if is_prime(A...
351
'''simple docstring''' import json import os from typing import Optional, Tuple import regex as re from ...tokenization_utils import PreTrainedTokenizer from ...utils import logging _lowerCamelCase : Dict = logging.get_logger(__name__) _lowerCamelCase : List[str] = { 'vocab_...
337
0
import os from pathlib import Path import numpy as np import pytest from pack_dataset import pack_data_dir from parameterized import parameterized from save_len_file import save_len_file from torch.utils.data import DataLoader from transformers import AutoTokenizer from transformers.models.mbart.modeling_mbart ...
352
'''simple docstring''' _lowerCamelCase : List[Any] = 'Input must be a string of 8 numbers plus letter' _lowerCamelCase : str = 'TRWAGMYFPDXBNJZSQVHLCKE' def __a ( UpperCAmelCase ) ->bool: """simple docstring""" if not isinstance(UpperCAmelCase , ...
337
0
'''simple docstring''' import argparse import torch from transformers import GPTaConfig, GPTaModel, load_tf_weights_in_gpta from transformers.utils import CONFIG_NAME, WEIGHTS_NAME, logging logging.set_verbosity_info() def __a ( UpperCAmelCase , UpperCAmelCase , UpperCAmelCase ...
353
'''simple docstring''' from typing import Mapping from ...configuration_utils import PretrainedConfig from ...onnx import OnnxSeqaSeqConfigWithPast from ...utils import logging _lowerCamelCase : Dict = logging.get_logger(__name__) _lowerCamelCase : Any = { 'google/umt5-small'...
337
0
'''simple docstring''' import importlib import sys from argparse import REMAINDER, ArgumentParser from pathlib import Path import torch_xla.distributed.xla_multiprocessing as xmp def __a ( ) ->str: """simple docstring""" A = ArgumentParser( description=( """Py...
354
'''simple docstring''' from collections import OrderedDict from typing import Mapping from packaging import version from ...configuration_utils import PretrainedConfig from ...onnx import OnnxConfig from ...utils import logging _lowerCamelCase : List[Any] = logging.get_logger(__name__) _lower...
337
0
import json import os import shutil import tempfile import unittest import numpy as np import pytest from transformers import CLIPTokenizer, CLIPTokenizerFast from transformers.models.clip.tokenization_clip import VOCAB_FILES_NAMES from transformers.testing_utils import require_vision from transformers.utils im...
355
'''simple docstring''' from __future__ import annotations def __a ( UpperCAmelCase ) ->list[int]: """simple docstring""" return [ord(UpperCAmelCase ) - 96 for elem in plain] def __a ( UpperCAmelCase ) ->str: """simple docstring""" return "".join...
337
0
'''simple docstring''' # 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 # fu...
356
'''simple docstring''' import os def __a ( ) ->List[Any]: """simple docstring""" A = os.path.join(os.path.dirname(UpperCAmelCase ) , """num.txt""" ) with open(UpperCAmelCase ) as file_hand: return str(sum(int(UpperCAmelCase ) for line in file_ha...
337
0
'''simple docstring''' from collections import OrderedDict from typing import Mapping from ...configuration_utils import PretrainedConfig from ...onnx import OnnxConfig from ...utils import logging _lowerCamelCase : List[Any] = logging.get_logger(__name__) _lowerCamelCase : List[Any] ...
357
'''simple docstring''' from typing import List, Optional, Union import numpy as np import tensorflow as tf from .utils import logging _lowerCamelCase : List[Any] = logging.get_logger(__name__) def __a ( UpperCAmelCase ) ->List[int]: """simple docstring""" if isin...
337
0
'''simple docstring''' _lowerCamelCase : Optional[int] = range(2, 20 + 1) _lowerCamelCase : str = [10**k for k in range(ks[-1] + 1)] _lowerCamelCase : dict[int, dict[int, list[list[int]]]] = {} def __a ( UpperCAmelCase , UpperCAmelCase , Uppe...
358
'''simple docstring''' from binascii import hexlify from hashlib import shaaaa from os import urandom # RFC 3526 - More Modular Exponential (MODP) Diffie-Hellman groups for # Internet Key Exchange (IKE) https://tools.ietf.org/html/rfc3526 _lowerCamelCase : Any = { # 1536-bit 5: { ...
337
0
'''simple docstring''' import torch from diffusers import DDPMScheduler from .test_schedulers import SchedulerCommonTest class __UpperCAmelCase ( SCREAMING_SNAKE_CASE__ ): '''simple docstring''' __lowerCAmelCase = (DDPMScheduler,) def A (self : O...
359
'''simple docstring''' def __a ( UpperCAmelCase , UpperCAmelCase ) ->Tuple: """simple docstring""" if b == 0: return 1 if (b % 2) == 0: return actual_power(UpperCAmelCase , int(b / 2 ) ) * actual_power(UpperCAmelCase , int(b / 2 ) ) else:...
337
0
'''simple docstring''' import collections from typing import List, Optional, Union from ...tokenization_utils_base import BatchEncoding from ...utils import TensorType, add_end_docstrings, add_start_docstrings, logging from ..bert.tokenization_bert_fast import BertTokenizerFast from .tokenization_dpr import DP...
360
'''simple docstring''' from __future__ import annotations import collections import tempfile import unittest import numpy as np from transformers.testing_utils import require_tf, require_vision, slow from transformers.utils import is_tf_available, is_vision_available from ...test_modeling_tf_common import f...
337
0
'''simple docstring''' from __future__ import annotations def __a ( UpperCAmelCase ) ->list[int]: """simple docstring""" A = [True] * limit A = False A = False A = True for i in range(3 , int(limit**0.5 + 1 ) , 2 ...
361
'''simple docstring''' from collections import OrderedDict from ...utils import logging from .auto_factory import _BaseAutoModelClass, _LazyAutoMapping, auto_class_update from .configuration_auto import CONFIG_MAPPING_NAMES _lowerCamelCase : List[str] = logging.get_logger(__name__) _lowerCame...
337
0
'''simple docstring''' from __future__ import annotations def __a ( UpperCAmelCase , UpperCAmelCase ) ->Optional[int]: """simple docstring""" if len(__snake_case ) <= 1 or n <= 1: return insert_next(__snake_case , n - 1 ) rec_insertion_sort(__snake_cas...
362
'''simple docstring''' import unittest from datasets import load_dataset from transformers.pipelines import pipeline from transformers.testing_utils import is_pipeline_test, nested_simplify, require_torch, slow @is_pipeline_test @require_torch class __UpperCAmelCase ( unittest.TestCase ): ...
337
0
'''simple docstring''' from collections import OrderedDict from typing import Mapping from packaging import version from ...configuration_utils import PretrainedConfig from ...onnx import OnnxConfig from ...utils import logging _lowerCamelCase : Optional[int] = logging.get_logger(__name__) _l...
363
'''simple docstring''' import argparse import glob import importlib.util import os import re import black from doc_builder.style_doc import style_docstrings_in_code # All paths are set with the intent you should run this script from the root of the repo with the command # python utils/check_copies.py _lowerC...
337
0
'''simple docstring''' from collections import OrderedDict from typing import Mapping from packaging import version from ...configuration_utils import PretrainedConfig from ...onnx import OnnxConfig from ...utils import logging _lowerCamelCase : Dict = logging.get_logger(__name__) _lowerCamel...
364
'''simple docstring''' def __a ( UpperCAmelCase ) ->bool: """simple docstring""" return credit_card_number.startswith(("""34""", """35""", """37""", """4""", """5""", """6""") ) def __a ( UpperCAmelCase ) ->bool: """simple docstring""" A ...
337
0
'''simple docstring''' import argparse import json import numpy import torch from transformers.models.xlm.tokenization_xlm import VOCAB_FILES_NAMES from transformers.utils import CONFIG_NAME, WEIGHTS_NAME, logging logging.set_verbosity_info() def __a ( UpperCAmelCase , UpperCAmelCase )...
365
'''simple docstring''' import heapq as hq import math from collections.abc import Iterator class __UpperCAmelCase : '''simple docstring''' def __init__(self : Any , _lowerCAmelCase : List[Any] ): A = str(id_ ) A = None A = None A ...
337
0
'''simple docstring''' from typing import Dict, List, Optional, Union import numpy as np from ...image_processing_utils import BaseImageProcessor, BatchFeature, get_size_dict from ...image_transforms import ( center_crop, get_resize_output_image_size, normalize, rescale, resize, to_cha...
366
'''simple docstring''' from collections import OrderedDict from typing import Any, Mapping, Optional, Union from ...configuration_utils import PretrainedConfig from ...feature_extraction_utils import FeatureExtractionMixin from ...onnx import OnnxConfig from ...onnx.utils import compute_effective_axis_dimensio...
337
0
'''simple docstring''' import json import os import tempfile from unittest.mock import patch import torch from torch.utils.data import DataLoader, TensorDataset from accelerate import DistributedType, infer_auto_device_map, init_empty_weights from accelerate.accelerator import Accelerator from accelerate.stat...
367
'''simple docstring''' import math class __UpperCAmelCase : '''simple docstring''' def __init__(self : int , _lowerCAmelCase : List[Any]=0 ): # a graph with Node 0,1,...,N-1 A = n A = [ [math.inf for j in range(0 , _lowerCAmelCase )] for i in...
337
0
'''simple docstring''' import numpy as np import torch from torch.utils.data import Dataset, IterableDataset from ..utils.generic import ModelOutput class __UpperCAmelCase ( UpperCamelCase__ ): '''simple docstring''' def __init__(self : List[str] , _lowerCAmelCase : List[s...
368
'''simple docstring''' import json import re from typing import TYPE_CHECKING, List, Optional, Tuple, Union import numpy as np from ...utils import is_tf_available, is_torch_available, logging if TYPE_CHECKING: if is_torch_available(): import torch if is_tf_available(): import tensor...
337
0
import math import unittest def __a ( UpperCAmelCase ) ->bool: """simple docstring""" assert isinstance(lowerCAmelCase_ , lowerCAmelCase_ ) and ( number >= 0 ), "'number' must been an int and positive" if 1 < number < 4: # 2 and 3 are primes return True elif...
369
'''simple docstring''' from typing import TYPE_CHECKING from ...utils import OptionalDependencyNotAvailable, _LazyModule, is_torch_available _lowerCamelCase : Optional[Any] = { 'configuration_swinv2': ['SWINV2_PRETRAINED_CONFIG_ARCHIVE_MAP', 'Swinv2Config'], } try: if not is_torch_ava...
337
0
'''simple docstring''' def __a ( UpperCAmelCase ) ->float: """simple docstring""" if not nums: # Makes sure that the list is not empty raise ValueError("""List is empty""" ) A = sum(__SCREAMING_SNAKE_CASE ) / len(__SCREAMING_SNAKE_CASE ) # Calculate the...
370
'''simple docstring''' 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 __UpperCAmelCase ( unittest.TestCase ): '''simple docstring''' ...
337
0