code
stringlengths
82
53.2k
code_codestyle
int64
0
721
style_context
stringlengths
91
41.9k
style_context_codestyle
int64
0
699
label
int64
0
1
"""simple docstring""" import json import os from datetime import date from pathlib import Path from tabulate import DataRow, TableFormat, tabulate lowerCAmelCase : Any = TableFormat( lineabove=None, linebelowheader=None, linebetweenrows=None, linebelow=None, headerrow=Data...
543
def lowerCAmelCase_ ( _lowercase : list , _lowercase : int , _lowercase : int = 0 , _lowercase : int = 0) -> int: """simple docstring""" a__ : str = right or len(_lowercase) - 1 if left > right: return -1 elif list_dat...
136
0
class UpperCamelCase_ : '''simple docstring''' def __init__( self : int , UpperCAmelCase__ : list) ->None: '''simple docstring''' A__ = set_counts A__ = max(UpperCAmelCase__) A__ = len(Uppe...
177
from __future__ import annotations import unittest from transformers import XGLMConfig, XGLMTokenizer, is_tf_available from transformers.testing_utils import require_tf, slow from ...test_configuration_common import ConfigTester from ...test_modeling_tf_common import TFModelTesterMixin, floats_tensor, ids_tenso...
177
1
import unittest from transformers import AutoTokenizer, FalconConfig, 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 Mo...
87
"""simple docstring""" import numpy as np from scipy.spatial.distance import cdist from sklearn.metrics import fa_score import datasets A__ : Optional[Any] = '\\n @inproceedings{kakwani2020indicnlpsuite,\n title={{IndicNLPSuite: Monolingual Corpora, Evaluation Benchmarks and Pre-trai...
153
0
from .testing import ( are_the_same_tensors, execute_subprocess_async, require_bnb, require_cpu, require_cuda, require_huggingface_suite, require_mps, require_multi_gpu, require_multi_xpu, require_safetensors, require_single_gpu, require_single_x...
372
__UpperCamelCase : List[str] = 256 # Modulus to hash a string __UpperCamelCase : int = 1000003 def a_ ( _A , _A ) -> bool: """simple docstring""" snake_case__ = len(_A ) snake_case__ = len(_A ) if ...
372
1
def _A ( _lowercase , _lowercase ) -> float: """simple docstring""" if density <= 0: raise ValueError('Impossible fluid density' ) if bulk_modulus <= 0: raise ValueError('Impossible bulk modulus' ) return (bulk_modulus / density) ** 0.5 if ...
1
'''simple docstring''' def lowerCAmelCase (__A , __A): """simple docstring""" if digit_amount > 0: return round(number - int(__A) , __A) return number - int(__A) if __name__ == "__main__": print(decimal_isolate(1.53, 0)) print(decimal_isolate(35.345, 1)) ...
11
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 _lowercase : int =logging.get_logger(__name__) _lowercase ...
574
'''simple docstring''' import os from shutil import copyfile from typing import List, Optional, Tuple from ...tokenization_utils import AddedToken from ...tokenization_utils_fast import PreTrainedTokenizerFast from ...utils import is_sentencepiece_available, logging if is_sentencepiece_available(): from ....
574
1
"""simple docstring""" from __future__ import annotations from collections.abc import MutableSequence class __lowercase : def __init__( self : Dict ,A : int ,A : MutableSequence[float] ): '''simple docstring''' if l...
65
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 ...
280
0
"""simple docstring""" import functools def lowercase_ ( _UpperCAmelCase , _UpperCAmelCase ): """simple docstring""" A_ : List[Any] = len(_UpperCAmelCase ) A_ : List[Any] = len(_UpperCAmelCase ) @functools.cache def min_distance(_UpperCAmelCa...
361
"""simple docstring""" from typing import Mapping from ...configuration_utils import PretrainedConfig from ...onnx import OnnxSeqaSeqConfigWithPast from ...utils import logging _lowerCamelCase : List[str] = logging.get_logger(__name__) _lowerCamelCase : str = { ...
361
1
"""simple docstring""" from typing import List import jiwer import jiwer.transforms as tr from packaging import version import datasets from datasets.config import PY_VERSION if PY_VERSION < version.parse("3.8"): import importlib_metadata else: import importlib.metadata as importlib_metadata __lowerCame...
490
"""simple docstring""" from collections.abc import Callable import numpy as np def lowercase ( __UpperCamelCase , __UpperCamelCase , __UpperCamelCase , __UpperCamelCase , __UpperCamelCase ) -> np.array: __magic_name__ = int(np.ceil((x_end - xa) / step_size ) ) __magic_nam...
490
1
def UpperCAmelCase_ ( _UpperCAmelCase = 1_0_0 ): lowerCamelCase_: int = set() lowerCamelCase_: List[Any] = 0 lowerCamelCase_: Union[str, Any] = n + 1 # maximum limit for a in range(2 , _UpperCAmelCase ): for b ...
584
from __future__ import annotations import unittest import numpy as np from transformers import OPTConfig, is_tf_available from transformers.testing_utils import require_sentencepiece, require_tf, slow from ...test_configuration_common import ConfigTester from ...test_modeling_tf_common import TFModelTeste...
584
1
'''simple docstring''' def A__ ( A_ ) -> bool: return sum(i for i in range(1 , number // 2 + 1 ) if number % i == 0 ) == number if __name__ == "__main__": print('''Program to check whether a number is a Perfect number or not...''') __magic_name__ : Dict = int(input...
497
'''simple docstring''' import os import sys __magic_name__ : str = os.path.join(os.path.dirname(__file__), '''src''') sys.path.append(SRC_DIR) from transformers import ( AutoConfig, AutoModel, AutoModelForCausalLM, AutoModelForMaskedLM, AutoModelForQuestionAnswering, AutoMo...
497
1
'''simple docstring''' import json import os import unittest from transformers.models.biogpt.tokenization_biogpt import VOCAB_FILES_NAMES, BioGptTokenizer from transformers.testing_utils import slow from ...test_tokenization_common import TokenizerTesterMixin class _lowerCAmelCase ...
411
'''simple docstring''' import importlib import json import os from collections import OrderedDict from typing import Dict, Optional, Union # Build the list of all image processors from ...configuration_utils import PretrainedConfig from ...dynamic_module_utils import get_class_from_dynamic...
411
1
"""simple docstring""" from __future__ import annotations def __snake_case ( __A : Tuple ) -> Dict: '''simple docstring''' create_state_space_tree(SCREAMING_SNAKE_CASE_ , [] , 0 , [0 for i in range(len(SCREAMING_SNAKE_CASE_ ) )] ) def _...
265
from typing import TYPE_CHECKING from ...utils import OptionalDependencyNotAvailable, _LazyModule, is_tf_available, is_torch_available _snake_case = { '''configuration_tapas''': ['''TAPAS_PRETRAINED_CONFIG_ARCHIVE_MAP''', '''TapasConfig'''], '''tokenization_tapas''': ['''TapasTokenizer'''], ...
340
0
'''simple docstring''' from typing import List, Optional, Union from ...processing_utils import ProcessorMixin from ...tokenization_utils_base import BatchEncoding, PaddingStrategy, PreTokenizedInput, TextInput, TruncationStrategy from ...utils import TensorType class UpperCamelCase__ ( __SCREAMING...
714
from typing import List, Optional, Union from ...processing_utils import ProcessorMixin from ...tokenization_utils_base import BatchEncoding, PaddingStrategy, PreTokenizedInput, TextInput, TruncationStrategy from ...utils import TensorType class UpperCamelCase__ ( __SCREAMING_SNAKE_CASE ): ...
597
0
"""simple docstring""" import copy import os from typing import Union from ...configuration_utils import PretrainedConfig from ...models.auto.modeling_auto import MODEL_FOR_CAUSAL_LM_MAPPING_NAMES from ...utils import logging from ..auto import CONFIG_MAPPING UpperCAmelCase__ =logging.get_logg...
616
"""simple docstring""" def lowerCAmelCase_ ( UpperCamelCase__ : int , UpperCamelCase__ : int ): """simple docstring""" return x if y == 0 else greatest_common_divisor(UpperCamelCase__ , x % y ) def lowerCAmelCase_ ( UpperCamelCase__ ...
616
1
import requests from bsa import BeautifulSoup def UpperCamelCase__( UpperCamelCase__ : str = "https://www.worldometers.info/coronavirus" )->Dict: A__ = BeautifulSoup(requests.get(UpperCamelCase__ ).text , '''html.parser''' ) A__ = soup.findAll('...
717
import math def UpperCamelCase__( UpperCamelCase__ : int )->bool: assert isinstance(UpperCamelCase__ , UpperCamelCase__ ) and ( number >= 0 ), "'number' must been an int and positive" if 1 < number < 4: # 2 and 3 are primes ...
212
0
__magic_name__ = {str(digit): digit**5 for digit in range(10)} def _lowerCAmelCase ( A__: int ): '''simple docstring''' return sum(DIGITS_FIFTH_POWER[digit] for digit in str(A__ ) ) def _lowerCAmelCase ( ): '''simple docstring''' ...
254
import math from typing import Optional import numpy as np from ...configuration_utils import PretrainedConfig from ...utils import logging __magic_name__ = logging.get_logger(__name__) __magic_name__ = { "facebook/encodec_24khz": "https://huggingface.co/facebook/encodec_24khz/res...
254
1
import timeit import numpy as np import datasets from datasets.arrow_writer import ArrowWriter from datasets.features.features import _ArrayXD def SCREAMING_SNAKE_CASE__ ( snake_case__ :Any ) -> Optional[int]: def wrapper(*snake_case__ :Dict , **snake_case...
535
# NOTE: This file is deprecated and will be removed in a future version. # It only exists so that temporarely `from diffusers.pipelines import DiffusionPipeline` works from ...utils import deprecate from ..controlnet.pipeline_flax_controlnet import FlaxStableDiffusionControlNetPipeline # noqa: F401 ...
535
1
'''simple docstring''' import argparse import OmegaConf import torch from diffusers import DDIMScheduler, LDMPipeline, UNetLDMModel, VQModel def _lowercase ( lowerCamelCase__ : Optional[int], lowerCamelCase__ : Dict, lowerCamelCase__ : List[Any] ): _a = OmegaConf.lo...
131
'''simple docstring''' from ...configuration_utils import PretrainedConfig from ...utils import logging __snake_case : Optional[int] = logging.get_logger(__name__) __snake_case : int = { "transfo-xl-wt103": "https://huggingface.co/transfo-xl-wt103/resolve/main/config.json",...
131
1
import unittest from transformers import DebertaVaTokenizer, DebertaVaTokenizerFast from transformers.testing_utils import get_tests_dir, require_sentencepiece, require_tokenizers, slow from ...test_tokenization_common import TokenizerTesterMixin SCREAMING_SNAKE_CASE_ = get_tests_dir("""fixtures/spiece.model...
709
"""simple docstring""" import unittest from transformers import SPIECE_UNDERLINE from transformers.models.speechta import SpeechTaTokenizer from transformers.testing_utils import get_tests_dir, require_sentencepiece, require_tokenizers, slow from transformers.tokenization_utils import AddedToken from ...test_toke...
370
0
import numpy as np import torch import tqdm from ...models.unet_ad import UNetaDModel from ...pipelines import DiffusionPipeline from ...utils import randn_tensor from ...utils.dummy_pt_objects import DDPMScheduler class UpperCamelCase_ ( UpperCAmelCase__ ): '''simple docstring''' ...
87
from __future__ import annotations from collections import namedtuple def snake_case_ ( lowerCAmelCase_ : float , lowerCAmelCase_ : float , lowerCAmelCase_ : float ): __lowercase : str = namedtuple("""result""" , """na...
149
0
'''simple docstring''' from ... import PretrainedConfig UpperCamelCase_ = { "sijunhe/nezha-cn-base": "https://huggingface.co/sijunhe/nezha-cn-base/resolve/main/config.json", } class _a ( SCREAMING_SNAKE_CASE ): '''simple docstring'''...
508
'''simple docstring''' from typing import TYPE_CHECKING from ...utils import OptionalDependencyNotAvailable, _LazyModule, is_flax_available, is_torch_available UpperCamelCase_ = {"configuration_speech_encoder_decoder": ["SpeechEncoderDecoderConfig"]} try: if not is_torch_...
508
1
import random import unittest import numpy as np from diffusers import ( DPMSolverMultistepScheduler, EulerAncestralDiscreteScheduler, EulerDiscreteScheduler, LMSDiscreteScheduler, OnnxStableDiffusionImgaImgPipeline, PNDMScheduler, ) from diffusers.utils import floats_tensor from diffusers.u...
25
def A__ ( lowerCamelCase = 4_00_00_00 ) -> int: UpperCamelCase_: Dict = [] UpperCamelCase_, UpperCamelCase_: Optional[int] = 0, 1 while b <= n: if b % 2 == 0: even_fibs.append(lowerCamelCase ) UpperCamelCase_, UpperCamelCase_: ...
548
0
import functools def __lowercase ( UpperCAmelCase__ , UpperCAmelCase__ ): """simple docstring""" if not isinstance(UpperCAmelCase__ , UpperCAmelCase__ ) or not all(isinstance(UpperCAmelCase__ , UpperCAmelCase__ ) for day in days ): raise Value...
102
def __lowercase ( UpperCAmelCase__ , UpperCAmelCase__ ): """simple docstring""" assert x is not None assert y is not None __lowerCAmelCase = len(UpperCAmelCase__ ) __lowerCAmelCase = len(UpperCAmelCase__ ) # declaring the array ...
102
1
"""simple docstring""" from typing import Dict, List, Optional, Union import numpy as np from .feature_extraction_utils import BatchFeature, FeatureExtractionMixin from .utils import PaddingStrategy, TensorType, is_tf_tensor, is_torch_tensor, logging, to_numpy snake_case = log...
103
import datasets import faiss import numpy as np import streamlit as st import torch from elasticsearch import Elasticsearch from elia_utils import ( embed_questions_for_retrieval, make_qa_sas_model, qa_sas_generate, query_es_index, query_qa_dense_index, ) import transformers from transformer...
297
0
"""simple docstring""" from __future__ import annotations def _lowerCamelCase ( lowerCamelCase__ : str , lowerCamelCase__ : list[str] | None = None ): lowercase__ : List[Any] = word_bank or [] # create a table lowercase__ : int = len(lowerCamelCase__ ...
128
"""simple docstring""" import os def _lowerCamelCase ( lowerCamelCase__ : str = "matrix.txt" ): with open(os.path.join(os.path.dirname(lowerCamelCase__ ) , lowerCamelCase__ ) ) as in_file: lowercase__ : Optional[Any] = in_file.read() lowercase__ : ...
128
1
def lowerCAmelCase ( UpperCAmelCase = 100_0000 ) ->int: """simple docstring""" __magic_name__ : str = [i - 1 for i in range(limit + 1 )] for i in range(2, limit + 1 ): if phi[i] == i - 1: for j in ...
154
from typing import List, Optional, TypeVar from .arrow_dataset import Dataset, _concatenate_map_style_datasets, _interleave_map_style_datasets from .dataset_dict import DatasetDict, IterableDatasetDict from .info import DatasetInfo from .iterable_dataset import IterableDataset, _concatenate_iterable_dat...
154
1
"""simple docstring""" def snake_case ( A__ ,A__ ): if a < 0 or b < 0: raise ValueError("the value of both inputs must be positive" ) UpperCAmelCase_ : List[str] = str(bin(_lowerCamelCase ) )[2:] # remove the leading "0b" UpperCAmelCase_ : Optional[Any] ...
716
"""simple docstring""" from ..utils import DummyObject, requires_backends class UpperCamelCase_ (metaclass=__A ): __magic_name__ = ['''onnx'''] def __init__( self : List[Any] , *lowerCAmelCase_ : Dict , **lowerCAmelCase_ : Dict ) -> Dict: r...
463
0
import torch import torch.nn as nn from transformers import CLIPConfig, CLIPVisionModel, PreTrainedModel from ...utils import logging UpperCAmelCase_ : List[str] = logging.get_logger(__name__) def lowerCAmelCase_ ( lowerCamelCase , lowerCamelCase ): __magic_...
21
import warnings from collections import OrderedDict from typing import Mapping from packaging import version from ...configuration_utils import PretrainedConfig from ...onnx import OnnxConfig from ...utils import logging UpperCAmelCase_ : Any = logging.get_logger(__name__) Upp...
21
1
'''simple docstring''' from __future__ import annotations def _A ( _lowerCAmelCase , _lowerCAmelCase ): """simple docstring""" __lowercase =0 __lowercase =len(_lowerCAmelCase ) - 1 while i < j: if nums[i] + nums[j] == target: ...
454
'''simple docstring''' from typing import TYPE_CHECKING from ...utils import OptionalDependencyNotAvailable, _LazyModule, is_torch_available, is_vision_available lowerCamelCase = { """configuration_mask2former""": [ """MASK2FORMER_PRETRAINED_CONFIG_ARCHIVE_MAP""", """Mask2FormerConf...
454
1
from operator import delitem, getitem, setitem import pytest from data_structures.hashing.hash_map import HashMap def __lowerCamelCase ( lowerCamelCase__ ): """simple docstring""" return getitem, k def __lowerCamelCase ( lowerCamelCase__ , lowerCamelCase__ ): """simple docstr...
496
'''simple docstring''' import math def snake_case_ ( SCREAMING_SNAKE_CASE__ ): """simple docstring""" _SCREAMING_SNAKE_CASE : Tuple = math.loga(math.sqrt(4 * positive_integer + 1 ) / 2 + 1 / 2 ) return exponent == int(SCREAMING_SNAKE_CASE__ ) def sna...
533
0
def a ( A__ , A__ , A__ ) -> float: '''simple docstring''' if principal <= 0: raise Exception('''Principal borrowed must be > 0''' ) if rate_per_annum < 0: raise Exception('''Rate of interest must be >= 0''' ) if...
250
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 a_ :s...
250
1
import math import tensorflow as tf from packaging import version def lowerCamelCase__ ( lowercase ): """simple docstring""" SCREAMING_SNAKE_CASE : str = tf.convert_to_tensor(lowercase ) SCREAMING_SNAKE_CASE : Optional[int] = 0.5 * (1.0 + t...
62
'''simple docstring''' from ..utils import DummyObject, requires_backends class a ( metaclass=SCREAMING_SNAKE_CASE ): """simple docstring""" __UpperCAmelCase = ["""transformers""", """torch""", """note_seq"""] def __init__( self : Dict...
347
0
'''simple docstring''' import os import unicodedata from shutil import copyfile from typing import Any, Dict, List, Optional, Tuple import sentencepiece as spm from ...tokenization_utils import AddedToken, PreTrainedTokenizer from ...utils import logging __lowercase : str = logging.get_logger(__n...
357
'''simple docstring''' import asyncio import os import shutil import subprocess import sys import tempfile import unittest from distutils.util import strtobool from functools import partial from pathlib import Path from typing import List, Union from unittest import mock import torch from ..state import Accelerato...
357
1
'''simple docstring''' from argparse import ArgumentParser from . import BaseTransformersCLICommand def a_ ( _UpperCAmelCase : Dict ) -> List[Any]: return DownloadCommand(args.model ,args.cache_dir ,args.force ,args.trust_remote_code ) class snake_case__ ( SCREA...
286
'''simple docstring''' import pickle import numpy as np from matplotlib import pyplot as plt class snake_case__ : def __init__( self : List[Any] , __a : str , __a : Dict , __a : List[Any] , __a : str , ...
286
1
from numpy import exp, pi, sqrt def lowerCAmelCase_ ( SCREAMING_SNAKE_CASE : Optional[int] , SCREAMING_SNAKE_CASE : float = 0.0 , SCREAMING_SNAKE_CASE : float = 1.0 ): '''simple docstring''' return 1 / ...
702
"""simple docstring""" import builtins import sys from ...utils.imports import _is_package_available from . import cursor, input from .helpers import Direction, clear_line, forceWrite, linebreak, move_cursor, reset_cursor, writeColor from .keymap import KEYMAP _UpperCamelCase = ...
363
0
"""simple docstring""" from __future__ import annotations def a ( __UpperCAmelCase : int | str ) -> bool: __magic_name__: List[str] = str(__UpperCAmelCase ) return n == n[::-1] def a ( __UpperCAmelCase : int = ...
96
import torch from diffusers import UnCLIPScheduler from .test_schedulers import SchedulerCommonTest class snake_case ( __snake_case ): """simple docstring""" __lowerCAmelCase = (UnCLIPScheduler,) def snake_case__ ( self , **lowerCAmelCase_ ): __lower...
321
0
def a__ ( a ) -> None: A_ : List[Any] = generate_pascal_triangle(a ) for row_idx in range(a ): # Print left spaces for _ in range(num_rows - row_idx - 1 ): print(end=''' ''' ) # Print...
707
import os from shutil import copyfile from typing import Any, Dict, List, Optional, Tuple import sentencepiece as spm from ...tokenization_utils import AddedToken, BatchEncoding, PreTrainedTokenizer from ...utils import logging _lowerCAmelCase = logging.get_logger(__name__) _lowerCAmelCase = ...
236
0
'''simple docstring''' def _lowerCAmelCase ( __magic_name__ : Optional[int] ) -> Union[str, Any]: return [ { 0: [1, 2], 1: [0, 2], 2: [0, 1, 3, 5], 3: [2, 4], 4: [3], 5: [2, 6, 8], ...
92
'''simple docstring''' from __future__ import annotations def _lowerCAmelCase ( __magic_name__ : list[float] ) -> float: lowercase : Any =0.0_0 lowercase : Tuple =0 for resistor in resistors: if resistor <= 0: l...
92
1
from __future__ import annotations import unittest from transformers import LEDConfig, is_tf_available from transformers.testing_utils import require_tf, slow from ...test_configuration_common import ConfigTester from ...test_modeling_tf_common import TFModelTesterMixin, ids_tensor from ...test_pipeline_mixin import...
702
import functools import operator from ...configuration_utils import PretrainedConfig from ...utils import logging __lowercase = logging.get_logger(__name__) __lowercase = { '''microsoft/unispeech-large-1500h-cv''': ( '''https://huggingface.co/microsoft/unispeech-large-1500h...
452
0
'''simple docstring''' from dataclasses import dataclass from typing import Dict, Optional, Tuple, Union import torch import torch.nn as nn from ..configuration_utils import ConfigMixin, register_to_config from ..utils import BaseOutput, apply_forward_hook from .attention_processor import AttentionProcessor, A...
131
import itertools import random import unittest import numpy as np from transformers import is_speech_available from transformers.testing_utils import require_torch, require_torchaudio from ...test_sequence_feature_extraction_common import SequenceFeatureExtractionTestMixin if is_speech_available(): from trans...
457
0
"""simple docstring""" from ...configuration_utils import PretrainedConfig from ...utils import logging __A : Optional[int] = logging.get_logger(__name__) __A : Union[str, Any] = { "uclanlp/visualbert-vqa": "https://huggingface.co/uclanlp/visualbert-vqa/r...
95
"""simple docstring""" from collections import UserDict from typing import Union import numpy as np import requests from ..utils import ( add_end_docstrings, logging, ) from .audio_classification import ffmpeg_read from .base import PIPELINE_INIT_ARGS, Pipeline __A : List[...
95
1
'''simple docstring''' from typing import List, Optional from ...configuration_utils import PretrainedConfig from ...utils import logging a : List[str] = logging.get_logger(__name__) a : Tuple = { '''huggingface/autoformer-tourism-monthly''': '''https:...
69
'''simple docstring''' import unittest from transformers import AutoTokenizer, FalconConfig, 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 ...
69
1
"""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 ...
197
"""simple docstring""" from __future__ import annotations import math def UpperCAmelCase__ ( lowerCAmelCase__ :int ) -> list[int]: '''simple docstring''' if num <= 0: lowercase = f'{num}: Invalid input, please enter a positive integer....
197
1
from typing import List, Optional, Tuple, Union import torch from ...models import UNetaDModel from ...schedulers import ScoreSdeVeScheduler from ...utils import randn_tensor from ..pipeline_utils import DiffusionPipeline, ImagePipelineOutput class _UpperCamelCase( __lowerCa...
47
import copy import os from typing import TYPE_CHECKING, List, Union if TYPE_CHECKING: pass from ...configuration_utils import PretrainedConfig from ...utils import logging lowerCamelCase : Optional[Any] = logging.get_logger(__name__) lowerCamelCase : Tuple = { '''kakaobrain...
149
0
'''simple docstring''' import requests from bsa import BeautifulSoup def __lowerCamelCase ( __lowerCAmelCase : str = "AAPL" ) -> str: snake_case = F'''https://in.finance.yahoo.com/quote/{symbol}?s={symbol}''' snake_case = BeautifulSoup(request...
517
'''simple docstring''' import argparse from collections import defaultdict import yaml _SCREAMING_SNAKE_CASE = "docs/source/en/_toctree.yml" def __lowerCamelCase ( __lowerCAmelCase : Tuple ) -> Optional[int]: snake_case = defaultdict(__l...
517
1
"""simple docstring""" import logging import re import pytorch_quantization import pytorch_quantization.nn as quant_nn import torch from pytorch_quantization import calib from pytorch_quantization.tensor_quant import QuantDescriptor __magic_name__ = logging.getLogger(__name__) __magic_name__ ...
129
"""simple docstring""" from typing import TYPE_CHECKING from ...utils import ( OptionalDependencyNotAvailable, _LazyModule, is_sentencepiece_available, is_tokenizers_available, is_torch_available, ) __magic_name__ = {"""configuration_reformer""": ["""REFORMER_PRETRAINED_CONFIG_A...
129
1
from __future__ import annotations from collections.abc import Callable from typing import Generic, TypeVar __magic_name__ = TypeVar('T') __magic_name__ = TypeVar('U') class __lowerCAmelCase ( Generic[T, U] ): '''simple docstring''' def __init__( self : Dict ,_a...
703
'''simple docstring''' import itertools import json import linecache import os import pickle import re import socket import string from collections import Counter from logging import getLogger from pathlib import Path from typing import Callable, Dict, Iterable, List import git import torch from torch.utils.data ...
27
0
from dataclasses import dataclass, field from typing import Optional @dataclass class __lowercase : '''simple docstring''' SCREAMING_SNAKE_CASE = field( default="codeparrot/codeparrot" , metadata={"help": "Model name or path of model to be trained."} ) SCREAMI...
637
def _SCREAMING_SNAKE_CASE ( __lowercase : List[Any] ) -> Any: """simple docstring""" stooge(__lowercase , 0 , len(__lowercase ) - 1 ) return arr def _SCREAMING_SNAKE_CASE ( __lowercase : str , __lowercase : Dict...
637
1
'''simple docstring''' import unittest from transformers import is_vision_available from transformers.pipelines import pipeline from transformers.testing_utils import ( is_pipeline_test, nested_simplify, require_tf, require_torch, require_vision, slow, ) from .test_pipelines_common import A...
700
'''simple docstring''' import unittest from datasets import load_dataset from transformers.pipelines import pipeline from transformers.testing_utils import is_pipeline_test, nested_simplify, require_torch, slow @is_pipeline_test @require_torch class _lowerCamelCase ( unittest.TestCase ): '''s...
540
0
from datetime import datetime import requests from bsa import BeautifulSoup if __name__ == "__main__": __a = input('Enter image url: ').strip() print(f"Downloading image from {url} ...") __a = BeautifulSoup(requests.get(url).content, 'html.parser') # The image UR...
97
"""simple docstring""" from manim import * class lowercase_ ( __lowerCAmelCase ): '''simple docstring''' def lowerCAmelCase_ ( self : Union[str, Any] ): _A = Rectangle(height=0.5 , width=0.5 ) _A = Rectangle(height=0.46 , w...
7
0
from ...utils import ( OptionalDependencyNotAvailable, is_torch_available, is_transformers_available, is_transformers_version, ) try: if not (is_transformers_available() and is_torch_available()): raise OptionalDependencyNotAvailable() except OptionalDependencyNotAvailable: from .....
664
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 tor...
664
1
import warnings from ...utils import is_sklearn_available, requires_backends if is_sklearn_available(): from scipy.stats import pearsonr, spearmanr from sklearn.metrics import fa_score, matthews_corrcoef __snake_case = ( '''This metric will be removed from the library soo...
1
from multiprocessing import Lock, Pipe, Process # lock used to ensure that two processes do not access a pipe at the same time SCREAMING_SNAKE_CASE__ = Lock() def lowercase ( a , a , a , a , a , a , a ): '''simple docstring''' global process_lock # we perfor...
631
0
import json import os import subprocess import unittest from ast import literal_eval import pytest from parameterized import parameterized, parameterized_class from . import is_sagemaker_available if is_sagemaker_available(): from sagemaker import Session, TrainingJobAnalytics from sagemak...
701
import itertools import os import random import tempfile import unittest import numpy as np from transformers import TvltFeatureExtractor, is_datasets_available from transformers.testing_utils import check_json_file_has_correct_format, require_torch, require_torchaudio from transformers.utils.import_uti...
346
0
"""simple docstring""" from __future__ import annotations from decimal import Decimal from math import * # noqa: F403 from sympy import diff def __lowerCamelCase ( __UpperCamelCase , __UpperCamelCase , __UpperCamelCase = 10**-10 ) -> Tuple: """simple docstring""" lower...
610
import math import torch from torch import nn from ..configuration_utils import ConfigMixin, register_to_config from .attention_processor import Attention from .embeddings import get_timestep_embedding from .modeling_utils import ModelMixin class UpperCAmelCase__ ( A__ , A__ ): """simple ...
493
0
import random import unittest import numpy as np import transformers from transformers import is_flax_available, is_torch_available from transformers.testing_utils import is_pt_flax_cross_test, require_flax if is_flax_available(): import os import jax.numpy as jnp from jax import jit from tra...
704
from typing import TYPE_CHECKING from ...utils import ( OptionalDependencyNotAvailable, _LazyModule, is_sentencepiece_available, is_torch_available, ) a_ : int = { 'configuration_speecht5': [ 'SPEECHT5_PRETRAINED_CONFIG_ARCHIVE_MAP', 'SPEECHT5_PRETRAINE...
444
0
import argparse import json import requests import torch from huggingface_hub import hf_hub_download from PIL import Image from transformers import ConvNextConfig, SegformerImageProcessor, UperNetConfig, UperNetForSemanticSegmentation def UpperCamelCase ( __magic_name__ : Lis...
15
'''simple docstring''' import inspect import tempfile import unittest from huggingface_hub import hf_hub_download from transformers import is_torch_available from transformers.testing_utils import is_flaky, require_torch, slow, torch_device from ...test_configuration_common import ConfigTester from ...test_...
11
0
import tempfile import unittest import numpy as np from diffusers import ( DDIMScheduler, DPMSolverMultistepScheduler, EulerAncestralDiscreteScheduler, EulerDiscreteScheduler, LMSDiscreteScheduler, OnnxStableDiffusionPipeline, PNDMScheduler, ) from diffusers.utils.testing_utils impor...
709
from math import factorial, radians def A__ ( SCREAMING_SNAKE_CASE__ , SCREAMING_SNAKE_CASE__ = 18 , SCREAMING_SNAKE_CASE__ = 10) -> float: __snake_case: Union[str, Any] = angle_in_degrees - ((angle_in_degrees // 360.0) * 360.0) # Converting from de...
155
0
from typing import TYPE_CHECKING from ...utils import OptionalDependencyNotAvailable, _LazyModule, is_torch_available UpperCamelCase__ : Union[str, Any] = {'''configuration_sew''': ['''SEW_PRETRAINED_CONFIG_ARCHIVE_MAP''', '''SEWConfig''']} try: if not is_torch_available(): raise...
105
'''simple docstring''' def snake_case_ ( _lowerCAmelCase : int ) -> list: UpperCAmelCase : Union[str, Any] = int(_lowerCAmelCase ) if n_element < 1: UpperCAmelCase : int = ValueError('''a should be a positive num...
127
0
import argparse import os import re # All paths are set with the intent you should run this script from the root of the repo with the command # python utils/check_dummies.py __a : Dict = """src/diffusers""" # Matches is_xxx_available() __a : Dict = re.compi...
414
# 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 # # Unl...
414
1
'''simple docstring''' import tempfile import unittest from pathlib import Path from shutil import copyfile from transformers import MaMaaaTokenizer, is_torch_available from transformers.testing_utils import ( get_tests_dir, nested_simplify, require_sentencepiece, require_token...
442
'''simple docstring''' import argparse import os import sys from unittest.mock import patch import pytorch_lightning as pl import timeout_decorator import torch from distillation import SummarizationDistiller, distill_main from finetune import SummarizationModule, main from transformers impo...
442
1
"""simple docstring""" import pytest from datasets.parallel import ParallelBackendConfig, parallel_backend from datasets.utils.py_utils import map_nested from .utils import require_dill_gt_0_3_2, require_joblibspark, require_not_windows def lowerCamelCase ( _UpperCamelCase : Any ) -> Optional[int]...
299
"""simple docstring""" import collections import os from shutil import copyfile from typing import Any, Dict, List, Optional, Tuple from ...tokenization_utils import PreTrainedTokenizer from ...utils import logging UpperCAmelCase : Union[str, Any] = logging.get_logger(__name__) UpperCAmelCase ...
299
1
def lowerCamelCase__ ( _a): SCREAMING_SNAKE_CASE : Optional[Any] = int(_a) if decimal in (0, 1): # Exit cases for the recursion return str(_a) SCREAMING_SNAKE_CASE ,SCREAMING_SNAKE_CASE : int = divmod(_a , 2) return binary_recursive(_a) + str(_a) def lowerCam...
25
"""simple docstring""" import unittest import numpy as np from transformers import is_flax_available from transformers.testing_utils import require_flax from ..test_modeling_flax_common import ids_tensor if is_flax_available(): import jax import jax.numpy as jnp from transformers.gene...
470
0
from typing import TYPE_CHECKING from ...utils import ( OptionalDependencyNotAvailable, _LazyModule, is_flax_available, is_tf_available, is_tokenizers_available, is_torch_available, ) UpperCAmelCase_ : List[Any] = { """configuration_roberta""": ["""ROBERTA_PRET...
715
import json import os from collections import Counter import torch import torchvision import torchvision.transforms as transforms from PIL import Image from torch import nn from torch.utils.data import Dataset UpperCAmelCase_ = {1: (1, 1), 2: (2, 1), 3: (3, 1), 4: (2, 2), 5: (5, 1), 6: (3, 2), ...
541
0
'''simple docstring''' 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_sta...
75
'''simple docstring''' from pathlib import Path import cva import numpy as np from matplotlib import pyplot as plt def a__ ( lowerCAmelCase__ , lowerCAmelCase__ , lowerCAmelCase__ , lowerCAmelCase__ , lowerCAmelCase__ ) -> np.ndarray: UpperCAmelCase__ ...
75
1
from __future__ import annotations def lowerCAmelCase__ ( _a : list[int] , _a : int , _a : int , _a : int ): if (direction == 1 and array[indexa] > array[indexa]) or ( direction == 0 and array[indexa] < array[indexa] ): snake_case_ , ...
114
import warnings from typing import List, Optional, Union from ...processing_utils import ProcessorMixin from ...tokenization_utils_base import BatchEncoding, PaddingStrategy, PreTokenizedInput, TextInput, TruncationStrategy from ...utils import TensorType class UpperCAmelCase_ ( SCREAMING_SNAKE_CASE_...
114
1
'''simple docstring''' def SCREAMING_SNAKE_CASE ( lowerCAmelCase__ : int = 1_00_00_00) -> int: '''simple docstring''' _lowercase : str = limit + 1 _lowercase : int = [0] * limit for first_term in range(1 , lowerCAmelCase__): ...
125
'''simple docstring''' import os import zipfile import requests from get_ci_error_statistics import download_artifact, get_artifacts_links def SCREAMING_SNAKE_CASE ( lowerCAmelCase__ : int , lowerCAmelCase__ : Optional[int]=7) -> Any: '''simple docstring''' ...
125
1
"""simple docstring""" def lowercase__ ( lowercase_ ) -> Union[str, Any]: """simple docstring""" _UpperCamelCase : List[Any] = len(lowercase_ ) for i in range(length - 1 ): _UpperCamelCase : Optional[int] = i f...
51
"""simple docstring""" lowerCamelCase__ = "\n# Installazione di Transformers\n! pip install transformers datasets\n# Per installare dalla fonte invece dell'ultima versione rilasciata, commenta il comando sopra e\n# rimuovi la modalità commento al comando seguente.\n# ! pip install git+https://github.com/...
51
1
"""simple docstring""" import re def lowercase__( __SCREAMING_SNAKE_CASE : str ): lowercase_ : str = re.compile( R'^(?:0|94|\+94|0{2}94)' R'7(0|1|2|4|5|6|7|8)' R'(-| |)' R'\d{7}$' ) return bool(re.search(__SCREAMING_SNAKE_CASE , __SCREAMING_SNAKE_CASE ) )...
425
"""simple docstring""" import gc import tempfile import unittest import numpy as np import torch from diffusers import VersatileDiffusionPipeline from diffusers.utils.testing_utils import load_image, nightly, require_torch_gpu, torch_device __SCREAMING_SNAKE_CASE =False class UpperCamel...
425
1
import numpy as np from scipy.spatial.distance import cdist from sklearn.metrics import fa_score import datasets snake_case = """\ @inproceedings{kakwani2020indicnlpsuite, title={{IndicNLPSuite: Monolingual Corpora, Evaluation Benchmarks and Pre-trained Multilingual Language Models for Indian ...
720
from ..utils import DummyObject, requires_backends class SCREAMING_SNAKE_CASE ( metaclass=lowerCAmelCase ): '''simple docstring''' UpperCamelCase_ : Union[str, Any] = ['''keras_nlp'''] def __init__( self : Dict , *UpperCAmelCase_ : Optional[Any] , **U...
488
0
"""simple docstring""" def lowerCAmelCase_ ( lowercase_ : int ): '''simple docstring''' assert ( isinstance(lowercase_ , lowercase_ ) and number_of_steps > 0 ), F'''number_of_steps needs to be positive integer, your input {number_of_steps}''' if number_of_steps...
674
"""simple docstring""" import json import pathlib import unittest import numpy as np from transformers.testing_utils import require_torch, require_vision, slow from transformers.utils import is_torch_available, is_vision_available from ...test_image_processing_common import ImageProcessingSavingTestMixin,...
674
1
from ...configuration_utils import PretrainedConfig from ...utils import logging lowercase_ = logging.get_logger(__name__) lowercase_ = { 'tanreinama/GPTSAN-2.8B-spout_is_uniform': ( 'https://huggingface.co/tanreinama/GPTSAN-2.8B-spout_is_uniform/resolve/main/c...
380
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 a ( ...
380
1
'''simple docstring''' import contextlib import csv import json import os import sqlitea import tarfile import textwrap import zipfile import pyarrow as pa import pyarrow.parquet as pq import pytest import datasets import datasets.config @pytest.fixture(scope="session" ) def UpperCAmelCase_ (...
310
"""simple docstring""" import argparse import pathlib import fairseq import torch from fairseq.models.roberta import RobertaModel as FairseqRobertaModel from fairseq.modules import TransformerSentenceEncoderLayer from packaging import version from transformers import XLMRobertaConfig, XLMRobertaXLForMaskedLM, XL...
200
0
import warnings warnings.warn( "memory_utils has been reorganized to utils.memory. Import `find_executable_batchsize` from the main `__init__`: " "`from accelerate import find_executable_batch_size` to avoid this warning.", FutureWarning, )
677
from typing import TYPE_CHECKING from ...utils import ( OptionalDependencyNotAvailable, _LazyModule, is_flax_available, is_tf_available, is_tokenizers_available, is_torch_available, is_vision_available, ) UpperCamelCase = { "configuration_clip": [ "CLIP_PRETRAINED_CO...
677
1
'''simple docstring''' import os def UpperCamelCase ( ) -> str: '''simple docstring''' with open(os.path.dirname(lowercase_ ) + '''/grid.txt''' ) as f: lowercase =[] # noqa: E741 for _ in range(2_0 ): l.append([int(lowercase_ ) for x in f.readline().split()] ) lowe...
72
'''simple docstring''' from torch import nn class A ( nn.Module ): def __init__( self , snake_case_ , snake_case_ ) -> List[Any]: super().__init__() _a = class_size _a = embed_size # self.mlp1 = nn.Linear(embed_size, emb...
131
0
"""simple docstring""" from typing import TYPE_CHECKING from ...utils import OptionalDependencyNotAvailable, _LazyModule, is_torch_available, is_vision_available UpperCAmelCase: Union[str, Any] = { """configuration_mask2former""": [ """MASK2FORMER_PRETRAINED_CONFIG_ARCHIVE_MAP"""...
707
"""simple docstring""" import argparse import json import os import time import zipfile from get_ci_error_statistics import download_artifact, get_artifacts_links from transformers import logging UpperCAmelCase: str = logging.get_logger(__name__) def __SCREAMING_SNAKE_CASE ( __Up...
600
0
'''simple docstring''' from __future__ import annotations def A (__lowerCamelCase :list[int | float] , __lowerCamelCase :int , __lowerCamelCase :int ): if len(__lowerCamelCase ) == 0: raise ValueError("""find_max() arg is an empty sequence""" ) if ( ...
5
def A ( __UpperCamelCase , __UpperCamelCase , __UpperCamelCase ) -> int: if exponent == 1: return base if exponent % 2 == 0: A__ = _modexpt(__UpperCamelCase , exponent // 2 , __UpperCamelCase ) % modulo_value return (x * x) % modul...
9
0
from ...configuration_utils import PretrainedConfig from ...utils import logging from ...utils.backbone_utils import BackboneConfigMixin, get_aligned_output_features_output_indices _snake_case = logging.get_logger(__name__) _snake_case = { """shi-labs/nat-mini-in1k-224""": """https://hugg...
611
import importlib import json import os from collections import OrderedDict from typing import Dict, Optional, Union # Build the list of all image processors from ...configuration_utils import PretrainedConfig from ...dynamic_module_utils import get_class_from_dynamic_module, resolve_trust_remote_code from ...ima...
611
1
'''simple docstring''' import numpy as np class UpperCamelCase_ : """simple docstring""" def __init__( self : Optional[int] ) -> Union[str, Any]: __magic_name__ = (0, 0) __magic_name__ = None __magic_name__ = 0 ...
664
"""simple docstring""" from collections import OrderedDict from typing import Mapping from ...configuration_utils import PretrainedConfig from ...onnx import OnnxConfig from ...utils import logging lowerCamelCase__ : Tuple = logging.get_logger(__name__) lowerCamelCase__ : Any =...
698
0
import json from typing import List, Optional, Tuple from tokenizers import normalizers from ...tokenization_utils_fast import PreTrainedTokenizerFast from ...utils import logging from .tokenization_convbert import ConvBertTokenizer lowercase_ = logging.get_logger(__name__) lowercase_ = {'vocab_fi...
718
# Copyright 2023 The HuggingFace Inc. team. All rights reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by a...
230
0
'''simple docstring''' from typing import TYPE_CHECKING from ...utils import _LazyModule __lowerCAmelCase = {'processing_wav2vec2_with_lm': ['Wav2Vec2ProcessorWithLM']} if TYPE_CHECKING: from .processing_wavaveca_with_lm import WavaVecaProcessorWithLM else: import sys __lowerCAmelCase = _...
585
'''simple docstring''' import unittest import numpy as np import torch from diffusers import PNDMPipeline, PNDMScheduler, UNetaDModel from diffusers.utils.testing_utils import enable_full_determinism, require_torch, slow, torch_device enable_full_determinism() class _lowerCAmelCase ( unittest.Te...
585
1
import unittest import numpy as np from transformers import AlbertConfig, is_flax_available from transformers.testing_utils import require_flax, slow from ...test_modeling_flax_common import FlaxModelTesterMixin, ids_tensor, random_attention_mask if is_flax_available(): import jax.numpy as jnp fr...
702
def UpperCamelCase__ ( SCREAMING_SNAKE_CASE__ , SCREAMING_SNAKE_CASE__ ): _validate_point(SCREAMING_SNAKE_CASE__ ) _validate_point(SCREAMING_SNAKE_CASE__ ) if len(SCREAMING_SNAKE_CASE__ ) != len(SCREAMING_SNAKE_CASE__ ): raise ValueError('Both points must be in the same n-dimensional space' ) ...
230
0
"""simple docstring""" import inspect import os import unittest from pathlib import Path import torch import accelerate from accelerate.test_utils import execute_subprocess_async from accelerate.test_utils.testing import run_command class lowercase__ ( unittest.TestCase ): __Up...
88
'''simple docstring''' import math import sys def _lowerCAmelCase ( __snake_case : int ) -> int: if number != int(__snake_case ): raise ValueError('the value of input must be a natural number' ) if number < 0: raise ValueE...
8
0
"""simple docstring""" from __future__ import annotations import os import tempfile import unittest from transformers import ConvBertConfig, is_tf_available from transformers.testing_utils import require_tf, slow from ...test_configuration_common import ConfigTester from ...test_modeling_tf_common import TFMod...
717
"""simple docstring""" import uuid from typing import Any, Dict, List, Optional, Union from ..utils import add_end_docstrings, is_tf_available, is_torch_available, logging from .base import PIPELINE_INIT_ARGS, Pipeline if is_tf_available(): import tensorflow as tf if is_torch_available(): import...
505
0
import itertools import json import os import unittest from transformers import AddedToken, RobertaTokenizer, RobertaTokenizerFast from transformers.models.roberta.tokenization_roberta import VOCAB_FILES_NAMES from transformers.testing_utils import require_tokenizers, slow from ...test_tokenization_common import...
587
def SCREAMING_SNAKE_CASE__ ( lowercase ) -> bool: snake_case : set[int] = set() # To detect a back edge, keep track of vertices currently in the recursion stack snake_case : set[int] = set() return any( node not in visited and depth_first_search(...
587
1
from transformers import HfArgumentParser, TensorFlowBenchmark, TensorFlowBenchmarkArguments def _UpperCAmelCase ( ): """simple docstring""" __lowerCamelCase : Union[str, Any] = HfArgumentParser(UpperCAmelCase ) __lowerCamelCase ...
458
import argparse import hashlib import os import urllib import warnings import torch from torch import nn from tqdm import tqdm from transformers import WhisperConfig, WhisperForConditionalGeneration __UpperCamelCase : Tuple = { 'tiny.en': 'https://openaipublic.azureedge.net...
458
1
"""simple docstring""" # This script creates a super tiny model that is useful inside tests, when we just want to test that # the machinery works, without needing to the check the quality of the outcomes. # # This version creates a tiny model through reduction of a normal pre-trained model, but keeping the # ...
77
'''simple docstring''' import numpy as np def UpperCamelCase__ ( _lowercase : np.array ) -> np.array: return 1 / (1 + np.exp(-vector )) if __name__ == "__main__": import doctest doctest.testmod()
523
0
"""simple docstring""" from sklearn.metrics import fa_score, matthews_corrcoef import datasets from .record_evaluation import evaluate as evaluate_record _UpperCamelCase : Any = "\\n@article{wang2019superglue,\n title={SuperGLUE: A Stickier Benchmark for General-Purpose Language Understandi...
709
"""simple docstring""" import shutil import tempfile import unittest from unittest.mock import patch from transformers import ( DefaultFlowCallback, IntervalStrategy, PrinterCallback, ProgressCallback, Trainer, TrainerCallback, TrainingArguments, is_torch_available, ) from transfor...
645
0
def _lowerCamelCase ( __lowerCamelCase = 200_0000 ) -> int: '''simple docstring''' UpperCAmelCase__ : int = [0 for i in range(n + 1 )] UpperCAmelCase__ : Tuple = 1 UpperCAmelCase__ : List[Any] = 1 ...
79
"""simple docstring""" def _lowerCAmelCase ( lowerCamelCase__ : int ) -> int: if divisor % 5 == 0 or divisor % 2 == 0: return 0 _SCREAMING_SNAKE_CASE : int = 1 _SCREAMING_SNAKE_CASE : List[str] = 1 while repunit: _SCREAMING_SNAKE_CASE : Tuple ...
572
0
import unittest import numpy as np import torch from torch import nn from transformers import ( CLIPImageProcessor, CLIPTextConfig, CLIPTextModelWithProjection, CLIPTokenizer, CLIPVisionConfig, CLIPVisionModelWithProjection, ) from diffusers import KandinskyVaaPriorPi...
221
from __future__ import annotations import os import tempfile import unittest from transformers import ConvBertConfig, is_tf_available from transformers.testing_utils import require_tf, slow from ...test_configuration_common import ConfigTester from ...test_modeling_tf_common import TFModelTeste...
221
1
from __future__ import annotations def UpperCAmelCase_ ( snake_case__ , snake_case__ = None ) -> Optional[int]: """simple docstring""" lowerCAmelCase__ = word_bank or [] # create a table lowerCAmelCase__ = len(__snake_case ) + 1 lowerCAmelCase__ ...
193
"""simple docstring""" # limitations under the License. # NOTE: This file is deprecated and will be removed in a future version. # It only exists so that temporarely `from diffusers.pipelines import DiffusionPipeline` works from .pipelines import DiffusionPipeline, ImagePipelineOutput # noqa: F401 from ...
88
0
"""simple docstring""" import warnings from ...processing_utils import ProcessorMixin from ...tokenization_utils_base import BatchEncoding class __lowercase ( __lowerCamelCase ): snake_case_ = ["""image_processor""", """tokenizer"""] snake_case_ ...
194
"""simple docstring""" from ...configuration_utils import PretrainedConfig from ...utils import logging __UpperCAmelCase = logging.get_logger(__name__) class __lowercase ( __lowerCamelCase ): snake_case_ = """timm_backbone""" def __init__( self...
194
1
"""simple docstring""" import gc import unittest import numpy as np import torch from diffusers import DanceDiffusionPipeline, IPNDMScheduler, UNetaDModel from diffusers.utils import slow, torch_device from diffusers.utils.testing_utils import enable_full_determinism, require_torch_gpu, skip_mp...
545
"""simple docstring""" import os import tempfile import unittest from transformers import FlaubertConfig, is_torch_available from transformers.testing_utils import require_torch, require_torch_gpu, slow, torch_device from ...test_configuration_common import ConfigTester from ...test_modeling_co...
545
1
from dataclasses import dataclass from typing import Optional, Tuple import torch from torch import nn from transformers import RobertaPreTrainedModel, XLMRobertaConfig, XLMRobertaModel from transformers.utils import ModelOutput @dataclass class snake_case__ ( __A): '...
708
import numpy as np import torch from torch.utils.data import DataLoader from accelerate.utils.dataclasses import DistributedType class snake_case__ : '''simple docstring''' def __init__( self , a__=2 , a__=3 , a__=64 , a__=None ...
291
0
'''simple docstring''' import argparse import torch from transformers import BlenderbotConfig, BlenderbotForConditionalGeneration from transformers.utils import logging logging.set_verbosity_info() __UpperCamelCase = logging.get_logger(__name__) __UpperCamelCase ...
26
'''simple docstring''' import doctest import logging import os import unittest from pathlib import Path from typing import List, Union import transformers from transformers.testing_utils import require_tf, require_torch, slow __UpperCamelCase = logging.getLogger() ...
26
1
from dataclasses import dataclass from typing import Optional, Tuple, Union import numpy as np import torch from ..configuration_utils import ConfigMixin, register_to_config from ..utils import BaseOutput, randn_tensor from .scheduling_utils import SchedulerMixin @dataclass class lowerCamelCase__ ( ...
707
from __future__ import annotations import numpy as np def UpperCamelCase_( _A :list[float] )-> Union[str, Any]: return np.maximum(0 , _A ) if __name__ == "__main__": print(np.array(relu([-1, 0, 5]))) # --> [0, 0, 5]
185
0
import argparse import re import numpy as np import requests import torch from huggingface_hub import hf_hub_download from PIL import Image from transformers import ( SamConfig, SamImageProcessor, SamModel, SamProcessor, SamVisionConfig, ) __lowercase : Dict =...
54
"""simple docstring""" import numpy as np def UpperCamelCase__ ( lowercase__ : Optional[int] , lowercase__ : Union[str, Any] , lowercase__ : Any , lowercase__ : Dict , lowercase__ : List[str] ): snake_case : Optional[int] = int(np.ceil((x_en...
134
0
import inspect import math import tempfile import unittest import numpy as np from transformers import ViTMAEConfig from transformers.testing_utils import require_torch, require_vision, slow, torch_device from transformers.utils import cached_property, is_torch_available, is_vision_available from ...
351
# coding=utf-8 # Copyright 2020 The HuggingFace Inc. team. # # 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 requi...
351
1
"""simple docstring""" from collections.abc import Callable from math import pi, sqrt from random import uniform from statistics import mean def _lowerCamelCase ( UpperCAmelCase_ : int ) -> Optional[Any]: """simple docstring""" def is_in_ci...
104
import json from typing import Iterator, List, Union from tokenizers import AddedToken, Regex, Tokenizer, decoders, normalizers, pre_tokenizers, trainers from tokenizers.implementations.base_tokenizer import BaseTokenizer from tokenizers.models import Unigram from tokenizers.processors import TemplateProcessing ...
130
0
import itertools import json import linecache import os import pickle import re import socket import string from collections import Counter from logging import getLogger from pathlib import Path from typing import Callable, Dict, Iterable, List import git import torch from torch.utils.data import Dataset from trans...
705
import gc import unittest import numpy as np import torch import torch.nn.functional as F from transformers import ( ClapTextConfig, ClapTextModelWithProjection, RobertaTokenizer, SpeechTaHifiGan, SpeechTaHifiGanConfig, ) from diffusers import ( AudioLDMPipeline, AutoencoderKL, DDIMS...
673
0