code
stringlengths
82
54.1k
code_codestyle
int64
0
699
style_context
stringlengths
111
35.6k
style_context_codestyle
int64
0
699
label
int64
0
1
from __future__ import annotations from random import random class __a : def __init__( self : str , UpperCAmelCase : int = None ): lowerCAmelCase_ : Any = value lowerCAmelCase_ : List[str] = random() low...
600
import numpy as np import torch from torch.nn import CrossEntropyLoss from transformers import AutoModelForCausalLM, AutoTokenizer import datasets from datasets import logging _lowerCamelCase = '\\n\n' _lowerCamelCase = '\nPerplexity (PPL) is one of the most common metrics for eval...
114
0
import string import numpy def SCREAMING_SNAKE_CASE_ ( UpperCamelCase__ , UpperCamelCase__ ): return b if a == 0 else greatest_common_divisor(b % a , lowercase_ ) class _lowerCamelCase : """simple docstring""" SCREAMING_SNAKE_CASE_ = string.ascii_uppercase...
285
from __future__ import annotations from scipy.special import comb # type: ignore class __A : """simple docstring""" def __init__( self , a__): """simple docstring""" _lowerCamelCase : str = list_of_points # ...
114
0
"""simple docstring""" import comet # From: unbabel-comet import torch import datasets SCREAMING_SNAKE_CASE__:str = datasets.logging.get_logger(__name__) SCREAMING_SNAKE_CASE__:Optional[Any] = """\\n@inproceedings{rei-EtAl:2020:WMT,\n author = {Rei, Ricardo and Stewart, Craig and Fa...
528
import warnings from ...utils import logging from .image_processing_deit import DeiTImageProcessor _lowerCamelCase = logging.get_logger(__name__) class __A ( lowerCamelCase__ ): """simple docstring""" def __init__( self , *a__ , **a__): ...
114
0
import unittest from transformers import JukeboxTokenizer from transformers.testing_utils import require_torch class lowerCamelCase_ ( unittest.TestCase ): _lowercase : Dict = JukeboxTokenizer _lowercase : Any = { '''artist''': '''Zac Brown Band''', '''genres...
17
import copy from typing import Any, Dict, List, Optional, Union import numpy as np from ...audio_utils import mel_filter_bank, spectrogram, window_function from ...feature_extraction_sequence_utils import SequenceFeatureExtractor from ...feature_extraction_utils import BatchFeature from ...utils import TensorTy...
114
0
import operator def SCREAMING_SNAKE_CASE_ ( snake_case__ , snake_case__ = False , snake_case__ = None ) -> Optional[int]: lowerCAmelCase = operator.lt if reverse else operator.gt lowerCAmelCase = solution or [] if not arr: re...
312
import doctest from collections import deque import numpy as np class __A : """simple docstring""" def __init__( self): """simple docstring""" _lowerCamelCase : Any = [2, 1, 2, -1] _lowerCamelCase : Optional[i...
114
0
"""simple docstring""" from ...utils import is_note_seq_available, is_transformers_available, is_torch_available from ...utils import OptionalDependencyNotAvailable try: if not (is_transformers_available() and is_torch_available()): raise OptionalDependencyNotAvailable() except OptionalDependencyNotAva...
156
from __future__ import annotations def __UpperCAmelCase( lowercase_ , lowercase_ = None , lowercase_ = None , lowercase_ = False , ): _lowerCamelCase : Tuple = cipher_alphabet or [chr(lowercase_ ) for i in range(97 , 1_23 )] # If the argument is No...
114
0
"""simple docstring""" from __future__ import annotations import copy import inspect import json import math import os import tempfile import unittest from importlib import import_module import numpy as np from transformers import ViTMAEConfig from transformers.file_utils import cached_property, is_tf_available,...
213
from ...configuration_utils import PretrainedConfig from ...utils import logging _lowerCamelCase = logging.get_logger(__name__) _lowerCamelCase = { 'sayakpaul/vit-msn-base': 'https://huggingface.co/sayakpaul/vit-msn-base/resolve/main/config.json', # See all ViT MSN models at...
114
0
from transformers import HfArgumentParser, TensorFlowBenchmark, TensorFlowBenchmarkArguments def lowercase_ (): snake_case__ : int = HfArgumentParser(lowercase_ ) snake_case__ : int = parser.parse_args_into_dataclasses()[0] snake_case__ : Tu...
478
import shutil import tempfile import unittest import numpy as np import pytest from transformers.testing_utils import require_vision from transformers.utils import is_vision_available if is_vision_available(): from PIL import Image from transformers import ( AutoProcessor, ...
114
0
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 from .tokenization_gpta import GPTaTokenizer if TY...
542
import inspect from typing import List, Optional, Tuple, Union import torch from ...models import UNetaDModel, VQModel from ...schedulers import DDIMScheduler from ...utils import randn_tensor from ..pipeline_utils import DiffusionPipeline, ImagePipelineOutput class __A ( lowerCamelCase__ )...
114
0
from __future__ import annotations def __SCREAMING_SNAKE_CASE ( lowerCAmelCase: int , lowerCAmelCase: Optional[Any] ) -> Any: if partitions <= 0: raise ValueError("partitions must be a positive number!" ) if partitions > number_of_bytes: raise ValueError("partitions can...
300
import copy import random from transformers import CLIPTokenizer class __A ( lowerCamelCase__ ): """simple docstring""" def __init__( self , *a__ , **a__): """simple docstring""" super().__init__(*a__ , **a__) ...
114
0
import inspect import os import unittest import torch import accelerate from accelerate import debug_launcher from accelerate.test_utils import ( execute_subprocess_async, require_cpu, require_huggingface_suite, require_multi_gpu, require_single_gpu, ) from accelerate.utils import patch_env...
351
import unittest import numpy as np import requests 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...
114
0
def __UpperCamelCase ( lowercase__ : List[str] ) -> Union[str, Any]: '''simple docstring''' lowerCAmelCase_ : List[Any] = 1 for i in range(1 , num + 1 ): fact *= i return fact def __UpperCamelCase ( lowercase__ ...
600
import argparse import torch from transformers import GPTaLMHeadModel, RobertaForMaskedLM if __name__ == "__main__": _lowerCamelCase = argparse.ArgumentParser( description=( 'Extraction some layers of the full RobertaForMaskedLM or GPT2LMHeadModel for Transfer Le...
114
0
from typing import TYPE_CHECKING from ...utils import ( OptionalDependencyNotAvailable, _LazyModule, is_flax_available, is_sentencepiece_available, is_tf_available, is_tokenizers_available, is_torch_available, ) lowerCamelCase ={"configuration_xglm": ["XGLM_PRETRAINED_CONFIG_ARCHIVE_MAP...
285
from typing import List, Optional, Tuple, Union import PIL import torch from torchvision import transforms from diffusers.pipeline_utils import DiffusionPipeline, ImagePipelineOutput from diffusers.schedulers import DDIMScheduler from diffusers.utils import randn_tensor _lowerCamelCase = transfo...
114
0
"""simple docstring""" from collections import OrderedDict from typing import Mapping from ...configuration_utils import PretrainedConfig from ...onnx import OnnxConfig from ...utils import logging SCREAMING_SNAKE_CASE__:Any = logging.get_logger(__name__) SCREAMING_SNAKE_CASE__:Optional[Any] = ...
528
from typing import TYPE_CHECKING from ...utils import OptionalDependencyNotAvailable, _LazyModule, is_torch_available _lowerCamelCase = { 'configuration_clipseg': [ 'CLIPSEG_PRETRAINED_CONFIG_ARCHIVE_MAP', 'CLIPSegConfig', 'CLIPSegTextConfig', 'CLIPSegVisionCon...
114
0
import importlib import json import os import sys import tempfile import unittest from pathlib import Path import transformers import transformers.models.auto from transformers.models.auto.configuration_auto import CONFIG_MAPPING, AutoConfig from transformers.models.bert.configuration_bert import BertConfig from tra...
17
import json import os import unittest from transformers import OpenAIGPTTokenizer, OpenAIGPTTokenizerFast from transformers.models.openai.tokenization_openai import VOCAB_FILES_NAMES from transformers.testing_utils import require_ftfy, require_spacy, require_tokenizers from ...test_tokenization_common import To...
114
0
from __future__ import annotations from collections import namedtuple def SCREAMING_SNAKE_CASE_ ( snake_case__ , snake_case__ , snake_case__ ) -> Any: lowerCAmelCase = namedtuple('''result''' , '''name value''' ) if (voltage, current, power).count(0 ) !...
312
def __UpperCAmelCase( lowercase_ , lowercase_ ): # "extended trapezoidal rule" # int(f) = dx/2 * (f1 + 2f2 + ... + fn) _lowerCamelCase : int = (boundary[1] - boundary[0]) / steps _lowerCamelCase : Any = boundary[0] _lowerCamelCase : Tuple ...
114
0
"""simple docstring""" from __future__ import annotations from collections import Counter from random import random class __lowerCamelCase : def __init__(self ): '''simple docstring''' _lowerCAmelCase = {} def A__ (self , lowerCa...
156
import json import os import subprocess import unittest from ast import literal_eval import pytest from parameterized import parameterized_class from . import is_sagemaker_available if is_sagemaker_available(): from sagemaker import Session, TrainingJobAnalytics from sagemaker.huggingface import...
114
0
"""simple docstring""" from ...configuration_utils import PretrainedConfig from ...utils import logging _a : Optional[Any] = logging.get_logger(__name__) _a : str = { 'edbeeching/decision-transformer-gym-hopper-medium': ( 'https://huggingface.co/edbeeching/decision-trans...
213
import argparse import requests import torch from PIL import Image from transformers import CLIPProcessor, GroupViTConfig, GroupViTModel def __UpperCAmelCase( lowercase_ ): # vision encoder if "img_encoder.pos_embed" in name: _lowerCamelCase : Tuple = name.replace(...
114
0
from math import sqrt def lowercase_ (A : Union[str, Any] = 1_0_0_0_0_0_0 ): snake_case__ : int = 0 snake_case__ : int = 0 snake_case__ : int while num_cuboids <= limit: max_cuboid_size += 1 for su...
478
import json import os from pathlib import Path from shutil import copyfile from typing import Any, Dict, List, Optional, Tuple, Union import sentencepiece from ...tokenization_utils import PreTrainedTokenizer from ...utils import logging _lowerCamelCase = logging.get_logger(__name__) _lowerCame...
114
0
import itertools import random import unittest import numpy as np from transformers import WAV_2_VEC_2_PRETRAINED_MODEL_ARCHIVE_LIST, WavaVecaConfig, WavaVecaFeatureExtractor from transformers.testing_utils import require_torch, slow from ...test_sequence_feature_extraction_common import SequenceFeature...
542
import os def __UpperCAmelCase( ): with open(os.path.dirname(lowercase_ ) + '''/p022_names.txt''' ) as file: _lowerCamelCase : Optional[int] = str(file.readlines()[0] ) _lowerCamelCase : List[Any] = names.replace('''"''' , '''''' ).split(...
114
0
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, prepare_image_inputs if is_to...
300
from __future__ import annotations import unittest from transformers import BlenderbotSmallConfig, BlenderbotSmallTokenizer, is_tf_available from transformers.testing_utils import require_tf, require_tokenizers, slow from transformers.utils import cached_property from ...test_configuration_common import Config...
114
0
import torch from diffusers import StableDiffusionPipeline UpperCAmelCase__ = '''path-to-your-trained-model''' UpperCAmelCase__ = StableDiffusionPipeline.from_pretrained(model_id, torch_dtype=torch.floataa).to('''cuda''') UpperCAmelCase__ = '''A photo of sks dog in a bu...
351
import mpmath # for roots of unity import numpy as np class __A : """simple docstring""" def __init__( self , a__=None , a__=None): """simple docstring""" _lowerCamelCase : List[str] = list(poly_a or [0])[:] ...
114
0
import json import os from typing import Dict, List, Optional, Tuple from ...tokenization_utils import PreTrainedTokenizer from ...utils import logging __UpperCAmelCase = logging.get_logger(__name__) __UpperCAmelCase = { 'vocab_file': 'vocab.json', 'tokenizer_config_file': 'tokenizer_...
600
import numpy as np import torch from torch.nn import CrossEntropyLoss from transformers import AutoModelForCausalLM, AutoTokenizer import datasets from datasets import logging _lowerCamelCase = '\\n\n' _lowerCamelCase = '\nPerplexity (PPL) is one of the most common metrics for eval...
114
0
lowerCamelCase ="\n# Transformers 설치 방법\n! pip install transformers datasets\n# 마지막 릴리스 대신 소스에서 설치하려면, 위 명령을 주석으로 바꾸고 아래 명령을 해제하세요.\n# ! pip install git+https://github.com/huggingface/transformers.git\n" lowerCamelCase =[{"type": "code", "content": INSTALL_CONTENT}] lowerCamelCase ={ "{processor_class}": "Fake...
285
from __future__ import annotations from scipy.special import comb # type: ignore class __A : """simple docstring""" def __init__( self , a__): """simple docstring""" _lowerCamelCase : str = list_of_points # ...
114
0
"""simple docstring""" import warnings from typing import Any, Dict, List, Optional, Union import numpy as np from ...audio_utils import mel_filter_bank, optimal_fft_length, spectrogram, window_function from ...feature_extraction_sequence_utils import SequenceFeatureExtractor from ...feature_extraction_utils impor...
528
import warnings from ...utils import logging from .image_processing_deit import DeiTImageProcessor _lowerCamelCase = logging.get_logger(__name__) class __A ( lowerCamelCase__ ): """simple docstring""" def __init__( self , *a__ , **a__): ...
114
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 LearnedClassifierFreeSamplin...
17
import copy from typing import Any, Dict, List, Optional, Union import numpy as np from ...audio_utils import mel_filter_bank, spectrogram, window_function from ...feature_extraction_sequence_utils import SequenceFeatureExtractor from ...feature_extraction_utils import BatchFeature from ...utils import TensorTy...
114
0
import json import os import shutil import tempfile import unittest from transformers import BatchEncoding, CanineTokenizer from transformers.testing_utils import require_tokenizers, require_torch from transformers.tokenization_utils import AddedToken from transformers.utils import cached_property from ......
312
import doctest from collections import deque import numpy as np class __A : """simple docstring""" def __init__( self): """simple docstring""" _lowerCamelCase : Any = [2, 1, 2, -1] _lowerCamelCase : Optional[i...
114
0
"""simple docstring""" import warnings from ...utils import logging from .image_processing_imagegpt import ImageGPTImageProcessor SCREAMING_SNAKE_CASE : Tuple = logging.get_logger(__name__) class __lowerCamelCase ( lowerCamelCase__ ): def __init__(self , *...
156
from __future__ import annotations def __UpperCAmelCase( lowercase_ , lowercase_ = None , lowercase_ = None , lowercase_ = False , ): _lowerCamelCase : Tuple = cipher_alphabet or [chr(lowercase_ ) for i in range(97 , 1_23 )] # If the argument is No...
114
0
"""simple docstring""" # Copyright 2021 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 # # U...
213
from ...configuration_utils import PretrainedConfig from ...utils import logging _lowerCamelCase = logging.get_logger(__name__) _lowerCamelCase = { 'sayakpaul/vit-msn-base': 'https://huggingface.co/sayakpaul/vit-msn-base/resolve/main/config.json', # See all ViT MSN models at...
114
0
import logging import os import random import sys from dataclasses import dataclass, field from typing import Optional import datasets import numpy as np import pandas as pd from datasets import load_dataset import transformers from transformers import ( AutoConfig, BartForSequenceClassification, Data...
478
import shutil import tempfile import unittest import numpy as np import pytest from transformers.testing_utils import require_vision from transformers.utils import is_vision_available if is_vision_available(): from PIL import Image from transformers import ( AutoProcessor, ...
114
0
import argparse import requests import torch from PIL import Image from transformers import ViTMAEConfig, ViTMAEForPreTraining, ViTMAEImageProcessor def snake_case__ ( lowerCamelCase_ ): if "cls_token" in name: A : str = name.replace('''cls...
542
import inspect from typing import List, Optional, Tuple, Union import torch from ...models import UNetaDModel, VQModel from ...schedulers import DDIMScheduler from ...utils import randn_tensor from ..pipeline_utils import DiffusionPipeline, ImagePipelineOutput class __A ( lowerCamelCase__ )...
114
0
import shutil import tempfile import unittest import numpy as np import pytest from transformers.testing_utils import require_vision from transformers.utils import is_vision_available if is_vision_available(): from PIL import Image from transformers import ( AutoProcessor, BertTokeniz...
300
import copy import random from transformers import CLIPTokenizer class __A ( lowerCamelCase__ ): """simple docstring""" def __init__( self , *a__ , **a__): """simple docstring""" super().__init__(*a__ , **a__) ...
114
0
import inspect import unittest from transformers import DPTConfig from transformers.file_utils import is_torch_available, is_vision_available from transformers.models.auto import get_values from transformers.testing_utils import require_torch, require_vision, slow, torch_device from ...test_configuration_commo...
351
import unittest import numpy as np import requests 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...
114
0
import doctest from collections import deque import numpy as np class __a : def __init__( self : Any ): lowerCAmelCase_ : Any = [2, 1, 2, -1] lowerCAmelCase_ : Optional[int] = [1, 2, 3, 4] def A ( self : Tupl...
600
import argparse import torch from transformers import GPTaLMHeadModel, RobertaForMaskedLM if __name__ == "__main__": _lowerCamelCase = argparse.ArgumentParser( description=( 'Extraction some layers of the full RobertaForMaskedLM or GPT2LMHeadModel for Transfer Le...
114
0
import os # Precomputes a list of the 100 first triangular numbers lowerCamelCase =[int(0.5 * n * (n + 1)) for n in range(1, 1_0_1)] def SCREAMING_SNAKE_CASE_ ( ): UpperCamelCase__ : List[str] = os.path.dirname(os.path.realpath(lowercase_ ) ) UpperCamelCase__ : Option...
285
from typing import List, Optional, Tuple, Union import PIL import torch from torchvision import transforms from diffusers.pipeline_utils import DiffusionPipeline, ImagePipelineOutput from diffusers.schedulers import DDIMScheduler from diffusers.utils import randn_tensor _lowerCamelCase = transfo...
114
0
"""simple docstring""" from typing import TYPE_CHECKING from ...utils import OptionalDependencyNotAvailable, _LazyModule, is_tf_available, is_torch_available SCREAMING_SNAKE_CASE__:Dict = { """configuration_rag""": ["""RagConfig"""], """retrieval_rag""": ["""RagRetriever"""], """tokenization...
528
from typing import TYPE_CHECKING from ...utils import OptionalDependencyNotAvailable, _LazyModule, is_torch_available _lowerCamelCase = { 'configuration_clipseg': [ 'CLIPSEG_PRETRAINED_CONFIG_ARCHIVE_MAP', 'CLIPSegConfig', 'CLIPSegTextConfig', 'CLIPSegVisionCon...
114
0
from __future__ import annotations def __SCREAMING_SNAKE_CASE ( a__ : Union[str, Any] ,a__ : Optional[Any] ,a__ : List[Any] ,) -> int: if (electron_conc, hole_conc, intrinsic_conc).count(0 ) != 1: raise ValueError("""You cannot supply more or less than 2 values""" ...
17
import json import os import unittest from transformers import OpenAIGPTTokenizer, OpenAIGPTTokenizerFast from transformers.models.openai.tokenization_openai import VOCAB_FILES_NAMES from transformers.testing_utils import require_ftfy, require_spacy, require_tokenizers from ...test_tokenization_common import To...
114
0
import numpy as np import torch from torch.nn import CrossEntropyLoss from transformers import AutoModelForCausalLM, AutoTokenizer import datasets from datasets import logging lowercase__ : Tuple = '''\\n\n''' lowercase__ : Any = '''\nPerplexity (PPL) i...
312
def __UpperCAmelCase( lowercase_ , lowercase_ ): # "extended trapezoidal rule" # int(f) = dx/2 * (f1 + 2f2 + ... + fn) _lowerCamelCase : int = (boundary[1] - boundary[0]) / steps _lowerCamelCase : Any = boundary[0] _lowerCamelCase : Tuple ...
114
0
"""simple docstring""" # This script creates a super tiny model that is useful inside tests, when we just want to test that # the machinery works, without needing to the check the quality of the outcomes. # # This version creates a tiny model through reduction of a normal pre-trained model, but keeping the # f...
156
import json import os import subprocess import unittest from ast import literal_eval import pytest from parameterized import parameterized_class from . import is_sagemaker_available if is_sagemaker_available(): from sagemaker import Session, TrainingJobAnalytics from sagemaker.huggingface import...
114
0
"""simple docstring""" 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 logging _a : Dict = logging.get_logger(__name__) _...
213
import argparse import requests import torch from PIL import Image from transformers import CLIPProcessor, GroupViTConfig, GroupViTModel def __UpperCAmelCase( lowercase_ ): # vision encoder if "img_encoder.pos_embed" in name: _lowerCamelCase : Tuple = name.replace(...
114
0
def lowercase_ (A : Optional[Any] ): snake_case__ : str = [0] * len(lowercase_ ) snake_case__ : Optional[int] = [] snake_case__ : Tuple = [1] * len(lowercase_ ) for values in graph.values(): for i in...
478
import json import os from pathlib import Path from shutil import copyfile from typing import Any, Dict, List, Optional, Tuple, Union import sentencepiece from ...tokenization_utils import PreTrainedTokenizer from ...utils import logging _lowerCamelCase = logging.get_logger(__name__) _lowerCame...
114
0
import copy from typing import Dict, List, Optional from ...configuration_utils import PretrainedConfig from ...utils import logging from ..auto import CONFIG_MAPPING lowercase : Any = { "facebook/mask2former-swin-small-coco-instance": ( "https://huggingface.co/facebook/mask2form...
542
import os def __UpperCAmelCase( ): with open(os.path.dirname(lowercase_ ) + '''/p022_names.txt''' ) as file: _lowerCamelCase : Optional[int] = str(file.readlines()[0] ) _lowerCamelCase : List[Any] = names.replace('''"''' , '''''' ).split(...
114
0
from collections import OrderedDict from typing import Mapping from ...configuration_utils import PretrainedConfig from ...onnx import OnnxConfig from ...utils import logging SCREAMING_SNAKE_CASE_ = logging.get_logger(__name__) SCREAMING_SNAKE_CASE_ = { 'kssteven/ibert-roberta-base': 'ht...
300
from __future__ import annotations import unittest from transformers import BlenderbotSmallConfig, BlenderbotSmallTokenizer, is_tf_available from transformers.testing_utils import require_tf, require_tokenizers, slow from transformers.utils import cached_property from ...test_configuration_common import Config...
114
0
import copy import os from typing import Union from ...configuration_utils import PretrainedConfig from ...utils import logging UpperCAmelCase__ = logging.get_logger(__name__) UpperCAmelCase__ = { '''google/pix2struct-textcaps-base''': ( '''https://huggingface.co/google/...
351
import mpmath # for roots of unity import numpy as np class __A : """simple docstring""" def __init__( self , a__=None , a__=None): """simple docstring""" _lowerCamelCase : List[str] = list(poly_a or [0])[:] ...
114
0
import fire from torch.utils.data import DataLoader from tqdm import tqdm from transformers import AutoTokenizer from utils import SeqaSeqDataset, pickle_save def __UpperCamelCase ( lowercase__ : Tuple , lowercase__ : Any , lowercase__ : Tuple=1024 , ...
600
import numpy as np import torch from torch.nn import CrossEntropyLoss from transformers import AutoModelForCausalLM, AutoTokenizer import datasets from datasets import logging _lowerCamelCase = '\\n\n' _lowerCamelCase = '\nPerplexity (PPL) is one of the most common metrics for eval...
114
0
from __future__ import annotations lowerCamelCase =tuple[int, int, int] lowerCamelCase =tuple[str, str, str] # used alphabet -------------------------- # from string.ascii_uppercase lowerCamelCase ="ABCDEFGHIJKLMNOPQRSTUVWXYZ" # -------------------------- default selection -------------------------- # rotors --...
285
from __future__ import annotations from scipy.special import comb # type: ignore class __A : """simple docstring""" def __init__( self , a__): """simple docstring""" _lowerCamelCase : str = list_of_points # ...
114
0
"""simple docstring""" import argparse import json import requests import timm import torch from huggingface_hub import hf_hub_download from PIL import Image from transformers import AutoImageProcessor, SwinConfig, SwinForImageClassification def _lowerCamelCase( a ): __a = SwinConfig() ...
528
import warnings from ...utils import logging from .image_processing_deit import DeiTImageProcessor _lowerCamelCase = logging.get_logger(__name__) class __A ( lowerCamelCase__ ): """simple docstring""" def __init__( self , *a__ , **a__): ...
114
0
import copy from typing import Any, Dict, List, Optional, Union import numpy as np import torch from ...audio_utils import mel_filter_bank, spectrogram, window_function from ...feature_extraction_sequence_utils import SequenceFeatureExtractor from ...feature_extraction_utils import BatchFeature from ...utils import...
17
import copy from typing import Any, Dict, List, Optional, Union import numpy as np from ...audio_utils import mel_filter_bank, spectrogram, window_function from ...feature_extraction_sequence_utils import SequenceFeatureExtractor from ...feature_extraction_utils import BatchFeature from ...utils import TensorTy...
114
0
def SCREAMING_SNAKE_CASE_ ( snake_case__ , snake_case__ ) -> Dict: lowerCAmelCase = int(lowercase_ ) # Initialize Result lowerCAmelCase = [] # Traverse through all denomination for denomination in reversed(lowercase_ ): ...
312
import doctest from collections import deque import numpy as np class __A : """simple docstring""" def __init__( self): """simple docstring""" _lowerCamelCase : Any = [2, 1, 2, -1] _lowerCamelCase : Optional[i...
114
0
"""simple docstring""" import json import os from functools import lru_cache from typing import Dict, List, Optional, Tuple, Union import regex as re from ...tokenization_utils import AddedToken, PreTrainedTokenizer from ...tokenization_utils_base import BatchEncoding, EncodedInput from ...utils import Paddi...
156
from __future__ import annotations def __UpperCAmelCase( lowercase_ , lowercase_ = None , lowercase_ = None , lowercase_ = False , ): _lowerCamelCase : Tuple = cipher_alphabet or [chr(lowercase_ ) for i in range(97 , 1_23 )] # If the argument is No...
114
0
"""simple docstring""" from __future__ import annotations import random # Maximum size of the population. Bigger could be faster but is more memory expensive. _a : List[str] = 200 # Number of elements selected in every generation of evolution. The selection takes # place from best to worst of that...
213
from ...configuration_utils import PretrainedConfig from ...utils import logging _lowerCamelCase = logging.get_logger(__name__) _lowerCamelCase = { 'sayakpaul/vit-msn-base': 'https://huggingface.co/sayakpaul/vit-msn-base/resolve/main/config.json', # See all ViT MSN models at...
114
0
import unittest from transformers import TrOCRConfig from transformers.testing_utils import is_torch_available, require_torch, torch_device from ...generation.test_utils import GenerationTesterMixin from ...test_configuration_common import ConfigTester from ...test_modeling_common import ModelTesterMixin, ids_ten...
478
import shutil import tempfile import unittest import numpy as np import pytest from transformers.testing_utils import require_vision from transformers.utils import is_vision_available if is_vision_available(): from PIL import Image from transformers import ( AutoProcessor, ...
114
0
def snake_case__ ( lowerCamelCase_ , lowerCamelCase_ ): A : List[Any] = 1 # To kept the Calculated Value # Since C(n, k) = C(n, n-k) if k > (n - k): A : Any = n - k # Calculate C(n,k) for i in range(lo...
542
import inspect from typing import List, Optional, Tuple, Union import torch from ...models import UNetaDModel, VQModel from ...schedulers import DDIMScheduler from ...utils import randn_tensor from ..pipeline_utils import DiffusionPipeline, ImagePipelineOutput class __A ( lowerCamelCase__ )...
114
0
import os def __SCREAMING_SNAKE_CASE ( ) -> Any: _UpperCAmelCase : Union[str, Any] = os.path.dirname(os.path.realpath(lowercase_ ) ) _UpperCAmelCase : Tuple = os.path.join(lowercase_ , "triangle.txt" ) with open(lowercase_ ) as f: _UpperCA...
300
import copy import random from transformers import CLIPTokenizer class __A ( lowerCamelCase__ ): """simple docstring""" def __init__( self , *a__ , **a__): """simple docstring""" super().__init__(*a__ , **a__) ...
114
0
import inspect import jax import jax.lax as lax import jax.numpy as jnp from ..utils import add_start_docstrings from ..utils.logging import get_logger UpperCAmelCase__ = get_logger(__name__) UpperCAmelCase__ = r'''\n Args:\n input_ids (`jnp.ndarray` of shape `(batch_siz...
351
import unittest import numpy as np import requests 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...
114
0
from __future__ import annotations import typing from collections.abc import Iterable import numpy as np __UpperCAmelCase = typing.Union[Iterable[float], Iterable[int], np.ndarray] # noqa: UP007 __UpperCAmelCase = typing.Union[np.floataa, int, float] # noqa: UP007 def __UpperCamelCase ...
600
import argparse import torch from transformers import GPTaLMHeadModel, RobertaForMaskedLM if __name__ == "__main__": _lowerCamelCase = argparse.ArgumentParser( description=( 'Extraction some layers of the full RobertaForMaskedLM or GPT2LMHeadModel for Transfer Le...
114
0
import os import unittest from transformers import BertTokenizerFast from transformers.models.bert.tokenization_bert import ( VOCAB_FILES_NAMES, BasicTokenizer, BertTokenizer, WordpieceTokenizer, _is_control, _is_punctuation, _is_whitespace, ) from transformers.testing_utils import require...
285
from typing import List, Optional, Tuple, Union import PIL import torch from torchvision import transforms from diffusers.pipeline_utils import DiffusionPipeline, ImagePipelineOutput from diffusers.schedulers import DDIMScheduler from diffusers.utils import randn_tensor _lowerCamelCase = transfo...
114
0
"""simple docstring""" import inspect import unittest from transformers import RegNetConfig, is_flax_available from transformers.testing_utils import require_flax, slow from transformers.utils import cached_property, is_vision_available from ...test_configuration_common import ConfigTester from ...test_modeling_fl...
528
from typing import TYPE_CHECKING from ...utils import OptionalDependencyNotAvailable, _LazyModule, is_torch_available _lowerCamelCase = { 'configuration_clipseg': [ 'CLIPSEG_PRETRAINED_CONFIG_ARCHIVE_MAP', 'CLIPSegConfig', 'CLIPSegTextConfig', 'CLIPSegVisionCon...
114
0
import warnings from contextlib import contextmanager from ....processing_utils import ProcessorMixin class lowerCamelCase_ ( lowerCamelCase__ ): _lowercase : int = '''MCTCTFeatureExtractor''' _lowercase : Any = '''AutoTokenizer''' def __init__( self : ...
17
import json import os import unittest from transformers import OpenAIGPTTokenizer, OpenAIGPTTokenizerFast from transformers.models.openai.tokenization_openai import VOCAB_FILES_NAMES from transformers.testing_utils import require_ftfy, require_spacy, require_tokenizers from ...test_tokenization_common import To...
114
0
import json import os import subprocess import unittest from ast import literal_eval import pytest from parameterized import parameterized_class from . import is_sagemaker_available if is_sagemaker_available(): from sagemaker import Session, TrainingJobAnalytics from sagemaker.huggingface import Hug...
312
def __UpperCAmelCase( lowercase_ , lowercase_ ): # "extended trapezoidal rule" # int(f) = dx/2 * (f1 + 2f2 + ... + fn) _lowerCamelCase : int = (boundary[1] - boundary[0]) / steps _lowerCamelCase : Any = boundary[0] _lowerCamelCase : Tuple ...
114
0
"""simple docstring""" from __future__ import annotations import inspect import unittest import numpy as np from transformers import DeiTConfig from transformers.testing_utils import require_tf, require_vision, slow from transformers.utils import cached_property, is_tf_available, is_vision_available from ....
156
import json import os import subprocess import unittest from ast import literal_eval import pytest from parameterized import parameterized_class from . import is_sagemaker_available if is_sagemaker_available(): from sagemaker import Session, TrainingJobAnalytics from sagemaker.huggingface import...
114
0
"""simple docstring""" from typing import List, Union import numpy as np from ..tokenization_utils import TruncationStrategy from ..utils import add_end_docstrings, logging from .base import PIPELINE_INIT_ARGS, ArgumentHandler, ChunkPipeline _a : Any = logging.get_logger(__name__) class __A ...
213
import argparse import requests import torch from PIL import Image from transformers import CLIPProcessor, GroupViTConfig, GroupViTModel def __UpperCAmelCase( lowercase_ ): # vision encoder if "img_encoder.pos_embed" in name: _lowerCamelCase : Tuple = name.replace(...
114
0
import copy from typing import Any, Dict, List, Optional, Union import numpy as np from ...audio_utils import mel_filter_bank, spectrogram, window_function from ...feature_extraction_sequence_utils import SequenceFeatureExtractor from ...feature_extraction_utils import BatchFeature from ...utils import TensorType...
478
import json import os from pathlib import Path from shutil import copyfile from typing import Any, Dict, List, Optional, Tuple, Union import sentencepiece from ...tokenization_utils import PreTrainedTokenizer from ...utils import logging _lowerCamelCase = logging.get_logger(__name__) _lowerCame...
114
0
from __future__ import annotations def snake_case__ ( lowerCamelCase_ , lowerCamelCase_ = None , lowerCamelCase_ = None ): if start is None: A : Union[str, Any] = 0 if end is None: A : Union[str, Any]...
542
import os def __UpperCAmelCase( ): with open(os.path.dirname(lowercase_ ) + '''/p022_names.txt''' ) as file: _lowerCamelCase : Optional[int] = str(file.readlines()[0] ) _lowerCamelCase : List[Any] = names.replace('''"''' , '''''' ).split(...
114
0
import fire from transformers import AutoConfig, AutoModelForSeqaSeqLM, AutoTokenizer def __SCREAMING_SNAKE_CASE ( lowerCAmelCase: Tuple , lowerCAmelCase: Union[str, Any] , **lowerCAmelCase: Any ) -> Optional[int]: _UpperCAmelCase : Optional[Any] = AutoConfig.from_pretraine...
300
from __future__ import annotations import unittest from transformers import BlenderbotSmallConfig, BlenderbotSmallTokenizer, is_tf_available from transformers.testing_utils import require_tf, require_tokenizers, slow from transformers.utils import cached_property from ...test_configuration_common import Config...
114
0
import json import os from pathlib import Path from shutil import copyfile from typing import Any, Dict, List, Optional, Tuple, Union import sentencepiece from ...tokenization_utils import PreTrainedTokenizer from ...utils import logging UpperCAmelCase__ = logging.get_logger(__name__) UpperCAme...
351
import mpmath # for roots of unity import numpy as np class __A : """simple docstring""" def __init__( self , a__=None , a__=None): """simple docstring""" _lowerCamelCase : List[str] = list(poly_a or [0])[:] ...
114
0
__UpperCAmelCase = [ (10_00, 'M'), (9_00, 'CM'), (5_00, 'D'), (4_00, 'CD'), (1_00, 'C'), (90, 'XC'), (50, 'L'), (40, 'XL'), (10, 'X'), (9, 'IX'), (5, 'V'), (4, 'IV'), (1, 'I'), ] def __UpperCamelCase ( lowercase__ : List[Any] )...
600
import numpy as np import torch from torch.nn import CrossEntropyLoss from transformers import AutoModelForCausalLM, AutoTokenizer import datasets from datasets import logging _lowerCamelCase = '\\n\n' _lowerCamelCase = '\nPerplexity (PPL) is one of the most common metrics for eval...
114
0
import math from numpy import inf from scipy.integrate import quad def SCREAMING_SNAKE_CASE_ ( UpperCamelCase__ ): if num <= 0: raise ValueError('''math domain error''' ) return quad(lowercase_ , 0 , lowercase_ , args=(lowercase_) )[0] def SCREAMING_SNAKE_CASE_ ...
285
from __future__ import annotations from scipy.special import comb # type: ignore class __A : """simple docstring""" def __init__( self , a__): """simple docstring""" _lowerCamelCase : str = list_of_points # ...
114
0
"""simple docstring""" import json import os import shutil import tempfile import unittest import numpy as np import pytest from transformers import MgpstrTokenizer from transformers.models.mgp_str.tokenization_mgp_str import VOCAB_FILES_NAMES from transformers.testing_utils import require_torch, require_vision fr...
528
import warnings from ...utils import logging from .image_processing_deit import DeiTImageProcessor _lowerCamelCase = logging.get_logger(__name__) class __A ( lowerCamelCase__ ): """simple docstring""" def __init__( self , *a__ , **a__): ...
114
0
def __SCREAMING_SNAKE_CASE ( a__ : Tuple ) -> List[str]: if not isinstance(lowercase_ ,lowercase_ ): raise ValueError("""Input series is not valid, valid series - [2, 4, 6]""" ) if len(lowercase_ ) == 0: raise ValueError("""Input list must be a non empty list""...
17
import copy from typing import Any, Dict, List, Optional, Union import numpy as np from ...audio_utils import mel_filter_bank, spectrogram, window_function from ...feature_extraction_sequence_utils import SequenceFeatureExtractor from ...feature_extraction_utils import BatchFeature from ...utils import TensorTy...
114
0
from typing import List from .keymap import KEYMAP, get_character def SCREAMING_SNAKE_CASE_ ( snake_case__ ) -> List[Any]: def decorator(snake_case__ ): lowerCAmelCase = getattr(lowercase_ , '''handle_key''' , [] ) handle += [key] ...
312
import doctest from collections import deque import numpy as np class __A : """simple docstring""" def __init__( self): """simple docstring""" _lowerCamelCase : Any = [2, 1, 2, -1] _lowerCamelCase : Optional[i...
114
0
"""simple docstring""" import math from collections import defaultdict from typing import List, Optional, Tuple, Union import numpy as np import torch from ..configuration_utils import ConfigMixin, register_to_config from .scheduling_utils import KarrasDiffusionSchedulers, SchedulerMixin, SchedulerOutput ...
156
from __future__ import annotations def __UpperCAmelCase( lowercase_ , lowercase_ = None , lowercase_ = None , lowercase_ = False , ): _lowerCamelCase : Tuple = cipher_alphabet or [chr(lowercase_ ) for i in range(97 , 1_23 )] # If the argument is No...
114
0
"""simple docstring""" import warnings from typing import List, Optional, Union from ...processing_utils import ProcessorMixin from ...tokenization_utils_base import BatchEncoding, PaddingStrategy, PreTokenizedInput, TextInput, TruncationStrategy from ...utils import TensorType class __A ( lowerCamelCase_...
213
from ...configuration_utils import PretrainedConfig from ...utils import logging _lowerCamelCase = logging.get_logger(__name__) _lowerCamelCase = { 'sayakpaul/vit-msn-base': 'https://huggingface.co/sayakpaul/vit-msn-base/resolve/main/config.json', # See all ViT MSN models at...
114
0
from typing import TYPE_CHECKING from ...utils import OptionalDependencyNotAvailable, _LazyModule, is_torch_available a_ :Tuple = { "configuration_nllb_moe": [ "NLLB_MOE_PRETRAINED_CONFIG_ARCHIVE_MAP", "NllbMoeConfig", ] } try: if not is_torch_available(): raise OptionalDependenc...
478
import shutil import tempfile import unittest import numpy as np import pytest from transformers.testing_utils import require_vision from transformers.utils import is_vision_available if is_vision_available(): from PIL import Image from transformers import ( AutoProcessor, ...
114
0
# # This a `torch.distributed` diagnostics script that checks that all GPUs in the cluster (one or # many nodes) can talk to each other via nccl and allocate gpu memory. # # To run first adjust the number of processes and nodes: # # python -m torch.distributed.run --nproc_per_node 2 --nnodes 1 torch-distribut...
542
import inspect from typing import List, Optional, Tuple, Union import torch from ...models import UNetaDModel, VQModel from ...schedulers import DDIMScheduler from ...utils import randn_tensor from ..pipeline_utils import DiffusionPipeline, ImagePipelineOutput class __A ( lowerCamelCase__ )...
114
0
import inspect import unittest from transformers import YolosConfig from transformers.testing_utils import require_torch, require_vision, slow, torch_device from transformers.utils import cached_property, is_torch_available, is_vision_available from ...test_configuration_common import ConfigTester from ...test_mode...
300
import copy import random from transformers import CLIPTokenizer class __A ( lowerCamelCase__ ): """simple docstring""" def __init__( self , *a__ , **a__): """simple docstring""" super().__init__(*a__ , **a__) ...
114
0
import os import unittest from transformers.models.phobert.tokenization_phobert import VOCAB_FILES_NAMES, PhobertTokenizer from ...test_tokenization_common import TokenizerTesterMixin class snake_case_ ( lowerCamelCase__ , unittest.TestCase ): """simple docstring""" ...
351
import unittest import numpy as np import requests 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...
114
0
import cva import numpy as np class __a : def __init__( self : List[str] , UpperCAmelCase : Optional[Any] , UpperCAmelCase : Any ): if k in (0.04, 0.06): lowerCAmelCase_ : Optional[Any] = k lo...
600
import argparse import torch from transformers import GPTaLMHeadModel, RobertaForMaskedLM if __name__ == "__main__": _lowerCamelCase = argparse.ArgumentParser( description=( 'Extraction some layers of the full RobertaForMaskedLM or GPT2LMHeadModel for Transfer Le...
114
0
import collections import json import math import os import re import time from fnmatch import fnmatch from typing import Dict import requests from slack_sdk import WebClient lowerCamelCase =WebClient(token=os.environ["CI_SLACK_BOT_TOKEN"]) def SCREAMING_SNAKE_CASE_ ( UpperCamelCase__ ): UpperC...
285
from typing import List, Optional, Tuple, Union import PIL import torch from torchvision import transforms from diffusers.pipeline_utils import DiffusionPipeline, ImagePipelineOutput from diffusers.schedulers import DDIMScheduler from diffusers.utils import randn_tensor _lowerCamelCase = transfo...
114
0
"""simple docstring""" from __future__ import annotations from math import gcd def _lowerCamelCase( a , a = 2 , a = 1 , a = 3 , ): # A value less than 2 can cause an infinite loop in the algorithm. if num < 2: raise ValueError("The input value cannot be less than ...
528
from typing import TYPE_CHECKING from ...utils import OptionalDependencyNotAvailable, _LazyModule, is_torch_available _lowerCamelCase = { 'configuration_clipseg': [ 'CLIPSEG_PRETRAINED_CONFIG_ARCHIVE_MAP', 'CLIPSegConfig', 'CLIPSegTextConfig', 'CLIPSegVisionCon...
114
0
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 ...modeling_outputs import ( BackboneOutput, BaseModelOutputWithNoAttention, BaseModelOutputWithPoo...
17
import json import os import unittest from transformers import OpenAIGPTTokenizer, OpenAIGPTTokenizerFast from transformers.models.openai.tokenization_openai import VOCAB_FILES_NAMES from transformers.testing_utils import require_ftfy, require_spacy, require_tokenizers from ...test_tokenization_common import To...
114
0
import warnings from ...utils import logging from .image_processing_poolformer import PoolFormerImageProcessor lowercase__ : List[Any] = logging.get_logger(__name__) class lowercase_ ( lowerCamelCase__ ): """simple docstring""" def __init__( se...
312
def __UpperCAmelCase( lowercase_ , lowercase_ ): # "extended trapezoidal rule" # int(f) = dx/2 * (f1 + 2f2 + ... + fn) _lowerCamelCase : int = (boundary[1] - boundary[0]) / steps _lowerCamelCase : Any = boundary[0] _lowerCamelCase : Tuple ...
114
0
"""simple docstring""" def __UpperCAmelCase ( snake_case_ : Any ) -> int: """simple docstring""" if edge <= 0 or not isinstance(lowercase_ , lowercase_ ): raise ValueError("""Length must be a positive.""" ) return 3 * ((25 + 10 * (5 ** (1 / 2))) ** (1 / 2))...
156
import json import os import subprocess import unittest from ast import literal_eval import pytest from parameterized import parameterized_class from . import is_sagemaker_available if is_sagemaker_available(): from sagemaker import Session, TrainingJobAnalytics from sagemaker.huggingface import...
114
0
"""simple docstring""" import re from typing import Callable, List, Optional, Union import tensorflow as tf try: from tensorflow.keras.optimizers.legacy import Adam except ImportError: from tensorflow.keras.optimizers import Adam class __A ( tf.keras.optimizers.schedules.LearningRateSchedule ...
213
import argparse import requests import torch from PIL import Image from transformers import CLIPProcessor, GroupViTConfig, GroupViTModel def __UpperCAmelCase( lowercase_ ): # vision encoder if "img_encoder.pos_embed" in name: _lowerCamelCase : Tuple = name.replace(...
114
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_bert import BertTokenizer a_ :int = logging.get_logger(__name__) a_ :Union[str, Any] = {"vocab_file": ...
478
import json import os from pathlib import Path from shutil import copyfile from typing import Any, Dict, List, Optional, Tuple, Union import sentencepiece from ...tokenization_utils import PreTrainedTokenizer from ...utils import logging _lowerCamelCase = logging.get_logger(__name__) _lowerCame...
114
0
from __future__ import annotations def snake_case__ ( lowerCamelCase_ , lowerCamelCase_ , lowerCamelCase_ , lowerCamelCase_ ): if (direction == 1 and array[indexa] > array[indexa]) or ( direction == 0 and array[indexa] < array[indexa] ): ...
542
import os def __UpperCAmelCase( ): with open(os.path.dirname(lowercase_ ) + '''/p022_names.txt''' ) as file: _lowerCamelCase : Optional[int] = str(file.readlines()[0] ) _lowerCamelCase : List[Any] = names.replace('''"''' , '''''' ).split(...
114
0
def __SCREAMING_SNAKE_CASE ( lowerCAmelCase: Any ) -> int: _UpperCAmelCase : str = len(lowercase_ ) for _ in range(lowercase_ ): for i in range(_ % 2 , arr_size - 1 , 2 ): if arr[i + 1] < arr[i]: _UpperCAmelCase : Dict ...
300
from __future__ import annotations import unittest from transformers import BlenderbotSmallConfig, BlenderbotSmallTokenizer, is_tf_available from transformers.testing_utils import require_tf, require_tokenizers, slow from transformers.utils import cached_property from ...test_configuration_common import Config...
114
0
import argparse import torch from transformers import GPTaLMHeadModel, RobertaForMaskedLM if __name__ == "__main__": UpperCAmelCase__ = argparse.ArgumentParser( description=( '''Extraction some layers of the full RobertaForMaskedLM or GPT2LMHeadModel for Transfer Learned''' ...
351
import mpmath # for roots of unity import numpy as np class __A : """simple docstring""" def __init__( self , a__=None , a__=None): """simple docstring""" _lowerCamelCase : List[str] = list(poly_a or [0])[:] ...
114
0
import logging from transformers import PretrainedConfig __UpperCAmelCase = logging.getLogger(__name__) __UpperCAmelCase = { 'bertabs-finetuned-cnndm': 'https://huggingface.co/remi/bertabs-finetuned-cnndm-extractive-abstractive-summarization/resolve/main/config.json', } class __a ( ...
600
import numpy as np import torch from torch.nn import CrossEntropyLoss from transformers import AutoModelForCausalLM, AutoTokenizer import datasets from datasets import logging _lowerCamelCase = '\\n\n' _lowerCamelCase = '\nPerplexity (PPL) is one of the most common metrics for eval...
114
0
import argparse import collections import torch from flax import traverse_util from tax import checkpoints from transformers import TaConfig, TaEncoderModel, TaForConditionalGeneration from transformers.utils import logging logging.set_verbosity_info() def SCREAMING_SNAKE_CASE_ ( UpperCamelCase__ , ...
285
from __future__ import annotations from scipy.special import comb # type: ignore class __A : """simple docstring""" def __init__( self , a__): """simple docstring""" _lowerCamelCase : str = list_of_points # ...
114
0
"""simple docstring""" import argparse from transformers import ( TapasConfig, TapasForMaskedLM, TapasForQuestionAnswering, TapasForSequenceClassification, TapasModel, TapasTokenizer, load_tf_weights_in_tapas, ) from transformers.utils import logging logging.set_verbosity_info() def...
528
import warnings from ...utils import logging from .image_processing_deit import DeiTImageProcessor _lowerCamelCase = logging.get_logger(__name__) class __A ( lowerCamelCase__ ): """simple docstring""" def __init__( self , *a__ , **a__): ...
114
0
import os import sys import unittest UpperCAmelCase_ : List[str] = os.path.abspath(os.path.dirname(os.path.dirname(os.path.dirname(__file__)))) sys.path.append(os.path.join(git_repo_path, '''utils''')) import get_test_info # noqa: E402 from get_test_info import ( # noqa: E402 get_model_to_test_...
17
import copy from typing import Any, Dict, List, Optional, Union import numpy as np from ...audio_utils import mel_filter_bank, spectrogram, window_function from ...feature_extraction_sequence_utils import SequenceFeatureExtractor from ...feature_extraction_utils import BatchFeature from ...utils import TensorTy...
114
0
import argparse import pickle import numpy as np import torch from torch import nn from transformers import ReformerConfig, ReformerModelWithLMHead from transformers.utils import logging logging.set_verbosity_info() def SCREAMING_SNAKE_CASE_ ( snake_case__ , snake_case__ , snake_case__=None...
312
import doctest from collections import deque import numpy as np class __A : """simple docstring""" def __init__( self): """simple docstring""" _lowerCamelCase : Any = [2, 1, 2, -1] _lowerCamelCase : Optional[i...
114
0
"""simple docstring""" from typing import List, Optional from ...configuration_utils import PretrainedConfig from ...utils import logging SCREAMING_SNAKE_CASE : str = logging.get_logger(__name__) SCREAMING_SNAKE_CASE : Tuple = { '''huggingface/autoformer-tourism-monthl...
156
from __future__ import annotations def __UpperCAmelCase( lowercase_ , lowercase_ = None , lowercase_ = None , lowercase_ = False , ): _lowerCamelCase : Tuple = cipher_alphabet or [chr(lowercase_ ) for i in range(97 , 1_23 )] # If the argument is No...
114
0
"""simple docstring""" # Copyright 2021 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 # # U...
213
from ...configuration_utils import PretrainedConfig from ...utils import logging _lowerCamelCase = logging.get_logger(__name__) _lowerCamelCase = { 'sayakpaul/vit-msn-base': 'https://huggingface.co/sayakpaul/vit-msn-base/resolve/main/config.json', # See all ViT MSN models at...
114
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 a_ :Dict = logging.getLogger(__name__) @da...
478
import shutil import tempfile import unittest import numpy as np import pytest from transformers.testing_utils import require_vision from transformers.utils import is_vision_available if is_vision_available(): from PIL import Image from transformers import ( AutoProcessor, ...
114
0
from typing import TYPE_CHECKING from ...utils import OptionalDependencyNotAvailable, _LazyModule, is_tokenizers_available, is_torch_available lowercase : Union[str, Any] = { "configuration_graphormer": ["GRAPHORMER_PRETRAINED_CONFIG_ARCHIVE_MAP", "GraphormerConfig"], } try: if not is...
542
import inspect from typing import List, Optional, Tuple, Union import torch from ...models import UNetaDModel, VQModel from ...schedulers import DDIMScheduler from ...utils import randn_tensor from ..pipeline_utils import DiffusionPipeline, ImagePipelineOutput class __A ( lowerCamelCase__ )...
114
0
from __future__ import annotations from random import random from typing import Generic, TypeVar SCREAMING_SNAKE_CASE_ = TypeVar('KT') SCREAMING_SNAKE_CASE_ = TypeVar('VT') class a ( Generic[KT, VT] ): def __init__( self , A_ = "root" , A_ = None ...
300
import copy import random from transformers import CLIPTokenizer class __A ( lowerCamelCase__ ): """simple docstring""" def __init__( self , *a__ , **a__): """simple docstring""" super().__init__(*a__ , **a__) ...
114
0
from ..utils import DummyObject, requires_backends class snake_case_ ( metaclass=lowerCamelCase__ ): """simple docstring""" snake_case__ = ["""torch""", """transformers""", """onnx"""] def __init__(self: Optional[int] , *__UpperCAmelCase: ...
351
import unittest import numpy as np import requests 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...
114
0
import shutil import tempfile import unittest import numpy as np from transformers.testing_utils import ( is_pt_tf_cross_test, require_tf, require_torch, require_torchvision, require_vision, ) from transformers.utils import is_tf_available, is_torch_available, is_vision_available if is_vis...
600
import argparse import torch from transformers import GPTaLMHeadModel, RobertaForMaskedLM if __name__ == "__main__": _lowerCamelCase = argparse.ArgumentParser( description=( 'Extraction some layers of the full RobertaForMaskedLM or GPT2LMHeadModel for Transfer Le...
114
0