code
stringlengths
87
55.2k
code_codestyle
int64
0
349
style_context
stringlengths
135
49.1k
style_context_codestyle
int64
0
349
label
int64
0
1
"""simple docstring""" from string import ascii_uppercase _a = {str(ord(c) - 55): c for c in ascii_uppercase} def __a ( __lowerCamelCase, __lowerCamelCase ): if isinstance(__lowerCamelCase, __lowerCamelCase ): raise TypeError("int() can't convert non-string with explicit b...
61
def lowerCAmelCase_ ( __lowerCAmelCase , __lowerCAmelCase )-> str: '''simple docstring''' if number < 0 or shift_amount < 0: raise ValueError('''both inputs must be positive integers''' ) UpperCAmelCase : Dict =str(bin(__lowerCAmelCase )...
348
0
import webbrowser from sys import argv from urllib.parse import parse_qs, quote import requests from bsa import BeautifulSoup from fake_useragent import UserAgent if __name__ == "__main__": _A = '%20'.join(argv[1:]) if len(argv) > 1 else quote(str(input('Search: '))) print('Googling.....') ...
62
from dataclasses import asdict, dataclass from typing import Optional from ...configuration_utils import PretrainedConfig from ...utils import logging __snake_case = logging.get_logger(__name__) # TODO Update this __snake_case = { '''facebook/esm-1b''': '''https://huggingface.co/facebook/esm-1b/re...
348
0
'''simple docstring''' from __future__ import annotations import unittest from transformers import MobileBertConfig, is_tf_available from transformers.models.auto import get_values from transformers.testing_utils import require_tf, slow from ...test_configuration_common import ConfigTester from ...test_...
63
import torch from diffusers import KDPMaDiscreteScheduler from diffusers.utils import torch_device from .test_schedulers import SchedulerCommonTest class __snake_case ( lowerCamelCase__ ): __lowerCamelCase : Optional[int] = (KDPMaDiscreteScheduler,) __lowerCamelCase : ...
348
0
"""simple docstring""" # using dfs for finding eulerian path traversal def UpperCAmelCase__ (snake_case__ : List[str] , snake_case__ : Tuple , snake_case__ : int , snake_case__ : List[str]=None ): """simple docstring""" _snake_ca...
64
import unittest from transformers import is_flax_available from transformers.testing_utils import require_flax, require_sentencepiece, require_tokenizers, require_torch, slow if is_flax_available(): import optax from flax.training.common_utils import onehot from transformers import AutoTokenizer, Fla...
348
0
import argparse from pathlib import Path from transformers import AutoConfig, AutoTokenizer, RagConfig, RagSequenceForGeneration, RagTokenForGeneration def lowerCAmelCase_ ( __A, __A, __A, __A, __A = None, __A = None, __A = None, ) -> str: '''simple docstring''' ...
65
import unittest import numpy as np from diffusers import LMSDiscreteScheduler, OnnxStableDiffusionInpaintPipeline from diffusers.utils.testing_utils import ( is_onnx_available, load_image, nightly, require_onnxruntime, require_torch_gpu, ) from ..test_pipelines_onnx_common import OnnxPipelineTest...
348
0
"""simple docstring""" from __future__ import annotations from collections import Counter from random import random class lowerCamelCase : '''simple docstring''' def __init__( self: Tuple ) -> Optional[Any]: snake_case_ :Optional[int] = {} d...
66
from unittest import TestCase from datasets import Dataset from minhash_deduplication import deduplicate_dataset, make_duplicate_clusters def lowerCAmelCase_ ( )-> int: '''simple docstring''' UpperCAmelCase : str ={ '''repo_name''': ['''test_repo1''',...
348
0
'''simple docstring''' from __future__ import annotations import pandas as pd def __lowerCAmelCase ( UpperCamelCase__ , UpperCamelCase__ , UpperCamelCase__ ) -> list[int]: __lowerCamelCase = [0] * no_of_processes __lowerCamelCase = [0] * no_of_processes # Copy the burst ti...
67
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 ...utils imp...
348
0
import logging import torch from accelerate import Accelerator from arguments import EvaluationArguments from datasets import load_dataset from torch.utils.data import IterableDataset from torch.utils.data.dataloader import DataLoader from transformers import AutoModelForCausalLM, AutoTokenizer, HfArgumentParser, s...
68
import unittest import numpy as np import torch from diffusers import KarrasVePipeline, KarrasVeScheduler, UNetaDModel from diffusers.utils.testing_utils import enable_full_determinism, require_torch, slow, torch_device enable_full_determinism() class __snake_case ( unittest.TestCase ): @proper...
348
0
"""simple docstring""" from typing import TYPE_CHECKING from ....utils import _LazyModule __UpperCamelCase = {'''tokenization_tapex''': ['''TapexTokenizer''']} if TYPE_CHECKING: from .tokenization_tapex import TapexTokenizer else: import sys __UpperCamelCase = _LazyModule(__nam...
69
import qiskit def lowerCAmelCase_ ( __lowerCAmelCase , __lowerCAmelCase )-> qiskit.result.counts.Counts: '''simple docstring''' UpperCAmelCase : Union[str, Any] =qiskit.Aer.get_backend('''aer_simulator''' ) UpperCAmelCase : List[str] ...
348
0
'''simple docstring''' from __future__ import annotations from typing import Generic, TypeVar A__ : List[str] =TypeVar('''T''') class UpperCAmelCase ( Generic[T] ): def __init__( self : List[str] , __snake_case : T ) -> None: ...
70
from __future__ import annotations import unittest from transformers import BlenderbotConfig, BlenderbotTokenizer, is_tf_available from transformers.testing_utils import require_tf, require_tokenizers, slow from transformers.utils import cached_property from ...test_configuration_common import ConfigTester from ...t...
348
0
import unittest from parameterized import parameterized from transformers import LlamaConfig, is_torch_available, set_seed from transformers.testing_utils import require_torch, slow, torch_device from ...generation.test_utils import GenerationTesterMixin from ...test_configuration_common import...
71
import functools import operator from ...configuration_utils import PretrainedConfig from ...utils import logging __snake_case = logging.get_logger(__name__) __snake_case = { '''asapp/sew-d-tiny-100k''': '''https://huggingface.co/asapp/sew-d-tiny-100k/resolve/main/config.json''', # See all SEW...
348
0
"""simple docstring""" from importlib import import_module from .logging import get_logger lowerCAmelCase__ = get_logger(__name__) class __snake_case : def __init__( self : int , __lowerCAmelCase : List[str] , __lowerCAmelCase : ...
72
import os from argparse import ArgumentParser from typing import List import torch.utils.data from datasets import Dataset, IterableDataset from datasets.distributed import split_dataset_by_node __snake_case = 4 __snake_case = 3 class __snake_case ( lowerCamelCase__ ): pass d...
348
0
def SCREAMING_SNAKE_CASE__ ( lowerCamelCase__ , lowerCamelCase__ ) -> float: if digit_amount > 0: return round(number - int(lowerCamelCase__ ) , lowerCamelCase__ ) return number - int(lowerCamelCase__ ) if __name__ == "__main__": print(decimal_isolate(1.53, 0)) print(d...
73
from typing import TYPE_CHECKING from ...utils import ( OptionalDependencyNotAvailable, _LazyModule, is_flax_available, is_tf_available, is_tokenizers_available, is_torch_available, ) __snake_case = {'''configuration_opt''': ['''OPT_PRETRAINED_CONFIG_ARCHIVE_MAP''', '''OPTConfig''']} ...
348
0
"""simple docstring""" import inspect import unittest import numpy as np from transformers import ViTConfig, is_flax_available from transformers.testing_utils import require_flax, slow from ...test_configuration_common import ConfigTester from ...test_modeling_flax_common import FlaxModelTesterMixin, floats_tenso...
74
import tempfile import unittest import numpy as np import transformers from transformers import GPTaTokenizer, GPTJConfig, is_flax_available, is_torch_available from transformers.testing_utils import is_pt_flax_cross_test, require_flax, tooslow from ...generation.test_flax_utils import FlaxGenerationTesterMixin from...
348
0
'''simple docstring''' from __future__ import annotations import unittest from transformers import is_tf_available, is_torch_available from transformers.testing_utils import DUMMY_UNKNOWN_IDENTIFIER, SMALL_MODEL_IDENTIFIER, is_pt_tf_cross_test, slow if is_tf_available(): from transformers import ( ...
75
from typing import TYPE_CHECKING from ...utils import OptionalDependencyNotAvailable, _LazyModule, is_tokenizers_available, is_torch_available __snake_case = { '''configuration_bloom''': ['''BLOOM_PRETRAINED_CONFIG_ARCHIVE_MAP''', '''BloomConfig''', '''BloomOnnxConfig'''], } try: if not is_tokenizers...
348
0
from typing import TYPE_CHECKING from ...utils import OptionalDependencyNotAvailable, _LazyModule, is_tf_available, is_torch_available a_ = { 'configuration_groupvit': [ 'GROUPVIT_PRETRAINED_CONFIG_ARCHIVE_MAP', 'GroupViTConfig', 'GroupViTOnnxConfig', 'GroupViTTextConfig',...
76
import os from typing import Dict, List, Tuple, TypeVar, Union __snake_case = TypeVar('''T''') __snake_case = Union[List[T], Tuple[T, ...]] __snake_case = Union[T, List[T], Dict[str, T]] __snake_case = Union[str, bytes, os.PathLike]
348
0
"""simple docstring""" import torch def a_ ( ): '''simple docstring''' if torch.cuda.is_available(): lowercase__ : Tuple = torch.cuda.device_count() else: lowercase__ : Optional[int] = 0 print(f"""Successfully ran on ...
77
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 import ...
348
0
"""simple docstring""" from __future__ import annotations def _lowerCAmelCase ( lowercase_ , lowercase_ ): UpperCAmelCase = 0 UpperCAmelCase = len(lowercase_ ) - 1 while i < j: if nums[i] + nums[j] == target: ...
78
from collections.abc import Callable from math import pi, sqrt from random import uniform from statistics import mean def lowerCAmelCase_ ( __lowerCAmelCase )-> Optional[Any]: '''simple docstring''' def is_in_circle(__lowerCAmelCase , __lowerCAmelCase ) -> bool: ...
348
0
'''simple docstring''' import gc import unittest import numpy as np import torch from diffusers import StableDiffusionKDiffusionPipeline from diffusers.utils import slow, torch_device from diffusers.utils.testing_utils import enable_full_determinism, require_torch_gpu enable_full_determinism() @slow @re...
79
from __future__ import annotations import unittest import numpy as np from transformers import BlipTextConfig from transformers.testing_utils import require_tf, slow from transformers.utils import is_tf_available from ...test_configuration_common import ConfigTester from ...test_modeling_tf_common import TFModelTes...
348
0
'''simple docstring''' import argparse import json import os import sys import tempfile import unittest from argparse import Namespace from dataclasses import dataclass, field from enum import Enum from pathlib import Path from typing import List, Literal, Optional import yaml from transformers import HfArg...
80
import torch import torch.nn as nn from transformers import CLIPConfig, CLIPVisionModel, PreTrainedModel from ...utils import logging __snake_case = logging.get_logger(__name__) def lowerCAmelCase_ ( __lowerCAmelCase , __lowerCAmelCase )-> str: '''simple docstring''' ...
348
0
"""simple docstring""" import random import timeit from functools import wraps from typing import Callable, Optional from ..configuration_utils import PretrainedConfig from ..models.auto.modeling_tf_auto import TF_MODEL_MAPPING, TF_MODEL_WITH_LM_HEAD_MAPPING from ..utils import is_pyanvml_a...
81
import argparse import intel_extension_for_pytorch as ipex import torch from diffusers import DPMSolverMultistepScheduler, StableDiffusionPipeline __snake_case = argparse.ArgumentParser('''Stable Diffusion script with intel optimization''', add_help=False) parser.add_argument('''--dpm''', action='''store_tru...
348
0
import inspect import re from transformers.utils import direct_transformers_import # All paths are set with the intent you should run this script from the root of the repo with the command # python utils/check_config_docstrings.py A__ = """src/transformers""" # This is to make sure the transformers...
82
__snake_case = '''Input must be a string of 8 numbers plus letter''' __snake_case = '''TRWAGMYFPDXBNJZSQVHLCKE''' def lowerCAmelCase_ ( __lowerCAmelCase )-> bool: '''simple docstring''' if not isinstance(__lowerCAmelCase , __lowerCAmelCase ): ...
348
0
'''simple docstring''' import json import os import unittest from transformers import MgpstrTokenizer from transformers.models.mgp_str.tokenization_mgp_str import VOCAB_FILES_NAMES from transformers.testing_utils import require_tokenizers from ...test_tokenization_common import TokenizerTesterMixin @require...
83
def lowerCAmelCase_ ( __lowerCAmelCase , __lowerCAmelCase )-> str: '''simple docstring''' if number < 0 or shift_amount < 0: raise ValueError('''both inputs must be positive integers''' ) UpperCAmelCase : Dict =str(bin(__lowerCAmelCase )...
348
0
"""simple docstring""" import operator as op __UpperCAmelCase = 'scaler.pt' __UpperCAmelCase = 'pytorch_model' __UpperCAmelCase = 'random_states' __UpperCAmelCase = 'optimizer' __UpperCAmelCase = 'scheduler' __UpperCAmelCase = 'pytorch_model.bin' __Upp...
84
from dataclasses import asdict, dataclass from typing import Optional from ...configuration_utils import PretrainedConfig from ...utils import logging __snake_case = logging.get_logger(__name__) # TODO Update this __snake_case = { '''facebook/esm-1b''': '''https://huggingface.co/facebook/esm-1b/re...
348
0
'''simple docstring''' import shutil import tempfile import unittest from transformers import SPIECE_UNDERLINE, BatchEncoding, MBartTokenizer, MBartTokenizerFast, is_torch_available from transformers.testing_utils import ( get_tests_dir, nested_simplify, require_sentencepiece, require_tokeniz...
85
import torch from diffusers import KDPMaDiscreteScheduler from diffusers.utils import torch_device from .test_schedulers import SchedulerCommonTest class __snake_case ( lowerCamelCase__ ): __lowerCamelCase : Optional[int] = (KDPMaDiscreteScheduler,) __lowerCamelCase : ...
348
0
"""simple docstring""" import os import shutil from pathlib import Path from typing import Optional, Union import numpy as np from huggingface_hub import hf_hub_download from ..utils import ONNX_EXTERNAL_WEIGHTS_NAME, ONNX_WEIGHTS_NAME, is_onnx_available, logging if is_onnx_available(): import onnxru...
86
import unittest from transformers import is_flax_available from transformers.testing_utils import require_flax, require_sentencepiece, require_tokenizers, require_torch, slow if is_flax_available(): import optax from flax.training.common_utils import onehot from transformers import AutoTokenizer, Fla...
348
0
from __future__ import annotations import unittest from transformers import BlenderbotSmallConfig, BlenderbotSmallTokenizer, is_tf_available from transformers.testing_utils import require_tf, require_tokenizers, slow from transformers.utils import cached_property from ...test_configuration_common import Conf...
87
import unittest import numpy as np from diffusers import LMSDiscreteScheduler, OnnxStableDiffusionInpaintPipeline from diffusers.utils.testing_utils import ( is_onnx_available, load_image, nightly, require_onnxruntime, require_torch_gpu, ) from ..test_pipelines_onnx_common import OnnxPipelineTest...
348
0
def a__ ( A_ ): '''simple docstring''' if not isinstance(A_, A_ ): raise ValueError("""Input series is not valid, valid series - [2, 4, 6]""" ) if len(A_ ) == 0: raise ValueError("""Input list must be a non empty list""" ) if len(A_ ) ==...
88
from unittest import TestCase from datasets import Dataset from minhash_deduplication import deduplicate_dataset, make_duplicate_clusters def lowerCAmelCase_ ( )-> int: '''simple docstring''' UpperCAmelCase : str ={ '''repo_name''': ['''test_repo1''',...
348
0
'''simple docstring''' import string def __lowerCamelCase ( lowerCAmelCase_ ) -> None: for key in range(len(string.ascii_uppercase ) ): _a : Union[str, Any] = '' for symbol in message: if symbol in string.ascii_uppercase: _a : Option...
89
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 ...utils imp...
348
0
import math import qiskit def lowerCamelCase_ ( UpperCamelCase__ : int = 1 , UpperCamelCase__ : int = 1 , UpperCamelCase__ : int = 1 ) -> qiskit.result.counts.Counts: """simple docstring""" if ( isinsta...
90
import unittest import numpy as np import torch from diffusers import KarrasVePipeline, KarrasVeScheduler, UNetaDModel from diffusers.utils.testing_utils import enable_full_determinism, require_torch, slow, torch_device enable_full_determinism() class __snake_case ( unittest.TestCase ): @proper...
348
0
"""simple docstring""" from .configuration_bert_masked import MaskedBertConfig from .modeling_bert_masked import ( MaskedBertForMultipleChoice, MaskedBertForQuestionAnswering, MaskedBertForSequenceClassification, MaskedBertForTokenClassification, MaskedBertModel, ) from .modules import ...
91
import qiskit def lowerCAmelCase_ ( __lowerCAmelCase , __lowerCAmelCase )-> qiskit.result.counts.Counts: '''simple docstring''' UpperCAmelCase : Union[str, Any] =qiskit.Aer.get_backend('''aer_simulator''' ) UpperCAmelCase : List[str] ...
348
0
# 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_CHECKIN...
92
from __future__ import annotations import unittest from transformers import BlenderbotConfig, BlenderbotTokenizer, is_tf_available from transformers.testing_utils import require_tf, require_tokenizers, slow from transformers.utils import cached_property from ...test_configuration_common import ConfigTester from ...t...
348
0
'''simple docstring''' import re import tempfile from pathlib import Path import pytest import yaml from datasets.utils.readme import ReadMe # @pytest.fixture # def example_yaml_structure(): _lowercase : Union[str, Any] = yaml.safe_load( "\\nname: \"\"\nallow_emp...
93
import functools import operator from ...configuration_utils import PretrainedConfig from ...utils import logging __snake_case = logging.get_logger(__name__) __snake_case = { '''asapp/sew-d-tiny-100k''': '''https://huggingface.co/asapp/sew-d-tiny-100k/resolve/main/config.json''', # See all SEW...
348
0
from __future__ import annotations import unittest import numpy as np from transformers import LayoutLMConfig, 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, rando...
94
import os from argparse import ArgumentParser from typing import List import torch.utils.data from datasets import Dataset, IterableDataset from datasets.distributed import split_dataset_by_node __snake_case = 4 __snake_case = 3 class __snake_case ( lowerCamelCase__ ): pass d...
348
0
import argparse from pathlib import Path import fairseq import torch from fairseq.models.xmod import XMODModel as FairseqXmodModel from packaging import version from transformers import XmodConfig, XmodForMaskedLM, XmodForSequenceClassification from transformers.utils import logging if versi...
95
from typing import TYPE_CHECKING from ...utils import ( OptionalDependencyNotAvailable, _LazyModule, is_flax_available, is_tf_available, is_tokenizers_available, is_torch_available, ) __snake_case = {'''configuration_opt''': ['''OPT_PRETRAINED_CONFIG_ARCHIVE_MAP''', '''OPTConfig''']} ...
348
0
"""simple docstring""" import argparse import torch from transformers import RemBertConfig, RemBertModel, load_tf_weights_in_rembert from transformers.utils import logging logging.set_verbosity_info() def _snake_case ( lowercase__ , lowercase__ ...
96
import tempfile import unittest import numpy as np import transformers from transformers import GPTaTokenizer, GPTJConfig, is_flax_available, is_torch_available from transformers.testing_utils import is_pt_flax_cross_test, require_flax, tooslow from ...generation.test_flax_utils import FlaxGenerationTesterMixin from...
348
0
'''simple docstring''' from typing import Dict from transformers import EvalPrediction, HfArgumentParser, TrainingArguments, is_torch_available from transformers.testing_utils import ( TestCasePlus, execute_subprocess_async, get_torch_dist_unique_port, require_torch_multi_gpu, require_torch_neur...
97
from typing import TYPE_CHECKING from ...utils import OptionalDependencyNotAvailable, _LazyModule, is_tokenizers_available, is_torch_available __snake_case = { '''configuration_bloom''': ['''BLOOM_PRETRAINED_CONFIG_ARCHIVE_MAP''', '''BloomConfig''', '''BloomOnnxConfig'''], } try: if not is_tokenizers...
348
0
"""simple docstring""" def a_ ( lowerCamelCase = 1_0_0_0 ): return sum(2 * a * ((a - 1) // 2) for a in range(3 , n + 1 ) ) if __name__ == "__main__": print(solution())
98
import os from typing import Dict, List, Tuple, TypeVar, Union __snake_case = TypeVar('''T''') __snake_case = Union[List[T], Tuple[T, ...]] __snake_case = Union[T, List[T], Dict[str, T]] __snake_case = Union[str, bytes, os.PathLike]
348
0
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='my_dataset...
99
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 import ...
348
0
"""simple docstring""" import os import re from shutil import copyfile from typing import Any, Dict, List, Optional, Tuple import sentencepiece as spm from ...tokenization_utils import AddedToken, PreTrainedTokenizer from ...utils import logging __magic_name__ = logging.get_logger(__name__) __magic_n...
100
from collections.abc import Callable from math import pi, sqrt from random import uniform from statistics import mean def lowerCAmelCase_ ( __lowerCAmelCase )-> Optional[Any]: '''simple docstring''' def is_in_circle(__lowerCAmelCase , __lowerCAmelCase ) -> bool: ...
348
0
import argparse import io import requests import torch from omegaconf import OmegaConf from diffusers import AutoencoderKL from diffusers.pipelines.stable_diffusion.convert_from_ckpt import ( assign_to_checkpoint, conv_attn_to_linear, create_vae_diffusers_config, renew_vae_attention_paths, renew_...
101
from __future__ import annotations import unittest import numpy as np from transformers import BlipTextConfig from transformers.testing_utils import require_tf, slow from transformers.utils import is_tf_available from ...test_configuration_common import ConfigTester from ...test_modeling_tf_common import TFModelTes...
348
0
"""simple docstring""" import collections import os from typing import List, Optional, Tuple from transformers.utils import is_jieba_available, requires_backends if is_jieba_available(): import jieba from ...tokenization_utils import PreTrainedTokenizer from ...utils import logging SCREAMING_SNAKE_CASE : ...
102
import torch import torch.nn as nn from transformers import CLIPConfig, CLIPVisionModel, PreTrainedModel from ...utils import logging __snake_case = logging.get_logger(__name__) def lowerCAmelCase_ ( __lowerCAmelCase , __lowerCAmelCase )-> str: '''simple docstring''' ...
348
0
def UpperCamelCase( __UpperCamelCase : int ,__UpperCamelCase : int ): if a < 0 or b < 0: raise ValueError('''the value of both inputs must be positive''' ) lowerCAmelCase_ : Optional[int] = str(bin(__UpperCamelCase ) )[2:] # remove the leading "0b" lowerCAmelCase_ :...
103
import argparse import intel_extension_for_pytorch as ipex import torch from diffusers import DPMSolverMultistepScheduler, StableDiffusionPipeline __snake_case = argparse.ArgumentParser('''Stable Diffusion script with intel optimization''', add_help=False) parser.add_argument('''--dpm''', action='''store_tru...
348
0
'''simple docstring''' import warnings from ...utils import logging from .image_processing_mobilevit import MobileViTImageProcessor lowerCAmelCase__ = logging.get_logger(__name__) class lowercase_ (lowerCamelCase__ ): """simple docstring""" def __init__( self : ...
104
__snake_case = '''Input must be a string of 8 numbers plus letter''' __snake_case = '''TRWAGMYFPDXBNJZSQVHLCKE''' def lowerCAmelCase_ ( __lowerCAmelCase )-> bool: '''simple docstring''' if not isinstance(__lowerCAmelCase , __lowerCAmelCase ): ...
348
0
"""simple docstring""" import unittest from transformers import PegasusConfig, PegasusTokenizer, is_flax_available from transformers.testing_utils import require_flax, slow from ...test_configuration_common import ConfigTester from ...test_modeling_flax_common import FlaxModelTesterMixin, i...
105
def lowerCAmelCase_ ( __lowerCAmelCase , __lowerCAmelCase )-> str: '''simple docstring''' if number < 0 or shift_amount < 0: raise ValueError('''both inputs must be positive integers''' ) UpperCAmelCase : Dict =str(bin(__lowerCAmelCase )...
348
0
"""simple docstring""" from collections import OrderedDict from typing import Mapping from packaging import version from ...configuration_utils import PretrainedConfig from ...onnx import OnnxConfig from ...utils import logging from ...utils.backbone_utils import BackboneConfigMixin, get_aligned_output_feature...
106
from dataclasses import asdict, dataclass from typing import Optional from ...configuration_utils import PretrainedConfig from ...utils import logging __snake_case = logging.get_logger(__name__) # TODO Update this __snake_case = { '''facebook/esm-1b''': '''https://huggingface.co/facebook/esm-1b/re...
348
0
import math def __magic_name__ ( A : int = 100 ): '''simple docstring''' a = sum(i * i for i in range(1, n + 1 ) ) a = int(math.pow(sum(range(1, n + 1 ) ), 2 ) ) return square_of_sum - sum_of_squares if __name__ == "__main__": print(F'''{soluti...
107
import torch from diffusers import KDPMaDiscreteScheduler from diffusers.utils import torch_device from .test_schedulers import SchedulerCommonTest class __snake_case ( lowerCamelCase__ ): __lowerCamelCase : Optional[int] = (KDPMaDiscreteScheduler,) __lowerCamelCase : ...
348
0
"""simple docstring""" from collections.abc import Iterable from typing import Generic, TypeVar lowerCAmelCase__ = TypeVar('''_T''') class SCREAMING_SNAKE_CASE__ ( Generic[_T] ): """simple docstring""" def __init__( self , snake_case__ = None ): ...
108
import unittest from transformers import is_flax_available from transformers.testing_utils import require_flax, require_sentencepiece, require_tokenizers, require_torch, slow if is_flax_available(): import optax from flax.training.common_utils import onehot from transformers import AutoTokenizer, Fla...
348
0
"""simple docstring""" import argparse import os import torch from diffusers import ( CMStochasticIterativeScheduler, ConsistencyModelPipeline, UNetaDModel, ) A: List[str] = { "sample_size": 3_2, "in_channels": 3, "out_channels": 3, "layers_per_block": 2, "num_class_emb...
109
import unittest import numpy as np from diffusers import LMSDiscreteScheduler, OnnxStableDiffusionInpaintPipeline from diffusers.utils.testing_utils import ( is_onnx_available, load_image, nightly, require_onnxruntime, require_torch_gpu, ) from ..test_pipelines_onnx_common import OnnxPipelineTest...
348
0
"""simple docstring""" from __future__ import annotations import unittest from transformers import BlenderbotConfig, BlenderbotTokenizer, is_tf_available from transformers.testing_utils import require_tf, require_tokenizers, slow from transformers.utils import cached_property from ...test_configuration_co...
46
from unittest import TestCase from datasets import Dataset from minhash_deduplication import deduplicate_dataset, make_duplicate_clusters def lowerCAmelCase_ ( )-> int: '''simple docstring''' UpperCAmelCase : str ={ '''repo_name''': ['''test_repo1''',...
348
0
from typing import List, Optional from ...configuration_utils import PretrainedConfig from ...utils import logging A : Optional[Any] = logging.get_logger(__name__) A : int = { '''huggingface/autoformer-tourism-monthly''': '''https://huggingface.co/huggingface/autofor...
274
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 ...utils imp...
348
0
import argparse import os import torch from transformers.utils import WEIGHTS_NAME UpperCAmelCase = ['''small''', '''medium''', '''large'''] UpperCAmelCase = '''lm_head.decoder.weight''' UpperCAmelCase = '''lm_head.weight''' def UpperCAmelCase_ ( __SCREAMING_SNAKE_CASE , ...
195
import unittest import numpy as np import torch from diffusers import KarrasVePipeline, KarrasVeScheduler, UNetaDModel from diffusers.utils.testing_utils import enable_full_determinism, require_torch, slow, torch_device enable_full_determinism() class __snake_case ( unittest.TestCase ): @proper...
348
0
'''simple docstring''' from collections.abc import Sequence def _UpperCamelCase ( UpperCamelCase__ = None ): if nums is None or not nums: raise ValueError("""Input sequence should not be empty""" ) UpperCAmelCase__ : Dict = nums[0...
163
import qiskit def lowerCAmelCase_ ( __lowerCAmelCase , __lowerCAmelCase )-> qiskit.result.counts.Counts: '''simple docstring''' UpperCAmelCase : Union[str, Any] =qiskit.Aer.get_backend('''aer_simulator''' ) UpperCAmelCase : List[str] ...
348
0
def UpperCAmelCase ( a_ , a_ , a_ , a_ ) -> int: """simple docstring""" global f # a global dp table for knapsack if f[i][j] < 0: if j < wt[i - 1]: __A = mf_knapsack(i - 1 , __lowerCAmelCase , __lowerCAmelCase , __lowerCAmelCase ) ...
15
from __future__ import annotations import unittest from transformers import BlenderbotConfig, BlenderbotTokenizer, is_tf_available from transformers.testing_utils import require_tf, require_tokenizers, slow from transformers.utils import cached_property from ...test_configuration_common import ConfigTester from ...t...
348
0
import pandas as pd from matplotlib import pyplot as plt from sklearn.linear_model import LinearRegression # Splitting the dataset into the Training set and Test set from sklearn.model_selection import train_test_split # Fitting Polynomial Regression to the dataset from sklearn.preprocessing import PolynomialFeat...
227
import functools import operator from ...configuration_utils import PretrainedConfig from ...utils import logging __snake_case = logging.get_logger(__name__) __snake_case = { '''asapp/sew-d-tiny-100k''': '''https://huggingface.co/asapp/sew-d-tiny-100k/resolve/main/config.json''', # See all SEW...
348
0
import unittest from accelerate import debug_launcher from accelerate.test_utils import require_cpu, test_ops, test_script @require_cpu class __lowerCAmelCase ( unittest.TestCase ): def A__ ( self ) -> Optional[Any]: '''simple docstring''' ...
205
import os from argparse import ArgumentParser from typing import List import torch.utils.data from datasets import Dataset, IterableDataset from datasets.distributed import split_dataset_by_node __snake_case = 4 __snake_case = 3 class __snake_case ( lowerCamelCase__ ): pass d...
348
0
"""simple docstring""" from __future__ import annotations import copy import inspect import json import math import os import tempfile import unittest from importlib import import_module import numpy as np from transformers import ViTMAEConfig from transformers.file_utils import cached_property, is_tf_available,...
132
from typing import TYPE_CHECKING from ...utils import ( OptionalDependencyNotAvailable, _LazyModule, is_flax_available, is_tf_available, is_tokenizers_available, is_torch_available, ) __snake_case = {'''configuration_opt''': ['''OPT_PRETRAINED_CONFIG_ARCHIVE_MAP''', '''OPTConfig''']} ...
348
0
'''simple docstring''' import argparse import os import pickle import sys import torch from transformers import TransfoXLConfig, TransfoXLLMHeadModel, load_tf_weights_in_transfo_xl from transformers.models.transfo_xl import tokenization_transfo_xl as data_utils from transformers.models.transfo_xl.to...
254
import tempfile import unittest import numpy as np import transformers from transformers import GPTaTokenizer, GPTJConfig, is_flax_available, is_torch_available from transformers.testing_utils import is_pt_flax_cross_test, require_flax, tooslow from ...generation.test_flax_utils import FlaxGenerationTesterMixin from...
348
0
'''simple docstring''' import unittest from transformers import TrOCRConfig from transformers.testing_utils import is_torch_available, require_torch, torch_device from ...generation.test_utils import GenerationTesterMixin from ...test_configuration_common import ConfigTester from ...test_modeling_common impo...
346
from typing import TYPE_CHECKING from ...utils import OptionalDependencyNotAvailable, _LazyModule, is_tokenizers_available, is_torch_available __snake_case = { '''configuration_bloom''': ['''BLOOM_PRETRAINED_CONFIG_ARCHIVE_MAP''', '''BloomConfig''', '''BloomOnnxConfig'''], } try: if not is_tokenizers...
348
0
from __future__ import annotations def UpperCamelCase ( _A, _A, _A, _A ): """simple docstring""" __magic_name__ : List[str] = [] __magic_name__ : Optional[Any] = input_list[low:mid], input_list[mid : high + 1] while lef...
342
import os from typing import Dict, List, Tuple, TypeVar, Union __snake_case = TypeVar('''T''') __snake_case = Union[List[T], Tuple[T, ...]] __snake_case = Union[T, List[T], Dict[str, T]] __snake_case = Union[str, bytes, os.PathLike]
348
0
"""simple docstring""" import math from typing import Optional import numpy as np from ...configuration_utils import PretrainedConfig from ...utils import logging SCREAMING_SNAKE_CASE__ = logging.get_logger(__name__) SCREAMING_SNAKE_CASE__ = { "facebook/encodec_24khz": "https://huggingfa...
46
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 import ...
348
0
from collections import OrderedDict from typing import List, Mapping from packaging import version from ...configuration_utils import PretrainedConfig from ...onnx import OnnxConfig from ...utils import logging A : Any = logging.get_logger(__name__) A : List[str] = {...
274
from collections.abc import Callable from math import pi, sqrt from random import uniform from statistics import mean def lowerCAmelCase_ ( __lowerCAmelCase )-> Optional[Any]: '''simple docstring''' def is_in_circle(__lowerCAmelCase , __lowerCAmelCase ) -> bool: ...
348
0
from dataclasses import dataclass, field from typing import ClassVar, Dict from ..features import Features, Sequence, Value from .base import TaskTemplate @dataclass(frozen=lowerCamelCase__ ) class A_ ( lowerCamelCase__ ): '''simple docstring''' _UpperCamelCase : str = ...
195
from __future__ import annotations import unittest import numpy as np from transformers import BlipTextConfig from transformers.testing_utils import require_tf, slow from transformers.utils import is_tf_available from ...test_configuration_common import ConfigTester from ...test_modeling_tf_common import TFModelTes...
348
0
'''simple docstring''' def _UpperCamelCase ( UpperCamelCase__ ): if not numbers: return 0 if not isinstance(__lowerCAmelCase , (list, tuple) ) or not all( isinstance(__lowerCAmelCase , __lowerCAmelCase ) for number in numbers ):...
163
import torch import torch.nn as nn from transformers import CLIPConfig, CLIPVisionModel, PreTrainedModel from ...utils import logging __snake_case = logging.get_logger(__name__) def lowerCAmelCase_ ( __lowerCAmelCase , __lowerCAmelCase )-> str: '''simple docstring''' ...
348
0
import json import os import shutil import warnings from argparse import ArgumentParser, Namespace from pathlib import Path from typing import List from ..utils import logging from . import BaseTransformersCLICommand try: from cookiecutter.main import cookiecutter SCREAMING_SNAKE_CASE :Dict ...
15
import argparse import intel_extension_for_pytorch as ipex import torch from diffusers import DPMSolverMultistepScheduler, StableDiffusionPipeline __snake_case = argparse.ArgumentParser('''Stable Diffusion script with intel optimization''', add_help=False) parser.add_argument('''--dpm''', action='''store_tru...
348
0
import argparse import json from collections import OrderedDict import torch from huggingface_hub import cached_download, hf_hub_url from transformers import AutoImageProcessor, CvtConfig, CvtForImageClassification def a( A : Tuple ) -> int: """simple docstring""" ...
227
__snake_case = '''Input must be a string of 8 numbers plus letter''' __snake_case = '''TRWAGMYFPDXBNJZSQVHLCKE''' def lowerCAmelCase_ ( __lowerCAmelCase )-> bool: '''simple docstring''' if not isinstance(__lowerCAmelCase , __lowerCAmelCase ): ...
348
0
# DISCLAIMER: This file is strongly influenced by https://github.com/yang-song/score_sde_pytorch import math from typing import Union import torch from ..configuration_utils import ConfigMixin, register_to_config from ..utils import randn_tensor from .scheduling_utils import SchedulerMixin cl...
205
def lowerCAmelCase_ ( __lowerCAmelCase , __lowerCAmelCase )-> str: '''simple docstring''' if number < 0 or shift_amount < 0: raise ValueError('''both inputs must be positive integers''' ) UpperCAmelCase : Dict =str(bin(__lowerCAmelCase )...
348
0
"""simple docstring""" from __future__ import annotations def _lowercase ( __lowerCAmelCase , __lowerCAmelCase ) -> set[str]: SCREAMING_SNAKE_CASE__ : Dict = set(__lowerCAmelCase ), [start] while stack: SCREAMING_SNAKE_CASE__ : ...
132
from dataclasses import asdict, dataclass from typing import Optional from ...configuration_utils import PretrainedConfig from ...utils import logging __snake_case = logging.get_logger(__name__) # TODO Update this __snake_case = { '''facebook/esm-1b''': '''https://huggingface.co/facebook/esm-1b/re...
348
0
'''simple docstring''' import importlib import torch import yaml from omegaconf import OmegaConf from taming.models.vqgan import VQModel def lowercase_ ( lowerCAmelCase__ : Optional[Any] , lowerCAmelCase__ : Union[str, Any]=False ): """simple docstring""" ...
254
import torch from diffusers import KDPMaDiscreteScheduler from diffusers.utils import torch_device from .test_schedulers import SchedulerCommonTest class __snake_case ( lowerCamelCase__ ): __lowerCamelCase : Optional[int] = (KDPMaDiscreteScheduler,) __lowerCamelCase : ...
348
0
'''simple docstring''' from argparse import ArgumentParser, Namespace from ..utils import logging from . import BaseTransformersCLICommand def _UpperCamelCase ( SCREAMING_SNAKE_CASE__ : Optional[Any] ): '''simple docstring''' return ConvertCommand( args.model_type , args.tf_c...
346
import unittest from transformers import is_flax_available from transformers.testing_utils import require_flax, require_sentencepiece, require_tokenizers, require_torch, slow if is_flax_available(): import optax from flax.training.common_utils import onehot from transformers import AutoTokenizer, Fla...
348
0
from dataclasses import dataclass from typing import Dict, Optional, Union import torch import torch.nn.functional as F from torch import nn from ..configuration_utils import ConfigMixin, register_to_config from ..utils import BaseOutput from .attention import BasicTransformerBlock from .attention_processor im...
342
import unittest import numpy as np from diffusers import LMSDiscreteScheduler, OnnxStableDiffusionInpaintPipeline from diffusers.utils.testing_utils import ( is_onnx_available, load_image, nightly, require_onnxruntime, require_torch_gpu, ) from ..test_pipelines_onnx_common import OnnxPipelineTest...
348
0
"""simple docstring""" import argparse import torch from torch import nn from transformers import SpeechaTextConfig, SpeechaTextForConditionalGeneration def UpperCAmelCase__ ( SCREAMING_SNAKE_CASE : List[Any] ): '''simple docstring''' lowerCAmelCase = ...
46
from unittest import TestCase from datasets import Dataset from minhash_deduplication import deduplicate_dataset, make_duplicate_clusters def lowerCAmelCase_ ( )-> int: '''simple docstring''' UpperCAmelCase : str ={ '''repo_name''': ['''test_repo1''',...
348
0
import gc import unittest from diffusers import FlaxControlNetModel, FlaxStableDiffusionControlNetPipeline from diffusers.utils import is_flax_available, load_image, slow from diffusers.utils.testing_utils import require_flax if is_flax_available(): import jax import jax.numpy as jnp ...
274
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 ...utils imp...
348
0
import heapq def UpperCAmelCase_ ( __SCREAMING_SNAKE_CASE ): lowercase = [] # for each node and his adjacency list add them and the rank of the node to queue # using heapq module the queue will be filled like a Priority Queue # heapq works with a min priority queue, so I used -1...
195
import unittest import numpy as np import torch from diffusers import KarrasVePipeline, KarrasVeScheduler, UNetaDModel from diffusers.utils.testing_utils import enable_full_determinism, require_torch, slow, torch_device enable_full_determinism() class __snake_case ( unittest.TestCase ): @proper...
348
0
'''simple docstring''' from __future__ import annotations def _UpperCamelCase ( UpperCamelCase__ , UpperCamelCase__ = None , UpperCamelCase__ = None ): if start is None: UpperCAmelCase__ : List[str] = 0 if end is ...
163
import qiskit def lowerCAmelCase_ ( __lowerCAmelCase , __lowerCAmelCase )-> qiskit.result.counts.Counts: '''simple docstring''' UpperCAmelCase : Union[str, Any] =qiskit.Aer.get_backend('''aer_simulator''' ) UpperCAmelCase : List[str] ...
348
0
import copy from dataclasses import dataclass, field from typing import ClassVar, Dict from ..features import ClassLabel, Features, Value from .base import TaskTemplate @dataclass(frozen=lowerCamelCase__ ) class UpperCAmelCase ( lowerCamelCase__ ): '''simple docstring''' snake_case_ ...
15
from __future__ import annotations import unittest from transformers import BlenderbotConfig, BlenderbotTokenizer, is_tf_available from transformers.testing_utils import require_tf, require_tokenizers, slow from transformers.utils import cached_property from ...test_configuration_common import ConfigTester from ...t...
348
0
from __future__ import annotations def a( A : Union[str, Any] ) -> float: """simple docstring""" a = 0.00 a = 0 for resistor in resistors: if resistor <= 0: a = f'''Resistor at index {index} has a...
227
import functools import operator from ...configuration_utils import PretrainedConfig from ...utils import logging __snake_case = logging.get_logger(__name__) __snake_case = { '''asapp/sew-d-tiny-100k''': '''https://huggingface.co/asapp/sew-d-tiny-100k/resolve/main/config.json''', # See all SEW...
348
0
import gc import unittest from transformers import CTRLConfig, 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 Mo...
205
import os from argparse import ArgumentParser from typing import List import torch.utils.data from datasets import Dataset, IterableDataset from datasets.distributed import split_dataset_by_node __snake_case = 4 __snake_case = 3 class __snake_case ( lowerCamelCase__ ): pass d...
348
0
"""simple docstring""" import os import tempfile import unittest from transformers import is_torch_available from transformers.testing_utils import require_torch if is_torch_available(): import torch from torch import nn from transformers import ( Adafactor, AdamW, get_constant_schedule,...
132
from typing import TYPE_CHECKING from ...utils import ( OptionalDependencyNotAvailable, _LazyModule, is_flax_available, is_tf_available, is_tokenizers_available, is_torch_available, ) __snake_case = {'''configuration_opt''': ['''OPT_PRETRAINED_CONFIG_ARCHIVE_MAP''', '''OPTConfig''']} ...
348
0
'''simple docstring''' import itertools import json import linecache import os import pickle import re import socket import string from collections import Counter from logging import getLogger from pathlib import Path from typing import Callable, Dict, Iterable, List import git import torch fro...
254
import tempfile import unittest import numpy as np import transformers from transformers import GPTaTokenizer, GPTJConfig, is_flax_available, is_torch_available from transformers.testing_utils import is_pt_flax_cross_test, require_flax, tooslow from ...generation.test_flax_utils import FlaxGenerationTesterMixin from...
348
0
'''simple docstring''' import json import os import shutil import tempfile import unittest import numpy as np import pytest from transformers import CLIPTokenizer, CLIPTokenizerFast from transformers.models.clip.tokenization_clip import VOCAB_FILES_NAMES from transformers.testing_utils import require_vision ...
346
from typing import TYPE_CHECKING from ...utils import OptionalDependencyNotAvailable, _LazyModule, is_tokenizers_available, is_torch_available __snake_case = { '''configuration_bloom''': ['''BLOOM_PRETRAINED_CONFIG_ARCHIVE_MAP''', '''BloomConfig''', '''BloomOnnxConfig'''], } try: if not is_tokenizers...
348
0
from datasets.utils.patching import _PatchedModuleObj, patch_submodule from . import _test_patching def UpperCamelCase ( ): """simple docstring""" import os as original_os from os import path as original_path from os import rename as original_rename fro...
342
import os from typing import Dict, List, Tuple, TypeVar, Union __snake_case = TypeVar('''T''') __snake_case = Union[List[T], Tuple[T, ...]] __snake_case = Union[T, List[T], Dict[str, T]] __snake_case = Union[str, bytes, os.PathLike]
348
0
"""simple docstring""" SCREAMING_SNAKE_CASE__ = { "joule": 1.0, "kilojoule": 1_000, "megajoule": 1_000_000, "gigajoule": 1_000_000_000, "wattsecond": 1.0, "watthour": 3_600, "kilowatthour": 3_600_000, "newtonmeter": 1.0, "calorie_nutr": 4_186.8, "kilocalorie_nutr...
46
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 import ...
348
0
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, ...
274
from collections.abc import Callable from math import pi, sqrt from random import uniform from statistics import mean def lowerCAmelCase_ ( __lowerCAmelCase )-> Optional[Any]: '''simple docstring''' def is_in_circle(__lowerCAmelCase , __lowerCAmelCase ) -> bool: ...
348
0
from abc import ABC, abstractmethod from argparse import ArgumentParser class A_ ( lowerCamelCase__ ): '''simple docstring''' @staticmethod @abstractmethod def SCREAMING_SNAKE_CASE__ ( snake_case ): raise NotImplementedError() @abstractmethod def SCREAMING_SNAK...
195
from __future__ import annotations import unittest import numpy as np from transformers import BlipTextConfig from transformers.testing_utils import require_tf, slow from transformers.utils import is_tf_available from ...test_configuration_common import ConfigTester from ...test_modeling_tf_common import TFModelTes...
348
0
'''simple docstring''' import copy from typing import Dict, List, Optional from ...configuration_utils import PretrainedConfig from ...utils import logging from ..auto import CONFIG_MAPPING __A ={ 'facebook/mask2former-swin-small-coco-instance': ( 'https://huggingface.co/facebook/...
163
import torch import torch.nn as nn from transformers import CLIPConfig, CLIPVisionModel, PreTrainedModel from ...utils import logging __snake_case = logging.get_logger(__name__) def lowerCAmelCase_ ( __lowerCAmelCase , __lowerCAmelCase )-> str: '''simple docstring''' ...
348
0
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 @require_...
15
import argparse import intel_extension_for_pytorch as ipex import torch from diffusers import DPMSolverMultistepScheduler, StableDiffusionPipeline __snake_case = argparse.ArgumentParser('''Stable Diffusion script with intel optimization''', add_help=False) parser.add_argument('''--dpm''', action='''store_tru...
348
0
from __future__ import annotations from fractions import Fraction def a( A : int , A : int ) -> bool: """simple docstring""" return ( num != den and num % 10 == den // 10 and (num // 10) / (den % 10) == num / den ) def a( ...
227
__snake_case = '''Input must be a string of 8 numbers plus letter''' __snake_case = '''TRWAGMYFPDXBNJZSQVHLCKE''' def lowerCAmelCase_ ( __lowerCAmelCase )-> bool: '''simple docstring''' if not isinstance(__lowerCAmelCase , __lowerCAmelCase ): ...
348
0
import logging from dataclasses import dataclass, field from pathlib import Path from typing import Optional, Union from .generation.configuration_utils import GenerationConfig from .training_args import TrainingArguments from .utils import add_start_docstrings lowercase_ = logging.getLogger(...
205
def lowerCAmelCase_ ( __lowerCAmelCase , __lowerCAmelCase )-> str: '''simple docstring''' if number < 0 or shift_amount < 0: raise ValueError('''both inputs must be positive integers''' ) UpperCAmelCase : Dict =str(bin(__lowerCAmelCase )...
348
0
"""simple docstring""" import numpy as np from PIL import Image def _lowercase ( __lowerCAmelCase , __lowerCAmelCase , __lowerCAmelCase ) -> np.ndarray: SCREAMING_SNAKE_CASE__ : Any = np.array(__lowerCAmelCase ) if arr.shape[0] != arr.shap...
132
from dataclasses import asdict, dataclass from typing import Optional from ...configuration_utils import PretrainedConfig from ...utils import logging __snake_case = logging.get_logger(__name__) # TODO Update this __snake_case = { '''facebook/esm-1b''': '''https://huggingface.co/facebook/esm-1b/re...
348
0
'''simple docstring''' def lowercase_ ( lowerCAmelCase__ : List[str] ): """simple docstring""" __UpperCAmelCase : int = abs(__lowerCAmelCase ) __UpperCAmelCase : Dict = 0 while n > 0: res += n % 10 n //= 10 retu...
254
import torch from diffusers import KDPMaDiscreteScheduler from diffusers.utils import torch_device from .test_schedulers import SchedulerCommonTest class __snake_case ( lowerCamelCase__ ): __lowerCamelCase : Optional[int] = (KDPMaDiscreteScheduler,) __lowerCamelCase : ...
348
0
'''simple docstring''' import gc import unittest import numpy as np import torch from transformers import CLIPTextConfig, CLIPTextModel, CLIPTokenizer from diffusers import TransformeraDModel, VQDiffusionPipeline, VQDiffusionScheduler, VQModel from diffusers.pipelines.vq_diffusion.pipeline_vq_diffusion impor...
346
import unittest from transformers import is_flax_available from transformers.testing_utils import require_flax, require_sentencepiece, require_tokenizers, require_torch, slow if is_flax_available(): import optax from flax.training.common_utils import onehot from transformers import AutoTokenizer, Fla...
348
0
import warnings from ...configuration_utils import PretrainedConfig from ...utils import logging __magic_name__: Optional[Any] = logging.get_logger(__name__) __magic_name__: Optional[int] = { "RUCAIBox/mvp": "https://huggingface.co/RUCAIBox/mvp/resolve/main/config.json", } class ...
342
import unittest import numpy as np from diffusers import LMSDiscreteScheduler, OnnxStableDiffusionInpaintPipeline from diffusers.utils.testing_utils import ( is_onnx_available, load_image, nightly, require_onnxruntime, require_torch_gpu, ) from ..test_pipelines_onnx_common import OnnxPipelineTest...
348
0
"""simple docstring""" from typing import TYPE_CHECKING from ...utils import ( OptionalDependencyNotAvailable, _LazyModule, is_flax_available, is_tf_available, is_tokenizers_available, is_torch_available, is_vision_available, ) SCREAMING_SNAKE_CASE__ = { "configuratio...
46
from unittest import TestCase from datasets import Dataset from minhash_deduplication import deduplicate_dataset, make_duplicate_clusters def lowerCAmelCase_ ( )-> int: '''simple docstring''' UpperCAmelCase : str ={ '''repo_name''': ['''test_repo1''',...
348
0
from ...configuration_utils import PretrainedConfig from ...utils import logging A : Union[str, Any] = logging.get_logger(__name__) A : int = { '''uw-madison/mra-base-512-4''': '''https://huggingface.co/uw-madison/mra-base-512-4/resolve/main/config.json''', } clas...
274
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 ...utils imp...
348
0
from ..utils import DummyObject, requires_backends class A_ ( metaclass=lowerCamelCase__ ): '''simple docstring''' _UpperCamelCase : Dict = ["""sentencepiece"""] def __init__( self , *snake_case , **snake_case ): requires_backends(self , ...
195
import unittest import numpy as np import torch from diffusers import KarrasVePipeline, KarrasVeScheduler, UNetaDModel from diffusers.utils.testing_utils import enable_full_determinism, require_torch, slow, torch_device enable_full_determinism() class __snake_case ( unittest.TestCase ): @proper...
348
0
'''simple docstring''' import requests __A ='https://newsapi.org/v1/articles?source=bbc-news&sortBy=top&apiKey=' def _UpperCamelCase ( UpperCamelCase__ ): UpperCAmelCase__ : List[str] = requests.get(_NEWS_API + bbc_news_api_key ).json() # each a...
163
import qiskit def lowerCAmelCase_ ( __lowerCAmelCase , __lowerCAmelCase )-> qiskit.result.counts.Counts: '''simple docstring''' UpperCAmelCase : Union[str, Any] =qiskit.Aer.get_backend('''aer_simulator''' ) UpperCAmelCase : List[str] ...
348
0
import unittest from transformers.models.xlm_prophetnet.tokenization_xlm_prophetnet import SPIECE_UNDERLINE, XLMProphetNetTokenizer from transformers.testing_utils import get_tests_dir, require_sentencepiece, slow from transformers.utils import cached_property from ...test_tokenization_common import TokenizerTesterM...
15
from __future__ import annotations import unittest from transformers import BlenderbotConfig, BlenderbotTokenizer, is_tf_available from transformers.testing_utils import require_tf, require_tokenizers, slow from transformers.utils import cached_property from ...test_configuration_common import ConfigTester from ...t...
348
0
def a( A : Optional[int] ) -> list: """simple docstring""" a = int(__lowerCAmelCase ) if n_element < 1: a = ValueError("a should be a positive number" ) raise my_error a = [1] a = ...
227
import functools import operator from ...configuration_utils import PretrainedConfig from ...utils import logging __snake_case = logging.get_logger(__name__) __snake_case = { '''asapp/sew-d-tiny-100k''': '''https://huggingface.co/asapp/sew-d-tiny-100k/resolve/main/config.json''', # See all SEW...
348
0
import argparse import json from pathlib import Path import requests import torch from huggingface_hub import hf_hub_download from PIL import Image from transformers import ( MobileViTConfig, MobileViTForImageClassification, MobileViTForSemanticSegmentation, MobileViTImageProcessor, ...
205
import os from argparse import ArgumentParser from typing import List import torch.utils.data from datasets import Dataset, IterableDataset from datasets.distributed import split_dataset_by_node __snake_case = 4 __snake_case = 3 class __snake_case ( lowerCamelCase__ ): pass d...
348
0