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 collections import OrderedDict from typing import TYPE_CHECKING, Any, Mapping, Optional from packaging import version from ...configuration_utils import PretrainedConfig from ...onnx import OnnxConfig from ...onnx.utils import compute_effective_axis_dimension from ...utils import ...
371
"""simple docstring""" from operator import delitem, getitem, setitem import pytest from data_structures.hashing.hash_map import HashMap def __UpperCAmelCase ( snake_case_ : Union[str, Any] ) -> Dict: """simple docstring""" return getitem, k def __UpperCAm...
317
0
"""simple docstring""" from ..models.auto import AutoModelForSeqaSeqLM, AutoTokenizer from .base import PipelineTool SCREAMING_SNAKE_CASE : Optional[Any] = { '''Acehnese Arabic''': '''ace_Arab''', '''Acehnese Latin''': '''ace_Latn''', '''Mesopotamian Arabic''': '''acm_Arab''', ...
350
"""simple docstring""" def __UpperCAmelCase ( snake_case_ : int , snake_case_ : list[int] , snake_case_ : int ) -> int: """simple docstring""" def count_of_possible_combinations(snake_case_ : int ) -> int: if target < 0: r...
317
0
"""simple docstring""" import json import os from typing import Optional, Tuple from ...tokenization_utils import PreTrainedTokenizer from ...utils import logging SCREAMING_SNAKE_CASE : Any = logging.get_logger(__name__) SCREAMING_SNAKE_CASE : List[Any] = {'''vocab_file''': ...
351
"""simple docstring""" from __future__ import annotations import string from itertools import cycle, product from pathlib import Path SCREAMING_SNAKE_CASE : str = ( string.ascii_letters + string.digits + string.punctuation + string.whitespace ) SCREAMING_SNAKE_CASE : list[int] ...
317
0
"""simple docstring""" import string import numpy def __UpperCAmelCase ( snake_case_ : int , snake_case_ : int ) -> int: return b if a == 0 else greatest_common_divisor(b % a , snake_case_ ) class __lowerCamelCase : __UpperCamelCase = ...
352
"""simple docstring""" def __UpperCAmelCase ( snake_case_ : int = 1000000 ) -> int: """simple docstring""" _lowerCAmelCase = limit + 1 _lowerCAmelCase = [0] * limit for first_term in range(1 , snake_case_ ): for n in range(sn...
317
0
"""simple docstring""" import os SCREAMING_SNAKE_CASE : List[Any] = {'''I''': 1, '''V''': 5, '''X''': 1_0, '''L''': 5_0, '''C''': 1_0_0, '''D''': 5_0_0, '''M''': 1_0_0_0} def __UpperCAmelCase ( snake_case_ : str ) -> int: """simp...
353
"""simple docstring""" from functools import reduce SCREAMING_SNAKE_CASE : int = ( '''73167176531330624919225119674426574742355349194934''' '''96983520312774506326239578318016984801869478851843''' '''85861560789112949495459501737958331952853208805511''' '''1254069874715852386305...
317
0
"""simple docstring""" from __future__ import annotations import unittest from transformers import MobileBertConfig, is_tf_available from transformers.models.auto import get_values from transformers.testing_utils import require_tf, slow from ...test_configuration_common import ConfigTester from ...test_mode...
354
"""simple docstring""" def __UpperCAmelCase ( snake_case_ : int = 600851475143 ) -> int: """simple docstring""" try: _lowerCAmelCase = int(snake_case_ ) except (TypeError, ValueError): raise TypeError("""Parameter n must be int or castable ...
317
0
"""simple docstring""" 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_ ...
355
"""simple docstring""" import logging import os import sys from dataclasses import dataclass, field from typing import Optional from seqaseq_trainer import SeqaSeqTrainer from seqaseq_training_args import SeqaSeqTrainingArguments import transformers from transformers import ( AutoConfig, AutoModelFor...
317
0
"""simple docstring""" def __UpperCAmelCase ( snake_case_ : int ) -> int: """simple docstring""" if divisor % 5 == 0 or divisor % 2 == 0: return 0 _lowerCAmelCase = 1 _lowerCAmelCase = 1 while repunit: _lowerCAmelCase ...
356
"""simple docstring""" from typing import TYPE_CHECKING # rely on isort to merge the imports from ...utils import OptionalDependencyNotAvailable, _LazyModule, is_torch_available SCREAMING_SNAKE_CASE : List[Any] = {'''configuration_focalnet''': ['''FOCALNET_PRETRAINED_CONFIG_ARCHIVE_MAP''', ''...
317
0
from typing import TYPE_CHECKING from ...file_utils import _LazyModule, is_torch_available from ...utils import OptionalDependencyNotAvailable SCREAMING_SNAKE_CASE : List[Any] = { '''configuration_gpt_neox_japanese''': ['''GPT_NEOX_JAPANESE_PRETRAINED_CONFIG_ARCHIVE_MAP''', '''GPTNeoXJapaneseC...
357
"""simple docstring""" import unittest import numpy as np from transformers.testing_utils import require_torch, require_vision from transformers.utils import is_torch_available, is_vision_available from ...test_image_processing_common import ImageProcessingSavingTestMixin, prepare_image_inputs if is_torch...
317
0
import torch from diffusers import StableDiffusionPipeline SCREAMING_SNAKE_CASE : Tuple = '''path-to-your-trained-model''' SCREAMING_SNAKE_CASE : Tuple = StableDiffusionPipeline.from_pretrained(model_id, torch_dtype=torch.floataa).to('''cuda''') SCREAMING_SNAKE_CASE : Any ...
358
"""simple docstring""" def __UpperCAmelCase ( snake_case_ : list ) -> list: """simple docstring""" for i in range(len(snake_case_ ) - 1 , 0 , -1 ): _lowerCAmelCase = False for j in range(snake_case_ , 0 , -1 ): ...
317
0
"""simple docstring""" from statistics import mean, stdev def __UpperCAmelCase ( snake_case_ : list , snake_case_ : int = 3 ) -> list: """simple docstring""" _lowerCAmelCase = min(snake_case_ ) _lowerCAmelCase = max(snak...
359
"""simple docstring""" import random import timeit from functools import wraps from typing import Callable, Optional from ..configuration_utils import PretrainedConfig from ..models.auto.modeling_tf_auto import TF_MODEL_MAPPING, TF_MODEL_WITH_LM_HEAD_MAPPING from ..utils import is_pyanvml_available, is_tf_ava...
317
0
"""simple docstring""" from typing import List, Union from ..utils import ( add_end_docstrings, is_tf_available, is_torch_available, is_vision_available, logging, requires_backends, ) from .base import PIPELINE_INIT_ARGS, Pipeline if is_vision_available(): from PIL import Image ...
360
"""simple docstring""" from ...configuration_utils import PretrainedConfig from ...utils import logging SCREAMING_SNAKE_CASE : int = logging.get_logger(__name__) SCREAMING_SNAKE_CASE : Any = { '''transfo-xl-wt103''': '''https://huggingface.co/transfo-xl-wt103/resolve/main/c...
317
0
"""simple docstring""" import argparse import collections import os import re import tempfile import pandas as pd from datasets import Dataset from huggingface_hub import hf_hub_download, upload_folder from transformers.utils import direct_transformers_import # All paths are set with the intent you should ...
361
"""simple docstring""" import math def __UpperCAmelCase ( snake_case_ : int ) -> list[int]: """simple docstring""" _lowerCAmelCase = [] _lowerCAmelCase = 2 _lowerCAmelCase = int(math.sqrt(snake_case_ ) ) # Size ...
317
0
"""simple docstring""" import doctest import glob import importlib import inspect import os import re from contextlib import contextmanager from functools import wraps from unittest.mock import patch import numpy as np import pytest from absl.testing import parameterized import datasets from datasets import...
362
"""simple docstring""" import glob import os import random from string import ascii_lowercase, digits import cva import numpy as np # Parrameters SCREAMING_SNAKE_CASE : Any = (7_2_0, 1_2_8_0) # Height, Width SCREAMING_SNAKE_CASE : List[str] = (0.4, 0.6) # if height or width lo...
317
0
"""simple docstring""" import json import os from datetime import date from pathlib import Path from tabulate import DataRow, TableFormat, tabulate SCREAMING_SNAKE_CASE : Tuple = TableFormat( lineabove=None, linebelowheader=None, linebetweenrows=None, linebelow=None, heade...
363
"""simple docstring""" # tests directory-specific settings - this file is run automatically # by pytest before any tests are run import sys import warnings from os.path import abspath, dirname, join # allow having multiple repository checkouts and not needing to remember to rerun # 'pip install -e .[dev]' w...
317
0
"""simple docstring""" import warnings from ...utils import logging from .image_processing_beit import BeitImageProcessor SCREAMING_SNAKE_CASE : str = logging.get_logger(__name__) class __lowerCamelCase ( __lowercase ): def __init__(self , *lowerCamelCase , **low...
364
"""simple docstring""" # 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...
317
0
"""simple docstring""" from ...processing_utils import ProcessorMixin class __lowerCamelCase ( __lowercase ): __UpperCamelCase = ['image_processor', 'feature_extractor'] __UpperCamelCase = 'TvltImageProcessor' __UpperCamelCase = 'TvltFeatureExtr...
365
"""simple docstring""" from math import isqrt def __UpperCAmelCase ( snake_case_ : int ) -> list[int]: """simple docstring""" _lowerCAmelCase = [True] * max_number for i in range(2 , isqrt(max_number - 1 ) + 1 ): if is_prime[i]: ...
317
0
"""simple docstring""" import unittest from transformers import MODEL_FOR_ZERO_SHOT_OBJECT_DETECTION_MAPPING, is_vision_available, pipeline from transformers.testing_utils import ( is_pipeline_test, nested_simplify, require_tf, require_torch, require_vision, slow, ) from .test_pipelin...
366
"""simple docstring""" # 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...
317
0
"""simple docstring""" import warnings from ...utils import logging from .image_processing_videomae import VideoMAEImageProcessor SCREAMING_SNAKE_CASE : Optional[Any] = logging.get_logger(__name__) class __lowerCamelCase ( __lowercase ): def __init__(self , *lowerCam...
367
"""simple docstring""" from __future__ import annotations import queue class __lowerCamelCase : def __init__(self , lowerCamelCase ): '''simple docstring''' _lowerCAmelCase = data _lowerCAmelCase = None _lowerCAmelCase = ...
317
0
"""simple docstring""" SCREAMING_SNAKE_CASE : Any = 0 # The first color of the flag. SCREAMING_SNAKE_CASE : Optional[int] = 1 # The second color of the flag. SCREAMING_SNAKE_CASE : List[str] = 2 # The third color of the flag. SCREAMING_SNAKE_CASE : Option...
368
"""simple docstring""" from __future__ import annotations class __lowerCamelCase : def __init__(self , lowerCamelCase , lowerCamelCase ): '''simple docstring''' _lowerCAmelCase , _lowerCAmelCase = text, pattern _lowerCAmelCase , _low...
317
0
"""simple docstring""" import argparse import torch from transformers import BertForMaskedLM if __name__ == "__main__": SCREAMING_SNAKE_CASE : Tuple = argparse.ArgumentParser( description=( '''Extraction some layers of the full BertForMaskedLM or RObertaForMaske...
369
"""simple docstring""" import unittest import numpy as np import torch from diffusers import VersatileDiffusionImageVariationPipeline from diffusers.utils.testing_utils import load_image, require_torch_gpu, slow, torch_device SCREAMING_SNAKE_CASE : List[str] = False class __lowerCamelCase...
317
0
"""simple docstring""" def __UpperCAmelCase ( snake_case_ : Any ) -> List[str]: """simple docstring""" _lowerCAmelCase , _lowerCAmelCase = [], [] while len(snake_case_ ) > 1: _lowerCAmelCase , _lowerCAmelCase = min(sna...
370
"""simple docstring""" import gc import unittest import numpy as np import torch from diffusers import AutoencoderKL, DDIMScheduler, DiTPipeline, DPMSolverMultistepScheduler, TransformeraDModel from diffusers.utils import is_xformers_available, load_numpy, slow, torch_device from diffusers.utils.testing_util...
317
0
"""simple docstring""" from __future__ import annotations def __UpperCAmelCase ( snake_case_ : int , snake_case_ : int ) -> list[list[int]]: """simple docstring""" _lowerCAmelCase = [] create_all_state(1 , snake_case_ , snake_cas...
371
"""simple docstring""" from operator import delitem, getitem, setitem import pytest from data_structures.hashing.hash_map import HashMap def __UpperCAmelCase ( snake_case_ : Union[str, Any] ) -> Dict: """simple docstring""" return getitem, k def __UpperCAm...
317
0
"""simple docstring""" from __future__ import annotations def __UpperCAmelCase ( snake_case_ : list[list[int]] ) -> int: """simple docstring""" for i in range(1 , len(matrix[0] ) ): matrix[0][i] += matrix[0][i - 1] # preprocessing the first colum...
350
"""simple docstring""" def __UpperCAmelCase ( snake_case_ : int , snake_case_ : list[int] , snake_case_ : int ) -> int: """simple docstring""" def count_of_possible_combinations(snake_case_ : int ) -> int: if target < 0: r...
317
0
"""simple docstring""" from ...configuration_utils import PretrainedConfig class __lowerCamelCase ( __lowercase ): __UpperCamelCase = 'bert-generation' def __init__(self , lowerCamelCase=50_358 , lowerCamelCase=1_024 , lowerCamelCase=24 , lowerCamelCase...
351
"""simple docstring""" from __future__ import annotations import string from itertools import cycle, product from pathlib import Path SCREAMING_SNAKE_CASE : str = ( string.ascii_letters + string.digits + string.punctuation + string.whitespace ) SCREAMING_SNAKE_CASE : list[int] ...
317
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, ) SCREAMING_SNAKE_CASE : List[Any] = { '''configuration_rofo...
352
"""simple docstring""" def __UpperCAmelCase ( snake_case_ : int = 1000000 ) -> int: """simple docstring""" _lowerCAmelCase = limit + 1 _lowerCAmelCase = [0] * limit for first_term in range(1 , snake_case_ ): for n in range(sn...
317
0
"""simple docstring""" from functools import reduce SCREAMING_SNAKE_CASE : int = ( '''73167176531330624919225119674426574742355349194934''' '''96983520312774506326239578318016984801869478851843''' '''85861560789112949495459501737958331952853208805511''' '''125406...
353
"""simple docstring""" from functools import reduce SCREAMING_SNAKE_CASE : int = ( '''73167176531330624919225119674426574742355349194934''' '''96983520312774506326239578318016984801869478851843''' '''85861560789112949495459501737958331952853208805511''' '''1254069874715852386305...
317
0
"""simple docstring""" from tempfile import TemporaryDirectory from unittest import TestCase from unittest.mock import MagicMock, patch from transformers import AutoModel, TFAutoModel from transformers.onnx import FeaturesManager from transformers.testing_utils import SMALL_MODEL_IDENTIFIER, require_tf, requi...
354
"""simple docstring""" def __UpperCAmelCase ( snake_case_ : int = 600851475143 ) -> int: """simple docstring""" try: _lowerCAmelCase = int(snake_case_ ) except (TypeError, ValueError): raise TypeError("""Parameter n must be int or castable ...
317
0
"""simple docstring""" from ...configuration_utils import PretrainedConfig from ...utils import logging SCREAMING_SNAKE_CASE : int = logging.get_logger(__name__) SCREAMING_SNAKE_CASE : Any = { '''transfo-xl-wt103''': '''https://huggingface.co/transfo-xl-wt1...
355
"""simple docstring""" import logging import os import sys from dataclasses import dataclass, field from typing import Optional from seqaseq_trainer import SeqaSeqTrainer from seqaseq_training_args import SeqaSeqTrainingArguments import transformers from transformers import ( AutoConfig, AutoModelFor...
317
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, BatchEncoding, PreTrainedTokenizer from ...utils import logging SCREAMING_SNAKE_CASE : str = logging.ge...
356
"""simple docstring""" from typing import TYPE_CHECKING # rely on isort to merge the imports from ...utils import OptionalDependencyNotAvailable, _LazyModule, is_torch_available SCREAMING_SNAKE_CASE : List[Any] = {'''configuration_focalnet''': ['''FOCALNET_PRETRAINED_CONFIG_ARCHIVE_MAP''', ''...
317
0
import argparse from collections import OrderedDict from pathlib import Path import torch from transformers import ( VisualBertConfig, VisualBertForMultipleChoice, VisualBertForPreTraining, VisualBertForQuestionAnswering, VisualBertForVisualReasoning, ) from transformers.utils import logging ...
357
"""simple docstring""" import unittest import numpy as np from transformers.testing_utils import require_torch, require_vision from transformers.utils import is_torch_available, is_vision_available from ...test_image_processing_common import ImageProcessingSavingTestMixin, prepare_image_inputs if is_torch...
317
0
from ...processing_utils import ProcessorMixin from ...tokenization_utils_base import BatchEncoding class __lowerCamelCase ( __lowercase ): __UpperCamelCase = ['image_processor', 'tokenizer'] __UpperCamelCase = 'AutoImageProcessor' __UpperCamelCase = ...
358
"""simple docstring""" def __UpperCAmelCase ( snake_case_ : list ) -> list: """simple docstring""" for i in range(len(snake_case_ ) - 1 , 0 , -1 ): _lowerCAmelCase = False for j in range(snake_case_ , 0 , -1 ): ...
317
0
"""simple docstring""" def __UpperCAmelCase ( snake_case_ : Any , snake_case_ : Tuple ) -> Optional[Any]: """simple docstring""" _lowerCAmelCase = [0 for i in range(r + 1 )] # nc0 = 1 _lowerCAmelCase = 1 for i in range(1...
359
"""simple docstring""" import random import timeit from functools import wraps from typing import Callable, Optional from ..configuration_utils import PretrainedConfig from ..models.auto.modeling_tf_auto import TF_MODEL_MAPPING, TF_MODEL_WITH_LM_HEAD_MAPPING from ..utils import is_pyanvml_available, is_tf_ava...
317
0
"""simple docstring""" from . import ( albert, align, altclip, audio_spectrogram_transformer, auto, autoformer, bark, bart, barthez, bartpho, beit, bert, bert_generation, bert_japanese, bertweet, big_bird, bigbird_pegasus, biogpt, bit,...
360
"""simple docstring""" from ...configuration_utils import PretrainedConfig from ...utils import logging SCREAMING_SNAKE_CASE : int = logging.get_logger(__name__) SCREAMING_SNAKE_CASE : Any = { '''transfo-xl-wt103''': '''https://huggingface.co/transfo-xl-wt103/resolve/main/c...
317
0
"""simple docstring""" from ...configuration_utils import PretrainedConfig from ...utils import logging SCREAMING_SNAKE_CASE : List[Any] = logging.get_logger(__name__) SCREAMING_SNAKE_CASE : List[str] = { '''facebook/vit-mae-base''': '''https://huggingface.co/facebook/vit-m...
361
"""simple docstring""" import math def __UpperCAmelCase ( snake_case_ : int ) -> list[int]: """simple docstring""" _lowerCAmelCase = [] _lowerCAmelCase = 2 _lowerCAmelCase = int(math.sqrt(snake_case_ ) ) # Size ...
317
0
"""simple docstring""" from ...configuration_utils import PretrainedConfig from ...utils import logging SCREAMING_SNAKE_CASE : Optional[int] = logging.get_logger(__name__) SCREAMING_SNAKE_CASE : Dict = { '''alibaba-damo/mgp-str-base''': '''https://huggingface.co/alibaba-da...
362
"""simple docstring""" import glob import os import random from string import ascii_lowercase, digits import cva import numpy as np # Parrameters SCREAMING_SNAKE_CASE : Any = (7_2_0, 1_2_8_0) # Height, Width SCREAMING_SNAKE_CASE : List[str] = (0.4, 0.6) # if height or width lo...
317
0
"""simple docstring""" from ...configuration_utils import PretrainedConfig from ...utils import logging SCREAMING_SNAKE_CASE : List[str] = logging.get_logger(__name__) SCREAMING_SNAKE_CASE : Any = { '''funnel-transformer/small''': '''https://huggingface.co/funnel-transforme...
363
"""simple docstring""" # tests directory-specific settings - this file is run automatically # by pytest before any tests are run import sys import warnings from os.path import abspath, dirname, join # allow having multiple repository checkouts and not needing to remember to rerun # 'pip install -e .[dev]' w...
317
0
"""simple docstring""" from dataclasses import dataclass, field from typing import TYPE_CHECKING, Any, ClassVar, Dict, List, Optional, Union import pyarrow as pa if TYPE_CHECKING: from .features import FeatureType @dataclass class __lowerCamelCase : __UpperCamelCase = 42 __UpperCa...
364
"""simple docstring""" # 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...
317
0
"""simple docstring""" def __UpperCAmelCase ( snake_case_ : str , snake_case_ : str ) -> list: """simple docstring""" _lowerCAmelCase = len(snake_case_ ) _lowerCAmelCase = [] for i in range(len(snake_case_ ) - pat_len + ...
365
"""simple docstring""" from math import isqrt def __UpperCAmelCase ( snake_case_ : int ) -> list[int]: """simple docstring""" _lowerCAmelCase = [True] * max_number for i in range(2 , isqrt(max_number - 1 ) + 1 ): if is_prime[i]: ...
317
0
"""simple docstring""" def __UpperCAmelCase ( snake_case_ : str , snake_case_ : str ): """simple docstring""" if not (isinstance(snake_case_ , snake_case_ ) and isinstance(snake_case_ , snake_case_ )): raise ValueError("""longest_common_substring(...
366
"""simple docstring""" # 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...
317
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.sta...
367
"""simple docstring""" from __future__ import annotations import queue class __lowerCamelCase : def __init__(self , lowerCamelCase ): '''simple docstring''' _lowerCAmelCase = data _lowerCAmelCase = None _lowerCAmelCase = ...
317
0
"""simple docstring""" import unittest from queue import Empty from threading import Thread from transformers import AutoTokenizer, TextIteratorStreamer, TextStreamer, is_torch_available from transformers.testing_utils import CaptureStdout, require_torch, torch_device from ..test_modeling_common import ids_t...
368
"""simple docstring""" from __future__ import annotations class __lowerCamelCase : def __init__(self , lowerCamelCase , lowerCamelCase ): '''simple docstring''' _lowerCAmelCase , _lowerCAmelCase = text, pattern _lowerCAmelCase , _low...
317
0
"""simple docstring""" import json import os import torch from diffusers import UNetaDModel os.makedirs('''hub/hopper-medium-v2/unet/hor32''', exist_ok=True) os.makedirs('''hub/hopper-medium-v2/unet/hor128''', exist_ok=True) os.makedirs('''hub/hopper-medium-v2/value_function''', exist_ok=True) def ...
369
"""simple docstring""" import unittest import numpy as np import torch from diffusers import VersatileDiffusionImageVariationPipeline from diffusers.utils.testing_utils import load_image, require_torch_gpu, slow, torch_device SCREAMING_SNAKE_CASE : List[str] = False class __lowerCamelCase...
317
0
"""simple docstring""" import tempfile import numpy as np import torch from transformers import AutoTokenizer, TaEncoderModel from diffusers import DDPMScheduler, UNetaDConditionModel from diffusers.models.attention_processor import AttnAddedKVProcessor from diffusers.pipelines.deepfloyd_if import IFWatermar...
370
"""simple docstring""" import gc import unittest import numpy as np import torch from diffusers import AutoencoderKL, DDIMScheduler, DiTPipeline, DPMSolverMultistepScheduler, TransformeraDModel from diffusers.utils import is_xformers_available, load_numpy, slow, torch_device from diffusers.utils.testing_util...
317
0
"""simple docstring""" import json from typing import Iterator, List, Union from tokenizers import AddedToken, Regex, Tokenizer, decoders, normalizers, pre_tokenizers, trainers from tokenizers.implementations.base_tokenizer import BaseTokenizer from tokenizers.models import Unigram from tokenizers.processors ...
371
"""simple docstring""" from operator import delitem, getitem, setitem import pytest from data_structures.hashing.hash_map import HashMap def __UpperCAmelCase ( snake_case_ : Union[str, Any] ) -> Dict: """simple docstring""" return getitem, k def __UpperCAm...
317
0
"""simple docstring""" import os import time import warnings from dataclasses import dataclass, field from enum import Enum from typing import List, Optional, Union import torch from filelock import FileLock from torch.utils.data import Dataset from ...tokenization_utils_base import PreTrainedTokenizerBase f...
350
"""simple docstring""" def __UpperCAmelCase ( snake_case_ : int , snake_case_ : list[int] , snake_case_ : int ) -> int: """simple docstring""" def count_of_possible_combinations(snake_case_ : int ) -> int: if target < 0: r...
317
0
"""simple docstring""" from typing import TYPE_CHECKING from ...utils import ( OptionalDependencyNotAvailable, _LazyModule, is_tf_available, is_torch_available, is_vision_available, ) SCREAMING_SNAKE_CASE : Dict = { '''configuration_efficientformer''': [ '''E...
351
"""simple docstring""" from __future__ import annotations import string from itertools import cycle, product from pathlib import Path SCREAMING_SNAKE_CASE : str = ( string.ascii_letters + string.digits + string.punctuation + string.whitespace ) SCREAMING_SNAKE_CASE : list[int] ...
317
0
"""simple docstring""" def __UpperCAmelCase ( snake_case_ : list , snake_case_ : list ) -> float: _validate_point(snake_case_ ) _validate_point(snake_case_ ) if len(snake_case_ ) != len(snake_case_ ): raise ValueError("""Both points must be in the...
352
"""simple docstring""" def __UpperCAmelCase ( snake_case_ : int = 1000000 ) -> int: """simple docstring""" _lowerCAmelCase = limit + 1 _lowerCAmelCase = [0] * limit for first_term in range(1 , snake_case_ ): for n in range(sn...
317
0
"""simple docstring""" from ...configuration_utils import PretrainedConfig from ...utils import logging SCREAMING_SNAKE_CASE : List[str] = logging.get_logger(__name__) SCREAMING_SNAKE_CASE : Any = {'''ctrl''': '''https://huggingface.co/ctrl/resolve/main/config.j...
353
"""simple docstring""" from functools import reduce SCREAMING_SNAKE_CASE : int = ( '''73167176531330624919225119674426574742355349194934''' '''96983520312774506326239578318016984801869478851843''' '''85861560789112949495459501737958331952853208805511''' '''1254069874715852386305...
317
0
"""simple docstring""" import subprocess import sys from transformers import BertConfig, BertModel, BertTokenizer, pipeline from transformers.testing_utils import TestCasePlus, require_torch class __lowerCamelCase ( __lowercase ): @require_torch def A__ (self ): ''...
354
"""simple docstring""" def __UpperCAmelCase ( snake_case_ : int = 600851475143 ) -> int: """simple docstring""" try: _lowerCAmelCase = int(snake_case_ ) except (TypeError, ValueError): raise TypeError("""Parameter n must be int or castable ...
317
0
"""simple docstring""" import os from shutil import copyfile from typing import List, Optional, Tuple from ...tokenization_utils_fast import PreTrainedTokenizerFast from ...utils import is_sentencepiece_available, logging if is_sentencepiece_available(): from .tokenization_pegasus impor...
355
"""simple docstring""" import logging import os import sys from dataclasses import dataclass, field from typing import Optional from seqaseq_trainer import SeqaSeqTrainer from seqaseq_training_args import SeqaSeqTrainingArguments import transformers from transformers import ( AutoConfig, AutoModelFor...
317
0
"""simple docstring""" from typing import TYPE_CHECKING from ...utils import OptionalDependencyNotAvailable, _LazyModule, is_torch_available, is_vision_available SCREAMING_SNAKE_CASE : Optional[Any] = { '''configuration_pix2struct''': [ '''PIX2STRUCT_PRETRAINED_CONFIG_ARCHIVE_MA...
356
"""simple docstring""" from typing import TYPE_CHECKING # rely on isort to merge the imports from ...utils import OptionalDependencyNotAvailable, _LazyModule, is_torch_available SCREAMING_SNAKE_CASE : List[Any] = {'''configuration_focalnet''': ['''FOCALNET_PRETRAINED_CONFIG_ARCHIVE_MAP''', ''...
317
0
def __UpperCAmelCase ( snake_case_ : Any ) -> List[str]: """simple docstring""" _lowerCAmelCase = len(snake_case_ ) _lowerCAmelCase = sum(snake_case_ ) _lowerCAmelCase = [[False for x in range(s + 1 )] for y in range(n ...
357
"""simple docstring""" import unittest import numpy as np from transformers.testing_utils import require_torch, require_vision from transformers.utils import is_torch_available, is_vision_available from ...test_image_processing_common import ImageProcessingSavingTestMixin, prepare_image_inputs if is_torch...
317
0
import json import os import shutil import tempfile import unittest import numpy as np from transformers import BertTokenizerFast from transformers.models.bert.tokenization_bert import VOCAB_FILES_NAMES, BertTokenizer from transformers.testing_utils import require_tokenizers, require_vision from transformers.util...
358
"""simple docstring""" def __UpperCAmelCase ( snake_case_ : list ) -> list: """simple docstring""" for i in range(len(snake_case_ ) - 1 , 0 , -1 ): _lowerCAmelCase = False for j in range(snake_case_ , 0 , -1 ): ...
317
0
"""simple docstring""" import argparse import os from pathlib import Path import fairseq import torch from packaging import version from torch import nn from transformers import ( BartConfig, BartForConditionalGeneration, BartForSequenceClassification, BartModel, BartTokenizer, ) from tra...
359
"""simple docstring""" import random import timeit from functools import wraps from typing import Callable, Optional from ..configuration_utils import PretrainedConfig from ..models.auto.modeling_tf_auto import TF_MODEL_MAPPING, TF_MODEL_WITH_LM_HEAD_MAPPING from ..utils import is_pyanvml_available, is_tf_ava...
317
0
"""simple docstring""" import os import sys import warnings from dataclasses import dataclass, field from io import BytesIO from typing import TYPE_CHECKING, Any, ClassVar, Dict, List, Optional, Union import numpy as np import pyarrow as pa from .. import config from ..download.streaming_download_manager imp...
360
"""simple docstring""" from ...configuration_utils import PretrainedConfig from ...utils import logging SCREAMING_SNAKE_CASE : int = logging.get_logger(__name__) SCREAMING_SNAKE_CASE : Any = { '''transfo-xl-wt103''': '''https://huggingface.co/transfo-xl-wt103/resolve/main/c...
317
0
"""simple docstring""" import numpy as np import torch from ..models.clipseg import CLIPSegForImageSegmentation from ..utils import is_vision_available, requires_backends from .base import PipelineTool if is_vision_available(): from PIL import Image class __lowerCamelCase ( __lowercase ): _...
361
"""simple docstring""" import math def __UpperCAmelCase ( snake_case_ : int ) -> list[int]: """simple docstring""" _lowerCAmelCase = [] _lowerCAmelCase = 2 _lowerCAmelCase = int(math.sqrt(snake_case_ ) ) # Size ...
317
0
"""simple docstring""" from math import isqrt def __UpperCAmelCase ( snake_case_ : int ) -> list[int]: """simple docstring""" _lowerCAmelCase = [True] * max_number for i in range(2 , isqrt(max_number - 1 ) + 1 ): if is_prime[i]: ...
362
"""simple docstring""" import glob import os import random from string import ascii_lowercase, digits import cva import numpy as np # Parrameters SCREAMING_SNAKE_CASE : Any = (7_2_0, 1_2_8_0) # Height, Width SCREAMING_SNAKE_CASE : List[str] = (0.4, 0.6) # if height or width lo...
317
0
"""simple docstring""" import gc import unittest import numpy as np import torch from diffusers import AutoencoderKL, DDIMScheduler, DiTPipeline, DPMSolverMultistepScheduler, TransformeraDModel from diffusers.utils import is_xformers_available, load_numpy, slow, torch_device from diffusers.utils.testing_util...
363
"""simple docstring""" # tests directory-specific settings - this file is run automatically # by pytest before any tests are run import sys import warnings from os.path import abspath, dirname, join # allow having multiple repository checkouts and not needing to remember to rerun # 'pip install -e .[dev]' w...
317
0
"""simple docstring""" import json from typing import List, Optional, Tuple from tokenizers import normalizers from ...tokenization_utils_fast import PreTrainedTokenizerFast from ...utils import logging from .tokenization_convbert import ConvBertTokenizer SCREAMING_SNAKE_CASE : Optional[Any] ...
364
"""simple docstring""" # 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...
317
0
"""simple docstring""" def __UpperCAmelCase ( snake_case_ : list ) -> bool: """simple docstring""" if not isinstance(snake_case_ , snake_case_ ): raise ValueError("""Input series is not valid, valid series - [2, 4, 6]""" ) if len(snake_case_ ) == 0: ...
365
"""simple docstring""" from math import isqrt def __UpperCAmelCase ( snake_case_ : int ) -> list[int]: """simple docstring""" _lowerCAmelCase = [True] * max_number for i in range(2 , isqrt(max_number - 1 ) + 1 ): if is_prime[i]: ...
317
0
"""simple docstring""" import tensorflow as tf from ...tf_utils import shape_list class __lowerCamelCase ( tf.keras.layers.Layer ): def __init__(self , lowerCamelCase , lowerCamelCase , lowerCamelCase , lowerCamelCase , lowerCamelCase=1 , lowerCamelCase=False ,...
366
"""simple docstring""" # 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...
317
0
"""simple docstring""" import unittest from transformers import PegasusTokenizer, PegasusTokenizerFast 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 To...
367
"""simple docstring""" from __future__ import annotations import queue class __lowerCamelCase : def __init__(self , lowerCamelCase ): '''simple docstring''' _lowerCAmelCase = data _lowerCAmelCase = None _lowerCAmelCase = ...
317
0
"""simple docstring""" import unittest from parameterized import parameterized from transformers import AutoTokenizer, GPTNeoXConfig, is_torch_available, set_seed from transformers.testing_utils import require_torch, slow, torch_device from ...generation.test_utils import GenerationTesterMixin from ...test_...
368
"""simple docstring""" from __future__ import annotations class __lowerCamelCase : def __init__(self , lowerCamelCase , lowerCamelCase ): '''simple docstring''' _lowerCAmelCase , _lowerCAmelCase = text, pattern _lowerCAmelCase , _low...
317
0
"""simple docstring""" import os import sys SCREAMING_SNAKE_CASE : Dict = os.path.join(os.path.dirname(__file__), '''src''') sys.path.append(SRC_DIR) from transformers import ( AutoConfig, AutoModel, AutoModelForCausalLM, AutoModelForMaskedLM, AutoModelForQuestionAnswering...
369
"""simple docstring""" import unittest import numpy as np import torch from diffusers import VersatileDiffusionImageVariationPipeline from diffusers.utils.testing_utils import load_image, require_torch_gpu, slow, torch_device SCREAMING_SNAKE_CASE : List[str] = False class __lowerCamelCase...
317
0
"""simple docstring""" import torch from torch import nn class __lowerCamelCase ( nn.Module ): def __init__(self , lowerCamelCase , lowerCamelCase , lowerCamelCase , lowerCamelCase , lowerCamelCase=1 , lowerCamelCase=False ): '''simple docstring''' ...
370
"""simple docstring""" import gc import unittest import numpy as np import torch from diffusers import AutoencoderKL, DDIMScheduler, DiTPipeline, DPMSolverMultistepScheduler, TransformeraDModel from diffusers.utils import is_xformers_available, load_numpy, slow, torch_device from diffusers.utils.testing_util...
317
0
"""simple docstring""" def __UpperCAmelCase ( snake_case_ : int = 10**9 ) -> int: """simple docstring""" _lowerCAmelCase = 1 _lowerCAmelCase = 2 _lowerCAmelCase = 0 _lowerCAmelCase = 0 _lowerCAmelCase ...
371
"""simple docstring""" from operator import delitem, getitem, setitem import pytest from data_structures.hashing.hash_map import HashMap def __UpperCAmelCase ( snake_case_ : Union[str, Any] ) -> Dict: """simple docstring""" return getitem, k def __UpperCAm...
317
0
"""simple docstring""" def __UpperCAmelCase ( snake_case_ : int , snake_case_ : list[int] , snake_case_ : int ) -> int: """simple docstring""" def count_of_possible_combinations(snake_case_ : int ) -> int: if target < 0: r...
350
"""simple docstring""" def __UpperCAmelCase ( snake_case_ : int , snake_case_ : list[int] , snake_case_ : int ) -> int: """simple docstring""" def count_of_possible_combinations(snake_case_ : int ) -> int: if target < 0: r...
317
0
"""simple docstring""" import argparse import torch from transformers import ( SpeechTaConfig, SpeechTaFeatureExtractor, SpeechTaForSpeechToSpeech, SpeechTaForSpeechToText, SpeechTaForTextToSpeech, SpeechTaProcessor, SpeechTaTokenizer, logging, ) from transformers.tokenizati...
351
"""simple docstring""" from __future__ import annotations import string from itertools import cycle, product from pathlib import Path SCREAMING_SNAKE_CASE : str = ( string.ascii_letters + string.digits + string.punctuation + string.whitespace ) SCREAMING_SNAKE_CASE : list[int] ...
317
0
"""simple docstring""" import math from dataclasses import dataclass from typing import Optional, Tuple, Union import torch from ..configuration_utils import ConfigMixin, register_to_config from ..utils import BaseOutput, randn_tensor from .scheduling_utils import SchedulerMixin, SchedulerOutput @dataclass...
352
"""simple docstring""" def __UpperCAmelCase ( snake_case_ : int = 1000000 ) -> int: """simple docstring""" _lowerCAmelCase = limit + 1 _lowerCAmelCase = [0] * limit for first_term in range(1 , snake_case_ ): for n in range(sn...
317
0
"""simple docstring""" def __UpperCAmelCase ( snake_case_ : list[int] , snake_case_ : list[int] , snake_case_ : int ) -> bool: """simple docstring""" return not any( neighbour == 1 and colored_vertices[i] == color ...
353
"""simple docstring""" from functools import reduce SCREAMING_SNAKE_CASE : int = ( '''73167176531330624919225119674426574742355349194934''' '''96983520312774506326239578318016984801869478851843''' '''85861560789112949495459501737958331952853208805511''' '''1254069874715852386305...
317
0
"""simple docstring""" from math import asin, atan, cos, radians, sin, sqrt, tan __SCREAMING_SNAKE_CASE : str = 6_3_7_8_1_3_7.0 __SCREAMING_SNAKE_CASE : Optional[Any] = 6_3_5_6_7_5_2.3_1_4_2_4_5 __SCREAMING_SNAKE_CASE : Any = 6_3_7_8_1_3_7 def __UpperCAmelC...
354
"""simple docstring""" def __UpperCAmelCase ( snake_case_ : int = 600851475143 ) -> int: """simple docstring""" try: _lowerCAmelCase = int(snake_case_ ) except (TypeError, ValueError): raise TypeError("""Parameter n must be int or castable ...
317
0
"""simple docstring""" from operator import delitem, getitem, setitem import pytest from data_structures.hashing.hash_map import HashMap def __UpperCAmelCase ( snake_case_ : Union[str, Any] ) -> Dict: """simple docstring""" return ge...
355
"""simple docstring""" import logging import os import sys from dataclasses import dataclass, field from typing import Optional from seqaseq_trainer import SeqaSeqTrainer from seqaseq_training_args import SeqaSeqTrainingArguments import transformers from transformers import ( AutoConfig, AutoModelFor...
317
0
"""simple docstring""" from __future__ import annotations def __UpperCAmelCase ( snake_case_ : int = 4 ) -> list[list[int]]: """simple docstring""" _lowerCAmelCase = abs(snake_case_ ) or 4 return [[1 + x + y * row_size for x in range(snake_case...
356
"""simple docstring""" from typing import TYPE_CHECKING # rely on isort to merge the imports from ...utils import OptionalDependencyNotAvailable, _LazyModule, is_torch_available SCREAMING_SNAKE_CASE : List[Any] = {'''configuration_focalnet''': ['''FOCALNET_PRETRAINED_CONFIG_ARCHIVE_MAP''', ''...
317
0
from __future__ import annotations import queue class __lowerCamelCase : def __init__(self , lowerCamelCase ): '''simple docstring''' _lowerCAmelCase = data _lowerCAmelCase = None _lowerCAmelCase = None def __Uppe...
357
"""simple docstring""" import unittest import numpy as np from transformers.testing_utils import require_torch, require_vision from transformers.utils import is_torch_available, is_vision_available from ...test_image_processing_common import ImageProcessingSavingTestMixin, prepare_image_inputs if is_torch...
317
0
import unittest import numpy as np from transformers import BertConfig, is_flax_available from transformers.testing_utils import require_flax, slow from ...test_modeling_flax_common import FlaxModelTesterMixin, floats_tensor, ids_tensor, random_attention_mask if is_flax_available(): from transformers.models....
358
"""simple docstring""" def __UpperCAmelCase ( snake_case_ : list ) -> list: """simple docstring""" for i in range(len(snake_case_ ) - 1 , 0 , -1 ): _lowerCAmelCase = False for j in range(snake_case_ , 0 , -1 ): ...
317
0
"""simple docstring""" from typing import TYPE_CHECKING from ...utils import OptionalDependencyNotAvailable, _LazyModule, is_flax_available, is_torch_available SCREAMING_SNAKE_CASE : Optional[Any] = { '''configuration_longt5''': ['''LONGT5_PRETRAINED_CONFIG_ARCHIVE_MAP''', '''LongT5Config...
359
"""simple docstring""" import random import timeit from functools import wraps from typing import Callable, Optional from ..configuration_utils import PretrainedConfig from ..models.auto.modeling_tf_auto import TF_MODEL_MAPPING, TF_MODEL_WITH_LM_HEAD_MAPPING from ..utils import is_pyanvml_available, is_tf_ava...
317
0
"""simple docstring""" import unittest import numpy as np import timeout_decorator # noqa from transformers import BlenderbotSmallConfig, is_flax_available from transformers.testing_utils import require_flax, slow from ...generation.test_flax_utils import FlaxGenerationTesterMixin from ...test_modeling_fla...
360
"""simple docstring""" from ...configuration_utils import PretrainedConfig from ...utils import logging SCREAMING_SNAKE_CASE : int = logging.get_logger(__name__) SCREAMING_SNAKE_CASE : Any = { '''transfo-xl-wt103''': '''https://huggingface.co/transfo-xl-wt103/resolve/main/c...
317
0
"""simple docstring""" import copy import inspect import unittest from transformers import AutoBackbone from transformers.configuration_utils import PretrainedConfig from transformers.testing_utils import require_timm, require_torch, torch_device from transformers.utils.import_utils import is_torch_available ...
361
"""simple docstring""" import math def __UpperCAmelCase ( snake_case_ : int ) -> list[int]: """simple docstring""" _lowerCAmelCase = [] _lowerCAmelCase = 2 _lowerCAmelCase = int(math.sqrt(snake_case_ ) ) # Size ...
317
0
"""simple docstring""" import qiskit def __UpperCAmelCase ( snake_case_ : int = 2 ) -> qiskit.result.counts.Counts: """simple docstring""" _lowerCAmelCase = qubits # Using Aer's simulator _lowerCAmelCase = qiskit.Aer.get_backend("...
362
"""simple docstring""" import glob import os import random from string import ascii_lowercase, digits import cva import numpy as np # Parrameters SCREAMING_SNAKE_CASE : Any = (7_2_0, 1_2_8_0) # Height, Width SCREAMING_SNAKE_CASE : List[str] = (0.4, 0.6) # if height or width lo...
317
0
"""simple docstring""" from __future__ import annotations import string from itertools import cycle, product from pathlib import Path SCREAMING_SNAKE_CASE : str = ( string.ascii_letters + string.digits + string.punctuation + string.whitespace ) SCREAMING_SNAKE_CASE : list[int] ...
363
"""simple docstring""" # tests directory-specific settings - this file is run automatically # by pytest before any tests are run import sys import warnings from os.path import abspath, dirname, join # allow having multiple repository checkouts and not needing to remember to rerun # 'pip install -e .[dev]' w...
317
0
"""simple docstring""" from __future__ import annotations import time from math import sqrt # 1 for manhattan, 0 for euclidean SCREAMING_SNAKE_CASE : Any = 0 SCREAMING_SNAKE_CASE : Union[str, Any] = [ [0, 0, 0, 0, 0, 0, 0], [0, 1, 0, 0, 0, 0, 0], # 0 are free path wher...
364
"""simple docstring""" # 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...
317
0
"""simple docstring""" from ..utils import DummyObject, requires_backends class __lowerCamelCase ( metaclass=__lowercase ): __UpperCamelCase = ['torch'] def __init__(self , *lowerCamelCase , **lowerCamelCase ): '''simple docstring''' require...
365
"""simple docstring""" from math import isqrt def __UpperCAmelCase ( snake_case_ : int ) -> list[int]: """simple docstring""" _lowerCAmelCase = [True] * max_number for i in range(2 , isqrt(max_number - 1 ) + 1 ): if is_prime[i]: ...
317
0
"""simple docstring""" from __future__ import annotations import copy import tempfile import unittest from transformers import CONFIG_MAPPING, AutoConfig, BertConfig, GPTaConfig, TaConfig, TapasConfig, is_tf_available from transformers.testing_utils import ( DUMMY_UNKNOWN_IDENTIFIER, SMALL_MODEL_IDEN...
366
"""simple docstring""" # 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...
317
0
"""simple docstring""" from typing import TYPE_CHECKING from ...utils import OptionalDependencyNotAvailable, _LazyModule, is_tokenizers_available, is_torch_available SCREAMING_SNAKE_CASE : Dict = { '''configuration_roc_bert''': ['''ROC_BERT_PRETRAINED_CONFIG_ARCHIVE_MAP''', '''RoCBertConf...
367
"""simple docstring""" from __future__ import annotations import queue class __lowerCamelCase : def __init__(self , lowerCamelCase ): '''simple docstring''' _lowerCAmelCase = data _lowerCAmelCase = None _lowerCAmelCase = ...
317
0
"""simple docstring""" import argparse import os from transformers.utils import direct_transformers_import # All paths are set with the intent you should run this script from the root of the repo with the command # python utils/check_task_guides.py SCREAMING_SNAKE_CASE : str = '''src/transfor...
368
"""simple docstring""" from __future__ import annotations class __lowerCamelCase : def __init__(self , lowerCamelCase , lowerCamelCase ): '''simple docstring''' _lowerCAmelCase , _lowerCAmelCase = text, pattern _lowerCAmelCase , _low...
317
0
"""simple docstring""" from __future__ import annotations def __UpperCAmelCase ( snake_case_ : list[float] ) -> float: """simple docstring""" _lowerCAmelCase = 0.0_0 _lowerCAmelCase = 0 for resistor in resistors: if resistor <...
369
"""simple docstring""" import unittest import numpy as np import torch from diffusers import VersatileDiffusionImageVariationPipeline from diffusers.utils.testing_utils import load_image, require_torch_gpu, slow, torch_device SCREAMING_SNAKE_CASE : List[str] = False class __lowerCamelCase...
317
0
"""simple docstring""" from collections import OrderedDict from typing import List, Mapping from packaging import version from ...configuration_utils import PretrainedConfig from ...onnx import OnnxConfig from ...utils import logging SCREAMING_SNAKE_CASE : Tuple = logging.get_logger(__name__...
370
"""simple docstring""" import gc import unittest import numpy as np import torch from diffusers import AutoencoderKL, DDIMScheduler, DiTPipeline, DPMSolverMultistepScheduler, TransformeraDModel from diffusers.utils import is_xformers_available, load_numpy, slow, torch_device from diffusers.utils.testing_util...
317
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, l...
371
"""simple docstring""" from operator import delitem, getitem, setitem import pytest from data_structures.hashing.hash_map import HashMap def __UpperCAmelCase ( snake_case_ : Union[str, Any] ) -> Dict: """simple docstring""" return getitem, k def __UpperCAm...
317
0
"""simple docstring""" def __UpperCAmelCase ( snake_case_ : int = 3 , snake_case_ : int = 7 , snake_case_ : int = 1000000 ) -> int: """simple docstring""" _lowerCAmelCase = 0 _lowerCAmelCase = 1 for current_denomi...
350
"""simple docstring""" def __UpperCAmelCase ( snake_case_ : int , snake_case_ : list[int] , snake_case_ : int ) -> int: """simple docstring""" def count_of_possible_combinations(snake_case_ : int ) -> int: if target < 0: r...
317
0
"""simple docstring""" from typing import TYPE_CHECKING from ...utils import ( OptionalDependencyNotAvailable, _LazyModule, is_flax_available, is_tf_available, is_torch_available, ) SCREAMING_SNAKE_CASE : Optional[Any] = { '''configuration_wav2vec2''': ['''WAV_2_VEC_...
351
"""simple docstring""" from __future__ import annotations import string from itertools import cycle, product from pathlib import Path SCREAMING_SNAKE_CASE : str = ( string.ascii_letters + string.digits + string.punctuation + string.whitespace ) SCREAMING_SNAKE_CASE : list[int] ...
317
0
"""simple docstring""" import random from typing import Any def __UpperCAmelCase ( snake_case_ : list ) -> list[Any]: for _ in range(len(snake_case_ ) ): _lowerCAmelCase = random.randint(0 , len(snake_case_ ) - 1 ) _lowerCAmelCase ...
352
"""simple docstring""" def __UpperCAmelCase ( snake_case_ : int = 1000000 ) -> int: """simple docstring""" _lowerCAmelCase = limit + 1 _lowerCAmelCase = [0] * limit for first_term in range(1 , snake_case_ ): for n in range(sn...
317
0
"""simple docstring""" import pytest SCREAMING_SNAKE_CASE : Optional[Any] = '''__dummy_dataset1__''' SCREAMING_SNAKE_CASE : List[str] = ''' import json import os import datasets REPO_URL = "https://huggingface.co/datasets/albertvillanova/tests-raw-jsonl/resolv...
353
"""simple docstring""" from functools import reduce SCREAMING_SNAKE_CASE : int = ( '''73167176531330624919225119674426574742355349194934''' '''96983520312774506326239578318016984801869478851843''' '''85861560789112949495459501737958331952853208805511''' '''1254069874715852386305...
317
0
"""simple docstring""" from __future__ import annotations class __lowerCamelCase : def __init__(self , lowerCamelCase , lowerCamelCase ): '''simple docstring''' _lowerCAmelCase , _lowerCAmelCase = text, pattern _lowerCAmelCase , _low...
354
"""simple docstring""" def __UpperCAmelCase ( snake_case_ : int = 600851475143 ) -> int: """simple docstring""" try: _lowerCAmelCase = int(snake_case_ ) except (TypeError, ValueError): raise TypeError("""Parameter n must be int or castable ...
317
0
"""simple docstring""" import unittest import numpy as np from transformers.testing_utils import require_torch, require_vision from transformers.utils import is_torch_available, is_vision_available from ...test_image_processing_common import ImageProcessingSavingTestMixin, prepare_image_inp...
355
"""simple docstring""" import logging import os import sys from dataclasses import dataclass, field from typing import Optional from seqaseq_trainer import SeqaSeqTrainer from seqaseq_training_args import SeqaSeqTrainingArguments import transformers from transformers import ( AutoConfig, AutoModelFor...
317
0
"""simple docstring""" def __UpperCAmelCase ( snake_case_ : int , snake_case_ : int ) -> str: """simple docstring""" return "\n".join( F"""{number} * {i} = {number * i}""" for i in range(1 , number_of_terms + 1 ) ) if __name__ == "__main__...
356
"""simple docstring""" from typing import TYPE_CHECKING # rely on isort to merge the imports from ...utils import OptionalDependencyNotAvailable, _LazyModule, is_torch_available SCREAMING_SNAKE_CASE : List[Any] = {'''configuration_focalnet''': ['''FOCALNET_PRETRAINED_CONFIG_ARCHIVE_MAP''', ''...
317
0
from collections.abc import Generator from math import sin def __UpperCAmelCase ( snake_case_ : bytes ) -> bytes: """simple docstring""" if len(snake_case_ ) != 32: raise ValueError("""Input must be of length 32""" ) _lowerCAmelCase = B"""""...
357
"""simple docstring""" import unittest import numpy as np from transformers.testing_utils import require_torch, require_vision from transformers.utils import is_torch_available, is_vision_available from ...test_image_processing_common import ImageProcessingSavingTestMixin, prepare_image_inputs if is_torch...
317
0
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 TensorType class __lowerCamelCase ( __low...
358
"""simple docstring""" def __UpperCAmelCase ( snake_case_ : list ) -> list: """simple docstring""" for i in range(len(snake_case_ ) - 1 , 0 , -1 ): _lowerCAmelCase = False for j in range(snake_case_ , 0 , -1 ): ...
317
0
"""simple docstring""" import argparse import json import requests import timm import torch from huggingface_hub import hf_hub_download from PIL import Image from transformers import AutoImageProcessor, SwinConfig, SwinForImageClassification def __UpperCAmelCase ( snake_case_ : Optional[...
359
"""simple docstring""" import random import timeit from functools import wraps from typing import Callable, Optional from ..configuration_utils import PretrainedConfig from ..models.auto.modeling_tf_auto import TF_MODEL_MAPPING, TF_MODEL_WITH_LM_HEAD_MAPPING from ..utils import is_pyanvml_available, is_tf_ava...
317
0
"""simple docstring""" import multiprocessing import os from typing import BinaryIO, Optional, Union import fsspec from .. import Dataset, Features, NamedSplit, config from ..formatting import query_table from ..packaged_modules.json.json import Json from ..utils import logging from ..utils.typing import Nes...
360
"""simple docstring""" from ...configuration_utils import PretrainedConfig from ...utils import logging SCREAMING_SNAKE_CASE : int = logging.get_logger(__name__) SCREAMING_SNAKE_CASE : Any = { '''transfo-xl-wt103''': '''https://huggingface.co/transfo-xl-wt103/resolve/main/c...
317
0