code
stringlengths
81
54k
code_codestyle
int64
0
721
style_context
stringlengths
91
41.9k
style_context_codestyle
int64
0
699
label
int64
0
1
'''simple docstring''' from typing import List import jiwer import jiwer.transforms as tr from packaging import version import datasets from datasets.config import PY_VERSION if PY_VERSION < version.parse('''3.8'''): import importlib_metadata else: import importlib.metadata as importlib_metadata lo...
707
'''simple docstring''' import math import torch from torch import nn from ..configuration_utils import ConfigMixin, register_to_config from .attention_processor import Attention from .embeddings import get_timestep_embedding from .modeling_utils import ModelMixin class SCREAMING_SNAKE_CASE ( __lowercase ...
58
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, ) lowercase_ = { '''configuration_whisper''': ['''WHISPER_PRETRAINED_CONFIG_A...
708
'''simple docstring''' import os from argparse import ArgumentParser, Namespace from ..data import SingleSentenceClassificationProcessor as Processor from ..pipelines import TextClassificationPipeline from ..utils import is_tf_available, is_torch_available, logging from . import BaseTransformersCLICommand if not is...
58
0
'''simple docstring''' import inspect from typing import Callable, List, Optional, Union import torch from transformers import CLIPImageProcessor, CLIPTextModel, CLIPTokenizer from diffusers import DiffusionPipeline from diffusers.models import AutoencoderKL, UNetaDConditionModel from diffusers.pipelines.stable_diff...
709
'''simple docstring''' from typing import TYPE_CHECKING from ...utils import ( OptionalDependencyNotAvailable, _LazyModule, is_flax_available, is_tf_available, is_torch_available, ) lowercase_ = {'''configuration_vit_mae''': ['''VIT_MAE_PRETRAINED_CONFIG_ARCHIVE_MAP''', '''ViTMAEConfig''']...
58
0
'''simple docstring''' import csv from collections import defaultdict from dataclasses import dataclass, field from typing import List, Optional import matplotlib.pyplot as plt import numpy as np from matplotlib.ticker import ScalarFormatter from transformers import HfArgumentParser def UpperCamelCase__ ...
710
'''simple docstring''' import argparse import json import os from collections import OrderedDict import numpy as np import tensorflow as tf import torch def UpperCamelCase__ ( a__ ): '''simple docstring''' _lowerCAmelCase =os.path.join(args.tf_model_dir , 'parame...
58
0
'''simple docstring''' import torch from diffusers import EulerDiscreteScheduler from diffusers.utils import torch_device from .test_schedulers import SchedulerCommonTest class SCREAMING_SNAKE_CASE ( __lowercase): """simple docstring""" lowercase : List[str] = (EulerDiscre...
711
'''simple docstring''' def UpperCamelCase__ ( a__ = 1_0_0_0 ): '''simple docstring''' _lowerCAmelCase =2**power _lowerCAmelCase =0 while n: _lowerCAmelCase , _lowerCAmelCase =r + n % 1_0, n // 1_0 return r if __name_...
58
0
'''simple docstring''' import argparse import os import re import packaging.version lowercase_ = '''examples/''' lowercase_ = { '''examples''': (re.compile(r'''^check_min_version\("[^"]+"\)\s*$''', re.MULTILINE), '''check_min_version("VERSION")\n'''), '''init''': (re.compile(r'''^__version__\...
712
'''simple docstring''' def UpperCamelCase__ ( a__ ): '''simple docstring''' _lowerCAmelCase =set() # To detect a back edge, keep track of vertices currently in the recursion stack _lowerCAmelCase =set() return any( node not in visited an...
58
0
'''simple docstring''' import argparse import json import re from pathlib import Path import requests import torch from huggingface_hub import hf_hub_download from PIL import Image from transformers import ( MobileNetVaConfig, MobileNetVaForImageClassification, MobileNetVaImageProcessor, load_tf_weig...
713
'''simple docstring''' import copy import os from typing import Union from ...configuration_utils import PretrainedConfig from ...models.auto.modeling_auto import MODEL_FOR_CAUSAL_LM_MAPPING_NAMES from ...utils import logging from ..auto import CONFIG_MAPPING lowercase_ = logging.get_logger(__name__) lowerca...
58
0
'''simple docstring''' from collections import defaultdict from math import ceil, sqrt def UpperCamelCase__ ( a__ = 1_0_0_0_0_0_0 , a__ = 1_0 ): '''simple docstring''' _lowerCAmelCase =defaultdict(a__ ) for outer_width in range(3 , (t_limit // 4...
714
'''simple docstring''' lowercase_ = { '''A''': '''.-''', '''B''': '''-...''', '''C''': '''-.-.''', '''D''': '''-..''', '''E''': '''.''', '''F''': '''..-.''', '''G''': '''--.''', '''H''': '''....''', '''I''': '''..''', '''J''': '''.---''', '''K''': '''-.-''', '''L''': '''.-..''', '''M''': '''--''', '''N''...
58
0
'''simple docstring''' import argparse import logging from collections import namedtuple import torch from model_bertabs import BertAbsSummarizer from models.model_builder import AbsSummarizer # The authors' implementation from transformers import BertTokenizer logging.basicConfig(level=logging.INFO) lowercase_ ...
715
'''simple docstring''' from collections import OrderedDict from typing import Mapping from ...configuration_utils import PretrainedConfig from ...onnx import OnnxConfig from ...utils import logging lowercase_ = logging.get_logger(__name__) lowercase_ = { '''facebook/data2vec-text-base''': '''https:...
58
0
'''simple docstring''' from __future__ import annotations def UpperCamelCase__ ( a__ , a__ ): '''simple docstring''' _lowerCAmelCase =[] create_all_state(1 , a__ , a__ , [] , a__ ) return result def UpperCamel...
716
'''simple docstring''' import gc import random import unittest import torch from diffusers import ( IFImgaImgPipeline, IFImgaImgSuperResolutionPipeline, IFInpaintingPipeline, IFInpaintingSuperResolutionPipeline, IFPipeline, IFSuperResolutionPipeline, ) from diffusers.models.attention_processo...
58
0
'''simple docstring''' import argparse import os import re lowercase_ = '''src/diffusers''' # Pattern that looks at the indentation in a line. lowercase_ = re.compile(r'''^(\s*)\S''') # Pattern that matches `"key":" and puts `key` in group 0. lowercase_ = re.compile(r'''^\s*"([^"]+)":''') # Patter...
717
'''simple docstring''' import unittest from knapsack import knapsack as k class SCREAMING_SNAKE_CASE ( unittest.TestCase): """simple docstring""" def UpperCamelCase__ ( self ) -> Optional[Any]: _lowerCAmelCase =0 _lowerCAmelCase =[0] ...
58
0
'''simple docstring''' from typing import TYPE_CHECKING from ...file_utils import _LazyModule, is_tokenizers_available, is_torch_available, is_vision_available from ...utils import OptionalDependencyNotAvailable lowercase_ = {'''configuration_dpt''': ['''DPT_PRETRAINED_CONFIG_ARCHIVE_MAP''', '''DPTConfig'''...
718
'''simple docstring''' lowercase_ = ''' # Installazione di Transformers ! pip install transformers datasets # Per installare dalla fonte invece dell\'ultima versione rilasciata, commenta il comando sopra e # rimuovi la modalità commento al comando seguente. # ! pip install git+https://github.com/huggingface/tran...
58
0
'''simple docstring''' import numpy as np def UpperCamelCase__ ( a__ ): '''simple docstring''' return 1 / (1 + np.exp(-vector )) if __name__ == "__main__": import doctest doctest.testmod()
719
'''simple docstring''' import argparse import os import sys from unittest.mock import patch import pytorch_lightning as pl import timeout_decorator import torch from distillation import SummarizationDistiller, distill_main from finetune import SummarizationModule, main from transformers import MarianMTModel from tra...
58
0
'''simple docstring''' import argparse import glob import logging import os import time from argparse import Namespace import numpy as np import torch from lightning_base import BaseTransformer, add_generic_args, generic_train from torch.utils.data import DataLoader, TensorDataset from transformers import glue_compu...
720
'''simple docstring''' import argparse import glob import logging import os import time from argparse import Namespace import numpy as np import torch from lightning_base import BaseTransformer, add_generic_args, generic_train from torch.utils.data import DataLoader, TensorDataset from transformers import glue_compu...
58
0
'''simple docstring''' from __future__ import annotations from collections import namedtuple from dataclasses import dataclass @dataclass class SCREAMING_SNAKE_CASE : """simple docstring""" lowercase : int lowercase : TreeNode | None = None lowercase : TreeNode | No...
721
'''simple docstring''' from __future__ import annotations from typing import Any class SCREAMING_SNAKE_CASE : """simple docstring""" def __init__( self , __A ) -> None: _lowerCAmelCase =num_of_nodes _lowerCAmelCase =[] _lowerCAmelCase ...
58
0
'''simple docstring''' import numpy as np from matplotlib import pyplot as plt from sklearn import datasets def UpperCamelCase__ ( a__ ): '''simple docstring''' return 1 / (1 + np.exp(-z )) def UpperCamelCase__ ( a__ , a__ ): '''simple ...
700
'''simple docstring''' from PIL import Image def UpperCamelCase__ ( a__ , a__ ): '''simple docstring''' def brightness(a__ ) -> float: return 1_2_8 + level + (c - 1_2_8) if not -255.0 <= level <= 255.0: raise ValueError('level must be be...
58
0
'''simple docstring''' import copy import os from collections import OrderedDict from typing import TYPE_CHECKING, Any, Dict, Mapping, Optional, Union if TYPE_CHECKING: from ...processing_utils import ProcessorMixin from ...utils import TensorType from ...configuration_utils import PretrainedConfig fr...
701
'''simple docstring''' import json import os import shutil import sys import tempfile import unittest import unittest.mock as mock from pathlib import Path from huggingface_hub import HfFolder, delete_repo from requests.exceptions import HTTPError from transformers import AutoConfig, BertConfig, GPTaConfig from tran...
58
0
'''simple docstring''' import json from typing import TYPE_CHECKING, List, Optional, Tuple from tokenizers import pre_tokenizers from ...tokenization_utils_fast import PreTrainedTokenizerFast from ...utils import logging if TYPE_CHECKING: from transformers.pipelines.conversational import Conversation lowercase_...
702
'''simple docstring''' from __future__ import annotations lowercase_ = 10 def UpperCamelCase__ ( a__ ): '''simple docstring''' _lowerCAmelCase =1 _lowerCAmelCase =max(a__ ) while placement <= max_digit: # declare and initializ...
58
0
'''simple docstring''' from collections import OrderedDict from typing import Any, List, Mapping, Optional from ... import PreTrainedTokenizer, TensorType, is_torch_available from ...configuration_utils import PretrainedConfig from ...onnx import OnnxConfigWithPast, PatchingSpec from ...utils import logging lowerca...
703
'''simple docstring''' from . import __version__ # Backward compatibility imports, to make sure all those objects can be found in file_utils from .utils import ( CLOUDFRONT_DISTRIB_PREFIX, CONFIG_NAME, DISABLE_TELEMETRY, DUMMY_INPUTS, DUMMY_MASK, ENV_VARS_TRUE_AND_AUTO_VALUES, ENV_VARS_TRU...
58
0
'''simple docstring''' import copy import os from typing import Union from ...configuration_utils import PretrainedConfig from ...models.auto.modeling_auto import MODEL_FOR_CAUSAL_LM_MAPPING_NAMES from ...utils import logging from ..auto import CONFIG_MAPPING lowercase_ = logging.get_logger(__name__) lowerca...
704
'''simple docstring''' from __future__ import annotations def UpperCamelCase__ ( a__ ): '''simple docstring''' _lowerCAmelCase =len(a__ ) // 2 # choose the middle 3 elements _lowerCAmelCase =lst[m - 1 : m + 2] # if middle element is peak...
58
0
import numpy # List of input, output pairs lowercase_ = ( ((5, 2, 3), 15), ((6, 5, 9), 25), ((11, 12, 13), 41), ((1, 1, 1), 8), ((11, 12, 13), 41), ) lowercase_ = (((515, 22, 13), 555), ((61, 35, 49), 150)) lowercase_ = [2, 4, 1, 5] lowercase_ = len(train_data) lowercase_ ...
705
'''simple docstring''' import json from typing import List, Optional, Tuple from tokenizers import normalizers from ...tokenization_utils_fast import PreTrainedTokenizerFast from ...utils import logging from .tokenization_convbert import ConvBertTokenizer lowercase_ = logging.get_logger(__name__) lowercase_...
58
0
'''simple docstring''' import warnings from ...processing_utils import ProcessorMixin from ...tokenization_utils_base import BatchEncoding class SCREAMING_SNAKE_CASE ( __lowercase): """simple docstring""" lowercase : Any = ['image_processor', 'tokenizer'] lowercase : ...
706
'''simple docstring''' import warnings from ...processing_utils import ProcessorMixin from ...tokenization_utils_base import BatchEncoding class SCREAMING_SNAKE_CASE ( __lowercase): """simple docstring""" lowercase : Any = ['image_processor', 'tokenizer'] lowercase : An...
58
0
'''simple docstring''' from random import shuffle import tensorflow as tf from numpy import array def UpperCamelCase__ ( a__ , a__ ): '''simple docstring''' _lowerCAmelCase =int(a__ ) assert noofclusters < len(a__ ) # Find out the dimension...
707
'''simple docstring''' import math import torch from torch import nn from ..configuration_utils import ConfigMixin, register_to_config from .attention_processor import Attention from .embeddings import get_timestep_embedding from .modeling_utils import ModelMixin class SCREAMING_SNAKE_CASE ( __lowercase ...
58
0
'''simple docstring''' import pprint import requests lowercase_ = '''https://zenquotes.io/api''' def UpperCamelCase__ ( ): '''simple docstring''' return requests.get(API_ENDPOINT_URL + '/today' ).json() def UpperCamelCase__ ( ): '''simple docstring''...
708
'''simple docstring''' import os from argparse import ArgumentParser, Namespace from ..data import SingleSentenceClassificationProcessor as Processor from ..pipelines import TextClassificationPipeline from ..utils import is_tf_available, is_torch_available, logging from . import BaseTransformersCLICommand if not is...
58
0
'''simple docstring''' import inspect import unittest import warnings from math import ceil, floor from transformers import LevitConfig from transformers.file_utils import cached_property, is_torch_available, is_vision_available from transformers.models.auto import get_values from transformers.testing_utils import re...
709
'''simple docstring''' from typing import TYPE_CHECKING from ...utils import ( OptionalDependencyNotAvailable, _LazyModule, is_flax_available, is_tf_available, is_torch_available, ) lowercase_ = {'''configuration_vit_mae''': ['''VIT_MAE_PRETRAINED_CONFIG_ARCHIVE_MAP''', '''ViTMAEConfig''']...
58
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 def ...
710
'''simple docstring''' import argparse import json import os from collections import OrderedDict import numpy as np import tensorflow as tf import torch def UpperCamelCase__ ( a__ ): '''simple docstring''' _lowerCAmelCase =os.path.join(args.tf_model_dir , 'parame...
58
0
'''simple docstring''' import argparse import os import sys from unittest.mock import patch import pytorch_lightning as pl import timeout_decorator import torch from distillation import SummarizationDistiller, distill_main from finetune import SummarizationModule, main from transformers import MarianMTModel fro...
711
'''simple docstring''' def UpperCamelCase__ ( a__ = 1_0_0_0 ): '''simple docstring''' _lowerCAmelCase =2**power _lowerCAmelCase =0 while n: _lowerCAmelCase , _lowerCAmelCase =r + n % 1_0, n // 1_0 return r if __name_...
58
0
'''simple docstring''' from typing import Dict, Iterable, List, Optional, Union import numpy as np from ...image_processing_utils import BaseImageProcessor, BatchFeature, get_size_dict from ...image_transforms import ( center_crop, get_resize_output_image_size, normalize, rescale, resize, ...
712
'''simple docstring''' def UpperCamelCase__ ( a__ ): '''simple docstring''' _lowerCAmelCase =set() # To detect a back edge, keep track of vertices currently in the recursion stack _lowerCAmelCase =set() return any( node not in visited an...
58
0
'''simple docstring''' from __future__ import annotations from random import random from typing import Generic, TypeVar lowercase_ = TypeVar('''KT''') lowercase_ = TypeVar('''VT''') class SCREAMING_SNAKE_CASE ( Generic[KT, VT]): """simple docstring""" def __init__( self , ...
713
'''simple docstring''' import copy import os from typing import Union from ...configuration_utils import PretrainedConfig from ...models.auto.modeling_auto import MODEL_FOR_CAUSAL_LM_MAPPING_NAMES from ...utils import logging from ..auto import CONFIG_MAPPING lowercase_ = logging.get_logger(__name__) lowerca...
58
0
'''simple docstring''' import argparse import json import subprocess def UpperCamelCase__ ( a__ , a__ ): '''simple docstring''' _lowerCAmelCase =[] _lowerCAmelCase =( F'''curl -H "Accept: application/vnd.github+json" -H "Authorization: Be...
714
'''simple docstring''' lowercase_ = { '''A''': '''.-''', '''B''': '''-...''', '''C''': '''-.-.''', '''D''': '''-..''', '''E''': '''.''', '''F''': '''..-.''', '''G''': '''--.''', '''H''': '''....''', '''I''': '''..''', '''J''': '''.---''', '''K''': '''-.-''', '''L''': '''.-..''', '''M''': '''--''', '''N''...
58
0
'''simple docstring''' from typing import Optional, Union import torch from torch import nn from ...configuration_utils import ConfigMixin, register_to_config from ...models.modeling_utils import ModelMixin class SCREAMING_SNAKE_CASE ( __lowercase , __lowercase): """simple docstring""" ...
715
'''simple docstring''' from collections import OrderedDict from typing import Mapping from ...configuration_utils import PretrainedConfig from ...onnx import OnnxConfig from ...utils import logging lowercase_ = logging.get_logger(__name__) lowercase_ = { '''facebook/data2vec-text-base''': '''https:...
58
0
'''simple docstring''' from .testing import ( are_the_same_tensors, execute_subprocess_async, require_bnb, require_cpu, require_cuda, require_huggingface_suite, require_mps, require_multi_gpu, require_multi_xpu, require_safetensors, require_single_gpu, require_single_xpu...
716
'''simple docstring''' import gc import random import unittest import torch from diffusers import ( IFImgaImgPipeline, IFImgaImgSuperResolutionPipeline, IFInpaintingPipeline, IFInpaintingSuperResolutionPipeline, IFPipeline, IFSuperResolutionPipeline, ) from diffusers.models.attention_processo...
58
0
'''simple docstring''' def UpperCamelCase__ ( a__ ): '''simple docstring''' assert isinstance(a__ , a__ ), F'''The input value of [n={number}] is not an integer''' if number == 1: return 2 elif number < 1: _lowerCAmelCase =F'...
717
'''simple docstring''' import unittest from knapsack import knapsack as k class SCREAMING_SNAKE_CASE ( unittest.TestCase): """simple docstring""" def UpperCamelCase__ ( self ) -> Optional[Any]: _lowerCAmelCase =0 _lowerCAmelCase =[0] ...
58
0
'''simple docstring''' import argparse import os import evaluate import torch from datasets import load_dataset from torch.optim import AdamW from torch.utils.data import DataLoader from transformers import AutoModelForSequenceClassification, AutoTokenizer, get_linear_schedule_with_warmup, set_seed from accelerate...
718
'''simple docstring''' lowercase_ = ''' # Installazione di Transformers ! pip install transformers datasets # Per installare dalla fonte invece dell\'ultima versione rilasciata, commenta il comando sopra e # rimuovi la modalità commento al comando seguente. # ! pip install git+https://github.com/huggingface/tran...
58
0
'''simple docstring''' from typing import TYPE_CHECKING from ...utils import OptionalDependencyNotAvailable, _LazyModule, is_tf_available, is_torch_available lowercase_ = {'''configuration_swin''': ['''SWIN_PRETRAINED_CONFIG_ARCHIVE_MAP''', '''SwinConfig''', '''SwinOnnxConfig''']} try: if not is_torc...
719
'''simple docstring''' import argparse import os import sys from unittest.mock import patch import pytorch_lightning as pl import timeout_decorator import torch from distillation import SummarizationDistiller, distill_main from finetune import SummarizationModule, main from transformers import MarianMTModel from tra...
58
0
'''simple docstring''' import torch from diffusers import DPMSolverSDEScheduler from diffusers.utils import torch_device from diffusers.utils.testing_utils import require_torchsde from .test_schedulers import SchedulerCommonTest @require_torchsde class SCREAMING_SNAKE_CASE ( __lowercase): """simple...
720
'''simple docstring''' import argparse import glob import logging import os import time from argparse import Namespace import numpy as np import torch from lightning_base import BaseTransformer, add_generic_args, generic_train from torch.utils.data import DataLoader, TensorDataset from transformers import glue_compu...
58
0
'''simple docstring''' import numpy as np from sklearn.datasets import fetch_california_housing from sklearn.metrics import mean_absolute_error, mean_squared_error from sklearn.model_selection import train_test_split from xgboost import XGBRegressor def UpperCamelCase__ ( a__ ): '''simple do...
721
'''simple docstring''' from __future__ import annotations from typing import Any class SCREAMING_SNAKE_CASE : """simple docstring""" def __init__( self , __A ) -> None: _lowerCAmelCase =num_of_nodes _lowerCAmelCase =[] _lowerCAmelCase ...
58
0
'''simple docstring''' import unittest from .lib import ( Matrix, Vector, axpy, square_zero_matrix, unit_basis_vector, zero_vector, ) class SCREAMING_SNAKE_CASE ( unittest.TestCase): """simple docstring""" def UpperCamelCase__ ( self ) -> None: ...
700
'''simple docstring''' from PIL import Image def UpperCamelCase__ ( a__ , a__ ): '''simple docstring''' def brightness(a__ ) -> float: return 1_2_8 + level + (c - 1_2_8) if not -255.0 <= level <= 255.0: raise ValueError('level must be be...
58
0
'''simple docstring''' from typing import List, Optional, Union import numpy as np import PIL.Image from ...image_processing_utils import BaseImageProcessor, BatchFeature from ...image_transforms import rescale, resize, to_channel_dimension_format from ...image_utils import ( ChannelDimension, PILImageResamp...
701
'''simple docstring''' import json import os import shutil import sys import tempfile import unittest import unittest.mock as mock from pathlib import Path from huggingface_hub import HfFolder, delete_repo from requests.exceptions import HTTPError from transformers import AutoConfig, BertConfig, GPTaConfig from tran...
58
0
'''simple docstring''' def UpperCamelCase__ ( a__ , a__ ): '''simple docstring''' if density <= 0: raise ValueError('Impossible fluid density' ) if bulk_modulus <= 0: raise ValueError('Impossible bulk modulus' ) return (bulk_modu...
702
'''simple docstring''' from __future__ import annotations lowercase_ = 10 def UpperCamelCase__ ( a__ ): '''simple docstring''' _lowerCAmelCase =1 _lowerCAmelCase =max(a__ ) while placement <= max_digit: # declare and initializ...
58
0
'''simple docstring''' import unittest from transformers import AutoConfig, AutoTokenizer, BertConfig, TensorType, is_flax_available from transformers.testing_utils import DUMMY_UNKNOWN_IDENTIFIER, require_flax, slow if is_flax_available(): import jax from transformers.models.auto.modeling_flax_auto ...
703
'''simple docstring''' from . import __version__ # Backward compatibility imports, to make sure all those objects can be found in file_utils from .utils import ( CLOUDFRONT_DISTRIB_PREFIX, CONFIG_NAME, DISABLE_TELEMETRY, DUMMY_INPUTS, DUMMY_MASK, ENV_VARS_TRUE_AND_AUTO_VALUES, ENV_VARS_TRU...
58
0
'''simple docstring''' from datetime import datetime as dt import os from github import Github lowercase_ = [ '''good first issue''', '''good second issue''', '''good difficult issue''', '''feature request''', '''new model''', '''wip''', ] def UpperCamelCase__ ( ): ...
704
'''simple docstring''' from __future__ import annotations def UpperCamelCase__ ( a__ ): '''simple docstring''' _lowerCAmelCase =len(a__ ) // 2 # choose the middle 3 elements _lowerCAmelCase =lst[m - 1 : m + 2] # if middle element is peak...
58
0
import importlib import math import os from dataclasses import dataclass from enum import Enum from typing import Any, Dict, Optional, Tuple, Union import flax import jax.numpy as jnp from ..utils import BaseOutput lowercase_ = '''scheduler_config.json''' class SCREAMING_SNAKE_CASE ( __lowercase): ...
705
'''simple docstring''' import json from typing import List, Optional, Tuple from tokenizers import normalizers from ...tokenization_utils_fast import PreTrainedTokenizerFast from ...utils import logging from .tokenization_convbert import ConvBertTokenizer lowercase_ = logging.get_logger(__name__) lowercase_...
58
0
'''simple docstring''' from __future__ import annotations from typing import Any class SCREAMING_SNAKE_CASE : """simple docstring""" def __init__( self , __A ) -> None: _lowerCAmelCase =num_of_nodes _lowerCAmelCase =[] _lowerCAmelCas...
706
'''simple docstring''' import warnings from ...processing_utils import ProcessorMixin from ...tokenization_utils_base import BatchEncoding class SCREAMING_SNAKE_CASE ( __lowercase): """simple docstring""" lowercase : Any = ['image_processor', 'tokenizer'] lowercase : An...
58
0
'''simple docstring''' from typing import TYPE_CHECKING from ...utils import OptionalDependencyNotAvailable, _LazyModule, is_torch_available lowercase_ = { '''configuration_time_series_transformer''': [ '''TIME_SERIES_TRANSFORMER_PRETRAINED_CONFIG_ARCHIVE_MAP''', '''TimeSeriesTransformerCo...
707
'''simple docstring''' import math import torch from torch import nn from ..configuration_utils import ConfigMixin, register_to_config from .attention_processor import Attention from .embeddings import get_timestep_embedding from .modeling_utils import ModelMixin class SCREAMING_SNAKE_CASE ( __lowercase ...
58
0
'''simple docstring''' from queue import Queue from typing import TYPE_CHECKING, Optional if TYPE_CHECKING: from ..models.auto import AutoTokenizer class SCREAMING_SNAKE_CASE : """simple docstring""" def UpperCamelCase__ ( self , __A ) -> List[Any]: raise No...
708
'''simple docstring''' import os from argparse import ArgumentParser, Namespace from ..data import SingleSentenceClassificationProcessor as Processor from ..pipelines import TextClassificationPipeline from ..utils import is_tf_available, is_torch_available, logging from . import BaseTransformersCLICommand if not is...
58
0
'''simple docstring''' def UpperCamelCase__ ( a__ ): '''simple docstring''' if divisor % 5 == 0 or divisor % 2 == 0: return 0 _lowerCAmelCase =1 _lowerCAmelCase =1 while repunit: _lowerCAmelCase =(1_0 * repunit + 1...
709
'''simple docstring''' from typing import TYPE_CHECKING from ...utils import ( OptionalDependencyNotAvailable, _LazyModule, is_flax_available, is_tf_available, is_torch_available, ) lowercase_ = {'''configuration_vit_mae''': ['''VIT_MAE_PRETRAINED_CONFIG_ARCHIVE_MAP''', '''ViTMAEConfig''']...
58
0
'''simple docstring''' from collections import OrderedDict from typing import Any, Mapping, Optional, Union from ...configuration_utils import PretrainedConfig from ...feature_extraction_utils import FeatureExtractionMixin from ...onnx import OnnxConfig from ...onnx.utils import compute_effective_axis_dimension from ...
710
'''simple docstring''' import argparse import json import os from collections import OrderedDict import numpy as np import tensorflow as tf import torch def UpperCamelCase__ ( a__ ): '''simple docstring''' _lowerCAmelCase =os.path.join(args.tf_model_dir , 'parame...
58
0
'''simple docstring''' lowercase_ = ''' # Installazione di Transformers ! pip install transformers datasets # Per installare dalla fonte invece dell\'ultima versione rilasciata, commenta il comando sopra e # rimuovi la modalità commento al comando seguente. # ! pip install git+https://github.com/huggingface...
711
'''simple docstring''' def UpperCamelCase__ ( a__ = 1_0_0_0 ): '''simple docstring''' _lowerCAmelCase =2**power _lowerCAmelCase =0 while n: _lowerCAmelCase , _lowerCAmelCase =r + n % 1_0, n // 1_0 return r if __name_...
58
0
'''simple docstring''' from __future__ import annotations from math import pi def UpperCamelCase__ ( a__ , a__ , a__ ): '''simple docstring''' if (inductance, frequency, reactance).count(0 ) != 1: raise ValueError('One and only one argument must...
712
'''simple docstring''' def UpperCamelCase__ ( a__ ): '''simple docstring''' _lowerCAmelCase =set() # To detect a back edge, keep track of vertices currently in the recursion stack _lowerCAmelCase =set() return any( node not in visited an...
58
0
'''simple docstring''' import json import os import shutil import sys import tempfile import unittest import unittest.mock as mock from pathlib import Path from huggingface_hub import HfFolder, delete_repo from requests.exceptions import HTTPError from transformers import AutoConfig, BertConfig, GPTaConfig from tran...
713
'''simple docstring''' import copy import os from typing import Union from ...configuration_utils import PretrainedConfig from ...models.auto.modeling_auto import MODEL_FOR_CAUSAL_LM_MAPPING_NAMES from ...utils import logging from ..auto import CONFIG_MAPPING lowercase_ = logging.get_logger(__name__) lowerca...
58
0
'''simple docstring''' from typing import List from .keymap import KEYMAP, get_character def UpperCamelCase__ ( a__ ): '''simple docstring''' def decorator(a__ ): _lowerCAmelCase =getattr(a__ , 'handle_key' , [] ) handle +...
714
'''simple docstring''' lowercase_ = { '''A''': '''.-''', '''B''': '''-...''', '''C''': '''-.-.''', '''D''': '''-..''', '''E''': '''.''', '''F''': '''..-.''', '''G''': '''--.''', '''H''': '''....''', '''I''': '''..''', '''J''': '''.---''', '''K''': '''-.-''', '''L''': '''.-..''', '''M''': '''--''', '''N''...
58
0
'''simple docstring''' from __future__ import annotations def UpperCamelCase__ ( a__ ) -> int: '''simple docstring''' _lowerCAmelCase =len(a__ ) // 2 # choose the middle 3 elements _lowerCAmelCase =lst[m - 1 : m + 2] # if middle el...
715
'''simple docstring''' from collections import OrderedDict from typing import Mapping from ...configuration_utils import PretrainedConfig from ...onnx import OnnxConfig from ...utils import logging lowercase_ = logging.get_logger(__name__) lowercase_ = { '''facebook/data2vec-text-base''': '''https:...
58
0
'''simple docstring''' from typing import TYPE_CHECKING from ...utils import OptionalDependencyNotAvailable, _LazyModule, is_tensorflow_text_available, is_torch_available lowercase_ = { '''configuration_ernie''': ['''ERNIE_PRETRAINED_CONFIG_ARCHIVE_MAP''', '''ErnieConfig''', '''ErnieOnnxConfig'''], } try...
716
'''simple docstring''' import gc import random import unittest import torch from diffusers import ( IFImgaImgPipeline, IFImgaImgSuperResolutionPipeline, IFInpaintingPipeline, IFInpaintingSuperResolutionPipeline, IFPipeline, IFSuperResolutionPipeline, ) from diffusers.models.attention_processo...
58
0
'''simple docstring''' import argparse import torch from transformers import OpenAIGPTConfig, OpenAIGPTModel, load_tf_weights_in_openai_gpt from transformers.utils import CONFIG_NAME, WEIGHTS_NAME, logging logging.set_verbosity_info() def UpperCamelCase__ ( a__ , a__ , a__ ): ...
717
'''simple docstring''' import unittest from knapsack import knapsack as k class SCREAMING_SNAKE_CASE ( unittest.TestCase): """simple docstring""" def UpperCamelCase__ ( self ) -> Optional[Any]: _lowerCAmelCase =0 _lowerCAmelCase =[0] ...
58
0
'''simple docstring''' import collections import os import re from pathlib import Path lowercase_ = '''src/transformers''' # Matches is_xxx_available() lowercase_ = re.compile(r'''is\_([a-z_]*)_available()''') # Catches a one-line _import_struct = {xxx} lowercase_ = re.compile(r'''^_import_stru...
718
'''simple docstring''' lowercase_ = ''' # Installazione di Transformers ! pip install transformers datasets # Per installare dalla fonte invece dell\'ultima versione rilasciata, commenta il comando sopra e # rimuovi la modalità commento al comando seguente. # ! pip install git+https://github.com/huggingface/tran...
58
0
'''simple docstring''' from typing import Dict, List, Optional, Union import numpy as np from ...image_processing_utils import BaseImageProcessor, BatchFeature, get_size_dict from ...image_transforms import ( center_crop, get_resize_output_image_size, normalize, rescale, resize, to_channel_di...
719
'''simple docstring''' import argparse import os import sys from unittest.mock import patch import pytorch_lightning as pl import timeout_decorator import torch from distillation import SummarizationDistiller, distill_main from finetune import SummarizationModule, main from transformers import MarianMTModel from tra...
58
0
'''simple docstring''' import unittest import numpy as np from transformers.testing_utils import require_torch, require_vision from transformers.utils import is_torch_available, is_vision_available from ...test_image_processing_common import ImageProcessingSavingTestMixin, prepare_image_inputs if is_torch_availab...
720
'''simple docstring''' import argparse import glob import logging import os import time from argparse import Namespace import numpy as np import torch from lightning_base import BaseTransformer, add_generic_args, generic_train from torch.utils.data import DataLoader, TensorDataset from transformers import glue_compu...
58
0
'''simple docstring''' from argparse import ArgumentParser from .add_new_model import AddNewModelCommand from .add_new_model_like import AddNewModelLikeCommand from .convert import ConvertCommand from .download import DownloadCommand from .env import EnvironmentCommand from .lfs import LfsCommands from .pt_to_tf impo...
721
'''simple docstring''' from __future__ import annotations from typing import Any class SCREAMING_SNAKE_CASE : """simple docstring""" def __init__( self , __A ) -> None: _lowerCAmelCase =num_of_nodes _lowerCAmelCase =[] _lowerCAmelCase ...
58
0
from math import ceil, sqrt def SCREAMING_SNAKE_CASE__ ( UpperCamelCase__: int = 1_000_000 ): SCREAMING_SNAKE_CASE__ = 0 for outer_width in range(3 , (limit // 4) + 2 ): if outer_width**2 > limit: SCREAMING_SNAKE_CASE__ = max(ceil(sqrt(outer_wid...
59
from math import pow, sqrt def SCREAMING_SNAKE_CASE__ ( *UpperCamelCase__: float ): SCREAMING_SNAKE_CASE__ = len(UpperCamelCase__ ) > 0 and all(value > 0.0 for value in values ) return result def SCREAMING_SNAKE_CASE__ ( UpperCamelCase__: ...
59
1
from datetime import datetime import matplotlib.pyplot as plt import torch def SCREAMING_SNAKE_CASE__ ( UpperCamelCase__: Union[str, Any] ): for param in module.parameters(): SCREAMING_SNAKE_CASE__ = False def SCREAMING_SNAKE_CASE__ ( ): SCREAMI...
59
from ...configuration_utils import PretrainedConfig from ...utils import logging from ...utils.backbone_utils import BackboneConfigMixin, get_aligned_output_features_output_indices _lowerCamelCase = logging.get_logger(__name__) _lowerCamelCase = { 'shi-labs/nat-mini-in1k-224': 'https://hugg...
59
1
import numpy as np def SCREAMING_SNAKE_CASE__ ( UpperCamelCase__: np.array ): return 1 / (1 + np.exp(-vector )) def SCREAMING_SNAKE_CASE__ ( UpperCamelCase__: np.array ): return vector * sigmoid(1.7_0_2 * vector ) if __name__ == "__main__":...
59
from argparse import ArgumentParser from datasets.commands.convert import ConvertCommand from datasets.commands.dummy_data import DummyDataCommand from datasets.commands.env import EnvironmentCommand from datasets.commands.run_beam import RunBeamCommand from datasets.commands.test import TestCommand from dataset...
59
1
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 SCREAMING_SNAKE_CASE__ ( UpperCamelCase__: Tuple ): SCREAMING_SNAKE_CASE__ = test_file.split(os...
59
import warnings from ...utils import logging from .image_processing_layoutlmva import LayoutLMvaImageProcessor _lowerCamelCase = logging.get_logger(__name__) class UpperCamelCase_ ( UpperCamelCase__ ): def __init__( self :List[Any] , *__A :Tuple , ...
59
1
import warnings from functools import wraps from typing import Callable def SCREAMING_SNAKE_CASE__ ( UpperCamelCase__: Callable ): @wraps(UpperCamelCase__ ) def _inner_fn(*UpperCamelCase__: Dict , **UpperCamelCase__: Any ): warnings.warn( (f'...
59
import unittest from datasets import load_dataset from transformers.pipelines import pipeline from transformers.testing_utils import is_pipeline_test, nested_simplify, require_torch, slow @is_pipeline_test @require_torch class UpperCamelCase_ ( unittest.TestCase ): @require_torch ...
59
1
import copy import os from typing import Union from ...configuration_utils import PretrainedConfig from ...utils import logging _lowerCamelCase = logging.get_logger(__name__) _lowerCamelCase = { 'Salesforce/blip-vqa-base': 'https://huggingface.co/Salesforce/blip-vqa-base/resolve/main/confi...
59
import argparse import os import pickle import sys import torch from transformers import TransfoXLConfig, TransfoXLLMHeadModel, load_tf_weights_in_transfo_xl from transformers.models.transfo_xl import tokenization_transfo_xl as data_utils from transformers.models.transfo_xl.tokenization_transfo_xl import CORPUS...
59
1
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 = transforms.Co...
59
import argparse import tensorflow as tf import torch from transformers import BertConfig, BertForMaskedLM from transformers.models.bert.modeling_bert import ( BertIntermediate, BertLayer, BertOutput, BertPooler, BertSelfAttention, BertSelfOutput, ) from transformers.utils import logging ...
59
1
import gc import random import unittest import numpy as np import torch from PIL import Image from transformers import XLMRobertaTokenizerFast from diffusers import DDIMScheduler, KandinskyInpaintPipeline, KandinskyPriorPipeline, UNetaDConditionModel, VQModel from diffusers.pipelines.kandinsky.text_encoder impo...
59
import os from pathlib import Path from unittest.mock import patch import pytest import zstandard as zstd from datasets.download.download_config import DownloadConfig from datasets.utils.file_utils import ( OfflineModeIsEnabled, cached_path, fsspec_get, fsspec_head, ftp_get, ftp_head, ...
59
1
import inspect import unittest class UpperCamelCase_ ( unittest.TestCase ): def _snake_case ( self :str ) -> Union[str, Any]: """simple docstring""" try: import diffusers # noqa: F401 except ImportError: assert...
59
import argparse import logging import os import datasets import tensorflow as tf from transformers import AutoTokenizer _lowerCamelCase = logging.getLogger(__name__) def SCREAMING_SNAKE_CASE__ ( ): SCREAMING_SNAKE_CASE__ = argparse.ArgumentParser( description="""Pr...
59
1
def SCREAMING_SNAKE_CASE__ ( UpperCamelCase__: list , UpperCamelCase__: list ): _validate_point(UpperCamelCase__ ) _validate_point(UpperCamelCase__ ) if len(UpperCamelCase__ ) != len(UpperCamelCase__ ): raise ValueError("""Both points must be in the same ...
59
def SCREAMING_SNAKE_CASE__ ( UpperCamelCase__: list[list[float]] ): SCREAMING_SNAKE_CASE__ = [] for data in source_data: for i, el in enumerate(UpperCamelCase__ ): if len(UpperCamelCase__ ) < i + 1: data_lists.append([] ) data_lists[i].append(fl...
59
1
import html from ...feature_extraction_utils import BatchFeature, FeatureExtractionMixin from ...utils import is_bsa_available, logging, requires_backends if is_bsa_available(): import bsa from bsa import BeautifulSoup _lowerCamelCase = logging.get_logger(__name__) class UpperCamelCase_ ...
59
import warnings from functools import wraps from typing import Callable def SCREAMING_SNAKE_CASE__ ( UpperCamelCase__: Callable ): @wraps(UpperCamelCase__ ) def _inner_fn(*UpperCamelCase__: Dict , **UpperCamelCase__: Any ): warnings.warn( (f'...
59
1
import qiskit def SCREAMING_SNAKE_CASE__ ( UpperCamelCase__: int , UpperCamelCase__: int ): SCREAMING_SNAKE_CASE__ = qiskit.Aer.get_backend("""aer_simulator""" ) # Create a Quantum Circuit acting on the q register SCREAMING_SNAKE_CASE__ = qiskit.Q...
59
import json import os import unittest from transformers.models.roc_bert.tokenization_roc_bert import ( VOCAB_FILES_NAMES, RoCBertBasicTokenizer, RoCBertTokenizer, RoCBertWordpieceTokenizer, _is_control, _is_punctuation, _is_whitespace, ) from transformers.testing_utils import require_...
59
1
from typing import TYPE_CHECKING from ...utils import OptionalDependencyNotAvailable, _LazyModule, is_torch_available _lowerCamelCase = {'configuration_sew': ['SEW_PRETRAINED_CONFIG_ARCHIVE_MAP', 'SEWConfig']} try: if not is_torch_available(): raise OptionalDependencyNotAvailable() except OptionalD...
59
import argparse import json from collections import OrderedDict from pathlib import Path import requests import torch from huggingface_hub import hf_hub_download from PIL import Image from transformers import PoolFormerConfig, PoolFormerForImageClassification, PoolFormerImageProcessor from transformers.utils im...
59
1
from __future__ import annotations from collections.abc import Callable from typing import Any, Generic, TypeVar _lowerCamelCase = TypeVar('T') class UpperCamelCase_ ( Generic[T] ): def __init__( self :Tuple , __A :list[T] , __A :Callable[[T, ...
59
import copy import os from typing import Union from ...configuration_utils import PretrainedConfig from ...utils import logging _lowerCamelCase = logging.get_logger(__name__) _lowerCamelCase = { 'google/pix2struct-textcaps-base': ( 'https://huggingface.co/google/pix2struct-textcaps...
59
1
import tempfile import unittest from transformers import TaConfig, is_torch_available from transformers.testing_utils import ( require_sentencepiece, require_tokenizers, require_torch, slow, torch_device, ) from ...generation.test_utils import GenerationTesterMixin from ...test_modeling_comm...
59
import inspect import os import unittest import torch import accelerate from accelerate import Accelerator from accelerate.test_utils import execute_subprocess_async, require_multi_gpu from accelerate.utils import patch_environment class UpperCamelCase_ ( unittest.TestCase ): def ...
59
1
from typing import List import numpy as np def SCREAMING_SNAKE_CASE__ ( UpperCamelCase__: dict ): SCREAMING_SNAKE_CASE__ = {key: len(UpperCamelCase__ ) for key, value in gen_kwargs.items() if isinstance(UpperCamelCase__ , UpperCamelCase__ )} if len(set(lists_...
59
from typing import TYPE_CHECKING from ...utils import ( OptionalDependencyNotAvailable, _LazyModule, is_tf_available, is_tokenizers_available, is_torch_available, is_vision_available, ) _lowerCamelCase = { 'configuration_layoutlmv3': [ 'LAYOUTLMV3_PRETRAINED_CONFIG_A...
59
1
import functools import operator from ...configuration_utils import PretrainedConfig from ...utils import logging _lowerCamelCase = logging.get_logger(__name__) _lowerCamelCase = { 'asapp/sew-d-tiny-100k': 'https://huggingface.co/asapp/sew-d-tiny-100k/resolve/main/config.json', # See a...
59
import inspect import unittest class UpperCamelCase_ ( unittest.TestCase ): def _snake_case ( self :str ) -> Union[str, Any]: """simple docstring""" try: import diffusers # noqa: F401 except ImportError: assert...
59
1
from typing import TYPE_CHECKING from ...utils import ( OptionalDependencyNotAvailable, _LazyModule, is_flax_available, is_tf_available, is_tokenizers_available, is_torch_available, ) _lowerCamelCase = { 'configuration_whisper': ['WHISPER_PRETRAINED_CONFIG_ARCHIVE_MAP', 'Whi...
59
import warnings from typing import List, Optional, Tuple, Union import numpy as np import PIL import torch from ...models import UNetaDModel from ...schedulers import RePaintScheduler from ...utils import PIL_INTERPOLATION, logging, randn_tensor from ..pipeline_utils import DiffusionPipeline, ImagePipelineOutpu...
59
1
import argparse import os import numpy as np import tensorflow as tf import torch from transformers import BertModel def SCREAMING_SNAKE_CASE__ ( UpperCamelCase__: BertModel , UpperCamelCase__: str , UpperCamelCase__: str ): SCREAMING_SNAKE_CASE__ = ...
59
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...
59
1
import random def SCREAMING_SNAKE_CASE__ ( UpperCamelCase__: List[str] , UpperCamelCase__: str , UpperCamelCase__: str ): SCREAMING_SNAKE_CASE__ = a[left_index] SCREAMING_SNAKE_CASE__ = left_index + 1 for j in range(left_index + 1 , ...
59
import copy from dataclasses import dataclass, field from typing import ClassVar, Dict from ..features import ClassLabel, Features, Image from .base import TaskTemplate @dataclass(frozen=UpperCamelCase__ ) class UpperCamelCase_ ( UpperCamelCase__ ): lowerCamelCase_ = fi...
59
1
import json import os import tempfile import unittest import numpy as np from datasets import load_dataset 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 ImageProcessin...
59
# 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 app...
59
1
from typing import TYPE_CHECKING from ...utils import ( OptionalDependencyNotAvailable, _LazyModule, is_tf_available, is_tokenizers_available, is_torch_available, ) _lowerCamelCase = { 'configuration_mobilebert': [ 'MOBILEBERT_PRETRAINED_CONFIG_ARCHIVE_MAP', 'Mob...
59
from ...configuration_utils import PretrainedConfig from ...utils import logging _lowerCamelCase = logging.get_logger(__name__) class UpperCamelCase_ ( UpperCamelCase__ ): lowerCamelCase_ = "timm_backbone" def __init__( self :Union[str, Any] ...
59
1
from ...utils import ( OptionalDependencyNotAvailable, is_torch_available, is_transformers_available, is_transformers_version, ) try: if not (is_transformers_available() and is_torch_available() and is_transformers_version('>=', '4.25.0')): raise OptionalDependencyNotAvailable() except Option...
59
from math import pow, sqrt def SCREAMING_SNAKE_CASE__ ( *UpperCamelCase__: float ): SCREAMING_SNAKE_CASE__ = len(UpperCamelCase__ ) > 0 and all(value > 0.0 for value in values ) return result def SCREAMING_SNAKE_CASE__ ( UpperCamelCase__: ...
59
1
# 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 app...
59
from ...configuration_utils import PretrainedConfig from ...utils import logging from ...utils.backbone_utils import BackboneConfigMixin, get_aligned_output_features_output_indices _lowerCamelCase = logging.get_logger(__name__) _lowerCamelCase = { 'shi-labs/nat-mini-in1k-224': 'https://hugg...
59
1
from typing import TYPE_CHECKING from ...utils import ( OptionalDependencyNotAvailable, _LazyModule, is_torch_available, ) _lowerCamelCase = { 'configuration_swiftformer': [ 'SWIFTFORMER_PRETRAINED_CONFIG_ARCHIVE_MAP', 'SwiftFormerConfig', 'SwiftFormerOnnxConfig'...
59
from argparse import ArgumentParser from datasets.commands.convert import ConvertCommand from datasets.commands.dummy_data import DummyDataCommand from datasets.commands.env import EnvironmentCommand from datasets.commands.run_beam import RunBeamCommand from datasets.commands.test import TestCommand from dataset...
59
1
_lowerCamelCase = '\n# Installazione di Transformers\n! pip install transformers datasets\n# Per installare dalla fonte invece dell\'ultima versione rilasciata, commenta il comando sopra e\n# rimuovi la modalità commento al comando seguente.\n# ! pip install git+https://github.com/huggingface/transformers...
59
import warnings from ...utils import logging from .image_processing_layoutlmva import LayoutLMvaImageProcessor _lowerCamelCase = logging.get_logger(__name__) class UpperCamelCase_ ( UpperCamelCase__ ): def __init__( self :List[Any] , *__A :Tuple , ...
59
1
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 ...
59
import unittest from datasets import load_dataset from transformers.pipelines import pipeline from transformers.testing_utils import is_pipeline_test, nested_simplify, require_torch, slow @is_pipeline_test @require_torch class UpperCamelCase_ ( unittest.TestCase ): @require_torch ...
59
1
from ..utils import DummyObject, requires_backends class UpperCamelCase_ ( metaclass=UpperCamelCase__ ): lowerCamelCase_ = ["note_seq"] def __init__( self :Any , *__A :Union[str, Any] , **__A :Optional[Any] ) -> Any: ...
59
import argparse import os import pickle import sys import torch from transformers import TransfoXLConfig, TransfoXLLMHeadModel, load_tf_weights_in_transfo_xl from transformers.models.transfo_xl import tokenization_transfo_xl as data_utils from transformers.models.transfo_xl.tokenization_transfo_xl import CORPUS...
59
1
def SCREAMING_SNAKE_CASE__ ( UpperCamelCase__: int ): return number & 1 == 0 if __name__ == "__main__": import doctest doctest.testmod()
59
import argparse import tensorflow as tf import torch from transformers import BertConfig, BertForMaskedLM from transformers.models.bert.modeling_bert import ( BertIntermediate, BertLayer, BertOutput, BertPooler, BertSelfAttention, BertSelfOutput, ) from transformers.utils import logging ...
59
1
import unittest from transformers import load_tool from transformers.utils import is_torch_available if is_torch_available(): import torch from transformers.testing_utils import require_torch from .test_tools_common import ToolTesterMixin @require_torch class UpperCamelCase_ ( unittest.TestC...
59
import os from pathlib import Path from unittest.mock import patch import pytest import zstandard as zstd from datasets.download.download_config import DownloadConfig from datasets.utils.file_utils import ( OfflineModeIsEnabled, cached_path, fsspec_get, fsspec_head, ftp_get, ftp_head, ...
59
1
import argparse import os import torch from transformers.utils import WEIGHTS_NAME _lowerCamelCase = ['small', 'medium', 'large'] _lowerCamelCase = 'lm_head.decoder.weight' _lowerCamelCase = 'lm_head.weight' def SCREAMING_SNAKE_CASE__ ( UpperCamelCase__: st...
59
import argparse import logging import os import datasets import tensorflow as tf from transformers import AutoTokenizer _lowerCamelCase = logging.getLogger(__name__) def SCREAMING_SNAKE_CASE__ ( ): SCREAMING_SNAKE_CASE__ = argparse.ArgumentParser( description="""Pr...
59
1
from ...configuration_utils import PretrainedConfig from ...utils import logging _lowerCamelCase = logging.get_logger(__name__) _lowerCamelCase = { 'bigcode/gpt_bigcode-santacoder': 'https://huggingface.co/bigcode/gpt_bigcode-santacoder/resolve/main/config.json', } class UpperCamelCas...
59
def SCREAMING_SNAKE_CASE__ ( UpperCamelCase__: list[list[float]] ): SCREAMING_SNAKE_CASE__ = [] for data in source_data: for i, el in enumerate(UpperCamelCase__ ): if len(UpperCamelCase__ ) < i + 1: data_lists.append([] ) data_lists[i].append(fl...
59
1
import logging import os import sys import warnings from dataclasses import dataclass, field from random import randint from typing import Optional import datasets import evaluate import numpy as np from datasets import DatasetDict, load_dataset import transformers from transformers import ( AutoConfig, ...
59
import warnings from functools import wraps from typing import Callable def SCREAMING_SNAKE_CASE__ ( UpperCamelCase__: Callable ): @wraps(UpperCamelCase__ ) def _inner_fn(*UpperCamelCase__: Dict , **UpperCamelCase__: Any ): warnings.warn( (f'...
59
1
import json from typing import List, Optional, Tuple from tokenizers import normalizers from ...tokenization_utils_fast import PreTrainedTokenizerFast from .tokenization_lxmert import LxmertTokenizer _lowerCamelCase = {'vocab_file': 'vocab.txt', 'tokenizer_file': 'tokenizer.json'} _lowerCamelCase ...
59
import json import os import unittest from transformers.models.roc_bert.tokenization_roc_bert import ( VOCAB_FILES_NAMES, RoCBertBasicTokenizer, RoCBertTokenizer, RoCBertWordpieceTokenizer, _is_control, _is_punctuation, _is_whitespace, ) from transformers.testing_utils import require_...
59
1
import os from shutil import copyfile from typing import Any, Dict, List, Optional, Tuple import sentencepiece as spm from ...tokenization_utils import AddedToken, PreTrainedTokenizer from ...utils import logging _lowerCamelCase = logging.get_logger(__name__) _lowerCamelCase = {'vocab_file': ...
59
import argparse import json from collections import OrderedDict from pathlib import Path import requests import torch from huggingface_hub import hf_hub_download from PIL import Image from transformers import PoolFormerConfig, PoolFormerForImageClassification, PoolFormerImageProcessor from transformers.utils im...
59
1
import os import shutil import tempfile import unittest import numpy as np from transformers import AutoTokenizer, BarkProcessor from transformers.testing_utils import require_torch, slow @require_torch class UpperCamelCase_ ( unittest.TestCase ): def _snake_case ( self ...
59
import copy import os from typing import Union from ...configuration_utils import PretrainedConfig from ...utils import logging _lowerCamelCase = logging.get_logger(__name__) _lowerCamelCase = { 'google/pix2struct-textcaps-base': ( 'https://huggingface.co/google/pix2struct-textcaps...
59
1
import math import os import unittest from transformers import MegatronBertConfig, is_torch_available from transformers.models.auto import get_values from transformers.testing_utils import require_sentencepiece, require_tokenizers, require_torch, slow, torch_device from ...test_configuration_common import Confi...
59
import inspect import os import unittest import torch import accelerate from accelerate import Accelerator from accelerate.test_utils import execute_subprocess_async, require_multi_gpu from accelerate.utils import patch_environment class UpperCamelCase_ ( unittest.TestCase ): def ...
59
1
_lowerCamelCase = { 'Pillow': 'Pillow<10.0.0', 'accelerate': 'accelerate>=0.20.3', 'av': 'av==9.2.0', 'beautifulsoup4': 'beautifulsoup4', 'black': 'black~=23.1', 'codecarbon': 'codecarbon==1.2.0', 'cookiecutter': 'cookiecutter==1.7.3', 'dataclasses': 'dataclasses', 'dat...
59
from typing import TYPE_CHECKING from ...utils import ( OptionalDependencyNotAvailable, _LazyModule, is_tf_available, is_tokenizers_available, is_torch_available, is_vision_available, ) _lowerCamelCase = { 'configuration_layoutlmv3': [ 'LAYOUTLMV3_PRETRAINED_CONFIG_A...
59
1
from __future__ import annotations from math import pi def SCREAMING_SNAKE_CASE__ ( UpperCamelCase__: float , UpperCamelCase__: float , UpperCamelCase__: float ): if (inductance, frequency, reactance).count(0 ) != 1: raise ValueError("""One and onl...
59
import inspect import unittest class UpperCamelCase_ ( unittest.TestCase ): def _snake_case ( self :str ) -> Union[str, Any]: """simple docstring""" try: import diffusers # noqa: F401 except ImportError: assert...
59
1
from argparse import ArgumentParser from datasets.commands.convert import ConvertCommand from datasets.commands.dummy_data import DummyDataCommand from datasets.commands.env import EnvironmentCommand from datasets.commands.run_beam import RunBeamCommand from datasets.commands.test import TestCommand from dataset...
59
import warnings from typing import List, Optional, Tuple, Union import numpy as np import PIL import torch from ...models import UNetaDModel from ...schedulers import RePaintScheduler from ...utils import PIL_INTERPOLATION, logging, randn_tensor from ..pipeline_utils import DiffusionPipeline, ImagePipelineOutpu...
59
1
from typing import TYPE_CHECKING from ...utils import ( OptionalDependencyNotAvailable, _LazyModule, is_sentencepiece_available, is_tokenizers_available, is_torch_available, ) _lowerCamelCase = {'configuration_fnet': ['FNET_PRETRAINED_CONFIG_ARCHIVE_MAP', 'FNetConfig']} try: if no...
59
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...
59
1