code
stringlengths
82
53.2k
code_codestyle
int64
0
721
style_context
stringlengths
91
41.9k
style_context_codestyle
int64
0
699
label
int64
0
1
'''simple docstring''' import json 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 UpperCamelCase : str = logging.ge...
50
import gc import random import unittest import numpy as np import torch from PIL import Image from transformers import CLIPTextConfig, CLIPTextModel, CLIPTokenizer from diffusers import ( AutoencoderKL, DDIMScheduler, EulerAncestralDiscreteScheduler, LMSDiscreteScheduler, PNDMScheduler, Sta...
696
0
from ...configuration_utils import PretrainedConfig from ...utils import logging A : List[str] = logging.get_logger(__name__) A : str = { 'weiweishi/roc-bert-base-zh': 'https://huggingface.co/weiweishi/roc-bert-base-zh/resolve/main/config.json', } ...
707
import unittest from transformers import DebertaVaConfig, 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_t...
473
0
"""simple docstring""" import random import unittest import torch from diffusers import IFInpaintingSuperResolutionPipeline from diffusers.utils import floats_tensor from diffusers.utils.import_utils import is_xformers_available from diffusers.utils.testing_utils import skip_mps, torch_device from ..pipeline_pa...
338
"""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 ( ...
238
0
def __magic_name__ ( SCREAMING_SNAKE_CASE , SCREAMING_SNAKE_CASE ) -> int: return abs(SCREAMING_SNAKE_CASE ) if a == 0 else greatest_common_divisor(b % a , SCREAMING_SNAKE_CASE ) def __magic_name__ ( SCREAMING_SNAKE_CASE , SCREAMING...
677
import unittest import numpy as np import timeout_decorator # noqa from transformers import BlenderbotSmallConfig, is_flax_available from transformers.testing_utils import require_flax, slow from ...generation.test_flax_utils import FlaxGenerationTesterMixin from ...test_modeling_flax_common import FlaxModel...
677
1
'''simple docstring''' from typing import TYPE_CHECKING from ...utils import ( OptionalDependencyNotAvailable, _LazyModule, is_sentencepiece_available, is_tokenizers_available, is_torch_available, is_vision_available, ) lowercase ={'processing_layoutxlm': ['LayoutXLMProcessor']} ...
446
import cva import numpy as np class snake_case : '''simple docstring''' def __init__( self : Any , lowerCAmelCase_ : float , lowerCAmelCase_ : int ) -> List[Any]: """simple docstring""" if k in (0.04, 0.06): SCREAMING_SN...
393
0
'''simple docstring''' import json import os from typing import Optional, Tuple from ...tokenization_utils import PreTrainedTokenizer from ...utils import logging __lowerCAmelCase = logging.get_logger(__name__) __lowerCAmelCase = {"""vocab_file""": """vocab.json"""} __lowerCAmelCase ...
319
'''simple docstring''' from ...utils import ( OptionalDependencyNotAvailable, is_flax_available, is_torch_available, is_transformers_available, ) try: if not (is_transformers_available() and is_torch_available()): raise OptionalDependencyNotAvailable() except OptionalDependencyNotAvailab...
319
1
from ...configuration_utils import PretrainedConfig from ...utils import logging from ...utils.backbone_utils import BackboneConfigMixin, get_aligned_output_features_output_indices lowerCamelCase_ = logging.get_logger(__name__) class __a ( __lowerCamelCase , __lowerCamelCase ): """simple d...
151
import numpy as np import skfuzzy as fuzz if __name__ == "__main__": # Create universe of discourse in Python using linspace () lowerCamelCase_ = np.linspace(start=0, stop=75, num=75, endpoint=True, retstep=False) # Create two fuzzy sets by defining any membership function # (trapmf(), gbel...
151
1
import gc import random import unittest import numpy as np import torch from PIL import Image from transformers import CLIPTextConfig, CLIPTextModel, CLIPTokenizer from diffusers import AutoencoderKL, PNDMScheduler, StableDiffusionInpaintPipeline, UNetaDConditionModel from diffusers.utils import floats_tensor, load_i...
316
import gc import random import unittest import numpy as np import torch from transformers import ( CLIPImageProcessor, CLIPTextConfig, CLIPTextModelWithProjection, CLIPTokenizer, CLIPVisionConfig, CLIPVisionModelWithProjection, ) from diffusers import ( DiffusionPipeline, UnCLIPImageVa...
316
1
"""simple docstring""" from typing import TYPE_CHECKING from ...utils import OptionalDependencyNotAvailable, _LazyModule, is_tf_available, is_torch_available _UpperCamelCase = { "configuration_data2vec_audio": ["DATA2VEC_AUDIO_PRETRAINED_CONFIG_ARCHIVE_MAP", "Data2VecAudioConfig"], "configuration_...
363
"""simple docstring""" from collections import defaultdict class __UpperCAmelCase : '''simple docstring''' def __init__( self , snake_case_ , snake_case_ ): '''simple docstring''' A__ : Tuple = total # total no of tasks...
363
1
'''simple docstring''' from __future__ import annotations def SCREAMING_SNAKE_CASE__ ( __A ) -> int: if not nums: return 0 _snake_case = nums[0] _snake_case = 0 for num in nums[1:]: _snake_case , _snake_case = ( max_excluding + num, max(__A , ...
542
'''simple docstring''' import unittest import numpy as np from transformers.testing_utils import require_torch, require_vision from transformers.utils import is_torch_available, is_vision_available from ...test_image_processing_common import ImageProcessingSavingTestMixin, prepare_image_inputs if is_torch_...
542
1
"""simple docstring""" 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 ) -> int: debug_...
76
"""simple docstring""" import warnings from contextlib import contextmanager from ...processing_utils import ProcessorMixin class a ( UpperCAmelCase__ ): UpperCamelCase : Any = 'Speech2TextFeatureExtractor' UpperCamelCase : Optional[Any] = 'S...
409
0
import importlib import json import os from collections import OrderedDict from typing import Dict, Optional, Union # Build the list of all image processors from ...configuration_utils import PretrainedConfig from ...dynamic_module_utils import get_class_from_dynamic_module, resolve_trust_remote_code from ...image_...
705
import copy import inspect import unittest from transformers import AutoBackbone from transformers.configuration_utils import PretrainedConfig from transformers.testing_utils import require_timm, require_torch, torch_device from transformers.utils.import_utils import is_torch_available from ...test_bac...
242
0
"""simple docstring""" import logging import os import sys import warnings from dataclasses import dataclass, field from random import randint from typing import Optional import datasets import evaluate import numpy as np from datasets import DatasetDict, load_dataset import transf...
449
"""simple docstring""" A = 8.31_4462 # Unit - J mol-1 K-1 def __SCREAMING_SNAKE_CASE ( lowerCamelCase_: float , lowerCamelCase_: float , lowerCamelCase_: float ): """simple docstring""" if moles < 0 or kelvin < 0 or volume < 0: ...
449
1
"""simple docstring""" from numpy import exp, pi, sqrt def UpperCAmelCase ( a_, a_ = 0.0, a_ = 1.0 ): '''simple docstring''' return 1 / sqrt(2 * pi * sigma**2 ) * exp(-((x - mu) ** 2) / (2 * sigma**2) ) if __name__ == "__main__": import doctest doctest.testm...
133
"""simple docstring""" import os import pytest from attr import dataclass _A = 'us-east-1' # defaults region @dataclass class _lowercase : lowercase_ = 42 lowercase_ = 'arn:aws:iam::558105141721:role/sagemaker_execution_role' lowercase_ = { 'task_name...
133
1
from __future__ import annotations def __SCREAMING_SNAKE_CASE ( UpperCamelCase__ , UpperCamelCase__ = None , UpperCamelCase__ = None , UpperCamelCase__ = False , ) -> tuple[int, float, str]: '''simple docstring''' UpperCAmelCase = ...
130
import gc import unittest import numpy as np import torch from diffusers import ( AudioDiffusionPipeline, AutoencoderKL, DDIMScheduler, DDPMScheduler, DiffusionPipeline, Mel, UNetaDConditionModel, UNetaDModel, ) from diffusers.utils import slow, torch_device from diffusers.utils....
130
1
from collections import OrderedDict from typing import Mapping from packaging import version from ...configuration_utils import PretrainedConfig from ...onnx import OnnxConfig from ...utils import logging from ..auto import CONFIG_MAPPING _snake_case : Tuple = logging.get_logger(__name__) _snake_...
203
import argparse import re import torch from CLAP import create_model from transformers import AutoFeatureExtractor, ClapConfig, ClapModel _snake_case : int = { "text_branch": "text_model", "audio_branch": "audio_model.audio_encoder", "attn": "attention.self", "self.proj": "output.d...
203
1
"""simple docstring""" from typing import TYPE_CHECKING from ...utils import ( OptionalDependencyNotAvailable, _LazyModule, is_flax_available, is_tf_available, is_torch_available, ) _lowerCAmelCase = {"""configuration_unispeech""": ["""UNISPEECH_PRETRAINED...
259
"""simple docstring""" from ....configuration_utils import PretrainedConfig from ....utils import logging _lowerCAmelCase = logging.get_logger(__name__) _lowerCAmelCase = { """Visual-Attention-Network/van-base""": ( """https://huggingface.co/Visual-Atten...
259
1
'''simple docstring''' import unittest from transformers import CamembertTokenizer, CamembertTokenizerFast from transformers.testing_utils import get_tests_dir, require_sentencepiece, require_tokenizers, slow from transformers.utils import is_torch_available from ...test_tokenization_common import Tokenizer...
719
'''simple docstring''' from __future__ import annotations import unittest from transformers import is_tf_available from transformers.testing_utils import require_sentencepiece, require_tf, require_tokenizers, slow from ...test_configuration_common import ConfigTester from ...test_modelin...
411
0
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 PoolFormerConfig, PoolFormerForImageClassification, PoolFormerImageProcessor from transforme...
43
'''simple docstring''' import os # All paths are set with the intent you should run this script from the root of the repo with the command # python utils/check_doctest_list.py UpperCAmelCase_ : List[Any] = '.' if __name__ == "__main__": UpperCAmelCase_ : Any = os.path.join(R...
533
0
from collections import OrderedDict from ...utils import logging from .auto_factory import _BaseAutoModelClass, _LazyAutoMapping, auto_class_update from .configuration_auto import CONFIG_MAPPING_NAMES __lowerCamelCase = logging.get_logger(__name__) __lowerCamelCase = OrderedDict( [ ...
719
import gc import unittest import numpy as np import torch from transformers import CLIPTextConfig, CLIPTextModel, XLMRobertaTokenizer from diffusers import AltDiffusionPipeline, AutoencoderKL, DDIMScheduler, PNDMScheduler, UNetaDConditionModel from diffusers.pipelines.alt_diffusion.modeling_roberta_series import ...
455
0
import pyarrow.parquet as pq import pytest from datasets import Audio, Dataset, DatasetDict, Features, NamedSplit, Sequence, Value, config from datasets.features.image import Image from datasets.io.parquet import ParquetDatasetReader, ParquetDatasetWriter, get_writer_batch_size from ..utils import assert_arrow_memor...
408
import gc import unittest import numpy as np import torch from transformers import CLIPTextConfig, CLIPTextModel, CLIPTokenizer from diffusers import ( AutoencoderKL, DDIMScheduler, StableDiffusionSAGPipeline, UNetaDConditionModel, ) from diffusers.utils import slow, torch_device from diffusers.utils...
408
1
"""simple docstring""" from typing import List, Optional, Union import torch from ...models import UNetaDConditionModel, VQModel from ...pipelines import DiffusionPipeline from ...pipelines.pipeline_utils import ImagePipelineOutput from ...schedulers import DDPMScheduler from ...utils import ( is_accelerate_ava...
715
"""simple docstring""" def lowerCamelCase_ ( __lowerCAmelCase , __lowerCAmelCase ) -> int: '''simple docstring''' return number | (1 << position) def lowerCamelCase_ ( __lowerCAmelCase , __lowerCAmelCase ) -> int: ...
132
0
import argparse import os import re # All paths are set with the intent you should run this script from the root of the repo with the command # python utils/check_dummies.py __snake_case = '''src/diffusers''' # Matches is_xxx_available() __snake_case = re.compile(r'''is\_(...
1
def _lowerCAmelCase ( __magic_name__ :list[list[int]] , __magic_name__ :int , __magic_name__ :int , __magic_name__ :set ): UpperCAmelCase_, UpperCAmelCase_ = len(__magic_name__ ), len(grid[0] ) if ( min(__magic_name__ , __ma...
121
0
import os import re import unicodedata from shutil import copyfile from typing import TYPE_CHECKING, Any, Dict, List, Optional, Tuple, Union import sentencepiece as spm from ...tokenization_utils import PreTrainedTokenizer from ...utils import is_torch_available, logging if is_torch_available(...
711
import unittest from transformers import is_torch_available from transformers.testing_utils import require_sentencepiece, require_tokenizers, require_torch, slow, torch_device if is_torch_available(): from transformers import AutoModelForSeqaSeqLM, AutoTokenizer @require_torch @require_sentencepiece @requ...
450
0
import copy import os from collections import OrderedDict from typing import TYPE_CHECKING, Any, Dict, Mapping, Optional, Union if TYPE_CHECKING: from ...processing_utils import ProcessorMixin from ...utils import TensorType from ...configuration_utils import PretrainedConfig from ...onnx import O...
305
from collections import OrderedDict from typing import Any, Mapping, Optional from ... import PreTrainedTokenizer from ...configuration_utils import PretrainedConfig from ...onnx import OnnxConfig, OnnxConfigWithPast, OnnxSeqaSeqConfigWithPast from ...onnx.utils import compute_effective_axis_dimension from ...u...
305
1
import argparse import json import subprocess def __UpperCamelCase (_SCREAMING_SNAKE_CASE , _SCREAMING_SNAKE_CASE ) -> Optional[int]: lowercase__ = [] lowercase__ = ( F"""curl -H \"Accept: application/vnd.github+json\" -H \"Authorization: B...
710
import numpy as np import torch import tqdm from ...models.unet_ad import UNetaDModel from ...pipelines import DiffusionPipeline from ...utils import randn_tensor from ...utils.dummy_pt_objects import DDPMScheduler class SCREAMING_SNAKE_CASE (UpperCAmelCase ): def __init__( ...
45
0
import json import os from typing import Dict, List, Optional, Tuple import regex as re from ...tokenization_utils import PreTrainedTokenizer from ...utils import logging lowerCamelCase : List[Any] = logging.get_logger(__name__) lowerCamelCase : Optional[int] = { "...
367
'''simple docstring''' import os def lowercase ( ): '''simple docstring''' UpperCAmelCase : Union[str, Any] = os.path.dirname(os.path.realpath(__magic_name__ ) ) UpperCAmelCase : Any = os.path.join(__magic_name__ , "triangle.txt" ) w...
679
0
import argparse import json import os import re import shutil import torch from transformers import BioGptConfig, BioGptForCausalLM from transformers.models.biogpt.tokenization_biogpt import VOCAB_FILES_NAMES from transformers.tokenization_utils_base import TOKENIZER_CONFIG_FILE from transformers.utils import W...
705
from typing import Optional, Tuple, Union import tensorflow as tf from ...activations_tf import ACTaFN from ...file_utils import add_code_sample_docstrings, add_start_docstrings, add_start_docstrings_to_model_forward from ...modeling_tf_outputs import ( TFBaseModelOutputWithNoAttention, TFBaseModelOutpu...
613
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 __a = logging.get_logger(__name__) __a = '''▁''' __a = {'''vocab_file''': '''sentencepiec...
319
"""simple docstring""" from __future__ import annotations import unittest from transformers import DebertaVaConfig, is_tf_available from transformers.testing_utils import require_tf, slow from ...test_configuration_common import ConfigTester from ...test_modeling_tf_common import TFModelTesterMixin, ids_tenso...
388
0
import qiskit def lowerCamelCase__ (_UpperCAmelCase , _UpperCAmelCase): SCREAMING_SNAKE_CASE = qiskit.Aer.get_backend('aer_simulator') # Create a Quantum Circuit acting on the q register SCREAMING_SNAKE_CASE = qiskit.QuantumCircuit(_UpperCAmelCase , _Upper...
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
import copy from collections import OrderedDict from typing import Dict, Mapping from packaging import version from ...configuration_utils import PretrainedConfig from ...onnx import OnnxConfig from ...utils import logging from ..auto import CONFIG_MAPPING _UpperCamelCase = logging.get_logger(__name__...
243
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 _snake_case ( _lowercase ): lowerCamelCase__: Op...
382
0
from math import loga def lowerCamelCase_ ( UpperCAmelCase_ : int ) -> int: '''simple docstring''' if a < 0: raise ValueError('Input value must be a positive integer' ) elif isinstance(UpperCAmelCase_ , UpperCAmelCase_ ): raise TypeError('Input value mu...
717
from ...configuration_utils import PretrainedConfig from ...utils import logging lowerCAmelCase__ = logging.get_logger(__name__) lowerCAmelCase__ = { """RWKV/rwkv-4-169m-pile""": """https://huggingface.co/RWKV/rwkv-4-169m-pile/resolve/main/config.json""", """RWKV/rwkv-4-430m-pile""": """htt...
648
0
def lowercase ( _lowerCAmelCase , _lowerCAmelCase ): while a != 0: UpperCAmelCase__ , UpperCAmelCase__ = b % a, a return b def lowercase ( _lowerCAmelCase , _lowerCAmelCase ): if gcd(UpperCamelCase_ , UpperCamelCase_ ) != 1: UpperCAmelCas...
392
import gc import unittest from diffusers import FlaxDPMSolverMultistepScheduler, FlaxStableDiffusionPipeline from diffusers.utils import is_flax_available, slow from diffusers.utils.testing_utils import require_flax if is_flax_available(): import jax import jax.numpy as jnp from flax.ja...
246
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 lowerCAmelCase : Tuple = datasets.logging.get_logger(__name__) lowerCAmelCase : Dict = '\\n@InProceedings{moosavi2...
353
# Copyright 2023 The HuggingFace Inc. team. All rights reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by ap...
353
1
"""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/li...
238
"""simple docstring""" from ...processing_utils import ProcessorMixin class _UpperCAmelCase ( __a): __a : Optional[Any] = """SpeechT5FeatureExtractor""" __a : Dict = """SpeechT5Tokenizer""" def __init__( self , _A , ...
238
1
"""simple docstring""" from torch import nn def lowercase ( __UpperCamelCase ) -> int: if act_fn in ["swish", "silu"]: return nn.SiLU() elif act_fn == "mish": return nn.Mish() elif act_fn == "gelu": return nn.GELU() else: raise ValueError(f'''Unsupported activation function: {...
190
"""simple docstring""" import os from tempfile import TemporaryDirectory from unittest import TestCase import pytest from absl.testing import parameterized from datasets import config from datasets.arrow_reader import HF_GCP_BASE_URL from datasets.builder import DatasetBuilder from datasets.dataset_dict impor...
190
1
"""simple docstring""" from __future__ import annotations from collections.abc import Generator def __lowerCamelCase ( ): """simple docstring""" _UpperCAmelCase = {} _UpperCAmelCase = 2 while True: _UpperCAmelCase = factor_map.pop(UpperCamelCase__ , UpperCamelCase__ ) i...
657
"""simple docstring""" 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 fro...
657
1
'''simple docstring''' from __future__ import annotations from typing import Any def _lowerCAmelCase ( _lowerCAmelCase )-> int: if not postfix_notation: return 0 __UpperCAmelCase = {'+', '-', '*', '/'} __UpperCAmelCase = [] for token in postfix_notation: if token ...
721
'''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: str = { """configuration_whisper""": ["""WHISPER_PRETRA...
617
0
from math import pi def UpperCamelCase__ ( UpperCAmelCase_ , UpperCAmelCase_ ) -> float: '''simple docstring''' return 2 * pi * radius * (angle / 360) if __name__ == "__main__": print(arc_length(90, 10))
322
from __future__ import annotations from typing import Any class UpperCAmelCase__ : '''simple docstring''' def __init__( self : Dict , UpperCamelCase : int = 6 ): """simple docstring""" _lowercase : Node | None ...
322
1
from __future__ import annotations from collections.abc import Callable from typing import Any, Generic, TypeVar snake_case_ = TypeVar('T') class SCREAMING_SNAKE_CASE__ ( Generic[T] ): def __init__(self : str , a__ : list[T] , a__ : Callable[...
388
import inspect import os import unittest from pathlib import Path import torch import accelerate from accelerate.test_utils import execute_subprocess_async from accelerate.test_utils.testing import run_command class SCREAMING_SNAKE_CASE__ ( unittest.TestCase ): A_ : L...
388
1
'''simple docstring''' import json import sys def lowerCAmelCase_ ( snake_case_ : Any , snake_case_ : Tuple ) -> List[str]: '''simple docstring''' with open(snake_case_ , encoding="utf-8" ) as f: UpperCAmelCase_ = json...
78
from argparse import ArgumentParser from ..pipelines import Pipeline, PipelineDataFormat, get_supported_tasks, pipeline from ..utils import logging from . import BaseTransformersCLICommand SCREAMING_SNAKE_CASE__ = logging.get_logger(__name__) # pylint: disable=invalid-name def lowercase ( a )...
631
0
"""simple docstring""" import inspect from typing import List, Optional, Tuple, Union import torch from ...models import UNetaDModel, VQModel from ...schedulers import DDIMScheduler from ...utils import randn_tensor from ..pipeline_utils import DiffusionPipeline, ImagePipelineOutput class ...
255
"""simple docstring""" UpperCAmelCase =256 # Modulus to hash a string UpperCAmelCase =1_000_003 def _A ( _a : str , _a : str ): """simple docstring""" A = len(_a ) A = len(_a ) if p...
255
1
'''simple docstring''' from typing import Optional import numpy as np import torch from torch import nn from transformers import GPTaConfig, GPTaLMHeadModel from transformers.modeling_utils import ModuleUtilsMixin from ...configuration_utils import ConfigMixin, register_to_config from ...models import ModelMixi...
13
class lowerCamelCase_ : '''simple docstring''' def __init__( self : str ): SCREAMING_SNAKE_CASE_ = {} def lowerCAmelCase_ ( self : List[str] ): print(self.vertex ) for i in self.vertex: print(_lowerCAmelCase , ...
31
0
'''simple docstring''' from typing import TYPE_CHECKING from ...utils import ( OptionalDependencyNotAvailable, _LazyModule, is_torch_available, ) __lowerCamelCase : str = { '''configuration_mega''': ['''MEGA_PRETRAINED_CONFIG_ARCHIVE_MAP''', '''Mega...
703
'''simple docstring''' import pickle import unittest import torch from accelerate import Accelerator from accelerate.state import AcceleratorState from accelerate.test_utils import require_cpu @require_cpu class A_ (unittest.TestCase ): """simple docstrin...
656
0
import json import os import re import unicodedata from json.encoder import INFINITY from typing import Any, Dict, List, Optional, Tuple, Union import numpy as np import regex from ...tokenization_utils import AddedToken, PreTrainedTokenizer from ...tokenization_utils_base import BatchEncoding from .....
16
from __future__ import annotations def lowercase ( __A : list ) -> float: '''simple docstring''' if not nums: raise ValueError("""List is empty""" ) return sum(__A ) / len(__A ) if __name__ == "__main__": import doctest doctest.testmod()
36
0
"""simple docstring""" from typing import TYPE_CHECKING from ...utils import OptionalDependencyNotAvailable, _LazyModule, is_torch_available, is_vision_available _lowerCamelCase = { 'configuration_pix2struct': [ 'PIX2STRUCT_PRETRAINED_CONFIG_ARCHIVE_MAP', 'Pix2StructConfig', ...
713
"""simple docstring""" import os import time import warnings from dataclasses import dataclass, field from enum import Enum from typing import List, Optional, Union import torch from filelock import FileLock from torch.utils.data import Dataset from ...tokenization_utils_base import PreTrainedTokenizerBase f...
112
0
"""simple docstring""" from typing import TYPE_CHECKING from ...utils import OptionalDependencyNotAvailable, _LazyModule, is_torch_available a_ = { 'configuration_clipseg': [ 'CLIPSEG_PRETRAINED_CONFIG_ARCHIVE_MAP', 'CLIPSegConfig', 'CLIPSegTextCon...
76
"""simple docstring""" import warnings from ...utils import logging from .image_processing_glpn import GLPNImageProcessor a_ = logging.get_logger(__name__) class UpperCAmelCase_ ( snake_case ): def __init__( self , *UpperCamelCase_ , **UpperCam...
76
1
import unittest from transformers import EsmConfig, is_torch_available from transformers.testing_utils import TestCasePlus, require_torch, slow, torch_device from ...test_configuration_common import ConfigTester from ...test_modeling_common import ModelTesterMixin, ids_tensor, random_attention_mask f...
714
import pytest import datasets # Import fixture modules as plugins UpperCAmelCase_ : Union[str, Any] = ["tests.fixtures.files", "tests.fixtures.hub", "tests.fixtures.fsspec"] def lowerCAmelCase_ ( lowerCamelCase , lowerCamelCase ): # Mark tests as "unit" by defa...
367
0
'''simple docstring''' from collections import OrderedDict from typing import Mapping from ...configuration_utils import PretrainedConfig from ...onnx import OnnxConfig from ...utils import logging A__: Union[str, Any] = logging.get_logger(__name__) A__: List[An...
694
'''simple docstring''' import argparse import numpy as np import torch from transformers import SpeechTaHifiGan, SpeechTaHifiGanConfig, logging logging.set_verbosity_info() A__: Union[str, Any] = logging.get_logger('''transformers.models.speecht5''') def SCR...
694
1
'''simple docstring''' from ...configuration_utils import PretrainedConfig from ...utils import logging snake_case : Optional[int] = logging.get_logger(__name__) snake_case : Optional[int] = {'ctrl': 'https://huggingface.co/ctrl/resolve/main/config.json'} class lowerCamelC...
339
'''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, _is_whitespace, ) from transfo...
339
1
import string # frequency taken from https://en.wikipedia.org/wiki/Letter_frequency A : Optional[int] = { 'E': 12.70, 'T': 9.06, 'A': 8.17, 'O': 7.51, 'I': 6.97, 'N': 6.75, 'S': 6.33, 'H': 6.09, 'R': 5.99, 'D': 4.25, 'L': 4.03, 'C': 2.78, 'U': 2.76, ...
219
def __lowerCAmelCase ( a__ , a__ ) -> None: __a = len(a__ ) print('''The following activities are selected:''' ) # The first activity is always selected __a = 0 print(a__ , end=''',''' ) # Consider rest of the activitie...
219
1
"""simple docstring""" from torch import nn def A_ ( __lowercase ): if act_fn in ["swish", "silu"]: return nn.SiLU() elif act_fn == "mish": return nn.Mish() elif act_fn == "gelu": return nn.GELU() else: raise ValueError(F'''Unsupported activation function: {act_fn}''' )
703
"""simple docstring""" def A_ ( __lowercase = 10 ): if not isinstance(__lowercase , __lowercase ) or n < 0: raise ValueError('Invalid input' ) UpperCamelCase_ : int =10**n UpperCamelCase_ : List[str] =2_84_33 * (pow(2 , 7_83_04_57 , __lowercase )) + 1 return st...
395
0
'''simple docstring''' def _UpperCamelCase ( SCREAMING_SNAKE_CASE__ : list , SCREAMING_SNAKE_CASE__ : int , SCREAMING_SNAKE_CASE__ : int = 0 , SCREAMING_SNAKE_CASE__ : int = 0 ): '''simple docstring''' UpperCAmelCase__ = ri...
603
'''simple docstring''' import torch from transformers import AutoModel class lowerCAmelCase_ ( torch.nn.Module ): '''simple docstring''' def __init__( self : Tuple , _UpperCAmelCase : List[str]="sayef/fsner-bert-base-uncased" ): """simple docstring"...
603
1
import argparse from typing import List import evaluate import numpy as np import torch from datasets import DatasetDict, load_dataset # New Code # # We'll be using StratifiedKFold for this example from sklearn.model_selection import StratifiedKFold from torch.optim import AdamW from torch.utils.data im...
409
def a ( snake_case__: int ): '''simple docstring''' if upper_limit < 0: raise ValueError('''Limit for the Catalan sequence must be ≥ 0''' ) lowercase_ = [0] * (upper_limit + 1) # Base case: C(0) = C(1) = 1 lowercase_ = 1 ...
409
1
"""simple docstring""" import logging import os from typing import List, TextIO, Union from conllu import parse_incr from utils_ner import InputExample, Split, TokenClassificationTask UpperCamelCase = logging.getLogger(__name__) class UpperCamelCase__ ( ...
104
"""simple docstring""" from __future__ import annotations def _lowerCAmelCase ( lowerCamelCase__ : list[list[int]] ) -> bool: _SCREAMING_SNAKE_CASE : int = len(lowerCamelCase__ ) # We need to create solution object to save path. _SCREAMING_SNAKE_CASE : Di...
572
0
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_neuroncore, ) from transforme...
297
import json import pathlib import unittest import numpy as np from transformers.testing_utils import require_torch, require_vision, slow from transformers.utils import is_torch_available, is_vision_available from ...test_image_processing_common import ImageProcessingSavingTestMixin, prepare_image_inputs if is_tor...
297
1
"""simple docstring""" from __future__ import annotations from scipy.special import comb # type: ignore class __A : def __init__( self : str , __snake_case : list[tuple[float, float]] ) -> List[Any]: __magic_name__: int ...
96
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 __UpperCAmelCase = logging.get_logger(__name__) __UpperCAmelCa...
600
0
'''simple docstring''' import baseaa def _SCREAMING_SNAKE_CASE ( A : str ) -> int: return baseaa.baaencode(string.encode('utf-8' ) ) def _SCREAMING_SNAKE_CASE ( A : List[Any] ) -> List[str]: return baseaa.baadecode(A ).d...
714
'''simple docstring''' import argparse import json from collections import OrderedDict from functools import partial from pathlib import Path import timm import torch from huggingface_hub import hf_hub_download from transformers import LevitConfig, LevitForImageClassificationWithT...
61
0
'''simple docstring''' import unittest from transformers import is_torch_available from transformers.testing_utils import require_sentencepiece, require_tokenizers, require_torch, slow if is_torch_available(): import torch from transformers import XLMRobertaModel @require_sentencepiece @require_tokenizers...
44
"""simple docstring""" import unittest from transformers import DonutProcessor a : Optional[int] = '''naver-clova-ix/donut-base''' class __UpperCamelCase ( unittest.TestCase ): def __a ( self ) -> Dict: a : O...
633
0
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...
531
# Lint as: python3 import sys from collections.abc import Mapping from typing import TYPE_CHECKING, Dict, Optional import numpy as np import pyarrow as pa from .. import config from ..utils.logging import get_logger from ..utils.py_utils import map_nested from .formatting import TensorFormatter if TYPE_CHECKING:...
531
1
def __magic_name__ ( __lowerCAmelCase : int ) -> int: if not isinstance(__lowerCAmelCase , __lowerCAmelCase ): raise ValueError('''multiplicative_persistence() only accepts integral values''' ) if num < 0: raise ValueError('''multiplicative_persistence() d...
298
import copy import os import cva import numpy as np from matplotlib import pyplot as plt class lowerCAmelCase__ : def __init__( self : Optional[int] ) -> Optional[int]: __lowerCamelCase = '''''' __lowerCamelCase = '''''' __lowerCamelCase ...
298
1
import argparse import json import os import time import zipfile from get_ci_error_statistics import download_artifact, get_artifacts_links from transformers import logging a : Optional[int] = logging.get_logger(__name__) def snake_case__ ( _SCREAMING_SNAKE_CASE , _SCREAMI...
701
"""simple docstring""" import importlib import torch import yaml from omegaconf import OmegaConf from taming.models.vqgan import VQModel def snake_case__ ( _SCREAMING_SNAKE_CASE , _SCREAMING_SNAKE_CASE=False ) ->str: UpperCAmelCase__ = OmegaConf.load(_SCREAMING_SNAKE_CASE ) ...
422
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...
89
'''simple docstring''' from math import ceil def A__ ( UpperCAmelCase_ = 1_0_0_1 ): _UpperCamelCase : int = 1 for i in range(1 , int(ceil(n / 2.0 ) ) ): _UpperCamelCase : Dict = 2 * i + 1 _UpperCamelCase : ...
195
0
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 VaeImageProcessor from diffusers.pipe...
708
import os def _lowerCAmelCase ( UpperCamelCase__: str = "matrix.txt" ) -> int: """simple docstring""" with open(os.path.join(os.path.dirname(UpperCamelCase__ ) , UpperCamelCase__ ) ) as in_file: A = in_file.read() A = [[int(UpperCa...
546
0
import random import torch from huggingface_hub import HfApi from diffusers import UNetaDModel A__: Optional[Any] = HfApi() A__: str = {} # fmt: off A__: Any = torch.tensor([ -0.7_515, -1.6_883, 0.2_420, 0.0_300, 0.6_347, 1.3_433, -1.1_743, -3.7_467, 1.2_342, -2.2_4...
380
import os from shutil import copyfile from typing import List, Optional, Tuple import sentencepiece as spm from ...tokenization_utils import PreTrainedTokenizer from ...utils import logging A__: Union[str, Any] = logging.get_logger(__name__) A__: int = {'''vocab_file''': '''senten...
380
1
def _a ( __lowercase = 1000 ) -> int: """simple docstring""" return sum(e for e in range(3 , __lowercase ) if e % 3 == 0 or e % 5 == 0 ) if __name__ == "__main__": print(F'''{solution() = }''')
701
import unittest import numpy as np import torch from diffusers import VersatileDiffusionImageVariationPipeline from diffusers.utils.testing_utils import load_image, require_torch_gpu, slow, torch_device _snake_case = False class lowerCAmelCase_ ( unittest.TestCase ): """simple docs...
567
0
"""simple docstring""" from ...configuration_utils import PretrainedConfig from ...utils import logging __UpperCAmelCase = logging.get_logger(__name__) __UpperCAmelCase = { '''google/fnet-base''': '''https://huggingface.co/google/fnet-base/resolve/main/config.json''', '''google/fnet...
642
"""simple docstring""" import argparse import pickle import numpy as np import torch from torch import nn from transformers import ReformerConfig, ReformerModelWithLMHead from transformers.utils import logging logging.set_verbosity_info() def lowercase__ ( lowerCAmelCase__ : Union[str...
642
1
'''simple docstring''' # Usage: # ./gen-card-allenai-wmt16.py import os from pathlib import Path def A__ ( A : Optional[int] , A : List[str] , A : int , A : Any): '''simple docstring''' UpperCamelCase : Union[str, Any] = ...
435
'''simple docstring''' from argparse import ArgumentParser, Namespace from ..utils import logging from . import BaseTransformersCLICommand def A__ ( A : Namespace): '''simple docstring''' return ConvertCommand( args.model_type , args.tf_checkpoint , args.pyto...
435
1
from __future__ import annotations import unittest from transformers import is_tf_available from transformers.testing_utils import require_tf, slow from ...test_configuration_common import ConfigTester from ...test_modeling_tf_common import TFModelTesterMixin, ids_tensor, random_attention_mask from ...test_...
666
from __future__ import annotations import unittest from transformers import is_tf_available from transformers.testing_utils import require_sentencepiece, require_tf, require_tokenizers, slow if is_tf_available(): import numpy as np import tensorflow as tf from transformers import TFXLMRo...
666
1
"""simple docstring""" import argparse from collections import OrderedDict from pathlib import Path import torch from transformers import ( VisualBertConfig, VisualBertForMultipleChoice, VisualBertForPreTraining, VisualBertForQuestionAnswering, VisualBertForVisualReasoning, ) from transformers...
310
"""simple docstring""" from typing import List, Optional, Union from ...configuration_utils import PretrainedConfig from ...utils import logging __a = logging.get_logger(__name__) __a = { "huggingface/time-series-transformer-tourism-monthly": ( "https://huggingface.co...
310
1
'''simple docstring''' import io import os import unicodedata from typing import Any, Dict, List, Optional, Tuple import sentencepiece as spm from ...tokenization_utils import PreTrainedTokenizer from ...utils import logging UpperCAmelCase_ : Tuple = logging.get_logger(__name__) UpperCAmelCase_ ...
365
def __snake_case ( _lowerCAmelCase : int ) -> bool: if num < 0: return False A_ : int = num A_ : int = 0 while num > 0: A_ : str = rev_num * 10 + (num % 10) num //= 10 return num_copy == r...
454
0
'''simple docstring''' import collections import inspect import unittest from typing import Dict, List, Tuple from transformers import MaskFormerSwinConfig from transformers.testing_utils import require_torch, require_torch_multi_gpu, torch_device from transformers.utils import is_torch_available from ...test...
709
'''simple docstring''' from typing import List, Union import numpy as np from ..tokenization_utils import TruncationStrategy from ..utils import add_end_docstrings, logging from .base import PIPELINE_INIT_ARGS, ArgumentHandler, ChunkPipeline a : List[str] = logging.get_logger(__name__)...
672
0
"""simple docstring""" import argparse import json import logging import os import shutil import sys import tempfile import unittest from unittest import mock import torch from accelerate.utils import write_basic_config from transformers.testing_utils import TestCasePlus, get_gpu_count, run_comm...
617
"""simple docstring""" from statistics import mean, stdev def _A ( _a : list , _a : int = 3 ): """simple docstring""" A = min(_a ) A = max(_a ) # normalize data return [round((x - x_min) / (x_max - x_min) ...
617
1
'''simple docstring''' def lowerCAmelCase_ ( a : str , a : str = " " ): a__ = [] a__ = 0 for index, char in enumerate(a ): if char == separator: split_words.append(string[last_index:index] ) ...
701
'''simple docstring''' import json import os from collections import Counter import torch import torchvision import torchvision.transforms as transforms from PIL import Image from torch import nn from torch.utils.data import Dataset __A : str = {1: (1, 1), 2: (2, 1), 3: (3, 1), 4: (2, 2), 5: (...
126
0
'''simple docstring''' from __future__ import annotations import os import tempfile import unittest from transformers import ConvBertConfig, is_tf_available from transformers.testing_utils import require_tf, slow from ...test_configuration_common import ConfigTester from ...test_modeli...
8
def __lowerCamelCase ( _lowercase = 50000000 ) -> int: UpperCamelCase = set() UpperCamelCase = int((limit - 24) ** (1 / 2) ) UpperCamelCase = set(range(3 , prime_square_limit + 1 , 2 ) ) primes.add(2 ) f...
282
0
'''simple docstring''' import time import unittest from transformers import is_torch_available from transformers.testing_utils import require_torch, torch_device from ..test_modeling_common import ids_tensor if is_torch_available(): import torch from transformers.generation import ( MaxLeng...
714
'''simple docstring''' 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.cs...
599
0
from typing import TYPE_CHECKING from ...utils import OptionalDependencyNotAvailable, _LazyModule, is_tokenizers_available, is_torch_available UpperCamelCase = { 'configuration_nezha': ['NEZHA_PRETRAINED_CONFIG_ARCHIVE_MAP', 'NezhaConfig'], } try: if not is_torch_available(): ...
590
from transformers import BertTokenizer, EncoderDecoderModel, SeqaSeqTrainer, SeqaSeqTrainingArguments from transformers.testing_utils import TestCasePlus, require_torch, slow from transformers.utils import is_datasets_available if is_datasets_available(): import datasets class _UpperCAmelCase ( A__...
183
0
def __snake_case ( _UpperCamelCase , _UpperCamelCase , _UpperCamelCase , _UpperCamelCase ) -> int: if height >= 1: move_tower(height - 1 , _UpperCamelCase , _UpperCamelCase , _UpperCamelCase ) move_disk(_UpperCamelCase , _UpperCamelCase ) mo...
346
import argparse import collections import os import re import tempfile import pandas as pd from datasets import Dataset from huggingface_hub import hf_hub_download, upload_folder from transformers.utils import direct_transformers_import # All paths are set with the intent you should run this script...
346
1
'''simple docstring''' import argparse import json import os import torch from torch import nn from transformers import NllbMoeConfig, NllbMoeModel from transformers.modeling_utils import dtype_byte_size from transformers.utils import WEIGHTS_INDEX_NAME, WEIGHTS_NAME def a__ ( lowerC...
75
import argparse import OmegaConf import torch from diffusers import DDIMScheduler, LDMPipeline, UNetLDMModel, VQModel def A ( _lowercase , _lowercase , _lowercase ): SCREAMING_SNAKE_CASE : List[Any] = OmegaConf.load(_lowercase ) SCREAMING_SNAKE_...
248
0
import string def a__ (__lowercase :str ) -> None: for key in range(len(string.ascii_uppercase ) ): _A : List[str] = '''''' for symbol in message: if symbol in string.ascii_uppercase: _A : int ...
332
import math from typing import Any, Callable, List, Optional, Tuple, Union import numpy as np import torch from ...models import TaFilmDecoder from ...schedulers import DDPMScheduler from ...utils import is_onnx_available, logging, randn_tensor if is_onnx_available(): from ..onnx_utils im...
332
1
"""simple docstring""" from ...configuration_utils import PretrainedConfig from ...utils import logging lowercase__ = logging.get_logger(__name__) lowercase__ = { "EleutherAI/gpt-neox-20b": "https://huggingface.co/EleutherAI/gpt-neox-20b/resolve/main/config.json", # See all GPT...
581
import copy from dataclasses import dataclass, field from typing import ClassVar, Dict from ..features import Audio, ClassLabel, Features from .base import TaskTemplate @dataclass(frozen=lowercase_) class snake_case__ ( lowercase_): '''simple docstring''' lowerCa...
455
0
"""simple docstring""" def snake_case ( lowerCAmelCase_ , lowerCAmelCase_ ) -> List[str]: # "extended trapezoidal rule" # int(f) = dx/2 * (f1 + 2f2 + ... + fn) _snake_case = (boundary[1] - boundary[0]) / steps _snake_case = boundary[0] _snake_case ...
404
"""simple docstring""" import os from shutil import copyfile from typing import List, Optional, Tuple from ...tokenization_utils import AddedToken from ...tokenization_utils_fast import PreTrainedTokenizerFast from ...utils import is_sentencepiece_available, logging if is_sentencepiece_...
404
1
"""simple docstring""" import numpy as np import skfuzzy as fuzz if __name__ == "__main__": # Create universe of discourse in Python using linspace () _A = np.linspace(start=0, stop=75, num=75, endpoint=True, retstep=False) # Create two fuzzy sets by defining any membership function # (trapmf...
182
"""simple docstring""" from .glue import glue_convert_examples_to_features, glue_output_modes, glue_processors, glue_tasks_num_labels from .squad import SquadExample, SquadFeatures, SquadVaProcessor, SquadVaProcessor, squad_convert_examples_to_features from .utils import DataProcessor, InputExample, InputFeatures, Si...
182
1
'''simple docstring''' from typing import TYPE_CHECKING from ...utils import ( OptionalDependencyNotAvailable, _LazyModule, is_tokenizers_available, is_torch_available, is_vision_available, ) __UpperCAmelCase = { """configuration_perceiver""": ["""PERCEIVER_PRETRAINED_CO...
79
'''simple docstring''' from collections import deque from math import floor from random import random from time import time class UpperCamelCase__ : """simple docstring""" def __init__( self : Optional[Any] ): '''simple docstring''' SCREAMING_SNAKE_CASE : ...
79
1
import contextlib import os import sqlitea import pytest from datasets import Dataset, Features, Value from datasets.io.sql import SqlDatasetReader, SqlDatasetWriter from ..utils import assert_arrow_memory_doesnt_increase, assert_arrow_memory_increases, require_sqlalchemy def lowerCamelCase_ (...
583
import pprint import requests snake_case__ = """https://zenquotes.io/api""" def lowerCamelCase_ ( ): return requests.get(API_ENDPOINT_URL + '''/today''' ).json() def lowerCamelCase_ ( ): return requests.get(API_ENDPOINT_URL + '''/random''' ).jso...
583
1
'''simple docstring''' import heapq as hq import math from collections.abc import Iterator class __A : def __init__( self , UpperCamelCase_ ): __UpperCAmelCase : int = str(id_ ) __UpperCAmelCase : ...
10
'''simple docstring''' import os from shutil import copyfile from typing import Any, Dict, List, Optional, Tuple import sentencepiece as spm from ...tokenization_utils import AddedToken, PreTrainedTokenizer from ...utils import logging _a : str = logging.get_logger(__name__) _a : ...
10
1
import os import tempfile import unittest from transformers import FlaubertConfig, is_torch_available from transformers.testing_utils import require_torch, require_torch_gpu, slow, torch_device from ...test_configuration_common import ConfigTester from ...test_modeling_common import ModelTesterMixin, id...
15
from manim import * class A_ ( UpperCAmelCase ): """simple docstring""" def __UpperCAmelCase ( self : str ) -> Union[str, Any]: _lowercase = Rectangle(height=0.5 ,width=0.5 ) _lower...
67
0
import unittest from transformers import is_torch_available from transformers.testing_utils import require_torch if is_torch_available(): import torch from transformers.activations import gelu_new, gelu_python, get_activation @require_torch class a_ ( unittest.TestCase ): ...
333
import argparse import json import numpy import torch from transformers.models.xlm.tokenization_xlm import VOCAB_FILES_NAMES from transformers.utils import CONFIG_NAME, WEIGHTS_NAME, logging logging.set_verbosity_info() def UpperCAmelCase_( a__ , a__ ): """simple docstring""" ...
333
1
"""simple docstring""" import time import warnings from abc import ABC from copy import deepcopy from typing import Optional import torch from ..utils import add_start_docstrings, logging _snake_case = logging.get_logger(__name__) _snake_case = R''' Args: inp...
580
"""simple docstring""" import itertools import os import random import tempfile import unittest import numpy as np from datasets import load_dataset from transformers import is_speech_available from transformers.testing_utils import check_json_file_has_correct_format, require_torch, require_torchau...
580
1
from typing import TYPE_CHECKING from ...utils import OptionalDependencyNotAvailable, _LazyModule, is_torch_available _UpperCamelCase : List[str] ={ "configuration_jukebox": [ "JUKEBOX_PRETRAINED_CONFIG_ARCHIVE_MAP", "JukeboxConfig", "JukeboxPriorConfig", "Jukebo...
711
'''simple docstring''' import gc import unittest from diffusers import FlaxControlNetModel, FlaxStableDiffusionControlNetPipeline from diffusers.utils import is_flax_available, load_image, slow from diffusers.utils.testing_utils import require_flax if is_flax_available(): import jax import jax.num...
575
0
'''simple docstring''' import argparse import dataclasses import json import logging import os import shutil from typing import List, Optional import datasets from accelerate import Accelerator from datasets import load_dataset from finetuning import finetune from tqdm.auto import tqdm import transfo...
3
'''simple docstring''' import random import unittest import numpy as np import torch from diffusers import ( DPMSolverMultistepScheduler, EulerAncestralDiscreteScheduler, EulerDiscreteScheduler, LMSDiscreteScheduler, OnnxStableDiffusionUpscalePipeline, PNDMScheduler, ) from diffusers...
329
0
"""simple docstring""" import argparse import os import evaluate import torch from datasets import load_dataset from torch.optim import AdamW from torch.utils.data import DataLoader from transformers import AutoModelForSequenceClassification, AutoTokenizer, get_linear_schedule_with_warmup, set_seed from acce...
150
"""simple docstring""" import csv import tweepy # Twitter API credentials lowercase = """""" lowercase = """""" lowercase = """""" lowercase = """""" def A__ ( _UpperCAmelCase : str ) -> None: '''simple docstring''' snake_case__ : Any = tweepy.OAuthH...
150
1
"""simple docstring""" import argparse import datetime def __lowerCAmelCase ( __UpperCamelCase : str ): '''simple docstring''' snake_case_ : Optional[Any] = { """0""": """Sunday""", """1""": """Monday""", ...
58
"""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/licen...
58
1
import copy import os from typing import Union from ...configuration_utils import PretrainedConfig from ...models.auto.modeling_auto import MODEL_FOR_CAUSAL_LM_MAPPING_NAMES from ...utils import logging from ..auto import CONFIG_MAPPING UpperCamelCase = logging.get_logger(__name__) UpperCamelCase =...
708
from ...configuration_utils import PretrainedConfig from ...utils import logging UpperCamelCase = logging.get_logger(__name__) UpperCamelCase = { '''EleutherAI/gpt-neox-20b''': '''https://huggingface.co/EleutherAI/gpt-neox-20b/resolve/main/config.json''', # See all GPTNeoX models at https:...
144
0
from sklearn.metrics import recall_score import datasets UpperCamelCase__ = ''' Recall is the fraction of the positive examples that were correctly labeled by the model as positive. It can be computed with the equation: Recall = TP / (TP + FN) Where TP is the true positives and FN is the false negativ...
268
from math import isqrt, loga def lowerCamelCase__ ( __A :int ): """simple docstring""" __snake_case = [True] * max_number for i in range(2 ,isqrt(max_number - 1 ) + 1 ): if is_prime[i]: for j in ran...
268
1
'''simple docstring''' from typing import TYPE_CHECKING from ...utils import OptionalDependencyNotAvailable, _LazyModule, is_torch_available, is_vision_available UpperCamelCase__ : int = { "configuration_poolformer": [ "POOLFORMER_PRETRAINED_CONFIG_ARCHIVE_MAP", "PoolForme...
0
'''simple docstring''' import os from shutil import copyfile from typing import Any, Dict, List, Optional, Tuple import sentencepiece as spm from ...tokenization_utils import PreTrainedTokenizer from ...utils import logging UpperCamelCase__ : List[Any] = logging.get_logger(__name__) UpperC...
0
1
"""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_vision...
77
"""simple docstring""" import numpy as np import pandas as pd from sklearn.preprocessing import MinMaxScaler from tensorflow.keras.layers import LSTM, Dense from tensorflow.keras.models import Sequential if __name__ == "__main__": A = pd.read_csv("""sample_data.csv""", header=None) A = ...
77
1
import argparse import json import os import fairseq import torch from torch import nn from transformers import ( SpeechaTextaConfig, SpeechaTextaForCausalLM, SpeechaTextaTokenizer, SpeechEncoderDecoderConfig, SpeechEncoderDecoderModel, WavaVecaConfig, WavaVecaFeatureExtractor, WavaV...
193
from collections.abc import Iterable from typing import Any class _UpperCamelCase : '''simple docstring''' def __init__( self : Tuple , a : int | None = None ) -> List[Any]: """simple docstring""" SCREAMING_SNAKE_CASE : Any = ...
193
1
from ...configuration_utils import PretrainedConfig from ...utils import logging a__ = logging.get_logger(__name__) a__ = {} class SCREAMING_SNAKE_CASE_ ( __a ): """simple docstring""" __magic_name__ : List[str] = """llama""" __mag...
279
'''simple docstring''' import unittest from transformers import AutoTokenizer, FalconConfig, is_torch_available from transformers.testing_utils import require_torch, slow, torch_device from ...generation.test_utils import GenerationTesterMixin from ...test_configuration_common import ConfigTester from ......
414
0
"""simple docstring""" def lowercase ( __snake_case : list[int] ): lowercase_ : List[str] = [] if len(__snake_case ) == 1: return [nums.copy()] for _ in range(len(__snake_case ) ): lowercase_ : Optional[int] = nums.po...
717
"""simple docstring""" import inspect import os import unittest import torch import accelerate from accelerate import Accelerator from accelerate.test_utils import execute_subprocess_async, require_multi_gpu from accelerate.utils import patch_environment class _UpperCAme...
141
0