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
import fire from torch.utils.data import DataLoader from tqdm import tqdm from transformers import AutoTokenizer from utils import SeqaSeqDataset, pickle_save def snake_case (__lowercase , __lowercase , __lowercase=1_024 , __lowercase=1_024 , __lowercase=False , **__lowercase ) -> L...
368
from typing import TYPE_CHECKING # rely on isort to merge the imports from ...utils import OptionalDependencyNotAvailable, _LazyModule, is_torch_available __SCREAMING_SNAKE_CASE : Optional[Any] = { 'configuration_autoformer': [ 'AUTOFORMER_PRETRAINED_CONFIG_ARCHIVE_MAP', 'Autofor...
284
0
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 else: __SCREAMING_S...
369
import shutil import tempfile import unittest from transformers import ClapFeatureExtractor, ClapProcessor, RobertaTokenizer, RobertaTokenizerFast from transformers.testing_utils import require_sentencepiece, require_torchaudio from .test_feature_extraction_clap import floats_list @require_torchaudio @require_sent...
284
0
from ..utils import DummyObject, requires_backends class lowercase_ ( metaclass=__snake_case ): _lowerCamelCase = ['onnx'] def __init__( self , *lowercase_ , **lowercase_ ): requires_backends(self , ["onnx"] ) @classmethod ...
370
import logging from transformers import PretrainedConfig __SCREAMING_SNAKE_CASE : Any = logging.getLogger(__name__) __SCREAMING_SNAKE_CASE : int = { 'bertabs-finetuned-cnndm': 'https://huggingface.co/remi/bertabs-finetuned-cnndm-extractive-abstractive-summarization/resolve/mai...
284
0
"""simple docstring""" def snake_case (__lowercase ) -> list: '''simple docstring''' if bit_count < 0: raise ValueError("The given input must be positive" ) # get the generated string sequence _snake_case : List[Any] = gray_code_sequence_string(...
371
import argparse import os import shutil import torch from emmental.modules import MagnitudeBinarizer, ThresholdBinarizer, TopKBinarizer def snake_case (__lowercase ) -> str: '''simple docstring''' _snake_case : int = args.pruning_method _snake_case : List[Any] ...
284
0
from collections import OrderedDict from typing import Mapping from packaging import version from ...configuration_utils import PretrainedConfig from ...onnx import OnnxConfig from ...utils import logging from ..auto import CONFIG_MAPPING __SCREAMING_SNAKE_CASE : List[Any] = logging.get_logger(__na...
350
from __future__ import annotations from collections import deque from collections.abc import Iterator from dataclasses import dataclass @dataclass class lowercase_ : _lowerCamelCase = 42 _lowerCamelCase = 42 class lowercase_ : def __init__( self , ...
284
0
import unittest from transformers import is_torch_available from transformers.testing_utils import require_torch if is_torch_available(): import torch from transformers.generation import DisjunctiveConstraint @require_torch class lowercase_ ( unittest.TestCase ): def UpperCamelCa...
351
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 : Optional[int] = { 'configuration_distilbert': [ 'DISTIL...
284
0
# HF Trainer benchmarking tool # # This tool can be used to run and compare multiple dimensions of the HF Trainers args. # # It then prints a report once in github format with all the information that needs to be shared # with others and second time in a console-friendly format, so it's easier to use for tuning things ...
352
from dataclasses import dataclass, field from typing import Tuple from ..utils import cached_property, is_tf_available, logging, requires_backends from .benchmark_args_utils import BenchmarkArguments if is_tf_available(): import tensorflow as tf __SCREAMING_SNAKE_CASE : str = logging.get_logge...
284
0
import tempfile import unittest from pathlib import Path from shutil import copyfile from transformers import MaMaaaTokenizer, is_torch_available from transformers.testing_utils import ( get_tests_dir, nested_simplify, require_sentencepiece, require_tokenizers, require_torch, slow, ) from trans...
353
from __future__ import annotations import requests __SCREAMING_SNAKE_CASE : Tuple = set( 'approved_at_utc approved_by author_flair_background_color\nauthor_flair_css_class author_flair_richtext author_flair_template_id author_fullname\nauthor_premium can_mod_post category clicked content_categori...
284
0
def snake_case (__lowercase ) -> list[int]: '''simple docstring''' if num <= 0: raise ValueError("Input must be a positive integer" ) _snake_case : Any = [True] * (num + 1) _snake_case : str = 2 while p * p <= num: i...
354
# Copyright 2023 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 # # Unless required by applicabl...
284
0
import copy from typing import TYPE_CHECKING, Any, Mapping, Optional, OrderedDict from packaging import version from ...configuration_utils import PretrainedConfig from ...onnx import OnnxConfig from ...utils import logging from ..auto.configuration_auto import AutoConfig if TYPE_CHECKING: from ... import P...
355
import torch from transformers import PreTrainedModel, XLMRobertaConfig, XLMRobertaModel class lowercase_ ( __snake_case ): _lowerCamelCase = 'M-CLIP' def __init__( self , lowercase_=1_024 , lowercase_=768 , **lowercase_ ): _snake_case ...
284
0
import warnings from ...utils import logging from .image_processing_flava import FlavaImageProcessor __SCREAMING_SNAKE_CASE : str = logging.get_logger(__name__) class lowercase_ ( __snake_case ): def __init__( self , *lowercase_ , **lowercase_ ): ...
356
import importlib import shutil import threading import warnings from typing import List import fsspec import fsspec.asyn from . import compression from .hffilesystem import HfFileSystem __SCREAMING_SNAKE_CASE : Any = importlib.util.find_spec('s3fs') is not None if _has_safs: from .safilesystem...
284
0
"""simple docstring""" import functools from typing import Any def snake_case (__lowercase , __lowercase ) -> bool: '''simple docstring''' if not isinstance(__lowercase , __lowercase ) or len(__lowercase ) == 0: raise ValueError("the string should be not em...
357
import os import pytest from attr import dataclass __SCREAMING_SNAKE_CASE : int = 'us-east-1' # defaults region @dataclass class lowercase_ : _lowerCamelCase = 42 _lowerCamelCase = 'arn:aws:iam::558105141721:role/sagemaker_execution_role' _lowerCamelCase...
284
0
"""simple docstring""" from __future__ import annotations from collections import deque from collections.abc import Iterator from dataclasses import dataclass @dataclass class lowercase_ : _lowerCamelCase = 42 _lowerCamelCase = 42 class lowercase_ : def ...
358
def snake_case (__lowercase ) -> list[int]: '''simple docstring''' if num <= 0: raise ValueError("Input must be a positive integer" ) _snake_case : Any = [True] * (num + 1) _snake_case : str = 2 while p * p <= num: i...
284
0
import logging from dataclasses import dataclass, field from pathlib import Path from typing import Optional, Union from .generation.configuration_utils import GenerationConfig from .training_args import TrainingArguments from .utils import add_start_docstrings __SCREAMING_SNAKE_CASE : int = logging...
359
from __future__ import annotations def snake_case (__lowercase , __lowercase ) -> float: '''simple docstring''' _snake_case : Any = sorted(numsa + numsa ) _snake_case ,_snake_case : Any = divmod(len(__lowercase ) , 2 ) if mod...
284
0
from collections import OrderedDict from typing import Mapping from packaging import version from ...configuration_utils import PretrainedConfig from ...onnx import OnnxConfig from ...utils import logging __SCREAMING_SNAKE_CASE : int = logging.get_logger(__name__) __SCREAMING_SNAKE_CASE : T...
360
def snake_case (__lowercase ) -> list: '''simple docstring''' return [ txt[:a] + txt[a].upper() + txt[a + 1 :] for a in range(len(__lowercase ) ) if txt[a].isalpha() ] if __name__ == "__main__": __import__('doctest').testmod()
284
0
import itertools import random import unittest import numpy as np from transformers import is_speech_available from transformers.testing_utils import require_torch, require_torchaudio from ...test_sequence_feature_extraction_common import SequenceFeatureExtractionTestMixin if is_speech_available(): from transf...
361
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] = [ord(letter) for le...
284
0
from dataclasses import dataclass, field from typing import ClassVar, Dict from ..features import Features, Sequence, Value from .base import TaskTemplate @dataclass(frozen=__snake_case ) class lowercase_ ( __snake_case ): # `task` is not a ClassVar since we want it to be part of the `asdict` ...
362
def snake_case () -> Dict: '''simple docstring''' _snake_case : List[str] = 0 for i in range(1 , 1_001 ): total += i**i return str(__lowercase )[-10:] if __name__ == "__main__": print(solution())
284
0
import re from filelock import FileLock try: import nltk __SCREAMING_SNAKE_CASE : Any = True except (ImportError, ModuleNotFoundError): __SCREAMING_SNAKE_CASE : str = False if NLTK_AVAILABLE: with FileLock('.lock') as lock: nltk.download('punkt', quiet=True...
363
from __future__ import annotations import unittest import numpy as np from transformers import OPTConfig, is_tf_available from transformers.testing_utils import require_sentencepiece, require_tf, slow from ...test_configuration_common import ConfigTester from ...test_modeling_tf_common import TFModelTesterMixin, id...
284
0
import importlib import os import sys # This is required to make the module import works (when the python process is running from the root of the repo) sys.path.append('.') def snake_case (__lowercase ) -> int: '''simple docstring''' _snake_case : List[Any] = test...
364
def snake_case (__lowercase , __lowercase ) -> str: '''simple docstring''' _snake_case : Tuple = "" for word_or_phrase in separated: if not isinstance(__lowercase , __lowercase ): raise Exception("join() accepts only strings to ...
284
0
import numpy as np def snake_case (__lowercase ) -> np.array: '''simple docstring''' return (2 / (1 + np.exp(-2 * vector ))) - 1 if __name__ == "__main__": import doctest doctest.testmod()
365
from typing import Dict, List, Optional, Tuple, Union import numpy as np from ...image_processing_utils import BaseImageProcessor, BatchFeature, get_size_dict from ...image_transforms import ( center_crop, flip_channel_order, get_resize_output_image_size, rescale, resize, to_channel_dimension_...
284
0
def snake_case (__lowercase ) -> bool: '''simple docstring''' return number & 1 == 0 if __name__ == "__main__": import doctest doctest.testmod()
366
def snake_case (__lowercase ) -> bool: '''simple docstring''' _snake_case : Dict = 0 for ch in input_str: _snake_case : int = ord(__lowercase ) _snake_case : List[Any] = pow(2 , __lowercase ) #...
284
0
import unittest import numpy as np from transformers.testing_utils import require_torch, require_vision from transformers.utils import is_torch_available, is_vision_available from ...test_image_processing_common import ImageProcessingSavingTestMixin, prepare_image_inputs if is_torch_available(): import torch ...
367
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 IFWatermarker from diffusers.utils.testing...
284
0
import warnings 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 : Any = logging.get_logger(__name__) __SCREAMING_SNAKE...
368
from typing import TYPE_CHECKING # rely on isort to merge the imports from ...utils import OptionalDependencyNotAvailable, _LazyModule, is_torch_available __SCREAMING_SNAKE_CASE : Optional[Any] = { 'configuration_autoformer': [ 'AUTOFORMER_PRETRAINED_CONFIG_ARCHIVE_MAP', 'Autofor...
284
0
import re def snake_case (__lowercase ) -> list: '''simple docstring''' return [char.split() for char in re.split(r"[^ a-z A-Z 0-9 \s]" , str_ )] def snake_case (__lowercase ) -> str: '''simple docstring''' _snake_case : List[str] = sp...
369
import shutil import tempfile import unittest from transformers import ClapFeatureExtractor, ClapProcessor, RobertaTokenizer, RobertaTokenizerFast from transformers.testing_utils import require_sentencepiece, require_torchaudio from .test_feature_extraction_clap import floats_list @require_torchaudio @require_sent...
284
0
from ...configuration_utils import PretrainedConfig from ...utils import logging from ...utils.backbone_utils import BackboneConfigMixin, get_aligned_output_features_output_indices __SCREAMING_SNAKE_CASE : Dict = logging.get_logger(__name__) __SCREAMING_SNAKE_CASE : List[Any] = { ...
370
import logging from transformers import PretrainedConfig __SCREAMING_SNAKE_CASE : Any = logging.getLogger(__name__) __SCREAMING_SNAKE_CASE : int = { 'bertabs-finetuned-cnndm': 'https://huggingface.co/remi/bertabs-finetuned-cnndm-extractive-abstractive-summarization/resolve/mai...
284
0
"""simple docstring""" import json import os import unittest from transformers.models.xlm.tokenization_xlm import VOCAB_FILES_NAMES, XLMTokenizer from transformers.testing_utils import slow from ...test_tokenization_common import TokenizerTesterMixin class lowercase_ ( __snake_case , unitte...
371
import argparse import os import shutil import torch from emmental.modules import MagnitudeBinarizer, ThresholdBinarizer, TopKBinarizer def snake_case (__lowercase ) -> str: '''simple docstring''' _snake_case : int = args.pruning_method _snake_case : List[Any] ...
284
0
import coval # From: git+https://github.com/ns-moosavi/coval.git # noqa: F401 from coval.conll import reader, util from coval.eval import evaluator import datasets __SCREAMING_SNAKE_CASE : Dict = datasets.logging.get_logger(__name__) __SCREAMING_SNAKE_CASE : List[Any] = '\\n@InPr...
350
from __future__ import annotations from collections import deque from collections.abc import Iterator from dataclasses import dataclass @dataclass class lowercase_ : _lowerCamelCase = 42 _lowerCamelCase = 42 class lowercase_ : def __init__( self , ...
284
0
import collections import inspect import unittest from typing import Dict, List, Tuple from transformers import MaskFormerSwinConfig from transformers.testing_utils import require_torch, require_torch_multi_gpu, torch_device from transformers.utils import is_torch_available from ...test_backbone_common import Backbon...
351
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 : Optional[int] = { 'configuration_distilbert': [ 'DISTIL...
284
0
import os def snake_case (__lowercase = "input.txt" ) -> int: '''simple docstring''' with open(os.path.join(os.path.dirname(__lowercase ) , __lowercase ) ) as input_file: _snake_case : List[Any] = [ [int(__lowercase ) for elem...
352
from dataclasses import dataclass, field from typing import Tuple from ..utils import cached_property, is_tf_available, logging, requires_backends from .benchmark_args_utils import BenchmarkArguments if is_tf_available(): import tensorflow as tf __SCREAMING_SNAKE_CASE : str = logging.get_logge...
284
0
import unittest import numpy as np from diffusers import LMSDiscreteScheduler, OnnxStableDiffusionInpaintPipeline from diffusers.utils.testing_utils import ( is_onnx_available, load_image, nightly, require_onnxruntime, require_torch_gpu, ) from ..test_pipelines_onnx_common import OnnxPipelineTest...
353
from __future__ import annotations import requests __SCREAMING_SNAKE_CASE : Tuple = set( 'approved_at_utc approved_by author_flair_background_color\nauthor_flair_css_class author_flair_richtext author_flair_template_id author_fullname\nauthor_premium can_mod_post category clicked content_categori...
284
0
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_flax_common import FlaxModelTesterM...
354
# Copyright 2023 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 # # Unless required by applicabl...
284
0
import datasets __SCREAMING_SNAKE_CASE : Dict = '\\n@InProceedings{conneau2018xnli,\n author = "Conneau, Alexis\n and Rinott, Ruty\n and Lample, Guillaume\n and Williams, Adina\n and Bowman, Samuel R.\n and Schwenk, ...
355
import torch from transformers import PreTrainedModel, XLMRobertaConfig, XLMRobertaModel class lowercase_ ( __snake_case ): _lowerCamelCase = 'M-CLIP' def __init__( self , lowercase_=1_024 , lowercase_=768 , **lowercase_ ): _snake_case ...
284
0
from typing import TYPE_CHECKING from ...utils import ( OptionalDependencyNotAvailable, _LazyModule, is_tf_available, is_torch_available, is_vision_available, ) __SCREAMING_SNAKE_CASE : List[str] = { 'configuration_efficientformer': [ 'EFFICIENTFORMER_PRETRAINED_CONFI...
356
import importlib import shutil import threading import warnings from typing import List import fsspec import fsspec.asyn from . import compression from .hffilesystem import HfFileSystem __SCREAMING_SNAKE_CASE : Any = importlib.util.find_spec('s3fs') is not None if _has_safs: from .safilesystem...
284
0
"""simple docstring""" import argparse import dataclasses import json import logging import os import shutil from typing import List, Optional import datasets from accelerate import Accelerator from datasets import load_dataset from finetuning import finetune from tqdm.auto import tqdm import transformers from tr...
357
import os import pytest from attr import dataclass __SCREAMING_SNAKE_CASE : int = 'us-east-1' # defaults region @dataclass class lowercase_ : _lowerCamelCase = 42 _lowerCamelCase = 'arn:aws:iam::558105141721:role/sagemaker_execution_role' _lowerCamelCase...
284
0
"""simple docstring""" from typing import TYPE_CHECKING from ...utils import OptionalDependencyNotAvailable, _LazyModule, is_torch_available, is_vision_available __SCREAMING_SNAKE_CASE : List[Any] = { 'configuration_pix2struct': [ 'PIX2STRUCT_PRETRAINED_CONFIG_ARCHIVE_MAP', '...
358
def snake_case (__lowercase ) -> list[int]: '''simple docstring''' if num <= 0: raise ValueError("Input must be a positive integer" ) _snake_case : Any = [True] * (num + 1) _snake_case : str = 2 while p * p <= num: i...
284
0
import torch from diffusers import DDIMParallelScheduler from .test_schedulers import SchedulerCommonTest class lowercase_ ( __snake_case ): _lowerCamelCase = (DDIMParallelScheduler,) _lowerCamelCase = (('eta', 0.0), ('num_inference_steps', 50)) def UpperCamelCase...
359
from __future__ import annotations def snake_case (__lowercase , __lowercase ) -> float: '''simple docstring''' _snake_case : Any = sorted(numsa + numsa ) _snake_case ,_snake_case : Any = divmod(len(__lowercase ) , 2 ) if mod...
284
0
def snake_case (__lowercase , __lowercase ) -> list[str]: '''simple docstring''' return [sentence[i : i + ngram_size] for i in range(len(__lowercase ) - ngram_size + 1 )] if __name__ == "__main__": from doctest import testmod testmod()
360
def snake_case (__lowercase ) -> list: '''simple docstring''' return [ txt[:a] + txt[a].upper() + txt[a + 1 :] for a in range(len(__lowercase ) ) if txt[a].isalpha() ] if __name__ == "__main__": __import__('doctest').testmod()
284
0
from typing import TYPE_CHECKING from ...utils import ( OptionalDependencyNotAvailable, _LazyModule, is_sentencepiece_available, is_speech_available, is_torch_available, ) __SCREAMING_SNAKE_CASE : Union[str, Any] = { 'configuration_trocr': ['TROCR_PRETRAINED_CONFIG_ARCHIVE_MA...
361
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] = [ord(letter) for le...
284
0
def snake_case (__lowercase , __lowercase = False ) -> str: '''simple docstring''' if not isinstance(__lowercase , __lowercase ): _snake_case : str = F"""Expected string as input, found {type(__lowercase )}""" raise ValueError(__lowerc...
362
def snake_case () -> Dict: '''simple docstring''' _snake_case : List[str] = 0 for i in range(1 , 1_001 ): total += i**i return str(__lowercase )[-10:] if __name__ == "__main__": print(solution())
284
0
import os import sys import tempfile import unittest import unittest.mock as mock from pathlib import Path from huggingface_hub import HfFolder, delete_repo from huggingface_hub.file_download import http_get from requests.exceptions import HTTPError from transformers import ( AlbertTokenizer, AutoTokenizer, ...
363
from __future__ import annotations import unittest import numpy as np from transformers import OPTConfig, is_tf_available from transformers.testing_utils import require_sentencepiece, require_tf, slow from ...test_configuration_common import ConfigTester from ...test_modeling_tf_common import TFModelTesterMixin, id...
284
0
def snake_case (__lowercase ) -> bool: '''simple docstring''' if p < 2: raise ValueError("p should not be less than 2!" ) elif p == 2: return True _snake_case : Tuple = 4 _snake_case : Dict = (1 << p) - 1 ...
364
def snake_case (__lowercase , __lowercase ) -> str: '''simple docstring''' _snake_case : Tuple = "" for word_or_phrase in separated: if not isinstance(__lowercase , __lowercase ): raise Exception("join() accepts only strings to ...
284
0
from graphs.minimum_spanning_tree_kruskal import kruskal def snake_case () -> Dict: '''simple docstring''' _snake_case : Union[str, Any] = 9 _snake_case : Union[str, Any] = [ [0, 1, 4], [0, 7, 8], [1, 2, 8], [7, 8, 7], ...
365
from typing import Dict, List, Optional, Tuple, Union import numpy as np from ...image_processing_utils import BaseImageProcessor, BatchFeature, get_size_dict from ...image_transforms import ( center_crop, flip_channel_order, get_resize_output_image_size, rescale, resize, to_channel_dimension_...
284
0
import argparse import json import os import fairseq import torch from torch import nn from transformers import ( SpeechaTextaConfig, SpeechaTextaForCausalLM, SpeechaTextaTokenizer, SpeechEncoderDecoderConfig, SpeechEncoderDecoderModel, WavaVecaConfig, WavaVecaFeatureExtractor, WavaVec...
366
def snake_case (__lowercase ) -> bool: '''simple docstring''' _snake_case : Dict = 0 for ch in input_str: _snake_case : int = ord(__lowercase ) _snake_case : List[Any] = pow(2 , __lowercase ) #...
284
0
import datasets from .nmt_bleu import compute_bleu # From: https://github.com/tensorflow/nmt/blob/master/nmt/scripts/bleu.py __SCREAMING_SNAKE_CASE : Union[str, Any] = '\\n@INPROCEEDINGS{Papineni02bleu:a,\n author = {Kishore Papineni and Salim Roukos and Todd Ward and Wei-jing Zhu},\n title =...
367
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 IFWatermarker from diffusers.utils.testing...
284
0
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, smartaa_timesteps, smartaa_timesteps, smart...
368
from typing import TYPE_CHECKING # rely on isort to merge the imports from ...utils import OptionalDependencyNotAvailable, _LazyModule, is_torch_available __SCREAMING_SNAKE_CASE : Optional[Any] = { 'configuration_autoformer': [ 'AUTOFORMER_PRETRAINED_CONFIG_ARCHIVE_MAP', 'Autofor...
284
0
import argparse import math import traceback import dateutil.parser as date_parser import requests def snake_case (__lowercase ) -> Tuple: '''simple docstring''' _snake_case : Any = {} _snake_case : Union[str, Any] = job["started_at"] _snake_ca...
369
import shutil import tempfile import unittest from transformers import ClapFeatureExtractor, ClapProcessor, RobertaTokenizer, RobertaTokenizerFast from transformers.testing_utils import require_sentencepiece, require_torchaudio from .test_feature_extraction_clap import floats_list @require_torchaudio @require_sent...
284
0
import itertools import random import unittest import numpy as np from transformers import BatchFeature, SpeechTaFeatureExtractor from transformers.testing_utils import require_torch from transformers.utils.import_utils import is_torch_available from ...test_sequence_feature_extraction_common import SequenceFeatureE...
370
import logging from transformers import PretrainedConfig __SCREAMING_SNAKE_CASE : Any = logging.getLogger(__name__) __SCREAMING_SNAKE_CASE : int = { 'bertabs-finetuned-cnndm': 'https://huggingface.co/remi/bertabs-finetuned-cnndm-extractive-abstractive-summarization/resolve/mai...
284
0
"""simple docstring""" import json import pathlib import unittest import numpy as np from transformers.testing_utils import require_torch, require_vision, slow from transformers.utils import is_torch_available, is_vision_available from ...test_image_processing_common import ImageProcessingSavingTestMixin, prepar...
371
import argparse import os import shutil import torch from emmental.modules import MagnitudeBinarizer, ThresholdBinarizer, TopKBinarizer def snake_case (__lowercase ) -> str: '''simple docstring''' _snake_case : int = args.pruning_method _snake_case : List[Any] ...
284
0
def snake_case (__lowercase , __lowercase ) -> int: '''simple docstring''' return 1 if input_a == input_a else 0 def snake_case () -> None: '''simple docstring''' assert xnor_gate(0 , 0 ) == 1 assert xnor_gate(0 , 1 ) == 0 asser...
350
from __future__ import annotations from collections import deque from collections.abc import Iterator from dataclasses import dataclass @dataclass class lowercase_ : _lowerCamelCase = 42 _lowerCamelCase = 42 class lowercase_ : def __init__( self , ...
284
0
import gc import unittest import numpy as np import torch from transformers import CLIPTextConfig, CLIPTextModel, CLIPTokenizer from diffusers import TransformeraDModel, VQDiffusionPipeline, VQDiffusionScheduler, VQModel from diffusers.pipelines.vq_diffusion.pipeline_vq_diffusion import LearnedClassifierFreeSamplingE...
351
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 : Optional[int] = { 'configuration_distilbert': [ 'DISTIL...
284
0
import argparse from pathlib import Path import requests import torch from PIL import Image from transformers import ( RobertaTokenizer, TrOCRConfig, TrOCRForCausalLM, TrOCRProcessor, VisionEncoderDecoderModel, ViTConfig, ViTImageProcessor, ViTModel, ) from transformers.utils import lo...
352
from dataclasses import dataclass, field from typing import Tuple from ..utils import cached_property, is_tf_available, logging, requires_backends from .benchmark_args_utils import BenchmarkArguments if is_tf_available(): import tensorflow as tf __SCREAMING_SNAKE_CASE : str = logging.get_logge...
284
0
import logging from transformers import PretrainedConfig __SCREAMING_SNAKE_CASE : Any = logging.getLogger(__name__) __SCREAMING_SNAKE_CASE : int = { 'bertabs-finetuned-cnndm': 'https://huggingface.co/remi/bertabs-finetuned-cnndm-extractive-abstractive-summarization/resolve/mai...
353
from __future__ import annotations import requests __SCREAMING_SNAKE_CASE : Tuple = set( 'approved_at_utc approved_by author_flair_background_color\nauthor_flair_css_class author_flair_richtext author_flair_template_id author_fullname\nauthor_premium can_mod_post category clicked content_categori...
284
0
from __future__ import annotations __SCREAMING_SNAKE_CASE : Optional[int] = { 'A': ['B', 'C', 'E'], 'B': ['A', 'D', 'E'], 'C': ['A', 'F', 'G'], 'D': ['B'], 'E': ['A', 'B', 'D'], 'F': ['C'], 'G': ['C'], } class lowercase_ : def __init__( self , ...
354
# Copyright 2023 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 # # Unless required by applicabl...
284
0
import gc import random import unittest import numpy as np import torch from transformers import ( CLIPImageProcessor, CLIPTextConfig, CLIPTextModel, CLIPTokenizer, CLIPVisionConfig, CLIPVisionModelWithProjection, ) from diffusers import AutoencoderKL, DDIMScheduler, DDPMScheduler, StableU...
355
import torch from transformers import PreTrainedModel, XLMRobertaConfig, XLMRobertaModel class lowercase_ ( __snake_case ): _lowerCamelCase = 'M-CLIP' def __init__( self , lowercase_=1_024 , lowercase_=768 , **lowercase_ ): _snake_case ...
284
0
import gzip import hashlib import json import multiprocessing import os import re import shutil import time from pathlib import Path import numpy as np from arguments import PreprocessingArguments from datasets import load_dataset from minhash_deduplication import deduplicate_dataset from transformers import AutoToke...
356
import importlib import shutil import threading import warnings from typing import List import fsspec import fsspec.asyn from . import compression from .hffilesystem import HfFileSystem __SCREAMING_SNAKE_CASE : Any = importlib.util.find_spec('s3fs') is not None if _has_safs: from .safilesystem...
284
0
"""simple docstring""" import os import sys __SCREAMING_SNAKE_CASE : int = os.path.join(os.path.dirname(__file__), 'src') sys.path.append(SRC_DIR) from transformers import ( AutoConfig, AutoModel, AutoModelForCausalLM, AutoModelForMaskedLM, AutoModelForQuestionAnswering, ...
357
import os import pytest from attr import dataclass __SCREAMING_SNAKE_CASE : int = 'us-east-1' # defaults region @dataclass class lowercase_ : _lowerCamelCase = 42 _lowerCamelCase = 'arn:aws:iam::558105141721:role/sagemaker_execution_role' _lowerCamelCase...
284
0
"""simple docstring""" import faiss # noqa: F401 # Here to have a nice missing dependency error message early on import numpy # noqa: F401 # Here to have a nice missing dependency error message early on import requests # noqa: F401 # Here to have a nice missing dependency error message early on import sklearn #...
358
def snake_case (__lowercase ) -> list[int]: '''simple docstring''' if num <= 0: raise ValueError("Input must be a positive integer" ) _snake_case : Any = [True] * (num + 1) _snake_case : str = 2 while p * p <= num: i...
284
0
from __future__ import annotations import csv import requests from bsa import BeautifulSoup def snake_case (__lowercase = "" ) -> dict[str, float]: '''simple docstring''' _snake_case : str = url or "https://www.imdb.com/chart/top/?ref_=nv_mv_250" _snake_case : O...
359
from __future__ import annotations def snake_case (__lowercase , __lowercase ) -> float: '''simple docstring''' _snake_case : Any = sorted(numsa + numsa ) _snake_case ,_snake_case : Any = divmod(len(__lowercase ) , 2 ) if mod...
284
0
import logging from pathlib import Path import numpy as np import pytorch_lightning as pl import torch from pytorch_lightning.callbacks import EarlyStopping, ModelCheckpoint from pytorch_lightning.utilities import rank_zero_only from utils_rag import save_json def snake_case (__lowercase ) -> Optional[int]:...
360
def snake_case (__lowercase ) -> list: '''simple docstring''' return [ txt[:a] + txt[a].upper() + txt[a + 1 :] for a in range(len(__lowercase ) ) if txt[a].isalpha() ] if __name__ == "__main__": __import__('doctest').testmod()
284
0
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] = [ord(letter) for le...
361
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] = [ord(letter) for le...
284
0
import logging import os from typing import Dict, List, Optional, Union import torch import torch.nn as nn from accelerate.utils.imports import ( is_abit_bnb_available, is_abit_bnb_available, is_bnb_available, ) from ..big_modeling import dispatch_model, init_empty_weights from .dataclasses import BnbQua...
362
def snake_case () -> Dict: '''simple docstring''' _snake_case : List[str] = 0 for i in range(1 , 1_001 ): total += i**i return str(__lowercase )[-10:] if __name__ == "__main__": print(solution())
284
0
import gc import random import unittest import numpy as np import torch from transformers import CLIPTextConfig, CLIPTextModel, CLIPTextModelWithProjection, CLIPTokenizer from diffusers import ( AutoencoderKL, DiffusionPipeline, EulerDiscreteScheduler, StableDiffusionXLImgaImgPipeline, UNetaDCondi...
363
from __future__ import annotations import unittest import numpy as np from transformers import OPTConfig, is_tf_available from transformers.testing_utils import require_sentencepiece, require_tf, slow from ...test_configuration_common import ConfigTester from ...test_modeling_tf_common import TFModelTesterMixin, id...
284
0
import os import re from shutil import copyfile from typing import Any, Dict, List, Optional, Tuple import sentencepiece as spm from ...tokenization_utils import AddedToken, PreTrainedTokenizer from ...utils import logging __SCREAMING_SNAKE_CASE : Tuple = logging.get_logger(__name__) ...
364
def snake_case (__lowercase , __lowercase ) -> str: '''simple docstring''' _snake_case : Tuple = "" for word_or_phrase in separated: if not isinstance(__lowercase , __lowercase ): raise Exception("join() accepts only strings to ...
284
0
from __future__ import annotations from math import pi, sqrt def snake_case (__lowercase , __lowercase ) -> tuple: '''simple docstring''' if inductance <= 0: raise ValueError("Inductance cannot be 0 or negative" ) elif capacitance <= 0: raise ValueErr...
365
from typing import Dict, List, Optional, Tuple, Union import numpy as np from ...image_processing_utils import BaseImageProcessor, BatchFeature, get_size_dict from ...image_transforms import ( center_crop, flip_channel_order, get_resize_output_image_size, rescale, resize, to_channel_dimension_...
284
0
# DISCLAIMER: This file is strongly influenced by https://github.com/ermongroup/ddim from dataclasses import dataclass from typing import Optional, Tuple, Union import flax import jax import jax.numpy as jnp from ..configuration_utils import ConfigMixin, register_to_config from .scheduling_utils_flax import ( Co...
366
def snake_case (__lowercase ) -> bool: '''simple docstring''' _snake_case : Dict = 0 for ch in input_str: _snake_case : int = ord(__lowercase ) _snake_case : List[Any] = pow(2 , __lowercase ) #...
284
0
def snake_case (__lowercase = 2_000_000 ) -> int: '''simple docstring''' _snake_case : Tuple = [0 for i in range(n + 1 )] _snake_case : Optional[int] = 1 _snake_case : List[Any] = 1 for i in range(2 , int(n**0.5 ) + 1...
367
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 IFWatermarker from diffusers.utils.testing...
284
0
import datasets from .evaluate import evaluate __SCREAMING_SNAKE_CASE : List[Any] = '\\n@article{hendrycks2021cuad,\n title={CUAD: An Expert-Annotated NLP Dataset for Legal Contract Review},\n author={Dan Hendrycks and Collin Burns and Anya Chen and Spencer Ball},\n journal={arXiv pre...
368
from typing import TYPE_CHECKING # rely on isort to merge the imports from ...utils import OptionalDependencyNotAvailable, _LazyModule, is_torch_available __SCREAMING_SNAKE_CASE : Optional[Any] = { 'configuration_autoformer': [ 'AUTOFORMER_PRETRAINED_CONFIG_ARCHIVE_MAP', 'Autofor...
284
0
from typing import TYPE_CHECKING from ...utils import _LazyModule __SCREAMING_SNAKE_CASE : Any = {'tokenization_wav2vec2_phoneme': ['Wav2Vec2PhonemeCTCTokenizer']} if TYPE_CHECKING: from .tokenization_wavaveca_phoneme import WavaVecaPhonemeCTCTokenizer else: import sys __SCREAM...
369
import shutil import tempfile import unittest from transformers import ClapFeatureExtractor, ClapProcessor, RobertaTokenizer, RobertaTokenizerFast from transformers.testing_utils import require_sentencepiece, require_torchaudio from .test_feature_extraction_clap import floats_list @require_torchaudio @require_sent...
284
0
def snake_case (__lowercase ) -> int: '''simple docstring''' _snake_case : str = [] _snake_case : Optional[int] = [] _snake_case : List[str] = { "^": 3, "*": 2, "/": 2, "%": 2, "+": 1, ...
370
import logging from transformers import PretrainedConfig __SCREAMING_SNAKE_CASE : Any = logging.getLogger(__name__) __SCREAMING_SNAKE_CASE : int = { 'bertabs-finetuned-cnndm': 'https://huggingface.co/remi/bertabs-finetuned-cnndm-extractive-abstractive-summarization/resolve/mai...
284
0
"""simple docstring""" from collections.abc import Iterable from typing import Generic, TypeVar __SCREAMING_SNAKE_CASE : List[Any] = TypeVar('_T') class lowercase_ ( Generic[_T] ): def __init__( self , lowercase_ = None ): _snake_case : ...
371
import argparse import os import shutil import torch from emmental.modules import MagnitudeBinarizer, ThresholdBinarizer, TopKBinarizer def snake_case (__lowercase ) -> str: '''simple docstring''' _snake_case : int = args.pruning_method _snake_case : List[Any] ...
284
0
import json import unittest import numpy as np from huggingface_hub import hf_hub_download 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_im...
350
from __future__ import annotations from collections import deque from collections.abc import Iterator from dataclasses import dataclass @dataclass class lowercase_ : _lowerCamelCase = 42 _lowerCamelCase = 42 class lowercase_ : def __init__( self , ...
284
0
import argparse import json from pathlib import Path import requests import torch from huggingface_hub import hf_hub_download from PIL import Image from transformers import DetrConfig, DetrForObjectDetection, DetrForSegmentation, DetrImageProcessor, ResNetConfig from transformers.utils import logging logging.set_ve...
351
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 : Optional[int] = { 'configuration_distilbert': [ 'DISTIL...
284
0
import os import unittest from tempfile import TemporaryDirectory import torch import torch.nn as nn from accelerate.utils import ( OffloadedWeightsLoader, extract_submodules_state_dict, load_offloaded_weight, offload_state_dict, offload_weight, ) class lowercase_ ( nn.Module ): ...
352
from dataclasses import dataclass, field from typing import Tuple from ..utils import cached_property, is_tf_available, logging, requires_backends from .benchmark_args_utils import BenchmarkArguments if is_tf_available(): import tensorflow as tf __SCREAMING_SNAKE_CASE : str = logging.get_logge...
284
0
from ...configuration_utils import PretrainedConfig from ...utils import logging __SCREAMING_SNAKE_CASE : int = logging.get_logger(__name__) __SCREAMING_SNAKE_CASE : List[Any] = { 'google/pegasus-large': 'https://huggingface.co/google/pegasus-large/resolve/main/config.json', ...
353
from __future__ import annotations import requests __SCREAMING_SNAKE_CASE : Tuple = set( 'approved_at_utc approved_by author_flair_background_color\nauthor_flair_css_class author_flair_richtext author_flair_template_id author_fullname\nauthor_premium can_mod_post category clicked content_categori...
284
0
import importlib import os import fsspec import pytest from fsspec import register_implementation from fsspec.registry import _registry as _fsspec_registry from datasets.filesystems import COMPRESSION_FILESYSTEMS, HfFileSystem, extract_path_from_uri, is_remote_filesystem from .utils import require_lza, require_zstan...
354
# Copyright 2023 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 # # Unless required by applicabl...
284
0
import json from typing import List, Optional, Tuple from tokenizers import normalizers from ...tokenization_utils_fast import PreTrainedTokenizerFast from ...utils import logging from .tokenization_distilbert import DistilBertTokenizer __SCREAMING_SNAKE_CASE : List[Any] = logging.get_logger(__...
355
import torch from transformers import PreTrainedModel, XLMRobertaConfig, XLMRobertaModel class lowercase_ ( __snake_case ): _lowerCamelCase = 'M-CLIP' def __init__( self , lowercase_=1_024 , lowercase_=768 , **lowercase_ ): _snake_case ...
284
0
from typing import Optional, Tuple, Union import torch from einops import rearrange, reduce from diffusers import DDIMScheduler, DDPMScheduler, DiffusionPipeline, ImagePipelineOutput, UNetaDConditionModel from diffusers.schedulers.scheduling_ddim import DDIMSchedulerOutput from diffusers.schedulers.scheduling_ddpm im...
356
import importlib import shutil import threading import warnings from typing import List import fsspec import fsspec.asyn from . import compression from .hffilesystem import HfFileSystem __SCREAMING_SNAKE_CASE : Any = importlib.util.find_spec('s3fs') is not None if _has_safs: from .safilesystem...
284
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, is_vision_available, ) __SCREAMING_SNAKE_CASE : Union[str, Any] =...
357
import os import pytest from attr import dataclass __SCREAMING_SNAKE_CASE : int = 'us-east-1' # defaults region @dataclass class lowercase_ : _lowerCamelCase = 42 _lowerCamelCase = 'arn:aws:iam::558105141721:role/sagemaker_execution_role' _lowerCamelCase...
284
0
"""simple docstring""" from collections import OrderedDict from typing import Mapping from packaging import version from ...configuration_utils import PretrainedConfig from ...onnx import OnnxConfig from ...utils import logging __SCREAMING_SNAKE_CASE : List[Any] = logging.get_logger(__name__) ...
358
def snake_case (__lowercase ) -> list[int]: '''simple docstring''' if num <= 0: raise ValueError("Input must be a positive integer" ) _snake_case : Any = [True] * (num + 1) _snake_case : str = 2 while p * p <= num: i...
284
0
from typing import TYPE_CHECKING from ...utils import OptionalDependencyNotAvailable, _LazyModule, is_torch_available __SCREAMING_SNAKE_CASE : Dict = { 'configuration_x_clip': [ 'XCLIP_PRETRAINED_CONFIG_ARCHIVE_MAP', 'XCLIPConfig', 'XCLIPTextConfig', 'XCLIPVisionC...
359
from __future__ import annotations def snake_case (__lowercase , __lowercase ) -> float: '''simple docstring''' _snake_case : Any = sorted(numsa + numsa ) _snake_case ,_snake_case : Any = divmod(len(__lowercase ) , 2 ) if mod...
284
0
# Copyright (c) 2021-, NVIDIA CORPORATION. All rights reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by appl...
360
def snake_case (__lowercase ) -> list: '''simple docstring''' return [ txt[:a] + txt[a].upper() + txt[a + 1 :] for a in range(len(__lowercase ) ) if txt[a].isalpha() ] if __name__ == "__main__": __import__('doctest').testmod()
284
0
from __future__ import annotations import requests __SCREAMING_SNAKE_CASE : Tuple = set( 'approved_at_utc approved_by author_flair_background_color\nauthor_flair_css_class author_flair_richtext author_flair_template_id author_fullname\nauthor_premium can_mod_post category clicked content_categori...
361
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] = [ord(letter) for le...
284
0
from collections import OrderedDict from typing import TYPE_CHECKING, Any, Mapping, Optional, Union from ...configuration_utils import PretrainedConfig from ...onnx import OnnxConfig from ...utils import logging if TYPE_CHECKING: from ... import FeatureExtractionMixin, PreTrainedTokenizerBase, TensorType __SCR...
362
def snake_case () -> Dict: '''simple docstring''' _snake_case : List[str] = 0 for i in range(1 , 1_001 ): total += i**i return str(__lowercase )[-10:] if __name__ == "__main__": print(solution())
284
0
def snake_case (__lowercase , __lowercase ): '''simple docstring''' _snake_case : str = (boundary[1] - boundary[0]) / steps _snake_case : Dict = boundary[0] _snake_case : Dict = boundary[1] _snake_case : Optional[int] ...
363
from __future__ import annotations import unittest import numpy as np from transformers import OPTConfig, is_tf_available from transformers.testing_utils import require_sentencepiece, require_tf, slow from ...test_configuration_common import ConfigTester from ...test_modeling_tf_common import TFModelTesterMixin, id...
284
0
import argparse import requests import torch from PIL import Image from torchvision.transforms import Compose, Normalize, Resize, ToTensor from transformers import SwinaSRConfig, SwinaSRForImageSuperResolution, SwinaSRImageProcessor def snake_case (__lowercase ) -> int: '''simple docstring...
364
def snake_case (__lowercase , __lowercase ) -> str: '''simple docstring''' _snake_case : Tuple = "" for word_or_phrase in separated: if not isinstance(__lowercase , __lowercase ): raise Exception("join() accepts only strings to ...
284
0
import copy import os import tempfile from unittest import TestCase from unittest.mock import patch import numpy as np import pyarrow as pa import pyarrow.parquet as pq import pytest from datasets.arrow_writer import ArrowWriter, OptimizedTypedSequence, ParquetWriter, TypedSequence from datasets.features import Array...
365
from typing import Dict, List, Optional, Tuple, Union import numpy as np from ...image_processing_utils import BaseImageProcessor, BatchFeature, get_size_dict from ...image_transforms import ( center_crop, flip_channel_order, get_resize_output_image_size, rescale, resize, to_channel_dimension_...
284
0
import numpy as np from nltk.translate import meteor_score import datasets from datasets.config import importlib_metadata, version __SCREAMING_SNAKE_CASE : Dict = version.parse(importlib_metadata.version('nltk')) if NLTK_VERSION >= version.Version('3.6.4'): from nltk import word_tokenize __SCR...
366
def snake_case (__lowercase ) -> bool: '''simple docstring''' _snake_case : Dict = 0 for ch in input_str: _snake_case : int = ord(__lowercase ) _snake_case : List[Any] = pow(2 , __lowercase ) #...
284
0
from argparse import ArgumentParser, Namespace from typing import Any, List, Optional from ..pipelines import Pipeline, get_supported_tasks, pipeline from ..utils import logging from . import BaseTransformersCLICommand try: from fastapi import Body, FastAPI, HTTPException from fastapi.routing import APIRoute...
367
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 IFWatermarker from diffusers.utils.testing...
284
0
from typing import Dict, List, Optional, Union import numpy as np from transformers.utils import is_vision_available from transformers.utils.generic import TensorType from ...image_processing_utils import BaseImageProcessor, BatchFeature, get_size_dict from ...image_transforms import ( center_crop, get_resiz...
368
from typing import TYPE_CHECKING # rely on isort to merge the imports from ...utils import OptionalDependencyNotAvailable, _LazyModule, is_torch_available __SCREAMING_SNAKE_CASE : Optional[Any] = { 'configuration_autoformer': [ 'AUTOFORMER_PRETRAINED_CONFIG_ARCHIVE_MAP', 'Autofor...
284
0
import argparse import os import numpy as np import tensorflow as tf import torch from transformers import BertModel def snake_case (__lowercase , __lowercase , __lowercase ) -> int: '''simple docstring''' _snake_case : Optional[int] = ("dense.weight", "attent...
369
import shutil import tempfile import unittest from transformers import ClapFeatureExtractor, ClapProcessor, RobertaTokenizer, RobertaTokenizerFast from transformers.testing_utils import require_sentencepiece, require_torchaudio from .test_feature_extraction_clap import floats_list @require_torchaudio @require_sent...
284
0
def snake_case (__lowercase , __lowercase ) -> str: '''simple docstring''' _snake_case : Tuple = "" for word_or_phrase in separated: if not isinstance(__lowercase , __lowercase ): raise Exception("join() accepts only strings to ...
370
import logging from transformers import PretrainedConfig __SCREAMING_SNAKE_CASE : Any = logging.getLogger(__name__) __SCREAMING_SNAKE_CASE : int = { 'bertabs-finetuned-cnndm': 'https://huggingface.co/remi/bertabs-finetuned-cnndm-extractive-abstractive-summarization/resolve/mai...
284
0
"""simple docstring""" import json import os import re import shutil import tempfile import unittest from typing import Tuple from transformers import AddedToken, BatchEncoding, ByTaTokenizer from transformers.utils import cached_property, is_tf_available, is_torch_available from ...test_tokenization_common impor...
371
import argparse import os import shutil import torch from emmental.modules import MagnitudeBinarizer, ThresholdBinarizer, TopKBinarizer def snake_case (__lowercase ) -> str: '''simple docstring''' _snake_case : int = args.pruning_method _snake_case : List[Any] ...
284
0
from __future__ import annotations from math import pow, sqrt def _snake_case( SCREAMING_SNAKE_CASE__ , SCREAMING_SNAKE_CASE__ , SCREAMING_SNAKE_CASE__ ) -> dict[str, float]: if (resistance, reactance, impedance).count(0 ) != 1: raise ValueError("""One and only one...
285
from typing import Mapping from ...configuration_utils import PretrainedConfig from ...onnx import OnnxSeqaSeqConfigWithPast from ...utils import logging lowercase : List[str] = logging.get_logger(__name__) lowercase : Tuple = { """google/umt5-small""": """https://huggingface.co/g...
285
1
from PIL import Image def _snake_case( SCREAMING_SNAKE_CASE__ , SCREAMING_SNAKE_CASE__ ) -> Image: lowercase : Optional[int] = (259 * (level + 255)) / (255 * (259 - level)) def contrast(SCREAMING_SNAKE_CASE__ ) -> int: return int(128 + factor *...
285
import json import os import shutil import tempfile import unittest import numpy as np import pytest from transformers import BertTokenizer, BertTokenizerFast from transformers.models.bert.tokenization_bert import VOCAB_FILES_NAMES from transformers.testing_utils import require_vision from transformers.utils import ...
285
1
from __future__ import annotations from statistics import mean def _snake_case( SCREAMING_SNAKE_CASE__ , SCREAMING_SNAKE_CASE__ , SCREAMING_SNAKE_CASE__ ) -> list[int]: lowercase : Optional[Any] = [0] * no_of_processes lowercase : Tuple = ...
285
def _snake_case( SCREAMING_SNAKE_CASE__ ) -> int: assert ( isinstance(SCREAMING_SNAKE_CASE__ , SCREAMING_SNAKE_CASE__ ) and number_of_steps > 0 ), f"number_of_steps needs to be positive integer, your input {number_of_steps}" if number_of_steps == 1: re...
285
1
from __future__ import annotations import unittest from transformers import RoFormerConfig, is_tf_available from transformers.testing_utils import require_tf, slow from ...test_configuration_common import ConfigTester from ...test_modeling_tf_common import TFModelTesterMixin, ids_tensor, random_attention_mask from ...
285
from ...processing_utils import ProcessorMixin class __snake_case ( lowerCAmelCase ): _a : Union[str, Any]= "WhisperFeatureExtractor" _a : int= "WhisperTokenizer" def __init__( self ,snake_case ,snake_case ): '''simple docstring''' super().__...
285
1
import argparse import csv import logging import os import random import numpy as np import torch from torch.utils.data import DataLoader, RandomSampler, SequentialSampler, TensorDataset from tqdm import tqdm, trange from transformers import ( CONFIG_NAME, WEIGHTS_NAME, AdamW, OpenAIGPTDoubleHeadsMod...
285
from bisect import bisect from itertools import accumulate def _snake_case( SCREAMING_SNAKE_CASE__ , SCREAMING_SNAKE_CASE__ , SCREAMING_SNAKE_CASE__ , SCREAMING_SNAKE_CASE__ ) -> Optional[int]: lowercase : Dict = sorted(zip(SCREAMING_SNAKE_CASE__ , SCREAMIN...
285
1
def _snake_case( SCREAMING_SNAKE_CASE__ , SCREAMING_SNAKE_CASE__ , SCREAMING_SNAKE_CASE__ ) -> int: def count_of_possible_combinations(SCREAMING_SNAKE_CASE__ ) -> int: if target < 0: return 0 if target == 0: return 1...
285
import os import unicodedata from shutil import copyfile from typing import Any, Dict, List, Optional, Tuple import sentencepiece as spm from ...tokenization_utils import AddedToken, PreTrainedTokenizer from ...utils import SPIECE_UNDERLINE, logging lowercase : Union[str, Any] = logging.get_logger(_...
285
1
from dataclasses import dataclass from typing import List, Optional, Union import numpy as np import PIL import torch from transformers import CLIPImageProcessor, CLIPVisionModel from ...models import PriorTransformer from ...pipelines import DiffusionPipeline from ...schedulers import HeunDiscreteScheduler from ......
285
print((lambda quine: quine % quine)("""print((lambda quine: quine %% quine)(%r))"""))
285
1
import os import re import sys import traceback import warnings from pathlib import Path from typing import Dict, Optional, Union from uuid import uuida from huggingface_hub import HfFolder, ModelCard, ModelCardData, hf_hub_download, whoami from huggingface_hub.file_download import REGEX_COMMIT_HASH from huggingface_...
285
def _snake_case( SCREAMING_SNAKE_CASE__ , SCREAMING_SNAKE_CASE__ , SCREAMING_SNAKE_CASE__ ) -> int: def count_of_possible_combinations(SCREAMING_SNAKE_CASE__ ) -> int: if target < 0: return 0 if target == 0: return 1...
285
1