code
stringlengths
86
54.5k
code_codestyle
int64
0
371
style_context
stringlengths
87
49.2k
style_context_codestyle
int64
0
349
label
int64
0
1
"""simple docstring""" import math class lowerCamelCase : '''simple docstring''' def lowerCAmelCase_ ( self: Tuple , snake_case: list[list[float]] , snake_case: list[int] ) -> int: snake_case_ :Any = 0.0 sn...
66
'''simple docstring''' from typing import TYPE_CHECKING from ...utils import OptionalDependencyNotAvailable, _LazyModule, is_torch_available __lowerCAmelCase = { '''configuration_lilt''': ['''LILT_PRETRAINED_CONFIG_ARCHIVE_MAP''', '''LiltConfig'''], } try: if not is_torch_available(): ...
89
0
"""simple docstring""" from typing import TYPE_CHECKING # rely on isort to merge the imports from ...utils import OptionalDependencyNotAvailable, _LazyModule, is_torch_available UpperCamelCase_ ={ """configuration_autoformer""": [ """AUTOFORMER_PRETRAINED_CONFIG_ARCHI...
128
"""simple docstring""" from ...processing_utils import ProcessorMixin class _a ( _lowerCAmelCase ): UpperCamelCase = ['''image_processor''', '''feature_extractor'''] UpperCamelCase = '''TvltImageProcessor''' UpperCamelCase = '''TvltFe...
128
1
from __future__ import annotations import unittest from transformers import is_tf_available from transformers.testing_utils import require_sentencepiece, require_tf, require_tokenizers, slow from ...test_configuration_common import ConfigTester from ...test_modeling_tf_common import TFModelTesterMixin, ids...
88
import argparse import datetime def lowerCAmelCase__( lowercase : str ) -> str: __snake_case : int = { "0": "Sunday", "1": "Monday", "2": "Tuesday", "3": "Wednesday", "4": "Thursday", "5": "Friday", "6": "Saturday", } __snake_...
326
0
'''simple docstring''' import asyncio import os import shutil import subprocess import sys import tempfile import unittest from distutils.util import strtobool from functools import partial from pathlib import Path from typing import List, Union from unittest import mock import torch from ..st...
9
'''simple docstring''' import argparse import datetime def __magic_name__( lowerCamelCase): __lowerCAmelCase = { '''0''': '''Sunday''', '''1''': '''Monday''', '''2''': '''Tuesday''', '''3''': '''Wednesday''', '''4''': '''Thur...
9
1
'''simple docstring''' import math import sys def UpperCamelCase_ ( _UpperCAmelCase : str ) -> str: """simple docstring""" _UpperCAmelCase : Any = "" try: with open(_UpperCAmelCase , "rb" ) as binary_file: ...
31
"""simple docstring""" import os from shutil import copyfile from typing import Any, Dict, List, Optional, Tuple import sentencepiece as spm from ...tokenization_utils import PreTrainedTokenizer from ...utils import logging lowerCAmelCase_ = logging.get_logger(__name__) ...
16
0
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, EulerAncestralDiscreteScheduler...
359
from ...configuration_utils import PretrainedConfig from ...utils import logging A : Dict = logging.get_logger(__name__) A : Dict = { '''google/pegasus-large''': '''https://huggingface.co/google/pegasus-large/resolve/main/config.json''', # See all PEGASUS models at https://h...
276
0
"""simple docstring""" 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, DDIMSche...
81
# Copyright 2022 The HuggingFace Team. All rights reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by ap...
137
0
"""simple docstring""" import argparse import intel_extension_for_pytorch as ipex import torch from diffusers import DPMSolverMultistepScheduler, StableDiffusionPipeline __UpperCamelCase = argparse.ArgumentParser('''Stable Diffusion script with intel optimization''', add_help=False) parser.add_argume...
367
"""simple docstring""" from collections import OrderedDict from typing import Mapping from packaging import version from ...configuration_utils import PretrainedConfig from ...onnx import OnnxConfig from ...utils import logging from ...utils.backbone_utils import BackboneConfigMixin, get_aligned_output_features_out...
312
0
from dataclasses import dataclass from enum import Enum from typing import List, Optional, Union import numpy as np import PIL from PIL import Image from ...utils import BaseOutput, is_torch_available, is_transformers_available @dataclass class _lowercase (a_ ): '''simple docstring''' ...
128
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 DDPMScheduler from ...utils...
128
1
# tests directory-specific settings - this file is run automatically # by pytest before any tests are run import doctest import sys import warnings from os.path import abspath, dirname, join import _pytest from transformers.testing_utils import HfDoctestModule, HfDocTestParser # allow having multiple reposi...
319
from typing import TYPE_CHECKING from ...utils import OptionalDependencyNotAvailable, _LazyModule, is_sentencepiece_available snake_case = {} try: if not is_sentencepiece_available(): raise OptionalDependencyNotAvailable() except OptionalDependencyNotAvailable: pass else: snake_c...
319
1
import asyncio import os import shutil import subprocess import sys import tempfile import unittest from distutils.util import strtobool from functools import partial from pathlib import Path from typing import List, Union from unittest import mock import torch from ..state import AcceleratorState, PartialState fr...
9
from typing import Optional from .. import Features, NamedSplit from ..packaged_modules.text.text import Text from ..utils.typing import NestedDataStructureLike, PathLike from .abc import AbstractDatasetReader class _lowercase ( A__ ): '''simple docstring''' def __init__( ...
9
1
'''simple docstring''' from argparse import ArgumentParser, Namespace from ..utils import logging from . import BaseTransformersCLICommand def SCREAMING_SNAKE_CASE_ ( __A : Namespace ) -> Dict: return ConvertCommand( args.model_type , args.tf_checkpoint , args.pytorch_dum...
357
'''simple docstring''' from typing import TYPE_CHECKING from ...utils import ( OptionalDependencyNotAvailable, _LazyModule, is_tokenizers_available, is_torch_available, is_vision_available, ) lowerCamelCase_ = { 'configuration_layoutlmv2': ['LAYOUTLMV2_PRETRAINED_CONFIG_ARCHIVE...
111
0
"""simple docstring""" import unittest from transformers import is_vision_available from transformers.pipelines import pipeline from transformers.testing_utils import ( is_pipeline_test, nested_simplify, require_tf, require_torch, require_vision, slow, ) from .test_pipelines_common ...
46
'''simple docstring''' # NOTE: This file is deprecated and will be removed in a future version. # It only exists so that temporarely `from diffusers.pipelines import DiffusionPipeline` works from ...utils import deprecate from ..controlnet.multicontrolnet import MultiControlNetModel # noqa: F40...
276
0
'''simple docstring''' import argparse import os import re import torch from flax.traverse_util import flatten_dict from tax import checkpoints from transformers import ( AutoTokenizer, PixaStructConfig, PixaStructForConditionalGeneration, PixaStructImageProcessor, ...
354
'''simple docstring''' import gc import importlib.metadata import tempfile import unittest from packaging import version from transformers import ( AutoModel, AutoModelForCausalLM, AutoModelForSeqaSeqLM, AutoModelForSequenceClassification, AutoTokenizer, BitsAnd...
164
0
from math import pi, sqrt, tan def _a ( SCREAMING_SNAKE_CASE : float ) -> int: """simple docstring""" if side_length < 0: raise ValueError('surface_area_cube() only accepts non-negative values' ) return 6 * side_length**2 def _a ( SCREAMING...
322
from unittest import TestCase from datasets import Dataset from minhash_deduplication import deduplicate_dataset, make_duplicate_clusters def __snake_case ( ): """simple docstring""" A_ = { "repo_name": ["test_repo1", "test_repo2", "test_repo3"], "...
312
0
import copy import unittest from transformers.models.auto import get_values from transformers.testing_utils import require_torch, slow, torch_device from transformers.utils import cached_property, is_torch_available, is_vision_available from ...test_configuration_common import ConfigTester from ...test_modeli...
206
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 PaddingStrategy, logging from ....
206
1
'''simple docstring''' # tests directory-specific settings - this file is run automatically # by pytest before any tests are run import doctest import sys import warnings from os.path import abspath, dirname, join import _pytest from transformers.testing_utils import HfDoctestModule, HfDocTe...
319
'''simple docstring''' def SCREAMING_SNAKE_CASE( __lowercase ) -> int: if not isinstance(__lowercase , __lowercase ): raise TypeError('''only integers accepted as input''' ) else: A: str = str(abs(__lowercase ) ...
319
1
from math import sqrt def lowercase_ ( _lowerCamelCase : int): lowercase__ : List[Any] = 0 for i in range(1 , int(sqrt(_lowerCamelCase) + 1)): if n % i == 0 and i != sqrt(_lowerCamelCase): total += i + n // i elif i == sqrt(_lowerCamelCa...
333
import os import re import shutil import sys import tempfile import unittest import black UpperCamelCase = 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_copies # noqa: E402 # This is...
333
1
'''simple docstring''' from __future__ import annotations def a_ ( lowerCamelCase : list[int] , lowerCamelCase : int ): lowerCAmelCase = 0 lowerCAmelCase = len(lowerCamelCase ) - 1 while i < j: if nums[i] + nums[j] == target: return...
4
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 __UpperCAmelCase : Any = "src/diffusers" # Matches is_xxx_available() __UpperCAmelCase : List[str] ...
111
0
from __future__ import annotations # This is the precision for this function which can be altered. # It is recommended for users to keep this number greater than or equal to 10. __lowerCAmelCase = 10 def snake_case_ ( snake_case , snake_case , snake_case ...
288
import os import tempfile import unittest from transformers import NezhaConfig, is_torch_available from transformers.models.auto import get_values from transformers.testing_utils import require_torch, require_torch_gpu, slow, torch_device from ...generation.test_utils import GenerationTesterMixin from ...
288
1
import warnings from ...processing_utils import ProcessorMixin from ...tokenization_utils_base import BatchEncoding class __UpperCAmelCase ( __UpperCAmelCase ): UpperCamelCase = ["""image_processor""", """tokenizer"""] UpperCamelCase = """ChineseCLIPImageProcessor...
336
'''simple docstring''' def _A ( lowercase__ ): lowercase__ = False while is_sorted is False: # Until all the indices are traversed keep looping lowercase__ = True for i in range(0 , len(lowercase__ ) - 1 , 2...
164
0
"""simple docstring""" import glob import os import random from string import ascii_lowercase, digits import cva import numpy as np # Parrameters __A = (7_20, 12_80) # Height, Width __A = (0.4, 0.6) # if height or width lower than this scale, drop it. __A = 1 / 1_00 __A ...
357
import json import os import unittest from transformers import CLIPTokenizer, CLIPTokenizerFast from transformers.models.clip.tokenization_clip import VOCAB_FILES_NAMES from transformers.testing_utils import require_ftfy, require_tokenizers from ...test_tokenization_common import TokenizerTesterMixin @require_to...
278
0
'''simple docstring''' def a ( lowerCamelCase__ ): '''simple docstring''' for i in range(len(lowerCamelCase__ ) - 1 , 0 , -1 ): A_ : str = False for j in range(lowerCamelCase__ , 0 , -1 ): if unsorted[j] < unsorted[...
206
'''simple docstring''' import multiprocessing import os from typing import BinaryIO, Optional, Union import fsspec from .. import Dataset, Features, NamedSplit, config from ..formatting import query_table from ..packaged_modules.json.json import Json from ..utils import logging from ..utils.typing import Nest...
206
1
import argparse import json import os import fairseq import torch from fairseq.data import Dictionary from transformers import ( WavaVecaConformerConfig, WavaVecaConformerForCTC, WavaVecaConformerForPreTraining, WavaVecaCTCTokenizer, WavaVecaFeatureExtractor, WavaVe...
245
import math import tensorflow as tf from packaging import version def A ( a_ ) -> Optional[Any]: __UpperCamelCase : Dict =tf.convert_to_tensor(a_ ) __UpperCamelCase : str =0.5 * (1.0 + tf.math.erf(x / tf.cast(tf.sqrt(2.0 ) ,x.dtype ) )) ...
245
1
from math import sqrt def __a ( SCREAMING_SNAKE_CASE ) -> int: '''simple docstring''' __UpperCAmelCase = 0 for i in range(1 , int(sqrt(SCREAMING_SNAKE_CASE ) + 1 ) ): if n % i == 0 and i != sqrt(SCREAMING_SNAKE_CASE ): ...
333
import tempfile import torch from diffusers import IPNDMScheduler from .test_schedulers import SchedulerCommonTest class A_ ( _a ): '''simple docstring''' a__ = (IPNDMScheduler,) a__ = (("num_inference_steps", 50),) def lower...
333
1
"""simple docstring""" from typing import TYPE_CHECKING from ...utils import OptionalDependencyNotAvailable, _LazyModule, is_torch_available, is_vision_available a__ : Optional[int] = { '''configuration_chinese_clip''': [ '''CHINESE_CLIP_PRETRAINED_CONFIG_ARCHIVE_MAP''',...
195
"""simple docstring""" import re import jax.numpy as jnp from flax.traverse_util import flatten_dict, unflatten_dict from jax.random import PRNGKey from ..utils import logging a__ : Union[str, Any] = logging.get_logger(__name__) def UpperCAmelCase__ (lowerCAmelCase_ ...
195
1
"""simple docstring""" 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 _UpperCA...
288
"""simple docstring""" import argparse import torch from transformers import BertForMaskedLM if __name__ == "__main__": UpperCAmelCase__ = argparse.ArgumentParser( description=( 'Extraction some layers of the full BertForMaskedLM or RObertaForMaskedLM for Transfer Learned'...
288
1
"""simple docstring""" from typing import Callable, Optional from .. import Features from ..packaged_modules.generator.generator import Generator from .abc import AbstractDatasetInputStream class __A (snake_case__): '''simple docstring''' def __init__( self : Optional[A...
233
"""simple docstring""" import copy import tempfile import unittest from transformers import MaMaaaConfig, is_torch_available from transformers.testing_utils import require_sentencepiece, require_tokenizers, require_torch, slow, torch_device from transformers.utils import cached_property from ...generation.test_uti...
233
1
'''simple docstring''' from collections import OrderedDict from typing import Any, Mapping, Optional, Union from ...configuration_utils import PretrainedConfig from ...feature_extraction_utils import FeatureExtractionMixin from ...onnx import OnnxConfig from ...onnx.utils import compute_effective_axis_dimens...
22
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 _A = logging.get_logger(__name__) _A = { '''google/vit-base-patch16-224''': '''https://hu...
278
0
def __lowerCamelCase ( lowerCamelCase__ ): """simple docstring""" return "".join(chr(ord(_a ) - 32 ) if "a" <= char <= "z" else char for char in word ) if __name__ == "__main__": from doctest import testmod testmod()
365
import json import os import subprocess import unittest from ast import literal_eval import pytest from parameterized import parameterized_class from . import is_sagemaker_available if is_sagemaker_available(): from sagemaker import Session, TrainingJobAnalytics from sagemaker.huggingface import Hugging...
121
0
import os from shutil import copyfile from typing import Any, Dict, List, Optional, Tuple import sentencepiece as spm from ...tokenization_utils import PreTrainedTokenizer from ...utils import logging UpperCAmelCase__ : Optional[int] = logging.get_logger(__name__) UpperCAmelCase__ ...
245
# Usage: # ./gen-card-facebook-wmt19.py import os from pathlib import Path def __lowercase ( _A , _A , _A ) -> int: SCREAMING_SNAKE_CASE : Optional[Any] = { """en""": """Machine learning is great, isn't it?""", """ru""": """Маши...
245
1
from math import pi def lowerCamelCase__ ( UpperCamelCase__ : int , UpperCamelCase__ : int ) -> float: '''simple docstring''' return 2 * pi * radius * (angle / 360) if __name__ == "__main__": print(arc_length(90, 10))
295
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 UpperCAmelCase_ = logging.get_logger(__name__) UpperCAmelCase_ = {"""voca...
295
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 import ...
195
import re import jax.numpy as jnp from flax.traverse_util import flatten_dict, unflatten_dict from jax.random import PRNGKey from ..utils import logging UpperCAmelCase = logging.get_logger(__name__) def UpperCAmelCase_ ( __SCREAMING_SNAKE_CASE ): lowercase = r'\w+[.]\d+' ...
195
1
import json import os import unittest from transformers.models.ctrl.tokenization_ctrl import VOCAB_FILES_NAMES, CTRLTokenizer from ...test_tokenization_common import TokenizerTesterMixin class a__ ( __lowercase , unittest.TestCase ): lowerCamelCase : Dict =CTRLTokenizer ...
350
'''simple docstring''' def __lowerCAmelCase ( UpperCamelCase__ , UpperCamelCase__ , UpperCamelCase__ ) -> float: if principal <= 0: raise Exception('''Principal borrowed must be > 0''' ) if rate_per_annum < 0: raise Exception('''Rate of interest must be >= 0''' ...
237
0
import math from typing import Callable, List, Optional, Union import numpy as np import PIL import torch from PIL import Image from transformers import CLIPTextModel, CLIPTokenizer from diffusers.models import AutoencoderKL, UNetaDConditionModel from diffusers.pipelines.stable_diffusion.pipeline_stable_diffus...
233
from ...configuration_utils import PretrainedConfig from ...utils import logging lowerCamelCase : Optional[Any] = logging.get_logger(__name__) lowerCamelCase : List[str] = { '''google/canine-s''': '''https://huggingface.co/google/canine-s/resolve/main/config.jso...
233
1
import math import unittest from transformers import BioGptConfig, 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 impor...
371
import argparse import json import os import fairseq import torch from fairseq.data import Dictionary from transformers import ( HubertConfig, HubertForCTC, HubertModel, WavaVecaCTCTokenizer, WavaVecaFeatureExtractor, WavaVecaProcessor, logging, ) logging.set_verbo...
15
0
'''simple docstring''' import re def __magic_name__ ( __UpperCAmelCase ) -> bool: '''simple docstring''' snake_case_ = re.compile( r'''^(?:0|94|\+94|0{2}94)''' r'''7(0|1|2|4|5|6|7|8)''' r'''(-| |)''' r'''\d{7}$''' ) return bool(re.search(__UpperCAmelCase, __U...
56
from __future__ import annotations class UpperCAmelCase : '''simple docstring''' def __init__( self : Optional[Any] , lowerCAmelCase_ : int ): """simple docstring""" _A: List[str] = data _A: Node | None = None _A: Node...
121
0
import importlib import inspect 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_config_docstrings.py a__: Tuple = 'src/transformers' # This is to make sure the transformers module imported i...
366
import functools import operator from ...configuration_utils import PretrainedConfig from ...utils import logging a__: List[Any] = logging.get_logger(__name__) a__: Optional[Any] = { 'microsoft/unispeech-large-1500h-cv': ( 'https://huggingface.co/microsoft/unispeec...
39
0
from __future__ import annotations from collections.abc import Iterator from typing import Any class A : def __init__(self , lowerCAmelCase ): __lowercase= data __lowercase= None class A : def __init__(self ): __lowercase= ...
295
import os import re import warnings from shutil import copyfile from typing import List, Optional, Tuple from ...tokenization_utils_fast import PreTrainedTokenizerFast from ...utils import is_sentencepiece_available, logging if is_sentencepiece_available(): from .tokenization_ta import TaTokenizer else: lowerCA...
295
1
"""simple docstring""" def a_ ( _lowercase ): if not isinstance(_lowercase , _lowercase ): raise TypeError('''Input value must be an \'int\' type''' ) _UpperCamelCase : Optional[Any] = 0 while number: p...
128
"""simple docstring""" def a_ ( _lowercase , _lowercase ): if discount_rate < 0: raise ValueError('''Discount rate cannot be negative''' ) if not cash_flows: raise ValueError('''Cash flows list cannot be empty''' ) _Upp...
128
1
"""simple docstring""" import collections.abc from typing import Optional, Tuple, Union import torch import torch.utils.checkpoint from torch import nn from torch.nn import BCEWithLogitsLoss, CrossEntropyLoss, MSELoss from ...activations import ACTaFN from ...modeling_outputs import Ba...
16
'''simple docstring''' import functools def UpperCamelCase ( _lowerCamelCase : str , _lowerCamelCase : str ): A__ = len(_lowerCamelCase ) A__ = len(_lowerCamelCase ) @functools.cache def min_distance(_lowerCamelCase :...
237
0
'''simple docstring''' from typing import TYPE_CHECKING from ...utils import OptionalDependencyNotAvailable, _LazyModule, is_sentencepiece_available _snake_case : List[str] = {} try: if not is_sentencepiece_available(): raise OptionalDependencyNotAvailable() ...
179
'''simple docstring''' import argparse import math import traceback import dateutil.parser as date_parser import requests def snake_case_ (UpperCamelCase : Dict ): '''simple docstring''' _a = {} _a = job['''started_at'''] ...
179
1
"""simple docstring""" import argparse import json import pickle from pathlib import Path import requests import torch from huggingface_hub import hf_hub_download from PIL import Image from transformers import MaskFormerConfig, MaskFormerForInstanceSegmentation, MaskFormerImageProcessor, SwinConfig from tra...
286
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'): SCREAMING_SNAKE_CASE :Any = { 'linear': PIL.Image.Resampling.BILINEAR, 'bilinear': PIL.Image.Resampl...
15
0
import functools import operator from ...configuration_utils import PretrainedConfig from ...utils import logging __A = logging.get_logger(__name__) __A = { "asapp/sew-d-tiny-100k": "https://huggingface.co/asapp/sew-d-tiny-100k/resolve/main/config.json", # See all SEW-D models...
348
import argparse import json import requests import torch from huggingface_hub import hf_hub_download from PIL import Image from torchvision import transforms from transformers import BitImageProcessor, FocalNetConfig, FocalNetForImageClassification from transformers.image_utils import IMAGENET_DEF...
348
1
from pathlib import Path from typing import List from transformers import is_torch_available, is_vision_available from transformers.testing_utils import get_tests_dir, is_tool_test from transformers.tools.agent_types import AGENT_TYPE_MAPPING, AgentAudio, AgentImage, AgentText if is_torch_available(): import ...
216
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 ViTConfig, ViTForImageClassification, ViTImageProcessor, ViTModel from transformers.utils import logging logging.set...
39
0
"""simple docstring""" from __future__ import annotations import copy import inspect import json import math import os import tempfile import unittest from importlib import import_module import numpy as np from transformers import ViTMAEConfig from transformers.file_utils import cached_propert...
77
"""simple docstring""" class lowerCamelCase__ : '''simple docstring''' def __init__( self ) -> Any: A = 0 A = 0 A = {} def UpperCamelCase__ ( self ,lowerCamelCase_ ) ...
77
1
import numpy as np import torch from imwatermark import WatermarkEncoder # Copied from https://github.com/Stability-AI/generative-models/blob/613af104c6b85184091d42d374fef420eddb356d/scripts/demo/streamlit_helpers.py#L66 UpperCAmelCase : int =0B101_100_111_110_110_010_010_000_011_110_111_0...
128
class _lowercase : '''simple docstring''' def __init__( self , snake_case__ ): '''simple docstring''' UpperCamelCase_ = arr.split("," ) def _lowerCamelCase ( self ): '''simple docstring''' UpperC...
128
1
from __future__ import annotations def _SCREAMING_SNAKE_CASE ( lowercase : str , lowercase : str ): '''simple docstring''' lowerCamelCase_ = get_failure_array(lowercase ) # 2) Step through text searching for pattern ...
208
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 if is_torch_available(): import torch if...
208
1
"""simple docstring""" from dataclasses import dataclass from enum import Enum from typing import List, Optional, Union import numpy as np import PIL from PIL import Image from ...utils import BaseOutput, is_torch_available, is_transformers_available @dataclass class __snake_case ( SCREAMING_SNA...
179
"""simple docstring""" import json import os from dataclasses import dataclass from functools import partial from typing import Callable import flax.linen as nn import jax import jax.numpy as jnp import joblib import optax import wandb from flax import jax_utils, struct, traverse_util from flax.serialization ...
179
1
"""simple docstring""" 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 PatchingS...
357
"""simple docstring""" 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, ...
253
0
import functools import operator from ...configuration_utils import PretrainedConfig from ...utils import logging __snake_case = logging.get_logger(__name__) __snake_case = { '''asapp/sew-d-tiny-100k''': '''https://huggingface.co/asapp/sew-d-tiny-100k/resolve/main/config.json''', # See all SEW...
348
__snake_case = '''Input must be a string of 8 numbers plus letter''' __snake_case = '''TRWAGMYFPDXBNJZSQVHLCKE''' def lowerCAmelCase_ ( __lowerCAmelCase )-> bool: '''simple docstring''' if not isinstance(__lowerCAmelCase , __lowerCAmelCase ): ...
348
1
"""simple docstring""" from string import ascii_lowercase, ascii_uppercase def lowercase_ ( _lowerCamelCase: str ) -> str: '''simple docstring''' if not sentence: return "" __lowerCamelCase : List[str] = dict(zip(_lowerCamelCase , _lower...
64
"""simple docstring""" from ...configuration_utils import PretrainedConfig from ...utils import logging __A = logging.get_logger(__name__) __A = { '''uclanlp/visualbert-vqa''': '''https://huggingface.co/uclanlp/visualbert-vqa/resolve/main/config.json''', '''uclanlp/visualbert-vqa-pre''': '''...
64
1
"""simple docstring""" from __future__ import annotations from random import random from typing import Generic, TypeVar _UpperCamelCase : Optional[int] = TypeVar("KT") _UpperCamelCase : Tuple = TypeVar("VT") class UpperCAmelCase_ ( Generic[KT, VT]): def __init__( ...
77
"""simple docstring""" from dataclasses import dataclass from typing import List, Optional, Union import numpy as np import PIL from PIL import Image from ...utils import ( BaseOutput, OptionalDependencyNotAvailable, is_flax_available, is_k_diffusion_available, is_k_diffusion_version, is_...
77
1
'''simple docstring''' import unittest from pathlib import Path from tempfile import TemporaryDirectory from transformers import AutoConfig, TFAutoModel, is_tensorflow_text_available, is_tf_available from transformers.models.bert.tokenization_bert import BertTokenizer from transformers.testi...
367
'''simple docstring''' import os from shutil import copyfile from typing import Any, Dict, List, Optional, Tuple import sentencepiece as spm from ...tokenization_utils import AddedToken, BatchEncoding, PreTrainedTokenizer from ...utils import logging __A =logging.get_logger(__name__) __A ...
283
0
'''simple docstring''' import unittest import numpy as np from transformers import AlbertConfig, is_flax_available from transformers.testing_utils import require_flax, slow from ...test_modeling_flax_common import FlaxModelTesterMixin, ids_tensor, random_attention_mask if is_flax_avail...
208
'''simple docstring''' _UpperCamelCase = tuple[float, float, float] _UpperCamelCase = tuple[float, float, float] def a_ ( _lowerCAmelCase ,_lowerCAmelCase ) -> Vectorad: __lowerCamelCase : Any = end_poin...
208
1
"""simple docstring""" def __SCREAMING_SNAKE_CASE ( ): """simple docstring""" A = [] A = 1 while len(lowercase__ ) < 1e6: constant.append(str(lowercase__ ) ) i += 1 A = "".join(lowercase__ ) return ( int(cons...
57
"""simple docstring""" import argparse import json import os import torch from transformers import LukeConfig, LukeModel, LukeTokenizer, RobertaTokenizer from transformers.tokenization_utils_base import AddedToken @torch.no_grad() def __SCREAMING_SNAKE_CASE ( lowercase__ , lowercase_...
57
1
"""simple docstring""" import csv from collections import defaultdict from dataclasses import dataclass, field from typing import List, Optional import matplotlib.pyplot as plt import numpy as np from matplotlib.ticker import ScalarFormatter from transformers import HfArgumentParser def ...
45
import json import multiprocessing import os import re from collections import defaultdict import torch from accelerate import Accelerator from accelerate.utils import set_seed from arguments import HumanEvalArguments from datasets import load_dataset, load_metric from torch.utils.data import IterableDataset from to...
253
0
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 BackboneTesterMixin ...
363
import gc import random import unittest import numpy as np import torch from PIL import Image from transformers import XLMRobertaTokenizerFast from diffusers import DDIMScheduler, KandinskyImgaImgPipeline, KandinskyPriorPipeline, UNetaDConditionModel, VQModel from diffusers.pipelines.kandinsky.text_en...
213
0
"""simple docstring""" def UpperCAmelCase__ (snake_case__ : str , snake_case__ : list[str] ): """simple docstring""" _snake_case : int = """""" for word_or_phrase in separated: if not isinstance(snake_case__ , snake_case__ ): ...
64
"""simple docstring""" import gzip import hashlib import json import multiprocessing import os import re import shutil import time from pathlib import Path import numpy as np from arguments import PreprocessingArguments from datasets import load_dataset from minhash_deduplication import ded...
64
1
"""simple docstring""" def lowercase__( __SCREAMING_SNAKE_CASE : list ): lowercase_ : Any = len(__SCREAMING_SNAKE_CASE ) for i in range(1 , __SCREAMING_SNAKE_CASE ): lowercase_ : Dict = collection[i] low...
360
"""simple docstring""" import os import sys import unittest __SCREAMING_SNAKE_CASE =os.path.abspath(os.path.dirname(os.path.dirname(os.path.dirname(__file__)))) sys.path.append(os.path.join(git_repo_path, "utils")) import get_test_info # noqa: E402 from get_test_info import ( # noqa: E402 get_mod...
321
0
"""simple docstring""" from __future__ import annotations _UpperCamelCase : int = 1_0 def _SCREAMING_SNAKE_CASE ( __snake_case : Optional[Any] ): '''simple docstring''' lowercase = 1 lowercase = max(SCREAMING_SNAKE_CASE_ ) while plac...
220
import argparse _snake_case = '''docs/source/_static/js/custom.js''' def lowercase_( SCREAMING_SNAKE_CASE_ ): '''simple docstring''' with open(SCREAMING_SNAKE_CASE_ , encoding="utf-8" , newline="\n" ) as f: lowerCamelCase : List[str] ...
283
0
import unittest from transformers.testing_utils import require_bsa from transformers.utils import is_bsa_available from ...test_feature_extraction_common import FeatureExtractionSavingTestMixin if is_bsa_available(): from transformers import MarkupLMFeatureExtractor class _UpperCAmelCase ( unit...
368
"""simple docstring""" from itertools import count def lowerCamelCase_ (UpperCamelCase__ : int = 50 ): _UpperCAmelCase : Tuple = [1] * min_block_length for n in count(UpperCamelCase__ ): fill_count_functions.append(1 ) for block_length in...
68
0
"""simple docstring""" from copy import deepcopy from typing import Optional, Union import numpy as np from ...processing_utils import ProcessorMixin from ...tokenization_utils_base import BatchEncoding from ...utils import TensorType, is_tf_available, is_torch_available if is_torch_available(): import torch ...
57
"""simple docstring""" from diffusers.utils.testing_utils import require_onnxruntime @require_onnxruntime class _UpperCamelCase : '''simple docstring''' pass
57
1
import tempfile import unittest import numpy as np from huggingface_hub import HfFolder, delete_repo from requests.exceptions import HTTPError from transformers import BertConfig, is_flax_available from transformers.testing_utils import TOKEN, USER, is_staging_test, require_flax if is_flax_available(): ...
351
import collections import json import os import re from typing import TYPE_CHECKING, List, Optional, Tuple import numpy as np from ...tokenization_utils_fast import PreTrainedTokenizer from ...utils import logging if TYPE_CHECKING: from transformers.pipelines.conversational import Conversation _UpperC...
232
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 timm import create_model from timm.data import resolve_data_config from timm.data.transforms_factory import create_transform from transformers import BitConfig, ...
345
"""simple docstring""" __SCREAMING_SNAKE_CASE =[ "DownloadConfig", "DownloadManager", "DownloadMode", "StreamingDownloadManager", ] from .download_config import DownloadConfig from .download_manager import DownloadManager, DownloadMode from .streaming_download_manager import StreamingDownloa...
213
0
import coval # From: git+https://github.com/ns-moosavi/coval.git # noqa: F401 from coval.conll import reader, util from coval.eval import evaluator import datasets __UpperCAmelCase = datasets.logging.get_logger(__name__) __UpperCAmelCase = "\\n@InProceedings{moosavi2019minimum,\n author = { Nafi...
366
import os import unittest from transformers.models.transfo_xl.tokenization_transfo_xl import VOCAB_FILES_NAMES, TransfoXLTokenizer from ...test_tokenization_common import TokenizerTesterMixin class UpperCamelCase__ ( __SCREAMING_SNAKE_CASE , unittest.TestCase ): """simple doc...
257
0
from functools import lru_cache def lowerCamelCase__ ( _a): SCREAMING_SNAKE_CASE : str = 2 SCREAMING_SNAKE_CASE : Optional[Any] = set() while i * i <= n: if n % i: i += 1 else: n //= i factors.add(_a) if n > 1: factors.add(_a) return factors @lru_cac...
76
'''simple docstring''' # Algorithm for the pigeonhole sorting def lowercase__ ( __UpperCamelCase )-> Union[str, Any]: UpperCamelCase = min(__UpperCamelCase ) # min() finds the minimum value UpperCamelCase = max(__UpperCamelCase ) # ...
321
0
"""simple docstring""" import mpmath # for roots of unity import numpy as np class lowerCamelCase__ : """simple docstring""" def __init__( self : Union[str, Any] , UpperCamelCase : List[str]=None , UpperCamelCase : int=None ): '''simple docstring''...
350
"""simple docstring""" from ...processing_utils import ProcessorMixin from ...tokenization_utils_base import BatchEncoding class lowerCamelCase__ ( A ): """simple docstring""" __a = ["""image_processor""", """tokenizer"""] __a = """AutoImageP...
320
0
"""simple docstring""" from __future__ import annotations import csv import requests from bsa import BeautifulSoup def _snake_case ( _snake_case : str = "" ): lowerCAmelCase : List[Any] = url or '''https://www.imdb.com/chart/top/?ref_=nv_mv_250''' lowerCAmelCase : Any = ...
60
from __future__ import annotations import unittest from transformers import BlenderbotSmallConfig, BlenderbotSmallTokenizer, is_tf_available from transformers.testing_utils import require_tf, require_tokenizers, slow from transformers.utils import cached_property from ...test_configuration_common import ConfigTest...
68
0
'''simple docstring''' import dataclasses import re import string from typing import Any, Dict, Iterator, List, Mapping, Optional, Sequence, Tuple import numpy as np from . import residue_constants a__ = Mapping[str, np.ndarray] a__ = Mapping[str, Any] # Is a...
365
'''simple docstring''' 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 a__ : List[Any] = ...
243
0
"""simple docstring""" import inspect from typing import Optional, Union import numpy as np import PIL import torch from torch.nn import functional as F from torchvision import transforms from transformers import CLIPFeatureExtractor, CLIPModel, CLIPTextModel, CLIPTokenizer from diffusers import ( Autoenco...
17
class lowerCamelCase__ : '''simple docstring''' def __init__( self :int ) -> Dict: __UpperCamelCase : Union[str, Any] = {} def _lowerCamelCase ( self :str ) -> None: print(self.vertex ) for i in self.vert...
232
0
from collections import OrderedDict from typing import Mapping from ...configuration_utils import PretrainedConfig from ...onnx import OnnxConfig from ...utils import logging _A = logging.get_logger(__name__) _A = { "roberta-base": "https://huggingface.co/roberta-base/resolve/main...
371
from ...configuration_utils import PretrainedConfig from ...utils import logging from ...utils.backbone_utils import BackboneConfigMixin, get_aligned_output_features_output_indices _A = logging.get_logger(__name__) _A = { '''shi-labs/dinat-mini-in1k-224''': '''https://huggingface.c...
167
0
"""simple docstring""" from __future__ import annotations def A_ ( _lowerCAmelCase : Optional[Any] ): """simple docstring""" _a = len(a__ ) # We need to create solution object to save path. _a = [[0 for _ in range(a__ )] for _ in range(a__ )] ...
320
from math import factorial def __lowercase ( a__ = 1_00 ) -> int: return sum(int(a__ ) for x in str(factorial(a__ ) ) ) if __name__ == "__main__": print(solution(int(input('''Enter the Number: ''').strip())))
257
0
import os import unittest from transformers import FunnelTokenizer, FunnelTokenizerFast from transformers.models.funnel.tokenization_funnel import VOCAB_FILES_NAMES from transformers.testing_utils import require_tokenizers from ...test_tokenization_common import TokenizerTesterMixin @require_tokenizers class __m...
364
import unittest import numpy as np from transformers.testing_utils import is_flaky, 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(): ...
51
0
from typing import TYPE_CHECKING # rely on isort to merge the imports from ...utils import OptionalDependencyNotAvailable, _LazyModule, is_torch_available, is_vision_available UpperCAmelCase__ = { "configuration_efficientnet": [ "EFFICIENTNET_PRETRAINED_CONFIG_ARCHIVE_MAP", "Efficient...
339
"""simple docstring""" import functools import operator from ...configuration_utils import PretrainedConfig from ...utils import logging __snake_case = logging.get_logger(__name__) __snake_case = { '''microsoft/unispeech-large-1500h-cv''': ( '''https://huggingface.co/microsoft/unisp...
320
0
"""simple docstring""" import argparse import struct import unittest class lowerCamelCase_: '''simple docstring''' def __init__( self , lowerCamelCase__ ): _lowerCamelCase = data # Initialize hash values _lowerCamelCase = [ ...
73
"""simple docstring""" import argparse from pathlib import Path import requests import torch from PIL import Image from transformers import ( RobertaTokenizer, TrOCRConfig, TrOCRForCausalLM, TrOCRProcessor, VisionEncoderDecoderModel, ViTConfig, ViTImageProcessor, ViTModel, ) from t...
73
1
import functools import gc import inspect import torch from .imports import is_npu_available, is_xpu_available def _UpperCamelCase ( *lowercase__ ): if not isinstance(lowercase__ , lowercase__ ): __SCREAMING_SNAKE_CASE : List[Any] = list(lowerc...
9
"""simple docstring""" import unittest from transformers import JukeboxTokenizer from transformers.testing_utils import require_torch class snake_case ( unittest.TestCase ): a_ : Any = JukeboxTokenizer a_ : Any = { """artist""": """Zac Brown Band""", ""...
243
0
"""simple docstring""" from PIL import Image def lowerCamelCase ( _UpperCamelCase : Image , _UpperCamelCase : float ) -> Image: '''simple docstring''' def brightness(_UpperCamelCase : int ) -> float: return 1_2_8 + level + (c - 1_2_8) ...
320
"""simple docstring""" import hashlib import unittest from typing import Dict import numpy as np from transformers import ( MODEL_FOR_MASK_GENERATION_MAPPING, TF_MODEL_FOR_MASK_GENERATION_MAPPING, is_vision_available, pipeline, ) from transformers.pipelines import MaskGenerationPipeline from ...
320
1
"""simple docstring""" import argparse import json from dataclasses import dataclass, field from functools import partial from pathlib import Path from typing import Callable, Dict, List, Tuple import timm import torch import torch.nn as nn from classy_vision.models.regnet import RegNet, RegNetParams, RegNetYaa...
17
"""simple docstring""" from typing import TYPE_CHECKING from ...utils import OptionalDependencyNotAvailable, _LazyModule, is_tokenizers_available, is_torch_available _lowerCamelCase : Any = { 'configuration_altclip': [ 'ALTCLIP_PRETRAINED_CONFIG_ARCHIVE_MAP', '...
167
0
'''simple docstring''' import logging import os from .state import PartialState class _UpperCAmelCase ( logging.LoggerAdapter ): """simple docstring""" @staticmethod def lowerCAmelCase ( __UpperCAmelCase : Dict ): '''simple docstring''' ...
353
'''simple docstring''' import gc import random import unittest import torch from diffusers import ( IFImgaImgPipeline, IFImgaImgSuperResolutionPipeline, IFInpaintingPipeline, IFInpaintingSuperResolutionPipeline, IFPipeline, IFSuperResolutionPipeline, ) from diffusers.models.attentio...
174
0
'''simple docstring''' import json import os import shutil import tempfile import unittest import numpy as np import pytest from transformers import CLIPTokenizer, CLIPTokenizerFast from transformers.models.clip.tokenization_clip import VOCAB_FILES_NAMES from transformers.testing_utils import require_visi...
34
# This model implementation is heavily inspired by https://github.com/haofanwang/ControlNet-for-Diffusers/ 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 dif...
51
0
import json import os import shutil import tempfile import unittest from transformers import BatchEncoding, CanineTokenizer from transformers.testing_utils import require_tokenizers, require_torch from transformers.tokenization_utils import AddedToken from transformers.utils import cached_property ...
152
import string def _lowerCAmelCase ( A__: str ): '''simple docstring''' for key in range(len(string.ascii_uppercase ) ): UpperCAmelCase = '''''' for symbol in message: if symbol in string.ascii_uppercase: Upper...
152
1
import argparse import json import os import fairseq import torch from fairseq.data import Dictionary from transformers import ( UniSpeechConfig, UniSpeechForCTC, UniSpeechForPreTraining, WavaVecaFeatureExtractor, WavaVecaPhonemeCTCTokenizer, WavaVecaProcessor, logging, ...
73
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 sagem...
73
1
"""simple docstring""" import copy from ...configuration_utils import PretrainedConfig from ...utils import logging from ..auto import CONFIG_MAPPING UpperCAmelCase = logging.get_logger(__name__) UpperCAmelCase = { """ut/deta""": """https://huggingface.co/ut/deta/resolve/main/config.json""", } ...
355
"""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 # #...
54
0
"""simple docstring""" from PIL import Image def A_ ( _lowerCAmelCase : Image, _lowerCAmelCase : float ): """simple docstring""" def brightness(_lowerCAmelCase : int ) -> float: return 1_28 + level + (c - 1_28) if not -2_5_5.0 <= level <= 2...
320
"""simple docstring""" from ...configuration_utils import PretrainedConfig from ...utils import logging __snake_case = logging.get_logger(__name__) __snake_case = { '''edbeeching/decision-transformer-gym-hopper-medium''': ( '''https://huggingface.co/edbeeching/decision-transformer-gy...
320
1
import math from typing import Optional import numpy as np from ...configuration_utils import PretrainedConfig from ...utils import logging SCREAMING_SNAKE_CASE__ : int = logging.get_logger(__name__) SCREAMING_SNAKE_CASE__ : Optional[Any] = { """facebook/en...
352
import datasets import faiss import numpy as np import streamlit as st import torch from elasticsearch import Elasticsearch from elia_utils import ( embed_questions_for_retrieval, make_qa_sas_model, qa_sas_generate, query_es_index, query_qa_dense_index, ) import transformers from transformers impo...
339
0
def _a ( ) -> Optional[int]: a = 0 for i in range(1 , 1_001 ): total += i**i return str(a )[-10:] if __name__ == "__main__": print(solution())
0
'''simple docstring''' from typing import TYPE_CHECKING from ...utils import OptionalDependencyNotAvailable, _LazyModule, is_tokenizers_available, is_torch_available _UpperCAmelCase : Dict = { """configuration_mvp""": ["""MVP_PRETRAINED_CONFIG_ARCHIVE_MAP""", """MvpConfig""", """Mvp...
174
0
import warnings from contextlib import contextmanager from ...processing_utils import ProcessorMixin class __magic_name__ ( lowerCAmelCase_ ): SCREAMING_SNAKE_CASE = 'Speech2TextFeatureExtractor' SCREAMING_SNAKE_CASE = 'Speech2TextTokenizer...
308
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 : List[str] = logging.get_logger(__name__) _lowerCAmelCase : ...
308
1
'''simple docstring''' from typing import TYPE_CHECKING from ...utils import ( OptionalDependencyNotAvailable, _LazyModule, is_flax_available, is_tf_available, is_tokenizers_available, is_torch_available, ) a_ = { 'configuration_whisper': ['WHISPER_PRET...
152
'''simple docstring''' from __future__ import annotations from collections.abc import Iterator class __SCREAMING_SNAKE_CASE : def __init__( self : Dict , __lowercase : int ) -> None: SCREAMING_SNAKE_CASE__ : List[Any] =...
152
1
from __future__ import annotations def SCREAMING_SNAKE_CASE ( lowercase_ , lowercase_ ) -> list[tuple[int, int]]: """simple docstring""" A__ , A__ = position A__ = [ (y + 1, x + 2), (y - 1, x + 2), (y + 1, x...
231
from typing import TYPE_CHECKING # rely on isort to merge the imports from ...utils import OptionalDependencyNotAvailable, _LazyModule, is_torch_available _lowerCamelCase : str = {"""configuration_focalnet""": ["""FOCALNET_PRETRAINED_CONFIG_ARCHIVE_MAP""", """FocalNetConfig"""]} try: if no...
231
1
"""simple docstring""" from typing import Dict from transformers import EvalPrediction, HfArgumentParser, TrainingArguments, is_torch_available from transformers.testing_utils import ( TestCasePlus, execute_subprocess_async, get_torch_dist_unique_port, require_torch_multi_gpu, require_torch_neuron...
256
"""simple docstring""" from jiwer import compute_measures import datasets a__ : Optional[int] = '''\ @inproceedings{inproceedings, author = {Morris, Andrew and Maier, Viktoria and Green, Phil}, year = {2004}, month = {01}, pages = {}, title = {From WER and RIL to MER a...
54
0
"""simple docstring""" from pathlib import Path import cva import numpy as np from matplotlib import pyplot as plt def _a ( _SCREAMING_SNAKE_CASE , _SCREAMING_SNAKE_CASE , _SCREAMING_SNAKE_CASE , _SCREAMING_SNAKE_CASE , _SCREAMING_SNAKE_CASE ) -> np.ndarray: snake_case_ =...
233
"""simple docstring""" import faiss # noqa: F401 # Here to have a nice missing dependency error message early on import numpy # noqa: F401 # Here to have a nice missing dependency error message early on import requests # noqa: F401 # Here to have a nice missing dependency error message early on import sklearn # ...
233
1
"""simple docstring""" import sacrebleu as scb from packaging import version from sacrebleu import TER import datasets SCREAMING_SNAKE_CASE__ = "\\n@inproceedings{snover-etal-2006-study,\n title = \"A Study of Translation Edit Rate with Targeted Human Annotation\",\n author = \"Snover, Matthew...
46
from ...configuration_utils import PretrainedConfig from ...utils import logging UpperCAmelCase__ = logging.get_logger(__name__) UpperCAmelCase__ = { "s-JoL/Open-Llama-V1": "https://huggingface.co/s-JoL/Open-Llama-V1/blob/main/config.json", } class __lowerCAmelCase ( A ): ...
339
0
from collections.abc import Iterator, MutableMapping from dataclasses import dataclass from typing import Generic, TypeVar lowercase : str = TypeVar("""KEY""") lowercase : str = TypeVar("""VAL""") @dataclass(frozen=__UpperCAmelCase , slots=__UpperCAmelCase ) class A__...
225
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, ) lowercase : List[str] = { """configuration_clip""": [ ...
225
1
import warnings from contextlib import contextmanager from ...processing_utils import ProcessorMixin class _A ( _lowerCamelCase ): _UpperCamelCase : List[str] = '''Speech2TextFeatureExtractor''' _UpperCamelCase : Optional[Any] = '''Speech2TextTokenizer''' ...
308
import importlib import sys from argparse import REMAINDER, ArgumentParser from pathlib import Path import torch_xla.distributed.xla_multiprocessing as xmp def snake_case( ) -> int: '''simple docstring''' lowercase : List[str] = ArgumentP...
308
1
"""simple docstring""" import os import time import pytest from datasets.utils.filelock import FileLock, Timeout def __lowerCamelCase ( __UpperCamelCase ) -> Optional[int]: """simple docstring""" lowerCAmelCase_ : Optional[Any] = FileLock(str(tmpdir / "foo.lock"...
161
"""simple docstring""" from packaging import version from .import_utils import is_accelerate_available if is_accelerate_available(): import accelerate def __lowerCamelCase ( __UpperCamelCase ) -> Any: """simple docstring""" if not is_accelerate_available(): return method ...
161
1
import math def lowerCamelCase__ ( ): """simple docstring""" lowerCAmelCase_ = input("Enter message: " ) lowerCAmelCase_ = int(input(F"""Enter key [2-{len(__lowerCAmelCase ) - 1}]: """ ) ) lowerCAmelCase_ = input("Encryption/Decryption [e/d]: " ) if mo...
231
from ..utils import DummyObject, requires_backends class _lowerCAmelCase ( metaclass=__a ): _lowercase =['''torch'''] def __init__( self , *_UpperCamelCase , **_UpperCamelCase ) -> Dict: requires_backends(self , ["torch"] ) @classmeth...
231
1
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 get_test_info # noqa: E402 from get_test_info import ( # noqa: E402 get_model_to_test_mapping, get_model_to_t...
359
from typing import TYPE_CHECKING from ...utils import ( OptionalDependencyNotAvailable, _LazyModule, is_flax_available, is_tf_available, is_tokenizers_available, is_torch_available, ) lowercase_ = { "configuration_blenderbot_small": [ "BLENDERBOT_SMALL_PRETRAINED_CONFIG_...
20
0
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, BertEmbeddings, BertL...
233
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 import logging logging.set_verbosity_inf...
233
1
import logging import os from dataclasses import dataclass, field from functools import partial from pathlib import Path from tempfile import TemporaryDirectory from typing import List, Optional import faiss import torch from datasets import Features, Sequence, Value, load_dataset from transformers impo...
358
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 A__ ( __magic_name__ ): lowercase ...
307
0