code
stringlengths
81
54k
code_codestyle
int64
0
721
style_context
stringlengths
91
41.9k
style_context_codestyle
int64
0
699
label
int64
0
1
import argparse from copy import deepcopy import numpy as np from datasets import ClassLabel, DatasetDict, load_dataset from evaluate import load from transformers import ( AutoModelForSequenceClassification, AutoTokenizer, DataCollatorWithPadding, Trainer, TrainerCallback, TrainingArgum...
678
import re def _SCREAMING_SNAKE_CASE ( snake_case_ : str ): __magic_name__ = 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(snake_case_ , snake_case_ ) ) if __name__ == "__main__": a_ : ...
678
1
def _SCREAMING_SNAKE_CASE ( snake_case_ : int , snake_case_ : int , snake_case_ : int ): if exponent == 1: return base if exponent % 2 == 0: __magic_name__ = _modexpt(snake_case_ , exponent // 2 , snake_case_ ) % modulo_value return (x...
678
import os import sys import unittest a_ : int = os.path.abspath(os.path.dirname(os.path.dirname(os.path.dirname(__file__)))) sys.path.append(os.path.join(git_repo_path, 'utils')) import check_dummies # noqa: E402 from check_dummies import create_dummy_files, create_dummy_object, find_backen...
678
1
def _SCREAMING_SNAKE_CASE ( snake_case_ : str ): return " ".join( ''''''.join(word[::-1] ) if len(snake_case_ ) > 4 else word for word in sentence.split() ) if __name__ == "__main__": import doctest doctest.testmod() print(reverse_long_words('Hey wollef sroirraw'))
678
def _SCREAMING_SNAKE_CASE ( snake_case_ : list[list[int]] , snake_case_ : int , snake_case_ : int , snake_case_ : set ): __magic_name__ , __magic_name__ = len(snake_case_ ), len(grid[0] ) if ( min(snake_case_ , snake_case_ ) < 0 or row == row...
678
1
from ...configuration_utils import PretrainedConfig from ...utils import logging a_ : List[str] = logging.get_logger(__name__) a_ : Union[str, Any] = { 'RWKV/rwkv-4-169m-pile': 'https://huggingface.co/RWKV/rwkv-4-169m-pile/resolve/main/config.json', 'RWKV/rwkv-4-43...
678
a_ : Dict = { 'meter': 'm', 'kilometer': 'km', 'megametre': 'Mm', 'gigametre': 'Gm', 'terametre': 'Tm', 'petametre': 'Pm', 'exametre': 'Em', 'zettametre': 'Zm', 'yottametre': 'Ym', } # Exponent of the factor(meter) a_ : str = { 'm': 0, ...
678
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 a_ : Optional[int] = logging.get_logger(__name__) a_ : Optional[int] ...
678
from typing import TYPE_CHECKING from ...utils import OptionalDependencyNotAvailable, _LazyModule, is_flax_available, is_torch_available a_ : Union[str, Any] = { 'configuration_longt5': ['LONGT5_PRETRAINED_CONFIG_ARCHIVE_MAP', 'LongT5Config', 'LongT5OnnxConfig'], } try: if not is_to...
678
1
from ...utils import ( OptionalDependencyNotAvailable, is_torch_available, is_transformers_available, is_transformers_version, ) try: if not (is_transformers_available() and is_torch_available() and is_transformers_version('>=', '4.25.0')): raise OptionalDependencyNotAvailable() exce...
678
import unittest from transformers import is_torch_available from transformers.testing_utils import require_torch, slow, torch_device from ...generation.test_utils import GenerationTesterMixin from ...test_configuration_common import ConfigTester from ...test_modeling_common import ModelTesterMixin, ids_tensor f...
678
1
from __future__ import annotations class SCREAMING_SNAKE_CASE_ : """simple docstring""" def __init__( self , A ) -> None: '''simple docstring''' __magic_name__ = data __magic_name__ = None __magic_name__ = None de...
678
def _SCREAMING_SNAKE_CASE ( ): __magic_name__ = [] __magic_name__ = 1 while len(snake_case_ ) < 1E6: constant.append(str(snake_case_ ) ) i += 1 __magic_name__ = ''''''.join(snake_case_ ) return ( int(constant[0] ) * int...
678
1
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 impor...
678
import copy import fnmatch import json import os import pickle as pkl import shutil import sys import tarfile import tempfile from collections import OrderedDict from contextlib import contextmanager from functools import partial from hashlib import shaaaa from io import BytesIO from pathlib import Path from urll...
678
1
import pytest a_ : Dict = '__dummy_dataset1__' a_ : Union[str, Any] = '\nimport json\nimport os\n\nimport datasets\n\n\nREPO_URL = "https://huggingface.co/datasets/albertvillanova/tests-raw-jsonl/resolve/main/"\nURLS = {"train": REPO_URL + "wikiann-bn-train.jsonl", "valida...
678
import argparse import json 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 accelerate import ...
678
1
import os from datetime import datetime as dt from github import Github a_ : Optional[Any] = [ 'good first issue', 'good second issue', 'good difficult issue', 'enhancement', 'new pipeline/model', 'new scheduler', 'wip', ] def _SCREAMING_SNAKE_CASE ( )...
678
def _SCREAMING_SNAKE_CASE ( snake_case_ : str ): return " ".join( ''''''.join(word[::-1] ) if len(snake_case_ ) > 4 else word for word in sentence.split() ) if __name__ == "__main__": import doctest doctest.testmod() print(reverse_long_words('Hey wollef sroirraw'))
678
1
import os import zipfile import requests from get_ci_error_statistics import download_artifact, get_artifacts_links def _SCREAMING_SNAKE_CASE ( snake_case_ : Optional[int] , snake_case_ : str=7 ): __magic_name__ = None if token is not None: __magic_name__ = {'...
678
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 # noqa: F401 # Here to...
678
1
import argparse a_ : Optional[Any] = 'docs/source/_static/js/custom.js' def _SCREAMING_SNAKE_CASE ( snake_case_ : Optional[Any] ): with open(snake_case_ , encoding='''utf-8''' , newline='''\n''' ) as f: __magic_name__ = f.readlines() __magic_n...
678
from __future__ import annotations import typing from collections.abc import Iterable import numpy as np a_ : Tuple = typing.Union[Iterable[float], Iterable[int], np.ndarray] # noqa: UP007 a_ : List[str] = typing.Union[np.floataa, int, float] # noqa: UP007 def _...
678
1
import argparse import torch from transformers import ( UniSpeechSatConfig, UniSpeechSatForAudioFrameClassification, UniSpeechSatForSequenceClassification, UniSpeechSatForXVector, WavaVecaFeatureExtractor, logging, ) logging.set_verbosity_info() a_ : str = logging.ge...
678
import argparse import json import os from pathlib import Path import requests import torch from transformers import JukeboxConfig, JukeboxModel from transformers.utils import logging logging.set_verbosity_info() a_ : str = logging.get_logger(__name__) a_ : Union[str, Any] ...
678
1
import math import sys def _SCREAMING_SNAKE_CASE ( snake_case_ : str ): __magic_name__ = '''''' try: with open(snake_case_ , '''rb''' ) as binary_file: __magic_name__ = binary_file.read() for dat in data: __magic_name__ ...
678
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 a_ : int = logging.get_logger(__name__) a_ : ...
678
1
import copy import os from typing import Union from ...configuration_utils import PretrainedConfig from ...utils import logging a_ : int = logging.get_logger(__name__) a_ : str = { 'Salesforce/blip-vqa-base': 'https://huggingface.co/Salesforce/blip-vqa-base/resolve/ma...
678
import argparse import torch from transformers import LxmertConfig, LxmertForPreTraining, load_tf_weights_in_lxmert from transformers.utils import logging logging.set_verbosity_info() def _SCREAMING_SNAKE_CASE ( snake_case_ : str , snake_case_ : Optional[int] , snake_case_ : Union[str...
678
1
import numpy as np from PIL import Image def _SCREAMING_SNAKE_CASE ( snake_case_ : np.ndarray , snake_case_ : int , snake_case_ : int ): __magic_name__ = np.array(snake_case_ ) if arr.shape[0] != arr.shape[1]: raise ValueError('''The input array is not a square ...
678
# Usage: # ./gen-card-allenai-wmt16.py import os from pathlib import Path def _SCREAMING_SNAKE_CASE ( snake_case_ : Tuple , snake_case_ : Union[str, Any] , snake_case_ : List[str] , snake_case_ : Union[str, Any] ): __magic_name__ = { '''en''': '''Machine learni...
678
1
from typing import TYPE_CHECKING from ...utils import OptionalDependencyNotAvailable, _LazyModule, is_torch_available a_ : Optional[Any] = { 'configuration_luke': ['LUKE_PRETRAINED_CONFIG_ARCHIVE_MAP', 'LukeConfig'], 'tokenization_luke': ['LukeTokenizer'], } try: if not is_torch...
678
def _SCREAMING_SNAKE_CASE ( snake_case_ : list[int] , snake_case_ : list[int] ): __magic_name__ = len(snake_case_ ) print('''The following activities are selected:''' ) # The first activity is always selected __magic_name__ = 0 print(snake_case_ , end=''...
678
1
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_diffusi...
678
import math from typing import Any, Callable, List, Optional, Tuple, Union import numpy as np import torch from ...models import TaFilmDecoder from ...schedulers import DDPMScheduler from ...utils import is_onnx_available, logging, randn_tensor if is_onnx_available(): from ..onnx_utils import OnnxRuntimeM...
678
1
from random import shuffle import tensorflow as tf from numpy import array def _SCREAMING_SNAKE_CASE ( snake_case_ : List[Any] , snake_case_ : str ): __magic_name__ = int(snake_case_ ) assert noofclusters < len(snake_case_ ) # Find out the dimensionality __magic_nam...
678
from ...utils import ( OptionalDependencyNotAvailable, is_torch_available, is_transformers_available, is_transformers_version, ) try: if not (is_transformers_available() and is_torch_available() and is_transformers_version('>=', '4.25.0')): raise OptionalDependencyNotAvailable() exce...
678
1
def _SCREAMING_SNAKE_CASE ( snake_case_ : str , snake_case_ : int ): __magic_name__ = word.split() def justify(snake_case_ : list , snake_case_ : int , snake_case_ : int ) -> str: __magic_name__ = max_width - width __magic_name__ = le...
678
import argparse import requests import torch from PIL import Image from transformers import SwinConfig, SwinForMaskedImageModeling, ViTImageProcessor def _SCREAMING_SNAKE_CASE ( snake_case_ : Optional[Any] ): __magic_name__ = SwinConfig(image_size=192 ) if "base" in model_name: ...
678
1
import numpy as np def _SCREAMING_SNAKE_CASE ( snake_case_ : np.ndarray , snake_case_ : np.ndarray , snake_case_ : float = 1E-12 , snake_case_ : int = 100 , ): assert np.shape(snake_case_ )[0] == np.shape(snake_case_ )[1] # Ensure proper dimensionality. assert np...
678
from __future__ import annotations import collections import pprint from pathlib import Path def _SCREAMING_SNAKE_CASE ( snake_case_ : str ): return "".join(sorted(snake_case_ ) ) def _SCREAMING_SNAKE_CASE ( snake_case_ : str ): return word_by_signature[signature(snake_case_ )...
678
1
import warnings from ...configuration_utils import PretrainedConfig from ...utils import logging a_ : Tuple = logging.get_logger(__name__) a_ : str = { 'RUCAIBox/mvp': 'https://huggingface.co/RUCAIBox/mvp/resolve/main/config.json', } class SCREAMING_SNAKE_CASE_ ...
678
from __future__ import annotations from scipy.special import comb # type: ignore class SCREAMING_SNAKE_CASE_ : """simple docstring""" def __init__( self , A ) -> Tuple: '''simple docstring''' __magic_name__ = list_of_points # Degree det...
678
1
from typing import TYPE_CHECKING from ...utils import OptionalDependencyNotAvailable, _LazyModule, is_torch_available a_ : Dict = { 'configuration_bigbird_pegasus': [ 'BIGBIRD_PEGASUS_PRETRAINED_CONFIG_ARCHIVE_MAP', 'BigBirdPegasusConfig', 'BigBirdPegasusOnnxConfi...
678
import re def _SCREAMING_SNAKE_CASE ( snake_case_ : str ): __magic_name__ = 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(snake_case_ , snake_case_ ) ) if __name__ == "__main__": a_ : ...
678
1
def _SCREAMING_SNAKE_CASE ( snake_case_ : str ): return [ txt[:a] + txt[a].upper() + txt[a + 1 :] for a in range(len(snake_case_ ) ) if txt[a].isalpha() ] if __name__ == "__main__": __import__('doctest').testmod()
678
import os import sys import unittest a_ : int = os.path.abspath(os.path.dirname(os.path.dirname(os.path.dirname(__file__)))) sys.path.append(os.path.join(git_repo_path, 'utils')) import check_dummies # noqa: E402 from check_dummies import create_dummy_files, create_dummy_object, find_backen...
678
1
import argparse import pathlib import fairseq import torch from fairseq.models.roberta import RobertaModel as FairseqRobertaModel from fairseq.modules import TransformerSentenceEncoderLayer from packaging import version from transformers import XLMRobertaConfig, XLMRobertaXLForMaskedLM, XLMRobertaXLForSequenceC...
678
def _SCREAMING_SNAKE_CASE ( snake_case_ : list[list[int]] , snake_case_ : int , snake_case_ : int , snake_case_ : set ): __magic_name__ , __magic_name__ = len(snake_case_ ), len(grid[0] ) if ( min(snake_case_ , snake_case_ ) < 0 or row == row...
678
1
a_ : List[Any] = {str(digit): digit**5 for digit in range(10)} def _SCREAMING_SNAKE_CASE ( snake_case_ : int ): return sum(DIGITS_FIFTH_POWER[digit] for digit in str(snake_case_ ) ) def _SCREAMING_SNAKE_CASE ( ): return sum( number for number...
678
a_ : Dict = { 'meter': 'm', 'kilometer': 'km', 'megametre': 'Mm', 'gigametre': 'Gm', 'terametre': 'Tm', 'petametre': 'Pm', 'exametre': 'Em', 'zettametre': 'Zm', 'yottametre': 'Ym', } # Exponent of the factor(meter) a_ : str = { 'm': 0, ...
678
1
import logging import os from typing import List, Tuple import numpy as np import psutil import torch import torch.distributed as dist from transformers import RagRetriever a_ : Optional[Any] = logging.getLogger(__name__) class SCREAMING_SNAKE_CASE_ ( SCREAMING_SNAKE_CASE__ ): ...
678
from typing import TYPE_CHECKING from ...utils import OptionalDependencyNotAvailable, _LazyModule, is_flax_available, is_torch_available a_ : Union[str, Any] = { 'configuration_longt5': ['LONGT5_PRETRAINED_CONFIG_ARCHIVE_MAP', 'LongT5Config', 'LongT5OnnxConfig'], } try: if not is_to...
678
1
import unittest from transformers import is_torch_available from transformers.testing_utils import require_torch, slow, torch_device from ...generation.test_utils import GenerationTesterMixin from ...test_configuration_common import ConfigTester from ...test_modeling_common import ModelTesterMixin, ids_tensor f...
678
import unittest from transformers import is_torch_available from transformers.testing_utils import require_torch, slow, torch_device from ...generation.test_utils import GenerationTesterMixin from ...test_configuration_common import ConfigTester from ...test_modeling_common import ModelTesterMixin, ids_tensor f...
678
1
from functools import reduce a_ : Optional[int] = ( '73167176531330624919225119674426574742355349194934' '96983520312774506326239578318016984801869478851843' '85861560789112949495459501737958331952853208805511' '12540698747158523863050715693290963295227443043557' '668966489...
678
def _SCREAMING_SNAKE_CASE ( ): __magic_name__ = [] __magic_name__ = 1 while len(snake_case_ ) < 1E6: constant.append(str(snake_case_ ) ) i += 1 __magic_name__ = ''''''.join(snake_case_ ) return ( int(constant[0] ) * int...
678
1
from typing import TYPE_CHECKING from ...utils import OptionalDependencyNotAvailable, _LazyModule, is_flax_available, is_torch_available a_ : Union[str, Any] = { 'configuration_longt5': ['LONGT5_PRETRAINED_CONFIG_ARCHIVE_MAP', 'LongT5Config', 'LongT5OnnxConfig'], } try: if not is_to...
678
import copy import fnmatch import json import os import pickle as pkl import shutil import sys import tarfile import tempfile from collections import OrderedDict from contextlib import contextmanager from functools import partial from hashlib import shaaaa from io import BytesIO from pathlib import Path from urll...
678
1
import warnings from ...utils import logging from .image_processing_segformer import SegformerImageProcessor a_ : Dict = logging.get_logger(__name__) class SCREAMING_SNAKE_CASE_ ( SCREAMING_SNAKE_CASE__ ): """simple docstring""" def __init__( self , *A , ...
678
import argparse import json 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 accelerate import ...
678
1
def _SCREAMING_SNAKE_CASE ( snake_case_ : int ): if a < 0: raise ValueError('''Input value must be a positive integer''' ) elif isinstance(snake_case_ , snake_case_ ): raise TypeError('''Input value must be a \'int\' type''' ) return bin(snake_case_ ).count('''1'''...
678
def _SCREAMING_SNAKE_CASE ( snake_case_ : str ): return " ".join( ''''''.join(word[::-1] ) if len(snake_case_ ) > 4 else word for word in sentence.split() ) if __name__ == "__main__": import doctest doctest.testmod() print(reverse_long_words('Hey wollef sroirraw'))
678
1
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 SCREAMING_SNAKE_CASE_ ( unittest.TestCase ): """simple doc...
678
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 # noqa: F401 # Here to...
678
1
import argparse import torch from ...utils import logging from . import AlbertConfig, AlbertForPreTraining, load_tf_weights_in_albert logging.set_verbosity_info() def _SCREAMING_SNAKE_CASE ( snake_case_ : Dict , snake_case_ : List[Any] , snake_case_ : Tuple ): # Initialise PyTorc...
678
from __future__ import annotations import typing from collections.abc import Iterable import numpy as np a_ : Tuple = typing.Union[Iterable[float], Iterable[int], np.ndarray] # noqa: UP007 a_ : List[str] = typing.Union[np.floataa, int, float] # noqa: UP007 def _...
678
1
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_...
678
import argparse import json import os from pathlib import Path import requests import torch from transformers import JukeboxConfig, JukeboxModel from transformers.utils import logging logging.set_verbosity_info() a_ : str = logging.get_logger(__name__) a_ : Union[str, Any] ...
678
1
a_ : Dict = { 'meter': 'm', 'kilometer': 'km', 'megametre': 'Mm', 'gigametre': 'Gm', 'terametre': 'Tm', 'petametre': 'Pm', 'exametre': 'Em', 'zettametre': 'Zm', 'yottametre': 'Ym', } # Exponent of the factor(meter) a_ : str = { 'm': 0, ...
678
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 a_ : int = logging.get_logger(__name__) a_ : ...
678
1
# Copyright 2021 The HuggingFace Team. All rights reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by app...
678
import argparse import torch from transformers import LxmertConfig, LxmertForPreTraining, load_tf_weights_in_lxmert from transformers.utils import logging logging.set_verbosity_info() def _SCREAMING_SNAKE_CASE ( snake_case_ : str , snake_case_ : Optional[int] , snake_case_ : Union[str...
678
1
from ...configuration_utils import PretrainedConfig from ...utils import logging from ...utils.backbone_utils import BackboneConfigMixin, get_aligned_output_features_output_indices a_ : List[Any] = logging.get_logger(__name__) a_ : Optional[Any] = { 'microsoft/focalnet...
678
# Usage: # ./gen-card-allenai-wmt16.py import os from pathlib import Path def _SCREAMING_SNAKE_CASE ( snake_case_ : Tuple , snake_case_ : Union[str, Any] , snake_case_ : List[str] , snake_case_ : Union[str, Any] ): __magic_name__ = { '''en''': '''Machine learni...
678
1
import gc import importlib.metadata import tempfile import unittest from packaging import version from transformers import ( AutoModel, AutoModelForCausalLM, AutoModelForSeqaSeqLM, AutoModelForSequenceClassification, AutoTokenizer, BitsAndBytesConfig, pipeline, ) from transformers.te...
678
def _SCREAMING_SNAKE_CASE ( snake_case_ : list[int] , snake_case_ : list[int] ): __magic_name__ = len(snake_case_ ) print('''The following activities are selected:''' ) # The first activity is always selected __magic_name__ = 0 print(snake_case_ , end=''...
678
1
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 # noqa: F401 # Here to...
678
import math from typing import Any, Callable, List, Optional, Tuple, Union import numpy as np import torch from ...models import TaFilmDecoder from ...schedulers import DDPMScheduler from ...utils import is_onnx_available, logging, randn_tensor if is_onnx_available(): from ..onnx_utils import OnnxRuntimeM...
678
1
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_ : Optional[Any] = logging.get_logger(__name__) def _SCREAMING_SNAKE_CASE ( snake_case_ : List[Any] ): __magic_name__ ...
678
from ...utils import ( OptionalDependencyNotAvailable, is_torch_available, is_transformers_available, is_transformers_version, ) try: if not (is_transformers_available() and is_torch_available() and is_transformers_version('>=', '4.25.0')): raise OptionalDependencyNotAvailable() exce...
678
1
from random import randint from tempfile import TemporaryFile import numpy as np def _SCREAMING_SNAKE_CASE ( snake_case_ : str , snake_case_ : str , snake_case_ : List[str] ): __magic_name__ = 0 if start < end: __magic_name__ = randint(snake_case_ , ...
678
import argparse import requests import torch from PIL import Image from transformers import SwinConfig, SwinForMaskedImageModeling, ViTImageProcessor def _SCREAMING_SNAKE_CASE ( snake_case_ : Optional[Any] ): __magic_name__ = SwinConfig(image_size=192 ) if "base" in model_name: ...
678
1
import unittest import numpy as np import torch from diffusers import PNDMPipeline, PNDMScheduler, UNetaDModel from diffusers.utils.testing_utils import enable_full_determinism, require_torch, slow, torch_device enable_full_determinism() class SCREAMING_SNAKE_CASE_ ( unittest.TestCase ): """si...
678
from __future__ import annotations import collections import pprint from pathlib import Path def _SCREAMING_SNAKE_CASE ( snake_case_ : str ): return "".join(sorted(snake_case_ ) ) def _SCREAMING_SNAKE_CASE ( snake_case_ : str ): return word_by_signature[signature(snake_case_ )...
678
1
import argparse import json import subprocess def _SCREAMING_SNAKE_CASE ( snake_case_ : List[str] , snake_case_ : List[str] ): __magic_name__ = [] __magic_name__ = ( f'curl -H "Accept: application/vnd.github+json" -H "Authorization: Bearer {token}"' ''...
678
from __future__ import annotations from scipy.special import comb # type: ignore class SCREAMING_SNAKE_CASE_ : """simple docstring""" def __init__( self , A ) -> Tuple: '''simple docstring''' __magic_name__ = list_of_points # Degree det...
678
1
import argparse import json 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 accelerate import ...
678
import re def _SCREAMING_SNAKE_CASE ( snake_case_ : str ): __magic_name__ = 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(snake_case_ , snake_case_ ) ) if __name__ == "__main__": a_ : ...
678
1
import argparse import torch from torch import nn from transformers import MBartConfig, MBartForConditionalGeneration def _SCREAMING_SNAKE_CASE ( snake_case_ : List[str] ): __magic_name__ = [ '''encoder.version''', '''decoder.version''', '''model.encoder.versi...
678
import os import sys import unittest a_ : int = os.path.abspath(os.path.dirname(os.path.dirname(os.path.dirname(__file__)))) sys.path.append(os.path.join(git_repo_path, 'utils')) import check_dummies # noqa: E402 from check_dummies import create_dummy_files, create_dummy_object, find_backen...
678
1
import json import os from typing import Optional import numpy as np from ...feature_extraction_utils import BatchFeature from ...processing_utils import ProcessorMixin from ...utils import logging from ...utils.hub import get_file_from_repo from ..auto import AutoTokenizer a_ : Any = loggi...
678
def _SCREAMING_SNAKE_CASE ( snake_case_ : list[list[int]] , snake_case_ : int , snake_case_ : int , snake_case_ : set ): __magic_name__ , __magic_name__ = len(snake_case_ ), len(grid[0] ) if ( min(snake_case_ , snake_case_ ) < 0 or row == row...
678
1
from typing import Dict import numpy as np from ..utils import add_end_docstrings, is_tf_available, is_torch_available, logging from .base import PIPELINE_INIT_ARGS, GenericTensor, Pipeline, PipelineException if is_tf_available(): import tensorflow as tf from ..tf_utils import stable_softmax if is_...
678
a_ : Dict = { 'meter': 'm', 'kilometer': 'km', 'megametre': 'Mm', 'gigametre': 'Gm', 'terametre': 'Tm', 'petametre': 'Pm', 'exametre': 'Em', 'zettametre': 'Zm', 'yottametre': 'Ym', } # Exponent of the factor(meter) a_ : str = { 'm': 0, ...
678
1
import heapq as hq import math from collections.abc import Iterator class SCREAMING_SNAKE_CASE_ : """simple docstring""" def __init__( self , A ) -> Optional[int]: '''simple docstring''' __magic_name__ = str(id_ ) __magic_name__ = ...
678
from typing import TYPE_CHECKING from ...utils import OptionalDependencyNotAvailable, _LazyModule, is_flax_available, is_torch_available a_ : Union[str, Any] = { 'configuration_longt5': ['LONGT5_PRETRAINED_CONFIG_ARCHIVE_MAP', 'LongT5Config', 'LongT5OnnxConfig'], } try: if not is_to...
678
1
from __future__ import annotations import os import tempfile import unittest import numpy as np from huggingface_hub import hf_hub_download from transformers import is_tensorflow_text_available, is_tf_available from transformers.testing_utils import require_tensorflow_text, require_tf, slow from ..test_modeli...
678
import unittest from transformers import is_torch_available from transformers.testing_utils import require_torch, slow, torch_device from ...generation.test_utils import GenerationTesterMixin from ...test_configuration_common import ConfigTester from ...test_modeling_common import ModelTesterMixin, ids_tensor f...
678
1
import fire from torch.utils.data import DataLoader from tqdm import tqdm from transformers import AutoTokenizer from utils import SeqaSeqDataset, pickle_save def _SCREAMING_SNAKE_CASE ( snake_case_ : List[str] , snake_case_ : Optional[int] , snake_case_ : Optional[Any]=1024 , snake...
678
def _SCREAMING_SNAKE_CASE ( ): __magic_name__ = [] __magic_name__ = 1 while len(snake_case_ ) < 1E6: constant.append(str(snake_case_ ) ) i += 1 __magic_name__ = ''''''.join(snake_case_ ) return ( int(constant[0] ) * int...
678
1
from collections import defaultdict class SCREAMING_SNAKE_CASE_ : """simple docstring""" def __init__( self , A , A ) -> int: '''simple docstring''' __magic_name__ = total # total no of tasks (N) # DP table will have a dimension of...
678
import copy import fnmatch import json import os import pickle as pkl import shutil import sys import tarfile import tempfile from collections import OrderedDict from contextlib import contextmanager from functools import partial from hashlib import shaaaa from io import BytesIO from pathlib import Path from urll...
678
1
from math import factorial def _SCREAMING_SNAKE_CASE ( snake_case_ : int = 100 ): return sum(int(snake_case_ ) for x in str(factorial(snake_case_ ) ) ) if __name__ == "__main__": print(solution(int(input('Enter the Number: ').strip())))
678
import argparse import json 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 accelerate import ...
678
1
import argparse import torch from transformers import LxmertConfig, LxmertForPreTraining, load_tf_weights_in_lxmert from transformers.utils import logging logging.set_verbosity_info() def _SCREAMING_SNAKE_CASE ( snake_case_ : str , snake_case_ : Optional[int] , snake_case_ : Union[str...
678
def _SCREAMING_SNAKE_CASE ( snake_case_ : str ): return " ".join( ''''''.join(word[::-1] ) if len(snake_case_ ) > 4 else word for word in sentence.split() ) if __name__ == "__main__": import doctest doctest.testmod() print(reverse_long_words('Hey wollef sroirraw'))
678
1
import qiskit def _SCREAMING_SNAKE_CASE ( snake_case_ : int , snake_case_ : int ): __magic_name__ = qiskit.Aer.get_backend('''aer_simulator''' ) # Create a Quantum Circuit acting on the q register __magic_name__ = qiskit.QuantumCircuit(snake_case_ , snake_case...
678
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 # noqa: F401 # Here to...
678
1
def _SCREAMING_SNAKE_CASE ( ): __magic_name__ = [] __magic_name__ = 1 while len(snake_case_ ) < 1E6: constant.append(str(snake_case_ ) ) i += 1 __magic_name__ = ''''''.join(snake_case_ ) return ( int(constant[0] ) * int...
678
from __future__ import annotations import typing from collections.abc import Iterable import numpy as np a_ : Tuple = typing.Union[Iterable[float], Iterable[int], np.ndarray] # noqa: UP007 a_ : List[str] = typing.Union[np.floataa, int, float] # noqa: UP007 def _...
678
1
def _SCREAMING_SNAKE_CASE ( snake_case_ : int ): if not isinstance(snake_case_ , snake_case_ ): raise ValueError('''multiplicative_persistence() only accepts integral values''' ) if num < 0: raise ValueError('''multiplicative_persistence() does not accept negative valu...
678
import argparse import json import os from pathlib import Path import requests import torch from transformers import JukeboxConfig, JukeboxModel from transformers.utils import logging logging.set_verbosity_info() a_ : str = logging.get_logger(__name__) a_ : Union[str, Any] ...
678
1
from __future__ import annotations a_ : Optional[Any] = [] def _SCREAMING_SNAKE_CASE ( snake_case_ : list[list[int]] , snake_case_ : int , snake_case_ : int ): for i in range(len(snake_case_ ) ): if board[row][i] == 1: return False fo...
678
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 a_ : int = logging.get_logger(__name__) a_ : ...
678
1
import json import os import unittest from transformers import AutoTokenizer, GPTaTokenizer, GPTaTokenizerFast from transformers.models.gpta.tokenization_gpta import VOCAB_FILES_NAMES from transformers.testing_utils import require_tokenizers from ...test_tokenization_common import TokenizerTesterMixin @requi...
678
import argparse import torch from transformers import LxmertConfig, LxmertForPreTraining, load_tf_weights_in_lxmert from transformers.utils import logging logging.set_verbosity_info() def _SCREAMING_SNAKE_CASE ( snake_case_ : str , snake_case_ : Optional[int] , snake_case_ : Union[str...
678
1
def _SCREAMING_SNAKE_CASE ( snake_case_ : list[list[int]] , snake_case_ : int , snake_case_ : int , snake_case_ : set ): __magic_name__ , __magic_name__ = len(snake_case_ ), len(grid[0] ) if ( min(snake_case_ , snake_case_ ) < 0 or row == row...
678
# Usage: # ./gen-card-allenai-wmt16.py import os from pathlib import Path def _SCREAMING_SNAKE_CASE ( snake_case_ : Tuple , snake_case_ : Union[str, Any] , snake_case_ : List[str] , snake_case_ : Union[str, Any] ): __magic_name__ = { '''en''': '''Machine learni...
678
1
# Copyright 2023 The HuggingFace Team. All rights reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by app...
678
def _SCREAMING_SNAKE_CASE ( snake_case_ : list[int] , snake_case_ : list[int] ): __magic_name__ = len(snake_case_ ) print('''The following activities are selected:''' ) # The first activity is always selected __magic_name__ = 0 print(snake_case_ , end=''...
678
1
import os from shutil import copyfile from typing import List, Optional, Tuple from ...tokenization_utils import AddedToken from ...tokenization_utils_fast import PreTrainedTokenizerFast from ...utils import is_sentencepiece_available, logging if is_sentencepiece_available(): from .tokenization_albert impo...
678
import math from typing import Any, Callable, List, Optional, Tuple, Union import numpy as np import torch from ...models import TaFilmDecoder from ...schedulers import DDPMScheduler from ...utils import is_onnx_available, logging, randn_tensor if is_onnx_available(): from ..onnx_utils import OnnxRuntimeM...
678
1
import argparse from typing import Dict import tensorflow as tf import torch from tqdm import tqdm from transformers import BigBirdPegasusConfig, BigBirdPegasusForConditionalGeneration a_ : Tuple = [ # tf -> hf ('/', '.'), ('layer_', 'layers.'), ('kernel', 'weight'), ('b...
678
from ...utils import ( OptionalDependencyNotAvailable, is_torch_available, is_transformers_available, is_transformers_version, ) try: if not (is_transformers_available() and is_torch_available() and is_transformers_version('>=', '4.25.0')): raise OptionalDependencyNotAvailable() exce...
678
1
import argparse import logging import os import time import timeit import datasets import numpy as np import pycuda.autoinit # noqa: F401 import pycuda.driver as cuda import tensorrt as trt import torch from absl import logging as absl_logging from accelerate import Accelerator from datasets import load_dataset...
678
import argparse import requests import torch from PIL import Image from transformers import SwinConfig, SwinForMaskedImageModeling, ViTImageProcessor def _SCREAMING_SNAKE_CASE ( snake_case_ : Optional[Any] ): __magic_name__ = SwinConfig(image_size=192 ) if "base" in model_name: ...
678
1
import logging import os from dataclasses import dataclass, field from typing import Dict, Optional import numpy as np from utils_multiple_choice import MultipleChoiceDataset, Split, processors import transformers from transformers import ( AutoConfig, AutoModelForMultipleChoice, AutoTokenizer, ...
678
from __future__ import annotations import collections import pprint from pathlib import Path def _SCREAMING_SNAKE_CASE ( snake_case_ : str ): return "".join(sorted(snake_case_ ) ) def _SCREAMING_SNAKE_CASE ( snake_case_ : str ): return word_by_signature[signature(snake_case_ )...
678
1
from typing import TYPE_CHECKING from ...utils import ( OptionalDependencyNotAvailable, _LazyModule, is_flax_available, is_sentencepiece_available, is_tf_available, is_tokenizers_available, is_torch_available, ) a_ : Any = { 'configuration_xlm_roberta': [ ...
678
from __future__ import annotations from scipy.special import comb # type: ignore class SCREAMING_SNAKE_CASE_ : """simple docstring""" def __init__( self , A ) -> Tuple: '''simple docstring''' __magic_name__ = list_of_points # Degree det...
678
1
import copy 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 a_ : Union[str, Any] = logging.get_logge...
678
import re def _SCREAMING_SNAKE_CASE ( snake_case_ : str ): __magic_name__ = 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(snake_case_ , snake_case_ ) ) if __name__ == "__main__": a_ : ...
678
1
import argparse import os from io import BytesIO from pathlib import Path import requests from clip_retrieval.clip_client import ClipClient from PIL import Image from tqdm import tqdm def _SCREAMING_SNAKE_CASE ( snake_case_ : Any , snake_case_ : Tuple , snake_case_ : str ): __magic_...
678
import os import sys import unittest a_ : int = os.path.abspath(os.path.dirname(os.path.dirname(os.path.dirname(__file__)))) sys.path.append(os.path.join(git_repo_path, 'utils')) import check_dummies # noqa: E402 from check_dummies import create_dummy_files, create_dummy_object, find_backen...
678
1
import warnings from .generation import TFGenerationMixin class SCREAMING_SNAKE_CASE_ ( SCREAMING_SNAKE_CASE__ ): """simple docstring""" warnings.warn( """Importing `TFGenerationMixin` from `src/transformers/generation_tf_utils.py` is deprecated and will """ """be removed in Tr...
678
def _SCREAMING_SNAKE_CASE ( snake_case_ : list[list[int]] , snake_case_ : int , snake_case_ : int , snake_case_ : set ): __magic_name__ , __magic_name__ = len(snake_case_ ), len(grid[0] ) if ( min(snake_case_ , snake_case_ ) < 0 or row == row...
678
1
import datetime import platform import subprocess from typing import Optional, Tuple, Union import numpy as np def _SCREAMING_SNAKE_CASE ( snake_case_ : bytes , snake_case_ : int ): __magic_name__ = f'{sampling_rate}' __magic_name__ = '''1''' __magic_name__ = ...
678
a_ : Dict = { 'meter': 'm', 'kilometer': 'km', 'megametre': 'Mm', 'gigametre': 'Gm', 'terametre': 'Tm', 'petametre': 'Pm', 'exametre': 'Em', 'zettametre': 'Zm', 'yottametre': 'Ym', } # Exponent of the factor(meter) a_ : str = { 'm': 0, ...
678
1
import os import zipfile import pytest from datasets.utils.extract import ( BzipaExtractor, Extractor, GzipExtractor, LzaExtractor, SevenZipExtractor, TarExtractor, XzExtractor, ZipExtractor, ZstdExtractor, ) from .utils import require_lza, require_pyazr, require_zstandard ...
678
from typing import TYPE_CHECKING from ...utils import OptionalDependencyNotAvailable, _LazyModule, is_flax_available, is_torch_available a_ : Union[str, Any] = { 'configuration_longt5': ['LONGT5_PRETRAINED_CONFIG_ARCHIVE_MAP', 'LongT5Config', 'LongT5OnnxConfig'], } try: if not is_to...
678
1
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 ( BertTokenizer, ViltConfig, ViltForImageAndTextRetrieval, ViltForImagesAndTextClassification, ViltForMaskedLM, Vil...
678
import unittest from transformers import is_torch_available from transformers.testing_utils import require_torch, slow, torch_device from ...generation.test_utils import GenerationTesterMixin from ...test_configuration_common import ConfigTester from ...test_modeling_common import ModelTesterMixin, ids_tensor f...
678
1
from __future__ import annotations import collections import pprint from pathlib import Path def _SCREAMING_SNAKE_CASE ( snake_case_ : str ): return "".join(sorted(snake_case_ ) ) def _SCREAMING_SNAKE_CASE ( snake_case_ : str ): return word_by_signature[signature(snake_case_ )...
678
def _SCREAMING_SNAKE_CASE ( ): __magic_name__ = [] __magic_name__ = 1 while len(snake_case_ ) < 1E6: constant.append(str(snake_case_ ) ) i += 1 __magic_name__ = ''''''.join(snake_case_ ) return ( int(constant[0] ) * int...
678
1
import argparse import ast import logging import os import sys import pandas as pd import torch from tqdm import tqdm from transformers import BartForConditionalGeneration, RagRetriever, RagSequenceForGeneration, RagTokenForGeneration from transformers import logging as transformers_logging sys.path.append(os...
678
import copy import fnmatch import json import os import pickle as pkl import shutil import sys import tarfile import tempfile from collections import OrderedDict from contextlib import contextmanager from functools import partial from hashlib import shaaaa from io import BytesIO from pathlib import Path from urll...
678
1
import logging import os import sys from dataclasses import dataclass, field from importlib import import_module from typing import Dict, List, Optional, Tuple import numpy as np from seqeval.metrics import accuracy_score, fa_score, precision_score, recall_score from torch import nn from utils_ner import Split, ...
678
import argparse import json 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 accelerate import ...
678
1
from typing import Optional, Tuple, Union import flax import flax.linen as nn import jax import jax.numpy as jnp from flax.core.frozen_dict import FrozenDict from ..configuration_utils import ConfigMixin, flax_register_to_config from ..utils import BaseOutput from .embeddings_flax import FlaxTimestepEmbedding, ...
678
def _SCREAMING_SNAKE_CASE ( snake_case_ : str ): return " ".join( ''''''.join(word[::-1] ) if len(snake_case_ ) > 4 else word for word in sentence.split() ) if __name__ == "__main__": import doctest doctest.testmod() print(reverse_long_words('Hey wollef sroirraw'))
678
1
from typing import List, Optional import numpy as np from ...processing_utils import ProcessorMixin from ...utils import to_numpy class SCREAMING_SNAKE_CASE_ ( SCREAMING_SNAKE_CASE__ ): """simple docstring""" _a = """EncodecFeatureExtractor""" _a = ("""T5Toke...
678
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 # noqa: F401 # Here to...
678
1
import jax.numpy as jnp from ...utils import logging from ..ta.modeling_flax_ta import FlaxTaEncoderModel, FlaxTaForConditionalGeneration, FlaxTaModel from .configuration_mta import MTaConfig a_ : Any = logging.get_logger(__name__) a_ : List[str] = 'T5Config' def ...
678
from __future__ import annotations import typing from collections.abc import Iterable import numpy as np a_ : Tuple = typing.Union[Iterable[float], Iterable[int], np.ndarray] # noqa: UP007 a_ : List[str] = typing.Union[np.floataa, int, float] # noqa: UP007 def _...
678
1
import gc import tempfile import unittest import numpy as np import torch from diffusers import VersatileDiffusionTextToImagePipeline from diffusers.utils.testing_utils import nightly, require_torch_gpu, torch_device a_ : List[Any] = False class SCREAMING_SNAKE_CASE_ ( unittest....
678
import argparse import json import os from pathlib import Path import requests import torch from transformers import JukeboxConfig, JukeboxModel from transformers.utils import logging logging.set_verbosity_info() a_ : str = logging.get_logger(__name__) a_ : Union[str, Any] ...
678
1
def _SCREAMING_SNAKE_CASE ( snake_case_ : int ): __magic_name__ = 1 for i in range(1 , num + 1 ): fact *= i return fact def _SCREAMING_SNAKE_CASE ( snake_case_ : int ): __magic_name__ = 0 while number > 0: __magic_name__ = ...
678
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 a_ : int = logging.get_logger(__name__) a_ : ...
678
1
from ...configuration_utils import PretrainedConfig from ...utils import logging a_ : Optional[int] = logging.get_logger(__name__) a_ : Tuple = { 'vinvino02/glpn-kitti': 'https://huggingface.co/vinvino02/glpn-kitti/resolve/main/config.json', # See all GLPN models a...
678
import argparse import torch from transformers import LxmertConfig, LxmertForPreTraining, load_tf_weights_in_lxmert from transformers.utils import logging logging.set_verbosity_info() def _SCREAMING_SNAKE_CASE ( snake_case_ : str , snake_case_ : Optional[int] , snake_case_ : Union[str...
678
1
import pytest from datasets.splits import SplitDict, SplitInfo from datasets.utils.py_utils import asdict @pytest.mark.parametrize( '''split_dict''' , [ SplitDict(), SplitDict({'''train''': SplitInfo(name='''train''' , num_bytes=1337 , num_examples=42 , dataset_name=''...
678
# Usage: # ./gen-card-allenai-wmt16.py import os from pathlib import Path def _SCREAMING_SNAKE_CASE ( snake_case_ : Tuple , snake_case_ : Union[str, Any] , snake_case_ : List[str] , snake_case_ : Union[str, Any] ): __magic_name__ = { '''en''': '''Machine learni...
678
1
import argparse import json import os import sys import tempfile import unittest from argparse import Namespace from dataclasses import dataclass, field from enum import Enum from pathlib import Path from typing import List, Literal, Optional import yaml from transformers import HfArgumentParser, TrainingArgume...
678
def _SCREAMING_SNAKE_CASE ( snake_case_ : list[int] , snake_case_ : list[int] ): __magic_name__ = len(snake_case_ ) print('''The following activities are selected:''' ) # The first activity is always selected __magic_name__ = 0 print(snake_case_ , end=''...
678
1
import json import os import shutil import tempfile import unittest from multiprocessing import get_context from pathlib import Path import datasets import numpy as np from datasets import load_dataset from parameterized import parameterized from transformers import AutoProcessor from transformers.models.wavave...
678
import math from typing import Any, Callable, List, Optional, Tuple, Union import numpy as np import torch from ...models import TaFilmDecoder from ...schedulers import DDPMScheduler from ...utils import is_onnx_available, logging, randn_tensor if is_onnx_available(): from ..onnx_utils import OnnxRuntimeM...
678
1
import unittest import numpy as np import torch from transformers import CLIPTextConfig, CLIPTextModel from diffusers import DDIMScheduler, LDMPipeline, UNetaDModel, VQModel from diffusers.utils.testing_utils import enable_full_determinism, require_torch, slow, torch_device enable_full_determinism() class ...
678
from ...utils import ( OptionalDependencyNotAvailable, is_torch_available, is_transformers_available, is_transformers_version, ) try: if not (is_transformers_available() and is_torch_available() and is_transformers_version('>=', '4.25.0')): raise OptionalDependencyNotAvailable() exce...
678
1
import shutil import tempfile import unittest from unittest.mock import patch from transformers import ( DefaultFlowCallback, IntervalStrategy, PrinterCallback, ProgressCallback, Trainer, TrainerCallback, TrainingArguments, is_torch_available, ) from transformers.testing_utils imp...
678
import argparse import requests import torch from PIL import Image from transformers import SwinConfig, SwinForMaskedImageModeling, ViTImageProcessor def _SCREAMING_SNAKE_CASE ( snake_case_ : Optional[Any] ): __magic_name__ = SwinConfig(image_size=192 ) if "base" in model_name: ...
678
1
import os from shutil import copyfile from typing import List, Optional, Tuple from ...tokenization_utils import AddedToken from ...tokenization_utils_fast import PreTrainedTokenizerFast from ...utils import is_sentencepiece_available, logging if is_sentencepiece_available(): from .tokenization_big_bird im...
678
from __future__ import annotations import collections import pprint from pathlib import Path def _SCREAMING_SNAKE_CASE ( snake_case_ : str ): return "".join(sorted(snake_case_ ) ) def _SCREAMING_SNAKE_CASE ( snake_case_ : str ): return word_by_signature[signature(snake_case_ )...
678
1
from __future__ import annotations import inspect import unittest import numpy as np from transformers import DeiTConfig from transformers.testing_utils import require_tf, require_vision, slow from transformers.utils import cached_property, is_tf_available, is_vision_available from ...test_configuration_commo...
678
from __future__ import annotations from scipy.special import comb # type: ignore class SCREAMING_SNAKE_CASE_ : """simple docstring""" def __init__( self , A ) -> Tuple: '''simple docstring''' __magic_name__ = list_of_points # Degree det...
678
1
import re def _SCREAMING_SNAKE_CASE ( snake_case_ : str ): __magic_name__ = 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(snake_case_ , snake_case_ ) ) if __name__ == "__main__": a_ : ...
678
import re def _SCREAMING_SNAKE_CASE ( snake_case_ : str ): __magic_name__ = 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(snake_case_ , snake_case_ ) ) if __name__ == "__main__": a_ : ...
678
1
from __future__ import annotations import typing from collections.abc import Iterable import numpy as np a_ : Tuple = typing.Union[Iterable[float], Iterable[int], np.ndarray] # noqa: UP007 a_ : List[str] = typing.Union[np.floataa, int, float] # noqa: UP007 def _...
678
import os import sys import unittest a_ : int = os.path.abspath(os.path.dirname(os.path.dirname(os.path.dirname(__file__)))) sys.path.append(os.path.join(git_repo_path, 'utils')) import check_dummies # noqa: E402 from check_dummies import create_dummy_files, create_dummy_object, find_backen...
678
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 import Mode...
678
def _SCREAMING_SNAKE_CASE ( snake_case_ : list[list[int]] , snake_case_ : int , snake_case_ : int , snake_case_ : set ): __magic_name__ , __magic_name__ = len(snake_case_ ), len(grid[0] ) if ( min(snake_case_ , snake_case_ ) < 0 or row == row...
678
1
# Lint as: python3 import sys from collections.abc import Mapping from typing import TYPE_CHECKING import numpy as np import pyarrow as pa from .. import config from ..utils.py_utils import map_nested from .formatting import TensorFormatter if TYPE_CHECKING: import torch class SCREAMING_SNAKE_CASE_ ...
678
a_ : Dict = { 'meter': 'm', 'kilometer': 'km', 'megametre': 'Mm', 'gigametre': 'Gm', 'terametre': 'Tm', 'petametre': 'Pm', 'exametre': 'Em', 'zettametre': 'Zm', 'yottametre': 'Ym', } # Exponent of the factor(meter) a_ : str = { 'm': 0, ...
678
1
import argparse from pathlib import Path from typing import Dict, OrderedDict, Tuple import torch from audiocraft.models import MusicGen from transformers import ( AutoFeatureExtractor, AutoTokenizer, EncodecModel, MusicgenDecoderConfig, MusicgenForConditionalGeneration, MusicgenProcesso...
678
from typing import TYPE_CHECKING from ...utils import OptionalDependencyNotAvailable, _LazyModule, is_flax_available, is_torch_available a_ : Union[str, Any] = { 'configuration_longt5': ['LONGT5_PRETRAINED_CONFIG_ARCHIVE_MAP', 'LongT5Config', 'LongT5OnnxConfig'], } try: if not is_to...
678
1
def _SCREAMING_SNAKE_CASE ( snake_case_ : int ): # bit count represents no. of bits in the gray code if bit_count < 0: raise ValueError('''The given input must be positive''' ) # get the generated string sequence __magic_name__ = gray_code_sequence_string(snake_case...
678
import unittest from transformers import is_torch_available from transformers.testing_utils import require_torch, slow, torch_device from ...generation.test_utils import GenerationTesterMixin from ...test_configuration_common import ConfigTester from ...test_modeling_common import ModelTesterMixin, ids_tensor f...
678
1
import copy import fnmatch import json import os import pickle as pkl import shutil import sys import tarfile import tempfile from collections import OrderedDict from contextlib import contextmanager from functools import partial from hashlib import shaaaa from io import BytesIO from pathlib import Path from urll...
678
def _SCREAMING_SNAKE_CASE ( ): __magic_name__ = [] __magic_name__ = 1 while len(snake_case_ ) < 1E6: constant.append(str(snake_case_ ) ) i += 1 __magic_name__ = ''''''.join(snake_case_ ) return ( int(constant[0] ) * int...
678
1
def _SCREAMING_SNAKE_CASE ( snake_case_ : int ): if n == 1 or not isinstance(snake_case_ , snake_case_ ): return 0 elif n == 2: return 1 else: __magic_name__ = [0, 1] for i in range(2 , n + 1 ): sequence.append(sequenc...
678
import copy import fnmatch import json import os import pickle as pkl import shutil import sys import tarfile import tempfile from collections import OrderedDict from contextlib import contextmanager from functools import partial from hashlib import shaaaa from io import BytesIO from pathlib import Path from urll...
678
1
import unittest from transformers import ( MODEL_FOR_CAUSAL_LM_MAPPING, TF_MODEL_FOR_CAUSAL_LM_MAPPING, TextGenerationPipeline, logging, pipeline, ) from transformers.testing_utils import ( CaptureLogger, is_pipeline_test, require_accelerate, require_tf, require_torch, ...
678
import argparse import json 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 accelerate import ...
678
1
from typing import Callable, List, Optional, Tuple, Union import torch from transformers import CLIPTextModel, CLIPTokenizer from ...configuration_utils import ConfigMixin, register_to_config from ...models import ModelMixin, TransformeraDModel, VQModel from ...schedulers import VQDiffusionScheduler from ...uti...
678
def _SCREAMING_SNAKE_CASE ( snake_case_ : str ): return " ".join( ''''''.join(word[::-1] ) if len(snake_case_ ) > 4 else word for word in sentence.split() ) if __name__ == "__main__": import doctest doctest.testmod() print(reverse_long_words('Hey wollef sroirraw'))
678
1
from typing import TYPE_CHECKING from ...utils import ( OptionalDependencyNotAvailable, _LazyModule, is_flax_available, is_sentencepiece_available, is_tf_available, is_tokenizers_available, is_torch_available, ) a_ : Optional[int] = { 'configuration_albert': [...
678
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 # noqa: F401 # Here to...
678
1
def _SCREAMING_SNAKE_CASE ( snake_case_ : list[int] , snake_case_ : list[int] ): __magic_name__ = len(snake_case_ ) print('''The following activities are selected:''' ) # The first activity is always selected __magic_name__ = 0 print(snake_case_ , end=''...
678
from __future__ import annotations import typing from collections.abc import Iterable import numpy as np a_ : Tuple = typing.Union[Iterable[float], Iterable[int], np.ndarray] # noqa: UP007 a_ : List[str] = typing.Union[np.floataa, int, float] # noqa: UP007 def _...
678
1