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""" import gc import random import unittest import numpy as np import torch from diffusers import DDIMScheduler, KandinskyVaaPipeline, KandinskyVaaPriorPipeline, UNetaDConditionModel, VQModel from diffusers.utils import floats_tensor, load_numpy, slow, torch_device from diffusers.utils.testing...
357
from typing import TYPE_CHECKING from ...utils import ( OptionalDependencyNotAvailable, _LazyModule, is_tokenizers_available, is_torch_available, is_vision_available, ) A : str = { 'configuration_perceiver': ['PERCEIVER_PRETRAINED_CONFIG_ARCHIVE_MAP', 'PerceiverConfig', 'P...
33
0
from typing import TYPE_CHECKING from ...utils import _LazyModule A : Any = {'tokenization_byt5': ['ByT5Tokenizer']} if TYPE_CHECKING: from .tokenization_byta import ByTaTokenizer else: import sys A : Any = _LazyModule(__name__, globals()['__file__'], _import_...
358
from typing import TYPE_CHECKING from ...utils import ( OptionalDependencyNotAvailable, _LazyModule, is_flax_available, is_tf_available, is_tokenizers_available, is_torch_available, ) A : Optional[int] = { 'configuration_roberta': ['ROBERTA_PRETRAINED_CONFIG_ARCHIVE_MA...
33
0
from collections import Counter from timeit import timeit def __lowerCAmelCase ( a__ = "" , ) -> bool: return sum(c % 2 for c in Counter(input_str.replace(''' ''' , '''''' ).lower() ).values() ) < 2 def __lowerCAmelCase ( a__ = "" ) -> bool: if len(a__ ) == 0:...
359
from string import ascii_uppercase A : Optional[int] = {char: i for i, char in enumerate(ascii_uppercase)} A : Union[str, Any] = dict(enumerate(ascii_uppercase)) def __lowerCAmelCase ( a__ , a__ ) -> str: __a = len(a__ ) __a ...
33
0
from typing import TYPE_CHECKING from ...utils import ( OptionalDependencyNotAvailable, _LazyModule, is_sentencepiece_available, is_speech_available, is_tf_available, is_torch_available, ) A : Dict = { 'configuration_speech_to_text': ['SPEECH_TO_TEXT_PRETRAINED_CONFIG_...
360
import argparse import torch from transformers import GPTaLMHeadModel, RobertaForMaskedLM if __name__ == "__main__": A : Union[str, Any] = argparse.ArgumentParser( description=( 'Extraction some layers of the full RobertaForMaskedLM or GPT2LMHeadModel for Transfer Lear...
33
0
"""simple docstring""" import argparse import json import os import tensorstore as ts import torch from flax import serialization from flax.traverse_util import flatten_dict, unflatten_dict from tensorflow.io import gfile from transformers.modeling_utils import dtype_byte_size from transformers.models.switch_tra...
361
import os import numpy import onnx def __lowerCAmelCase ( a__ , a__ ) -> List[str]: __a = a.name __a = b.name __a = '''''' __a = '''''' __a = a == b __a = name_a __a =...
33
0
from __future__ import annotations import json import requests from bsa import BeautifulSoup from fake_useragent import UserAgent A = {'UserAgent': UserAgent().random} def __lowerCAmelCase ( a__ ) -> dict: __a = script.contents[0] __a = json.loads(data...
362
from typing import TYPE_CHECKING from ...utils import OptionalDependencyNotAvailable, _LazyModule, is_torch_available A : Dict = { 'configuration_instructblip': [ 'INSTRUCTBLIP_PRETRAINED_CONFIG_ARCHIVE_MAP', 'InstructBlipConfig', 'InstructBlipQFormerConfig', '...
33
0
import warnings from ...utils import logging from .image_processing_perceiver import PerceiverImageProcessor A : Optional[int] = logging.get_logger(__name__) class __A( a ): def __init__( self , *_snake_case , **_snake_case ) -> None: ''...
363
import importlib import inspect import json import os import re import shutil import sys from pathlib import Path from typing import Dict, Optional, Union from urllib import request from huggingface_hub import HfFolder, cached_download, hf_hub_download, model_info from packaging import version from .. import __versi...
33
0
from unittest import TestCase from datasets import Dataset from minhash_deduplication import deduplicate_dataset, make_duplicate_clusters def __lowerCAmelCase ( ) -> Dict: __a = { '''repo_name''': ['''test_repo1''', '''test_repo2''', '''test_repo3'''], '''path''': [''...
364
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 A : List[Any] = logging.get_logger(__name__) A : ...
33
0
from collections import OrderedDict from typing import Mapping from packaging import version from ...configuration_utils import PretrainedConfig from ...onnx import OnnxConfig from ...utils import logging from ..auto import CONFIG_MAPPING A : List[Any] = logging.get_logger(__name__) A : ...
365
import functools def __lowerCAmelCase ( a__ , a__ ) -> int: __a = len(a__ ) __a = len(a__ ) @functools.cache def min_distance(a__ , a__ ) -> int: # if first word index is overflow - delete all from the second word if indexa ...
33
0
"""simple docstring""" import inspect from typing import List, Optional, Tuple, Union import numpy as np import PIL import torch import torch.utils.checkpoint from ...models import UNetaDModel, VQModel from ...schedulers import ( DDIMScheduler, DPMSolverMultistepScheduler, EulerAncestralDiscreteSched...
366
import logging from transformers.configuration_utils import PretrainedConfig A : Union[str, Any] = logging.getLogger(__name__) class __A( a ): snake_case_ = '''masked_bert''' def __init__( self , _snake_case=30_522 , _snake_case=768 , ...
33
0
from __future__ import annotations import unittest from transformers import MobileBertConfig, is_tf_available from transformers.models.auto import get_values from transformers.testing_utils import require_tf, slow from ...test_configuration_common import ConfigTester from ...test_modeling_tf_common import TFModelTe...
367
import sys def __lowerCAmelCase ( a__ ) -> Optional[int]: __a = len(a__ ) __a = [[0 for x in range(a__ )] for x in range(a__ )] __a = [[0 for x in range(a__ )] for x in range(a__ )] for chain_length in range(2 , a__ ): for...
33
0
from typing import List, Optional, Union import torch from ...models import UNetaDConditionModel, VQModel from ...pipelines import DiffusionPipeline from ...pipelines.pipeline_utils import ImagePipelineOutput from ...schedulers import DDPMScheduler from ...utils import ( is_accelerate_available, is_accelerat...
368
from typing import TYPE_CHECKING from ...utils import ( OptionalDependencyNotAvailable, _LazyModule, is_tf_available, is_torch_available, is_vision_available, ) A : int = { 'configuration_mobilevit': ['MOBILEVIT_PRETRAINED_CONFIG_ARCHIVE_MAP', 'MobileViTConfig', 'MobileViT...
33
0
def __lowerCAmelCase ( a__ , a__ ) -> float: return price * (1 + tax_rate) if __name__ == "__main__": print(F"{price_plus_tax(1_0_0, 0.25) = }") print(F"{price_plus_tax(125.50, 0.05) = }")
369
from pathlib import Path import cva import numpy as np from matplotlib import pyplot as plt def __lowerCAmelCase ( a__ , a__ , a__ , a__ , a__ ) -> np.ndarray: __a = cva.getAffineTransform(a__ , a__ ) return cva.warpAffine(a__ , a__ ...
33
0
from typing import TYPE_CHECKING from ...utils import ( OptionalDependencyNotAvailable, _LazyModule, is_tf_available, is_tokenizers_available, is_torch_available, ) A : Tuple = { 'configuration_lxmert': ['LXMERT_PRETRAINED_CONFIG_ARCHIVE_MAP', 'LxmertConfig'], 'tokeniz...
370
from __future__ import annotations def __lowerCAmelCase ( a__ , a__ = None ) -> list[list[str]]: __a = word_bank or [] # create a table __a = len(a__ ) + 1 __a = [] for _ in range(a__ ): table.append([] ) # seed value...
33
0
def __lowerCAmelCase ( a__ , a__ , a__ ) -> int: def update_area_of_max_square(a__ , a__ ) -> int: # BASE CASE if row >= rows or col >= cols: return 0 __a = update_area_of_max_square(a__ , col + 1 ) __a ...
371
from typing import List from .keymap import KEYMAP, get_character def __lowerCAmelCase ( a__ ) -> List[str]: def decorator(a__ ): __a = getattr(a__ , '''handle_key''' , [] ) handle += [key] setattr(a__ , '''handle_key''' , a__ ...
33
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 A : str = logging.get_logger(__name__) A : Tuple = {'vocab_file...
350
from typing import TYPE_CHECKING from ...utils import ( OptionalDependencyNotAvailable, _LazyModule, is_sentencepiece_available, is_tokenizers_available, is_torch_available, ) A : Optional[Any] = {} try: if not is_sentencepiece_available(): raise OptionalDepend...
33
0
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 from transformers import ( ...
351
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
0
import argparse import os import re import packaging.version A : int = 'examples/' A : Any = { 'examples': (re.compile(R'^check_min_version\("[^"]+"\)\s*$', re.MULTILINE), 'check_min_version("VERSION")\n'), 'init': (re.compile(R'^__version__\s+=\s+"([^"]+)"\s*$', re.MUL...
352
import argparse import fairseq import torch from transformers import UniSpeechSatConfig, UniSpeechSatForCTC, UniSpeechSatForPreTraining, logging logging.set_verbosity_info() A : str = logging.get_logger(__name__) A : Any = { 'post_extract_proj': 'feature_projection.projec...
33
0
def __lowerCAmelCase ( a__ , a__ ) -> str: __a = len(a__ ) __a = len(a__ ) __a = ( first_str_length if first_str_length > second_str_length else second_str_length ) __a = [] for char_count in range(a__ ): ...
353
from transformers import BertTokenizer, EncoderDecoderModel, SeqaSeqTrainer, SeqaSeqTrainingArguments from transformers.testing_utils import TestCasePlus, require_torch, slow from transformers.utils import is_datasets_available if is_datasets_available(): import datasets class __A( a ): ...
33
0
import numpy as np from PIL import Image def __lowerCAmelCase ( a__ , a__ , a__ ) -> np.ndarray: __a = np.array(a__ ) if arr.shape[0] != arr.shape[1]: raise ValueError('''The input array is not a square matrix''' ) __a = 0 __a ...
354
from typing import TYPE_CHECKING from ...utils import OptionalDependencyNotAvailable, _LazyModule, is_torch_available A : str = { 'configuration_time_series_transformer': [ 'TIME_SERIES_TRANSFORMER_PRETRAINED_CONFIG_ARCHIVE_MAP', 'TimeSeriesTransformerConfig', ], } try: ...
33
0
from scipy.stats import pearsonr, spearmanr from sklearn.metrics import fa_score, matthews_corrcoef import datasets A : Dict = '\\n@inproceedings{wang2019glue,\n title={{GLUE}: A Multi-Task Benchmark and Analysis Platform for Natural Language Understanding},\n author={Wang, Alex and Singh, Aman...
355
import inspect import os import unittest from dataclasses import dataclass import torch from accelerate import Accelerator, DistributedDataParallelKwargs, GradScalerKwargs from accelerate.state import AcceleratorState from accelerate.test_utils import execute_subprocess_async, require_cuda, require_multi_gpu from ac...
33
0
from __future__ import annotations def __lowerCAmelCase ( a__ , a__ = None ) -> list[list[str]]: __a = word_bank or [] # create a table __a = len(a__ ) + 1 __a = [] for _ in range(a__ ): table.append([] ) # seed value...
356
import os # Precomputes a list of the 100 first triangular numbers A : List[Any] = [int(0.5 * n * (n + 1)) for n in range(1, 1_0_1)] def __lowerCAmelCase ( ) -> Tuple: __a = os.path.dirname(os.path.realpath(a__ ) ) __a = os.path.join(a__ , ...
33
0
"""simple docstring""" import gc import random import unittest import torch from diffusers import ( IFImgaImgPipeline, IFImgaImgSuperResolutionPipeline, IFInpaintingPipeline, IFInpaintingSuperResolutionPipeline, IFPipeline, IFSuperResolutionPipeline, ) from diffusers.models.attention_proc...
357
from typing import TYPE_CHECKING from ...utils import ( OptionalDependencyNotAvailable, _LazyModule, is_tokenizers_available, is_torch_available, is_vision_available, ) A : str = { 'configuration_perceiver': ['PERCEIVER_PRETRAINED_CONFIG_ARCHIVE_MAP', 'PerceiverConfig', 'P...
33
0
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, Traini...
358
from typing import TYPE_CHECKING from ...utils import ( OptionalDependencyNotAvailable, _LazyModule, is_flax_available, is_tf_available, is_tokenizers_available, is_torch_available, ) A : Optional[int] = { 'configuration_roberta': ['ROBERTA_PRETRAINED_CONFIG_ARCHIVE_MA...
33
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 transformer...
359
from string import ascii_uppercase A : Optional[int] = {char: i for i, char in enumerate(ascii_uppercase)} A : Union[str, Any] = dict(enumerate(ascii_uppercase)) def __lowerCAmelCase ( a__ , a__ ) -> str: __a = len(a__ ) __a ...
33
0
def __lowerCAmelCase ( a__ ) -> None: __a = generate_pascal_triangle(a__ ) for row_idx in range(a__ ): # Print left spaces for _ in range(num_rows - row_idx - 1 ): print(end=''' ''' ) # Print row values for col_idx in range(row_idx + ...
360
import argparse import torch from transformers import GPTaLMHeadModel, RobertaForMaskedLM if __name__ == "__main__": A : Union[str, Any] = argparse.ArgumentParser( description=( 'Extraction some layers of the full RobertaForMaskedLM or GPT2LMHeadModel for Transfer Lear...
33
0
"""simple docstring""" from ...configuration_utils import PretrainedConfig class __A( a ): snake_case_ = '''bert-generation''' def __init__( self , _snake_case=50_358 , _snake_case=1_024 , _snake_case=24 , _snake_case=16 , _snake_case=4_096...
361
import os import numpy import onnx def __lowerCAmelCase ( a__ , a__ ) -> List[str]: __a = a.name __a = b.name __a = '''''' __a = '''''' __a = a == b __a = name_a __a =...
33
0
from typing import List, Optional import numpy as np from ...processing_utils import ProcessorMixin from ...utils import to_numpy class __A( a ): snake_case_ = '''EncodecFeatureExtractor''' snake_case_ = ('''T5Tokenizer''', '''T5TokenizerFast''') def __...
362
from typing import TYPE_CHECKING from ...utils import OptionalDependencyNotAvailable, _LazyModule, is_torch_available A : Dict = { 'configuration_instructblip': [ 'INSTRUCTBLIP_PRETRAINED_CONFIG_ARCHIVE_MAP', 'InstructBlipConfig', 'InstructBlipQFormerConfig', '...
33
0
from __future__ import annotations def __lowerCAmelCase ( a__ , a__ ) -> list[tuple[int, int]]: __a , __a = position __a = [ (y + 1, x + 2), (y - 1, x + 2), (y + 1, x - 2), (y - 1, x - 2), (y + 2, x + 1), ...
363
import importlib import inspect import json import os import re import shutil import sys from pathlib import Path from typing import Dict, Optional, Union from urllib import request from huggingface_hub import HfFolder, cached_download, hf_hub_download, model_info from packaging import version from .. import __versi...
33
0
def __lowerCAmelCase ( a__ ) -> int: if not isinstance(a__ , a__ ): raise ValueError('''Input must be an integer''' ) if input_num <= 0: raise ValueError('''Input must be positive''' ) return sum( divisor for divisor in range(1 , input_num // 2 + 1 )...
364
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 A : List[Any] = logging.get_logger(__name__) A : ...
33
0
from collections import defaultdict def __lowerCAmelCase ( a__ , a__ ) -> bool: __a = first_str.lower().strip() __a = second_str.lower().strip() # Remove whitespace __a = first_str.replace(''' ''' , '''''' ) __a ...
365
import functools def __lowerCAmelCase ( a__ , a__ ) -> int: __a = len(a__ ) __a = len(a__ ) @functools.cache def min_distance(a__ , a__ ) -> int: # if first word index is overflow - delete all from the second word if indexa ...
33
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...
366
import logging from transformers.configuration_utils import PretrainedConfig A : Union[str, Any] = logging.getLogger(__name__) class __A( a ): snake_case_ = '''masked_bert''' def __init__( self , _snake_case=30_522 , _snake_case=768 , ...
33
0
from __future__ import annotations A : List[str] = [-1_0, -5, 0, 5, 5.1, 1_1, 1_3, 2_1, 3, 4, -2_1, -1_0, -5, -1, 0] A : Optional[Any] = [-5, 0, 5, 5.1, 1_1, 1_3, 2_1, -1, 4, -1, -1_0, -5, -1, 0, -1] def __lowerCAmelCase ( a__ ) -> list[float]: __a ...
367
import sys def __lowerCAmelCase ( a__ ) -> Optional[int]: __a = len(a__ ) __a = [[0 for x in range(a__ )] for x in range(a__ )] __a = [[0 for x in range(a__ )] for x in range(a__ )] for chain_length in range(2 , a__ ): for...
33
0
from functools import lru_cache def __lowerCAmelCase ( a__ ) -> set: __a = 2 __a = set() while i * i <= n: if n % i: i += 1 else: n //= i factors.add(a__ ) if n > 1: factors.add(a__ ) return f...
368
from typing import TYPE_CHECKING from ...utils import ( OptionalDependencyNotAvailable, _LazyModule, is_tf_available, is_torch_available, is_vision_available, ) A : int = { 'configuration_mobilevit': ['MOBILEVIT_PRETRAINED_CONFIG_ARCHIVE_MAP', 'MobileViTConfig', 'MobileViT...
33
0
from math import ceil, sqrt def __lowerCAmelCase ( a__ = 100_0000 ) -> int: __a = 0 for outer_width in range(3 , (limit // 4) + 2 ): if outer_width**2 > limit: __a = max(ceil(sqrt(outer_width**2 - limit ) ) , 1 ) else:...
369
from pathlib import Path import cva import numpy as np from matplotlib import pyplot as plt def __lowerCAmelCase ( a__ , a__ , a__ , a__ , a__ ) -> np.ndarray: __a = cva.getAffineTransform(a__ , a__ ) return cva.warpAffine(a__ , a__ ...
33
0
def __lowerCAmelCase ( a__ , a__ , a__ ) -> float: __a = (num_of_terms / 2) * (2 * first_term + (num_of_terms - 1) * common_diff) # formula for sum of series return total def __lowerCAmelCase ( ) -> Union[str, Any]: print(sum_of_series(1 ,...
370
from __future__ import annotations def __lowerCAmelCase ( a__ , a__ = None ) -> list[list[str]]: __a = word_bank or [] # create a table __a = len(a__ ) + 1 __a = [] for _ in range(a__ ): table.append([] ) # seed value...
33
0
from typing import TYPE_CHECKING from ...utils import ( OptionalDependencyNotAvailable, _LazyModule, is_tokenizers_available, is_torch_available, is_vision_available, ) A : str = { 'configuration_perceiver': ['PERCEIVER_PRETRAINED_CONFIG_ARCHIVE_MAP', 'PerceiverConfi...
371
from typing import List from .keymap import KEYMAP, get_character def __lowerCAmelCase ( a__ ) -> List[str]: def decorator(a__ ): __a = getattr(a__ , '''handle_key''' , [] ) handle += [key] setattr(a__ , '''handle_key''' , a__ ...
33
0
def __lowerCAmelCase ( a__ = 100_0000 ) -> int: __a = set(range(3 , a__ , 2 ) ) primes.add(2 ) for p in range(3 , a__ , 2 ): if p not in primes: continue primes.difference_update(set(range(p * p , a__ , a...
350
from typing import TYPE_CHECKING from ...utils import ( OptionalDependencyNotAvailable, _LazyModule, is_sentencepiece_available, is_tokenizers_available, is_torch_available, ) A : Optional[Any] = {} try: if not is_sentencepiece_available(): raise OptionalDepend...
33
0
from typing import TYPE_CHECKING from ...utils import ( OptionalDependencyNotAvailable, _LazyModule, is_tf_available, is_tokenizers_available, is_torch_available, ) A : List[str] = { 'configuration_convbert': ['CONVBERT_PRETRAINED_CONFIG_ARCHIVE_MAP', 'ConvBertConfig', 'Co...
351
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
0
import numpy as np from cva import destroyAllWindows, imread, imshow, waitKey class __A: def __init__( self , _snake_case , _snake_case , _snake_case ) -> Union[str, Any]: '''simple docstring''' if dst_width < 0 or dst_height < 0: raise ...
352
import argparse import fairseq import torch from transformers import UniSpeechSatConfig, UniSpeechSatForCTC, UniSpeechSatForPreTraining, logging logging.set_verbosity_info() A : str = logging.get_logger(__name__) A : Any = { 'post_extract_proj': 'feature_projection.projec...
33
0
import flax.linen as nn import jax import jax.numpy as jnp class __A( nn.Module ): snake_case_ = 4_2 snake_case_ = jnp.floataa def SCREAMING_SNAKE_CASE_ ( self ) -> Dict: '''simple docstring''' __a = nn...
353
from transformers import BertTokenizer, EncoderDecoderModel, SeqaSeqTrainer, SeqaSeqTrainingArguments from transformers.testing_utils import TestCasePlus, require_torch, slow from transformers.utils import is_datasets_available if is_datasets_available(): import datasets class __A( a ): ...
33
0
def __lowerCAmelCase ( a__ , a__ , a__ ) -> int: def count_of_possible_combinations(a__ ) -> int: if target < 0: return 0 if target == 0: return 1 return sum(count_of_possible_combinations(target - item ) for item in array ) retu...
354
from typing import TYPE_CHECKING from ...utils import OptionalDependencyNotAvailable, _LazyModule, is_torch_available A : str = { 'configuration_time_series_transformer': [ 'TIME_SERIES_TRANSFORMER_PRETRAINED_CONFIG_ARCHIVE_MAP', 'TimeSeriesTransformerConfig', ], } try: ...
33
0
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 if is_torch_tpu_available(check_device=False)...
355
import inspect import os import unittest from dataclasses import dataclass import torch from accelerate import Accelerator, DistributedDataParallelKwargs, GradScalerKwargs from accelerate.state import AcceleratorState from accelerate.test_utils import execute_subprocess_async, require_cuda, require_multi_gpu from ac...
33
0
def __lowerCAmelCase ( a__ ) -> list: for i in range(len(a__ ) - 1 , 0 , -1 ): __a = False for j in range(a__ , 0 , -1 ): if unsorted[j] < unsorted[j - 1]: __a , __a = unsorted[j - 1], u...
356
import os # Precomputes a list of the 100 first triangular numbers A : List[Any] = [int(0.5 * n * (n + 1)) for n in range(1, 1_0_1)] def __lowerCAmelCase ( ) -> Tuple: __a = os.path.dirname(os.path.realpath(a__ ) ) __a = os.path.join(a__ , ...
33
0
"""simple docstring""" class __A: def __init__( self ) -> Any: '''simple docstring''' __a = {} def SCREAMING_SNAKE_CASE_ ( self ) -> None: '''simple docstring''' print(self.vertex ) for i in self...
357
from typing import TYPE_CHECKING from ...utils import ( OptionalDependencyNotAvailable, _LazyModule, is_tokenizers_available, is_torch_available, is_vision_available, ) A : str = { 'configuration_perceiver': ['PERCEIVER_PRETRAINED_CONFIG_ARCHIVE_MAP', 'PerceiverConfig', 'P...
33
0
def __lowerCAmelCase ( a__ ) -> list[int]: """simple docstring""" __a = len(a__ ) for i in range(a__ ): for j in range(i + 1 , a__ ): if numbers[j] < numbers[i]: __a , __a = numbers[j], numbers[i] ...
358
from typing import TYPE_CHECKING from ...utils import ( OptionalDependencyNotAvailable, _LazyModule, is_flax_available, is_tf_available, is_tokenizers_available, is_torch_available, ) A : Optional[int] = { 'configuration_roberta': ['ROBERTA_PRETRAINED_CONFIG_ARCHIVE_MA...
33
0
# DISCLAIMER: This code is strongly influenced by https://github.com/pesser/pytorch_diffusion # and https://github.com/hojonathanho/diffusion import math from dataclasses import dataclass from typing import List, Optional, Tuple, Union import numpy as np import torch from diffusers.configuration_utils import ConfigM...
359
from string import ascii_uppercase A : Optional[int] = {char: i for i, char in enumerate(ascii_uppercase)} A : Union[str, Any] = dict(enumerate(ascii_uppercase)) def __lowerCAmelCase ( a__ , a__ ) -> str: __a = len(a__ ) __a ...
33
0
from typing import TYPE_CHECKING from ...file_utils import _LazyModule, is_tokenizers_available, is_torch_available, is_vision_available from ...utils import OptionalDependencyNotAvailable A : Optional[int] = {'configuration_dpt': ['DPT_PRETRAINED_CONFIG_ARCHIVE_MAP', 'DPTConfig']} try: if ...
360
import argparse import torch from transformers import GPTaLMHeadModel, RobertaForMaskedLM if __name__ == "__main__": A : Union[str, Any] = argparse.ArgumentParser( description=( 'Extraction some layers of the full RobertaForMaskedLM or GPT2LMHeadModel for Transfer Lear...
33
0
"""simple docstring""" import os from typing import Optional import fsspec from fsspec.archive import AbstractArchiveFileSystem from fsspec.utils import DEFAULT_BLOCK_SIZE class __A( a ): snake_case_ = '''''' snake_case_ = ( None # protocol passed i...
361
import os import numpy import onnx def __lowerCAmelCase ( a__ , a__ ) -> List[str]: __a = a.name __a = b.name __a = '''''' __a = '''''' __a = a == b __a = name_a __a =...
33
0
from typing import TYPE_CHECKING from ...utils import OptionalDependencyNotAvailable, _LazyModule, is_torch_available A = { 'configuration_time_series_transformer': [ 'TIME_SERIES_TRANSFORMER_PRETRAINED_CONFIG_ARCHIVE_MAP', 'TimeSeriesTransformerConfig', ], } try: if not is_...
362
from typing import TYPE_CHECKING from ...utils import OptionalDependencyNotAvailable, _LazyModule, is_torch_available A : Dict = { 'configuration_instructblip': [ 'INSTRUCTBLIP_PRETRAINED_CONFIG_ARCHIVE_MAP', 'InstructBlipConfig', 'InstructBlipQFormerConfig', '...
33
0
import numpy class __A: def __init__( self , _snake_case , _snake_case ) -> None: '''simple docstring''' __a = input_array # Random initial weights are assigned where first argument is the # number of nodes in previous laye...
363
import importlib import inspect import json import os import re import shutil import sys from pathlib import Path from typing import Dict, Optional, Union from urllib import request from huggingface_hub import HfFolder, cached_download, hf_hub_download, model_info from packaging import version from .. import __versi...
33
0
import numpy as np import torch import torch.nn as nn from transformers import CLIPConfig, CLIPVisionModelWithProjection, PreTrainedModel from ...utils import logging A : Dict = logging.get_logger(__name__) class __A( a ): snake_case_ = CLIPConfig snake_...
364
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 A : List[Any] = logging.get_logger(__name__) A : ...
33
0
from typing import List, Optional, Union from ...processing_utils import ProcessorMixin from ...tokenization_utils_base import BatchEncoding, PaddingStrategy, PreTokenizedInput, TextInput, TruncationStrategy from ...utils import TensorType class __A( a ): snake_case_ = ['''image_...
365
import functools def __lowerCAmelCase ( a__ , a__ ) -> int: __a = len(a__ ) __a = len(a__ ) @functools.cache def min_distance(a__ , a__ ) -> int: # if first word index is overflow - delete all from the second word if indexa ...
33
0
"""simple docstring""" 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 A : Any = logging.get_logger(__name__) A : Opti...
366
import logging from transformers.configuration_utils import PretrainedConfig A : Union[str, Any] = logging.getLogger(__name__) class __A( a ): snake_case_ = '''masked_bert''' def __init__( self , _snake_case=30_522 , _snake_case=768 , ...
33
0
def __lowerCAmelCase ( a__ = 1000 ) -> int: __a , __a = 1, 1 __a = 2 while True: __a = 0 __a = fa + fa __a , __a = fa, f index += 1 for _ in str(a__ ): ...
367
import sys def __lowerCAmelCase ( a__ ) -> Optional[int]: __a = len(a__ ) __a = [[0 for x in range(a__ )] for x in range(a__ )] __a = [[0 for x in range(a__ )] for x in range(a__ )] for chain_length in range(2 , a__ ): for...
33
0
import inspect import os import unittest from dataclasses import dataclass import torch from accelerate import Accelerator, DistributedDataParallelKwargs, GradScalerKwargs from accelerate.state import AcceleratorState from accelerate.test_utils import execute_subprocess_async, require_cuda, require_multi_gpu from ac...
368
from typing import TYPE_CHECKING from ...utils import ( OptionalDependencyNotAvailable, _LazyModule, is_tf_available, is_torch_available, is_vision_available, ) A : int = { 'configuration_mobilevit': ['MOBILEVIT_PRETRAINED_CONFIG_ARCHIVE_MAP', 'MobileViTConfig', 'MobileViT...
33
0
import copy from ...configuration_utils import PretrainedConfig from ...utils import logging from ..auto import CONFIG_MAPPING A : Union[str, Any] = logging.get_logger(__name__) A : List[str] = { 'ut/deta': 'https://huggingface.co/ut/deta/resolve/main/config.json', } ...
369
from pathlib import Path import cva import numpy as np from matplotlib import pyplot as plt def __lowerCAmelCase ( a__ , a__ , a__ , a__ , a__ ) -> np.ndarray: __a = cva.getAffineTransform(a__ , a__ ) return cva.warpAffine(a__ , a__ ...
33
0
A : Tuple = { '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-builder': 'hf-doc-builder>=0.3.0', 'huggingface-hub': 'huggingfa...
370
from __future__ import annotations def __lowerCAmelCase ( a__ , a__ = None ) -> list[list[str]]: __a = word_bank or [] # create a table __a = len(a__ ) + 1 __a = [] for _ in range(a__ ): table.append([] ) # seed value...
33
0
import os import numpy import onnx def __lowerCAmelCase ( a__ , a__ ) -> List[str]: __a = a.name __a = b.name __a = '''''' __a = '''''' __a = a == b __a = name_a __a ...
371
from typing import List from .keymap import KEYMAP, get_character def __lowerCAmelCase ( a__ ) -> List[str]: def decorator(a__ ): __a = getattr(a__ , '''handle_key''' , [] ) handle += [key] setattr(a__ , '''handle_key''' , a__ ...
33
0
import argparse import intel_extension_for_pytorch as ipex import torch from diffusers import DPMSolverMultistepScheduler, StableDiffusionPipeline lowerCamelCase_ = argparse.ArgumentParser('''Stable Diffusion script with intel optimization''', add_help=False) parser.add_argument('''--dpm''', action='''st...
34
def UpperCamelCase( lowercase_ , lowercase_ ) -> str: '''simple docstring''' return "\n".join( f'''{number} * {i} = {number * i}''' for i in range(1 , number_of_terms + 1 ) ) if __name__ == "__main__": print(multiplication_table(number=5, number_of_t...
34
1
from transformers import DistilBertTokenizer, DistilBertTokenizerFast from transformers.testing_utils import require_tokenizers, slow from ..bert.test_tokenization_bert import BertTokenizationTest @require_tokenizers class __lowerCamelCase ( __snake_case ): lowerCamelCase_ : Dict ...
34
from typing import TYPE_CHECKING from ...utils import OptionalDependencyNotAvailable, _LazyModule, is_tf_available, is_torch_available lowerCamelCase_ = { '''configuration_groupvit''': [ '''GROUPVIT_PRETRAINED_CONFIG_ARCHIVE_MAP''', '''GroupViTConfig''', '''GroupViTOnnxConfig''...
34
1
# this script reports modified .py files under the desired list of top-level sub-dirs passed as a list of arguments, e.g.: # python ./utils/get_modified_files.py utils src tests examples # # it uses git to find the forking point and which files were modified - i.e. files not under git won't be considered # since th...
34
from __future__ import annotations import csv import requests from bsa import BeautifulSoup def UpperCamelCase( lowercase_ = "" ) -> dict[str, float]: '''simple docstring''' snake_case_ = url or """https://www.imdb.com/chart/top/?ref_=nv_mv_250""" snake_case_ = ...
34
1
def UpperCamelCase( lowercase_ ) -> str: '''simple docstring''' if isinstance(lowercase_ , lowercase_ ): raise TypeError("""'float' object cannot be interpreted as an integer""" ) if isinstance(lowercase_ , lowercase_ ): raise TypeError("""'str' ...
34
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 lowerCamelCase_ = logging.get_logger(__name__) lowerCamelCase_ = { '''facebook/levit-1...
34
1
from typing import TYPE_CHECKING from ...utils import ( OptionalDependencyNotAvailable, _LazyModule, is_tf_available, is_tokenizers_available, is_torch_available, is_vision_available, ) lowerCamelCase_ = { '''configuration_layoutlmv3''': [ '''LAYOUTLMV3_PRETRAINED_CONFI...
34
import logging from transformers.configuration_utils import PretrainedConfig lowerCamelCase_ = logging.getLogger(__name__) class __lowerCamelCase ( __snake_case ): lowerCamelCase_ : Optional[int] = 'masked_bert' def __init__( self , lowerCam...
34
1
import os def UpperCamelCase( ) -> Dict: '''simple docstring''' snake_case_ = os.path.join(os.path.dirname(lowercase_ ) , """num.txt""" ) with open(lowercase_ ) as file_hand: return str(sum(int(lowercase_ ) for line in file_hand ) ...
34
from unittest import TestCase from datasets import Dataset from minhash_deduplication import deduplicate_dataset, make_duplicate_clusters def UpperCamelCase( ) -> Optional[Any]: '''simple docstring''' snake_case_ = { """repo_name""": ["""test_repo1""", """test_repo2""", ...
34
1
from unittest import TestCase from datasets import Dataset from minhash_deduplication import deduplicate_dataset, make_duplicate_clusters def UpperCamelCase( ) -> Optional[Any]: '''simple docstring''' snake_case_ = { """repo_name""": ["""test_repo1""", """test_repo2""", ...
34
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 ConfigTester ...
34
1
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 __lowerCamelCase ( ...
34
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 lowerCamelCase_ = logging.get_logger(__name__) lowerCamelCase_ = { '''google/mobilenet...
34
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 from ...utils.backbone_utils import BackboneConfigMixin, get_aligned_output_features_output_indices lowerCame...
34
# HF Trainer benchmarking tool # # This tool can be used to run and compare multiple dimensions of the HF Trainers args. # # It then prints a report once in github format with all the information that needs to be shared # with others and second time in a console-friendly format, so it's easier to use for tuning thing...
34
1
import warnings from ...utils import logging from .image_processing_beit import BeitImageProcessor lowerCamelCase_ = logging.get_logger(__name__) class __lowerCamelCase ( __snake_case ): def __init__( self , *lowerCamelCase , **lowerCamelCase ) ...
34
import json from typing import List, Optional, Tuple from tokenizers import normalizers from ....tokenization_utils_fast import PreTrainedTokenizerFast from ....utils import logging from .tokenization_retribert import RetriBertTokenizer lowerCamelCase_ = logging.get_logger(__name__) lowerCamelCase_ ...
34
1
import collections import json import math import os import re import time from fnmatch import fnmatch from typing import Dict import requests from slack_sdk import WebClient lowerCamelCase_ = WebClient(token=os.environ['''CI_SLACK_BOT_TOKEN''']) def UpperCamelCase( lowercase_ ) -> ...
34
from argparse import ArgumentParser from datasets.commands.convert import ConvertCommand from datasets.commands.dummy_data import DummyDataCommand from datasets.commands.env import EnvironmentCommand from datasets.commands.run_beam import RunBeamCommand from datasets.commands.test import TestCommand from datasets.ut...
34
1
lowerCamelCase_ = '''Tobias Carryer''' from time import time class __lowerCamelCase : def __init__( self , lowerCamelCase , lowerCamelCase , lowerCamelCase , lowerCamelCase=int(time() ) ) -> Optional[Any]: # noqa: B008 snake...
34
import numpy as np def UpperCamelCase( lowercase_ ) -> np.array: '''simple docstring''' return (2 / (1 + np.exp(-2 * vector ))) - 1 if __name__ == "__main__": import doctest doctest.testmod()
34
1
import argparse import json import os import fairseq import torch from fairseq.data import Dictionary from transformers import ( WavaVecaConformerConfig, WavaVecaConformerForCTC, WavaVecaConformerForPreTraining, WavaVecaCTCTokenizer, WavaVecaFeatureExtractor, WavaVecaProcessor, logging, ...
34
from typing import TYPE_CHECKING from ...utils import OptionalDependencyNotAvailable, _LazyModule, is_tokenizers_available, is_torch_available lowerCamelCase_ = { '''configuration_graphormer''': ['''GRAPHORMER_PRETRAINED_CONFIG_ARCHIVE_MAP''', '''GraphormerConfig'''], } try: if not is_torch_avail...
34
1
import os from distutils.util import strtobool def UpperCamelCase( lowercase_ , lowercase_ ) -> int: '''simple docstring''' for e in env_keys: snake_case_ = int(os.environ.get(lowercase_ , -1 ) ) if val >= 0: return val return default...
34
from typing import List, Optional, Union import torch from transformers import ( XLMRobertaTokenizer, ) from ...models import UNetaDConditionModel, VQModel from ...pipelines import DiffusionPipeline from ...pipelines.pipeline_utils import ImagePipelineOutput from ...schedulers import DDIMScheduler, DDPMSchedule...
34
1
def UpperCamelCase( lowercase_ ) -> int: '''simple docstring''' if not isinstance(lowercase_ , lowercase_ ): raise ValueError("""Input must be an integer""" ) if input_num <= 0: raise ValueError("""Input must be positive""" ) return sum( divis...
34
import enum import os from hashlib import shaaaa from typing import Optional from .. import config from .logging import get_logger lowerCamelCase_ = get_logger(__name__) class __lowerCamelCase ( enum.Enum ): lowerCamelCase_ : Dict = 'all_checks' lowerCamelCas...
34
1
from pathlib import PurePosixPath from typing import Optional import fsspec from fsspec import AbstractFileSystem from huggingface_hub.hf_api import DatasetInfo from ..utils.file_utils import get_authentication_headers_for_url from ..utils.hub import hf_hub_url class __lowerCamelCase ( __snake_case...
34
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 lowerCamelCase_ = logging.get_logger(__name__) lowerCamelCase_ = { '''google/mobilenet...
34
1
import gzip import hashlib import json import multiprocessing import os import re import shutil import time from pathlib import Path import numpy as np from arguments import PreprocessingArguments from datasets import load_dataset from minhash_deduplication import deduplicate_dataset from transformers import AutoTo...
34
import argparse import json import os import numpy as np import PIL import requests import tensorflow.keras.applications.efficientnet as efficientnet import torch from huggingface_hub import hf_hub_download from PIL import Image from tensorflow.keras.preprocessing import image from transformers import ( Efficie...
34
1
from __future__ import annotations def UpperCamelCase( lowercase_ , lowercase_ , lowercase_ ) -> dict[str, float]: '''simple docstring''' if (voltage, current, resistance).count(0 ) != 1: raise ValueError("""One and only one argument must be 0""" ) if r...
34
import numpy as np from matplotlib import pyplot as plt from sklearn.datasets import load_iris from sklearn.metrics import ConfusionMatrixDisplay from sklearn.model_selection import train_test_split from xgboost import XGBClassifier def UpperCamelCase( lowercase_ ) -> tuple: '''simple do...
34
1
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 import...
34
import argparse from tax import checkpoints from transformers import AutoConfig, FlaxAutoModelForSeqaSeqLM def UpperCamelCase( lowercase_ , lowercase_ , lowercase_ ) -> Any: '''simple docstring''' snake_case_ = AutoConfig.from_pretrained(lowercase_ ) s...
34
1
from collections import OrderedDict from typing import Mapping from ...configuration_utils import PretrainedConfig from ...onnx import OnnxConfig from ...utils import logging lowerCamelCase_ = logging.get_logger(__name__) lowerCamelCase_ = { '''xlm-roberta-base''': '''https://huggingface.co/...
34
import argparse import collections import json import os import re import string import sys import numpy as np lowerCamelCase_ = re.compile(R'''\b(a|an|the)\b''', re.UNICODE) lowerCamelCase_ = None def UpperCamelCase( ) -> List[Any]: '''simple docstring''' snake_ca...
34
1
import unittest from transformers import load_tool from transformers.utils import is_torch_available if is_torch_available(): import torch from transformers.testing_utils import require_torch from .test_tools_common import ToolTesterMixin @require_torch class __lowerCamelCase ( unittest.Test...
34
from torch import nn def UpperCamelCase( lowercase_ ) -> Tuple: '''simple docstring''' if act_fn in ["swish", "silu"]: return nn.SiLU() elif act_fn == "mish": return nn.Mish() elif act_fn == "gelu": return nn.GELU() else: raise ValueError(f'''Unsupported acti...
34
1
from typing import TYPE_CHECKING from ...utils import ( OptionalDependencyNotAvailable, _LazyModule, is_flax_available, is_sentencepiece_available, is_tf_available, is_tokenizers_available, is_torch_available, ) lowerCamelCase_ = { '''configuration_albert''': ['''ALBERT_PRE...
34
from __future__ import annotations def UpperCamelCase( lowercase_ , lowercase_ , lowercase_ ) -> dict[str, float]: '''simple docstring''' if (voltage, current, resistance).count(0 ) != 1: raise ValueError("""One and only one argument must be 0""" ) if r...
34
1
import argparse from transformers import ( TapasConfig, TapasForMaskedLM, TapasForQuestionAnswering, TapasForSequenceClassification, TapasModel, TapasTokenizer, load_tf_weights_in_tapas, ) from transformers.utils import logging logging.set_verbosity_info() def UpperCamelCase( ...
34
def UpperCamelCase( lowercase_ , lowercase_ ) -> str: '''simple docstring''' return "\n".join( f'''{number} * {i} = {number * i}''' for i in range(1 , number_of_terms + 1 ) ) if __name__ == "__main__": print(multiplication_table(number=5, number_of_t...
34
1
def UpperCamelCase( lowercase_ ) -> bool: '''simple docstring''' snake_case_ = 0 for ch in input_str: snake_case_ = ord(lowercase_ ) snake_case_ = pow(2 , lowercase_ ) # If we already turned on bit for current character's uni...
34
from typing import TYPE_CHECKING from ...utils import OptionalDependencyNotAvailable, _LazyModule, is_tf_available, is_torch_available lowerCamelCase_ = { '''configuration_groupvit''': [ '''GROUPVIT_PRETRAINED_CONFIG_ARCHIVE_MAP''', '''GroupViTConfig''', '''GroupViTOnnxConfig''...
34
1
from typing import TYPE_CHECKING from ...utils import ( OptionalDependencyNotAvailable, _LazyModule, is_flax_available, is_tf_available, is_tokenizers_available, is_torch_available, ) lowerCamelCase_ = { '''configuration_roformer''': ['''ROFORMER_PRETRAINED_CONFIG_ARCHIVE_MAP''...
34
from __future__ import annotations import csv import requests from bsa import BeautifulSoup def UpperCamelCase( lowercase_ = "" ) -> dict[str, float]: '''simple docstring''' snake_case_ = url or """https://www.imdb.com/chart/top/?ref_=nv_mv_250""" snake_case_ = ...
34
1
from torch import nn def UpperCamelCase( lowercase_ ) -> Tuple: '''simple docstring''' if act_fn in ["swish", "silu"]: return nn.SiLU() elif act_fn == "mish": return nn.Mish() elif act_fn == "gelu": return nn.GELU() else: raise ValueError(f'''Unsupported acti...
34
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 lowerCamelCase_ = logging.get_logger(__name__) lowerCamelCase_ = { '''facebook/levit-1...
34
1
import json import os import unittest from transformers import DebertaTokenizer, DebertaTokenizerFast from transformers.models.deberta.tokenization_deberta import VOCAB_FILES_NAMES from transformers.testing_utils import slow from ...test_tokenization_common import TokenizerTesterMixin class __lowerCamelCa...
34
import logging from transformers.configuration_utils import PretrainedConfig lowerCamelCase_ = logging.getLogger(__name__) class __lowerCamelCase ( __snake_case ): lowerCamelCase_ : Optional[int] = 'masked_bert' def __init__( self , lowerCam...
34
1
from argparse import ArgumentParser from datasets.commands.convert import ConvertCommand from datasets.commands.dummy_data import DummyDataCommand from datasets.commands.env import EnvironmentCommand from datasets.commands.run_beam import RunBeamCommand from datasets.commands.test import TestCommand from datasets.ut...
34
from unittest import TestCase from datasets import Dataset from minhash_deduplication import deduplicate_dataset, make_duplicate_clusters def UpperCamelCase( ) -> Optional[Any]: '''simple docstring''' snake_case_ = { """repo_name""": ["""test_repo1""", """test_repo2""", ...
34
1
from ...configuration_utils import PretrainedConfig from ...utils import logging lowerCamelCase_ = logging.get_logger(__name__) lowerCamelCase_ = { '''transfo-xl-wt103''': '''https://huggingface.co/transfo-xl-wt103/resolve/main/config.json''', } class __lowerCamelCase ( __sna...
34
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 ConfigTester ...
34
1
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 __lowerCamelCase ( __snake_case ): def __init__( self , lowerC...
34
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 lowerCamelCase_ = logging.get_logger(__name__) lowerCamelCase_ = { '''google/mobilenet...
34
1
def UpperCamelCase( lowercase_ , lowercase_ ) -> int: '''simple docstring''' while a != 0: snake_case_ , snake_case_ = b % a, a return b def UpperCamelCase( lowercase_ , lowercase_ ) -> int: '''simple docstring''' ...
34
# HF Trainer benchmarking tool # # This tool can be used to run and compare multiple dimensions of the HF Trainers args. # # It then prints a report once in github format with all the information that needs to be shared # with others and second time in a console-friendly format, so it's easier to use for tuning thing...
34
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 applica...
34
import json from typing import List, Optional, Tuple from tokenizers import normalizers from ....tokenization_utils_fast import PreTrainedTokenizerFast from ....utils import logging from .tokenization_retribert import RetriBertTokenizer lowerCamelCase_ = logging.get_logger(__name__) lowerCamelCase_ ...
34
1
from decimal import Decimal, getcontext from math import ceil, factorial def UpperCamelCase( lowercase_ ) -> str: '''simple docstring''' if not isinstance(lowercase_ , lowercase_ ): raise TypeError("""Undefined for non-integers""" ) elif precision < 1: r...
34
from argparse import ArgumentParser from datasets.commands.convert import ConvertCommand from datasets.commands.dummy_data import DummyDataCommand from datasets.commands.env import EnvironmentCommand from datasets.commands.run_beam import RunBeamCommand from datasets.commands.test import TestCommand from datasets.ut...
34
1
import argparse 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 import Accelerator, DistributedTy...
34
import numpy as np def UpperCamelCase( lowercase_ ) -> np.array: '''simple docstring''' return (2 / (1 + np.exp(-2 * vector ))) - 1 if __name__ == "__main__": import doctest doctest.testmod()
34
1
from collections import deque from .hash_table import HashTable class __lowerCamelCase ( __snake_case ): def __init__( self , *lowerCamelCase , **lowerCamelCase ) -> List[str]: super().__init__(*lowerCamelCase , **lowerCamelCase ) ...
34
from typing import TYPE_CHECKING from ...utils import OptionalDependencyNotAvailable, _LazyModule, is_tokenizers_available, is_torch_available lowerCamelCase_ = { '''configuration_graphormer''': ['''GRAPHORMER_PRETRAINED_CONFIG_ARCHIVE_MAP''', '''GraphormerConfig'''], } try: if not is_torch_avail...
34
1
import enum import os from hashlib import shaaaa from typing import Optional from .. import config from .logging import get_logger lowerCamelCase_ = get_logger(__name__) class __lowerCamelCase ( enum.Enum ): lowerCamelCase_ : Dict = 'all_checks' lowerCamelCas...
34
from typing import List, Optional, Union import torch from transformers import ( XLMRobertaTokenizer, ) from ...models import UNetaDConditionModel, VQModel from ...pipelines import DiffusionPipeline from ...pipelines.pipeline_utils import ImagePipelineOutput from ...schedulers import DDIMScheduler, DDPMSchedule...
34
1
import warnings from ...processing_utils import ProcessorMixin from ...tokenization_utils_base import BatchEncoding class __lowerCamelCase ( __snake_case ): lowerCamelCase_ : List[str] = ['image_processor', 'tokenizer'] lowerCamelCase_ : List[Any] = 'Chine...
34
import enum import os from hashlib import shaaaa from typing import Optional from .. import config from .logging import get_logger lowerCamelCase_ = get_logger(__name__) class __lowerCamelCase ( enum.Enum ): lowerCamelCase_ : Dict = 'all_checks' lowerCamelCas...
34
1
def UpperCamelCase( lowercase_ = 100 ) -> int: '''simple docstring''' snake_case_ = set() snake_case_ = 0 snake_case_ = n + 1 # maximum limit for a in range(2 , lowercase_ ): for b in range(2 , lowercase_ ): snake_c...
34
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 lowerCamelCase_ = logging.get_logger(__name__) lowerCamelCase_ = { '''google/mobilenet...
34
1
import random import unittest import torch from diffusers import IFInpaintingPipeline from diffusers.utils import floats_tensor from diffusers.utils.import_utils import is_xformers_available from diffusers.utils.testing_utils import skip_mps, torch_device from ..pipeline_params import ( TEXT_GUIDED_IMAGE_INPAI...
34
import argparse import json import os import numpy as np import PIL import requests import tensorflow.keras.applications.efficientnet as efficientnet import torch from huggingface_hub import hf_hub_download from PIL import Image from tensorflow.keras.preprocessing import image from transformers import ( Efficie...
34
1
from ...processing_utils import ProcessorMixin class __lowerCamelCase ( __snake_case ): lowerCamelCase_ : List[str] = 'SpeechT5FeatureExtractor' lowerCamelCase_ : str = 'SpeechT5Tokenizer' def __init__( self , lowerCamelCase , ...
34
import numpy as np from matplotlib import pyplot as plt from sklearn.datasets import load_iris from sklearn.metrics import ConfusionMatrixDisplay from sklearn.model_selection import train_test_split from xgboost import XGBClassifier def UpperCamelCase( lowercase_ ) -> tuple: '''simple do...
34
1
import json import os import shutil import warnings from argparse import ArgumentParser, Namespace from pathlib import Path from typing import List from ..utils import logging from . import BaseTransformersCLICommand try: from cookiecutter.main import cookiecutter lowerCamelCase_ = True except Im...
34
import argparse from tax import checkpoints from transformers import AutoConfig, FlaxAutoModelForSeqaSeqLM def UpperCamelCase( lowercase_ , lowercase_ , lowercase_ ) -> Any: '''simple docstring''' snake_case_ = AutoConfig.from_pretrained(lowercase_ ) s...
34
1