code
stringlengths
86
54.5k
code_codestyle
int64
0
371
style_context
stringlengths
87
49.2k
style_context_codestyle
int64
0
349
label
int64
0
1
def lowerCamelCase__ ( __lowerCamelCase : str ): __UpperCAmelCase : int = 0 for ch in input_str: __UpperCAmelCase : Union[str, Any] = ord(__lowerCamelCase ) __UpperCAmelCase : Any = pow(2 , __lowerCamelCase ) ...
114
from abc import ABC, abstractmethod from typing import Optional, Union from .. import Dataset, DatasetDict, Features, IterableDataset, IterableDatasetDict, NamedSplit from ..utils.typing import NestedDataStructureLike, PathLike class a ( lowercase__ ): """simple docstring""" ...
114
1
'''simple docstring''' import itertools import math def a__ ( lowerCAmelCase__ ) -> bool: if 1 < number < 4: # 2 and 3 are primes return True elif number < 2 or number % 2 == 0 or number % 3 == 0: # Negatives, 0, 1, all even numbers, all multiples of...
299
'''simple docstring''' import pickle import shutil import tempfile import unittest from transformers import SPIECE_UNDERLINE, XLMRobertaTokenizer, XLMRobertaTokenizerFast from transformers.testing_utils import get_tests_dir, require_sentencepiece, require_tokenizers, slow from transformers.utils import c...
299
1
'''simple docstring''' from ...configuration_utils import PretrainedConfig from ...utils import logging UpperCAmelCase_ = logging.get_logger(__name__) UpperCAmelCase_ = { 'google/vivit-b-16x2-kinetics400': ( 'https://huggingface.co/google/vivit-b-16x2-kinetics400/resolve/main/con...
346
'''simple docstring''' import datasets from .nmt_bleu import compute_bleu # From: https://github.com/tensorflow/nmt/blob/master/nmt/scripts/bleu.py UpperCAmelCase_ = '\\n@INPROCEEDINGS{Papineni02bleu:a,\n author = {Kishore Papineni and Salim Roukos and Todd Ward and Wei-jing Zhu},\n title = {...
346
1
import gc import unittest from diffusers import FlaxControlNetModel, FlaxStableDiffusionControlNetPipeline from diffusers.utils import is_flax_available, load_image, slow from diffusers.utils.testing_utils import require_flax if is_flax_available(): import jax import jax.numpy as jnp ...
276
from typing import TYPE_CHECKING from ...utils import _LazyModule A : Optional[Any] = {'''processing_wav2vec2_with_lm''': ['''Wav2Vec2ProcessorWithLM''']} if TYPE_CHECKING: from .processing_wavaveca_with_lm import WavaVecaProcessorWithLM else: import sys A : List[s...
276
1
"""simple docstring""" from dataclasses import asdict, dataclass from typing import Optional from ...configuration_utils import PretrainedConfig from ...utils import logging __UpperCamelCase = logging.get_logger(__name__) # TODO Update this __UpperCamelCase = { '''f...
113
"""simple docstring""" import argparse import json from pathlib import Path import torch import torchaudio from datasets import load_dataset from huggingface_hub import hf_hub_download from transformers import ASTConfig, ASTFeatureExtractor, ASTForAudioClassification from transformers.utils i...
113
1
"""simple docstring""" from typing import Any, Dict, List, Optional, Tuple, Union import torch from torch import nn from torch.utils.data import DistributedSampler, RandomSampler from transformers import PreTrainedModel, Trainer, logging from transformers.integrations import is_fairscale_available from trans...
351
"""simple docstring""" from __future__ import annotations def lowerCamelCase ( _UpperCamelCase : list[float] , _UpperCamelCase : list[float] ) -> float: '''simple docstring''' __UpperCAmelCase : Tuple = sorted(numsa + numsa ) __Up...
320
0
'''simple docstring''' import doctest from collections import deque import numpy as np class _a : def __init__( self : List[Any] ): '''simple docstring''' UpperCAmelCase = [2, 1, 2, -1] UpperCAmelCase = [1, 2, 3, 4] ...
34
"""simple docstring""" def _snake_case ( _snake_case : int = 10_00 ) -> int: '''simple docstring''' return sum(2 * a * ((a - 1) // 2) for a in range(3 , n + 1 ) ) if __name__ == "__main__": print(solution())
315
0
"""simple docstring""" from math import sqrt def A_ ( _lowerCAmelCase : int ): """simple docstring""" _a = 0 for i in range(1, int(sqrt(_lowerCAmelCase ) + 1 ) ): if n % i == 0 and i != sqrt(_lowerCAmelCase ): total += ...
153
"""simple docstring""" def A_ ( _lowerCAmelCase : int ): """simple docstring""" return number & 1 == 0 if __name__ == "__main__": import doctest doctest.testmod()
153
1
'''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, XLMRobertaXLForMaskedL...
297
'''simple docstring''' # Copyright 2023 The HuggingFace Team. All rights reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0...
297
1
import logging import numpy as np import pytest from scipy.linalg import eigh logging.basicConfig(level=logging.INFO, format='''%(message)s''') def lowerCamelCase_ ( _a : np.ndarray ): '''simple docstring''' return input_array.reshape((input_array.size, 1) ) def ...
59
from typing import Dict, List, Optional, Union import numpy as np from ...image_processing_utils import BaseImageProcessor, BatchFeature, get_size_dict from ...image_transforms import ( center_crop, convert_to_rgb, get_resize_output_image_size, normalize, rescale, resize, to_channel_di...
59
1
lowercase : Optional[int] = [ (1000, """M"""), (900, """CM"""), (500, """D"""), (400, """CD"""), (100, """C"""), (90, """XC"""), (50, """L"""), (40, """XL"""), (10, """X"""), (9, """IX"""), (5, """V"""), (4, """IV"""), (1, """I"""), ] def ...
20
'''simple docstring''' import argparse import os import torch from diffusers import ( CMStochasticIterativeScheduler, ConsistencyModelPipeline, UNetaDModel, ) lowercase__ = { "sample_size": 32, "in_channels": 3, "out_channels": 3, "layers_per_block": 2, ...
151
0
"""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 = logging.get_logger(__n...
144
"""simple docstring""" from ...configuration_utils import PretrainedConfig from ...utils import logging _a = logging.get_logger(__name__) _a = { 'MIT/ast-finetuned-audioset-10-10-0.4593': ( 'https://huggingface.co/MIT/ast-finetuned-audioset-10-10-0.4593/resolve/main/config....
144
1
'''simple docstring''' import argparse import os import re __a = '''src/transformers/models/auto''' # re pattern that matches mapping introductions: # SUPER_MODEL_MAPPING_NAMES = OrderedDict or SUPER_MODEL_MAPPING = OrderedDict __a = re.compile(R'[A-Z_]+_MAPPING(\s+|_[A-Z_]+\s+)=\...
145
'''simple docstring''' 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 Paddin...
112
0
import argparse import json from pathlib import Path import requests import torch from huggingface_hub import hf_hub_download from PIL import Image from transformers import DetrConfig, DetrForObjectDetection, DetrForSegmentation, DetrImageProcessor, ResNetConfig from transformers.utils import logging logging....
140
import unittest import numpy as np from transformers.testing_utils import require_torch, require_vision from transformers.utils import is_torch_available, is_vision_available from ...test_image_processing_common import ImageProcessingSavingTestMixin, prepare_image_inputs if is_torch_available(): import t...
140
1
from __future__ import annotations from typing import Any def A__ ( __lowerCamelCase ): if not postfix_notation: return 0 SCREAMING_SNAKE_CASE_ = {'''+''', '''-''', '''*''', '''/'''} SCREAMING_SNAKE_CASE_ = [] for token in postfix_notation: if token in operations: ...
299
import math import random def A__ ( __lowerCamelCase, __lowerCamelCase = False ): if deriv: return value * (1 - value) return 1 / (1 + math.exp(-value )) # Initial Value __UpperCAmelCase = 0.02 def A__ ( __lowerCamelCase, __lowerCamelCase ): SCREAMING_SNA...
299
1
import torch from diffusers import DPMSolverSDEScheduler from diffusers.utils import torch_device from diffusers.utils.testing_utils import require_torchsde from .test_schedulers import SchedulerCommonTest @require_torchsde class lowercase_ ( lowercase ): ...
26
import argparse import json from pathlib import Path import requests import torch from huggingface_hub import hf_hub_download from PIL import Image from transformers import ( SwiftFormerConfig, SwiftFormerForImageClassification, ViTImageProcessor, ) from transformers.utils impo...
26
1
from ...configuration_utils import PretrainedConfig class _snake_case ( snake_case ): UpperCamelCase__ = 'bert-generation' def __init__( self , _a=50_358 , _a=1_024 , _a=24 , _a=16 , _a=4_096 , _a="gelu" , _a=0.1 , ...
281
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 impor...
281
1
'''simple docstring''' def lowercase__( __UpperCamelCase: Dict ): """simple docstring""" SCREAMING_SNAKE_CASE , SCREAMING_SNAKE_CASE : Optional[int] = [], [] while len(__UpperCamelCase ) > 1: SCREAMING_SNAKE_CASE , SCREAMING_SNAK...
246
'''simple docstring''' from scipy.stats import spearmanr import datasets UpperCamelCase_ = "\nThe Spearman rank-order correlation coefficient is a measure of the\nrelationship between two datasets. Like other correlation coefficients,\nthis one varies between -1 and +1 with 0 implyi...
246
1
"""simple docstring""" import unittest import numpy as np import torch from diffusers import ScoreSdeVePipeline, ScoreSdeVeScheduler, UNetaDModel from diffusers.utils.testing_utils import enable_full_determinism, require_torch, slow, torch_device enable_full_determinism() class _UpperCAmelCase ( un...
263
"""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 ...
320
0
from typing import List, Optional, Union import numpy as np from ...feature_extraction_sequence_utils import SequenceFeatureExtractor from ...feature_extraction_utils import BatchFeature from ...utils import PaddingStrategy, TensorType, logging __A : Optional[Any] = logging.get_logger(__name__...
355
import math def SCREAMING_SNAKE_CASE__ ( _UpperCAmelCase = 100 ) -> int: '''simple docstring''' lowerCAmelCase : Any = sum(i * i for i in range(1, n + 1 ) ) lowerCAmelCase : str = int(math.pow(sum(range(1, n + 1 ) ), 2 ) ) return s...
323
0
"""simple docstring""" import argparse import csv import logging import os import random import numpy as np import torch from torch.utils.data import DataLoader, RandomSampler, SequentialSampler, TensorDataset from tqdm import tqdm, trange from transformers import ( CONFIG_NAME, WEIGHTS_NAME, A...
153
"""simple docstring""" def a__ ( _SCREAMING_SNAKE_CASE ): """simple docstring""" if p < 2: raise ValueError("p should not be less than 2!" ) elif p == 2: return True UpperCamelCase = 4 UpperCamelCase = (1 << p) - 1 for _ in range(p - 2 ): UpperCamel...
153
1
import argparse import os import pickle import sys import torch from transformers import TransfoXLConfig, TransfoXLLMHeadModel, load_tf_weights_in_transfo_xl from transformers.models.transfo_xl import tokenization_transfo_xl as data_utils from transformers.models.transfo_xl.tokenization_transfo_xl import CORPUS_N...
369
'''simple docstring''' # Function to print upper half of diamond (pyramid) def __lowerCamelCase ( _lowercase ) -> List[Any]: for i in range(0 , _lowercase ): for _ in range(0 , n - i - 1 ): # printing spaces print(""" """ , end="...
338
0
import re from pathlib import Path from unittest import TestCase import pytest @pytest.mark.integration class UpperCAmelCase ( A_ ): def _SCREAMING_SNAKE_CASE (self : Optional[Any] , snake_case__ : str ) -> Optional[Any]: '''simple docstring...
59
import warnings from typing import Dict import numpy as np from ..utils import ExplicitEnum, add_end_docstrings, is_tf_available, is_torch_available from .base import PIPELINE_INIT_ARGS, GenericTensor, Pipeline if is_tf_available(): from ..models.auto.modeling_tf_auto import TF_MODEL_FOR_SEQUENCE_CLA...
59
1
import unittest import numpy as np from transformers.testing_utils import require_torch, require_vision from transformers.utils import is_torch_available, is_vision_available from ...test_image_processing_common import ImageProcessingSavingTestMixin, prepare_image_inputs if is_torch_available(): import...
29
from io import BytesIO from typing import List, Union import requests from ..utils import add_end_docstrings, is_decord_available, is_torch_available, logging, requires_backends from .base import PIPELINE_INIT_ARGS, Pipeline if is_decord_available(): import numpy as np from decord import VideoRea...
29
1
"""simple docstring""" import argparse import requests import torch # pip3 install salesforce-lavis # I'm actually installing a slightly modified version: pip3 install git+https://github.com/nielsrogge/LAVIS.git@fix_lavis_float32 (there's also the fix_lavis branch) # also note: to convert Vicuna checkpoints...
144
"""simple docstring""" import contextlib import importlib import io import unittest import transformers # Try to import everything from transformers to ensure every object can be loaded. from transformers import * # noqa F406 from transformers.testing_utils import DUMMY_UNKNOWN_IDENTIFIER, require_flax, re...
144
1
'''simple docstring''' from multiprocessing import Lock, Pipe, Process # lock used to ensure that two processes do not access a pipe at the same time __lowercase: int = Lock() def SCREAMING_SNAKE_CASE__ ( _UpperCamelCase : str , _UpperCamelCase : List[str] ...
351
'''simple docstring''' def SCREAMING_SNAKE_CASE__( _UpperCamelCase : float , _UpperCamelCase : float ) -> float: '''simple docstring''' if density <= 0: raise ValueError("Impossible fluid density" ) if bulk_modulus <= 0: rais...
31
0
import heapq def UpperCamelCase ( __lowercase : dict ): '''simple docstring''' A_ : list[list] = [] # for each node and his adjacency list add them and the rank of the node to queue # using heapq module the queue will be filled like a Priority Queue # h...
140
def UpperCamelCase ( __lowercase : list[list[int]] ,__lowercase : int ,__lowercase : int ,__lowercase : list[int] ): '''simple docstring''' if graph[path[curr_ind - 1]][next_ver] == 0: return False # 2. Validate that next vertex is not already in...
140
1
def __UpperCamelCase ( _lowerCAmelCase ) -> list: """simple docstring""" def merge(_lowerCAmelCase , _lowerCAmelCase ) -> list: def _merge(): while left and right: yield (left if left[0] <= right[0] else right).pop(0 ) yield from...
359
import json import os from typing import Dict, List, Optional, Tuple import regex as re from ...tokenization_utils import PreTrainedTokenizer from ...utils import logging SCREAMING_SNAKE_CASE_:Dict = logging.get_logger(__name__) SCREAMING_SNAKE_CASE_:int = { """vocab_file""": """vocab.js...
115
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...
26
import requests from bsa import BeautifulSoup def lowerCAmelCase_ ( snake_case_ = "AAPL" ): _A : str = f'''https://in.finance.yahoo.com/quote/{symbol}?s={symbol}''' _A : List[Any] = BeautifulSoup(requests.get(snake_case_ ).text,"""html.parser""" ...
26
1
import argparse import os import jax as jnp import numpy as onp import torch import torch.nn as nn from music_spectrogram_diffusion import inference from tax import checkpoints from diffusers import DDPMScheduler, OnnxRuntimeModel, SpectrogramDiffusionPipeline from diffusers.pipelines.spectrogram_diffusion import Sp...
339
def __magic_name__ ( __lowerCAmelCase : int , __lowerCAmelCase : int ) -> int: return abs(__lowerCAmelCase ) if a == 0 else greatest_common_divisor(b % a , __lowerCAmelCase ) def __magic_name__ ( __lowerCAmelCase : int , __lowe...
339
1
"""simple docstring""" import os import tempfile import unittest from pathlib import Path from transformers import AutoConfig, is_torch_available from transformers.testing_utils import require_torch, torch_device if is_torch_available(): from transformers import PyTorchBenchmark, PyT...
246
"""simple docstring""" import unittest from huggingface_hub import hf_hub_download from transformers import MODEL_FOR_VIDEO_CLASSIFICATION_MAPPING, VideoMAEFeatureExtractor from transformers.pipelines import VideoClassificationPipeline, pipeline from transformers.testing_utils import ( is_...
246
1
def lowerCAmelCase_ ( UpperCamelCase_ ) -> int: UpperCamelCase_ = len(UpperCamelCase_ ) UpperCamelCase_ = len(matrix[0] ) UpperCamelCase_ = min(UpperCamelCase_ , UpperCamelCase_ ) for row in range(UpperCamelCase...
328
from typing import TYPE_CHECKING from ...utils import OptionalDependencyNotAvailable, _LazyModule, is_tf_available, is_torch_available _UpperCAmelCase = { 'configuration_tapas': ['TAPAS_PRETRAINED_CONFIG_ARCHIVE_MAP', 'TapasConfig'], 'tokenization_tapas': ['TapasTokenizer'], } try: if not i...
328
1
from typing import Union from ..utils import add_end_docstrings, is_torch_available, is_vision_available, logging from .base import PIPELINE_INIT_ARGS, Pipeline if is_vision_available(): from PIL import Image from ..image_utils import load_image if is_torch_available(): from ..models.auto.modeling_auto impo...
49
'''simple docstring''' from dataclasses import dataclass from typing import Optional import numpy as np import torch import torch.nn as nn from ..utils import BaseOutput, is_torch_version, randn_tensor from .attention_processor import SpatialNorm from .unet_ad_blocks import UNetMidBlockaD, get_down_block, g...
323
0
import warnings from ...utils import logging from .image_processing_flava import FlavaImageProcessor snake_case = logging.get_logger(__name__) class SCREAMING_SNAKE_CASE ( lowerCAmelCase ): '''simple docstring''' def __init__( self : List[str] , *UpperCAmelCase_ ...
319
# 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 .utils import deprecate dep...
319
1
'''simple docstring''' from ...configuration_utils import PretrainedConfig from ...utils import logging lowerCAmelCase_ : Dict = logging.get_logger(__name__) lowerCAmelCase_ : int = { 'bigcode/gpt_bigcode-santacoder': 'https://huggingface.co/bigcode/gpt_bigcode-santacod...
63
import torch from diffusers import DDPMScheduler from .test_schedulers import SchedulerCommonTest class lowercase_ ( UpperCamelCase_ ): """simple docstring""" UpperCAmelCase_ : str = (DDPMScheduler,) def SCREAMING_SNAKE_CASE_ ( self , **__SCREA...
338
0
from typing import Dict import numpy as np from ..utils import add_end_docstrings, is_tf_available, is_torch_available, logging from .base import PIPELINE_INIT_ARGS, GenericTensor, Pipeline, PipelineException if is_tf_available(): import tensorflow as tf from ..tf_utils import stable_softmax if is_to...
189
from typing import Any class a : def __init__( self , A_ ): '''simple docstring''' _UpperCAmelCase : List[Any] = data _UpperCAmelCase : Any = None class a : def __init__( self ): ...
189
1
import logging import numpy as np import pytest from scipy.linalg import eigh logging.basicConfig(level=logging.INFO, format='%(message)s') def lowercase__ ( __snake_case : np.ndarray ): '''simple docstring''' return input_array.reshape((input_a...
29
from typing import List, Optional, Union import numpy as np import PIL import torch from PIL import Image from ...models import UNetaDConditionModel, VQModel from ...pipelines import DiffusionPipeline from ...pipelines.pipeline_utils import ImagePipelineOutput from ...schedulers import DDPMSch...
29
1
"""simple docstring""" 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 __lowerCamelCase ...
239
"""simple docstring""" from itertools import product def __lowerCamelCase ( a_ : int , a_ : int ) -> list[int]: __SCREAMING_SNAKE_CASE :Tuple = sides_number __SCREAMING_SNAKE_CASE :List[Any] = max_face_number * di...
239
1
from typing import TYPE_CHECKING from ...utils import ( OptionalDependencyNotAvailable, _LazyModule, is_sentencepiece_available, is_tokenizers_available, is_torch_available, ) UpperCAmelCase__ = {"configuration_plbart": ["PLBART_PRETRAINED_CONFIG_ARCHIVE_MAP", "PLB...
0
'''simple docstring''' import math from typing import List, Optional, Tuple, Union import numpy as np import torch from ..configuration_utils import ConfigMixin, register_to_config from .scheduling_utils import SchedulerMixin, SchedulerOutput class lowerCamelCase_ (snake_case__ , snake_case__ ): ...
31
0
'''simple docstring''' from random import randint, random def lowerCamelCase__ ( _A , _A , _A , _A = False , _A = False , _A = 5 , ): a : Union[str, Any] = [[-1] * number_of_cells] # Create a highway without any car a : Optional[...
96
'''simple docstring''' from math import factorial, pi def lowerCamelCase__ ( _A , _A = 30 ): if not isinstance(_A , (int, float) ): raise ValueError('maclaurin_sin() requires either an int or float for theta' ) if not isinstance(_A , _A ) or accuracy <= 0: ...
96
1
'''simple docstring''' from typing import Dict, List, Optional, Tuple, Union import torch from ...models import AutoencoderKL, TransformeraDModel from ...schedulers import KarrasDiffusionSchedulers from ...utils import randn_tensor from ..pipeline_utils import DiffusionPipeline, ImagePipelineOutput ...
151
"""simple docstring""" import argparse import json from pathlib import Path import requests import torch from huggingface_hub import hf_hub_download from PIL import Image from transformers import ( SwiftFormerConfig, SwiftFormerForImageClassification, ViTImageProcessor, ) from transformers.utils ...
115
0
import argparse import torch from torch import nn from transformers import SpeechaTextConfig, SpeechaTextForConditionalGeneration def snake_case (UpperCAmelCase__ ) -> Dict: UpperCamelCase_: List[str] = [ "encoder.version", "decoder.version", "model.encoder...
363
import os import sys import tempfile import torch from .state import AcceleratorState from .utils import PrecisionType, PrepareForLaunch, is_mps_available, patch_environment def snake_case (UpperCAmelCase__ , UpperCAmelCase__=() , UpperCAmelCase__=None , UpperCAmelCase__="n...
292
0
from typing import Dict, List, Optional, Tuple, Union import numpy as np from ...image_processing_utils import BaseImageProcessor, BatchFeature, get_size_dict from ...image_transforms import ( center_crop, flip_channel_order, get_resize_output_image_size, rescale, resize, to_channel_dime...
284
from ...configuration_utils import PretrainedConfig from ...utils import logging _snake_case : List[Any] = logging.get_logger(__name__) _snake_case : Any = { 'google/pegasus-large': 'https://huggingface.co/google/pegasus-large/resolve/main/config.json', # See all PEGASUS mod...
284
1
'''simple docstring''' from __future__ import annotations import unittest from transformers import is_tf_available from transformers.testing_utils import require_sentencepiece, require_tf, require_tokenizers, slow if is_tf_available(): import numpy as np import tensorflow as tf from transformers import TF...
358
'''simple docstring''' def lowerCamelCase__ ( A : int , A : int ): '''simple docstring''' return int(input_a == input_a == 0 ) def lowerCamelCase__ ( ): '''simple docstring''' print('''Truth Table of NOR Gate:''' ...
91
0
'''simple docstring''' from __future__ import annotations import unittest from transformers import is_tf_available, is_torch_available from transformers.testing_utils import DUMMY_UNKNOWN_IDENTIFIER, SMALL_MODEL_IDENTIFIER, is_pt_tf_cross_test, slow if is_tf_available(): from transformers import ( ...
265
'''simple docstring''' import unittest from transformers import ( MODEL_FOR_SEQUENCE_CLASSIFICATION_MAPPING, TF_MODEL_FOR_SEQUENCE_CLASSIFICATION_MAPPING, Pipeline, ZeroShotClassificationPipeline, pipeline, ) from transformers.testing_utils import is_pipeline_test, nested_simplify, require_...
265
1
from ...configuration_utils import PretrainedConfig from ...utils import logging lowerCAmelCase : Dict = logging.get_logger(__name__) lowerCAmelCase : Optional[int] = { '''transfo-xl-wt103''': '''https://huggingface.co/transfo-xl-wt103/resolve/main/config.json''', ...
369
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 lowerCAmelCase : Any = logging.get_logger(__name__) lower...
127
0
'''simple docstring''' from __future__ import annotations def lowerCamelCase__ ( _A , _A ): a : list[list[int]] = [] create_all_state(1 , _A , _A , [] , _A ) return result def lowerCamelCase__ ( _A , _A , _A , _A , _A , ): ...
297
'''simple docstring''' import json from typing import Dict, List, Optional, Tuple, Union from tokenizers import pre_tokenizers, processors from ...tokenization_utils_base import AddedToken, BatchEncoding, EncodedInput from ...tokenization_utils_fast import PreTrainedTokenizerFast from ...utils import Paddin...
297
1
'''simple docstring''' def __magic_name__( lowerCamelCase): if a < 0: raise ValueError('''Input value must be a positive integer''') elif isinstance(lowerCamelCase, lowerCamelCase): raise TypeError('''Input value must be a \'int\' type''') return bin(low...
9
'''simple docstring''' from typing import Callable, Dict, Optional, Tuple import torch from torch import nn from torch.distributions import ( AffineTransform, Distribution, Independent, NegativeBinomial, Normal, StudentT, TransformedDistribution, ) class a__ ( _...
9
1
from .imports import is_rich_available if is_rich_available(): from rich.traceback import install install(show_locals=False) else: raise ModuleNotFoundError('''To use the rich extension, install rich with `pip install rich`''')
189
from ...configuration_utils import PretrainedConfig from ...utils import logging lowerCamelCase : Optional[int] =logging.get_logger(__name__) lowerCamelCase : Dict ={ '''facebook/s2t-wav2vec2-large-en-de''': ( '''https://huggingface.co/facebook/s2t-wav2vec2-large-e...
189
1
"""simple docstring""" import unittest from transformers import RoFormerTokenizer, RoFormerTokenizerFast from transformers.testing_utils import require_rjieba, require_tokenizers from ...test_tokenization_common import TokenizerTesterMixin @require_rjieba @require_tokenizers class lowercase_ ( a_ ...
358
def snake_case (__lowercase ) -> list[int]: '''simple docstring''' if num <= 0: raise ValueError("Input must be a positive integer" ) _snake_case : Any = [True] * (num + 1) _snake_case : str = 2 while p * p <= num: i...
284
0
'''simple docstring''' import argparse import json import re from pathlib import Path import requests import torch from huggingface_hub import hf_hub_download from PIL import Image from transformers import ( MobileNetVaConfig, MobileNetVaForImageClassification, MobileNetVaImageProcessor, load_tf_w...
239
'''simple docstring''' import argparse import json import os import sys import tempfile import unittest from argparse import Namespace from dataclasses import dataclass, field from enum import Enum from pathlib import Path from typing import List, Literal, Optional import yaml from transformers import HfArgumentP...
239
1
def UpperCAmelCase_ ( __UpperCAmelCase : int = 4_00_00_00 ) -> int: SCREAMING_SNAKE_CASE_ = [] SCREAMING_SNAKE_CASE_ , SCREAMING_SNAKE_CASE_ = 0, 1 while b <= n: if b % 2 == 0: even_fibs.append(__UpperCA...
210
import unittest import numpy as np from transformers.testing_utils import require_torch, require_vision from transformers.utils import is_torch_available, is_vision_available from ...test_image_processing_common import ImageProcessingSavingTestMixin, prepare_image_inputs if is_torch_available(): import tor...
210
1
"""simple docstring""" from collections import OrderedDict from typing import Any, Mapping, Optional from ... import PreTrainedTokenizer, TensorType, is_torch_available from ...configuration_utils import PretrainedConfig from ...onnx import OnnxConfigWithPast from ...utils import logging ...
96
"""simple docstring""" def _snake_case ( lowercase__ ): if not isinstance(lowercase__ , lowercase__ ): raise ValueError('Input series is not valid, valid series - [2, 4, 6]' ) if len(lowercase__ ) == 0: raise ValueError('Input list must be a non ...
96
1
'''simple docstring''' import requests _snake_case : Optional[int] = '' # <-- Put your OpenWeatherMap appid here! _snake_case : Dict = 'https://api.openweathermap.org/data/2.5/' def snake_case_ (UpperCamelCase : str = "Chicago" , UpperCamelCase : ...
179
'''simple docstring''' import argparse from collections import defaultdict import yaml _snake_case : int = 'docs/source/en/_toctree.yml' def snake_case_ (UpperCamelCase : Optional[int] ): '''simple docstring''' _a = defaultdi...
179
1
'''simple docstring''' from bisect import bisect from itertools import accumulate def snake_case_ ( __SCREAMING_SNAKE_CASE : Dict , __SCREAMING_SNAKE_CASE : List[Any] , __SCREAMING_SNAKE_CASE : int , __SCREAMING_SNAKE_CASE : int ): ...
93
"""simple docstring""" import hashlib import unittest from transformers import MODEL_FOR_DEPTH_ESTIMATION_MAPPING, is_torch_available, is_vision_available from transformers.pipelines import DepthEstimationPipeline, pipeline from transformers.testing_utils import ( is_pipeline_test, nested_simplify, r...
292
0
'''simple docstring''' import comet # From: unbabel-comet import torch import datasets snake_case_ : int = datasets.logging.get_logger(__name__) snake_case_ : Optional[int] = '\\n@inproceedings{rei-EtAl:2020:WMT,\n author = {Rei, Ricardo and Stewart, Craig and Farinha, Ana C and La...
236
'''simple docstring''' import os from shutil import copyfile from typing import List, Optional, Tuple from tokenizers import processors from ...tokenization_utils import AddedToken, BatchEncoding from ...tokenization_utils_fast import PreTrainedTokenizerFast from ...utils import is_sentencepiece_available, loggin...
236
1
'''simple docstring''' import torch from ..models.auto import AutoModelForSequenceClassification, AutoTokenizer from .base import PipelineTool class A__ ( UpperCAmelCase__ ): """simple docstring""" UpperCamelCase_ : List[str] = '''facebook/bart-large-m...
145
"""simple docstring""" import unittest from diffusers.pipelines.pipeline_utils import is_safetensors_compatible class lowerCAmelCase__ ( unittest.TestCase ): '''simple docstring''' def _SCREAMING_SNAKE_CASE ( self : str): '''simple docstring''' ...
91
0
"""simple docstring""" import enum import os from hashlib import shaaaa from typing import Optional from .. import config from .logging import get_logger a :Any = get_logger(__name__) class __a (enum.Enum): '''simple docstring''' _SCREAMING_SNAKE_CASE :Tuple = """all_chec...
56
"""simple docstring""" import logging import sys from dataclasses import dataclass, field from typing import Any, Dict, List, Optional, Union import librosa import torch from datasets import DatasetDict, load_dataset from packaging import version from torch import nn from transformers import ( HfArgumentParse...
56
1
"""simple docstring""" import argparse import logging import pickle from collections import Counter logging.basicConfig( format='%(asctime)s - %(levelname)s - %(name)s - %(message)s', datefmt='%m/%d/%Y %H:%M:%S', level=logging.INFO ) lowerCAmelCase_ = logging.getLogger(__...
16
import random def UpperCAmelCase__ (UpperCamelCase_ ,UpperCamelCase_ ,UpperCamelCase_ ): """simple docstring""" snake_case = a[left_index] snake_case = left_index + 1 for j in range(left_index + 1 ,UpperCamelCase_ ): i...
127
0
'''simple docstring''' from ...configuration_utils import PretrainedConfig from ...utils import logging lowerCAmelCase :Any = logging.get_logger(__name__) lowerCAmelCase :Tuple = { '''s-JoL/Open-Llama-V1''': '''https://huggingface.co/s-JoL/Open-Llama-V1/blob/main/config.json''',...
275
'''simple docstring''' import warnings from ...utils import logging from .image_processing_beit import BeitImageProcessor lowerCAmelCase :Tuple = logging.get_logger(__name__) class _lowerCamelCase ( lowercase__ ): '''simple docstring''' def __init__( self : Any , ...
275
1
def _UpperCamelCase ( lowercase__ ): if a < 0: raise ValueError('''Input value must be a positive integer''' ) elif isinstance(lowercase__ , lowercase__ ): raise TypeError('''Input value must be a \'int\' type''' ) return bin(lo...
9
def _UpperCamelCase ( lowercase__ , lowercase__ , lowercase__=False ): if isinstance(lowercase__ , lowercase__ ) and isinstance(lowercase__ , lowercase__ ): __SCREAMING_SNAKE_CASE : List[str] = len(set_a.intersectio...
9
1
import os import tempfile import unittest import uuid from pathlib import Path from transformers.testing_utils import get_tests_dir, require_soundfile, require_torch, require_vision from transformers.tools.agent_types import AgentAudio, AgentImage, AgentText from transformers.utils import is_soundfile_availble, ...
279
import random from .binary_exp_mod import bin_exp_mod def lowerCamelCase_ ( _UpperCamelCase , _UpperCamelCase=1_000 ) -> str: """simple docstring""" if n < 2: return False if n % 2 == 0: return n == 2 # this means n is odd snake_case_ ...
279
1
_lowerCAmelCase : Optional[Any] = 8.314_4598 def __snake_case ( _lowerCAmelCase : float , _lowerCAmelCase : float ) -> float: if temperature < 0: raise Exception("Temperature cannot be less than 0 K" ) if molar_mass <= 0: raise Exception("...
300
import argparse import json import os import fairseq import torch from torch import nn from transformers import ( SpeechaTextaConfig, SpeechaTextaForCausalLM, SpeechaTextaTokenizer, SpeechEncoderDecoderConfig, SpeechEncoderDecoderModel, WavaVecaConfig, WavaVecaFeatureExtractor, W...
300
1
from typing import TYPE_CHECKING from ...utils import ( OptionalDependencyNotAvailable, _LazyModule, is_tf_available, is_tokenizers_available, is_torch_available, ) UpperCAmelCase__ = { "configuration_lxmert": ["LXMERT_PRETRAINED_CONFIG_ARCHIVE_MAP", "LxmertConfig"], "tokenizati...
290
from typing import TYPE_CHECKING from ...utils import _LazyModule UpperCAmelCase__ = {"tokenization_bertweet": ["BertweetTokenizer"]} if TYPE_CHECKING: from .tokenization_bertweet import BertweetTokenizer else: import sys UpperCAmelCase__ = _LazyModule(__name__, globals()["__...
290
1
from ...configuration_utils import PretrainedConfig from ...utils import logging __lowerCamelCase : List[Any] = logging.get_logger(__name__) __lowerCamelCase : Dict = { '''alibaba-damo/mgp-str-base''': '''https://huggingface.co/alibaba-damo/mgp-str-base/resolve/main/config.json''', } ...
18
from typing import TYPE_CHECKING from ...utils import ( OptionalDependencyNotAvailable, _LazyModule, is_tokenizers_available, is_torch_available, is_vision_available, ) lowerCAmelCase : Dict = { 'configuration_layoutlmv2': ['LAYOUTLMV2_PRETRAINED_CONFIG_ARCHIVE_MAP', 'LayoutL...
253
0
'''simple docstring''' import unittest from transformers import 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 ModelTeste...
363
'''simple docstring''' import argparse import json from collections import OrderedDict import torch from huggingface_hub import cached_download, hf_hub_url from transformers import AutoImageProcessor, CvtConfig, CvtForImageClassification def __magic_name__ ( A ) -> Tuple: snake_case ...
332
0
"""simple docstring""" import inspect import unittest from transformers import ViTHybridConfig from transformers.testing_utils import require_accelerate, require_torch, require_vision, slow, torch_device from transformers.utils import cached_property, is_torch_available, is_vision_available from ...test_conf...
179
"""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(): imp...
179
1
'''simple docstring''' 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 sa...
371
'''simple docstring''' import unittest import numpy as np from transformers.testing_utils import require_pytesseract, require_torch from transformers.utils import is_pytesseract_available, is_torch_available from ...test_image_processing_common import ImageProcessingSavingTestMixin, prepare_image_inputs if i...
294
0
from typing import Optional from torch import nn from .transformer_ad import TransformeraDModel, TransformeraDModelOutput class __lowerCAmelCase ( nn.Module): def __init__( self: Union[str, Any] , _lowerCAmelCase: int = 16 , _lowerCAmelCase: int = 88 ,...
236
_UpperCAmelCase : Tuple = {str(digit): digit**5 for digit in range(10)} def UpperCAmelCase__ ( lowerCamelCase ): return sum(DIGITS_FIFTH_POWER[digit] for digit in str(lowerCamelCase ) ) def UpperCAmelCase__ ( ): return sum( number for number in range(1...
236
1
from __future__ import annotations def a__ ( A__, A__ ): SCREAMING_SNAKE_CASE_ : Dict = 0 SCREAMING_SNAKE_CASE_ : Any = len(A__ ) - 1 while i < j: if nums[i] + nums[j] == target: return [i, j] elif nums[...
162
from ...configuration_utils import PretrainedConfig from ...utils import logging from ...utils.backbone_utils import BackboneConfigMixin, get_aligned_output_features_output_indices lowerCAmelCase__ : List[Any] =logging.get_logger(__name__) lowerCAmelCase__ : Tuple ={ 'micros...
162
1
'''simple docstring''' def __magic_name__ ( __UpperCAmelCase, __UpperCAmelCase, __UpperCAmelCase ) -> float: '''simple docstring''' if principal <= 0: raise Exception('''Principal borrowed must be > 0''' ) if rate_per_annum < 0: raise Exception('''Rate of i...
56
'''simple docstring''' import argparse import json from pathlib import Path import requests import torch from huggingface_hub import cached_download, hf_hub_url from PIL import Image from transformers import DPTConfig, DPTForDepthEstimation, DPTForSemanticSegmentation, DPTImageProcessor from transformers.utils ...
56
1
'''simple docstring''' import json import os import shutil import tempfile import unittest import numpy as np import pytest from transformers import MgpstrTokenizer from transformers.models.mgp_str.tokenization_mgp_str import VOCAB_FILES_NAMES from transformers.testing_utils import require_torch, require_vision fro...
274
'''simple docstring''' import unittest from transformers.utils.backbone_utils import ( BackboneMixin, get_aligned_output_features_output_indices, verify_out_features_out_indices, ) class __SCREAMING_SNAKE_CASE ( unittest.TestCase ): '''simple docstring''' def _UpperCamelC...
274
1
import math import os from copy import deepcopy import datasets import evaluate import torch import transformers from datasets import load_dataset from torch.utils.data import DataLoader from transformers import AutoModelForSequenceClassification, AutoTokenizer from accelerate import Accelerator from accelerate.test...
244
from __future__ import annotations from typing import Generic, TypeVar lowerCamelCase_ = TypeVar('''T''') class __A( Generic[T] ): """simple docstring""" def __init__(self , SCREAMING_SNAKE_CASE_ ): UpperCamelCase__ = data UpperCamelCase__ = self ...
244
1
from ...configuration_utils import PretrainedConfig from ...utils import logging _lowerCAmelCase : List[str] = logging.get_logger(__name__) _lowerCAmelCase : Union[str, Any] = { '''SCUT-DLVCLab/lilt-roberta-en-base''': ( '''https://huggingface.co/SCUT-DLVCLab/lilt-roberta-en-b...
70
import copy import os from typing import Union from ...configuration_utils import PretrainedConfig from ...utils import logging _lowerCAmelCase : int = logging.get_logger(__name__) _lowerCAmelCase : Dict = { '''microsoft/git-base''': '''https://huggingface.co/microsoft/git-base/resol...
70
1
import json import os import tempfile import unittest import unittest.mock as mock from pathlib import Path from requests.exceptions import HTTPError from transformers.utils import ( CONFIG_NAME, FLAX_WEIGHTS_NAME, TF2_WEIGHTS_NAME, TRANSFORMERS_CACHE, WEIGHTS_NAME, cached_file, get_...
279
import PIL.Image import PIL.ImageOps from packaging import version from PIL import Image if version.parse(version.parse(PIL.__version__).base_version) >= version.parse('''9.1.0'''): lowerCAmelCase_ = { '''linear''': PIL.Image.Resampling.BILINEAR, '''bilinear''': PIL.Image.Resampling.BILINEAR, ...
279
1
lowerCamelCase : Optional[int] = "0.21.0" from .accelerator import Accelerator from .big_modeling import ( cpu_offload, cpu_offload_with_hook, disk_offload, dispatch_model, init_empty_weights, init_on_device, load_checkpoint_and_dispatch, ) from .data_lo...
366
def _SCREAMING_SNAKE_CASE ( lowercase : Tuple , lowercase : Dict , lowercase : List[str] , lowercase : Dict , lowercase : Dict , lowercase : List[str] ): '''simple docstring''' if index == r:...
208
0
"""simple docstring""" def __a ( _SCREAMING_SNAKE_CASE , _SCREAMING_SNAKE_CASE ) ->int: while b: a__ , a__: List[str] = b, a % b return a def __a ( _SCREAMING_SNAKE_CASE , _SCREAMING_SNAKE_CASE ) ->int: return a if b == 0 else euclidean_gcd_recursive(...
290
"""simple docstring""" import math def __a ( _SCREAMING_SNAKE_CASE ) ->bool: if 1 < number < 4: # 2 and 3 are primes return True elif number < 2 or number % 2 == 0 or number % 3 == 0: # Negatives, 0, 1, all even numbers, all multiples of 3 are not primes return False # All prime...
290
1
'''simple docstring''' import gc import random import unittest import numpy as np import torch from transformers import CLIPTextConfig, CLIPTextModel, CLIPTokenizer from diffusers import AutoencoderKL, CycleDiffusionPipeline, DDIMScheduler, UNetaDConditionModel from diffusers.utils import floats_tensor, load...
43
'''simple docstring''' import numpy as np def __snake_case( _lowerCAmelCase , _lowerCAmelCase , _lowerCAmelCase = 1e-12 , _lowerCAmelCase = 100 , ) -> tuple[float, np.ndarray]: assert np.shape(_lowerCAmelCase )[0] == np.shape(_lowerCAmelCase )[1]...
43
1
"""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 UpperCamelCase__ ...
224
import argparse from argparse import Namespace import torch from torch import nn from transformers import XGLMConfig, XGLMForCausalLM def __UpperCamelCase ( _A ): lowerCAmelCase_ = [ '''decoder.version''', '''decoder.output_projection.weight''', '''_floa...
278
0
"""simple docstring""" import argparse import os import numpy as np import tensorflow as tf import torch from transformers import BertModel def _a ( _snake_case , _snake_case , _snake_case ): """simple docstring""" UpperCAmelCase = ("""dense.weight""", "...
234
"""simple docstring""" from typing import TYPE_CHECKING from ...utils import ( OptionalDependencyNotAvailable, _LazyModule, is_flax_available, is_tf_available, is_tokenizers_available, is_torch_available, ) _UpperCamelCase = { """configuration_roformer""": ["""ROF...
234
1
"""simple docstring""" from collections.abc import Callable def lowerCAmelCase__ ( UpperCamelCase__ , UpperCamelCase__ , UpperCamelCase__ ): '''simple docstring''' _a : float = a _a : float = b if function(UpperC...
294
"""simple docstring""" import json import os from typing import Optional, Tuple from ...tokenization_utils import PreTrainedTokenizer from ...utils import logging _snake_case = logging.get_logger(__name__) _snake_case = {'vocab_file': 'vocab.json'} _snake_ca...
294
1
'''simple docstring''' import unittest import torch from diffusers import VQModel from diffusers.utils import floats_tensor, torch_device from diffusers.utils.testing_utils import enable_full_determinism from .test_modeling_common import ModelTesterMixin, UNetTesterMixin enable_full_determinism() class...
366
'''simple docstring''' import copy from dataclasses import dataclass from pathlib import Path from typing import Dict, Optional, Union @dataclass class lowerCAmelCase_: '''simple docstring''' __lowercase : Optional[Union[str, Path]] = None __lowercase : bool ...
184
0
'''simple docstring''' from __future__ import annotations def UpperCAmelCase__ ( UpperCAmelCase__, UpperCAmelCase__ ) -> list[tuple[int, int]]: A_ , A_ = position A_ = [ (y + 1, x + 2), (y - 1, x + 2), (y + 1, x - 2), ...
162
'''simple docstring''' import argparse import os from transformers.utils import direct_transformers_import # All paths are set with the intent you should run this script from the root of the repo with the command # python utils/check_task_guides.py __lowerCamelCase = '''src/transformers''' __lowe...
162
1
import logging import os from dataclasses import dataclass from typing import List, Optional, Union import tqdm from filelock import FileLock from transformers import ( BartTokenizer, BartTokenizerFast, DataProcessor, PreTrainedTokenizer, RobertaTokenizer, RobertaTo...
359
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 = logging.get_logger(__name__) UpperCamelCase = {...
125
0
import unittest from transformers import AutoConfig, AutoTokenizer, BertConfig, TensorType, is_flax_available from transformers.testing_utils import DUMMY_UNKNOWN_IDENTIFIER, require_flax, slow if is_flax_available(): import jax from transformers.models.auto.modeling_flax_auto import FlaxAutoModel ...
9
import unittest from transformers.utils.backbone_utils import ( BackboneMixin, get_aligned_output_features_output_indices, verify_out_features_out_indices, ) class A (unittest.TestCase ): '''simple docstring''' def a_ ( self : Any ) -> Union[s...
274
0
import logging import torch from torch import nn from torch.nn import CrossEntropyLoss, MSELoss from transformers.file_utils import add_start_docstrings, add_start_docstrings_to_model_forward from transformers.models.bert.modeling_bert import ( BERT_INPUTS_DOCSTRING, BERT_START_DOCSTRING, BertEncoder, ...
366
import re from typing import Callable, List, Optional, Union import tensorflow as tf try: from tensorflow.keras.optimizers.legacy import Adam except ImportError: from tensorflow.keras.optimizers import Adam class __SCREAMING_SNAKE_CASE ( tf.keras.optimizers.schedules.LearningRateSchedule )...
173
0
'''simple docstring''' from __future__ import annotations from typing import Generic, TypeVar A__ : List[str] =TypeVar('''T''') class UpperCAmelCase ( Generic[T] ): def __init__( self : List[str] , __snake_case : T ) -> None: ...
70
'''simple docstring''' import heapq as hq import math from collections.abc import Iterator class UpperCAmelCase : def __init__( self : str , __snake_case : Any ) -> str: _lowerCAmelCase = str(id_ ) _lo...
70
1
from sklearn.metrics import fa_score, matthews_corrcoef import datasets from .record_evaluation import evaluate as evaluate_record __UpperCAmelCase = "\\n@article{wang2019superglue,\n title={SuperGLUE: A Stickier Benchmark for General-Purpose Language Understanding Systems},\n author={Wang, Alex and Pruks...
257
__UpperCAmelCase = [ (10_00, "M"), (9_00, "CM"), (5_00, "D"), (4_00, "CD"), (1_00, "C"), (90, "XC"), (50, "L"), (40, "XL"), (10, "X"), (9, "IX"), (5, "V"), (4, "IV"), (1, "I"), ] def A__ ( __lowerCamelCase ): SCREAMING_SNAKE_CASE_ = {'''...
257
1
"""simple docstring""" import argparse import json import os import re import shutil import torch from transformers import BioGptConfig, BioGptForCausalLM from transformers.models.biogpt.tokenization_biogpt import VOCAB_FILES_NAMES from transformers.tokenization_utils_base import TOKENI...
33
'''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, E...
208
0
class __lowerCamelCase : """simple docstring""" def __init__( self , UpperCAmelCase ) -> None: '''simple docstring''' lowercase_ = len(UpperCAmelCase ) lowercase_ = [0] * len_array if len_array > 0: ...
297
import json from typing import TYPE_CHECKING, List, Optional, Tuple from tokenizers import pre_tokenizers from ...tokenization_utils_base import BatchEncoding from ...tokenization_utils_fast import PreTrainedTokenizerFast from ...utils import logging from .tokenization_gpta import GPTaTokenizer if TYPE_CHECKING:...
297
1
from __future__ import annotations from scipy.special import comb # type: ignore class lowerCamelCase_ : '''simple docstring''' def __init__( self , __lowercase) -> Tuple: __UpperCamelCase :str = list_of_points # Degree determines the flexibility of the curve....
43
import math from typing import Any, Callable, List, Optional, Tuple, Union import numpy as np import torch from ...models import TaFilmDecoder from ...schedulers import DDPMScheduler from ...utils import is_onnx_available, logging, randn_tensor if is_onnx_available(): from ..onnx_utils import OnnxRuntimeModel ...
43
1
"""simple docstring""" from typing import TYPE_CHECKING from ...utils import OptionalDependencyNotAvailable, _LazyModule, is_tf_available, is_torch_available __lowercase = {'''configuration_swin''': ['''SWIN_PRETRAINED_CONFIG_ARCHIVE_MAP''', '''SwinConfig''', '''SwinOnnxConfig''']} try: i...
85
"""simple docstring""" from typing import TYPE_CHECKING from ...utils import OptionalDependencyNotAvailable, _LazyModule, is_torch_available __lowercase = {'''configuration_ibert''': ['''IBERT_PRETRAINED_CONFIG_ARCHIVE_MAP''', '''IBertConfig''', '''IBertOnnxConfig''']} try: if not is_torch_...
85
1
'''simple docstring''' import unittest import numpy as np def __lowerCAmelCase (__lowerCAmelCase , __lowerCAmelCase , __lowerCAmelCase , __lowerCAmelCase = None , ): _UpperCAmelCase : Optional[int] = np.shape(__lowerCAmel...
234
'''simple docstring''' import argparse import re import torch from CLAP import create_model from transformers import AutoFeatureExtractor, ClapConfig, ClapModel lowerCamelCase__ = { 'text_branch': 'text_model', 'audio_branch': 'audio_model.audio_encoder', 'attn': 'attention....
234
1
import unittest import numpy as np from transformers.testing_utils import require_torch, require_vision from transformers.utils import is_torch_available, is_vision_available from ...test_image_processing_common import ImageProcessingSavingTestMixin, prepare_image_inputs if is_torch_available(): ...
355
from typing import TYPE_CHECKING from ...utils import OptionalDependencyNotAvailable, _LazyModule, is_torch_available _SCREAMING_SNAKE_CASE : int = { "configuration_timesformer": ["TIMESFORMER_PRETRAINED_CONFIG_ARCHIVE_MAP", "TimesformerConfig"], } try: if not is_torch_availab...
213
0
"""simple docstring""" def lowercase ( _SCREAMING_SNAKE_CASE : int , _SCREAMING_SNAKE_CASE : list ): '''simple docstring''' _enforce_args(_A , _A ) if n == 0: return 0 _UpperCAmelCase = float('''-inf''' ) for i in...
260
from collections import defaultdict from pathlib import Path import pandas as pd from rouge_cli import calculate_rouge_path from utils import calculate_rouge A : Optional[int] = [ "Prosecutor: \"No videos were used in the crash investigation\" German papers say they saw a cell phone...
184
0
'''simple docstring''' import argparse import json from pathlib import Path import requests import timm import torch from huggingface_hub import hf_hub_download from PIL import Image from timm.data import resolve_data_config from timm.data.transforms_factory import create_transform from tra...
179
'''simple docstring''' import os import re 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 _snake_case : str = logg...
179
1
"""simple docstring""" from importlib import import_module from .logging import get_logger lowerCAmelCase__ = get_logger(__name__) class __snake_case : def __init__( self : int , __lowerCAmelCase : List[str] , __lowerCAmelCase : ...
72
'''simple docstring''' snake_case_ : List[str] = { "Pillow": "Pillow<10.0.0", "accelerate": "accelerate>=0.20.3", "av": "av==9.2.0", "beautifulsoup4": "beautifulsoup4", "black": "black~=23.1", "codecarbon": "codecarbon==1.2.0", "cookiecutter": "cookiecutter==1.7.3", ...
125
0
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 argparse import json import os import re from collections import OrderedDict from os.path import basename, dirname import fairseq import torch from fairseq import hub_utils from fairseq.data.dictionary import Dictionary from transformers import FSMTConfig, FSMTForConditionalGeneration from transformers.mod...
130
"""simple docstring""" from ..utils import DummyObject, requires_backends class a ( metaclass=UpperCAmelCase__ ): UpperCamelCase : Optional[int] = ['torch', 'torchsde'] def __init__( self : Union[str, Any] , *lowerCAmelCase : Any , **lowerCAme...
173
0
"""simple docstring""" import unittest from transformers import LiltConfig, is_torch_available from transformers.testing_utils import require_torch, slow, torch_device from ...generation.test_utils import GenerationTesterMixin from ...test_configuration_common import ConfigTester from ...test_modeli...
163
"""simple docstring""" import logging import os import sys import warnings from dataclasses import dataclass, field from random import randint from typing import Optional import datasets import evaluate import numpy as np from datasets import DatasetDict, load_dataset import transformers from...
163
1