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
def a( A : list ) -> list: """simple docstring""" if len(lowerCamelCase__ ) <= 1: return [tuple(lowerCamelCase__ )] a = [] def generate(A : int , A : list ): if k == 1: res...
227
"""simple docstring""" import copy import os from typing import Union from ...configuration_utils import PretrainedConfig from ...utils import logging A__ : int = logging.get_logger(__name__) A__ : List[str] = { 'google/pix2struct-textcaps-base': ( 'https://...
144
0
'''simple docstring''' from typing import List, Optional from ...configuration_utils import PretrainedConfig from ...utils import logging A__ : List[str] = logging.get_logger(__name__) A__ : Optional[Any] = { '''huggingface/autoformer-tourism-monthly''': '''...
358
'''simple docstring''' import json import os import shutil import tempfile import unittest import numpy as np from transformers import BertTokenizerFast from transformers.models.bert.tokenization_bert import VOCAB_FILES_NAMES, BertTokenizer from transformers.testing_utils import require_tokenizers, require_v...
0
0
import importlib import json import os from collections import OrderedDict from typing import Dict, Optional, Union # Build the list of all feature extractors from ...configuration_utils import PretrainedConfig from ...dynamic_module_utils import get_class_from_dynamic_module, resolve_trust_remote_code from ...featur...
328
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, ) from ...
328
1
import json import os import unittest from transformers import AutoTokenizer, GPTaTokenizer, GPTaTokenizerFast from transformers.models.gpta.tokenization_gpta import VOCAB_FILES_NAMES from transformers.testing_utils import require_tokenizers from ...test_tokenization_common import TokenizerTesterMixin @re...
367
import unittest from transformers import PegasusTokenizer, PegasusTokenizerFast from transformers.testing_utils import get_tests_dir, require_sentencepiece, require_tokenizers, require_torch, slow from transformers.utils import cached_property from ...test_tokenization_common import TokenizerTesterMixin _Uppe...
232
0
import unittest from transformers import ( MODEL_FOR_SEQ_TO_SEQ_CAUSAL_LM_MAPPING, TF_MODEL_FOR_SEQ_TO_SEQ_CAUSAL_LM_MAPPING, TextaTextGenerationPipeline, pipeline, ) from transformers.testing_utils import is_pipeline_test, require_tf, require_torch from transformers.utils import is_torch_available ...
13
import json import os from functools import lru_cache from typing import List, Optional, Tuple import regex as re from ...tokenization_utils import AddedToken, PreTrainedTokenizer from ...utils import logging lowerCAmelCase : Any = logging.get_logger(__name__) lowerCAmelCase : Tuple = ...
13
1
"""simple docstring""" from dataclasses import dataclass, field from typing import Tuple from ..utils import cached_property, is_torch_available, is_torch_tpu_available, logging, requires_backends from .benchmark_args_utils import BenchmarkArguments if is_torch_available(): import torch i...
362
"""simple docstring""" from math import factorial, radians def _lowerCAmelCase ( lowercase_ , lowercase_ = 18 , lowercase_ = 10 ): UpperCAmelCase = angle_in_degrees - ((angle_in_degrees // 3_6_0.0) * 3_6_0.0) # Converting from degrees to radians Up...
181
0
"""simple docstring""" from typing import List, Optional, Union from ...image_utils import ImageInput from ...processing_utils import ProcessorMixin from ...tokenization_utils_base import BatchEncoding, PaddingStrategy, PreTokenizedInput, TextInput, TruncationStrategy from ...utils import TensorType class ...
100
'''simple docstring''' def __lowerCAmelCase ( snake_case__ ): return "".join([hex(snake_case__ )[2:].zfill(2 ).upper() for byte in list(snake_case__ )] ) def __lowerCAmelCase ( snake_case__ ): # Check data validity, following RFC3548 ...
298
0
from __future__ import annotations import math import numpy as np from numpy.linalg import norm def UpperCamelCase__( UpperCamelCase__ : np.ndarray , UpperCamelCase__ : np.ndarray )->Dict: return math.sqrt(sum(pow(a - b , 2 ) for a, b in zip(UpperCamelCase__ ...
363
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 SCREAMING_SNAKE_CASE__ ( UpperCamelCas...
39
0
def UpperCamelCase ( __magic_name__ : int ) -> int: """simple docstring""" assert isinstance(__magic_name__ , __magic_name__ ), f'''The input value of [n={number}] is not an integer''' if number == 1: return 2 elif number < 1: lowercase__ = f...
305
import json import os import shutil import tempfile import unittest import numpy as np from transformers import BertTokenizerFast from transformers.models.bert.tokenization_bert import VOCAB_FILES_NAMES, BertTokenizer from transformers.testing_utils import require_tokenizers, require_vision f...
0
0
import unittest from transformers import BigBirdTokenizer, BigBirdTokenizerFast from transformers.testing_utils import get_tests_dir, require_sentencepiece, require_tokenizers, require_torch, slow from transformers.utils import cached_property from ...test_tokenization_common import TokenizerTesterMixin _snake_ca...
351
'''simple docstring''' 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_ ): _SCREAM...
199
0
'''simple docstring''' import itertools import random import unittest import numpy as np from transformers import ASTFeatureExtractor from transformers.testing_utils import require_torch, require_torchaudio from transformers.utils.import_utils import is_torch_available from ...test_sequence_feature_extractio...
112
from __future__ import annotations import math lowercase : Any = '2020.9.26' lowercase : Union[str, Any] = 'xcodz-dot, cclaus, dhruvmanila' def _SCREAMING_SNAKE_CASE ( _lowerCamelCase : float , _lowerCamelCase : float , _lowerCamelCas...
232
0
'''simple docstring''' import os import torch from ..logging import get_logger from .constants import FSDP_PYTORCH_VERSION, MODEL_NAME, OPTIMIZER_NAME from .versions import is_torch_version if is_torch_version('>=', FSDP_PYTORCH_VERSION): import torch.distributed.checkpoint as dist_cp from to...
8
'''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
1
"""simple docstring""" class lowerCAmelCase_ : '''simple docstring''' def __init__( self : Union[str, Any] ,A_ : list ) -> None: A = set_counts A = max(A_ ) A = len(A_ ) A = [1] * nu...
74
'''simple docstring''' from typing import TYPE_CHECKING from ...utils import ( OptionalDependencyNotAvailable, _LazyModule, is_sentencepiece_available, is_tf_available, is_tokenizers_available, is_torch_available, ) UpperCamelCase__ = { '''configuration_re...
181
0
import argparse import struct import unittest class UpperCamelCase__ : def __init__(self : int , snake_case_ : bytes ): __a : Dict = data # Initialize hash values __a : Dict = [ 0X6a09_e667, 0Xbb67_ae85, 0X3c6e_f372, 0Xa54f_f53a, ...
90
def __UpperCamelCase ( lowerCAmelCase__ : str , lowerCAmelCase__ : str ): __a : Any = len(lowerCAmelCase__ ) __a : Union[str, Any] = [] for i in range(len(lowerCAmelCase__ ) - pat_len + 1 ): __a : List[Any] = True for j in range(lowerCAmelCas...
90
1
'''simple docstring''' from collections import OrderedDict from typing import Any, Mapping, Optional from ... import PreTrainedTokenizer from ...configuration_utils import PretrainedConfig from ...onnx import OnnxConfig, OnnxConfigWithPast, OnnxSeqaSeqConfigWithPast from ...onnx.utils import compute_effect...
34
import os import unittest from transformers.models.transfo_xl.tokenization_transfo_xl import VOCAB_FILES_NAMES, TransfoXLTokenizer from ...test_tokenization_common import TokenizerTesterMixin class __lowerCamelCase ( snake_case__ , unittest.TestCase): """simple...
39
0
import unittest from transformers.testing_utils import CaptureStdout from transformers.tools.python_interpreter import evaluate def lowerCamelCase_ ( _UpperCamelCase ) -> str: """simple docstring""" return x + 2 class __lowerCAmelCase ( unittest.TestCase ...
360
import random from .binary_exp_mod import bin_exp_mod def lowerCamelCase_ ( _UpperCamelCase , _UpperCamelCase=1_000 ) -> str: """simple docstring""" if n < 2: return False if n % 2 == 0: return n == 2 # this means n is odd snake_case_ ...
279
0
"""simple docstring""" # using dfs for finding eulerian path traversal def UpperCAmelCase ( UpperCamelCase__ , UpperCamelCase__ , UpperCamelCase__ , UpperCamelCase__=None ): """simple docstring""" A__ = (path or []) + ...
221
import flax.linen as nn import jax.numpy as jnp from .attention_flax import FlaxTransformeraDModel from .resnet_flax import FlaxDownsampleaD, FlaxResnetBlockaD, FlaxUpsampleaD class A ( nn.Module ): UpperCamelCase__ : int UpperCamelCase__ : int UpperCamelCase__ : fl...
199
0
'''simple docstring''' import unittest from transformers import TrOCRConfig from transformers.testing_utils import is_torch_available, require_torch, torch_device from ...generation.test_utils import GenerationTesterMixin from ...test_configuration_common import ConfigTester from ...test_modeling_common impor...
354
'''simple docstring''' from collections import OrderedDict from typing import Mapping from ...configuration_utils import PretrainedConfig from ...onnx import OnnxConfig from ...utils import logging lowerCamelCase :Any = logging.get_logger(__name__) lowerCamelCase :List[Any] = { '...
135
0
import os import torch from ..logging import get_logger from .constants import FSDP_PYTORCH_VERSION, MODEL_NAME, OPTIMIZER_NAME from .versions import is_torch_version if is_torch_version('''>=''', FSDP_PYTORCH_VERSION): import torch.distributed.checkpoint as dist_cp from torch.distributed.c...
8
import math def __SCREAMING_SNAKE_CASE (SCREAMING_SNAKE_CASE__ , SCREAMING_SNAKE_CASE__ ): if 0 not in (x, y): # We use the relation x^y = y*log10(x), where 10 is the base. return y * math.logaa(SCREAMING_SNAKE_CASE__ ) else: if x == 0: ...
8
1
def _snake_case( SCREAMING_SNAKE_CASE__ : float , SCREAMING_SNAKE_CASE__ : float ) -> float: '''simple docstring''' if mass < 0: raise ValueError('The mass of a body cannot be negative' ) return 0.5 * mass * abs(SCREA...
365
import unittest from transformers import LiltConfig, 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_modeling_common import ModelTesterMi...
282
0
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 __A ...
90
from typing import List, Optional import numpy as np from ...processing_utils import ProcessorMixin from ...utils import to_numpy class __lowerCAmelCase ( __magic_name__ ): """simple docstring""" snake_case_ = '''EncodecFeatureExtractor''' ...
90
1
'''simple docstring''' def _snake_case ( A = 10 , A = 22 ) -> int: lowerCAmelCase__ = range(1 , A ) lowerCAmelCase__ = range(1 , A ) return sum( 1 for power in powers for base in bases if len(str(base**power ) ) =...
228
'''simple docstring''' from sklearn.metrics import fa_score, matthews_corrcoef import datasets from .record_evaluation import evaluate as evaluate_record __UpperCAmelCase = '''\ @article{wang2019superglue, title={SuperGLUE: A Stickier Benchmark for General-Purpose Language Un...
228
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__ = """▁""" lowerCamel...
302
import unittest import numpy as np from transformers.testing_utils import require_torch, require_vision from transformers.utils import is_torch_available, is_vision_available from ...test_image_processing_common import ImageProcessingSavingTestMixin, prepare_image_inputs if is_torch_available(): import torc...
279
0
'''simple docstring''' import os from pathlib import Path import numpy as np import pytest from pack_dataset import pack_data_dir from parameterized import parameterized from save_len_file import save_len_file from torch.utils.data import DataLoader from transformers import AutoTokenizer from tr...
187
'''simple docstring''' def _snake_case ( _SCREAMING_SNAKE_CASE : list ) -> list: """simple docstring""" if len(_SCREAMING_SNAKE_CASE ) < 2: return collection def circle_sort_util(_SCREAMING_SNAKE_CASE : list , _SCREAMING_SNAKE_CASE ...
187
1
"""simple docstring""" import argparse import datetime import json import time import warnings from logging import getLogger from pathlib import Path from typing import Dict, List import torch from tqdm import tqdm from transformers import AutoModelForSeqaSeqLM, AutoTokenizer from utils import c...
173
"""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, ...
135
0
'''simple docstring''' # Copyright 2023 The HuggingFace Inc. team. All rights reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 ...
237
'''simple docstring''' import functools import operator from ...configuration_utils import PretrainedConfig from ...utils import logging __UpperCAmelCase =logging.get_logger(__name__) __UpperCAmelCase ={ "microsoft/unispeech-sat-base-100h-libri-ft": ( "https://huggingface.co/mi...
237
1
from collections import OrderedDict from typing import Mapping from ...configuration_utils import PretrainedConfig from ...onnx import OnnxConfig from ...utils import logging _lowerCAmelCase : Optional[int] = logging.get_logger(__name__) _lowerCAmelCase : int = { '''distilb...
300
import os from typing import Any, Callable, Dict, List, Optional, Tuple, Union import torch from torch import nn from ...models.controlnet import ControlNetModel, ControlNetOutput from ...models.modeling_utils import ModelMixin from ...utils import logging _lowerCamelCase : List[str] = logging.get...
282
0
import numpy as np from scipy.spatial.distance import cdist from sklearn.metrics import fa_score import datasets UpperCAmelCase_ : Dict = '''\ @inproceedings{kakwani2020indicnlpsuite, title={{IndicNLPSuite: Monolingual Corpora, Evaluation Benchmarks and Pre-trained Multilingual Language ...
357
import argparse import gc import json import os import re import torch from huggingface_hub import hf_hub_download from transformers import AutoModelForCausalLM, AutoTokenizer, PreTrainedTokenizerFast, RwkvConfig from transformers.modeling_utils import WEIGHTS_INDEX_NAME, shard_checkpoint UpperCAmelCase_ ...
198
0
from __future__ import annotations import math import random from collections.abc import Collection from typing import overload class __lowerCAmelCase : def __init__( self :List[str] , __magic_name__ :Collection[float] | None = None ): '''simpl...
228
def __A ( __lowerCamelCase , __lowerCamelCase ) -> str: if not isinstance(__lowerCamelCase , __lowerCamelCase ): raise ValueError("""iterations must be defined as integers""" ) if not isinstance(__lowerCamelCase , __lowerCamelCase ) or not number >= 1: ...
228
1
import unittest from transformers import is_torch_available from transformers.testing_utils import require_torch if is_torch_available(): import torch from transformers.generation import DisjunctiveConstraint @require_torch class lowercase__ ( unittest.TestCase ): ...
366
import collections import json import math import os import re import time from fnmatch import fnmatch from typing import Dict import requests from slack_sdk import WebClient UpperCAmelCase_ = WebClient(token=os.environ['CI_SLACK_BOT_TOKEN']) def lowerCAmelCase_ ( ...
247
0
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, logging if...
187
from __future__ import annotations lowercase__ : str = [ [-1, 0], # left [0, -1], # down [1, 0], # right [0, 1], # up ] def lowerCamelCase__ ( _A , _A , _A , _A , _A , ): '''simple docstring''' snake_case_...
187
1
'''simple docstring''' import argparse from pathlib import Path from transformers import AutoConfig, AutoTokenizer, RagConfig, RagSequenceForGeneration, RagTokenForGeneration def _UpperCAmelCase ( _UpperCamelCase : str, _UpperCamelCase : str, _UpperCamelCase : str, ...
350
'''simple docstring''' import logging import os import sys from dataclasses import dataclass, field from typing import Optional import evaluate import numpy as np import torch from datasets import load_dataset from PIL import Image from torchvision.transforms import ( CenterCrop, Compose, Normalize, ...
18
0
'''simple docstring''' __lowerCAmelCase : Dict =[ "Audio", "Array2D", "Array3D", "Array4D", "Array5D", "ClassLabel", "Features", "Sequence", "Value", "Image", "Translation", "TranslationVariableLanguages", ] from .audio import Audio from .features import Ar...
237
'''simple docstring''' from ..utils import DummyObject, requires_backends class UpperCAmelCase ( metaclass=UpperCamelCase__ ): __lowercase = ["""note_seq"""] def __init__( self :Optional[Any] , *lowercase_ :List[Any] , **lowercase_ :List[str] ...
237
1
'''simple docstring''' import os import unittest from transformers import MobileBertTokenizer, MobileBertTokenizerFast from transformers.models.bert.tokenization_bert import ( VOCAB_FILES_NAMES, BasicTokenizer, WordpieceTokenizer, _is_control, _is_punctuation, _is_whitespace, ) from t...
362
'''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 : List[str] = { '''configuration_electra''': ['''ELE...
227
0
"""simple docstring""" from pathlib import Path import fire from tqdm import tqdm def UpperCAmelCase ( UpperCAmelCase="ro" , UpperCAmelCase="en" , UpperCAmelCase="wmt16" , UpperCAmelCase=None ) -> None: try: import datasets except (ModuleNotF...
69
'''simple docstring''' import unittest from knapsack import knapsack as k class UpperCAmelCase ( unittest.TestCase ): '''simple docstring''' def _lowerCAmelCase( self ) -> Tuple: lowercase__ : Optional[Any] = 0 lowercase__ : Any = [0] ...
198
0
from itertools import product from cva import COLOR_BGR2GRAY, cvtColor, imread, imshow, waitKey from numpy import dot, exp, mgrid, pi, ravel, square, uinta, zeros def _lowerCamelCase( lowercase__ , lowercase__ ) -> List[str]: '''simple docstring''' __lowercase= k_si...
304
from math import factorial, radians def _lowerCamelCase( lowercase__ , lowercase__ = 1_8 , lowercase__ = 1_0 ) -> float: '''simple docstring''' __lowercase= angle_in_degrees - ((angle_in_degrees // 360.0) * 360.0) # Converting from degrees to radians __l...
304
1
import warnings from contextlib import contextmanager from ...processing_utils import ProcessorMixin class UpperCAmelCase_ ( A_ ): """simple docstring""" UpperCamelCase_ : Dict ='Speech2TextFeatureExtractor' UpperCamelCase_ : Dict ='Speec...
259
"""simple docstring""" import logging import sys from dataclasses import dataclass, field from typing import Any, Dict, List, Optional, Union import librosa import torch from datasets import DatasetDict, load_dataset from packaging import version from torch import nn from transformers import ( HfArgumentP...
247
0
"""simple docstring""" import logging import os import quant_trainer import torch from torch.utils.data import DataLoader from transformers import Trainer, is_torch_tpu_available from transformers.trainer_utils import PredictionOutput lowerCAmelCase__ = logging.getLogger(__name__) if is_torc...
350
"""simple docstring""" import re from filelock import FileLock try: import nltk lowerCAmelCase__ = True except (ImportError, ModuleNotFoundError): lowerCAmelCase__ = False if NLTK_AVAILABLE: with FileLock('''.lock''') as lock: nltk.download('''punkt...
133
0
from typing import TYPE_CHECKING from ...utils import OptionalDependencyNotAvailable, _LazyModule, is_sentencepiece_available lowerCamelCase : Any = {} try: if not is_sentencepiece_available(): raise OptionalDependencyNotAvailable() except OptionalDependencyNotAvailab...
124
def _snake_case ( lowerCAmelCase : int ): """simple docstring""" SCREAMING_SNAKE_CASE_ : Tuple = int(lowerCAmelCase ) if decimal in (0, 1): # Exit cases for the recursion return str(lowerCAmelCase ) SCREAMING_SNAKE_CASE_ , SCREAMING_SNAKE_CASE_ : Dict ...
18
0
import gc import math import unittest import torch from diffusers import UNetaDModel from diffusers.utils import floats_tensor, logging, slow, torch_all_close, torch_device from diffusers.utils.testing_utils import enable_full_determinism from .test_modeling_common import ModelTesterMixin, UNetTesterMixin __...
366
from pathlib import Path from typing import List from transformers import is_torch_available, is_vision_available from transformers.testing_utils import get_tests_dir, is_tool_test from transformers.tools.agent_types import AGENT_TYPE_MAPPING, AgentAudio, AgentImage, AgentText if is_torch_available(): imp...
273
0
import argparse import requests import torch from PIL import Image from transformers import SwinConfig, SwinForMaskedImageModeling, ViTImageProcessor def _UpperCAmelCase ( a__): '''simple docstring''' a_ : Union[str, Any] = SwinConfig(image_size=1_9_2) if "base" in model_name...
248
from typing import List, Union from ..utils import ( add_end_docstrings, is_tf_available, is_torch_available, is_vision_available, logging, requires_backends, ) from .base import PIPELINE_INIT_ARGS, Pipeline if is_vision_available(): from PIL import Image from ..image_utils impor...
227
0
'''simple docstring''' 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_simplif...
299
'''simple docstring''' from typing import TYPE_CHECKING from ....utils import OptionalDependencyNotAvailable, _LazyModule, is_torch_available UpperCamelCase__ = {'''configuration_mmbt''': ['''MMBTConfig''']} try: if not is_torch_available(): raise OptionalDependencyNotAvailable() except...
299
1
'''simple docstring''' import argparse import os import torch from diffusers import ( CMStochasticIterativeScheduler, ConsistencyModelPipeline, UNetaDModel, ) _UpperCamelCase : Any = { 'sample_size': 32, 'in_channels': 3, 'out_channels': 3, 'layers_per_block': 2,...
304
'''simple docstring''' from __future__ import annotations def __UpperCAmelCase ( A : str ) -> list[int]: return [ord(A ) - 9_6 for elem in plain] def __UpperCAmelCase ( A : list[int] ) -> str: return "".join(chr(elem + 9_6 ) for elem in encoded ) ...
304
1
import inspect from typing import List, Optional, Tuple, Union import torch from ...models import UNetaDModel, VQModel from ...schedulers import DDIMScheduler from ...utils import randn_tensor from ..pipeline_utils import DiffusionPipeline, ImagePipelineOutput class snake_case__ ( _lowerCAmelCase ): d...
363
import unittest from transformers import is_flax_available from transformers.testing_utils import require_flax, require_sentencepiece, require_tokenizers, require_torch, slow if is_flax_available(): import optax from flax.training.common_utils import onehot from transformers import AutoTokenizer, FlaxM...
138
0
import time import warnings from abc import ABC from copy import deepcopy from typing import Optional import torch from ..utils import add_start_docstrings, logging lowercase_ = logging.get_logger(__name__) lowercase_ = r'\n Args:\n input_ids (`torch.LongTensor` of s...
303
def __SCREAMING_SNAKE_CASE ( snake_case_ ): '''simple docstring''' _UpperCAmelCase = len(snake_case_ ) for i in range(snake_case_ ): for j in range(i + 1 , snake_case_ ): if numbers[j] < numbers[i]: ...
133
0
'''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 the ass...
356
'''simple docstring''' from typing import Dict, List, Optional, Tuple, Union import numpy as np from ...image_processing_utils import BaseImageProcessor, BatchFeature, get_size_dict from ...image_transforms import ( center_crop, get_resize_output_image_size, normalize, rescale,...
222
0
import shutil import tempfile import unittest import numpy as np import pytest from transformers.testing_utils import require_vision from transformers.utils import is_vision_available if is_vision_available(): from PIL import Image from transformers import AutoProcessor, BertTokenizer, BlipImagePro...
326
import argparse import re from flax.traverse_util import flatten_dict, unflatten_dict from tax import checkpoints from transformers import SwitchTransformersConfig, SwitchTransformersForConditionalGeneration from transformers.modeling_flax_pytorch_utils import load_flax_weights_in_pytorch_model from transformer...
273
0
"""simple docstring""" import logging import os from dataclasses import dataclass, field from functools import partial from pathlib import Path from tempfile import TemporaryDirectory from typing import List, Optional import faiss import torch from datasets import Features, Sequence, Value, load_dataset fro...
352
"""simple docstring""" from typing import TYPE_CHECKING from ....utils import OptionalDependencyNotAvailable, _LazyModule, is_torch_available, is_vision_available lowerCAmelCase__ = {'''configuration_van''': ['''VAN_PRETRAINED_CONFIG_ARCHIVE_MAP''', '''VanConfig''']} try: if not is_torc...
133
0
import os from typing import Dict, List, Union import tensorflow as tf from keras_nlp.tokenizers import BytePairTokenizer from tensorflow_text import pad_model_inputs from .tokenization_gpta import GPTaTokenizer class UpperCamelCase__ ( tf.keras.layers.Layer ): """simple docstri...
299
from __future__ import annotations __UpperCAmelCase = [ [-1, 0], # left [0, -1], # down [1, 0], # right [0, 1], # up ] def A__ ( __lowerCamelCase, __lowerCamelCase, __lowerCamelCase, __lowerCamelCase, __lowerCamelCase, ): SCREAMING_SNAKE_CASE_ = [ [0...
299
1
'''simple docstring''' from __future__ import annotations def UpperCAmelCase ( a_ , a_ , a_ ) -> tuple[float, list[float]]: """simple docstring""" A_ : Any = list(range(len(a_ ) ) ) A_ : int ...
164
'''simple docstring''' def UpperCAmelCase ( a_ , a_ ) -> int: """simple docstring""" return int((input_a, input_a).count(1 ) != 0 ) def UpperCAmelCase ( ) -> None: """simple docstring""" assert or_g...
164
1
"""simple docstring""" import torch from transformers import AutoModel class a ( torch.nn.Module ): """simple docstring""" def __init__( self: List[Any] , UpperCamelCase: Union[str, Any]="sayef/fsner-bert-base-uncased" ): """si...
335
import numpy as np from cva import COLOR_BGR2GRAY, cvtColor, imread from numpy import array, uinta from PIL import Image from digital_image_processing import change_contrast as cc from digital_image_processing import convert_to_negative as cn from digital_image_processing import sepia as sp from digital_image_proces...
138
0
'''simple docstring''' import torch from diffusers import DiffusionPipeline class A_ ( _snake_case ): '''simple docstring''' def __init__( self : Any , lowercase_ : Tuple , lowercase_ : List[Any] ) -> Optional[Any...
280
'''simple docstring''' import inspect from typing import List, Optional, Tuple, Union import torch from ...models import UNetaDModel, VQModel from ...schedulers import DDIMScheduler from ...utils import randn_tensor from ..pipeline_utils import DiffusionPipeline, ImagePipelineOutput class A_ ...
280
1
import math from typing import Any, Callable, List, Optional, Tuple, Union import numpy as np import torch from ...models import TaFilmDecoder from ...schedulers import DDPMScheduler from ...utils import is_onnx_available, logging, randn_tensor if is_onnx_available(): from ..onnx_utils import OnnxRuntimeModel ...
277
import inspect import unittest from math import floor from transformers import CvtConfig from transformers.file_utils import cached_property, is_torch_available, is_vision_available from transformers.testing_utils import require_torch, require_vision, slow, torch_device from ...test_configuration_common import Confi...
222
0
def lowerCamelCase__ ( snake_case_ : bytes ) -> str: return "".join([hex(snake_case_ )[2:].zfill(2 ).upper() for byte in list(snake_case_ )] ) def lowerCamelCase__ ( snake_case_ : str ) -> bytes: # Check data validity, following RFC3548 # https://www.ietf.org/r...
364
from __future__ import annotations import collections import pprint from pathlib import Path def lowerCamelCase__ ( snake_case_ : str ) -> str: return "".join(sorted(snake_case_ ) ) def lowerCamelCase__ ( snake_case_ : str ) -> list[st...
238
0
import json import os import shutil import tempfile import unittest import numpy as np from transformers import BertTokenizerFast from transformers.models.bert.tokenization_bert import VOCAB_FILES_NAMES, BertTokenizer from transformers.testing_utils import require_tokenizers, require_vision from transformers.utils im...
43
import json import os from datetime import date from pathlib import Path from tabulate import DataRow, TableFormat, tabulate lowercase_ : Optional[Any] = TableFormat( lineabove=None, linebelowheader=None, linebetweenrows=None, linebelow=None, headerrow=DataRow('', '|', '|'), data...
133
0
import inspect import unittest import warnings from transformers import DeiTConfig from transformers.models.auto import get_values from transformers.testing_utils import ( require_accelerate, require_torch, require_torch_gpu, require_vision, slow, torch_device, ) from transformers.utils impor...
99
import logging import sys from dataclasses import dataclass, field from typing import Any, Dict, List, Optional, Union import librosa import torch from datasets import DatasetDict, load_dataset from packaging import version from torch import nn from transformers import ( HfArgumentParser, Trainer, Train...
99
1
'''simple docstring''' import os import tempfile import unittest from pathlib import Path from transformers import AutoConfig, is_tf_available from transformers.testing_utils import require_tf if is_tf_available(): import tensorflow as tf from transformers import TensorFlowBenchmark, TensorFlowBenchmark...
164
'''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, EulerAncestralDiscreteScheduler, LMSDiscreteScheduler, ...
164
1
import string # frequency taken from https://en.wikipedia.org/wiki/Letter_frequency lowercase__ ={ 'E': 12.70, 'T': 9.06, 'A': 8.17, 'O': 7.51, 'I': 6.97, 'N': 6.75, 'S': 6.33, 'H': 6.09, 'R': 5.99, 'D': 4.25, 'L': 4.03, 'C': 2.78, 'U': 2.76, 'M': 2.41,...
90
import json import os from functools import lru_cache from typing import Dict, List, Optional, Tuple, Union import regex as re from ...tokenization_utils import AddedToken, PreTrainedTokenizer from ...tokenization_utils_base import BatchEncoding, EncodedInput from ...utils import PaddingStrategy, logging lowercase...
90
1
from __future__ import annotations class _A: """simple docstring""" def __init__( self , _A ): __A : Optional[int] = data __A : Node | None = None __A : Node | None = None def _SCREAMING_SNAKE_CASE ...
280
def _SCREAMING_SNAKE_CASE ( a ) -> bool: return str(a ) == str(a )[::-1] def _SCREAMING_SNAKE_CASE ( a ) -> int: return int(a ) + int(str(a )[::-1] ) def _SCREAMING_SNAKE_CASE ( a = 1_00_00 ) -> int: __A : int = [] ...
280
1
"""simple docstring""" import argparse import torch from transformers import ( SpeechTaConfig, SpeechTaFeatureExtractor, SpeechTaForSpeechToSpeech, SpeechTaForSpeechToText, SpeechTaForTextToSpeech, SpeechTaProcessor, SpeechTaTokenizer, logging, ) from transformers.tokenization_util...
350
from __future__ import annotations import numpy as np def a__ ( __UpperCamelCase ): SCREAMING_SNAKE_CASE_ , SCREAMING_SNAKE_CASE_ = np.shape(__UpperCamelCase ) if rows != columns: SCREAMING_SNAKE_CASE_ = ( "'table' has to...
305
0
from __future__ import annotations import numpy as np def SCREAMING_SNAKE_CASE ( __lowerCAmelCase ) -> Union[str, Any]: UpperCamelCase__ : Tuple = np.shape(__lowerCamelCase ) if rows != columns: UpperCamelCase__ : str = ...
189
"""simple docstring""" import unittest import numpy as np import torch from diffusers import DDIMPipeline, DDIMScheduler, UNetaDModel from diffusers.utils.testing_utils import enable_full_determinism, require_torch_gpu, slow, torch_device from ..pipeline_params import UNCONDITIONAL_IMAGE_GENERATION_BATCH_P...
238
0
'''simple docstring''' from typing import Dict, Optional, Union import numpy as np from ...image_processing_utils import BaseImageProcessor, BatchFeature, get_size_dict from ...image_transforms import flip_channel_order, resize, to_channel_dimension_format, to_pil_image from ...image_utils import ( ...
280
'''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_dim...
280
1
import functools def A_ ( A__ , A__ ) -> int: # Validation if not isinstance(A__ , A__ ) or not all(isinstance(A__ , A__ ) for day in days ): raise ValueError('The parameter days should be a list of integers' ) if len(A__ ) != 3 or not...
99
import os import tempfile import unittest from pathlib import Path from transformers import AutoConfig, is_tf_available from transformers.testing_utils import require_tf if is_tf_available(): import tensorflow as tf from transformers import TensorFlowBenchmark, TensorFlowBenchmarkArguments @requi...
99
1
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_video_inputs if is_torch_available(): import torch...
33
A : Optional[Any] = tuple[float, float, float] A : Union[str, Any] = tuple[float, float, float] def __lowerCAmelCase ( a__ , a__ ) -> Vectorad: __a = end_pointa[0] - end_pointa[0] __a = end_pointa[1] - end_pointa[1] _...
33
1
import sys from typing import Tuple import numpy as np import torch from PIL import Image from torch import nn from transformers.image_utils import PILImageResampling from utils import img_tensorize class __lowerCAmelCase : """simple docstring""" def __ini...
90
from __future__ import annotations # This is the precision for this function which can be altered. # It is recommended for users to keep this number greater than or equal to 10. __A = 10 def lowerCamelCase_ ( UpperCamelCase__ : int , UpperCamelCase__ : ...
90
1
from math import factorial def lowerCAmelCase_ ( _snake_case : int = 100 ) -> int: '''simple docstring''' return sum(int(snake_case__ ) for x in str(factorial(snake_case__ ) ) ) if __name__ == "__main__": print(solution(int(input("Enter the Number: ")...
364
from .integrations import ( is_optuna_available, is_ray_available, is_sigopt_available, is_wandb_available, run_hp_search_optuna, run_hp_search_ray, run_hp_search_sigopt, run_hp_search_wandb, ) from .trainer_utils import ( HPSearchBackend, default_hp_space_optuna, default_hp...
41
0
'''simple docstring''' import logging from dataclasses import dataclass, field from pathlib import Path from typing import Optional, Union from .generation.configuration_utils import GenerationConfig from .training_args import TrainingArguments from .utils import add_start_docstrings a__ : List[str] ...
80
def UpperCamelCase ( __magic_name__ : str ) -> list: """simple docstring""" if n_term == "": return [] lowercase__ = [] for temp in range(int(__magic_name__ ) ): series.append(f'''1/{temp + 1}''' if series else """1""" ) return series ...
305
0
'''simple docstring''' def _A ( snake_case , snake_case ) -> int: return x if y == 0 else greatest_common_divisor(UpperCAmelCase__ , x % y ) def _A ( snake_case , snake_case ) -> int: return (x * y) // greatest_common_divisor(UpperCAmelCase__...
371
'''simple docstring''' from timeit import timeit def _A ( snake_case ) -> int: if number < 0: raise ValueError("the value of input must not be negative" ) _lowercase : Union[str, Any] = 0 while number: number &= number - 1 result += 1 ...
199
0
import argparse import requests import torch from PIL import Image from torchvision.transforms import Compose, Normalize, Resize, ToTensor from transformers import SwinaSRConfig, SwinaSRForImageSuperResolution, SwinaSRImageProcessor def _SCREAMING_SNAKE_CASE ( a ) -> Tuple: __A : ...
280
from __future__ import annotations import math import random from collections.abc import Collection from typing import overload class _A: """simple docstring""" def __init__( self , _A = None ): if components is None: __A : int = [] ...
280
1
import os import random import sys from . import cryptomath_module as cryptomath from . import rabin_miller __snake_case = 3 def _lowercase ( UpperCamelCase_ ) -> int: '''simple docstring''' print('Generating primitive root of p' ) while True: SCREAMI...
362
import warnings from ...utils import logging from .image_processing_layoutlmva import LayoutLMvaImageProcessor __snake_case = logging.get_logger(__name__) class lowercase__ ( _UpperCAmelCase ): def __init__( self : Dict , *UpperCAmelCase_ : int , ...
169
0
"""simple docstring""" import math class _UpperCAmelCase : def __init__( self : Union[str, Any] , A : Optional[int]=0 ) -> Union[str, Any]: # a graph with Node 0,1,...,N-1 lowercase_ : Any = n lower...
33
"""simple docstring""" import unittest from transformers import load_tool from .test_tools_common import ToolTesterMixin __A : Dict = ''' Hugging Face was founded in 2016 by French entrepreneurs Clément Delangue, Julien Chaumond, and Thomas Wolf originally as a company that ...
33
1
"""simple docstring""" import unittest import numpy as np import timeout_decorator # noqa from transformers import BlenderbotSmallConfig, is_flax_available from transformers.testing_utils import require_flax, slow from ...generation.test_flax_utils import FlaxGenerationTesterMixin from ......
53
"""simple docstring""" import unittest from transformers import DonutProcessor _UpperCamelCase: Any = 'naver-clova-ix/donut-base' class a__ ( unittest.TestCase ): def lowercase ( self : Optional[Any] ) -> Tuple: ...
53
1
'''simple docstring''' import os from typing import List, Optional, Union from ...tokenization_utils import PreTrainedTokenizer from ...tokenization_utils_base import AddedToken from ...utils import logging a__ : List[str] = logging.get_logger(__name__) a__ : Optional[int] = ...
80
'''simple docstring''' from collections.abc import Sequence def SCREAMING_SNAKE_CASE_ (UpperCamelCase , UpperCamelCase ) -> float: return sum(c * (x**i) for i, c in enumerate(UpperCamelCase ) ) def SCREAMING_SNAKE_CASE_ ...
41
0
import warnings from ...utils import logging from .image_processing_owlvit import OwlViTImageProcessor _lowerCAmelCase :int = logging.get_logger(__name__) class _UpperCAmelCase ( lowercase__ ): '''simple docstring''' def __init__( self , *A , **A ) -> Opti...
358
"""simple docstring""" # 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 # # U...
68
0
"""simple docstring""" from __future__ import annotations import math _a = '2020.9.26' _a = 'xcodz-dot, cclaus, dhruvmanila' def _A ( UpperCamelCase_ : float, UpperCamelCase_ : float, UpperCamelCase_ : float, UpperCamelCase_ : float,...
17
import tempfile import unittest from transformers import SPIECE_UNDERLINE, BatchEncoding, PLBartTokenizer, is_torch_available from transformers.testing_utils import ( get_tests_dir, nested_simplify, require_sentencepiece, require_tokenizers, require_torch, ) from ...test_tokenization_common imp...
199
0
'''simple docstring''' class UpperCAmelCase : '''simple docstring''' def __init__( self , __lowerCAmelCase = "" , __lowerCAmelCase = False ) -> None: # Mapping from the first character of the prefix of the node lowercase__ : dict[str, Radix...
214
'''simple docstring''' class UpperCAmelCase : '''simple docstring''' def __init__( self ) -> List[str]: lowercase__ : Dict = {} def _lowerCAmelCase( self ) -> None: print(self.vertex ) for i in self.vertex: print(__lowe...
214
1
"""simple docstring""" import unittest from transformers import MraConfig, is_torch_available from transformers.testing_utils import require_torch, slow, torch_device from ...test_configuration_common import ConfigTester from ...test_modeling_common import ModelTesterMixin, floats_tensor, ids_ten...
64
from __future__ import annotations from itertools import permutations from random import randint from timeit import repeat def lowerCAmelCase ( ): """simple docstring""" UpperCAmelCase__ = [randint(-1000 , 1000 ) for i in range(10 )] UpperCAmelCase__ ...
169
0
"""simple docstring""" from typing import TYPE_CHECKING from ...utils import ( OptionalDependencyNotAvailable, _LazyModule, is_flax_available, is_tf_available, is_torch_available, ) _lowercase : Any = { "configuration_resnet": ["RESNET_PRETRAINED_CONFIG_ARCHIVE_MAP...
272
"""simple docstring""" 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_weight...
272
1
'''simple docstring''' import warnings from ...utils import logging from .image_processing_dpt import DPTImageProcessor a__ : Optional[Any] =logging.get_logger(__name__) class snake_case ( __lowerCamelCase ): """simple docstring""" def __init__( self : ...
53
'''simple docstring''' from __future__ import annotations class snake_case : """simple docstring""" def __init__( self : Optional[int] , __A : list[list[int]] ): __UpperCamelCase = TypeError( 'Matrices must be formed from a list of ...
53
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 applic...
357
import tempfile import numpy as np import torch from transformers import AutoTokenizer, TaEncoderModel from diffusers import DDPMScheduler, UNetaDConditionModel from diffusers.models.attention_processor import AttnAddedKVProcessor from diffusers.pipelines.deepfloyd_if import IFWatermarker from diffusers.utils.test...
84
0
from ...configuration_utils import PretrainedConfig from ...utils import logging A : str = logging.get_logger(__name__) A : Dict = { 'vinvino02/glpn-kitti': 'https://huggingface.co/vinvino02/glpn-kitti/resolve/main/config.json', # See all GLPN models at https://huggingface.co/models?filter=glp...
6
import torch import torch.nn as nn from transformers import CLIPConfig, CLIPVisionModel, PreTrainedModel from ...utils import logging lowerCAmelCase__ = logging.get_logger(__name__) def lowerCAmelCase__ ( SCREAMING_SNAKE_CASE_: Optional[int] , SCREAMING_SNAKE_CASE_: int ...
68
0
'''simple docstring''' def __snake_case( _lowerCAmelCase ) -> List[str]: if bit_count < 0: raise ValueError("""The given input must be positive""" ) # get the generated string sequence snake_case__ : Any = gray_code_sequence_string(UpperCamelCas...
363
'''simple docstring''' import gc import random import unittest import numpy as np import torch from transformers import CLIPTextConfig, CLIPTextModel, CLIPTokenizer from diffusers import AutoencoderKL, CycleDiffusionPipeline, DDIMScheduler, UNetaDConditionModel from diffusers.utils import floats_tensor, load...
43
0
import argparse import torch from transformers import BlenderbotConfig, BlenderbotForConditionalGeneration from transformers.utils import logging logging.set_verbosity_info() snake_case_ = logging.get_logger(__name__) snake_case_ = [ ['''attention''', '''attn'''], ['''encoder_attention''', '''enc...
214
from typing import TYPE_CHECKING from ...utils import OptionalDependencyNotAvailable, _LazyModule, is_torch_available snake_case_ = { '''configuration_instructblip''': [ '''INSTRUCTBLIP_PRETRAINED_CONFIG_ARCHIVE_MAP''', '''InstructBlipConfig''', '''InstructBlipQFormerConfig''', ...
214
1
"""simple docstring""" from __future__ import annotations def lowercase ( A_ , A_ , A_ )-> float: '''simple docstring''' if days_between_payments <= 0: raise ValueError("days_between_payments must be > 0" ) if daily_interest_rate < 0: ...
226
"""simple docstring""" from math import ceil, sqrt def lowercase ( A_ = 1_000_000 )-> int: '''simple docstring''' a : Tuple = 0 for outer_width in range(3 , (limit // 4) + 2 ): if outer_width**2 > limit: a : ...
226
1
'''simple docstring''' import shutil import tempfile import unittest from transformers import ( SPIECE_UNDERLINE, AddedToken, BatchEncoding, NllbTokenizer, NllbTokenizerFast, is_torch_available, ) from transformers.testing_utils import ( get_tests_dir, nested_simplify, require_s...
272
'''simple docstring''' def snake_case__ ( _A: int , _A: int ) -> int: '''simple docstring''' while a != 0: lowerCAmelCase , lowerCAmelCase = b % a, a return b def snake_case__ ( _A: int , _A: int ) -> int: '''simple do...
272
1
'''simple docstring''' from collections import OrderedDict from typing import Mapping from packaging import version from ...configuration_utils import PretrainedConfig from ...onnx import OnnxConfig from ...utils import logging from ...utils.backbone_utils import BackboneConfigMixin, get_aligned_output_f...
368
'''simple docstring''' import argparse import intel_extension_for_pytorch as ipex import torch from diffusers import DPMSolverMultistepScheduler, StableDiffusionPipeline lowerCAmelCase_ : Dict = argparse.ArgumentParser('''Stable Diffusion script with intel optimization''', add...
170
0
'''simple docstring''' from __future__ import annotations import unittest from transformers import EsmConfig, 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_t...
309
"""simple docstring""" def _snake_case ( lowercase__ : int = 1_0 ) -> str: '''simple docstring''' if not isinstance(lowercase__ , lowercase__ ) or n < 0: raise ValueError("""Invalid input""" ) lowerCAmelCase_ :List[str] = 1_0**n ...
84
0
import sys from collections import defaultdict class SCREAMING_SNAKE_CASE__ : def __init__( self : Tuple ) -> Optional[Any]: a_ : List[Any] = [] def SCREAMING_SNAKE_CASE ( self : List[str] , SCREAMING_SNAKE_CASE__ : List[Any] ) -> ...
351
from typing import List, Optional, Tuple, Union import torch from torch import nn from torch.nn import CrossEntropyLoss from ... import AutoBackbone from ...modeling_outputs import SemanticSegmenterOutput from ...modeling_utils import PreTrainedModel from ...utils import add_start_docstrings, add_start...
120
0
'''simple docstring''' import importlib import sys from argparse import REMAINDER, ArgumentParser from pathlib import Path import torch_xla.distributed.xla_multiprocessing as xmp def snake_case_ (): UpperCAmelCase = ArgumentParser( description=( '''PyTorch...
34
def lowerCamelCase ( SCREAMING_SNAKE_CASE = 1 , SCREAMING_SNAKE_CASE = 1_000 ): '''simple docstring''' __UpperCamelCase :Union[str, Any] = 1 __UpperCamelCase :Any = 0 for divide_by_number in range(SCREAMING_SNAKE_CASE , digit + 1 ): __UpperCamelCase :list[i...
43
0
"""simple docstring""" from pathlib import Path import fire def A_ ( _lowerCAmelCase : str, _lowerCAmelCase : str, _lowerCAmelCase : int ): """simple docstring""" _a = Path(_lowerCAmelCase ) _a = Path(_lowerCAmelCase )...
153
"""simple docstring""" from collections.abc import Callable import numpy as np def A_ ( _lowerCAmelCase : Callable, _lowerCAmelCase : float, _lowerCAmelCase : float, _lowerCAmelCase : float, _lowerCAmelCase : float ): """simp...
153
1
import collections from typing import List, Optional, Union from ...tokenization_utils_base import BatchEncoding from ...utils import TensorType, add_end_docstrings, add_start_docstrings, logging from ..bert.tokenization_bert import BertTokenizer __A =logging.get_logger(__name__) __A ={"...
226
import argparse import shutil import time from json import JSONDecodeError from logging import getLogger from pathlib import Path from typing import Dict, List import torch from torch.utils.data import DataLoader from tqdm import tqdm from transformers import AutoModelForSeqaSeqLM, AutoTokenizer ...
226
1
'''simple docstring''' from math import cos, sin, sqrt, tau from audio_filters.iir_filter import IIRFilter def UpperCamelCase__ ( lowerCAmelCase , lowerCAmelCase , lowerCAmelCase = 1 / sqrt(2 ) ): """simple docstring""" _lowerCAmelCase = ...
354
'''simple docstring''' import json import logging import os import sys from pathlib import Path import finetune_rag from transformers.file_utils import is_apex_available from transformers.testing_utils import ( TestCasePlus, execute_subprocess_async, require_ray, ...
220
0
# Copyright 2022 The HuggingFace Team. All rights reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applica...
13
from typing import List, Union import numpy as np from ..utils import add_end_docstrings, is_torch_available, is_vision_available, logging, requires_backends from .base import PIPELINE_INIT_ARGS, Pipeline if is_vision_available(): from PIL import Image from ..image_utils import load_image ...
170
0
from transformers import DistilBertTokenizer, DistilBertTokenizerFast from transformers.testing_utils import require_tokenizers, slow from ..bert.test_tokenization_bert import BertTokenizationTest @require_tokenizers class SCREAMING_SNAKE_CASE__ ( UpperCamelCase__ ): __SCREAMING...
39
import gc import unittest import numpy as np import torch from diffusers import StableDiffusionKDiffusionPipeline from diffusers.utils import slow, torch_device from diffusers.utils.testing_utils import enable_full_determinism, require_torch_gpu enable_full_determinism() @slow @requ...
39
1
from typing import TYPE_CHECKING from ...utils import ( OptionalDependencyNotAvailable, _LazyModule, is_flax_available, is_tf_available, is_torch_available, is_vision_available, ) lowercase : str = {"""configuration_vit""": ["""VIT_PRETRAINED_CONFIG_ARCHIVE_MAP""", """ViT...
20
'''simple docstring''' import argparse import json import os import re import torch from transformers import BloomConfig, BloomModel from transformers.file_utils import CONFIG_NAME, WEIGHTS_NAME from transformers.utils import logging logging.set_verbosity_info() __A : Any ...
120
0
"""simple docstring""" import json import logging import os import re import sys from dataclasses import dataclass, field from typing import Any, Dict, List, Optional, Union import datasets import numpy as np import torch import torchaudio from packaging import version from torch import nn import transformers fro...
368
"""simple docstring""" import copy import os import cva import numpy as np from matplotlib import pyplot as plt class lowerCamelCase_: '''simple docstring''' def __init__( self ): _lowerCamelCase = '''''' _lowerCamelCase = '''''' _lowerCam...
73
0
"""simple docstring""" from typing import List, Union import numpy as np from ..tokenization_utils import TruncationStrategy from ..utils import add_end_docstrings, logging from .base import PIPELINE_INIT_ARGS, ArgumentHandler, ChunkPipeline lowerCAmelCase__ = logging.get_logger(__name__) class ...
153
"""simple docstring""" from sklearn.metrics import recall_score import datasets lowerCAmelCase__ = ''' Recall is the fraction of the positive examples that were correctly labeled by the model as positive. It can be computed with the equation: Recall = TP / (TP + FN) Where TP is the true positives and F...
153
1
from typing import TYPE_CHECKING from ...utils import ( OptionalDependencyNotAvailable, _LazyModule, is_tf_available, is_torch_available, is_vision_available, ) __snake_case = {'configuration_deit': ['DEIT_PRETRAINED_CONFIG_ARCHIVE_MAP', 'DeiTConfig', 'DeiTOnnxConfig']} try: if no...
363
import gc import random import unittest import numpy as np import torch from diffusers import ( DDIMScheduler, KandinskyVaaControlnetPipeline, KandinskyVaaPriorPipeline, UNetaDConditionModel, VQModel, ) from diffusers.utils import floats_tensor, load_image, load_numpy, slow, torch_device from diff...
78
0
from collections import OrderedDict from typing import TYPE_CHECKING, Any, Mapping, Optional, Union from ...configuration_utils import PretrainedConfig from ...onnx import OnnxConfig from ...utils import logging if TYPE_CHECKING: from ... import FeatureExtractionMixin, PreTrainedTokenizerBase, TensorType lowerC...
68
"""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
0
import argparse import json 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 im...
143
from typing import Any, Dict, List, Union from ..utils import add_end_docstrings, is_torch_available, is_vision_available, logging, requires_backends from .base import PIPELINE_INIT_ARGS, Pipeline if is_vision_available(): from ..image_utils import load_image if is_torch_available(): import ...
143
1