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 __future__ import annotations from collections.abc import Generator import requests from bsa import BeautifulSoup _A : List[Any] ='''https://www.indeed.co.in/jobs?q=mobile+app+development&l=''' def SCREAMING_SNAKE_CASE_ (Uppe...
41
'''simple docstring''' import gc import random import unittest import numpy as np import torch from PIL import Image from transformers import CLIPTextConfig, CLIPTextModel, CLIPTokenizer from diffusers import AutoencoderKL, DDIMScheduler, DDPMScheduler, StableDiffusionUpscalePipeline, UNetaDConditionModel from d...
1
0
'''simple docstring''' import random import unittest from torch.utils.data import BatchSampler, DataLoader, IterableDataset from accelerate import Accelerator from accelerate.data_loader import ( BatchSamplerShard, DataLoaderDispatcher, DataLoaderShard, IterableDatasetShard, SkipBatchSampl...
42
'''simple docstring''' from typing import Callable, Dict, Optional, Tuple import torch from torch import nn from torch.distributions import ( AffineTransform, Distribution, Independent, NegativeBinomial, Normal, StudentT, TransformedDistribution, ) class __A ( UpperCame...
1
0
from scipy.stats import spearmanr import datasets __lowercase = ''' The Spearman rank-order correlation coefficient is a measure of the relationship between two datasets. Like other correlation coefficients, this one varies between -1 and +1 with 0 implying no correlation. Positive correlations imply that...
43
'''simple docstring''' import math_equivalence # From: git+https://github.com/hendrycks/math.git import datasets SCREAMING_SNAKE_CASE_: Optional[Any] ='\\n@article{hendrycksmath2021,\n title={Measuring Mathematical Problem Solving With the MATH Dataset},\n author={Dan Hendrycks\n and Collin Burns\n ...
1
0
"""simple docstring""" from __future__ import annotations import unittest from transformers import XGLMConfig, XGLMTokenizer, is_tf_available from transformers.testing_utils import require_tf, slow from ...test_configuration_common import ConfigTester from ...test_modeling_tf_common import TFModelTesterMixin, fl...
44
'''simple docstring''' from copy import deepcopy import torch import torch.nn.functional as F from torch.optim import AdamW from torch.optim.lr_scheduler import LambdaLR from torch.utils.data import DataLoader from accelerate.accelerator import Accelerator from accelerate.state import GradientState from accelera...
1
0
"""simple docstring""" from importlib import import_module from .logging import get_logger lowercase_ = get_logger(__name__) class __lowerCAmelCase : '''simple docstring''' def __init__( self , _a , _a=None ): __a = attrs or [] ...
45
'''simple docstring''' def lowerCAmelCase_ ( snake_case_ : int , snake_case_ : int ) -> int: '''simple docstring''' return x if y == 0 else greatest_common_divisor(snake_case_ , x % y ) def lowerCAmelCase_ ( snake_case_ : int , ...
1
0
"""simple docstring""" from typing import Union import fire import torch from tqdm import tqdm def UpperCAmelCase__ ( SCREAMING_SNAKE_CASE : str , SCREAMING_SNAKE_CASE : str = "cpu" , SCREAMING_SNAKE_CASE : Union[str, None] = None ): ...
46
'''simple docstring''' import os from math import logaa def lowerCAmelCase_ ( snake_case_ : str = "base_exp.txt" ) -> int: '''simple docstring''' UpperCAmelCase_ = 0 UpperCAmelCase_ = 0 for i, line in enumerate(open(os.path.join(os.path...
1
0
'''simple docstring''' def _lowerCAmelCase ( _UpperCamelCase : list , _UpperCamelCase : int = 0 ) -> list: """simple docstring""" _SCREAMING_SNAKE_CASE =length or len(_UpperCamelCase ) _SCREAMING_SNAKE_CASE =False for i i...
47
'''simple docstring''' 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_...
1
0
def A ( _SCREAMING_SNAKE_CASE ) -> int: if a < 0: raise ValueError("Input value must be a positive integer" ) elif isinstance(_SCREAMING_SNAKE_CASE ,_SCREAMING_SNAKE_CASE ): raise TypeError("Input value must be a 'int' type" ) re...
48
'''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_ten...
1
0
import json import os import shutil import tempfile import unittest import numpy as np import pytest from transformers import MgpstrTokenizer from transformers.models.mgp_str.tokenization_mgp_str import VOCAB_FILES_NAMES from transformers.testing_utils import require_torch, require_vision from transformers.utils ...
49
'''simple docstring''' import os import shutil import tempfile from unittest import TestCase from unittest.mock import patch import numpy as np from datasets import Dataset from transformers.models.realm.configuration_realm import RealmConfig from transformers.models.realm.retrieval_realm import _REALM_BLOCK_REC...
1
0
from collections import OrderedDict from typing import TYPE_CHECKING, Any, List, Mapping, Optional, Union from ...configuration_utils import PretrainedConfig from ...onnx import OnnxConfig from ...utils import TensorType, logging if TYPE_CHECKING: from ...onnx.config import PatchingSpec from ...tokeniz...
50
'''simple docstring''' from math import log from scipy.constants import Boltzmann, physical_constants SCREAMING_SNAKE_CASE_: Optional[int] =3_00 # TEMPERATURE (unit = K) def lowerCAmelCase_ ( snake_case_ : float , snake_case_ : float , snake_case_ : float , ...
1
0
import json import os import unittest from transformers.models.gptsan_japanese.tokenization_gptsan_japanese import ( VOCAB_FILES_NAMES, GPTSanJapaneseTokenizer, ) from transformers.testing_utils import require_tokenizers, slow from ...test_tokenization_common import TokenizerTesterMixin ...
51
'''simple docstring''' import math def lowerCAmelCase_ ( ) -> None: '''simple docstring''' UpperCAmelCase_ = input("Enter message: " ) UpperCAmelCase_ = int(input(f"""Enter key [2-{len(snake_case_ ) - 1}]: """ ) ) UpperCAmelCase_ ...
1
0
from typing import TYPE_CHECKING from ...utils import ( OptionalDependencyNotAvailable, _LazyModule, is_flax_available, is_tf_available, is_tokenizers_available, is_torch_available, ) __lowerCamelCase : Any = { """configuration_electra""": ["""ELECTRA_PRETRAINED_CONF...
52
'''simple docstring''' import json import logging import os import sys from pathlib import Path import finetune_rag from transformers.file_utils import is_apex_available from transformers.testing_utils import ( TestCasePlus, execute_subprocess_async, require_ray, require_torch_gpu, require_to...
1
0
'''simple docstring''' import os from typing import BinaryIO, Optional, Union import numpy as np import pyarrow.parquet as pq from .. import Audio, Dataset, Features, Image, NamedSplit, Value, config from ..features.features import FeatureType, _visit from ..formatting import query_table from ..packaged_modules...
53
'''simple docstring''' from multiprocessing import Lock, Pipe, Process # lock used to ensure that two processes do not access a pipe at the same time SCREAMING_SNAKE_CASE_: Optional[int] =Lock() def lowerCAmelCase_ ( snake_case_ : Dict , snake_case_ : Dict , snake_case_...
1
0
"""simple docstring""" import warnings warnings.warn( '''memory_utils has been reorganized to utils.memory. Import `find_executable_batchsize` from the main `__init__`: ''' '''`from accelerate import find_executable_batch_size` to avoid this warning.''', FutureWarning, )
54
'''simple docstring''' def lowerCAmelCase_ ( snake_case_ : int , snake_case_ : int ) -> str: '''simple docstring''' if a < 0 or b < 0: raise ValueError("the value of both inputs must be positive" ) UpperCAmelCase_ = str(bin(snake_cas...
1
0
'''simple docstring''' import hashlib import unittest from transformers import MODEL_FOR_DEPTH_ESTIMATION_MAPPING, is_torch_available, is_vision_available from transformers.pipelines import DepthEstimationPipeline, pipeline from transformers.testing_utils import ( is_pipeline_test, nested_simpl...
55
'''simple docstring''' from __future__ import annotations def lowerCAmelCase_ ( snake_case_ : list , snake_case_ : int | None = None , snake_case_ : int | None = None ) -> None: '''simple docstring''' if start is None: UpperCAmelCase_...
1
0
'''simple docstring''' a : Optional[Any] = { 'A': '.-', 'B': '-...', 'C': '-.-.', 'D': '-..', 'E': '.', 'F': '..-.', 'G': '--.', 'H': '....', 'I': '..', 'J': '.---', 'K': '-.-', 'L': '.-..', 'M': '--', 'N': '-.', 'O': '---', 'P': '.--.', 'Q': '--.-', 'R': '.-.', 'S': '...', 'T': '-', 'U':...
56
'''simple docstring''' from transformers import DistilBertTokenizer, DistilBertTokenizerFast from transformers.testing_utils import require_tokenizers, slow from ..bert.test_tokenization_bert import BertTokenizationTest @require_tokenizers class __A ( UpperCamelCase__ ): a__ : Optio...
1
0
"""simple docstring""" from typing import Callable, Optional from .. import Features from ..packaged_modules.generator.generator import Generator from .abc import AbstractDatasetInputStream class _UpperCamelCase ( lowerCAmelCase__ ): '''simple docstring''' def __init__( self , ...
57
'''simple docstring''' import argparse import json from collections import OrderedDict from pathlib import Path import requests import torch from huggingface_hub import hf_hub_download from PIL import Image from transformers import ( ConditionalDetrConfig, ConditionalDetrForObjectDetection, Condition...
1
0
'''simple docstring''' import math def lowerCamelCase ( __lowerCamelCase : int ) ->bool: _SCREAMING_SNAKE_CASE = math.loga(math.sqrt(4 * positive_integer + 1 ) / 2 + 1 / 2 ) return exponent == int(__lowerCamelCase ) def lowerCamelCase ( __lowerCa...
58
'''simple docstring''' import warnings from ...utils import logging from .image_processing_clip import CLIPImageProcessor SCREAMING_SNAKE_CASE_: Union[str, Any] =logging.get_logger(__name__) class __A ( UpperCamelCase__ ): def __init__(self : int , *__a : Dict , *...
1
0
import inspect import re from hashlib import shaaaa from typing import Dict, List from .arrow import arrow from .audiofolder import audiofolder from .csv import csv from .imagefolder import imagefolder from .json import json from .pandas import pandas from .parquet import parquet from .sql import sql # ...
59
'''simple docstring''' from __future__ import annotations import queue class __A : def __init__(self : Optional[Any] , __a : str ): UpperCAmelCase_ = data UpperCAmelCase_ = None UpperCAmelCase_ = None def l...
1
0
"""simple docstring""" import os import string import sys snake_case__ : Optional[int] = 1 << 8 snake_case__ : Union[str, Any] = { '''tab''': ord('''\t'''), '''newline''': ord('''\r'''), '''esc''': 27, '''up''': 65 + ARROW_KEY_FLAG, '''down''': 66 + ARROW_KEY_FLAG, ...
60
'''simple docstring''' 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 s...
1
0
"""simple docstring""" from __future__ import annotations from collections import deque class A_ : '''simple docstring''' def __init__( self , lowercase_ ): """simple docstring""" UpperCAmelCase_ : list[dict] = [] self.adlist.append( {"value": ""...
61
'''simple docstring''' import logging import os from dataclasses import dataclass from typing import List, Optional, Union import tqdm from filelock import FileLock from transformers import ( BartTokenizer, BartTokenizerFast, DataProcessor, PreTrainedTokenizer, RobertaTokenizer, RobertaTo...
1
0
import argparse from typing import List import evaluate import numpy as np import torch from datasets import DatasetDict, load_dataset # New Code # # We'll be using StratifiedKFold for this example from sklearn.model_selection import StratifiedKFold from torch.optim import AdamW from torch.utils.data import DataLo...
62
'''simple docstring''' from ...configuration_utils import PretrainedConfig from ...utils import logging SCREAMING_SNAKE_CASE_: Dict =logging.get_logger(__name__) SCREAMING_SNAKE_CASE_: Tuple ={} class __A ( UpperCamelCase__ ): a__ : int = """llama""" a__ ...
1
0
'''simple docstring''' import logging import os from dataclasses import dataclass, field from typing import Dict, Optional import datasets import numpy as np import tensorflow as tf from transformers import ( AutoConfig, AutoTokenizer, EvalPrediction, HfArgumentParser, PreTrainedToken...
63
'''simple docstring''' import gc import random import unittest import numpy as np import torch from PIL import Image from transformers import CLIPTextConfig, CLIPTextModel, CLIPTokenizer from diffusers import AutoencoderKL, DDIMScheduler, DDPMScheduler, StableDiffusionUpscalePipeline, UNetaDConditionModel from d...
1
0
"""simple docstring""" import numpy as np from cva import destroyAllWindows, imread, imshow, waitKey class lowercase: '''simple docstring''' def __init__( self: Union[str, Any], a_: Optional[Any], a_: int, a_: int ): '''sim...
64
'''simple docstring''' from typing import Callable, Dict, Optional, Tuple import torch from torch import nn from torch.distributions import ( AffineTransform, Distribution, Independent, NegativeBinomial, Normal, StudentT, TransformedDistribution, ) class __A ( UpperCame...
1
0
import warnings from ...utils import logging from .image_processing_glpn import GLPNImageProcessor UpperCamelCase__ = logging.get_logger(__name__) class A ( UpperCAmelCase_ ): def __init__(self : Any , *__UpperCAmelCase : Any , ...
65
'''simple docstring''' import math_equivalence # From: git+https://github.com/hendrycks/math.git import datasets SCREAMING_SNAKE_CASE_: Optional[Any] ='\\n@article{hendrycksmath2021,\n title={Measuring Mathematical Problem Solving With the MATH Dataset},\n author={Dan Hendrycks\n and Collin Burns\n ...
1
0
"""simple docstring""" def A_ ( _lowercase ): '''simple docstring''' return [ txt[:a] + txt[a].upper() + txt[a + 1 :] for a in range(len(_lowercase ) ) if txt[a].isalpha() ] if __name__ == "__main__": __import__("doctest").testmod()
66
'''simple docstring''' from copy import deepcopy import torch import torch.nn.functional as F from torch.optim import AdamW from torch.optim.lr_scheduler import LambdaLR from torch.utils.data import DataLoader from accelerate.accelerator import Accelerator from accelerate.state import GradientState from accelera...
1
0
'''simple docstring''' from __future__ import annotations def __lowerCAmelCase ( UpperCamelCase__ , UpperCamelCase__ = None , UpperCamelCase__ = None , UpperCamelCase__ = False , ) -> tuple[int, float, str]: __lowerCamelCase = cipher_alphabet or [chr(UpperCamelCase__ ) for i ...
67
'''simple docstring''' def lowerCAmelCase_ ( snake_case_ : int , snake_case_ : int ) -> int: '''simple docstring''' return x if y == 0 else greatest_common_divisor(snake_case_ , x % y ) def lowerCAmelCase_ ( snake_case_ : int , ...
1
0
import tempfile import unittest from pathlib import Path from shutil import copyfile from transformers import BatchEncoding, MarianTokenizer from transformers.testing_utils import get_tests_dir, require_sentencepiece, slow from transformers.utils import is_sentencepiece_available, is_tf_available, is_torch_available...
68
'''simple docstring''' import os from math import logaa def lowerCAmelCase_ ( snake_case_ : str = "base_exp.txt" ) -> int: '''simple docstring''' UpperCAmelCase_ = 0 UpperCAmelCase_ = 0 for i, line in enumerate(open(os.path.join(os.path...
1
0
"""simple docstring""" from __future__ import annotations from collections.abc import Generator def UpperCAmelCase ( ) -> Generator[int, None, None]: snake_case_ = {} snake_case_ = 2 while True: snake_case_ = factor_map.pop...
69
'''simple docstring''' 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_...
1
0
'''simple docstring''' import os import tempfile import unittest from transformers import DistilBertConfig, is_torch_available from transformers.testing_utils import require_torch, require_torch_gpu, slow, torch_device from ...test_configuration_common import ConfigTester from ...test...
70
'''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_ten...
1
0
from typing import TYPE_CHECKING from ...utils import OptionalDependencyNotAvailable, _LazyModule, is_tf_available, is_torch_available A_ :List[str] = { '''configuration_xlm''': ['''XLM_PRETRAINED_CONFIG_ARCHIVE_MAP''', '''XLMConfig''', '''XLMOnnxConfig'''], '''tokenizat...
71
'''simple docstring''' import os import shutil import tempfile from unittest import TestCase from unittest.mock import patch import numpy as np from datasets import Dataset from transformers.models.realm.configuration_realm import RealmConfig from transformers.models.realm.retrieval_realm import _REALM_BLOCK_REC...
1
0
"""simple docstring""" import warnings from typing import List, Optional, Union from ...processing_utils import ProcessorMixin from ...tokenization_utils_base import BatchEncoding, PaddingStrategy, PreTokenizedInput, TextInput, TruncationStrategy from ...utils import TensorType class __snake_cas...
72
'''simple docstring''' from math import log from scipy.constants import Boltzmann, physical_constants SCREAMING_SNAKE_CASE_: Optional[int] =3_00 # TEMPERATURE (unit = K) def lowerCAmelCase_ ( snake_case_ : float , snake_case_ : float , snake_case_ : float , ...
1
0
from math import isqrt def SCREAMING_SNAKE_CASE__ ( lowerCamelCase__ ) -> bool: return all(number % divisor != 0 for divisor in range(2 , isqrt(lowerCamelCase__ ) + 1 ) ) def SCREAMING_SNAKE_CASE__ ( lowerCamelCase__ = 1_0**6 ) -> int: __lowerCam...
73
'''simple docstring''' import math def lowerCAmelCase_ ( ) -> None: '''simple docstring''' UpperCAmelCase_ = input("Enter message: " ) UpperCAmelCase_ = int(input(f"""Enter key [2-{len(snake_case_ ) - 1}]: """ ) ) UpperCAmelCase_ ...
1
0
"""simple docstring""" from typing import TYPE_CHECKING from ...utils import OptionalDependencyNotAvailable, _LazyModule, is_tf_available, is_torch_available _lowercase = { '''configuration_groupvit''': [ '''GROUPVIT_PRETRAINED_CONFIG_ARCHIVE_MAP''', '''GroupViTConfig''', '...
74
'''simple docstring''' import json import logging import os import sys from pathlib import Path import finetune_rag from transformers.file_utils import is_apex_available from transformers.testing_utils import ( TestCasePlus, execute_subprocess_async, require_ray, require_torch_gpu, require_to...
1
0
'''simple docstring''' import json import pathlib import unittest import numpy as np from transformers.testing_utils import require_torch, require_vision, slow from transformers.utils import is_torch_available, is_vision_available from ...test_image_processing_common import ImageProcessingSavingTestMixin, p...
75
'''simple docstring''' from multiprocessing import Lock, Pipe, Process # lock used to ensure that two processes do not access a pipe at the same time SCREAMING_SNAKE_CASE_: Optional[int] =Lock() def lowerCAmelCase_ ( snake_case_ : Dict , snake_case_ : Dict , snake_case_...
1
0
import os from shutil import copyfile from typing import List, Optional, Tuple from tokenizers import processors from ...tokenization_utils import AddedToken, BatchEncoding from ...tokenization_utils_fast import PreTrainedTokenizerFast from ...utils import is_sentencepiece_available, logging if is_sentencepiece_a...
76
'''simple docstring''' def lowerCAmelCase_ ( snake_case_ : int , snake_case_ : int ) -> str: '''simple docstring''' if a < 0 or b < 0: raise ValueError("the value of both inputs must be positive" ) UpperCAmelCase_ = str(bin(snake_cas...
1
0
"""simple docstring""" # limitations under the License. from typing import Optional, Tuple, Union import torch from diffusers import DiffusionPipeline, ImagePipelineOutput class UpperCAmelCase_ ( _a): def __init__( self , a , a ) -> List[Any]: super().__in...
77
'''simple docstring''' from __future__ import annotations def lowerCAmelCase_ ( snake_case_ : list , snake_case_ : int | None = None , snake_case_ : int | None = None ) -> None: '''simple docstring''' if start is None: UpperCAmelCase_...
1
0
"""simple docstring""" from ...configuration_utils import PretrainedConfig from ...utils import logging snake_case_ = logging.get_logger(__name__) snake_case_ = { """facebook/dpr-ctx_encoder-single-nq-base""": ( """https://huggingface.co/facebook/dpr-ctx_e...
78
'''simple docstring''' from transformers import DistilBertTokenizer, DistilBertTokenizerFast from transformers.testing_utils import require_tokenizers, slow from ..bert.test_tokenization_bert import BertTokenizationTest @require_tokenizers class __A ( UpperCamelCase__ ): a__ : Optio...
1
0
'''simple docstring''' import argparse import torch from torch import nn from transformers import SpeechaTextConfig, SpeechaTextForConditionalGeneration def __lowercase ( __lowercase ) -> Dict: '''simple docstring''' _A = [ "encoder.version", ...
79
'''simple docstring''' import argparse import json from collections import OrderedDict from pathlib import Path import requests import torch from huggingface_hub import hf_hub_download from PIL import Image from transformers import ( ConditionalDetrConfig, ConditionalDetrForObjectDetection, Condition...
1
0
'''simple docstring''' from __future__ import annotations def _UpperCamelCase ( __A , __A , __A ) -> dict[str, float]: '''simple docstring''' if (voltage, current, resistance).count(0 ) != 1: raise ValueError("One and only one argument m...
80
'''simple docstring''' import warnings from ...utils import logging from .image_processing_clip import CLIPImageProcessor SCREAMING_SNAKE_CASE_: Union[str, Any] =logging.get_logger(__name__) class __A ( UpperCamelCase__ ): def __init__(self : int , *__a : Dict , *...
1
0
"""simple docstring""" import random import unittest import torch from diffusers import IFInpaintingPipeline from diffusers.utils import floats_tensor from diffusers.utils.import_utils import is_xformers_available from diffusers.utils.testing_utils import skip_mps, torch_device from .....
81
'''simple docstring''' from __future__ import annotations import queue class __A : def __init__(self : Optional[Any] , __a : str ): UpperCAmelCase_ = data UpperCAmelCase_ = None UpperCAmelCase_ = None def l...
1
0
def _UpperCAmelCase ( snake_case ): """simple docstring""" _lowerCAmelCase = """""" for ch in key: if ch == " " or ch not in key_no_dups and ch.isalpha(): key_no_dups += ch return key_no_dups def _UpperCAmelCase ( snake_case ): ...
82
'''simple docstring''' 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 s...
1
0
'''simple docstring''' from collections.abc import Generator def A__ ( ): _UpperCamelCase , _UpperCamelCase : Tuple = 0, 1 while True: _UpperCamelCase , _UpperCamelCase : Union[str, Any] = b, a + b yield b def A__ ( UpperC...
83
'''simple docstring''' import logging import os from dataclasses import dataclass from typing import List, Optional, Union import tqdm from filelock import FileLock from transformers import ( BartTokenizer, BartTokenizerFast, DataProcessor, PreTrainedTokenizer, RobertaTokenizer, RobertaTo...
1
0
"""simple docstring""" import unittest from transformers import DebertaVaTokenizer, DebertaVaTokenizerFast from transformers.testing_utils import get_tests_dir, require_sentencepiece, require_tokenizers, slow from ...test_tokenization_common import TokenizerTesterMixin __UpperCAmelCase ...
84
'''simple docstring''' from ...configuration_utils import PretrainedConfig from ...utils import logging SCREAMING_SNAKE_CASE_: Dict =logging.get_logger(__name__) SCREAMING_SNAKE_CASE_: Tuple ={} class __A ( UpperCamelCase__ ): a__ : int = """llama""" a__ ...
1
0
'''simple docstring''' import os from pathlib import Path from unittest.mock import patch import pytest import zstandard as zstd from datasets.download.download_config import DownloadConfig from datasets.utils.file_utils import ( OfflineModeIsEnabled, cached_path, fsspec_get, fsspec_head, ...
85
'''simple docstring''' import gc import random import unittest import numpy as np import torch from PIL import Image from transformers import CLIPTextConfig, CLIPTextModel, CLIPTokenizer from diffusers import AutoencoderKL, DDIMScheduler, DDPMScheduler, StableDiffusionUpscalePipeline, UNetaDConditionModel from d...
1
0
"""simple docstring""" def __lowerCAmelCase (_UpperCamelCase , _UpperCamelCase , _UpperCamelCase ): if principal <= 0: raise Exception('Principal borrowed must be > 0' ) if rate_per_annum < 0: raise Exception('Rate of interest must be >= 0' ) if years_to_repay <= 0 or not isinstan...
86
'''simple docstring''' from typing import Callable, Dict, Optional, Tuple import torch from torch import nn from torch.distributions import ( AffineTransform, Distribution, Independent, NegativeBinomial, Normal, StudentT, TransformedDistribution, ) class __A ( UpperCame...
1
0
from collections import OrderedDict from typing import Any, Mapping, Optional from ... import PreTrainedTokenizer from ...configuration_utils import PretrainedConfig from ...file_utils import TensorType, is_torch_available from ...onnx import OnnxConfig, OnnxConfigWithPast, OnnxSeqaSeqConfigWithPast from ...onn...
87
'''simple docstring''' import math_equivalence # From: git+https://github.com/hendrycks/math.git import datasets SCREAMING_SNAKE_CASE_: Optional[Any] ='\\n@article{hendrycksmath2021,\n title={Measuring Mathematical Problem Solving With the MATH Dataset},\n author={Dan Hendrycks\n and Collin Burns\n ...
1
0
import unittest from parameterized import parameterized from transformers import OpenLlamaConfig, is_torch_available, set_seed from transformers.testing_utils import require_torch, torch_device from ...generation.test_utils import GenerationTesterMixin from ...test_configuration_common import ConfigTester ...
88
'''simple docstring''' from copy import deepcopy import torch import torch.nn.functional as F from torch.optim import AdamW from torch.optim.lr_scheduler import LambdaLR from torch.utils.data import DataLoader from accelerate.accelerator import Accelerator from accelerate.state import GradientState from accelera...
1
0
'''simple docstring''' def __lowerCamelCase ( lowerCAmelCase_ = 3 , lowerCAmelCase_ = 7 , lowerCAmelCase_ = 1000000 ) -> int: _a : Tuple = 0 _a : List[Any] = 1 for current_denominator in range(1 , limit + 1 ): _a ...
89
'''simple docstring''' def lowerCAmelCase_ ( snake_case_ : int , snake_case_ : int ) -> int: '''simple docstring''' return x if y == 0 else greatest_common_divisor(snake_case_ , x % y ) def lowerCAmelCase_ ( snake_case_ : int , ...
1
0
class __lowerCAmelCase : """simple docstring""" def __init__( self , lowerCamelCase__ ) -> Any: '''simple docstring''' __lowerCamelCase = n __lowerCamelCase = [None] * self.n __lowerCamelCase ...
90
'''simple docstring''' import os from math import logaa def lowerCAmelCase_ ( snake_case_ : str = "base_exp.txt" ) -> int: '''simple docstring''' UpperCAmelCase_ = 0 UpperCAmelCase_ = 0 for i, line in enumerate(open(os.path.join(os.path...
1
0
"""simple docstring""" from dataclasses import dataclass from typing import List, Optional, Union import numpy as np import torch from ...utils import BaseOutput, OptionalDependencyNotAvailable, is_torch_available, is_transformers_available @dataclass class lowerCAmelCase__ ( UpperCAmelCa...
91
'''simple docstring''' 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_...
1
0
from __future__ import annotations from math import pi # Define the Reduced Planck Constant ℏ (H bar), speed of light C, value of # Pi and the function UpperCamelCase__ = 1.054571817E-34 # unit of ℏ : J * s UpperCamelCase__ = 3E8 # unit of c : m * s^-1 def _a ( SCREAMING_SNAK...
92
'''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_ten...
1
0
'''simple docstring''' from typing import Dict, List, Optional, Union import numpy as np from ...image_processing_utils import BaseImageProcessor, BatchFeature, get_size_dict from ...image_transforms import convert_to_rgb, normalize, rescale, resize, to_channel_dimension_format from ...image_ut...
93
'''simple docstring''' import os import shutil import tempfile from unittest import TestCase from unittest.mock import patch import numpy as np from datasets import Dataset from transformers.models.realm.configuration_realm import RealmConfig from transformers.models.realm.retrieval_realm import _REALM_BLOCK_REC...
1
0
from math import factorial def __lowerCamelCase ( UpperCAmelCase_ : int = 100 ): """simple docstring""" return sum(map(UpperCAmelCase_ , str(factorial(UpperCAmelCase_ ) ) ) ) if __name__ == "__main__": print(solution(int(input('''Enter the Number: ...
94
'''simple docstring''' from math import log from scipy.constants import Boltzmann, physical_constants SCREAMING_SNAKE_CASE_: Optional[int] =3_00 # TEMPERATURE (unit = K) def lowerCAmelCase_ ( snake_case_ : float , snake_case_ : float , snake_case_ : float , ...
1
0
UpperCAmelCase : Tuple = {0: [2, 3], 1: [0], 2: [1], 3: [4], 4: []} UpperCAmelCase : Optional[int] = {0: [1, 2, 3], 1: [2], 2: [0], 3: [4], 4: [5], 5: [3]} def _A ( SCREAMING_SNAKE_CASE : dict[int, list[int]] , SCREAMING_SNAKE_CASE : int ...
95
'''simple docstring''' import math def lowerCAmelCase_ ( ) -> None: '''simple docstring''' UpperCAmelCase_ = input("Enter message: " ) UpperCAmelCase_ = int(input(f"""Enter key [2-{len(snake_case_ ) - 1}]: """ ) ) UpperCAmelCase_ ...
1
0
"""simple docstring""" import os import tempfile from functools import partial from unittest import TestCase from unittest.mock import patch import numpy as np import pytest from datasets.arrow_dataset import Dataset from datasets.search import ElasticSearchIndex, FaissIndex, MissingI...
96
'''simple docstring''' import json import logging import os import sys from pathlib import Path import finetune_rag from transformers.file_utils import is_apex_available from transformers.testing_utils import ( TestCasePlus, execute_subprocess_async, require_ray, require_torch_gpu, require_to...
1
0
'''simple docstring''' import tempfile import numpy as np import torch from transformers import AutoTokenizer, TaEncoderModel from diffusers import DDPMScheduler, UNetaDConditionModel from diffusers.models.attention_processor import AttnAddedKVProcessor from diffusers.pipelines.deepfloyd_if import IFWatermarker fr...
97
'''simple docstring''' from multiprocessing import Lock, Pipe, Process # lock used to ensure that two processes do not access a pipe at the same time SCREAMING_SNAKE_CASE_: Optional[int] =Lock() def lowerCAmelCase_ ( snake_case_ : Dict , snake_case_ : Dict , snake_case_...
1
0
"""simple docstring""" # this script reports modified .py files under the desired list of top-level sub-dirs passed as a list of arguments, e.g.: # python ./utils/get_modified_files.py utils src tests examples # # it uses git to find the forking point and which files were modified - i.e. files not under git won...
98
'''simple docstring''' def lowerCAmelCase_ ( snake_case_ : int , snake_case_ : int ) -> str: '''simple docstring''' if a < 0 or b < 0: raise ValueError("the value of both inputs must be positive" ) UpperCAmelCase_ = str(bin(snake_cas...
1
0
lowercase : List[str] = tuple[float, float, float] lowercase : int = tuple[float, float, float] def A_ ( A__ , A__ ) -> Vectorad: a__ : Optional[int] = end_pointa[0] - end_pointa[0] a__ : str = end_pointa[1] - end_pointa[1] ...
99
'''simple docstring''' from __future__ import annotations def lowerCAmelCase_ ( snake_case_ : list , snake_case_ : int | None = None , snake_case_ : int | None = None ) -> None: '''simple docstring''' if start is None: UpperCAmelCase_...
1
0
"""simple docstring""" import json import os import subprocess import unittest from ast import literal_eval import pytest from parameterized import parameterized_class from . import is_sagemaker_available if is_sagemaker_available(): from sagemaker import Session, TrainingJobAnalytics from sagem...
100
'''simple docstring''' from transformers import DistilBertTokenizer, DistilBertTokenizerFast from transformers.testing_utils import require_tokenizers, slow from ..bert.test_tokenization_bert import BertTokenizationTest @require_tokenizers class __A ( UpperCamelCase__ ): a__ : Optio...
1
0
from __future__ import annotations import math import random from typing import Any class lowercase : def __init__( self): lowercase = [] lowercase = 0 lowercase = 0 def A__ ( self): return s...
101
'''simple docstring''' import argparse import json from collections import OrderedDict from pathlib import Path import requests import torch from huggingface_hub import hf_hub_download from PIL import Image from transformers import ( ConditionalDetrConfig, ConditionalDetrForObjectDetection, Condition...
1
0
"""simple docstring""" import contextlib import importlib import io import unittest import transformers # Try to import everything from transformers to ensure every object can be loaded. from transformers import * # noqa F406 from transformers.testing_utils import DUMMY_UNKNOWN_IDENTIFIER, require_flax, require_t...
102
'''simple docstring''' import warnings from ...utils import logging from .image_processing_clip import CLIPImageProcessor SCREAMING_SNAKE_CASE_: Union[str, Any] =logging.get_logger(__name__) class __A ( UpperCamelCase__ ): def __init__(self : int , *__a : Dict , *...
1
0
import warnings from typing import Any, Dict, List, Optional, Union import numpy as np from ...audio_utils import mel_filter_bank, optimal_fft_length, spectrogram, window_function from ...feature_extraction_sequence_utils import SequenceFeatureExtractor from ...feature_extraction_utils import BatchFeature from .....
103
'''simple docstring''' from __future__ import annotations import queue class __A : def __init__(self : Optional[Any] , __a : str ): UpperCAmelCase_ = data UpperCAmelCase_ = None UpperCAmelCase_ = None def l...
1
0
'''simple docstring''' from __future__ import annotations import time import numpy as np lowerCAmelCase__ = [8, 5, 9, 7] lowerCAmelCase__ = [ [2, 0, 1, 1], [0, 1, 2, 1], [4, 0, 0, 3], [0, 2, 1, 0], [1, 0, 3, 0], ] lowerCAmelCase__ = [ [3, 2, 1, 4], [0...
104
'''simple docstring''' 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 s...
1
0
"""simple docstring""" import unittest from diffusers.models.unet_ad_blocks import * # noqa F403 from diffusers.utils import torch_device from .test_unet_blocks_common import UNetBlockTesterMixin class __UpperCamelCase ( a__ , unittest.TestCase ): low...
105
'''simple docstring''' import logging import os from dataclasses import dataclass from typing import List, Optional, Union import tqdm from filelock import FileLock from transformers import ( BartTokenizer, BartTokenizerFast, DataProcessor, PreTrainedTokenizer, RobertaTokenizer, RobertaTo...
1
0
"""simple docstring""" __UpperCamelCase : Dict = ''' # Transformers installation ! pip install transformers datasets # To install from source instead of the last release, comment the command above and uncomment the following one. # ! pip install git+https://github.com/huggingface/transformers....
106
'''simple docstring''' from ...configuration_utils import PretrainedConfig from ...utils import logging SCREAMING_SNAKE_CASE_: Dict =logging.get_logger(__name__) SCREAMING_SNAKE_CASE_: Tuple ={} class __A ( UpperCamelCase__ ): a__ : int = """llama""" a__ ...
1
0
import math import unittest def __magic_name__ ( A : int ): '''simple docstring''' assert isinstance(A, A ) and ( number >= 0 ), "'number' must been an int and positive" if 1 < number < 4: # 2 and 3 are primes return True elif number < 2 or number...
107
'''simple docstring''' import gc import random import unittest import numpy as np import torch from PIL import Image from transformers import CLIPTextConfig, CLIPTextModel, CLIPTokenizer from diffusers import AutoencoderKL, DDIMScheduler, DDPMScheduler, StableDiffusionUpscalePipeline, UNetaDConditionModel from d...
1
0
"""simple docstring""" import secrets from random import shuffle from string import ascii_letters, ascii_lowercase, ascii_uppercase, digits, punctuation def a__ ( SCREAMING_SNAKE_CASE : int = 8 ): '''simple docstring''' lowerCAmelCase : List[str] = ascii_le...
108
'''simple docstring''' from typing import Callable, Dict, Optional, Tuple import torch from torch import nn from torch.distributions import ( AffineTransform, Distribution, Independent, NegativeBinomial, Normal, StudentT, TransformedDistribution, ) class __A ( UpperCame...
1
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,...
109
'''simple docstring''' import math_equivalence # From: git+https://github.com/hendrycks/math.git import datasets SCREAMING_SNAKE_CASE_: Optional[Any] ='\\n@article{hendrycksmath2021,\n title={Measuring Mathematical Problem Solving With the MATH Dataset},\n author={Dan Hendrycks\n and Collin Burns\n ...
1
0
from typing import TYPE_CHECKING from ...utils import ( OptionalDependencyNotAvailable, _LazyModule, is_sentencepiece_available, is_torch_available, ) lowerCAmelCase = { 'configuration_speecht5': [ 'SPEECHT5_PRETRAINED_CONFIG_ARCHIVE_MAP', 'SPEECHT5_...
110
'''simple docstring''' from copy import deepcopy import torch import torch.nn.functional as F from torch.optim import AdamW from torch.optim.lr_scheduler import LambdaLR from torch.utils.data import DataLoader from accelerate.accelerator import Accelerator from accelerate.state import GradientState from accelera...
1
0
"""simple docstring""" from __future__ import annotations import math def __lowercase ( snake_case_ : int ) ->list[int]: '''simple docstring''' if num <= 0: __A : Dict = F"""{num}: Invalid input, please enter a positive integer.""" ra...
179
'''simple docstring''' def lowerCAmelCase_ ( snake_case_ : int , snake_case_ : int ) -> int: '''simple docstring''' return x if y == 0 else greatest_common_divisor(snake_case_ , x % y ) def lowerCAmelCase_ ( snake_case_ : int , ...
1
0
import pytest from datasets import inspect_metric, list_metrics, load_metric @pytest.fixture def __snake_case ( _lowerCAmelCase : List[str] ) -> List[str]: monkeypatch.setattr("datasets.utils.deprecation_utils._emitted_deprecation_warnings" , set() ) @pytest.fixture def __snak...
300
'''simple docstring''' import os from math import logaa def lowerCAmelCase_ ( snake_case_ : str = "base_exp.txt" ) -> int: '''simple docstring''' UpperCAmelCase_ = 0 UpperCAmelCase_ = 0 for i, line in enumerate(open(os.path.join(os.path...
1
0
'''simple docstring''' 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 ...tes...
239
'''simple docstring''' 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_...
1
0
import unittest from transformers import SPIECE_UNDERLINE, XLNetTokenizer, XLNetTokenizerFast from transformers.testing_utils import get_tests_dir, require_sentencepiece, require_tokenizers, slow from ...test_tokenization_common import TokenizerTesterMixin A : int = get_tests_dir('fixtures...
305
'''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_ten...
1
0
"""simple docstring""" from typing import TYPE_CHECKING from ...utils import OptionalDependencyNotAvailable, _LazyModule, is_torch_available, is_vision_available lowerCAmelCase : Tuple = { 'configuration_maskformer': ['MASKFORMER_PRETRAINED_CONFIG_ARCHIVE_MAP', 'MaskFormerConfig...
291
'''simple docstring''' import os import shutil import tempfile from unittest import TestCase from unittest.mock import patch import numpy as np from datasets import Dataset from transformers.models.realm.configuration_realm import RealmConfig from transformers.models.realm.retrieval_realm import _REALM_BLOCK_REC...
1
0
from typing import TYPE_CHECKING from ...utils import OptionalDependencyNotAvailable, _LazyModule, is_torch_available __a = { 'configuration_x_clip': [ 'XCLIP_PRETRAINED_CONFIG_ARCHIVE_MAP', 'XCLIPConfig', 'XCLIPTextConfig', 'XCLIPVisionConfig', ], 'processing...
337
'''simple docstring''' from math import log from scipy.constants import Boltzmann, physical_constants SCREAMING_SNAKE_CASE_: Optional[int] =3_00 # TEMPERATURE (unit = K) def lowerCAmelCase_ ( snake_case_ : float , snake_case_ : float , snake_case_ : float , ...
1
0
'''simple docstring''' import itertools from dataclasses import dataclass from typing import Optional import pandas as pd import pyarrow as pa import datasets from datasets.table import table_cast @dataclass class A__ ( datasets.BuilderConfig ): """simple docstring""" Uppe...
145
'''simple docstring''' import math def lowerCAmelCase_ ( ) -> None: '''simple docstring''' UpperCAmelCase_ = input("Enter message: " ) UpperCAmelCase_ = int(input(f"""Enter key [2-{len(snake_case_ ) - 1}]: """ ) ) UpperCAmelCase_ ...
1
0
'''simple docstring''' import numpy as np lowerCamelCase : Dict = [ ['a', 'b', 'c', 'd', 'e'], ['f', 'g', 'h', 'i', 'k'], ['l', 'm', 'n', 'o', 'p'], ['q', 'r', 's', 't', 'u'], ['v', 'w', 'x', 'y', 'z'], ] class A__ : def __init__( self : Tuple ) -> L...
47
'''simple docstring''' import json import logging import os import sys from pathlib import Path import finetune_rag from transformers.file_utils import is_apex_available from transformers.testing_utils import ( TestCasePlus, execute_subprocess_async, require_ray, require_torch_gpu, require_to...
1
0
from ...configuration_utils import PretrainedConfig from ...utils import logging from ...utils.backbone_utils import BackboneConfigMixin, get_aligned_output_features_output_indices __lowerCamelCase : Optional[Any] = logging.get_logger(__name__) __lowerCamelCase : List[Any] = { ...
52
'''simple docstring''' from multiprocessing import Lock, Pipe, Process # lock used to ensure that two processes do not access a pipe at the same time SCREAMING_SNAKE_CASE_: Optional[int] =Lock() def lowerCAmelCase_ ( snake_case_ : Dict , snake_case_ : Dict , snake_case_...
1
0
"""simple docstring""" 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.preproc...
150
'''simple docstring''' def lowerCAmelCase_ ( snake_case_ : int , snake_case_ : int ) -> str: '''simple docstring''' if a < 0 or b < 0: raise ValueError("the value of both inputs must be positive" ) UpperCAmelCase_ = str(bin(snake_cas...
1
0
"""simple docstring""" def _snake_case ( lowercase__ ): return 10 - x * x def _snake_case ( lowercase__ , lowercase__ ): if equation(snake_case_ ) * equation(snake_case_ ) >= 0: raise ValueError('Wrong space!' ) _l...
96
'''simple docstring''' from __future__ import annotations def lowerCAmelCase_ ( snake_case_ : list , snake_case_ : int | None = None , snake_case_ : int | None = None ) -> None: '''simple docstring''' if start is None: UpperCAmelCase_...
1
0
"""simple docstring""" import unittest import numpy as np from transformers import DistilBertConfig, is_flax_available from transformers.testing_utils import require_flax, slow from ...test_modeling_flax_common import FlaxModelTesterMixin, ids_tensor, random_attention_mask if is_flax_available(): i...
179
'''simple docstring''' from transformers import DistilBertTokenizer, DistilBertTokenizerFast from transformers.testing_utils import require_tokenizers, slow from ..bert.test_tokenization_bert import BertTokenizationTest @require_tokenizers class __A ( UpperCamelCase__ ): a__ : Optio...
1
0
import os from shutil import copyfile from typing import Any, Dict, List, Optional, Tuple import sentencepiece as spm from ...tokenization_utils import PreTrainedTokenizer from ...utils import logging _lowerCAmelCase : Optional[Any] = logging.get_logger(__name__) _lowerCAmelCase : D...
300
'''simple docstring''' import argparse import json from collections import OrderedDict from pathlib import Path import requests import torch from huggingface_hub import hf_hub_download from PIL import Image from transformers import ( ConditionalDetrConfig, ConditionalDetrForObjectDetection, Condition...
1
0
'''simple docstring''' import gc import random import tempfile import unittest import numpy as np import torch from PIL import Image from transformers import CLIPTextConfig, CLIPTextModel, CLIPTokenizer from diffusers import ( AutoencoderKL, ControlNetModel, DDIMScheduler, StableDiffusionControlNe...
239
'''simple docstring''' import warnings from ...utils import logging from .image_processing_clip import CLIPImageProcessor SCREAMING_SNAKE_CASE_: Union[str, Any] =logging.get_logger(__name__) class __A ( UpperCamelCase__ ): def __init__(self : int , *__a : Dict , *...
1
0
import warnings from diffusers import StableDiffusionImgaImgPipeline # noqa F401 warnings.warn( 'The `image_to_image.py` script is outdated. Please use directly `from diffusers import' ' StableDiffusionImg2ImgPipeline` instead.' )
305
'''simple docstring''' from __future__ import annotations import queue class __A : def __init__(self : Optional[Any] , __a : str ): UpperCAmelCase_ = data UpperCAmelCase_ = None UpperCAmelCase_ = None def l...
1
0
"""simple docstring""" import torch from diffusers import UnCLIPScheduler from .test_schedulers import SchedulerCommonTest class __magic_name__ ( UpperCamelCase__ ): '''simple docstring''' __UpperCamelCase = (UnCLIPScheduler,) def _lowerCAmelCase ...
291
'''simple docstring''' 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 s...
1
0
from __future__ import annotations def __lowercase ( _UpperCamelCase, _UpperCamelCase ) ->list[str]: """simple docstring""" if partitions <= 0: raise ValueError('''partitions must be a positive number!''' ) if partitions > number_of_bytes: raise ValueE...
337
'''simple docstring''' import logging import os from dataclasses import dataclass from typing import List, Optional, Union import tqdm from filelock import FileLock from transformers import ( BartTokenizer, BartTokenizerFast, DataProcessor, PreTrainedTokenizer, RobertaTokenizer, RobertaTo...
1
0
'''simple docstring''' import logging import os from dataclasses import dataclass from typing import List, Optional, Union import tqdm from filelock import FileLock from transformers import ( BartTokenizer, BartTokenizerFast, DataProcessor, PreTrainedTokenizer, RobertaTokenizer, RobertaT...
145
'''simple docstring''' from ...configuration_utils import PretrainedConfig from ...utils import logging SCREAMING_SNAKE_CASE_: Dict =logging.get_logger(__name__) SCREAMING_SNAKE_CASE_: Tuple ={} class __A ( UpperCamelCase__ ): a__ : int = """llama""" a__ ...
1
0
'''simple docstring''' import argparse import torch from transformers import ( WavaVecaConfig, WavaVecaFeatureExtractor, WavaVecaForAudioFrameClassification, WavaVecaForSequenceClassification, WavaVecaForXVector, logging, ) logging.set_verbosity_info() lowerCamelCase : Optional[int] ...
47
'''simple docstring''' import gc import random import unittest import numpy as np import torch from PIL import Image from transformers import CLIPTextConfig, CLIPTextModel, CLIPTokenizer from diffusers import AutoencoderKL, DDIMScheduler, DDPMScheduler, StableDiffusionUpscalePipeline, UNetaDConditionModel from d...
1
0
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, ) __lowerCamelCase : Dict = { 'configuration_albert':...
52
'''simple docstring''' from typing import Callable, Dict, Optional, Tuple import torch from torch import nn from torch.distributions import ( AffineTransform, Distribution, Independent, NegativeBinomial, Normal, StudentT, TransformedDistribution, ) class __A ( UpperCame...
1
0
"""simple docstring""" import gc import unittest import numpy as np import torch from torch.backends.cuda import sdp_kernel from diffusers import ( CMStochasticIterativeScheduler, ConsistencyModelPipeline, UNetaDModel, ) from diffusers.utils import randn_tensor, slow, torch_device from diffu...
150
'''simple docstring''' import math_equivalence # From: git+https://github.com/hendrycks/math.git import datasets SCREAMING_SNAKE_CASE_: Optional[Any] ='\\n@article{hendrycksmath2021,\n title={Measuring Mathematical Problem Solving With the MATH Dataset},\n author={Dan Hendrycks\n and Collin Burns\n ...
1
0
"""simple docstring""" import json import os import unittest from transformers.models.biogpt.tokenization_biogpt import VOCAB_FILES_NAMES, BioGptTokenizer from transformers.testing_utils import slow from ...test_tokenization_common import TokenizerTesterMixin class lowerCAme...
96
'''simple docstring''' from copy import deepcopy import torch import torch.nn.functional as F from torch.optim import AdamW from torch.optim.lr_scheduler import LambdaLR from torch.utils.data import DataLoader from accelerate.accelerator import Accelerator from accelerate.state import GradientState from accelera...
1
0
"""simple docstring""" def __lowercase ( snake_case_ : int ,snake_case_ : int ) ->int: '''simple docstring''' return x if y == 0 else greatest_common_divisor(snake_case_ ,x % y ) def __lowercase ( snake_case_ : int ,snake_case_ : int ) ...
179
'''simple docstring''' def lowerCAmelCase_ ( snake_case_ : int , snake_case_ : int ) -> int: '''simple docstring''' return x if y == 0 else greatest_common_divisor(snake_case_ , x % y ) def lowerCAmelCase_ ( snake_case_ : int , ...
1
0
import gc import random import unittest import numpy as np import torch from PIL import Image from transformers import CLIPTextConfig, CLIPTextModel, CLIPTokenizer from diffusers import AutoencoderKL, DDIMScheduler, DDPMScheduler, StableDiffusionUpscalePipeline, UNetaDConditionModel from diffusers.utils import ...
300
'''simple docstring''' import os from math import logaa def lowerCAmelCase_ ( snake_case_ : str = "base_exp.txt" ) -> int: '''simple docstring''' UpperCAmelCase_ = 0 UpperCAmelCase_ = 0 for i, line in enumerate(open(os.path.join(os.path...
1
0
'''simple docstring''' def lowerCamelCase ( UpperCAmelCase__ : list , UpperCAmelCase__ : int , UpperCAmelCase__ : int = 0 , UpperCAmelCase__ : int = 0 ) -> int: lowercase_ : List[str] = right or len(...
239
'''simple docstring''' 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_...
1
0
from __future__ import annotations A : List[str] = { 'A': ['B', 'C', 'E'], 'B': ['A', 'D', 'E'], 'C': ['A', 'F', 'G'], 'D': ['B'], 'E': ['A', 'B', 'D'], 'F': ['C'], 'G': ['C'], } class A : '''simple docstring''' def __init...
305
'''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_ten...
1
0
"""simple docstring""" from __future__ import annotations def a__ ( snake_case__ , snake_case__ , snake_case__ , snake_case__ ) -> None: if (direction == 1 and array[indexa] > array[indexa]) or ( direction == 0 and array[indexa] < array[indexa] ): ...
291
'''simple docstring''' import os import shutil import tempfile from unittest import TestCase from unittest.mock import patch import numpy as np from datasets import Dataset from transformers.models.realm.configuration_realm import RealmConfig from transformers.models.realm.retrieval_realm import _REALM_BLOCK_REC...
1
0
from __future__ import annotations __a = [] def __lowercase ( _UpperCamelCase, _UpperCamelCase, _UpperCamelCase ) ->bool: """simple docstring""" for i in range(len(snake_case_ ) ): if board[row][i] == 1: return False for i in range...
337
'''simple docstring''' from math import log from scipy.constants import Boltzmann, physical_constants SCREAMING_SNAKE_CASE_: Optional[int] =3_00 # TEMPERATURE (unit = K) def lowerCAmelCase_ ( snake_case_ : float , snake_case_ : float , snake_case_ : float , ...
1
0
'''simple docstring''' import tempfile import unittest from transformers import SPIECE_UNDERLINE, BatchEncoding, PLBartTokenizer, is_torch_available from transformers.testing_utils import ( get_tests_dir, nested_simplify, require_sentencepiece, require_tokenizers, require_torch, ) from ...te...
145
'''simple docstring''' import math def lowerCAmelCase_ ( ) -> None: '''simple docstring''' UpperCAmelCase_ = input("Enter message: " ) UpperCAmelCase_ = int(input(f"""Enter key [2-{len(snake_case_ ) - 1}]: """ ) ) UpperCAmelCase_ ...
1
0
'''simple docstring''' import argparse import requests import torch from PIL import Image from transformers import CLIPProcessor, GroupViTConfig, GroupViTModel def _lowerCAmelCase ( _UpperCamelCase : int ) -> List[str]: """simple docstring""" if "img_encoder.pos_em...
47
'''simple docstring''' import json import logging import os import sys from pathlib import Path import finetune_rag from transformers.file_utils import is_apex_available from transformers.testing_utils import ( TestCasePlus, execute_subprocess_async, require_ray, require_torch_gpu, require_to...
1
0