code
stringlengths
86
54.5k
code_codestyle
int64
0
371
style_context
stringlengths
87
49.2k
style_context_codestyle
int64
0
349
label
int64
0
1
'''simple docstring''' from ...configuration_utils import PretrainedConfig from ...utils import logging lowerCAmelCase__ = logging.get_logger(__name__) lowerCAmelCase__ = { '''google/canine-s''': '''https://huggingface.co/google/canine-s/resolve/main/config.json''', # See all CANI...
104
class _SCREAMING_SNAKE_CASE : '''simple docstring''' def __init__(self : Optional[Any] , UpperCAmelCase_ : int) ->Optional[int]: '''simple docstring''' lowerCamelCase__: Any =n lowerCamelCase__: Tuple =[None] * self.n lowerCamelCase__: ...
10
0
import json import os from pathlib import Path import pytest from datasets.download.download_config import DownloadConfig from datasets.download.download_manager import DownloadManager from datasets.utils.file_utils import hash_url_to_filename _snake_case = "http://www.mocksite.com/file1.txt" _snake_case = ...
351
import unittest import numpy as np from diffusers import OnnxStableDiffusionInpaintPipelineLegacy from diffusers.utils.testing_utils import ( is_onnx_available, load_image, load_numpy, nightly, require_onnxruntime, require_torch_gpu, ) if is_onnx_available(): import onnxruntime as ...
300
0
import inspect import unittest import numpy as np from tests.test_modeling_common import floats_tensor from transformers import MaskaFormerConfig, is_torch_available, is_vision_available from transformers.testing_utils import require_torch, require_torch_multi_gpu, require_vision, slow, torch_device from transfor...
36
"""simple docstring""" import unittest from pathlib import Path from tempfile import NamedTemporaryFile, TemporaryDirectory from transformers import BertConfig, BertTokenizerFast, FeatureExtractionPipeline from transformers.convert_graph_to_onnx import ( convert, ensure_valid_input, genera...
221
0
# Imports import numpy as np class __a : def __init__( self : List[str] , SCREAMING_SNAKE_CASE : Any=None , SCREAMING_SNAKE_CASE : Union[str, Any]=None , SCREAMING_SNAKE_CASE : Any=None , SCREAMING_...
196
from collections import UserDict from typing import List, Union from ..utils import ( add_end_docstrings, is_tf_available, is_torch_available, is_vision_available, logging, requires_backends, ) from .base import PIPELINE_INIT_ARGS, Pipeline if is_vision_available()...
196
1
import argparse import dataclasses import json import logging import os import shutil from typing import List, Optional import datasets from accelerate import Accelerator from datasets import load_dataset from finetuning import finetune from tqdm.auto import tqdm import transformers from tran...
308
import logging import torch from accelerate import Accelerator from arguments import EvaluationArguments from datasets import load_dataset from torch.utils.data import IterableDataset from torch.utils.data.dataloader import DataLoader from transformers import AutoModelForCausalLM, AutoTokenizer, Hf...
308
1
import warnings from typing import List, Optional, Union from ...image_utils import ImageInput from ...processing_utils import ProcessorMixin from ...tokenization_utils_base import BatchEncoding, PaddingStrategy, PreTokenizedInput, TextInput, TruncationStrategy from ...utils import TensorType class snake_...
138
import gc import unittest import numpy as np import torch from transformers import CLIPTextConfig, CLIPTextModel, CLIPTokenizer from diffusers import ( AutoencoderKL, DDIMScheduler, StableDiffusionAttendAndExcitePipeline, UNetaDConditionModel, ) from diffusers.utils import load_numpy, skip_mps,...
138
1
from typing import TYPE_CHECKING from ...utils import OptionalDependencyNotAvailable, _LazyModule, is_torch_available lowercase : List[Any] = { """configuration_timesformer""": ["""TIMESFORMER_PRETRAINED_CONFIG_ARCHIVE_MAP""", """TimesformerConfig"""], } try: if not is_torch_availa...
99
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_dimension_format, ) fro...
240
0
import json import os from collections import Counter import torch import torchvision import torchvision.transforms as transforms from PIL import Image from torch import nn from torch.utils.data import Dataset A : int = {1: (1, 1), 2: (2, 1), 3: (3, 1), 4: (2, 2), 5: (5, 1), 6: (3...
361
from __future__ import annotations import unittest from transformers import is_tf_available from transformers.testing_utils import require_sentencepiece, require_tf, require_tokenizers, slow if is_tf_available(): import numpy as np import tensorflow as tf from transformers import TFXLMRobertaM...
146
0
"""simple docstring""" from collections import OrderedDict from typing import Mapping from packaging import version from ...configuration_utils import PretrainedConfig from ...onnx import OnnxConfig from ...utils import logging snake_case__ : Any = logging.get_logger(__name__) snake_case__ :...
60
"""simple docstring""" from typing import TYPE_CHECKING from ...utils import OptionalDependencyNotAvailable, _LazyModule, is_torch_available A: List[str] = { "configuration_clipseg": [ "CLIPSEG_PRETRAINED_CONFIG_ARCHIVE_MAP", "CLIPSegConfig", "CLIPSegTextConfig", "CL...
109
0
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 OptionalDependencyNotAv...
7
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_flax_commo...
7
1
import functools def lowercase__ ( __snake_case : str , __snake_case : str ): '''simple docstring''' UpperCAmelCase_ : List[str] = len(__snake_case ) UpperCAmelCase_ : Dict = len(...
29
def UpperCAmelCase__ (UpperCamelCase_ ,UpperCamelCase_ ,UpperCamelCase_=False ): """simple docstring""" if isinstance(UpperCamelCase_ ,UpperCamelCase_ ) and isinstance(UpperCamelCase_ ,UpperCamelCase_ ): snake_case = len(set_a....
127
0
'''simple docstring''' from ...configuration_utils import PretrainedConfig class lowercase_ ( A ): """simple docstring""" lowerCamelCase_ = '''bert-generation''' def __init__( self : int , __lowerCamelCase : int=5_0_3_5_8 , __lowerCamelCase : Uni...
111
'''simple docstring''' def SCREAMING_SNAKE_CASE_ ( __A : list ) -> list: if len(__A ) <= 1: return lst _SCREAMING_SNAKE_CASE = 1 while i < len(__A ): if lst[i - 1] <= lst[i]: i += 1 else: _SCREAMING_SNAKE_CASE, _SCREAMING_SNAKE_CASE = l...
111
1
"""simple docstring""" def _SCREAMING_SNAKE_CASE ( __snake_case : bytes ): '''simple docstring''' return "".join([hex(__snake_case )[2:].zfill(2 ).upper() for byte in list(__snake_case )] ) def _SCREAMING_SNAKE_CASE ( __snake_case : str ): '''simp...
220
"""simple docstring""" import os from argparse import ArgumentParser from typing import List import torch.utils.data from datasets import Dataset, IterableDataset from datasets.distributed import split_dataset_by_node _UpperCamelCase : List[Any] = 4 _UpperCamelCase : Optional[Any] = 3 cla...
220
1
"""simple docstring""" from scipy.stats import pearsonr import datasets a_ = '\nPearson correlation coefficient and p-value for testing non-correlation.\nThe Pearson correlation coefficient measures the linear relationship between two datasets. The calculation of the p-value relies on ...
366
"""simple docstring""" 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, ) a_ = { "co...
163
0
from sklearn.metrics import mean_squared_error import datasets lowercase__ : List[str] = '''\ @article{scikit-learn, title={Scikit-learn: Machine Learning in {P}ython}, author={Pedregosa, F. and Varoquaux, G. and Gramfort, A. and Michel, V. and Thirion, B. and Grisel, O. and Blondel, M. and Pre...
338
import unittest import numpy as np def SCREAMING_SNAKE_CASE_ ( snake_case__ , snake_case__ , snake_case__ , snake_case__ = None , ) -> np.ndarray: lowerCAmelCase = np.shape(snake_case__ ) lowerCAmelCase = np.shape(snake_case__ ) lowerCAmelCase ...
338
1
'''simple docstring''' import copy from typing import Dict, Optional from ...configuration_utils import PretrainedConfig from ...utils import logging from ..auto import CONFIG_MAPPING from ..detr import DetrConfig from ..swin import SwinConfig lowercase : Optional[Any] = { "facebook/maskformer...
360
'''simple docstring''' import random from .binary_exp_mod import bin_exp_mod def SCREAMING_SNAKE_CASE__ ( __A , __A=1_000 ) -> str: if n < 2: return False if n % 2 == 0: return n == 2 # this means n is odd _snake_case = n - 1 _snake_case ...
160
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 # #...
56
'''simple docstring''' from collections import OrderedDict from typing import Mapping from ...configuration_utils import PretrainedConfig from ...onnx import OnnxConfig from ...utils import logging a : str = logging.get_logger(__name__) a : str = { 'google/bigbird-roberta-base': ...
56
1
'''simple docstring''' import logging import os from dataclasses import dataclass, field from typing import Dict, Optional import datasets import numpy as np import tensorflow as tf from transformers import ( AutoConfig, AutoTokenizer, EvalPrediction, HfArgumentParser, PreTrainedTokenizer...
365
'''simple docstring''' import warnings from ...utils import logging from .image_processing_mobilevit import MobileViTImageProcessor __A : Optional[int] = logging.get_logger(__name__) class __UpperCamelCase ( lowercase__ ): def __init__( self :List[str] ,*_Upp...
8
0
"""simple docstring""" from ...configuration_utils import PretrainedConfig from ...utils import logging snake_case__ : Dict = logging.get_logger(__name__) snake_case__ : Optional[Any] = {} class snake_case_( a__ ): __UpperCamelCase = '''llama''' __UpperCamelCa...
60
"""simple docstring""" import collections import inspect import unittest from transformers import SwinvaConfig 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_configura...
60
1
'''simple docstring''' from ...utils import logging from ..ta.modeling_tf_ta import TFTaEncoderModel, TFTaForConditionalGeneration, TFTaModel from .configuration_mta import MTaConfig UpperCamelCase__ : Dict = logging.get_logger(__name__) UpperCamelCase__ : Optional[Any] = 'T5Config...
355
'''simple docstring''' import math def UpperCAmelCase ( a_ ) -> bool: """simple docstring""" return math.sqrt(a_ ) * math.sqrt(a_ ) == num def UpperCAmelCase ( a_ ) -> bool: """simple docstring""" ...
164
0
"""simple docstring""" from ...configuration_utils import PretrainedConfig from ...utils import logging snake_case_ = logging.get_logger(__name__) snake_case_ = { """naver-clova-ix/donut-base""": """https://huggingface.co/naver-clova-ix/donut-base/resolve/main/conf...
78
"""simple docstring""" import numpy as np import torch from torch.nn import CrossEntropyLoss from transformers import AutoModelForCausalLM, AutoTokenizer import datasets from datasets import logging SCREAMING_SNAKE_CASE : Union[str, Any] = """\ """ SCREAMING_SNAKE_CASE : Any = """ Pe...
102
0
from argparse import ArgumentParser from .env import EnvironmentCommand def UpperCamelCase ( ) -> Dict: """simple docstring""" lowercase__ = ArgumentParser("""Diffusers CLI tool""" , usage="""diffusers-cli <command> [<args>]""" ) lowercase__ ...
146
from collections import OrderedDict from typing import Mapping from ...configuration_utils import PretrainedConfig from ...onnx import OnnxConfig from ...utils import logging A : Union[str, Any] = logging.get_logger(__name__) A : int = { 'andreasmadsen/efficient_mlm_m0.40': ...
146
1
"""simple docstring""" from collections import OrderedDict from typing import Mapping from ...configuration_utils import PretrainedConfig from ...onnx import OnnxConfig from ...utils import logging __magic_name__ = logging.get_logger(__name__) __magic_name__ = { "facebook/xlm-roberta-xl": ...
100
"""simple docstring""" from functools import lru_cache def snake_case__ ( __lowerCamelCase : int ): """simple docstring""" lowerCamelCase__ : Optional[Any] =2 lowerCamelCase__ : Optional[int] =set() while i * i <= n: if n % i: i += 1 else: ...
238
0
import json import os import shutil import tempfile import unittest import numpy as np import pytest from transformers import CLIPTokenizer, CLIPTokenizerFast from transformers.models.clip.tokenization_clip import VOCAB_FILES_NAMES from transformers.testing_utils import require_vision from transformers.utils im...
357
import gc import random import unittest import numpy as np import torch from transformers import CLIPTextConfig, CLIPTextModel, CLIPTokenizer import diffusers from diffusers import ( AutoencoderKL, EulerDiscreteScheduler, StableDiffusionLatentUpscalePipeline, StableDiffusionPipeline, UNetaDC...
201
0
'''simple docstring''' def a_ ( __snake_case : list ) -> bool: """simple docstring""" if not isinstance(__snake_case , __snake_case ): raise ValueError('''Input series is not valid, valid series - [2, 4, 6]''' ) if len(__sna...
75
'''simple docstring''' from typing import Optional, Tuple, Union import torch from einops import rearrange, reduce from diffusers import DDIMScheduler, DDPMScheduler, DiffusionPipeline, ImagePipelineOutput, UNetaDConditionModel from diffusers.schedulers.scheduling_ddim import DDIMSchedulerOut...
208
0
'''simple docstring''' import json from typing import List, Optional, Tuple from tokenizers import normalizers from ...tokenization_utils_base import BatchEncoding from ...tokenization_utils_fast import PreTrainedTokenizerFast from ...utils import PaddingStrategy, logging from .tokenization_r...
368
'''simple docstring''' import os from shutil import copyfile from typing import Any, Dict, List, Optional, Tuple import sentencepiece as spm from ...tokenization_utils import PreTrainedTokenizer from ...utils import logging SCREAMING_SNAKE_CASE__ = logging.get_logger(__name__) ...
183
0
'''simple docstring''' from ..utils import DummyObject, requires_backends class a_ ( metaclass=_lowercase ): __A = ["torch", "scipy"] def __init__( self : List[Any] , *lowercase : List[str] , **lowercase : str ): ...
223
"""simple docstring""" def snake_case_ ( A_ : list[list] ): '''simple docstring''' _lowerCamelCase : Optional[int] = current_set.copy() for row_index, row in enumerate(A_ ): _lowerCamelCase : Tuple = row[0] ...
72
0
"""simple docstring""" from typing import Any def lowercase ( lowerCAmelCase__ : Dict ) -> Any: if not input_list: return [] __a = [input_list.count(lowercase__ ) for value in input_list] __a = max(lowercase__ ) # Gets the maxi...
361
"""simple docstring""" from __future__ import annotations def lowercase ( lowerCAmelCase__ : list[int] , lowerCAmelCase__ : list[int] , lowerCAmelCase__ : list[int] , lowerCAmelCase__ : list[list[str]] , lowerCAmelCase__ : int , ) -> None: __a ...
11
0
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 _UpperCAmelCase : Any = logging.get_logger(__name__) _UpperCAmelCase : List[Any] = {"voca...
236
import os import pytest from attr import dataclass _UpperCAmelCase : List[str] = "us-east-1" # defaults region @dataclass class __lowerCAmelCase : _a = 42 _a = '''arn:aws:iam::558105141721:role/sagemaker_execution_role''' _a = { ...
236
1
from collections import OrderedDict from typing import Mapping from packaging import version from ...configuration_utils import PretrainedConfig from ...onnx import OnnxConfig from ...utils import logging __UpperCamelCase : Any = logging.get_logger(__name__) __UpperCamelCase : List[Any...
355
import argparse import json import numpy import torch from transformers.models.xlm.tokenization_xlm import VOCAB_FILES_NAMES from transformers.utils import CONFIG_NAME, WEIGHTS_NAME, logging logging.set_verbosity_info() def A ( _lowercase , _lowercase ): # Load checkpoint S...
258
0
"""simple docstring""" import functools def _snake_case ( UpperCamelCase : str , UpperCamelCase : str ): UpperCAmelCase : str = len(UpperCamelCase ) UpperCAmelCase : int = len(UpperCamelCase ) @functools.cache def min_distance(UpperCamelCase : int ...
109
"""simple docstring""" from typing import TYPE_CHECKING from ...utils import ( OptionalDependencyNotAvailable, _LazyModule, is_flax_available, is_tf_available, is_tokenizers_available, is_torch_available, ) A: str = { "configuration_distilbert": [ "DISTILBERT_PRETRAI...
109
1
"""simple docstring""" from collections.abc import Sequence def SCREAMING_SNAKE_CASE ( _lowerCamelCase : Sequence[int] | None = None ) -> int: if nums is None or not nums: raise ValueError("""Input sequence should not be empty""" ) _lowerCAmelCase : Union[str, Any]...
351
"""simple docstring""" import socket def SCREAMING_SNAKE_CASE ( ) -> str: _lowerCAmelCase : Optional[int] = socket.socket(socket.AF_INET ,socket.SOCK_STREAM ) _lowerCAmelCase : Optional[int] = socket.gethostname() _lowerCAmelCase : Tuple ...
126
0
'''simple docstring''' def a__ ( a__ , a__ , a__ ): """simple docstring""" __SCREAMING_SNAKE_CASE = len(__snake_case ) __SCREAMING_SNAKE_CASE = [[0] * n for i in range(__snake_case )] for i in range(__snake_case ): ...
267
'''simple docstring''' from __future__ import annotations from numpy import array, cos, cross, floataa, radians, sin from numpy.typing import NDArray def _lowerCAmelCase ( __snake_case : float , __snake_case : float , __snake_case : bool = False ) -> ...
190
0
"""simple docstring""" __UpperCamelCase : Tuple = [ [0, 16, 13, 0, 0, 0], [0, 0, 10, 12, 0, 0], [0, 4, 0, 0, 14, 0], [0, 0, 9, 0, 0, 20], [0, 0, 0, 7, 0, 4], [0, 0, 0, 0, 0, 0], ] def _SCREAMING_SNAKE_CASE (_UpperCAmelCase : List[Any] , _UpperCAmelCase ...
309
"""simple docstring""" import unittest from accelerate import debug_launcher from accelerate.test_utils import require_cpu, test_ops, test_script @require_cpu class a ( unittest.TestCase ): def UpperCamelCase__ ( self ): """simple docstring""" debug_laun...
309
1
"""simple docstring""" class lowerCAmelCase__ : '''simple docstring''' def __init__( self : List[str] , lowercase_ : Optional[int]): '''simple docstring''' SCREAMING_SNAKE_CASE_ : List[Any] = arr.split(''',''') ...
91
from collections import OrderedDict from typing import Mapping from packaging import version from ...configuration_utils import PretrainedConfig from ...onnx import OnnxConfig from ...utils import logging from ..auto import CONFIG_MAPPING _UpperCamelCase = logging.get_logger(__name__) _UpperCamelCase = {...
275
0
"""simple docstring""" import gc import random import unittest import numpy as np import torch from PIL import Image from transformers import CLIPTextConfig, CLIPTextModel, CLIPTokenizer from diffusers import AutoencoderKL, DDIMScheduler, DDPMScheduler, StableDiffusionUpscalePipeline, UNetaDConditio...
359
from ...configuration_utils import PretrainedConfig from ...utils import logging lowerCamelCase_ : Tuple = logging.get_logger(__name__) lowerCamelCase_ : List[Any] = { """google/fnet-base""": """https://huggingface.co/google/fnet-base/resolve/main/config.json""", """google/fnet-la...
197
0
"""simple docstring""" import torch import torch.nn as nn from transformers import CLIPConfig, CLIPVisionModel, PreTrainedModel from ...utils import logging __UpperCamelCase = logging.get_logger(__name__) def UpperCAmelCase ( UpperCAmelCase , UpperCAmelCase ) -> int: ...
69
'''simple docstring''' def _SCREAMING_SNAKE_CASE ( UpperCamelCase = "The quick brown fox jumps over the lazy dog" , ): """simple docstring""" lowerCAmelCase__ : str = set() # Replace all the whitespace in our sentence lowerCAmelCase__ : Tuple ...
37
0
import torch from diffusers import EulerDiscreteScheduler from diffusers.utils import torch_device from .test_schedulers import SchedulerCommonTest class __lowerCAmelCase ( _a ): lowerCamelCase_ : List[Any] = (EulerDiscreteScheduler,) lowerCamelCase_ : Optional[Any] ...
359
from collections.abc import Iterator, MutableMapping from dataclasses import dataclass from typing import Generic, TypeVar lowerCAmelCase_ = TypeVar('''KEY''') lowerCAmelCase_ = TypeVar('''VAL''') @dataclass(frozen=_a, slots=_a ) class __lowerCAmelCase ( Generic[KEY, VAL] ): l...
279
0
import copy import os from typing import TYPE_CHECKING, List, Union if TYPE_CHECKING: pass from ...configuration_utils import PretrainedConfig from ...utils import logging __snake_case = logging.get_logger(__name__) __snake_case = { """kakaobrain/align-base""": """https://huggi...
259
import argparse import collections import numpy as np import torch from flax import traverse_util from tax import checkpoints from transformers import MTaConfig, UMTaEncoderModel, UMTaForConditionalGeneration from transformers.utils import logging logging.set_verbosity_info() def _A ( SCREAMING_SNAK...
259
1
"""simple docstring""" print((lambda quine: quine % quine)('''print((lambda quine: quine %% quine)(%r))'''))
38
"""simple docstring""" from math import sqrt def lowercase (SCREAMING_SNAKE_CASE_ : int ) -> int: SCREAMING_SNAKE_CASE = 0 for i in range(1 , int(sqrt(SCREAMING_SNAKE_CASE_ ) + 1 ) ): if n % i == 0 and i != sqrt(SCREAMING_SNAKE...
38
1
"""simple docstring""" def lowercase ( _snake_case : str ) ->list: """simple docstring""" if n_term == "": return [] __snake_case : list = [] for temp in range(int(_snake_case ) ): series.append(f"""1/{temp + 1}""" if series else '''1''' ) return s...
102
"""simple docstring""" def lowercase ( _snake_case : int , _snake_case : int ) ->str: """simple docstring""" if a < 0 or b < 0: raise ValueError('''the value of both inputs must be positive''' ) __snake_case : Tuple = str(bin(_snake_case ) ...
102
1
UpperCamelCase__ : Optional[int] = { 0: """0""", 1: """1""", 2: """2""", 3: """3""", 4: """4""", 5: """5""", 6: """6""", 7: """7""", 8: """8""", 9: """9""", 10: """a""", 11: """b""", 12: """c""", 13: """d""", 14: """e""",...
330
from __future__ import annotations import os from collections.abc import Mapping UpperCamelCase__ : Any = tuple[int, int] class lowerCamelCase_ : def __init__( self : Optional[Any] ,__lowerCamelCase : set[int] ,__lowerCamelCase ...
330
1
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 ...
99
import os from typing import List, Optional, Union from ...tokenization_utils import PreTrainedTokenizer from ...tokenization_utils_base import AddedToken from ...utils import logging _lowerCamelCase =logging.get_logger(__name__) _lowerCamelCase ={"vocab_file": "vocab.txt"} _lowerCamelC...
334
0
'''simple docstring''' import unittest import torch from torch import nn from diffusers.models.activations import get_activation class SCREAMING_SNAKE_CASE (unittest.TestCase ): def SCREAMING_SNAKE_CASE ( self): '''simple docstring''' ...
190
'''simple docstring''' from ...utils import ( OptionalDependencyNotAvailable, is_torch_available, is_transformers_available, is_transformers_version, ) try: if not (is_transformers_available() and is_torch_available()): raise OptionalDependencyNotAvailable() excep...
190
1
"""simple docstring""" class a__ : def __init__( self , _a , _a , _a ): lowercase : Optional[Any] = name lowercase : List[str] = value lowercase : List[str] = weight def __repr__( self ...
202
"""simple docstring""" from typing import TYPE_CHECKING from ...utils import ( OptionalDependencyNotAvailable, _LazyModule, is_sentencepiece_available, is_tokenizers_available, is_torch_available, ) _A : Optional[int] = { """configuration_llama""": [""...
202
1
def A__ ( lowerCamelCase ) -> list: return [ txt[:a] + txt[a].upper() + txt[a + 1 :] for a in range(len(lowerCamelCase ) ) if txt[a].isalpha() ] if __name__ == "__main__": __import__("""doctest""").testmod()
355
import argparse import os from pathlib import Path import torch from bark.generation import _load_model as _bark_load_model from huggingface_hub import hf_hub_download from transformers import EncodecConfig, EncodecModel, set_seed from transformers.models.bark.configuration_bark import ( BarkCoarseConfig, Ba...
223
0
'''simple docstring''' from __future__ import annotations def a ( __a ) -> list[int]: '''simple docstring''' UpperCamelCase__ :Union[str, Any] = 2 UpperCamelCase__ :Optional[Any] = [] while i * i <= n: if n % i: i += 1 ...
97
import copy import os import tempfile from unittest import TestCase from unittest.mock import patch import numpy as np import pyarrow as pa import pyarrow.parquet as pq import pytest from datasets.arrow_writer import ArrowWriter, OptimizedTypedSequence, ParquetWriter, TypedSequence from datasets.features import Arr...
334
0
'''simple docstring''' import warnings from ...processing_utils import ProcessorMixin from ...tokenization_utils_base import BatchEncoding class lowerCAmelCase_ ( UpperCAmelCase_ ): '''simple docstring''' UpperCamelCase_ : int = ["""image_pr...
334
'''simple docstring''' class lowerCAmelCase_ : '''simple docstring''' def __init__( self : Any , SCREAMING_SNAKE_CASE_ : str , SCREAMING_SNAKE_CASE_ : Optional[int] , SCREAMING_SNAKE_CASE_ : List[str] ) -> ...
334
1
'''simple docstring''' _lowercase : Optional[int] = { "Pillow": "Pillow", "accelerate": "accelerate>=0.11.0", "compel": "compel==0.1.8", "black": "black~=23.1", "datasets": "datasets", "filelock": "filelock", "flax": "flax>=0.4.1", "hf-doc-builde...
93
import inspect import unittest from transformers import DecisionTransformerConfig, is_torch_available from transformers.testing_utils import require_torch, slow, torch_device from ...generation.test_utils import GenerationTesterMixin from ...test_configuration_common import ConfigTester from ...test_mod...
110
0
from __future__ import annotations import os import tempfile import unittest from transformers import ConvBertConfig, is_tf_available from transformers.testing_utils import require_tf, slow from ...test_configuration_common import ConfigTester from ...test_modeling_tf_common import TFModelTesterMixin, ids_tensor...
290
import json from typing import List, Optional, Tuple from tokenizers import normalizers from tokenizers.pre_tokenizers import BertPreTokenizer, PreTokenizer from ...tokenization_utils_fast import PreTrainedTokenizerFast from ...utils import logging from .tokenization_roformer import RoFormerTokenizer from .tokeni...
290
1
import re import string import numpy as np import datasets _snake_case = ''' Returns the rate at which the input predicted strings exactly match their references, ignoring any strings input as part of the regexes_to_ignore list. ''' _snake_case = ''' Args: predic...
283
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 UpperCAmelCase_ ( UpperCamelCase ): '''simpl...
283
1
"""simple docstring""" import argparse import struct import unittest class snake_case_ : def __init__( self : Tuple , lowercase_ : bytes ) -> None: lowercase__ : Optional[int] = data # Initialize hash values lowe...
368
from ...configuration_utils import PretrainedConfig from ...utils import logging UpperCamelCase = logging.get_logger(__name__) UpperCamelCase = { '''facebook/vit-mae-base''': '''https://huggingface.co/facebook/vit-mae-base/resolve/main/config.json''', # See all ViT MAE model...
333
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 __U...
141
'''simple docstring''' import gc import random import unittest import numpy as np import torch from PIL import Image from diffusers import ( DDIMScheduler, KandinskyVaaImgaImgPipeline, KandinskyVaaPriorPipeline, UNetaDConditionModel, VQModel, ) from diffusers.utils import floats_tensor, load_im...
141
1
import os import tempfile import unittest from transformers import FlaubertConfig, is_torch_available from transformers.testing_utils import require_torch, require_torch_gpu, slow, torch_device from ...test_configuration_common import ConfigTester from ...test_modeling_common import ModelTesterMixin, ids_tensor, ra...
354
import gc import random import unittest import numpy as np import torch from PIL import Image from diffusers import ( DDIMScheduler, KandinskyVaaImgaImgPipeline, KandinskyVaaPriorPipeline, UNetaDConditionModel, VQModel, ) from diffusers.utils import floats_tensor, load_image, load_numpy, slow, t...
141
0
import os import unittest from transformers import BatchEncoding from transformers.models.bert.tokenization_bert import ( BasicTokenizer, WordpieceTokenizer, _is_control, _is_punctuation, _is_whitespace, ) from transformers.models.prophetnet.tokenization_prophetnet import VOCAB_FILES_NAMES, Prophe...
299
import warnings from contextlib import contextmanager from ...processing_utils import ProcessorMixin from .feature_extraction_wavaveca import WavaVecaFeatureExtractor from .tokenization_wavaveca import WavaVecaCTCTokenizer class UpperCamelCase__ ( __SCREAMING_SNAKE_CASE ): """sim...
299
1
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, is_vision_available from t...
305
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, BlipaProcessor, BlipImageProces...
305
1
import io import itertools import json from dataclasses import dataclass from typing import Optional import pyarrow as pa import pyarrow.json as paj import datasets from datasets.table import table_cast from datasets.utils.file_utils import readline _UpperCamelCase = datasets.utils.logging.get_logger(__name__...
275
'''simple docstring''' import inspect import unittest from transformers import SegformerConfig, is_torch_available, is_vision_available from transformers.models.auto import get_values from transformers.testing_utils import require_torch, slow, torch_device from ...test_configuration_co...
70
0
'''simple docstring''' import logging import os import threading import time try: import warnings except ImportError: _UpperCAmelCase : Any = None try: import msvcrt except ImportError: _UpperCAmelCase : Any = None try: import fcntl except ImportError:...
371
'''simple docstring''' from collections import OrderedDict from typing import Mapping from ...configuration_utils import PretrainedConfig from ...onnx import OnnxConfig from ...utils import logging _UpperCAmelCase : str = logging.get_logger(__name__) _UpperCAmelCase : str ...
9
0
"""simple docstring""" import inspect from typing import Callable, List, Optional, Union import torch from transformers import ( CLIPImageProcessor, CLIPTextModel, CLIPTokenizer, WhisperForConditionalGeneration, WhisperProcessor, ) from diffusers import ( AutoencoderKL, DDIMScheduler, ...
109
"""simple docstring""" A: int = range(2, 2_0 + 1) A: Any = [1_0**k for k in range(ks[-1] + 1)] A: dict[int, dict[int, list[list[int]]]] = {} def _snake_case ( UpperCamelCase : Dict , UpperCamelCase : Any , UpperCamelCase : Any , UpperCamelCas...
109
1
'''simple docstring''' import os from shutil import copyfile from typing import List, Optional, Tuple from tokenizers import processors from ...tokenization_utils import AddedToken, BatchEncoding from ...tokenization_utils_fast import PreTrainedTokenizerFast from ...utils import is_sentencepiece_available, loggi...
107
'''simple docstring''' from __future__ import annotations from collections.abc import Iterator from typing import Any class __magic_name__ : def __init__( self : Dict ,_UpperCAmelCase : Any ): _a : Any = data _a : Node | None = ...
107
1
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 lowercase__ : str = logging.get_logger(__name__) lowercase_...
328
from __future__ import annotations import math def A_ ( snake_case : int ) -> bool: '''simple docstring''' if 1 < number < 4: # 2 and 3 are primes return True elif number < 2 or number % 2 == 0 or number % 3 == 0: # Neg...
328
1
'''simple docstring''' import os import tempfile import unittest from transformers.models.marian.convert_marian_tatoeba_to_pytorch import DEFAULT_REPO, TatoebaConverter from transformers.testing_utils import slow from transformers.utils import cached_property @unittest.skipUnless(os.path.exists(A ) , ...
48
'''simple docstring''' from math import factorial def _A ( _lowerCAmelCase = 20 ): """simple docstring""" __lowercase =2 * n # middle entry of odd rows starting at row 3 is the solution for n = 1, # 2, 3,... __lowercase =n // 2 return int(facto...
48
1
"""simple docstring""" from typing import Callable, Optional from .. import Features from ..packaged_modules.generator.generator import Generator from .abc import AbstractDatasetInputStream class lowerCAmelCase_ ( lowerCAmelCase ): """simple docstring""" def __init__( self ...
150
"""simple docstring""" def lowerCAmelCase__ ( _UpperCamelCase : list[int] ) -> int: """simple docstring""" if not numbers: return 0 if not isinstance(_UpperCamelCase , (list, tuple) ) or not all( isinstance(_UpperCamelCase ...
150
1
import sys from collections import defaultdict class SCREAMING_SNAKE_CASE : """simple docstring""" def __init__( self: Optional[int] ) -> Union[str, Any]: _A = [] def __A ( self: Any , __A: Tuple ) -> str: ...
367
# Copyright 2023 The HuggingFace Inc. team. All rights reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required ...
75
0
from collections import deque from math import floor from random import random from time import time class __lowerCamelCase : """simple docstring""" def __init__( self ): """simple docstring""" _UpperCAmelCase = {} ...
39
import os import tempfile import unittest import numpy as np from diffusers.utils import is_flax_available from diffusers.utils.testing_utils import require_flax, slow if is_flax_available(): import jax import jax.numpy as jnp from flax.jax_utils import replicate from flax.traini...
39
1
"""simple docstring""" from typing import TYPE_CHECKING from ...utils import OptionalDependencyNotAvailable, _LazyModule, is_torch_available __snake_case = { """configuration_instructblip""": [ """INSTRUCTBLIP_PRETRAINED_CONFIG_ARCHIVE_MAP""", """InstructBlipConfig""", ...
352
"""simple docstring""" def __lowerCAmelCase ( lowercase : int ) -> int: """simple docstring""" if not isinstance(lowercase , lowercase ): raise ValueError("Input must be an integer" ) if input_num <= 0: raise ValueError("Input must be posi...
112
0
lowerCAmelCase__ = { 'a': 'AAAAA', 'b': 'AAAAB', 'c': 'AAABA', 'd': 'AAABB', 'e': 'AABAA', 'f': 'AABAB', 'g': 'AABBA', 'h': 'AABBB', 'i': 'ABAAA', 'j': 'BBBAA', 'k': 'ABAAB', 'l': 'ABABA', 'm': 'ABABB', 'n': 'ABBAA', 'o': 'ABBAB', 'p': 'ABBBA', ...
11
import warnings from typing import List import numpy as np from ...processing_utils import ProcessorMixin from ...tokenization_utils_base import BatchEncoding from ...utils import is_flax_available, is_tf_available, is_torch_available class lowerCAmelCase__ ( a): '''simple docstring''...
11
1
"""simple docstring""" import os import zipfile import requests from get_ci_error_statistics import download_artifact, get_artifacts_links def UpperCAmelCase ( UpperCamelCase__ , UpperCamelCase__=7 ): """simple docstring""" A__ ...
361
"""simple docstring""" from typing import TYPE_CHECKING from ...utils import OptionalDependencyNotAvailable, _LazyModule, is_torch_available __lowerCamelCase = { "configuration_timesformer": ["TIMESFORMER_PRETRAINED_CONFIG_ARCHIVE_MAP", "TimesformerConfig"], } try: if not is_...
154
0
"""simple docstring""" from typing import TYPE_CHECKING # rely on isort to merge the imports from ...utils import OptionalDependencyNotAvailable, _LazyModule, is_torch_available lowerCAmelCase__ = { '''configuration_autoformer''': [ '''AUTOFORMER_PRETRAINED_CONFIG_ARCHIVE_MAP''', ...
72
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_inpu...
184
0
from __future__ import annotations import math from collections import Counter from string import ascii_lowercase def UpperCAmelCase_ ( __UpperCAmelCase : str ) -> None: SCREAMING_SNAKE_CASE_ , SCREAMING_SNAKE_CASE_ = analyze_text(__UpperCAmelCase ) ...
210
import random from typing import Any def UpperCAmelCase_ ( __UpperCAmelCase : list ) -> list[Any]: for _ in range(len(__UpperCAmelCase ) ): SCREAMING_SNAKE_CASE_ = random.randint(0 , len(__UpperCAmelCase ) - 1 ) ...
210
1
import unittest import numpy as np from transformers.testing_utils import is_flaky, 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_avail...
196
from typing import Optional import torch import torch.utils.checkpoint from torch import Tensor, nn from torch.nn import BCEWithLogitsLoss, CrossEntropyLoss, MSELoss from ...activations import ACTaFN from ...file_utils import add_code_sample_docstrings, add_start_docstrings, add_start_docstrings_to_mode...
196
1
from datetime import datetime import matplotlib.pyplot as plt import torch def UpperCamelCase ( lowerCAmelCase__ ): '''simple docstring''' for param in module.parameters(): lowercase = False def UpperCamelCase ( ): '''simple docstring''' lowercase ...
350
import torch from torch import nn from torch.nn import CrossEntropyLoss, MSELoss from transformers.file_utils import add_start_docstrings, add_start_docstrings_to_model_forward from transformers.models.bert.modeling_bert import ( BERT_INPUTS_DOCSTRING, BERT_START_DOCSTRING, BertEmbeddings, BertLayer, ...
97
0
import json import os import unittest from transformers import CLIPTokenizer, CLIPTokenizerFast from transformers.models.clip.tokenization_clip import VOCAB_FILES_NAMES from transformers.testing_utils import require_ftfy, require_tokenizers from ...test_tokenization_common import TokenizerTesterMixin ...
127
import re import time from typing import Optional import IPython.display as disp from ..trainer_callback import TrainerCallback from ..trainer_utils import IntervalStrategy, has_length def UpperCAmelCase__ (UpperCamelCase_ ): """simple docstring""" snake_case =...
127
1
"""simple docstring""" import os from shutil import copyfile from typing import List, Optional, Tuple import sentencepiece as spm from ...tokenization_utils import PreTrainedTokenizer from ...utils import logging lowerCAmelCase_ : Optional[int] = logging.get_logger(__name__) lowerCAme...
369
"""simple docstring""" from __future__ import annotations import math def _lowerCAmelCase ( lowerCAmelCase ): '''simple docstring''' if 1 < number < 4: # 2 and 3 are primes return True elif number < 2 or number % 2 == 0 or number % 3...
248
0
'''simple docstring''' from __future__ import annotations import math from collections.abc import Callable def a__ ( a__ , a__ , a__ , a__ = 1_00 , ): """simple docstring""" __SCREAMING_SNAKE_CASE = x_start __SCREAMING_SNAKE_CASE =...
267
'''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 # # ...
267
1
import inspect import unittest from datasets import load_dataset from packaging import version from transformers import BeitConfig from transformers.models.auto import get_values from transformers.testing_utils import require_torch, require_torch_multi_gpu, require_vision, slow, torch_device from transformers.util...
134
import warnings from typing import List import numpy as np from ...processing_utils import ProcessorMixin from ...tokenization_utils_base import BatchEncoding from ...utils import is_flax_available, is_tf_available, is_torch_available class a (_lowerCAmelCase ): """simple docstring""" ...
134
1
"""simple docstring""" from typing import TYPE_CHECKING from ...utils import _LazyModule a :List[str] = {'tokenization_wav2vec2_phoneme': ['Wav2Vec2PhonemeCTCTokenizer']} if TYPE_CHECKING: from .tokenization_wavaveca_phoneme import WavaVecaPhonemeCTCTokenizer else: import sys a :Any = ...
132
from collections import OrderedDict from typing import TYPE_CHECKING, Any, Mapping, Optional, Union from ...configuration_utils import PretrainedConfig from ...onnx import OnnxConfig from ...utils import logging if TYPE_CHECKING: from ... import FeatureExtractionMixin, PreTrainedTokenizerBase, TensorType ...
137
0
from typing import TYPE_CHECKING from ...utils import ( OptionalDependencyNotAvailable, _LazyModule, is_tf_available, is_torch_available, is_vision_available, ) __UpperCAmelCase = { '''configuration_blip''': [ '''BLIP_PRETRAINED_CONFIG_ARCHIVE_MAP''', '''BlipCo...
354
import os import unicodedata from shutil import copyfile from typing import Any, Dict, List, Optional, Tuple import sentencepiece as spm from ...tokenization_utils import AddedToken, PreTrainedTokenizer from ...utils import SPIECE_UNDERLINE, logging __UpperCAmelCase = logging.get_logger(__name__) _...
42
0
import random def _UpperCAmelCase ( SCREAMING_SNAKE_CASE__ : int ): __UpperCamelCase =num - 1 __UpperCamelCase =0 while s % 2 == 0: __UpperCamelCase =s // 2 t += 1 for _ in range(5 ): __UpperCamelCase ...
62
from typing import TYPE_CHECKING from ...utils import ( OptionalDependencyNotAvailable, _LazyModule, is_sentencepiece_available, is_speech_available, is_tf_available, is_torch_available, ) __A : Union[str, Any] = { "configuration_speech_to_text": ["SPEECH_TO_TEXT_PRETR...
273
0
class _lowerCAmelCase : """simple docstring""" def __init__( self : List[Any], UpperCAmelCase__ : str = "", UpperCAmelCase__ : bool = False ): __lowercase = {} # A node will be a leaf if the tree contains its word __lowercase ...
360
"""simple docstring""" from ...configuration_utils import PretrainedConfig from ...utils import logging _a = logging.get_logger(__name__) _a = { 'MIT/ast-finetuned-audioset-10-10-0.4593': ( 'https://huggingface.co/MIT/ast-finetuned-audioset-10-10-0.4593/resolve/main/config....
144
0
# 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 # # Unless...
306
import unittest from transformers import GPTNeoXJapaneseConfig, is_torch_available from transformers.models.gpt_neox_japanese.tokenization_gpt_neox_japanese import GPTNeoXJapaneseTokenizer from transformers.testing_utils import require_torch, slow, torch_device from ...test_configuration_common import ConfigTe...
178
0
def _SCREAMING_SNAKE_CASE ( SCREAMING_SNAKE_CASE ): A_ : List[str] = 0 A_ : str = len(SCREAMING_SNAKE_CASE ) for i in range(n - 1 ): for j in range(i + 1 , SCREAMING_SNAKE_CASE ): if arr[i] > arr[j]: num_inversions += 1 return num_inversions def ...
363
import warnings from ...utils import logging from .image_processing_yolos import YolosImageProcessor UpperCamelCase = logging.get_logger(__name__) class _lowerCamelCase ( UpperCamelCase ): """simple docstring""" def __init__( self , *_SCREAMING_SNAKE_CASE , ...
65
0
def lowerCAmelCase__ ( _SCREAMING_SNAKE_CASE : int ): """simple docstring""" return [ { 0: [1, 2], 1: [0, 2], 2: [0, 1, 3, 5], 3: [2, 4], 4: [3], 5: [2, 6, 8], 6: [5, 7], 7: [6, 8]...
302
from typing import TYPE_CHECKING from ...utils import ( OptionalDependencyNotAvailable, _LazyModule, is_tf_available, is_torch_available, is_vision_available, ) lowerCamelCase__ = { """configuration_blip""": [ """BLIP_PRETRAINED_CONFIG_ARCHIVE_MAP""", """BlipConfig""...
302
1
"""simple docstring""" from __future__ import annotations from collections import namedtuple from dataclasses import dataclass @dataclass class lowercase__ : '''simple docstring''' UpperCamelCase = 42 UpperCamelCase = N...
351
"""simple docstring""" import warnings from ...utils import logging from .image_processing_flava import FlavaImageProcessor lowerCamelCase = logging.get_logger(__name__) class lowercase__ ( SCREAMING_SNAKE_CASE ): '''simple docstring''' ...
241
0
import gc import unittest import numpy as np import torch from transformers import CLIPTextConfig, CLIPTextModel, XLMRobertaTokenizer from diffusers import AltDiffusionPipeline, AutoencoderKL, DDIMScheduler, PNDMScheduler, UNetaDConditionModel from diffusers.pipelines.alt_diffusion.modeling_roberta_...
308
from __future__ import annotations from typing import Any def snake_case( __magic_name__ ) -> None: '''simple docstring''' create_state_space_tree(__magic_name__ , [] , 0 ) def snake_case( __magic_name__ , __magic_name__ , ...
308
1
"""simple docstring""" def _snake_case ( lowerCamelCase__ : list[list] ) -> list[list]: lowerCamelCase_ : Optional[Any] =current_set.copy() for row_index, row in enumerate(lowerCamelCase__ ): lowerCamelCase_ : List[str] =row[0] ...
209
"""simple docstring""" import darl # noqa import gym import tqdm from diffusers.experimental import ValueGuidedRLPipeline A__ : int = { 'n_samples': 64, 'horizon': 32, 'num_inference_steps': 20, 'n_guide_steps': 2, # can set to 0 for faster sampling, does not use value network 's...
209
1
from copy import deepcopy import torch import torch.nn.functional as F from torch.optim import AdamW from torch.optim.lr_scheduler import LambdaLR from torch.utils.data import DataLoader from accelerate.accelerator import Accelerator from accelerate.state import GradientState from accelerate.test_utils import Regres...
328
import math def A_ ( snake_case : int ) -> bool: '''simple docstring''' return math.sqrt(snake_case ) * math.sqrt(snake_case ) == num def A_ ( snake_case : int ) -> bool: '''simple docstring''' ...
328
1
import argparse import random import joblib import numpy as np import torch from igf.igf import ( SecondaryLearner, collect_objective_set, compute_perplexity, generate_datasets, load_gpta, recopy_gpta, set_seed, train_secondary_learner, ) from torch.utils.data import DataLoader, Ra...
363
from typing import TYPE_CHECKING from ...utils import ( OptionalDependencyNotAvailable, _LazyModule, is_sentencepiece_available, is_tf_available, is_tokenizers_available, is_torch_available, ) _A = { '''configuration_rembert''': ['''REMBERT_PRETRAINED_CONFIG_ARCHIVE_MAP'...
167
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, ) _lowerCamelCase : List[Any] = { 'configuration_roformer': ['ROFORME...
258
'''simple docstring''' from dataclasses import dataclass from typing import List, Optional, Union import numpy as np import PIL import torch from transformers import CLIPImageProcessor, CLIPVisionModel from ...models import PriorTransformer from ...pipelines import DiffusionPipeline from ...schedulers import ...
258
1
class _UpperCAmelCase : """simple docstring""" def __init__( self : Dict ) -> str: __lowerCAmelCase = 0 __lowerCAmelCase = 0 __lowerCAmelCase = {} def lowercase ( self : List[Any] , lowerCAmelCase_ ...
366
import mpmath # for roots of unity import numpy as np class _UpperCAmelCase : """simple docstring""" def __init__( self : List[Any] , lowerCAmelCase_ : Dict=None , lowerCAmelCase_ : str=None ) -> List[Any]: # Input as list __lowerCAmelCase = l...
207
0
import unittest from transformers import ( MODEL_FOR_SEQUENCE_CLASSIFICATION_MAPPING, TF_MODEL_FOR_SEQUENCE_CLASSIFICATION_MAPPING, TextClassificationPipeline, pipeline, ) from transformers.testing_utils import is_pipeline_test, nested_simplify, require_tf, require_torch, slow from .test_pipeli...
340
'''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 __a = logging.get_logger(__name__) __...
145
0
def snake_case( __magic_name__ , __magic_name__ ) -> Any: '''simple docstring''' while b: lowercase , lowercase : Optional[int] = b, a % b return a def snake_case( __magic_name__ , __magic_name__ ) -> ...
359
def snake_case( __magic_name__ , __magic_name__ ) -> bool: '''simple docstring''' lowercase : List[Any] = len(__magic_name__ ) lowercase : str = [[False] * (required_sum + 1) for _ in range(arr_len + 1 )] # for each arr v...
116
0
import inspect import unittest import numpy as np from transformers import ViTConfig, is_flax_available from transformers.testing_utils import require_flax, slow from ...test_configuration_common import ConfigTester from ...test_modeling_flax_common import FlaxModelTesterMixin, floats_tensor if is_flax_available...
275
from ....configuration_utils import PretrainedConfig from ....utils import logging _UpperCamelCase = logging.get_logger(__name__) _UpperCamelCase = { "CarlCochet/trajectory-transformer-halfcheetah-medium-v2": ( "https://huggingface.co/CarlCochet/trajectory-transformer-halfcheetah-medium-v2/reso...
275
1
from __future__ import annotations import unittest from transformers import XGLMConfig, XGLMTokenizer, is_tf_available from transformers.testing_utils import require_tf, slow from ...test_configuration_common import ConfigTester from ...test_modeling_tf_common import TFModelTesterMixin, floats_tensor, ids_tensor, ra...
364
import argparse import hashlib import os import urllib import warnings import torch from torch import nn from tqdm import tqdm from transformers import WhisperConfig, WhisperForConditionalGeneration _lowercase: List[Any] = { "tiny.en": "https://openaipublic.azureedge.net/main/whisper/models/d3dd...
71
0
class __lowerCAmelCase : """simple docstring""" def __init__( self , lowerCamelCase__ ) -> Any: '''simple docstring''' __lowerCamelCase = n __lowerCamelCase = [None] * self.n __lowerCamelCase ...
90
import re import string import numpy as np import datasets _SCREAMING_SNAKE_CASE : Union[str, Any] = "\nReturns the rate at which the input predicted strings exactly match their references, ignoring any strings input as part of the regexes_to_ignore list.\n" _SCREAMING_SNAKE_CASE : T...
127
0
import argparse import torch from transformers import YosoConfig, YosoForMaskedLM def __a ( lowerCAmelCase_ : int ) -> List[str]: '''simple docstring''' if "model" in orig_key: UpperCAmelCase_= orig_key.replace("""model.""" ,"""""" ) if ...
356
from typing import Optional import pyspark from .. import Features, NamedSplit from ..download import DownloadMode from ..packaged_modules.spark.spark import Spark from .abc import AbstractDatasetReader class lowercase ( snake_case__): """simple docstring""" def __init__( self : ...
277
0
from __future__ import annotations def _lowercase ( UpperCamelCase_ ) -> list[int]: # This function is recursive '''simple docstring''' SCREAMING_SNAKE_CASE__ = len(UpperCamelCase_ ) # If the array contains only one element, we return it (it's the stop condition...
176
import argparse import fairseq import torch from torch import nn from transformers import ( MBartaaTokenizer, MBartConfig, MBartForCausalLM, SpeechEncoderDecoderConfig, SpeechEncoderDecoderModel, WavaVecaConfig, WavaVecaFeatureExtractor, WavaVecaModel, logging, ) logging.set_ver...
176
1
'''simple docstring''' import argparse import json from typing import List from ltp import LTP from transformers import BertTokenizer def _UpperCAmelCase ( _UpperCamelCase : Dict ) -> Union[str, Any]: # This defines a "chinese character" as anything in the CJK Unicode bloc...
366
'''simple docstring''' from diffusers.utils.testing_utils import require_onnxruntime @require_onnxruntime class __UpperCAmelCase : '''simple docstring''' pass
18
0
"""simple docstring""" from dataclasses import dataclass from typing import List, Optional, Union import numpy as np import PIL from PIL import Image from ...utils import ( BaseOutput, OptionalDependencyNotAvailable, is_flax_available, is_k_diffusion_available, is_k_diffusion_version, i...
106
"""simple docstring""" from __future__ import annotations class snake_case : '''simple docstring''' def __init__( self : int, _lowerCamelCase : List[Any]=None ): '''simple docstring''' __A = data __A = None def __repr__( self : Union[...
266
0
import importlib import os import sys # This is required to make the module import works (when the python process is running from the root of the repo) sys.path.append(".") def UpperCamelCase_( _snake_case : str ): """simple docstring""" __a =t...
308
import hashlib import unittest from transformers import MODEL_FOR_DEPTH_ESTIMATION_MAPPING, is_torch_available, is_vision_available from transformers.pipelines import DepthEstimationPipeline, pipeline from transformers.testing_utils import ( is_pipeline_test, nested_simplify, require_tf, r...
308
1