code
stringlengths
82
54.1k
code_codestyle
int64
0
699
style_context
stringlengths
111
35.6k
style_context_codestyle
int64
0
699
label
int64
0
1
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, is_vision_available...
0
"""simple docstring""" from sklearn.metrics import matthews_corrcoef import datasets __UpperCAmelCase = ''' Compute the Matthews correlation coefficient (MCC) The Matthews correlation coefficient is used in machine learning as a measure of the quality of binary and multiclass classifications. It ...
642
0
from __future__ import annotations from collections.abc import Callable def _A ( _lowercase , _lowercase , _lowercase , _lowercase = 1_00 , ) -> float: """simple docstring""" __UpperCamelCase = x_start __UpperCamelCase = fnc(_lowercase ) ...
1
"""simple docstring""" 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_...
642
0
from typing import Optional import torch import torch.utils.checkpoint from torch import Tensor, nn from torch.nn import BCEWithLogitsLoss, CrossEntropyLoss, MSELoss from ...activations import ACTaFN from ...modeling_outputs import ( BackboneOutput, BaseModelOutputWithNoAttention, BaseM...
2
"""simple docstring""" import numpy as np from transformers import BatchFeature from transformers.testing_utils import require_tf, require_torch from .test_feature_extraction_common import FeatureExtractionSavingTestMixin class __UpperCAmelCase ( _UpperCamelCase ): # to overwrite a...
642
0
'''simple docstring''' import argparse import random import joblib import numpy as np import torch from igf.igf import ( SecondaryLearner, collect_objective_set, compute_perplexity, generate_datasets, load_gpta, recopy_gpta, set_seed, train_secondary_learner, ) from t...
3
"""simple docstring""" from typing import TYPE_CHECKING # rely on isort to merge the imports from ...utils import OptionalDependencyNotAvailable, _LazyModule, is_torch_available __UpperCAmelCase = { '''configuration_informer''': [ '''INFORMER_PRETRAINED_CONFIG_ARCHIVE_MAP''', '...
642
0
"""simple docstring""" from scipy.stats import pearsonr import datasets __UpperCamelCase : Tuple = ''' Pearson correlation coefficient and p-value for testing non-correlation. The Pearson correlation coefficient measures the linear relationship between two datasets. The calculation of the...
4
"""simple docstring""" import pytest import datasets # Import fixture modules as plugins __UpperCAmelCase = ['''tests.fixtures.files''', '''tests.fixtures.hub''', '''tests.fixtures.fsspec'''] def lowercase__ ( lowerCAmelCase__ : Optional[Any] , lowerCAmelCase__ : str...
642
0
'''simple docstring''' import unittest from transformers import BarthezTokenizer, BarthezTokenizerFast, BatchEncoding from transformers.testing_utils import require_sentencepiece, require_tokenizers, require_torch, slow from ...test_tokenization_common import TokenizerTesterMixin @require_tokenizers @require_...
5
"""simple docstring""" import functools def lowercase__ ( lowerCAmelCase__ : str , lowerCAmelCase__ : str ) -> int: '''simple docstring''' a__ : Any = len(lowerCAmelCase__ ) a__ : Optional[int] = len(lowerCAmelCase__ ) @functools.cache d...
642
0
def SCREAMING_SNAKE_CASE__ ( UpperCamelCase__: float , UpperCamelCase__: float ): if mass < 0: raise ValueError("""The mass of a body cannot be negative""" ) return 0.5 * mass * abs(UpperCamelCase__ ) * abs(UpperCamelCase__ ) if __name__ == "__main__": import d...
6
"""simple docstring""" def lowercase__ ( lowerCAmelCase__ : str ) -> list[int]: '''simple docstring''' a__ : List[str] = [0 for i in range(len(lowerCAmelCase__ ) )] # initialize interval's left pointer and right pointer a__ , a__ : int = 0, 0 for i in ra...
642
0
"""simple docstring""" from collections import Counter from pathlib import Path from typing import Optional, Tuple import yaml class lowercase_ ( yaml.SafeLoader ): '''simple docstring''' def lowerCAmelCase_ ( self : List[str] , _UpperCAmelCase : List[Any] ...
7
"""simple docstring""" import os import unicodedata 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 SPIECE_UNDERLINE, logging __UpperCAmelCase = loggi...
642
0
'''simple docstring''' import unittest import torch from diffusers import DDIMScheduler, DDPMScheduler, UNetaDModel from diffusers.training_utils import set_seed from diffusers.utils.testing_utils import slow lowercase__ : List[Any] = False class SCREAMING...
8
"""simple docstring""" import argparse import pickle import numpy as np import torch from torch import nn from transformers import ReformerConfig, ReformerModelWithLMHead from transformers.utils import logging logging.set_verbosity_info() def lowercase__ ( lowerCAmelCase__ : Union[str...
642
0
from collections import UserDict from typing import List, Union from ..utils import ( add_end_docstrings, is_tf_available, is_torch_available, is_vision_available, logging, requires_backends, ) from .base import PIPELINE_INIT_ARGS, Pipeline if is_vision_available(): from PIL import...
9
"""simple docstring""" import os def lowercase__ ( ) -> Optional[Any]: '''simple docstring''' with open(os.path.dirname(lowerCAmelCase__ ) + "/p022_names.txt" ) as file: a__ : Optional[int] = str(file.readlines()[0] ) a__ : Optional[int] = names.repla...
642
0
from typing import TYPE_CHECKING # rely on isort to merge the imports from ...utils import OptionalDependencyNotAvailable, _LazyModule, is_torch_available _lowerCAmelCase = {"configuration_focalnet": ["FOCALNET_PRETRAINED_CONFIG_ARCHIVE_MAP", "FocalNetConfig"]} try: if not is_torch_available(): ...
10
"""simple docstring""" from typing import List, Optional, Union import numpy as np import tensorflow as tf from .utils import logging __UpperCAmelCase = logging.get_logger(__name__) def lowercase__ ( lowerCAmelCase__ : Union[tf.Tensor, np.ndarray] ) -> List[int]: '...
642
0
'''simple docstring''' from collections import OrderedDict from ...utils import logging from .auto_factory import _BaseAutoModelClass, _LazyAutoMapping, auto_class_update from .configuration_auto import CONFIG_MAPPING_NAMES lowercase_ = logging.get_logger(__name__) lowercase_ = Order...
11
"""simple docstring""" import tempfile import unittest import numpy as np from diffusers import ( DDIMScheduler, DPMSolverMultistepScheduler, EulerAncestralDiscreteScheduler, EulerDiscreteScheduler, LMSDiscreteScheduler, OnnxStableDiffusionPipeline, PNDMScheduler, ) from diffus...
642
0
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 AutoTo...
12
"""simple docstring""" from __future__ import annotations def lowercase__ ( lowerCAmelCase__ : int ) -> list[int]: '''simple docstring''' a__ : Tuple = [True] * limit a__ : Tuple = False a__ : int = False a__ : Tuple = True for i in range(3...
642
0
'''simple docstring''' import argparse import os import transformers from .convert_slow_tokenizer import SLOW_TO_FAST_CONVERTERS from .utils import logging logging.set_verbosity_info() A__ : Union[str, Any] = logging.get_logger(__name__) A__ : Union[str, Any] = {name: getattr(tran...
13
"""simple docstring""" __UpperCAmelCase = [ [0, 16, 13, 0, 0, 0], [0, 0, 10, 12, 0, 0], [0, 4, 0, 0, 14, 0], [0, 0, 9, 0, 0, 20], [0, 0, 0, 7, 0, 4], [0, 0, 0, 0, 0, 0], ] def lowercase__ ( lowerCAmelCase__ : Dict , lowerCAmelCase__ : Optional[in...
642
0
import argparse import json import os from collections import OrderedDict import torch from transformers import LukeConfig, LukeForMaskedLM, MLukeTokenizer, XLMRobertaTokenizer from transformers.tokenization_utils_base import AddedToken @torch.no_grad() def __UpperCAmelCase ( __a : ...
14
"""simple docstring""" import unittest from transformers import load_tool from .test_tools_common import ToolTesterMixin class __UpperCAmelCase ( unittest.TestCase , _UpperCamelCase ): def UpperCAmelCase ( self : Dict ) -> List[Any]: '''simple do...
642
0
import argparse import json import os import sys import tempfile import unittest from argparse import Namespace from dataclasses import dataclass, field from enum import Enum from pathlib import Path from typing import List, Literal, Optional import yaml from transformers import HfArgumentParser, ...
15
"""simple docstring""" import unittest import torch from diffusers import DDIMScheduler, DDPMScheduler, UNetaDModel from diffusers.training_utils import set_seed from diffusers.utils.testing_utils import slow __UpperCAmelCase = False class __UpperCAmelCase ( unittest.TestCase ...
642
0
def __a ( A__ : int ): if num <= 0: raise ValueError("Input must be a positive integer" ) SCREAMING_SNAKE_CASE = [True] * (num + 1) SCREAMING_SNAKE_CASE = 2 while p * p <= num: if primes[p]: for i in range(p * p ...
16
"""simple docstring""" import argparse import re import torch from CLAP import create_model from transformers import AutoFeatureExtractor, ClapConfig, ClapModel __UpperCAmelCase = { '''text_branch''': '''text_model''', '''audio_branch''': '''audio_model.audio_encoder''', '''attn''': '...
642
0
import unittest from transformers import JukeboxTokenizer from transformers.testing_utils import require_torch class lowerCamelCase_ ( unittest.TestCase ): _lowercase : List[str] = JukeboxTokenizer _lowercase : Any = { '''artist''': '''Zac Brown Band''', '''g...
17
"""simple docstring""" from __future__ import annotations def lowercase__ ( lowerCAmelCase__ : int , lowerCAmelCase__ : int ) -> tuple[int, int]: '''simple docstring''' if b == 0: return (1, 0) ((a__) , (a__)) : List[Any] = extended_euclid(lowerCA...
642
0
'''simple docstring''' from collections import namedtuple _SCREAMING_SNAKE_CASE = namedtuple("from_to", "from_ to") _SCREAMING_SNAKE_CASE = { "cubicmeter": from_to(1, 1), "litre": from_to(0.001, 10_00), "kilolitre": from_to(1, 1), "gallon": from_to(0.0_0454, 264.172), ...
18
"""simple docstring""" from typing import List, Union import numpy as np from ..tokenization_utils import TruncationStrategy from ..utils import add_end_docstrings, logging from .base import PIPELINE_INIT_ARGS, ArgumentHandler, ChunkPipeline __UpperCAmelCase = logging.get_logger(__name__) clas...
642
0
"""simple docstring""" from collections import defaultdict from math import gcd def lowerCamelCase__ ( __snake_case = 1_50_00_00 ) -> int: """simple docstring""" _UpperCamelCase = defaultdict(__snake_case ) _UpperCamelCase ...
19
"""simple docstring""" from maths.is_square_free import is_square_free from maths.prime_factors import prime_factors def lowercase__ ( lowerCAmelCase__ : int ) -> int: '''simple docstring''' a__ : Tuple = prime_factors(lowerCAmelCase__ ) if is_square_free(lowerCA...
642
0
import pytest import datasets.config from datasets.utils.info_utils import is_small_dataset @pytest.mark.parametrize('dataset_size' , [None, 400 * 2**20, 600 * 2**20] ) @pytest.mark.parametrize('input_in_memory_max_size' , ['default', 0, 100 * 2**20, 900 * 2**20] ) def _lowercase( ...
20
"""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 IFWater...
642
0
from sklearn.metrics import matthews_corrcoef import datasets UpperCAmelCase_ : Dict = "\nCompute the Matthews correlation coefficient (MCC)\n\nThe Matthews correlation coefficient is used in machine learning as a\nmeasure of the quality of binary and multiclass classifications. It take...
21
"""simple docstring""" import json import os from functools import lru_cache from typing import TYPE_CHECKING, List, Optional, Tuple import regex as re from ...tokenization_utils import AddedToken, PreTrainedTokenizer from ...utils import logging if TYPE_CHECKING: from transformers.pipelines.conversat...
642
0
'''simple docstring''' import argparse import collections import os 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_table.py _snake_case : Option...
22
"""simple docstring""" from sklearn.metrics import matthews_corrcoef import datasets __UpperCAmelCase = ''' Compute the Matthews correlation coefficient (MCC) The Matthews correlation coefficient is used in machine learning as a measure of the quality of binary and multiclass classifications. It ...
642
0
from __future__ import annotations import math import random from typing import Any class _a : """simple docstring""" def __init__( self ) -> None: UpperCamelCase_ = [] UpperCamelCase_ = 0 UpperCamelCase_ = 0 ...
23
"""simple docstring""" 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_...
642
0
'''simple docstring''' import os import unittest from transformers import FunnelTokenizer, FunnelTokenizerFast from transformers.models.funnel.tokenization_funnel import VOCAB_FILES_NAMES from transformers.testing_utils import require_tokenizers from ...test_tokenization_common import TokenizerTesterMixin ...
24
"""simple docstring""" import numpy as np from transformers import BatchFeature from transformers.testing_utils import require_tf, require_torch from .test_feature_extraction_common import FeatureExtractionSavingTestMixin class __UpperCAmelCase ( _UpperCamelCase ): # to overwrite a...
642
0
def lowerCamelCase__ ( _a): if not isinstance(_a , _a): raise ValueError("multiplicative_persistence() only accepts integral values") if num < 0: raise ValueError("multiplicative_persistence() does not accept negative values") SCREAMING_SNAKE_CASE : int = 0 SCREAMING_SNAKE_C...
25
"""simple docstring""" from typing import TYPE_CHECKING # rely on isort to merge the imports from ...utils import OptionalDependencyNotAvailable, _LazyModule, is_torch_available __UpperCAmelCase = { '''configuration_informer''': [ '''INFORMER_PRETRAINED_CONFIG_ARCHIVE_MAP''', '...
642
0
'''simple docstring''' import os from argparse import ArgumentParser, Namespace from ..data import SingleSentenceClassificationProcessor as Processor from ..pipelines import TextClassificationPipeline from ..utils import is_tf_available, is_torch_available, logging from . import BaseTran...
26
"""simple docstring""" import pytest import datasets # Import fixture modules as plugins __UpperCAmelCase = ['''tests.fixtures.files''', '''tests.fixtures.hub''', '''tests.fixtures.fsspec'''] def lowercase__ ( lowerCAmelCase__ : Optional[Any] , lowerCAmelCase__ : str...
642
0
import json import os from pathlib import Path import pytest from datasets.download.download_config import DownloadConfig from datasets.download.download_manager import DownloadManager from datasets.utils.file_utils import hash_url_to_filename __A : List[Any] = "http://www.m...
27
"""simple docstring""" import functools def lowercase__ ( lowerCAmelCase__ : str , lowerCAmelCase__ : str ) -> int: '''simple docstring''' a__ : Any = len(lowerCAmelCase__ ) a__ : Optional[int] = len(lowerCAmelCase__ ) @functools.cache d...
642
0
'''simple docstring''' import math import os from copy import deepcopy import datasets import evaluate import torch import transformers from datasets import load_dataset from torch.utils.data import DataLoader from transformers import AutoModelForSequenceClassification, AutoTokenizer from...
28
"""simple docstring""" def lowercase__ ( lowerCAmelCase__ : str ) -> list[int]: '''simple docstring''' a__ : List[str] = [0 for i in range(len(lowerCAmelCase__ ) )] # initialize interval's left pointer and right pointer a__ , a__ : int = 0, 0 for i in ra...
642
0
"""simple docstring""" import math def lowercase ( lowerCAmelCase__ ): lowerCamelCase_ = [True] * n lowerCamelCase_ = False lowerCamelCase_ = False lowerCamelCase_ = True for i in range(3 ,int(n**0.5 + 1 ) ,2 ): lowerCamelCase_ = i * 2 w...
29
"""simple docstring""" import os import unicodedata 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 SPIECE_UNDERLINE, logging __UpperCAmelCase = loggi...
642
0
import torch from diffusers import CMStochasticIterativeScheduler from .test_schedulers import SchedulerCommonTest class __a( _a ): """simple docstring""" lowerCAmelCase = (CMStochasticIterativeScheduler,) lowerCAmelCase = 10 def a__ ( self ,**_SCREAMING...
30
"""simple docstring""" import argparse import pickle import numpy as np import torch from torch import nn from transformers import ReformerConfig, ReformerModelWithLMHead from transformers.utils import logging logging.set_verbosity_info() def lowercase__ ( lowerCAmelCase__ : Union[str...
642
0
from __future__ import annotations import math from collections.abc import Callable def UpperCAmelCase_ ( __UpperCAmelCase : Callable[[int | float], int | float] , __UpperCAmelCase : int | float , __UpperCAmelCase : int | float , __UpperCAmelCase : int = 1_00...
31
"""simple docstring""" import os def lowercase__ ( ) -> Optional[Any]: '''simple docstring''' with open(os.path.dirname(lowerCAmelCase__ ) + "/p022_names.txt" ) as file: a__ : Optional[int] = str(file.readlines()[0] ) a__ : Optional[int] = names.repla...
642
0
import os import sys from contextlib import contextmanager # Windows only if os.name == "nt": import ctypes import msvcrt # noqa class __UpperCamelCase ( ctypes.Structure ): # _fields is a specific attr expected by ctypes __A : int = [("""size""", ctypes.c...
32
"""simple docstring""" from typing import List, Optional, Union import numpy as np import tensorflow as tf from .utils import logging __UpperCAmelCase = logging.get_logger(__name__) def lowercase__ ( lowerCAmelCase__ : Union[tf.Tensor, np.ndarray] ) -> List[int]: '...
642
0
from datetime import datetime import requests from bsa import BeautifulSoup if __name__ == "__main__": lowerCamelCase__ : List[Any] = input("""Enter image url: """).strip() print(F"""Downloading image from {url} ...""") lowerCamelCase__ : Optional[int] ...
33
"""simple docstring""" import tempfile import unittest import numpy as np from diffusers import ( DDIMScheduler, DPMSolverMultistepScheduler, EulerAncestralDiscreteScheduler, EulerDiscreteScheduler, LMSDiscreteScheduler, OnnxStableDiffusionPipeline, PNDMScheduler, ) from diffus...
642
0
"""simple docstring""" # XXX: we want transformers master here - in the absense of conftest manipulating sys.path: # hack it in for now: import sys from pathlib import Path SCREAMING_SNAKE_CASE_ = Path(__file__).resolve().parents[3] / 'src' sys.path.insert(1, str(git_repo_path)) import datacla...
34
"""simple docstring""" from __future__ import annotations def lowercase__ ( lowerCAmelCase__ : int ) -> list[int]: '''simple docstring''' a__ : Tuple = [True] * limit a__ : Tuple = False a__ : int = False a__ : Tuple = True for i in range(3...
642
0
import json import os import subprocess import unittest from ast import literal_eval import pytest from parameterized import parameterized, parameterized_class from . import is_sagemaker_available if is_sagemaker_available(): from sagemaker import Session, TrainingJobAnalytics from sagemaker.huggingface ...
35
"""simple docstring""" __UpperCAmelCase = [ [0, 16, 13, 0, 0, 0], [0, 0, 10, 12, 0, 0], [0, 4, 0, 0, 14, 0], [0, 0, 9, 0, 0, 20], [0, 0, 0, 7, 0, 4], [0, 0, 0, 0, 0, 0], ] def lowercase__ ( lowerCAmelCase__ : Dict , lowerCAmelCase__ : Optional[in...
642
0
import string def lowercase ( __A : str ) -> str: '''simple docstring''' snake_case : Union[str, Any] = """""" for i in sequence: snake_case : Optional[int] = ord(__A ) if 65 <= extract <= 90: output += chr(155 ...
36
"""simple docstring""" import unittest from transformers import load_tool from .test_tools_common import ToolTesterMixin class __UpperCAmelCase ( unittest.TestCase , _UpperCamelCase ): def UpperCAmelCase ( self : Dict ) -> List[Any]: '''simple do...
642
0
import json from typing import List, Optional, Tuple from tokenizers import normalizers from ...tokenization_utils_base import BatchEncoding from ...tokenization_utils_fast import PreTrainedTokenizerFast from ...utils import PaddingStrategy, logging from .tokenization_realm import RealmTokenizer UpperCamelCase ...
37
"""simple docstring""" import unittest import torch from diffusers import DDIMScheduler, DDPMScheduler, UNetaDModel from diffusers.training_utils import set_seed from diffusers.utils.testing_utils import slow __UpperCAmelCase = False class __UpperCAmelCase ( unittest.TestCase ...
642
0
'''simple docstring''' from ..utils import DummyObject, requires_backends class __snake_case ( metaclass=__SCREAMING_SNAKE_CASE ): '''simple docstring''' lowerCamelCase__ = ['''note_seq'''] def __init__( self , *__SCREAMING_SNAKE_CASE , **__SCREAMI...
38
"""simple docstring""" import argparse import re import torch from CLAP import create_model from transformers import AutoFeatureExtractor, ClapConfig, ClapModel __UpperCAmelCase = { '''text_branch''': '''text_model''', '''audio_branch''': '''audio_model.audio_encoder''', '''attn''': '...
642
0
from __future__ import annotations import math from collections.abc import Callable def __SCREAMING_SNAKE_CASE (SCREAMING_SNAKE_CASE__ , SCREAMING_SNAKE_CASE__ , SCREAMING_SNAKE_CASE__ , SCREAMING_SNAKE_CASE__ = 100 , ): snake_case_ = x_start snake_...
39
"""simple docstring""" from __future__ import annotations def lowercase__ ( lowerCAmelCase__ : int , lowerCAmelCase__ : int ) -> tuple[int, int]: '''simple docstring''' if b == 0: return (1, 0) ((a__) , (a__)) : List[Any] = extended_euclid(lowerCA...
642
0
from math import isqrt def UpperCamelCase ( snake_case__ : int ) -> list[int]: UpperCamelCase : Union[str, Any] = [True] * max_number for i in range(2 , isqrt(max_number - 1 ) + 1 ): if is_prime[i]: for j in range(i**2 , snake_cas...
40
"""simple docstring""" from typing import List, Union import numpy as np from ..tokenization_utils import TruncationStrategy from ..utils import add_end_docstrings, logging from .base import PIPELINE_INIT_ARGS, ArgumentHandler, ChunkPipeline __UpperCAmelCase = logging.get_logger(__name__) clas...
642
0
'''simple docstring''' from typing import TYPE_CHECKING from ...utils import ( OptionalDependencyNotAvailable, _LazyModule, is_flax_available, is_tf_available, is_torch_available, is_vision_available, ) lowerCAmelCase__ = {'''configuration_vit''': ['''VIT_PRETRAINED_CONFIG_AR...
41
"""simple docstring""" from maths.is_square_free import is_square_free from maths.prime_factors import prime_factors def lowercase__ ( lowerCAmelCase__ : int ) -> int: '''simple docstring''' a__ : Tuple = prime_factors(lowerCAmelCase__ ) if is_square_free(lowerCA...
642
0
'''simple docstring''' from __future__ import annotations import math def _UpperCamelCase ( __UpperCamelCase ,__UpperCamelCase ) -> float: lowerCamelCase_ = u for i in range(1 ,__UpperCamelCase ): lowerCamelCase_ = temp * (u - i) return temp ...
42
"""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 IFWater...
642
0
import math def _a ( SCREAMING_SNAKE_CASE , SCREAMING_SNAKE_CASE ): """simple docstring""" if initial_intensity < 0: raise ValueError('''The value of intensity cannot be negative''' ) # handling of negative values of initial intensity if angle < 0 or angle > 3_60: ...
43
"""simple docstring""" import json import os from functools import lru_cache from typing import TYPE_CHECKING, List, Optional, Tuple import regex as re from ...tokenization_utils import AddedToken, PreTrainedTokenizer from ...utils import logging if TYPE_CHECKING: from transformers.pipelines.conversat...
642
0
'''simple docstring''' import argparse import torch from transformers import GPTaConfig, GPTaModel, load_tf_weights_in_gpta from transformers.utils import CONFIG_NAME, WEIGHTS_NAME, logging logging.set_verbosity_info() def A_ ( _lowerCAmelCase : List[Any] , _lowerCAmelCase : ...
44
"""simple docstring""" from sklearn.metrics import matthews_corrcoef import datasets __UpperCAmelCase = ''' Compute the Matthews correlation coefficient (MCC) The Matthews correlation coefficient is used in machine learning as a measure of the quality of binary and multiclass classifications. It ...
642
0
import inspect import unittest from transformers import ConvNextConfig from transformers.testing_utils import require_torch, require_vision, slow, torch_device from transformers.utils import cached_property, is_torch_available, is_vision_available from ...test_backbone_common import BackboneTesterMixin from .....
45
"""simple docstring""" 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_...
642
0
"""simple docstring""" from collections import defaultdict def lowerCamelCase_( _lowerCamelCase , _lowerCamelCase ) -> bool: '''simple docstring''' _lowerCamelCase : str = first_str.lower().strip() _lowerCamelCase : Any = second_str.low...
46
"""simple docstring""" import numpy as np from transformers import BatchFeature from transformers.testing_utils import require_tf, require_torch from .test_feature_extraction_common import FeatureExtractionSavingTestMixin class __UpperCAmelCase ( _UpperCamelCase ): # to overwrite a...
642
0
from typing import TYPE_CHECKING from ...utils import OptionalDependencyNotAvailable, _LazyModule, is_tokenizers_available SCREAMING_SNAKE_CASE__ = {'''tokenization_herbert''': ['''HerbertTokenizer''']} try: if not is_tokenizers_available(): raise OptionalDepend...
47
"""simple docstring""" from typing import TYPE_CHECKING # rely on isort to merge the imports from ...utils import OptionalDependencyNotAvailable, _LazyModule, is_torch_available __UpperCAmelCase = { '''configuration_informer''': [ '''INFORMER_PRETRAINED_CONFIG_ARCHIVE_MAP''', '...
642
0
'''simple docstring''' def A ( UpperCamelCase_ : int , UpperCamelCase_ : int ) -> bool: '''simple docstring''' return numa ^ numa < 0 if __name__ == "__main__": import doctest doctest.testmod()
48
"""simple docstring""" import pytest import datasets # Import fixture modules as plugins __UpperCAmelCase = ['''tests.fixtures.files''', '''tests.fixtures.hub''', '''tests.fixtures.fsspec'''] def lowercase__ ( lowerCAmelCase__ : Optional[Any] , lowerCAmelCase__ : str...
642
0
"""simple docstring""" import json import multiprocessing import os import re from collections import defaultdict import torch from accelerate import Accelerator from accelerate.utils import set_seed from arguments import HumanEvalArguments from datasets import load_dataset, load_metric from to...
49
"""simple docstring""" import functools def lowercase__ ( lowerCAmelCase__ : str , lowerCAmelCase__ : str ) -> int: '''simple docstring''' a__ : Any = len(lowerCAmelCase__ ) a__ : Optional[int] = len(lowerCAmelCase__ ) @functools.cache d...
642
0
'''simple docstring''' from abc import ABC, abstractmethod from typing import List, Optional class UpperCamelCase__ (a ): '''simple docstring''' def __init__( self ): # test for the above condition self.test() def UpperCamelCase_ ( ...
50
"""simple docstring""" def lowercase__ ( lowerCAmelCase__ : str ) -> list[int]: '''simple docstring''' a__ : List[str] = [0 for i in range(len(lowerCAmelCase__ ) )] # initialize interval's left pointer and right pointer a__ , a__ : int = 0, 0 for i in ra...
642
0
'''simple docstring''' from __future__ import annotations import json import requests from bsa import BeautifulSoup from fake_useragent import UserAgent a__ : int = {'UserAgent': UserAgent().random} def __snake_case ( SCREAMING_SNAKE_CASE_ : List[Any] ) -> dict: ...
51
"""simple docstring""" import os import unicodedata 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 SPIECE_UNDERLINE, logging __UpperCAmelCase = loggi...
642
0
"""simple docstring""" import itertools import os import random import tempfile import unittest import numpy as np from transformers import TvltFeatureExtractor, is_datasets_available from transformers.testing_utils import check_json_file_has_correct_format, require_torch, require_to...
52
"""simple docstring""" import argparse import pickle import numpy as np import torch from torch import nn from transformers import ReformerConfig, ReformerModelWithLMHead from transformers.utils import logging logging.set_verbosity_info() def lowercase__ ( lowerCAmelCase__ : Union[str...
642
0
import torch from diffusers import UnCLIPScheduler from .test_schedulers import SchedulerCommonTest class _UpperCAmelCase ( _UpperCamelCase ): """simple docstring""" a_ = (UnCLIPScheduler,) def lowercase ( self : str , *...
53
"""simple docstring""" import os def lowercase__ ( ) -> Optional[Any]: '''simple docstring''' with open(os.path.dirname(lowerCAmelCase__ ) + "/p022_names.txt" ) as file: a__ : Optional[int] = str(file.readlines()[0] ) a__ : Optional[int] = names.repla...
642
0
from typing import TYPE_CHECKING from ...utils import ( OptionalDependencyNotAvailable, _LazyModule, is_flax_available, is_tf_available, is_tokenizers_available, is_torch_available, is_vision_available, ) __lowercase : int ={ """configuration_owlvit""":...
54
"""simple docstring""" from typing import List, Optional, Union import numpy as np import tensorflow as tf from .utils import logging __UpperCAmelCase = logging.get_logger(__name__) def lowercase__ ( lowerCAmelCase__ : Union[tf.Tensor, np.ndarray] ) -> List[int]: '...
642
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 version.parse(fairseq.__vers...
55
"""simple docstring""" import tempfile import unittest import numpy as np from diffusers import ( DDIMScheduler, DPMSolverMultistepScheduler, EulerAncestralDiscreteScheduler, EulerDiscreteScheduler, LMSDiscreteScheduler, OnnxStableDiffusionPipeline, PNDMScheduler, ) from diffus...
642
0
'''simple docstring''' # limitations under the License. # NOTE: This file is deprecated and will be removed in a future version. # It only exists so that temporarely `from diffusers.pipelines import DiffusionPipeline` works from .pipelines import DiffusionPipeline, ImagePipelineOutput # noqa: F401 from .utils...
56
"""simple docstring""" from __future__ import annotations def lowercase__ ( lowerCAmelCase__ : int ) -> list[int]: '''simple docstring''' a__ : Tuple = [True] * limit a__ : Tuple = False a__ : int = False a__ : Tuple = True for i in range(3...
642
0
from __future__ import annotations def snake_case (UpperCAmelCase__ ) -> float: if not nums: raise ValueError('List is empty' ) return sum(UpperCAmelCase__ ) / len(UpperCAmelCase__ ) if __name__ == "__main__": import doctest doctest.testmod()
57
"""simple docstring""" __UpperCAmelCase = [ [0, 16, 13, 0, 0, 0], [0, 0, 10, 12, 0, 0], [0, 4, 0, 0, 14, 0], [0, 0, 9, 0, 0, 20], [0, 0, 0, 7, 0, 4], [0, 0, 0, 0, 0, 0], ] def lowercase__ ( lowerCAmelCase__ : Dict , lowerCAmelCase__ : Optional[in...
642
0
"""simple docstring""" import argparse import glob import importlib.util import os import re import black from doc_builder.style_doc import style_docstrings_in_code # All paths are set with the intent you should run this script from the root of the repo with the command # python utils/c...
58
"""simple docstring""" import unittest from transformers import load_tool from .test_tools_common import ToolTesterMixin class __UpperCAmelCase ( unittest.TestCase , _UpperCamelCase ): def UpperCAmelCase ( self : Dict ) -> List[Any]: '''simple do...
642
0
from __future__ import annotations import unittest from transformers import DistilBertConfig, is_tf_available from transformers.testing_utils import require_tf, slow from ...test_configuration_common import ConfigTester from ...test_modeling_tf_common import TFModelTesterMixin, ids_tensor, random_attention_mas...
59
"""simple docstring""" import unittest import torch from diffusers import DDIMScheduler, DDPMScheduler, UNetaDModel from diffusers.training_utils import set_seed from diffusers.utils.testing_utils import slow __UpperCAmelCase = False class __UpperCAmelCase ( unittest.TestCase ...
642
0
from typing import TYPE_CHECKING from ...utils import ( OptionalDependencyNotAvailable, _LazyModule, is_tf_available, is_tokenizers_available, is_torch_available, ) lowerCAmelCase_ = { '''configuration_mobilebert''': [ '''MOBILEBERT_PRETRAINED_CONFIG_ARCHIVE_MAP''',...
60
"""simple docstring""" import argparse import re import torch from CLAP import create_model from transformers import AutoFeatureExtractor, ClapConfig, ClapModel __UpperCAmelCase = { '''text_branch''': '''text_model''', '''audio_branch''': '''audio_model.audio_encoder''', '''attn''': '...
642
0
import unittest import torch from torch import nn from accelerate.test_utils import require_cuda from accelerate.utils.memory import find_executable_batch_size, release_memory def _A ( ): """simple docstring""" raise RuntimeError("CUDA out of memory." ) class ...
61
"""simple docstring""" from __future__ import annotations def lowercase__ ( lowerCAmelCase__ : int , lowerCAmelCase__ : int ) -> tuple[int, int]: '''simple docstring''' if b == 0: return (1, 0) ((a__) , (a__)) : List[Any] = extended_euclid(lowerCA...
642
0
import bza import gzip import lzma import os import shutil import struct import tarfile import warnings import zipfile from abc import ABC, abstractmethod from pathlib import Path from typing import Dict, List, Optional, Type, Union from .. import config from .filelock import FileLock from .logging import get_l...
62
"""simple docstring""" from typing import List, Union import numpy as np from ..tokenization_utils import TruncationStrategy from ..utils import add_end_docstrings, logging from .base import PIPELINE_INIT_ARGS, ArgumentHandler, ChunkPipeline __UpperCAmelCase = logging.get_logger(__name__) clas...
642
0
import inspect import unittest from typing import List import numpy as np from transformers import EfficientFormerConfig from transformers.testing_utils import require_tf, require_vision, slow from transformers.utils import cached_property, is_tf_available, is_vision_available from ...test_co...
63
"""simple docstring""" from maths.is_square_free import is_square_free from maths.prime_factors import prime_factors def lowercase__ ( lowerCAmelCase__ : int ) -> int: '''simple docstring''' a__ : Tuple = prime_factors(lowerCAmelCase__ ) if is_square_free(lowerCA...
642
0
def A__ ( snake_case_ : int = 1_000_000 ): SCREAMING_SNAKE_CASE__: List[str]= set(range(3 , snake_case_ , 2 ) ) primes.add(2 ) for p in range(3 , snake_case_ , 2 ): if p not in primes: continue primes.difference_update(set(range(p * p ,...
64
"""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 IFWater...
642
0
"""simple docstring""" import pytest from datasets import Dataset, DatasetDict, Features, NamedSplit, Value from datasets.io.text import TextDatasetReader from ..utils import assert_arrow_memory_doesnt_increase, assert_arrow_memory_increases def lowerCAmelCase ( __UpperCamelCase , ...
65
"""simple docstring""" import json import os from functools import lru_cache from typing import TYPE_CHECKING, List, Optional, Tuple import regex as re from ...tokenization_utils import AddedToken, PreTrainedTokenizer from ...utils import logging if TYPE_CHECKING: from transformers.pipelines.conversat...
642
0
from __future__ import annotations import math def __magic_name__ ( SCREAMING_SNAKE_CASE ) -> bool: if 1 < number < 4: # 2 and 3 are primes return True elif number < 2 or number % 2 == 0 or number % 3 == 0: # Negatives, 0, 1, all eve...
66
"""simple docstring""" from sklearn.metrics import matthews_corrcoef import datasets __UpperCAmelCase = ''' Compute the Matthews correlation coefficient (MCC) The Matthews correlation coefficient is used in machine learning as a measure of the quality of binary and multiclass classifications. It ...
642
0
import sys snake_case = ( """73167176531330624919225119674426574742355349194934""" """96983520312774506326239578318016984801869478851843""" """85861560789112949495459501737958331952853208805511""" """12540698747158523863050715693290963295227443043557""" """6689664895...
67
"""simple docstring""" 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_...
642
0
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 import ModelTesterMixin, ids_...
68
"""simple docstring""" import numpy as np from transformers import BatchFeature from transformers.testing_utils import require_tf, require_torch from .test_feature_extraction_common import FeatureExtractionSavingTestMixin class __UpperCAmelCase ( _UpperCamelCase ): # to overwrite a...
642
0
'''simple docstring''' from __future__ import annotations def __UpperCAmelCase ( _UpperCAmelCase : list ) -> list: if len(_UpperCAmelCase ) == 0: return [] __snake_case , __snake_case = min(_UpperCAmelCase ), max(_UpperCAmelCase ) __snake_c...
69
"""simple docstring""" from typing import TYPE_CHECKING # rely on isort to merge the imports from ...utils import OptionalDependencyNotAvailable, _LazyModule, is_torch_available __UpperCAmelCase = { '''configuration_informer''': [ '''INFORMER_PRETRAINED_CONFIG_ARCHIVE_MAP''', '...
642
0
# flake8: noqa # Lint as: python3 lowerCamelCase : Any = [ "VerificationMode", "Version", "disable_progress_bar", "enable_progress_bar", "is_progress_bar_enabled", "experimental", ] from .info_utils import VerificationMode from .logging import disabl...
70
"""simple docstring""" import pytest import datasets # Import fixture modules as plugins __UpperCAmelCase = ['''tests.fixtures.files''', '''tests.fixtures.hub''', '''tests.fixtures.fsspec'''] def lowercase__ ( lowerCAmelCase__ : Optional[Any] , lowerCAmelCase__ : str...
642
0
'''simple docstring''' from __future__ import annotations import copy import tempfile import unittest from transformers import CONFIG_MAPPING, AutoConfig, BertConfig, GPTaConfig, TaConfig, TapasConfig, is_tf_available from transformers.testing_utils import ( DUMMY_UNKNOWN_IDENTIFIER, SMALL_MODEL...
71
"""simple docstring""" import functools def lowercase__ ( lowerCAmelCase__ : str , lowerCAmelCase__ : str ) -> int: '''simple docstring''' a__ : Any = len(lowerCAmelCase__ ) a__ : Optional[int] = len(lowerCAmelCase__ ) @functools.cache d...
642
0
'''simple docstring''' # limitations under the License. from typing import Optional, Tuple, Union import torch from diffusers import DiffusionPipeline, ImagePipelineOutput class __magic_name__ ( __SCREAMING_SNAKE_CASE ): def __init__( self , snake_case_ , snake_case_ ): super()...
72
"""simple docstring""" def lowercase__ ( lowerCAmelCase__ : str ) -> list[int]: '''simple docstring''' a__ : List[str] = [0 for i in range(len(lowerCAmelCase__ ) )] # initialize interval's left pointer and right pointer a__ , a__ : int = 0, 0 for i in ra...
642
0
import argparse import evaluate import torch from datasets import load_dataset from torch.optim import AdamW from torch.utils.data import DataLoader from transformers import AutoModelForSequenceClassification, AutoTokenizer, get_linear_schedule_with_warmup, set_seed from accelerate import Accelerator, Distribu...
73
"""simple docstring""" import os import unicodedata 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 SPIECE_UNDERLINE, logging __UpperCAmelCase = loggi...
642
0
import unittest from transformers import is_torch_available from transformers.testing_utils import require_torch if is_torch_available(): import torch from transformers.generation import DisjunctiveConstraint @require_torch class __UpperCamelCase ( unittest.TestCase ): """simp...
74
"""simple docstring""" import argparse import pickle import numpy as np import torch from torch import nn from transformers import ReformerConfig, ReformerModelWithLMHead from transformers.utils import logging logging.set_verbosity_info() def lowercase__ ( lowerCAmelCase__ : Union[str...
642
0
'''simple docstring''' # coding=utf-8 # Copyright 2020 The HuggingFace Inc. team. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-...
75
"""simple docstring""" import os def lowercase__ ( ) -> Optional[Any]: '''simple docstring''' with open(os.path.dirname(lowerCAmelCase__ ) + "/p022_names.txt" ) as file: a__ : Optional[int] = str(file.readlines()[0] ) a__ : Optional[int] = names.repla...
642
0
"""simple docstring""" def __UpperCAmelCase ( __UpperCamelCase ): __lowercase : str = 0 for ch in input_str: __lowercase : Union[str, Any] = ord(__UpperCamelCase ) __lowercase : Optional[int] = pow(2 , __UpperCamelCase ...
76
"""simple docstring""" from typing import List, Optional, Union import numpy as np import tensorflow as tf from .utils import logging __UpperCAmelCase = logging.get_logger(__name__) def lowercase__ ( lowerCAmelCase__ : Union[tf.Tensor, np.ndarray] ) -> List[int]: '...
642
0
"""simple docstring""" from typing import Any class a__ : def __init__( self : List[str] , UpperCamelCase_ : Any): """simple docstring""" __UpperCAmelCase : str = data __UpperCAmelCase : Optional[Any] = None ...
77
"""simple docstring""" import tempfile import unittest import numpy as np from diffusers import ( DDIMScheduler, DPMSolverMultistepScheduler, EulerAncestralDiscreteScheduler, EulerDiscreteScheduler, LMSDiscreteScheduler, OnnxStableDiffusionPipeline, PNDMScheduler, ) from diffus...
642
0
'''simple docstring''' def lowerCAmelCase_ ( snake_case_ : int ) -> int: '''simple docstring''' UpperCAmelCase_ = 0 while num > 0: digit_sum += num % 10 num //= 10 return digit_sum def lowerCAmelCase_ ( snake_c...
78
"""simple docstring""" from __future__ import annotations def lowercase__ ( lowerCAmelCase__ : int ) -> list[int]: '''simple docstring''' a__ : Tuple = [True] * limit a__ : Tuple = False a__ : int = False a__ : Tuple = True for i in range(3...
642
0
from typing import TYPE_CHECKING from ...utils import ( OptionalDependencyNotAvailable, _LazyModule, is_tokenizers_available, is_torch_available, is_vision_available, ) SCREAMING_SNAKE_CASE__ : int = { """configuration_layoutlmv2""": ["""LAYOUTLMV2_PRET...
79
"""simple docstring""" __UpperCAmelCase = [ [0, 16, 13, 0, 0, 0], [0, 0, 10, 12, 0, 0], [0, 4, 0, 0, 14, 0], [0, 0, 9, 0, 0, 20], [0, 0, 0, 7, 0, 4], [0, 0, 0, 0, 0, 0], ] def lowercase__ ( lowerCAmelCase__ : Dict , lowerCAmelCase__ : Optional[in...
642
0
import builtins import sys from ...utils.imports import _is_package_available from . import cursor, input from .helpers import Direction, clear_line, forceWrite, linebreak, move_cursor, reset_cursor, writeColor from .keymap import KEYMAP __UpperCamelCase : List[Any] = False try: __UpperCamel...
80
"""simple docstring""" import unittest from transformers import load_tool from .test_tools_common import ToolTesterMixin class __UpperCAmelCase ( unittest.TestCase , _UpperCamelCase ): def UpperCAmelCase ( self : Dict ) -> List[Any]: '''simple do...
642
0
import torch from diffusers import CMStochasticIterativeScheduler from .test_schedulers import SchedulerCommonTest class a (_lowerCAmelCase ): """simple docstring""" __UpperCAmelCase : Optional[int] = (CMStochasticIterativeScheduler,) __UpperCAmelCase :...
81
"""simple docstring""" import unittest import torch from diffusers import DDIMScheduler, DDPMScheduler, UNetaDModel from diffusers.training_utils import set_seed from diffusers.utils.testing_utils import slow __UpperCAmelCase = False class __UpperCAmelCase ( unittest.TestCase ...
642
0
"""simple docstring""" import os import sys import unittest lowerCamelCase = os.path.abspath(os.path.dirname(os.path.dirname(os.path.dirname(__file__)))) sys.path.append(os.path.join(git_repo_path, """utils""")) import get_test_info # noqa: E402 from get_test_info import ( # noqa: ...
82
"""simple docstring""" import argparse import re import torch from CLAP import create_model from transformers import AutoFeatureExtractor, ClapConfig, ClapModel __UpperCAmelCase = { '''text_branch''': '''text_model''', '''audio_branch''': '''audio_model.audio_encoder''', '''attn''': '...
642
0
"""simple docstring""" from ...utils import is_note_seq_available, is_transformers_available, is_torch_available from ...utils import OptionalDependencyNotAvailable try: if not (is_transformers_available() and is_torch_available()): raise OptionalDependencyNotAvailable() except OptionalDependencyNo...
83
"""simple docstring""" from __future__ import annotations def lowercase__ ( lowerCAmelCase__ : int , lowerCAmelCase__ : int ) -> tuple[int, int]: '''simple docstring''' if b == 0: return (1, 0) ((a__) , (a__)) : List[Any] = extended_euclid(lowerCA...
642
0
from typing import Optional import torch import torch.utils.checkpoint from torch import Tensor, nn from torch.nn import BCEWithLogitsLoss, CrossEntropyLoss, MSELoss from ...activations import ACTaFN from ...file_utils import add_code_sample_docstrings, add_start_docstrings, add_start_docstrings_to_model_forward fro...
84
"""simple docstring""" from typing import List, Union import numpy as np from ..tokenization_utils import TruncationStrategy from ..utils import add_end_docstrings, logging from .base import PIPELINE_INIT_ARGS, ArgumentHandler, ChunkPipeline __UpperCAmelCase = logging.get_logger(__name__) clas...
642
0
from typing import List, Optional, Tuple, Union import torch from ...models import UNetaDModel from ...schedulers import ScoreSdeVeScheduler from ...utils import randn_tensor from ..pipeline_utils import DiffusionPipeline, ImagePipelineOutput class snake_case ( UpperCamelCase_ ): lowercase_ = ...
85
"""simple docstring""" from maths.is_square_free import is_square_free from maths.prime_factors import prime_factors def lowercase__ ( lowerCAmelCase__ : int ) -> int: '''simple docstring''' a__ : Tuple = prime_factors(lowerCAmelCase__ ) if is_square_free(lowerCA...
642
0
from ...configuration_utils import PretrainedConfig from ...utils import logging __a :Union[str, Any] = logging.get_logger(__name__) __a :Optional[int] = { 'facebook/vit-mae-base': 'https://huggingface.co/facebook/vit-mae-base/resolve/main/config.json', # See all ViT MAE model...
86
"""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 IFWater...
642
0
def SCREAMING_SNAKE_CASE ( lowercase_ = 100 ) -> int: """simple docstring""" A__ = (n * (n + 1) // 2) ** 2 A__ = n * (n + 1) * (2 * n + 1) // 6 return sum_cubes - sum_squares if __name__ == "__main__": print(F'''{solution() = }''')
87
"""simple docstring""" import json import os from functools import lru_cache from typing import TYPE_CHECKING, List, Optional, Tuple import regex as re from ...tokenization_utils import AddedToken, PreTrainedTokenizer from ...utils import logging if TYPE_CHECKING: from transformers.pipelines.conversat...
642
0
"""simple docstring""" import os from huggingface_hub.constants import HUGGINGFACE_HUB_CACHE, hf_cache_home UpperCAmelCase = HUGGINGFACE_HUB_CACHE UpperCAmelCase = """config.json""" UpperCAmelCase = """diffusion_pytorch_model.bin""" UpperCAmelCase = """diffusion_fla...
88
"""simple docstring""" from sklearn.metrics import matthews_corrcoef import datasets __UpperCAmelCase = ''' Compute the Matthews correlation coefficient (MCC) The Matthews correlation coefficient is used in machine learning as a measure of the quality of binary and multiclass classifications. It ...
642
0
from typing import TYPE_CHECKING from ...utils import OptionalDependencyNotAvailable, _LazyModule, is_torch_available, is_vision_available SCREAMING_SNAKE_CASE : Optional[Any] = { "configuration_conditional_detr": [ "CONDITIONAL_DETR_PRETRAINED_CONFIG_ARCHIVE_MAP", "ConditionalDetr...
89
"""simple docstring""" 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_...
642
0
'''simple docstring''' from __future__ import annotations __UpperCAmelCase = list[list[int]] # assigning initial values to the grid __UpperCAmelCase = [ [3, 0, 6, 5, 0, 8, 4, 0, 0], [5, 2, 0, 0, 0, 0, 0, 0, 0], [0, 8, 7, 0, 0, 0, 0, 3, 1], [0...
90
"""simple docstring""" import numpy as np from transformers import BatchFeature from transformers.testing_utils import require_tf, require_torch from .test_feature_extraction_common import FeatureExtractionSavingTestMixin class __UpperCAmelCase ( _UpperCamelCase ): # to overwrite a...
642
0
"""simple docstring""" import argparse import re import requests import torch # git clone https://github.com/salesforce/BLIP.git from models.blip import blip_decoder from models.blip_itm import blip_itm from models.blip_vqa import blip_vqa from PIL import Image from torchvision import transforms from torchvision.t...
91
"""simple docstring""" from typing import TYPE_CHECKING # rely on isort to merge the imports from ...utils import OptionalDependencyNotAvailable, _LazyModule, is_torch_available __UpperCAmelCase = { '''configuration_informer''': [ '''INFORMER_PRETRAINED_CONFIG_ARCHIVE_MAP''', '...
642
0
'''simple docstring''' import shutil import tempfile import unittest from transformers import SPIECE_UNDERLINE, BatchEncoding, MBartaaTokenizer, MBartaaTokenizerFast, is_torch_available from transformers.testing_utils import ( get_tests_dir, nested_simplify, require_sentencepiece, require_tokeni...
92
"""simple docstring""" import pytest import datasets # Import fixture modules as plugins __UpperCAmelCase = ['''tests.fixtures.files''', '''tests.fixtures.hub''', '''tests.fixtures.fsspec'''] def lowercase__ ( lowerCAmelCase__ : Optional[Any] , lowerCAmelCase__ : str...
642
0
"""simple docstring""" import json from typing import List, Optional, Tuple from tokenizers import normalizers from ...tokenization_utils_fast import PreTrainedTokenizerFast from ...utils import logging from .tokenization_bert import BertTokenizer __A = logging.get_logger(__name__) __A ...
93
"""simple docstring""" import functools def lowercase__ ( lowerCAmelCase__ : str , lowerCAmelCase__ : str ) -> int: '''simple docstring''' a__ : Any = len(lowerCAmelCase__ ) a__ : Optional[int] = len(lowerCAmelCase__ ) @functools.cache d...
642
0
'''simple docstring''' 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_tokenizatio...
94
"""simple docstring""" def lowercase__ ( lowerCAmelCase__ : str ) -> list[int]: '''simple docstring''' a__ : List[str] = [0 for i in range(len(lowerCAmelCase__ ) )] # initialize interval's left pointer and right pointer a__ , a__ : int = 0, 0 for i in ra...
642
0
"""simple docstring""" import os from shutil import copyfile from typing import List, Optional, Tuple from ...tokenization_utils import AddedToken from ...tokenization_utils_fast import PreTrainedTokenizerFast from ...utils import is_sentencepiece_available, logging if is_sentencepiece_available(): from .t...
95
"""simple docstring""" import os import unicodedata 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 SPIECE_UNDERLINE, logging __UpperCAmelCase = loggi...
642
0
"""simple docstring""" import argparse import re import requests import torch # git clone https://github.com/salesforce/BLIP.git from models.blip import blip_decoder from models.blip_itm import blip_itm from models.blip_vqa import blip_vqa from PIL import Image from torchvision imp...
96
"""simple docstring""" import argparse import pickle import numpy as np import torch from torch import nn from transformers import ReformerConfig, ReformerModelWithLMHead from transformers.utils import logging logging.set_verbosity_info() def lowercase__ ( lowerCAmelCase__ : Union[str...
642
0
import logging import os from dataclasses import dataclass, field from functools import partial from pathlib import Path from tempfile import TemporaryDirectory from typing import List, Optional import faiss import torch from datasets import Features, Sequence, Value, load_dataset from transformers impo...
97
"""simple docstring""" import os def lowercase__ ( ) -> Optional[Any]: '''simple docstring''' with open(os.path.dirname(lowerCAmelCase__ ) + "/p022_names.txt" ) as file: a__ : Optional[int] = str(file.readlines()[0] ) a__ : Optional[int] = names.repla...
642
0
'''simple docstring''' import argparse import re import torch from CLAP import create_model from transformers import AutoFeatureExtractor, ClapConfig, ClapModel lowercase__ : List[str] = { 'text_branch': 'text_model', 'audio_branch': 'audio_model.audio_encoder', 'attn': 'attention.se...
98
"""simple docstring""" from typing import List, Optional, Union import numpy as np import tensorflow as tf from .utils import logging __UpperCAmelCase = logging.get_logger(__name__) def lowercase__ ( lowerCAmelCase__ : Union[tf.Tensor, np.ndarray] ) -> List[int]: '...
642
0
from ...configuration_utils import PretrainedConfig from ...utils import logging SCREAMING_SNAKE_CASE = logging.get_logger(__name__) SCREAMING_SNAKE_CASE = { 'vinvino02/glpn-kitti': 'https://huggingface.co/vinvino02/glpn-kitti/resolve/main/config.json', # See all...
99
"""simple docstring""" import tempfile import unittest import numpy as np from diffusers import ( DDIMScheduler, DPMSolverMultistepScheduler, EulerAncestralDiscreteScheduler, EulerDiscreteScheduler, LMSDiscreteScheduler, OnnxStableDiffusionPipeline, PNDMScheduler, ) from diffus...
642
0