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""" import warnings from ...utils import logging from .image_processing_segformer import SegformerImageProcessor SCREAMING_SNAKE_CASE : Tuple = logging.get_logger(__name__) class __lowerCamelCase ( __lowercase ): def __init__(self , *lowerCamelCase...
317
"""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
1
"""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 for i, neighbour in ...
317
"""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
1
"""simple docstring""" # Copyright 2022 The HuggingFace Team. All rights reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 ...
317
"""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
1
"""simple docstring""" # Lint as: python3 import sys from collections.abc import Mapping from typing import TYPE_CHECKING, Dict, Optional import numpy as np import pyarrow as pa from .. import config from ..utils.logging import get_logger from ..utils.py_utils import map_nested from .formatting import Tensor...
317
"""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
1
"""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 __UpperCAmelCase ...
317
"""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
1
"""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_...
317
"""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
1
"""simple docstring""" from functools import reduce SCREAMING_SNAKE_CASE : int = ( '''73167176531330624919225119674426574742355349194934''' '''96983520312774506326239578318016984801869478851843''' '''85861560789112949495459501737958331952853208805511''' '''1254069874715852386305...
317
"""simple docstring""" from functools import reduce SCREAMING_SNAKE_CASE : int = ( '''73167176531330624919225119674426574742355349194934''' '''96983520312774506326239578318016984801869478851843''' '''85861560789112949495459501737958331952853208805511''' '''1254069874715852386305...
317
1
"""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...
317
"""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
1
"""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_ : Dict ) ...
317
"""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
1
"""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 acce...
317
"""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
1
"""simple docstring""" from dataclasses import asdict, dataclass from typing import Optional from ...configuration_utils import PretrainedConfig from ...utils import logging SCREAMING_SNAKE_CASE : List[str] = logging.get_logger(__name__) # TODO Update this SCREAMING_SNAKE_CASE : Tupl...
317
"""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
1
"""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
"""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
1
"""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 + ...
317
"""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
1
"""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
"""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
1
"""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.json'''} class ...
317
"""simple docstring""" import math def __UpperCAmelCase ( snake_case_ : int ) -> list[int]: """simple docstring""" _lowerCAmelCase = [] _lowerCAmelCase = 2 _lowerCAmelCase = int(math.sqrt(snake_case_ ) ) # Size ...
317
1
"""simple docstring""" import os import pytest from datasets import ( get_dataset_config_info, get_dataset_config_names, get_dataset_infos, get_dataset_split_names, inspect_dataset, inspect_metric, ) SCREAMING_SNAKE_CASE : int = pytest.mark.integration @pytest.m...
317
"""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
1
"""simple docstring""" import torch from torch import nn from ...configuration_utils import ConfigMixin, register_to_config from ...models import ModelMixin class __lowerCamelCase ( __lowercase , __lowercase ): @register_to_config def __init__(self , *, lowerCamelC...
317
"""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
1
"""simple docstring""" 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_v...
317
"""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
1
"""simple docstring""" class __lowerCamelCase : def __init__(self ): '''simple docstring''' _lowerCAmelCase = {} # Mapping from char to TrieNode _lowerCAmelCase = False def A__ (self , lowerCamelCase ): '''si...
317
"""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
1
"""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[...
317
"""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
1
"""simple docstring""" import os from bleurt import score # From: git+https://github.com/google-research/bleurt.git import datasets SCREAMING_SNAKE_CASE : Optional[Any] = datasets.logging.get_logger(__name__) SCREAMING_SNAKE_CASE : Union[str, Any] = '''\ @inproceedings{bleu...
317
"""simple docstring""" from __future__ import annotations import queue class __lowerCamelCase : def __init__(self , lowerCamelCase ): '''simple docstring''' _lowerCAmelCase = data _lowerCAmelCase = None _lowerCAmelCase = ...
317
1
"""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 ,...
317
"""simple docstring""" from __future__ import annotations class __lowerCamelCase : def __init__(self , lowerCamelCase , lowerCamelCase ): '''simple docstring''' _lowerCAmelCase , _lowerCAmelCase = text, pattern _lowerCAmelCase , _low...
317
1
"""simple docstring""" import os from typing import BinaryIO, Optional, Union import numpy as np import pyarrow.parquet as pq from .. import Audio, Dataset, Features, Image, NamedSplit, Value, config from ..features.features import FeatureType, _visit from ..formatting import query_table from ..packaged_modu...
317
"""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
1
"""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...
317
"""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
1
"""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...
317
"""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
1
"""simple docstring""" import unittest import numpy as np import timeout_decorator # noqa from transformers import BlenderbotConfig, is_flax_available from transformers.testing_utils import jax_device, require_flax, slow from ...generation.test_flax_utils import FlaxGenerationTesterMixin from ...test_model...
317
"""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
1
"""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''': ''...
317
"""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
1
"""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 import PegasusTokenizer ...
317
"""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
1
"""simple docstring""" from typing import Optional import torch import torch.utils.checkpoint from torch import Tensor, nn from torch.nn import BCEWithLogitsLoss, CrossEntropyLoss, MSELoss from ...activations import ACTaFN from ...file_utils import add_code_sample_docstrings, add_start_docstrings, add_start_...
317
"""simple docstring""" from functools import reduce SCREAMING_SNAKE_CASE : int = ( '''73167176531330624919225119674426574742355349194934''' '''96983520312774506326239578318016984801869478851843''' '''85861560789112949495459501737958331952853208805511''' '''1254069874715852386305...
317
1
"""simple docstring""" import requests SCREAMING_SNAKE_CASE : int = '''https://newsapi.org/v1/articles?source=bbc-news&sortBy=top&apiKey=''' def __UpperCAmelCase ( snake_case_ : str ) -> None: """simple docstring""" _lowerCAmelCase = re...
317
"""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
1
"""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: """simple docstring""" _lowe...
317
"""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
1
"""simple docstring""" import os import pytest import yaml from datasets.features.features import Features, Value from datasets.info import DatasetInfo, DatasetInfosDict @pytest.mark.parametrize( """files""" , [ ["""full:README.md""", """dataset_infos.json"""], ["""empty:README....
317
"""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
1
"""simple docstring""" import unittest from transformers import SqueezeBertConfig, is_torch_available from transformers.testing_utils import require_sentencepiece, require_tokenizers, require_torch, slow, torch_device from ...test_configuration_common import ConfigTester from ...test_modeling_common import M...
317
"""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
1
"""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,...
317
"""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
1
"""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 ...
317
"""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
1
"""simple docstring""" 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 ...
317
"""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
1
"""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
"""simple docstring""" import math def __UpperCAmelCase ( snake_case_ : int ) -> list[int]: """simple docstring""" _lowerCAmelCase = [] _lowerCAmelCase = 2 _lowerCAmelCase = int(math.sqrt(snake_case_ ) ) # Size ...
317
1
"""simple docstring""" from ...processing_utils import ProcessorMixin class __lowerCamelCase ( __lowercase ): __UpperCamelCase = 'SpeechT5FeatureExtractor' __UpperCamelCase = 'SpeechT5Tokenizer' def __init__(self , lowerCamelCase , lowerCamelCas...
317
"""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
1
"""simple docstring""" def __UpperCAmelCase ( snake_case_ : str ) -> list: """simple docstring""" _lowerCAmelCase = [0] * len(snake_case_ ) for i in range(1 , len(snake_case_ ) ): # use last results for better performance - dynamic pro...
317
"""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
1
"""simple docstring""" SCREAMING_SNAKE_CASE : Optional[Any] = {0: [2, 3], 1: [0], 2: [1], 3: [4], 4: []} SCREAMING_SNAKE_CASE : List[Any] = {0: [1, 2, 3], 1: [2], 2: [0], 3: [4], 4: [5], 5: [3]} def __UpperCAmelCase ( snake_case_ : dict[int, list[int]] , ...
317
"""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
1
"""simple docstring""" # DISCLAIMER: This file is strongly influenced by https://github.com/yang-song/score_sde_pytorch import math from dataclasses import dataclass from typing import Optional, Tuple, Union import torch from ..configuration_utils import ConfigMixin, register_to_config from ..utils import B...
317
"""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
1
"""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
"""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
1
"""simple docstring""" from math import factorial SCREAMING_SNAKE_CASE : dict[str, int] = {str(digit): factorial(digit) for digit in range(1_0)} def __UpperCAmelCase ( snake_case_ : int ) -> int: """simple docstring""" if not isinstance(snake_case_ ...
317
"""simple docstring""" from __future__ import annotations import queue class __lowerCamelCase : def __init__(self , lowerCamelCase ): '''simple docstring''' _lowerCAmelCase = data _lowerCAmelCase = None _lowerCAmelCase = ...
317
1
"""simple docstring""" import warnings from ...utils import logging from .image_processing_yolos import YolosImageProcessor SCREAMING_SNAKE_CASE : Union[str, Any] = logging.get_logger(__name__) class __lowerCamelCase ( __lowercase ): def __init__(self , *lowerCamelCa...
317
"""simple docstring""" from __future__ import annotations class __lowerCamelCase : def __init__(self , lowerCamelCase , lowerCamelCase ): '''simple docstring''' _lowerCAmelCase , _lowerCAmelCase = text, pattern _lowerCAmelCase , _low...
317
1
"""simple docstring""" import argparse from pathlib import Path from typing import Dict, OrderedDict, Tuple import torch from audiocraft.models import MusicGen from transformers import ( AutoFeatureExtractor, AutoTokenizer, EncodecModel, MusicgenDecoderConfig, MusicgenForConditionalGenera...
317
"""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
1
"""simple docstring""" def __UpperCAmelCase ( snake_case_ : Optional[Any] ) -> Any: """simple docstring""" _lowerCAmelCase = [] _lowerCAmelCase = set({"""(""", """[""", """{"""} ) _lowerCAmelCase = set({""")""", """]""", ...
317
"""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
1
"""simple docstring""" from __future__ import annotations import unittest from transformers import is_tf_available from transformers.testing_utils import require_sentencepiece, require_tf, require_tokenizers, slow if is_tf_available(): import tensorflow as tf from transformers import AutoTokenizer, TF...
317
"""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
1
"""simple docstring""" def __UpperCAmelCase ( snake_case_ : int ) -> int: """simple docstring""" _lowerCAmelCase = [1] _lowerCAmelCase , _lowerCAmelCase , _lowerCAmelCase = 0, 0, 0 _lowerCAmelCase = ugly_nums[...
317
"""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
1
"""simple docstring""" from typing import TYPE_CHECKING from ...utils import OptionalDependencyNotAvailable, _LazyModule, is_torch_available, is_vision_available SCREAMING_SNAKE_CASE : int = { '''configuration_mobilenet_v2''': [ '''MOBILENET_V2_PRETRAINED_CONFIG_ARCHIVE_MAP''', ...
317
"""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
1
"""simple docstring""" import importlib import torch import yaml from omegaconf import OmegaConf from taming.models.vqgan import VQModel def __UpperCAmelCase ( snake_case_ : Optional[int] , snake_case_ : Any=False ) -> str: """simple docstring""" _lower...
317
"""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
1
"""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=1...
317
"""simple docstring""" from functools import reduce SCREAMING_SNAKE_CASE : int = ( '''73167176531330624919225119674426574742355349194934''' '''96983520312774506326239578318016984801869478851843''' '''85861560789112949495459501737958331952853208805511''' '''1254069874715852386305...
317
1
"""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 SCREAMING_SNAKE_CASE : Dict = logging.get_logger(__name__) SCRE...
317
"""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
1
"""simple docstring""" from typing import TYPE_CHECKING from ...utils import ( OptionalDependencyNotAvailable, _LazyModule, is_sentencepiece_available, is_tokenizers_available, is_torch_available, ) SCREAMING_SNAKE_CASE : List[str] = {'''configuration_plbart''': ['''PLBART...
317
"""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
1
"""simple docstring""" import pickle import shutil import tempfile import unittest from transformers import SPIECE_UNDERLINE, XGLMTokenizer, XGLMTokenizerFast from transformers.testing_utils import get_tests_dir, require_sentencepiece, require_tokenizers, slow from transformers.utils import cached_property f...
317
"""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
1
"""simple docstring""" 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""" ) _lowerCAme...
317
"""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
1
"""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
"""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
1
"""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 ...
317
"""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
1
"""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''' ...
317
"""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
1
"""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, TrainerC...
317
"""simple docstring""" import math def __UpperCAmelCase ( snake_case_ : int ) -> list[int]: """simple docstring""" _lowerCAmelCase = [] _lowerCAmelCase = 2 _lowerCAmelCase = int(math.sqrt(snake_case_ ) ) # Size ...
317
1
"""simple docstring""" from typing import List, Optional, Union import numpy as np import PIL import torch from PIL import Image from ...models import UNetaDConditionModel, VQModel from ...pipelines import DiffusionPipeline from ...pipelines.pipeline_utils import ImagePipelineOutput from ...schedulers import...
317
"""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
1
"""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
"""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
1
"""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__":...
317
"""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
1
"""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: ...
317
"""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
1
"""simple docstring""" # This is the module that test_patching.py uses to test patch_submodule() import os # noqa: this is just for tests import os as renamed_os # noqa: this is just for tests from os import path # noqa: this is just for tests from os import path as renamed_path # noqa: this is just for t...
317
"""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
1
"""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''': [ '''EFF...
317
"""simple docstring""" from __future__ import annotations import queue class __lowerCamelCase : def __init__(self , lowerCamelCase ): '''simple docstring''' _lowerCAmelCase = data _lowerCAmelCase = None _lowerCAmelCase = ...
317
1
"""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 ....
317
"""simple docstring""" from __future__ import annotations class __lowerCamelCase : def __init__(self , lowerCamelCase , lowerCamelCase ): '''simple docstring''' _lowerCAmelCase , _lowerCAmelCase = text, pattern _lowerCAmelCase , _low...
317
1
"""simple docstring""" def __UpperCAmelCase ( snake_case_ : int = 1000 ) -> int: """simple docstring""" _lowerCAmelCase , _lowerCAmelCase = 1, 1 _lowerCAmelCase = [] for i in range(1 , n + 1 ): _lowerCAmelCase ...
317
"""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
1
"""simple docstring""" import logging import os import quant_trainer import torch from torch.utils.data import DataLoader from transformers import Trainer, is_torch_tpu_available from transformers.trainer_utils import PredictionOutput SCREAMING_SNAKE_CASE : Tuple = logging.getLogger(__name__...
317
"""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
1
"""simple docstring""" from manim import * class __lowerCamelCase ( __lowercase ): def A__ (self ): '''simple docstring''' _lowerCAmelCase = Rectangle(height=0.5 , width=0.5 ) _lowerCAmelCase = Rectangle(height=0.46 ...
317
"""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
1
"""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...
317
"""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
1
"""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 ...
317
"""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
1
"""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...
317
"""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
1
"""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...
317
"""simple docstring""" from functools import reduce SCREAMING_SNAKE_CASE : int = ( '''73167176531330624919225119674426574742355349194934''' '''96983520312774506326239578318016984801869478851843''' '''85861560789112949495459501737958331952853208805511''' '''1254069874715852386305...
317
1
"""simple docstring""" from ...processing_utils import ProcessorMixin from ...tokenization_utils_base import BatchEncoding class __lowerCamelCase ( __lowercase ): __UpperCamelCase = ['image_processor', 'tokenizer'] __UpperCamelCase = 'AutoImageProcessor' __Upp...
317
"""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
1
"""simple docstring""" import argparse import torch from transformers import ( SpeechTaConfig, SpeechTaFeatureExtractor, SpeechTaForSpeechToSpeech, SpeechTaForSpeechToText, SpeechTaForTextToSpeech, SpeechTaProcessor, SpeechTaTokenizer, logging, ) from transformers.tokenization...
317
"""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
1
"""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...
317
"""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
1
"""simple docstring""" import argparse import json import os import fairseq import torch from fairseq.data import Dictionary from transformers import ( HubertConfig, HubertForCTC, HubertModel, WavaVecaCTCTokenizer, WavaVecaFeatureExtractor, WavaVecaProcessor, logging, ) logging....
317
"""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
1
"""simple docstring""" import random from typing import Any def __UpperCAmelCase ( snake_case_ : list ) -> list[Any]: """simple docstring""" for _ in range(len(snake_case_ ) ): _lowerCAmelCase = random.randint(0 , len(snake_case_ ) -...
317
"""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
1
"""simple docstring""" import numpy as np import qiskit def __UpperCAmelCase ( snake_case_ : int = 8 , snake_case_ : int | None = None ) -> str: """simple docstring""" _lowerCAmelCase = np.random.default_rng(seed=snake_case_ ) # Roug...
317
"""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
1
"""simple docstring""" def __UpperCAmelCase ( snake_case_ : int = 10**9 ) -> int: """simple docstring""" _lowerCAmelCase = 1 _lowerCAmelCase = 2 _lowerCAmelCase = 0 _lowerCAmelCase = 0 _lowerCAmelCase ...
317
"""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
1
"""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__...
317
"""simple docstring""" import math def __UpperCAmelCase ( snake_case_ : int ) -> list[int]: """simple docstring""" _lowerCAmelCase = [] _lowerCAmelCase = 2 _lowerCAmelCase = int(math.sqrt(snake_case_ ) ) # Size ...
317
1
"""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] ...
317
"""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
1
"""simple docstring""" from typing import List, Optional, Union import torch from ...models import UNetaDConditionModel, VQModel from ...pipelines import DiffusionPipeline from ...pipelines.pipeline_utils import ImagePipelineOutput from ...schedulers import DDPMScheduler from ...utils import ( is_acceler...
317
"""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
1
"""simple docstring""" import json import os import subprocess import unittest from ast import literal_eval import pytest from parameterized import parameterized, parameterized_class from . import is_sagemaker_available if is_sagemaker_available(): from sagemaker import Session, TrainingJobAnalytics fr...
317
"""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
1
"""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...
317
"""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
1
"""simple docstring""" import inspect import unittest from typing import List import numpy as np from transformers import EfficientFormerConfig from transformers.testing_utils import require_tf, require_vision, slow from transformers.utils import cached_property, is_tf_available, is_vision_available from .....
317
"""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
1
"""simple docstring""" import string import numpy def __UpperCAmelCase ( snake_case_ : int , snake_case_ : int ) -> int: """simple docstring""" return b if a == 0 else greatest_common_divisor(b % a , snake_case_ ) class __lowerCamelCase : ...
317
"""simple docstring""" from __future__ import annotations import queue class __lowerCamelCase : def __init__(self , lowerCamelCase ): '''simple docstring''' _lowerCAmelCase = data _lowerCAmelCase = None _lowerCAmelCase = ...
317
1
"""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
"""simple docstring""" from __future__ import annotations class __lowerCamelCase : def __init__(self , lowerCamelCase , lowerCamelCase ): '''simple docstring''' _lowerCAmelCase , _lowerCAmelCase = text, pattern _lowerCAmelCase , _low...
317
1
"""simple docstring""" from bisect import bisect from itertools import accumulate def __UpperCAmelCase ( snake_case_ : List[str] , snake_case_ : str , snake_case_ : Dict , snake_case_ : Tuple ) -> Dict: """simple docstring""" _low...
317
"""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
1
"""simple docstring""" def __UpperCAmelCase ( snake_case_ : Any ) -> List[str]: """simple docstring""" _lowerCAmelCase , _lowerCAmelCase = [], [] while len(snake_case_ ) > 1: _lowerCAmelCase , _lowerCAmelCase = min(sna...
317
"""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
1
"""simple docstring""" from typing import TYPE_CHECKING from ...utils import _LazyModule SCREAMING_SNAKE_CASE : List[str] = {'''tokenization_wav2vec2_phoneme''': ['''Wav2Vec2PhonemeCTCTokenizer''']} if TYPE_CHECKING: from .tokenization_wavaveca_phoneme import WavaVecaPhonemeCTCTokenizer e...
317
"""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
1
"""simple docstring""" def __UpperCAmelCase ( snake_case_ : int = 50 ) -> int: """simple docstring""" _lowerCAmelCase = [[0] * 3 for _ in range(length + 1 )] for row_length in range(length + 1 ): for tile_length in range(2 , 5 ): ...
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 from typing import TYPE_CHECKING, List, Optional, Tuple from tokenizers import pre_tokenizers from ...tokenization_utils_base import BatchEncoding from ...tokenization_utils_fast import PreTrainedTokenizerFast from ...utils import logging if TYPE_CHECKING: from transf...
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_torch_available SCREAMING_SNAKE_CASE : Any = { '''configuration_mgp_str''': ['''MGP_STR_PRETRAINED_CONFIG_ARCHIVE_MAP''', '''MgpstrConfig'''], '''processing_mgp...
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 dataclasses import dataclass from typing import List, Optional, Union import numpy as np import PIL from ...utils import BaseOutput, OptionalDependencyNotAvailable, is_torch_available, is_transformers_available from .timesteps import ( fastaa_timesteps, ...
353
"""simple docstring""" from functools import reduce SCREAMING_SNAKE_CASE : int = ( '''73167176531330624919225119674426574742355349194934''' '''96983520312774506326239578318016984801869478851843''' '''85861560789112949495459501737958331952853208805511''' '''1254069874715852386305...
317
0
"""simple docstring""" def __UpperCAmelCase ( snake_case_ : list ) -> list: """simple docstring""" if len(lowerCamelCase__ ) <= 1: return [tuple(lowerCamelCase__ )] _lowerCAmelCase = [] def generate(snake_case_ : int , snake_c...
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 typing import TYPE_CHECKING # rely on isort to merge the imports from ...utils import OptionalDependencyNotAvailable, _LazyModule, is_torch_available, is_vision_available SCREAMING_SNAKE_CASE : List[Any] = { '''configuration_efficientnet''': [ ...
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 SCREAMING_SNAKE_CASE : List[str] = { """configuration_pegasus_x""": ["""PEGASUS_X_PRETRAINED_CONFIG_ARCHIVE_MAP""", """PegasusXConfig"""], } try:...
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 import pathlib import fairseq import torch from fairseq.models.roberta import RobertaModel as FairseqRobertaModel from fairseq.modules import TransformerSentenceEncoderLayer from packaging import version from transformers import XLMRobertaConfig, XLMRobertaXLForMaskedLM, XLMRobertaXLForSequenceCla...
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 itertools import product def __UpperCAmelCase ( snake_case_ : int , snake_case_ : int ) -> List[str]: """simple docstring""" _lowerCAmelCase = sides_number _lowerCAmelCase = max_face_number * dice_number _lowerCAmelCase ...
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