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
def __snake_case ( lowerCAmelCase_ ) -> list[list[int]]: SCREAMING_SNAKE_CASE__ = [] if len(lowerCAmelCase_ ) == 1: return [nums.copy()] for _ in range(len(lowerCAmelCase_ ) ): SCREAMING_SNAKE_CASE__ = nums.pop(0 ) SCREAMING_SNAKE...
100
from typing import Any, Callable, Dict, List, Optional, Union import torch from transformers import CLIPImageProcessor, CLIPTextModel, CLIPTokenizer from diffusers import ( AutoencoderKL, DDIMScheduler, DiffusionPipeline, LMSDiscreteScheduler, PNDMScheduler, StableDiffusionPipeline, U...
587
0
import argparse import torch from transformers import OpenAIGPTConfig, OpenAIGPTModel, load_tf_weights_in_openai_gpt from transformers.utils import CONFIG_NAME, WEIGHTS_NAME, logging logging.set_verbosity_info() def UpperCamelCase_( lowerCamelCase_ , lowerCamelCase_ , lowerCamelCase...
354
import tempfile import torch from diffusers import ( DEISMultistepScheduler, DPMSolverMultistepScheduler, DPMSolverSinglestepScheduler, UniPCMultistepScheduler, ) from .test_schedulers import SchedulerCommonTest class _lowerCamelCase( _a ): lowercase_ : List[Any] = ...
354
1
from __future__ import annotations class A : def __init__( self: Dict , _lowerCAmelCase: int ) -> None: '''simple docstring''' UpperCAmelCase_ =order # a_{0} ... a_{k} UpperCAmelCase_ =[1.0] + [0...
54
"""simple docstring""" from math import pi, sqrt, tan def _lowerCAmelCase(a : float ) -> float: if side_length < 0: raise ValueError('''surface_area_cube() only accepts non-negative values''' ) return 6 * side_length**2 def _lowerCAmelCase(a : float , a...
255
0
'''simple docstring''' import math from typing import Union import torch from ..configuration_utils import ConfigMixin, register_to_config from ..utils import randn_tensor from .scheduling_utils import SchedulerMixin class __A ( UpperCAmelCase__ , UpperCAmelCase__ ): a__ : Tuple = 1 ...
714
'''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 # # ...
415
0
"""simple docstring""" from ...configuration_utils import PretrainedConfig from ...utils import logging a__ : Optional[int] = logging.get_logger(__name__) a__ : Union[str, Any] = { '''facebook/xglm-564M''': '''https://huggingface.co/facebook/xglm-564M/resolve/...
589
from manim import * class A__ ( __snake_case ): '''simple docstring''' def _SCREAMING_SNAKE_CASE ( self : Union[str, Any] ): """simple docstring""" UpperCamelCase = Rectangle(height=0.5 ...
280
0
"""simple docstring""" from typing import TYPE_CHECKING from ..models.auto import AutoModelForVisionaSeq from ..utils import requires_backends from .base import PipelineTool if TYPE_CHECKING: from PIL import Image class UpperCamelCase ( lowercase_ ): lowercase = 'Salesforce/bl...
705
"""simple docstring""" from argparse import ArgumentParser from .env import EnvironmentCommand def lowercase__( ): lowercase_ : List[Any] = ArgumentParser('Diffusers CLI tool' , usage='diffusers-cli <command> [<args>]' ) lowercase_ : int = parser.add_su...
477
0
'''simple docstring''' import importlib.util import os import platform from argparse import ArgumentParser import huggingface_hub from .. import __version__ as version from ..utils import ( is_accelerate_available, is_flax_available, is_safetensors_available, is_tf_available, is_torch_available,...
48
'''simple docstring''' import operator def snake_case ( snake_case : list , snake_case : bool = False , snake_case : list | None = None ) -> list: """simple docstring""" lowerCAmelCase = operator.lt if reverse else operator.gt lowerCAmelCase =...
284
0
from argparse import ArgumentParser, Namespace from ..utils import logging from . import BaseTransformersCLICommand def lowerCamelCase__ (_UpperCAmelCase): return ConvertCommand( args.model_type , args.tf_checkpoint , args.pytorch_dump_output , args.con...
444
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
1
"""simple docstring""" class _lowerCAmelCase : # Public class to implement a graph """simple docstring""" def __init__( self , __UpperCAmelCase , __UpperCAmelCase , __UpperCAmelCase ): '''simple docstring''' lowerCAmelCase__ ...
93
import argparse import json import os import fairseq import torch from fairseq.data import Dictionary from transformers import ( WavaVecaConformerConfig, WavaVecaConformerForCTC, WavaVecaConformerForPreTraining, WavaVecaCTCTokenizer, WavaVecaFeatureExtractor, WavaVecaProcessor, ...
486
0
"""simple docstring""" def _SCREAMING_SNAKE_CASE ( __snake_case : int = 4_00_00_00 ): '''simple docstring''' lowercase = [0, 1] lowercase = 0 while fib[i] <= n: fib.append(fib[i] + fib[i + 1] ) if fib[i + 2] > n: break i += 1 ...
134
"""simple docstring""" import math from collections.abc import Iterator from itertools import takewhile def _SCREAMING_SNAKE_CASE ( __snake_case : int ): '''simple docstring''' if 1 < number < 4: # 2 and 3 are primes return True elif number < 2 or number % 2 == 0 o...
134
1
from typing import TYPE_CHECKING from ...utils import ( OptionalDependencyNotAvailable, _LazyModule, is_sentencepiece_available, is_speech_available, is_tf_available, is_torch_available, ) _snake_case : Tuple = { "configuration_speech_to_text": ["SPEECH_TO_TEXT_P...
53
'''simple docstring''' import json import os import tempfile from transformers.testing_utils import check_json_file_has_correct_format class __UpperCAmelCase : __lowercase = None def lowerCamelCase ( self ): """simple docstring""" _snake_ca...
495
0
"""simple docstring""" from typing import TYPE_CHECKING from ...utils import OptionalDependencyNotAvailable, _LazyModule, is_torch_available, is_vision_available __lowercase : str = { """configuration_poolformer""": [ """POOLFORMER_PRETRAINED_CONFIG_ARCHIVE_MAP""", """PoolFormerC...
66
"""simple docstring""" from typing import TYPE_CHECKING from ...utils import OptionalDependencyNotAvailable, _LazyModule, is_torch_available __lowercase : Tuple = { """configuration_jukebox""": [ """JUKEBOX_PRETRAINED_CONFIG_ARCHIVE_MAP""", """JukeboxConfig""", """Jukebox...
66
1
import argparse import torch from ...utils import logging from . import AlbertConfig, AlbertForPreTraining, load_tf_weights_in_albert logging.set_verbosity_info() def lowerCAmelCase_ ( _SCREAMING_SNAKE_CASE : List[Any] , _SCREAMING_SNAKE_CASE : int , _SCREAMING_SNAKE_CAS...
635
import json import os import unittest from transformers.models.xlm.tokenization_xlm import VOCAB_FILES_NAMES, XLMTokenizer from transformers.testing_utils import slow from ...test_tokenization_common import TokenizerTesterMixin class __lowerCAmelCase ( lowerCAmelCase__ , unittest.TestCase ): low...
175
0
import warnings from ...processing_utils import ProcessorMixin from ...tokenization_utils_base import BatchEncoding class __snake_case ( __snake_case ): UpperCAmelCase__ : List[str] = ['''image_processor''', '''tokenizer'''] UpperCAmelCase__ : Optional[Any] = '...
719
from __future__ import annotations from fractions import Fraction from math import gcd, sqrt def A (__A : int ) -> bool: """simple docstring""" UpperCAmelCase_ = int(number**0.5 ) return number == sq * sq def A (__A : ...
169
0
'''simple docstring''' import inspect import logging import os import random import shutil import tempfile import unittest import pytest import torch from torch import nn from torch.utils.data import DataLoader, TensorDataset from accelerate import Accelerator from accelerate.test_utils import execute_sub...
38
'''simple docstring''' # Copyright 2023 The HuggingFace Inc. team. All rights reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0...
78
0
import inspect import unittest import numpy as np from transformers import BeitConfig from transformers.testing_utils import require_flax, require_vision, slow from transformers.utils import cached_property, is_flax_available, is_vision_available from ...test_configuration_common import ConfigTester from ...test_m...
708
from collections import OrderedDict from typing import TYPE_CHECKING, Any, List, Mapping, Optional, Union from ...configuration_utils import PretrainedConfig from ...onnx import OnnxConfig from ...utils import TensorType, logging if TYPE_CHECKING: from ...onnx.config import PatchingSpec from ...token...
472
0
from typing import TYPE_CHECKING from ...utils import OptionalDependencyNotAvailable, _LazyModule, is_torch_available a__ = { """configuration_jukebox""": [ """JUKEBOX_PRETRAINED_CONFIG_ARCHIVE_MAP""", """JukeboxConfig""", """JukeboxPriorConfig""", """Ju...
477
from argparse import ArgumentParser from ..pipelines import Pipeline, PipelineDataFormat, get_supported_tasks, pipeline from ..utils import logging from . import BaseTransformersCLICommand a__ = logging.get_logger(__name__) # pylint: disable=invalid-name def lowercase ( SCREA...
477
1
from urllib.parse import quote import pytest from datasets.utils.hub import hf_hub_url @pytest.mark.parametrize("""repo_id""" , ["""canonical_dataset_name""", """org-name/dataset-name"""] ) @pytest.mark.parametrize("""path""" , ["""filename.csv""", """filename with blanks...
247
import os import string import sys A : Dict = 1 << 8 A : Dict = { '''tab''': ord('''\t'''), '''newline''': ord('''\r'''), '''esc''': 2_7, '''up''': 6_5 + ARROW_KEY_FLAG, '''down''': 6_6 + ARROW_KEY_FLAG, '''right''': 6_7 + ARROW_KEY_FLAG, ...
247
1
"""simple docstring""" import warnings from contextlib import contextmanager from ...processing_utils import ProcessorMixin class __UpperCAmelCase ( __lowerCAmelCase ): A__ : Optional[int] = '''Speech2TextFeatureExtractor''' A__ : Tuple = '''Speech2TextTokenizer''' ...
530
"""simple docstring""" from __future__ import annotations from typing import Any class __UpperCAmelCase : def __init__( self , _lowerCamelCase , _lowerCamelCase , _lowerCamelCase = 0 ): lowerCamelCase__ , lowerCamelCase__ =row, column lowerCamelCase__ ...
530
1
'''simple docstring''' 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.spect...
0
'''simple docstring''' import sys UpperCamelCase__ : int = ( "73167176531330624919225119674426574742355349194934" "96983520312774506326239578318016984801869478851843" "85861560789112949495459501737958331952853208805511" "12540698747158523863050715693290963295227443043557" "6...
0
1
import logging from pathlib import Path import numpy as np import pytorch_lightning as pl import torch from pytorch_lightning.callbacks import EarlyStopping, ModelCheckpoint from pytorch_lightning.utilities import rank_zero_only from utils_rag import save_json def lowercase__ ( _UpperCamel...
280
def lowercase__ ( _UpperCamelCase) -> list: """simple docstring""" if bit_count < 0: raise ValueError('The given input must be positive') # get the generated string sequence UpperCamelCase = gray_code_sequence_string(_UpperCamelCase) ...
280
1
from math import log from scipy.constants import Boltzmann, physical_constants UpperCamelCase__ = 300 # TEMPERATURE (unit = K) def _UpperCamelCase (a__ :float , a__ :float , a__ :float , ): """simple docstring""" if donor_conc <= 0: ra...
710
import argparse import datetime def _UpperCamelCase (a__ :str ): """simple docstring""" UpperCamelCase__ = { """0""": """Sunday""", """1""": """Monday""", """2""": """Tuesday""", """3""": """Wednesday""", ...
548
0
"""simple docstring""" from pathlib import Path import fire from tqdm import tqdm def _UpperCAmelCase ( __lowerCamelCase : Union[str, Any]="ro" , __lowerCamelCase : Optional[Any]="en" , __lowerCamelCase : Optional[int]="wmt16" , __lowerCamelCase : Tuple=None ) -> ...
224
"""simple docstring""" import argparse import os # New Code # import evaluate import torch from datasets import load_dataset from torch.optim import AdamW from torch.utils.data import DataLoader from transformers import AutoModelForSequenceClassification, AutoTokenizer, get_linear_schedule_with_warmu...
224
1
from typing import TYPE_CHECKING from ...utils import OptionalDependencyNotAvailable, _LazyModule, is_torch_available __UpperCAmelCase = { """configuration_lilt""": ["""LILT_PRETRAINED_CONFIG_ARCHIVE_MAP""", """LiltConfig"""], } try: if not is_torch_available(): raise OptionalDep...
700
from ...configuration_utils import PretrainedConfig from ...utils import logging __UpperCAmelCase = logging.get_logger(__name__) __UpperCAmelCase = { """weiweishi/roc-bert-base-zh""": """https://huggingface.co/weiweishi/roc-bert-base-zh/resolve/main/config.json""", } class SCRE...
218
0
"""simple docstring""" import flax.linen as nn import jax.numpy as jnp from .attention_flax import FlaxTransformeraDModel from .resnet_flax import FlaxDownsampleaD, FlaxResnetBlockaD, FlaxUpsampleaD class lowercase__ ( nn.Module ): __UpperCAmelCase = 42 __UpperCA...
88
"""simple docstring""" from ...configuration_utils import PretrainedConfig from ...utils import logging snake_case_ : str = logging.get_logger(__name__) snake_case_ : Any = { """google/vivit-b-16x2-kinetics400""": ( """https://huggingface.co/google/vivit-b-16x2-kinetics400/resolve...
595
0
import datasets from .evaluate import evaluate a= "\\n@article{hendrycks2021cuad,\n title={CUAD: An Expert-Annotated NLP Dataset for Legal Contract Review},\n author={Dan Hendrycks and Collin Burns and Anya Chen and Spencer Ball},\n journal={arXiv preprint arXiv:2103.06268},\n year={2021}\n}\n" ...
707
'''simple docstring''' def _UpperCamelCase ( _a : int ): """simple docstring""" if bit_count < 0: raise ValueError('The given input must be positive' ) # get the generated string sequence __UpperCamelCase : Dict = gray_code_sequence_string(_a ) # # convert them t...
287
0
'''simple docstring''' from itertools import product def SCREAMING_SNAKE_CASE ( lowercase_ : int , lowercase_ : int ): lowercase = sides_number lowercase = max_face_number * dice_number lowercase = [0] * (max_total + 1) lowercase = 1 ...
588
'''simple docstring''' import gc import random import unittest import numpy as np import torch from transformers import XLMRobertaTokenizer from diffusers import ( AltDiffusionImgaImgPipeline, AutoencoderKL, PNDMScheduler, UNetaDConditionModel, ) from diffusers.image_processor import VaeImagePro...
588
1
'''simple docstring''' import inspect import unittest from transformers import MobileViTConfig from transformers.testing_utils import require_torch, require_vision, slow, torch_device from transformers.utils import cached_property, is_torch_available, is_vision_available from ...test_configuration_common imp...
352
'''simple docstring''' from ...configuration_utils import PretrainedConfig from ...utils import logging lowercase_ = logging.get_logger(__name__) lowercase_ = { "google/pegasus-large": "https://huggingface.co/google/pegasus-large/resolve/main/config.json", # See all PEGASUS models at htt...
352
1
"""simple docstring""" from __future__ import annotations from sys import maxsize from typing import Generic, TypeVar __UpperCamelCase : Union[str, Any] = TypeVar('''T''') def _SCREAMING_SNAKE_CASE (_UpperCAmelCase : int ): return (position - 1) // 2 def _SCREAMING_SNAKE_...
4
'''simple docstring''' import torch from diffusers import DDPMScheduler from .test_schedulers import SchedulerCommonTest class _snake_case ( a_ ): SCREAMING_SNAKE_CASE : Dict = (DDPMScheduler,) def _SCREAMING_SNAKE_CASE ( self , **_SCREAMING_SNAKE_CASE ): ...
284
0
"""simple docstring""" import argparse import json from collections import OrderedDict from pathlib import Path import requests import torch from huggingface_hub import hf_hub_download from PIL import Image from transformers import ( ConditionalDetrConfig, ConditionalDetrForObjectDetect...
713
"""simple docstring""" import json import multiprocessing as mp import re from collections import defaultdict from functools import partial from typing import Dict, List, Optional, Set, Tuple, Type from datasets import Dataset from datasketch import MinHash, MinHashLSH from dpu_utils.utils.iterator...
659
0
'''simple docstring''' import argparse import struct import unittest class __lowerCAmelCase : """simple docstring""" def __init__( self : Optional[int] , lowerCAmelCase__ : bytes ) -> None: '''simple docstring''' _UpperCamelC...
98
import json import os from typing import Dict, List, Optional, Tuple from ...tokenization_utils import PreTrainedTokenizer from ...utils import logging __lowerCamelCase = logging.get_logger(__name__) __lowerCamelCase = { """vocab_file""": """vocab.json""", """tokenizer_config_file...
317
0
import json import os import unittest from typing import Tuple from transformers import WavaVecaPhonemeCTCTokenizer from transformers.models.wavaveca.tokenization_wavaveca import VOCAB_FILES_NAMES from transformers.models.wavaveca_phoneme.tokenization_wavaveca_phoneme import WavaVecaPhonemeCTCTokenizerOutput fr...
290
import enum import warnings from .. import MODEL_FOR_CAUSAL_LM_MAPPING, TF_MODEL_FOR_CAUSAL_LM_MAPPING from ..utils import add_end_docstrings, is_tf_available from .base import PIPELINE_INIT_ARGS, Pipeline if is_tf_available(): import tensorflow as tf class _UpperCamelCase (enum.Enum ): s...
290
1
'''simple docstring''' from math import log from scipy.constants import Boltzmann, physical_constants lowerCAmelCase_ : Tuple = 300 # TEMPERATURE (unit = K) def _SCREAMING_SNAKE_CASE ( UpperCamelCase__ : float , UpperCamelCase__ : float , UpperCa...
442
'''simple docstring''' from ...configuration_utils import PretrainedConfig from ...utils import logging lowerCAmelCase_ : str = logging.get_logger(__name__) lowerCAmelCase_ : Any = { 'transfo-xl-wt103': 'https://huggingface.co/transfo-xl-wt103/resolve/main/conf...
442
1
'''simple docstring''' import os import unittest from transformers import MobileBertTokenizer, MobileBertTokenizerFast from transformers.models.bert.tokenization_bert import ( VOCAB_FILES_NAMES, BasicTokenizer, WordpieceTokenizer, _is_control, _is_punctuation, ...
704
'''simple docstring''' # tests directory-specific settings - this file is run automatically # by pytest before any tests are run import sys import warnings from os.path import abspath, dirname, join # allow having multiple repository checkouts and not needing to remember to rerun ...
61
0
'''simple docstring''' def _SCREAMING_SNAKE_CASE (A ) -> int: """simple docstring""" lowercase__ = [[0 for _ in range(A )] for _ in range(m + 1 )] for i in range(m + 1 ): lowercase__ = 1 for n in range(m + 1 ): for...
460
'''simple docstring''' from typing import TYPE_CHECKING from ...utils import ( OptionalDependencyNotAvailable, _LazyModule, is_flax_available, is_tf_available, is_tokenizers_available, is_torch_available, ) lowerCamelCase : Tuple = { 'configuration_distilbert': [ ...
460
1
import os from shutil import copyfile from typing import Any, Dict, List, Optional, Tuple import sentencepiece as spm from ...tokenization_utils import AddedToken, PreTrainedTokenizer from ...utils import logging UpperCamelCase = logging.get_logger(__name__) UpperCamelCase ...
569
import copy from dataclasses import dataclass, field from typing import ClassVar, Dict from ..features import ClassLabel, Features, Value from .base import TaskTemplate @dataclass(frozen=_UpperCAmelCase ) class __UpperCAmelCase (_UpperCAmelCase ): # `task` is not a ClassVar si...
569
1
"""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 ( ...
52
"""simple docstring""" from __future__ import annotations def lowercase ( UpperCamelCase : list[float] ): """simple docstring""" if len(UpperCamelCase ) < 2: raise ValueError("Monogons and Digons are not polygons in the Euclidean space" ) if any(i <= 0 for i i...
656
0
'''simple docstring''' import torch from transformers import CamembertForMaskedLM, CamembertTokenizer def __magic_name__ ( __UpperCAmelCase , __UpperCAmelCase , __UpperCAmelCase , __UpperCAmelCase=5 ) -> int: '''simple docstring''' assert masked_i...
13
'''simple docstring''' import flax.linen as nn import jax import jax.numpy as jnp class __a ( nn.Module ): __UpperCamelCase : int __UpperCamelCase : jnp.dtype = jnp.floataa def UpperCAmelCase__ ( self : List[Any] ): '''simple docstring''' __SC...
13
1
from ...configuration_utils import PretrainedConfig from ...utils import logging _lowerCamelCase = logging.get_logger(__name__) _lowerCamelCase = { 'google/pegasus-large': 'https://huggingface.co/google/pegasus-large/resolve/main/config.json', # See all PEGASUS models at https://hug...
6
"""simple docstring""" import argparse import torch from torch import nn from transformers import SpeechaTextConfig, SpeechaTextForConditionalGeneration def UpperCAmelCase__ ( SCREAMING_SNAKE_CASE : List[Any] ): '''simple docstring''' lowerCAmelCase = [ ...
532
0
from typing import TYPE_CHECKING from ...utils import ( OptionalDependencyNotAvailable, _LazyModule, is_tf_available, is_torch_available, is_vision_available, ) _lowerCamelCase ={ "configuration_blip": [ "BLIP_PRETRAINED_CONFIG_ARCHIVE_MAP", "BlipConfig", "Bli...
709
def snake_case__ ( lowerCAmelCase_ = 1000000 ): """simple docstring""" SCREAMING_SNAKE_CASE =limit + 1 SCREAMING_SNAKE_CASE =[0] * limit for first_term in range(1, lowerCAmelCase_ ): for n in range(lowerCAmelCase_, lowerCAmelCase_, lowe...
252
0
"""simple docstring""" from __future__ import annotations def a_ ( lowercase__ :list[int] ): if not nums: return 0 __lowerCamelCase = nums[0] __lowerCamelCase = 0 for num in nums[1:]: __lowerCamelCase ,__lowerCamelCase ...
281
"""simple docstring""" from dataclasses import dataclass from typing import List, Optional, Union import numpy as np import torch from ...utils import BaseOutput, OptionalDependencyNotAvailable, is_torch_available, is_transformers_available @dataclass class __snake_case (lowerCamel...
281
1
import copy from ...configuration_utils import PretrainedConfig from ...utils import logging from ..auto import CONFIG_MAPPING _lowerCAmelCase = logging.get_logger(__name__) _lowerCAmelCase = { 'SenseTime/deformable-detr': 'https://huggingface.co/sensetime/deformable-detr/resolve/main/conf...
236
import unittest import numpy as np import torch from .utils_summarization import build_mask, compute_token_type_ids, process_story, truncate_or_pad class __UpperCAmelCase( unittest.TestCase ): """simple docstring""" def UpperCAmelCase ( self ): """simple docs...
236
1
"""simple docstring""" def __lowerCAmelCase ( __UpperCamelCase : int ): '''simple docstring''' if divisor % 5 == 0 or divisor % 2 == 0: return 0 snake_case_ : Any = 1 snake_case_ : Optional[int] ...
58
class _a : '''simple docstring''' def __init__( self , __UpperCAmelCase ): __A : List[str] = val __A : str = None __A : List[Any] = None def __UpperCAmelCase( self , __UpperCAmelCase ): if self.val: ...
520
0
'''simple docstring''' import baseaa def _UpperCamelCase ( lowerCAmelCase__: str ) -> bytes: return baseaa.baaencode(string.encode('utf-8' ) ) def _UpperCamelCase ( lowerCAmelCase__: bytes ) -> str: return bas...
238
'''simple docstring''' from .constants import ( MODEL_NAME, OPTIMIZER_NAME, RNG_STATE_NAME, SAFE_WEIGHTS_INDEX_NAME, SAFE_WEIGHTS_NAME, SCALER_NAME, SCHEDULER_NAME, TORCH_LAUNCH_PARAMS, WEIGHTS_INDEX_NAME, WEIGHTS_NAME, ) from .dataclasses import ( BnbQuan...
238
1
"""simple docstring""" import argparse import re from pathlib import Path import requests import torch from PIL import Image from torchvision.transforms import CenterCrop, Compose, Normalize, Resize, ToTensor from transformers import ( EfficientFormerConfig, EfficientFormer...
96
'''simple docstring''' import importlib.metadata from typing import Union from packaging.version import Version, parse from .constants import STR_OPERATION_TO_FUNC _lowercase = parse(importlib.metadata.version('torch')) def __UpperCamelCase ( a : ...
342
0
import inspect import unittest from huggingface_hub import hf_hub_download from transformers import ASTConfig from transformers.testing_utils import require_torch, require_torchaudio, slow, torch_device from transformers.utils import cached_property, is_torch_available, is_torchaudio_available from ...test_co...
712
import logging import os import threading import time try: import warnings except ImportError: lowerCamelCase : Any = None try: import msvcrt except ImportError: lowerCamelCase : str = None try: import fcntl except ImportError: lowerCamelCase : Optional[Any] = ...
649
0
'''simple docstring''' def _a( ): '''simple docstring''' SCREAMING_SNAKE_CASE__ : Union[str, Any] =[3_1, 2_8, 3_1, 3_0, 3_1, 3_0, 3_1, 3_1, 3_0, 3_1, 3_0, 3_1] SCREAMING_SNAKE_CASE__ : List[Any] =6 SCREAMING_SNAKE_CASE__ : Dict...
296
'''simple docstring''' # Algorithm for the pigeonhole sorting def _a( UpperCamelCase__ : Optional[int] ): '''simple docstring''' SCREAMING_SNAKE_CASE__ : int =min(UpperCamelCase__ ) # min() finds the minimum value SCREAMIN...
296
1
"""simple docstring""" from collections import OrderedDict from typing import Mapping from ...configuration_utils import PretrainedConfig from ...onnx import OnnxConfig from ...utils import logging __SCREAMING_SNAKE_CASE = logging.get_logger(__name__) __SCREAMING_SNAKE_CASE = { 'andre...
395
"""simple docstring""" def A_ ( __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 empty list' ) if len(__lowercase ) == 1: return...
395
1
"""simple docstring""" from .configuration_bert_masked import MaskedBertConfig from .modeling_bert_masked import ( MaskedBertForMultipleChoice, MaskedBertForQuestionAnswering, MaskedBertForSequenceClassification, MaskedBertForTokenClassification, MaskedBertModel, ) from .modules import * ...
437
"""simple docstring""" import shutil import tempfile import unittest from transformers import ClapFeatureExtractor, ClapProcessor, RobertaTokenizer, RobertaTokenizerFast from transformers.testing_utils import require_sentencepiece, require_torchaudio from .test_feature_extraction_clap import floats_list ...
437
1
"""simple docstring""" import json import os import tempfile import datasets from utils import generate_example_dataset, get_duration lowerCamelCase_ : Optional[Any] = 5_00_00 lowerCamelCase_ : Optional[int] = 50_00 lowerCamelCase_ , lowerCamelCase_ : int ...
302
"""simple docstring""" from __future__ import annotations from collections import deque from collections.abc import Iterator from dataclasses import dataclass @dataclass class _UpperCAmelCase : '''simple docstring''' lowercase_ : int lowercase_ : int class _Uppe...
302
1
from __future__ import annotations import math def UpperCAmelCase_ ( _UpperCAmelCase :int ) -> Optional[Any]: '''simple docstring''' if num <= 0: A_ = f'{num}: Invalid input, please enter a positive integer.' raise ValueError(_UpperCAmelCase ...
188
_a : str = """ # Transformers installation ! pip install transformers datasets # To install from source instead of the last release, comment the command above and uncomment the following one. # ! pip install git+https://github.com/huggingface/transformers.git """ _a : int = [{"""type""":...
145
0
'''simple docstring''' import argparse import collections import os import re 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_table.py __magic_name__ ...
708
__magic_name__ = { "joule": 1.0, "kilojoule": 1_0_0_0, "megajoule": 1_0_0_0_0_0_0, "gigajoule": 1_0_0_0_0_0_0_0_0_0, "wattsecond": 1.0, "watthour": 3_6_0_0, "kilowatthour": 3_6_0_0_0_0_0, "newtonmeter": 1.0, "calorie_nutr": 4_1_8_6.8, "kilocalorie_nutr": ...
73
0
from math import factorial UpperCamelCase = {str(d): factorial(d) for d in range(10)} def lowerCamelCase_ ( _lowercase ) -> int: return sum(DIGIT_FACTORIAL[d] for d in str(_lowercase ) ) def lowerCamelCase_ ( ) -> int: __A ...
520
'''simple docstring''' from ...configuration_utils import PretrainedConfig from ...utils import logging __lowercase : Optional[int] = logging.get_logger(__name__) __lowercase : Optional[int] = { '''studio-ousia/luke-base''': '''https://huggingface.co/studio-ousia/luke-base/resolve/...
422
0
"""simple docstring""" def snake_case ( lowerCAmelCase_ ) -> List[str]: _snake_case = [] _snake_case = set({'''(''', '''[''', '''{'''} ) _snake_case = set({''')''', ''']''', '''}'''} ) _snake_case = {'''{''': '''}''', '''[''': ''']''', '''...
404
"""simple docstring""" import math import sys def snake_case ( lowerCAmelCase_ ) -> int: if number != int(lowerCAmelCase_ ): raise ValueError('''the value of input must be a natural number''' ) if number < 0: raise ValueError('''the value of input must not be a...
404
1
'''simple docstring''' import argparse from collections import defaultdict import yaml lowerCAmelCase_ : Union[str, Any] = 'docs/source/en/_toctree.yml' def _lowerCamelCase ( lowercase : Optional[int] ) -> List[str]: _a = defaultdict(lo...
692
import copy from ...configuration_utils import PretrainedConfig from ...utils import logging from ..bit import BitConfig snake_case = logging.get_logger(__name__) snake_case = { "Intel/dpt-large": "https://huggingface.co/Intel/dpt-large/resolve/main/config.json", # See all DPT models at http...
424
0
"""simple docstring""" from __future__ import annotations class _SCREAMING_SNAKE_CASE : """simple docstring""" def __init__( self , lowerCamelCase__ ) -> None: lowercase__ : Union[str, Any] = data lowercase__ : Dict = None lowercase__ : D...
700
"""simple docstring""" from abc import ABC, abstractmethod from argparse import ArgumentParser class _SCREAMING_SNAKE_CASE ( __UpperCAmelCase ): """simple docstring""" @staticmethod @abstractmethod def UpperCAmelCase__( lowerCamelCase__ ) -> Optional[Any]: rai...
128
0
'''simple docstring''' def _UpperCamelCase ( UpperCamelCase__ , UpperCamelCase__ ): if digit_amount > 0: return round(number - int(UpperCamelCase__ ) , UpperCamelCase__ ) return number - int(UpperCamelCase__ ) if __name__ == "__main__": print(d...
407
'''simple docstring''' import unittest from transformers import SPIECE_UNDERLINE, XLNetTokenizer, XLNetTokenizerFast from transformers.testing_utils import get_tests_dir, require_sentencepiece, require_tokenizers, slow from ...test_tokenization_common import TokenizerTesterMixin __A =get_t...
407
1
# flake8: noqa # Lint as: python3 from typing import Dict, List, Optional, Type from .. import config from ..utils import logging from .formatting import ( ArrowFormatter, CustomFormatter, Formatter, PandasFormatter, PythonFormatter, TensorFormatter, format_table, query_table, ) fr...
526
import torch from diffusers import DDPMScheduler from .test_schedulers import SchedulerCommonTest class _UpperCAmelCase ( A__ ): UpperCamelCase__ = (DDPMScheduler,) def snake_case_ ( self , **a__): A__ = { '''num_train_timesteps''': 1...
526
1
'''simple docstring''' def UpperCAmelCase_ ( lowerCamelCase_ ): """simple docstring""" if bit_count < 0: raise ValueError("The given input must be positive" ) # get the generated string sequence lowerCAmelCase__ : Dict = gray_code_sequence_string(a_ ) # # convert them to in...
378
"""simple docstring""" def __lowerCamelCase ( a_ : int = 50 ) -> int: __SCREAMING_SNAKE_CASE :List[str] = [1] * (length + 1) for row_length in range(length + 1 ): for tile_length in range(2 , 5 ): for tile_start in ...
498
0
# Copyright 2023 The HuggingFace Team. All rights reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless r...
414
import os import unittest from transformers import LxmertTokenizer, LxmertTokenizerFast from transformers.models.bert.tokenization_bert import VOCAB_FILES_NAMES from transformers.testing_utils import require_tokenizers from ...test_tokenization_common import TokenizerTesterMixin @require_token...
414
1
"""simple docstring""" import os import sys import unittest __A : List[Any] = os.path.abspath(os.path.dirname(os.path.dirname(os.path.dirname(__file__)))) sys.path.append(os.path.join(git_repo_path, '''utils''')) import check_dummies # noqa: E402 from check_dummie...
231
from dataclasses import dataclass, field from typing import ClassVar, Dict from ..features import Features, Value from .base import TaskTemplate @dataclass(frozen=A__ ) class _lowercase ( A__ ): '''simple docstring''' SCREAMING_SNAKE_CASE__ : str = field(default=''...
696
0
"""simple docstring""" import tempfile import unittest from pathlib import Path from shutil import copyfile from transformers import BatchEncoding, MarianTokenizer from transformers.testing_utils import get_tests_dir, require_sentencepiece, slow from transformers.utils import is_sentencepiece_ava...
712
"""simple docstring""" import copy from dataclasses import dataclass, field from typing import ClassVar, Dict from ..features import ClassLabel, Features, Value from .base import TaskTemplate @dataclass(frozen=lowerCamelCase_ ) class lowerCAmelCase ( lowerCamelCase_ ): ...
327
0
from __future__ import annotations from typing import Dict from ...configuration_utils import PretrainedConfig __a :Dict = { 'susnato/ernie-m-base_pytorch': 'https://huggingface.co/susnato/ernie-m-base_pytorch/blob/main/config.json', 'susnato/ernie-m-large_pytorch': 'https://huggingfa...
86
import os _lowercase = {'''I''': 1, '''V''': 5, '''X''': 10, '''L''': 50, '''C''': 100, '''D''': 500, '''M''': 1000} def UpperCamelCase ( snake_case__): lowerCAmelCase_ : List[str] = 0 lowerCAmelCase_ : Any = 0 while index < len(snake_case__) - 1: ...
659
0
import copy from typing import Any, Dict, List, Optional, Union import numpy as np from ...audio_utils import mel_filter_bank, spectrogram, window_function from ...feature_extraction_sequence_utils import SequenceFeatureExtractor from ...feature_extraction_utils import BatchFeature from ...utils import TensorType,...
683
import json import os from functools import lru_cache from typing import List, Optional, Tuple import regex as re from ...tokenization_utils import AddedToken, PreTrainedTokenizer from ...utils import logging _lowercase = logging.get_logger(__name__) _lowercase = {'''vocab_file''': '''vocab.jso...
683
1
'''simple docstring''' # Copyright 2021 The HuggingFace Team. All rights reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licen...
90
import inspect import os import re from transformers.configuration_utils import PretrainedConfig 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_config_docstrings.py lowercase_ ...
562
0
"""simple docstring""" import inspect import unittest from transformers import ConvNextConfig from transformers.testing_utils import require_torch, require_vision, slow, torch_device from transformers.utils import cached_property, is_torch_available, is_vision_available from ...test_backbone_common import Backb...
719
"""simple docstring""" import math from enum import Enum from typing import Optional, Union from torch.optim import Optimizer from torch.optim.lr_scheduler import LambdaLR from .utils import logging lowercase__ : List[Any] = logging.get_logger(__name__) class _UpperCAmelCase ( low...
485
0
'''simple docstring''' from jiwer import compute_measures import datasets __lowerCamelCase = '''\ @inproceedings{inproceedings, author = {Morris, Andrew and Maier, Viktoria and Green, Phil}, year = {2004}, month = {01}, pages = {}, title = {From WER and RIL to MER and WIL:...
467
'''simple docstring''' from collections import OrderedDict from typing import Mapping from packaging import version from ...configuration_utils import PretrainedConfig from ...onnx import OnnxConfig from ...utils import logging from ..auto import CONFIG_MAPPING __snake_case = logging.get_logger(__name__) ...
451
0
'''simple docstring''' import gc import threading import time import psutil import torch class UpperCamelCase__ : '''simple docstring''' def __init__( self ) -> Optional[int]: __lowerCAmelCase : List[Any] = psutil.Process() __lowerCAmelCase ...
123
'''simple docstring''' import json import os import unittest from transformers import OpenAIGPTTokenizer, OpenAIGPTTokenizerFast from transformers.models.openai.tokenization_openai import VOCAB_FILES_NAMES from transformers.testing_utils import require_ftfy, require_spacy, require_tokenizers from ...test_toke...
123
1
"""simple docstring""" from typing import TYPE_CHECKING from ...utils import ( OptionalDependencyNotAvailable, _LazyModule, is_flax_available, is_sentencepiece_available, is_tf_available, is_tokenizers_available, is_torch_available, ) _lowercase = { '''configuration_albert'...
91
from dataclasses import dataclass, field from typing import Optional @dataclass class A : _SCREAMING_SNAKE_CASE = field( default="""codeparrot/codeparrot""" ,metadata={"""help""": """Model name or path of model to be trained."""} ) _SCREAMING_SNAKE_CASE = ...
326
0
import gc import random import tempfile import unittest import numpy as np import torch from PIL import Image from transformers import CLIPTextConfig, CLIPTextModel, CLIPTokenizer from diffusers import ( AutoencoderKL, DDIMInverseScheduler, DDIMScheduler, DPMSolverMultistepInverseScheduler, ...
226
from typing import TYPE_CHECKING from ...utils import OptionalDependencyNotAvailable, _LazyModule, is_torch_available lowerCamelCase__ = {'''configuration_ibert''': ['''IBERT_PRETRAINED_CONFIG_ARCHIVE_MAP''', '''IBertConfig''', '''IBertOnnxConfig''']} try: if not is_torch_available(): raise ...
226
1
'''simple docstring''' from math import cos, sin, sqrt, tau from audio_filters.iir_filter import IIRFilter def __UpperCamelCase ( a : int , a : int , a : float = 1 / sqrt(2 ) ) ->IIRFilter: snake_case = tau * frequency / samplerate...
342
'''simple docstring''' import json import sys import tempfile import unittest from pathlib import Path import transformers from transformers import ( CONFIG_MAPPING, IMAGE_PROCESSOR_MAPPING, AutoConfig, AutoImageProcessor, CLIPConfig, CLIPImageProcessor, ...
342
1
"""simple docstring""" from typing import Optional, Union import numpy as np from ...image_processing_utils import BaseImageProcessor, BatchFeature from ...image_transforms import get_image_size, pad, rescale, to_channel_dimension_format from ...image_utils import ChannelDimension, ImageI...
317
"""simple docstring""" def UpperCamelCase_ ( lowerCAmelCase__ : list[int] , lowerCAmelCase__ : list[int] , lowerCAmelCase__ : int ) -> bool: """simple docstring""" return not any( neighbour == 1 and colored_vertic...
317
1
import os import tempfile import unittest from transformers import DistilBertConfig, is_torch_available from transformers.testing_utils import require_torch, require_torch_gpu, slow, torch_device from ...test_configuration_common import ConfigTester from ...test_modeling_common import ModelTesterMixin, ids_tensor, ...
17
import unittest from transformers import SqueezeBertConfig, is_torch_available from transformers.testing_utils import require_sentencepiece, require_tokenizers, require_torch, slow, torch_device from ...test_configuration_common import ConfigTester from ...test_modeling_common import ModelTesterMixin, ids_tens...
637
0
from collections import OrderedDict from typing import Mapping from packaging import version from ...configuration_utils import PretrainedConfig from ...onnx import OnnxConfig from ...utils import logging _lowercase = logging.get_logger(__name__) _lowercase = { '''facebook/d...
96
import inspect import unittest from transformers import MobileViTVaConfig from transformers.testing_utils import require_torch, require_torch_multi_gpu, require_vision, slow, torch_device from transformers.utils import cached_property, is_torch_available, is_vision_available from ...test_configuration_common impo...
96
1
import argparse import json from collections import OrderedDict from pathlib import Path import requests import torch from huggingface_hub import hf_hub_download from PIL import Image from transformers import ( ConditionalDetrConfig, ConditionalDetrForObjectDetection, ConditionalDetrForSegmentation, ...
37
import multiprocessing from typing import TYPE_CHECKING, Optional, Union from .. import Dataset, Features, config from ..formatting import query_table from ..packaged_modules.sql.sql import Sql from ..utils import logging from .abc import AbstractDatasetInputStream if TYPE_CHECKING: import sqlitea import...
37
1
"""simple docstring""" class _A : """simple docstring""" def __init__( self : Optional[Any] , A_ : Tuple , A_ : List[Any] , A_ : List[Any] ) -> Optional[int]: __snake_case = name __snak...
721
"""simple docstring""" import math import random from typing import Any from .hill_climbing import SearchProblem def SCREAMING_SNAKE_CASE ( snake_case, snake_case = True, snake_case = math.inf, snake_case = -math.inf, snake_case = math.inf, snake_case = -math...
93
0
import inspect import unittest from huggingface_hub import hf_hub_download from transformers import ASTConfig from transformers.testing_utils import require_torch, require_torchaudio, slow, torch_device from transformers.utils import cached_property, is_torch_available, is_torchaudio_available from ...test_con...
100
import contextlib from multiprocessing import Pool, RLock from tqdm.auto import tqdm from ..utils import experimental, logging _lowercase = logging.get_logger(__name__) class __A : UpperCamelCase :Union[str, Any] = None @experimental def _A (UpperCamelCase : Lis...
157
0
"""simple docstring""" from itertools import product from cva import COLOR_BGR2GRAY, cvtColor, imread, imshow, waitKey from numpy import dot, exp, mgrid, pi, ravel, square, uinta, zeros def _lowerCAmelCase ( lowerCamelCase__ : List[Any], lowerCamelCase__ : Any ...
295
"""simple docstring""" import argparse import shutil from pathlib import Path from tqdm import tqdm from transformers import AutoTokenizer def _lowerCAmelCase ( lowerCamelCase__ : Any, lowerCamelCase__ : Optional[Any], lowerCamelCase__ : List...
295
1
'''simple docstring''' from __future__ import annotations _a : Dict = list[tuple[int, int]] _a : str = [ [0, 0, 0, 0, 0, 0, 0], [0, 1, 0, 0, 0, 0, 0], # 0 are free path whereas 1's are obstacles [0, 0, 0, 0, 0, 0, 0], [0, 0, 1, 0, 0, 0, 0], [1, 0, 1, 0, 0,...
56
'''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 _a () -> Union[str...
56
1
from ..utils import DummyObject, requires_backends class UpperCAmelCase ( metaclass=UpperCAmelCase__ ): '''simple docstring''' lowerCAmelCase_ = ['''sentencepiece'''] def __init__( self : Tuple , *__lowercase : Opti...
139
import argparse import torch from transformers import BertConfig, BertForPreTraining, load_tf_weights_in_bert from transformers.utils import logging logging.set_verbosity_info() def lowerCamelCase__ ( _A , _A , _A ): '''simple docstring''' snake_c...
139
1
import copy import os from typing import TYPE_CHECKING, List, Union if TYPE_CHECKING: pass from ...configuration_utils import PretrainedConfig from ...utils import logging lowercase_ = logging.get_logger(__name__) lowercase_ = { """kakaobrain/align-base""": """https://huggingface.co/kakaobrain...
74
from __future__ import annotations from collections import deque from collections.abc import Iterator from dataclasses import dataclass @dataclass class lowerCAmelCase__ : '''simple docstring''' lowerCAmelCase_ = 42 lowerCAmelCase_ = 42 class ...
544
0
import os import posixpath import uuid from dataclasses import dataclass from typing import TYPE_CHECKING, Iterable, List, Optional, Tuple, Union import numpy as np import pyarrow as pa import datasets from datasets.arrow_writer import ArrowWriter, ParquetWriter from datasets.config import MAX_SHARD_SIZE ...
712
from __future__ import annotations from bisect import bisect_left from functools import total_ordering from heapq import merge @total_ordering class lowerCAmelCase__ ( SCREAMING_SNAKE_CASE_ ): '''simple docstring''' def __lt__( self : Optional[Any] , ...
234
0
from typing import TYPE_CHECKING from ...file_utils import _LazyModule, is_tokenizers_available, is_torch_available from ...utils import OptionalDependencyNotAvailable __UpperCamelCase : Tuple = {"""configuration_gpt_neox""": ["""GPT_NEOX_PRETRAINED_CONFIG_ARCHIVE_MAP""", """GPTNe...
328
import argparse import re from pathlib import Path import requests import torch from PIL import Image from torchvision.transforms import CenterCrop, Compose, Normalize, Resize, ToTensor from transformers import ( EfficientFormerConfig, EfficientFormerForImageClassificationWithTeacher,...
328
1
'''simple docstring''' import importlib.util import json import os import warnings from dataclasses import dataclass, field import torch from ..training_args import TrainingArguments from ..utils import cached_property, is_sagemaker_dp_enabled, logging a = logging.get_logger...
347
'''simple docstring''' import numpy as np def a_ ( __UpperCAmelCase , __UpperCAmelCase , __UpperCAmelCase , __UpperCAmelCase , __UpperCAmelCase ) -> Tuple: """simple docstring""" snake_case: ...
347
1
import unittest import numpy as np from transformers.file_utils import is_torch_available, is_vision_available from transformers.testing_utils import require_torch, require_vision from ...test_image_processing_common import ImageProcessingSavingTestMixin, prepare_image_inputs if is_torch_available(...
15
import inspect import unittest from typing import List import numpy as np from transformers import EfficientFormerConfig from transformers.testing_utils import require_tf, require_vision, slow from transformers.utils import cached_property, is_tf_available, is_vision_available from ...test_configuration_common impo...
276
0
import contextlib import copy import random from typing import Any, Dict, Iterable, Optional, Union import numpy as np import torch from .utils import deprecate, is_transformers_available if is_transformers_available(): import transformers def lowerCamelCase__ ( UpperCamelCase__ : ...
707
import unittest from accelerate import debug_launcher from accelerate.test_utils import require_cpu, test_ops, test_script @require_cpu class UpperCamelCase_ ( unittest.TestCase ): def lowerCAmelCase ( self ) -> List[Any]: debug_launcher(test_script.main ) def ...
541
0
"""simple docstring""" import os import sys import unittest lowercase_ = os.path.abspath(os.path.dirname(os.path.dirname(os.path.dirname(__file__)))) sys.path.append(os.path.join(git_repo_path, "utils")) import check_dummies # noqa: E402 from check_dummies import create_dummy_files, create_dum...
470
'''simple docstring''' import warnings from ...utils import logging from .image_processing_dpt import DPTImageProcessor lowerCAmelCase_ : Optional[int] = logging.get_logger(__name__) class __SCREAMING_SNAKE_CASE (lowerCamelCase_ ): """simple docstring""" ...
692
0
import json import os import unittest from transformers import OpenAIGPTTokenizer, OpenAIGPTTokenizerFast from transformers.models.openai.tokenization_openai import VOCAB_FILES_NAMES from transformers.testing_utils import require_ftfy, require_spacy, require_tokenizers from ...test_tokenization_common import To...
712
import inspect import unittest from transformers import MobileViTConfig from transformers.testing_utils import require_torch, require_vision, slow, torch_device from transformers.utils import cached_property, is_torch_available, is_vision_available from ...test_configuration_common import ConfigTester from ...t...
235
0
"""simple docstring""" def __A (_SCREAMING_SNAKE_CASE , _SCREAMING_SNAKE_CASE ) ->int: """simple docstring""" return number | (1 << position) def __A (_SCREAMING_SNAKE_CASE , _SCREAMING_SNAKE_CASE ) ->int: """simple docstring""" return number & ~(1 << position)...
93
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 lowerCamelCase__ = '''src/diffusers''' # Matches is_xxx_available() lowerCamelCase__ = re.compile(r''...
381
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_squeezebert import SqueezeBertTokenizer lowerCamelCase__ = logging.get_logger(__name__) lowerCamelCase__ =...
712
import torch import torch.nn as nn from transformers import CLIPConfig, CLIPVisionModel, PreTrainedModel from ...utils import logging lowerCamelCase__ = logging.get_logger(__name__) def __A(lowerCAmelCase , lowerCAmelCase ) -> List[str]: """simple docstring""" _UpperCamelCase ...
202
0
from __future__ import annotations import os from typing import Any import requests _lowerCamelCase : Any = '''https://api.github.com''' # https://docs.github.com/en/free-pro-team@latest/rest/reference/users#get-the-authenticated-user _lowerCamelCase : str = BASE_URL + ...
184
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_dimensio...
184
1
import argparse import shutil from pathlib import Path from tqdm import tqdm from transformers import AutoTokenizer def UpperCAmelCase ( _lowerCamelCase : List[str] , _lowerCamelCase : Optional[Any] , _lowerCamelCase : Dict , _lowerCamelCase : Any=1_024...
26
from __future__ import annotations from fractions import Fraction def UpperCAmelCase ( _lowerCamelCase : int , _lowerCamelCase : int ): '''simple docstring''' return ( num != den and num % 10 == den // 10 and (num // 10) / (den % 10) == num ...
26
1
from itertools import product from cva import COLOR_BGR2GRAY, cvtColor, imread, imshow, waitKey from numpy import dot, exp, mgrid, pi, ravel, square, uinta, zeros def snake_case_ ( lowerCAmelCase_ : Any , lowerCAmelCase_ : str ): __lowercase : Union[str, Any] ...
149
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 .tokenization_xlnet import ...
149
1
import argparse from pathlib import Path from transformers import AutoConfig, AutoTokenizer, RagConfig, RagSequenceForGeneration, RagTokenForGeneration def lowerCAmelCase_ ( __a , __a , __a , __a , __a = None , __a = None , __a = None , ) -> Any...
705
import unittest import numpy as np import torch from transformers import CLIPTextConfig, CLIPTextModel, CLIPTokenizer from diffusers import ( AutoencoderKL, DDIMScheduler, DPMSolverMultistepScheduler, TextToVideoSDPipeline, UNetaDConditionModel, ) from diffusers.utils import is_xformers_avai...
437
0
'''simple docstring''' import importlib import inspect import json import os import re import shutil import sys from pathlib import Path from typing import Dict, Optional, Union from urllib import request from huggingface_hub import HfFolder, cached_download, hf_hub_download, model_info...
8
'''simple docstring''' import argparse import torch from transformers import RemBertConfig, RemBertModel, load_tf_weights_in_rembert from transformers.utils import logging logging.set_verbosity_info() def __UpperCAmelCase ( SCREAMING_SNAKE_CASE__: Optional[Any], ...
448
0
import math def _lowerCamelCase ( A_ : int ) -> bool: '''simple docstring''' assert isinstance(SCREAMING_SNAKE_CASE_ , SCREAMING_SNAKE_CASE_ ) and ( number >= 0 ), "'number' must been an int and positive" if 1 < number < 4: # 2 and 3 are primes retu...
702
import warnings from ...processing_utils import ProcessorMixin from ...tokenization_utils_base import BatchEncoding class lowercase__( snake_case__ ): '''simple docstring''' snake_case__ = ['''image_processor''', '''tokenizer'''] snake_case__ = ''...
582
0
"""simple docstring""" from __future__ import annotations from collections.abc import Callable A_ : int =list[list[float | int]] def SCREAMING_SNAKE_CASE_ ( snake_case : Tuple , snake_case : Tuple )-> Matrix: _lowerCamelCase = len(_SCREAMING_SNAKE_CASE...
650
# flake8: noqa # Lint as: python3 from typing import Dict, List, Optional, Type from .. import config from ..utils import logging from .formatting import ( ArrowFormatter, CustomFormatter, Formatter, PandasFormatter, PythonFormatter, TensorFormatter, format_table, ...
311
0
'''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 YolosConfig, YolosForObjectDetection, YolosImageProcessor from transformers.utils import logging logging.set...
708
'''simple docstring''' def __snake_case (__UpperCAmelCase = 3 , __UpperCAmelCase = 7 , __UpperCAmelCase = 1000000 ): """simple docstring""" lowerCamelCase_ : Any = 0 lowerCamelCase_ : Tuple = 1 for current_denominator in range(1 , limit + ...
418
0
"""simple docstring""" from typing import TYPE_CHECKING from ...utils import ( OptionalDependencyNotAvailable, _LazyModule, is_flax_available, is_tf_available, is_tokenizers_available, is_torch_available, is_vision_available, ) lowerCamelCase__ : Union[st...
238
"""simple docstring""" from collections import OrderedDict from typing import Mapping from packaging import version from ...configuration_utils import PretrainedConfig from ...onnx import OnnxConfig from ...utils import logging lowerCamelCase__ : int = logging.get_logger(__name...
238
1
"""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 lowerCamelCase = False class lowerc...
700
"""simple docstring""" from collections import OrderedDict from typing import Mapping from ...configuration_utils import PretrainedConfig from ...onnx import OnnxConfig from ...utils import logging lowerCamelCase = logging.get_logger(__name__) lowerCamelCase = { """Yitu...
14
0