code
stringlengths
86
54.5k
code_codestyle
int64
0
371
style_context
stringlengths
87
49.2k
style_context_codestyle
int64
0
349
label
int64
0
1
import numpy as np def __lowerCamelCase ( UpperCAmelCase_ : str , UpperCAmelCase_ : Union[str, Any] ): """simple docstring""" return np.where(vector > 0 , _lowerCAmelCase , (alpha * (np.exp(_lowerCAmelCase ) - 1)) ) if __name__ == "__main__": i...
354
import numpy as np from matplotlib import pyplot as plt from sklearn.datasets import load_iris from sklearn.metrics import ConfusionMatrixDisplay from sklearn.model_selection import train_test_split from xgboost import XGBClassifier def __lowerCamelCase ( UpperCAmelCase_ : dict ): """...
281
0
import multiprocessing from typing import TYPE_CHECKING, Optional, Union from .. import Dataset, Features, config from ..formatting import query_table from ..packaged_modules.sql.sql import Sql from ..utils import logging from .abc import AbstractDatasetInputStream if TYPE_CHECKING: import sqlitea import s...
355
from collections import OrderedDict from typing import Mapping from packaging import version from ...configuration_utils import PretrainedConfig from ...onnx import OnnxConfig from ...utils import logging snake_case : Optional[Any] = logging.get_logger(__name__) snake_case : Dict = { ...
281
0
# Logistic Regression from scratch # In[62]: # In[63]: # importing all the required libraries import numpy as np from matplotlib import pyplot as plt from sklearn import datasets def __lowerCamelCase ( UpperCAmelCase_ : Union[str, Any] ): """simple docstring""" return 1...
356
from typing import TYPE_CHECKING from ....utils import OptionalDependencyNotAvailable, _LazyModule, is_torch_available, is_vision_available snake_case : Any = {'''configuration_van''': ['''VAN_PRETRAINED_CONFIG_ARCHIVE_MAP''', '''VanConfig''']} try: if not is_torch_available(): raise...
281
0
from __future__ import absolute_import, division, print_function, unicode_literals from torch import nn from torch.nn import CrossEntropyLoss, MSELoss from transformers import RobertaConfig from transformers.file_utils import add_start_docstrings, add_start_docstrings_to_model_forward from transformers.models.robe...
357
def __lowerCamelCase ( UpperCAmelCase_ : int = 100 ): """simple docstring""" a :List[Any] = 0 a :List[Any] = 0 for i in range(1 , n + 1 ): sum_of_squares += i**2 sum_of_ints += i return sum_of_int...
281
0
import math def __lowerCamelCase ( UpperCAmelCase_ : List[str] = 100 ): """simple docstring""" a :Any = sum(i * i for i in range(1 , n + 1 ) ) a :Union[str, Any] = int(math.pow(sum(range(1 , n + 1 ) ...
358
import os import re from shutil import copyfile from typing import List, Optional, Tuple from ...tokenization_utils import PreTrainedTokenizer from ...utils import logging snake_case : List[str] = logging.get_logger(__name__) snake_case : Optional[Any] = { '''vocab_file''': '''vocab...
281
0
from __future__ import annotations from typing import Any class _snake_case ( SCREAMING_SNAKE_CASE__ ): pass class _snake_case : def __init__( self , _lowerCamelCase ): a :Any = data a :Node | None = None def __iter__( self ): ...
359
# Copyright 2023 The HuggingFace Inc. team. All rights reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by a...
281
0
from __future__ import annotations # This is the precision for this function which can be altered. # It is recommended for users to keep this number greater than or equal to 10. snake_case : str = 10 def __lowerCamelCase ( UpperCAmelCase_ : int , UpperCAmelCase_ : int , Upp...
360
from __future__ import annotations import random import unittest from transformers import TransfoXLConfig, 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 from ...tes...
281
0
import argparse import datetime def __lowerCamelCase ( UpperCAmelCase_ : str ): """simple docstring""" a :List[str] = { '''0''': '''Sunday''', '''1''': '''Monday''', '''2''': '''Tuesday''', '''3''': '''Wednesday''', ...
361
# 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 import deprecate depreca...
281
0
"""simple docstring""" from collections import OrderedDict from typing import Any, Mapping, Optional, Union from ...configuration_utils import PretrainedConfig from ...feature_extraction_utils import FeatureExtractionMixin from ...onnx import OnnxConfig from ...onnx.utils import compute_effective_axis_dimension...
362
import gc import random import unittest import numpy as np import torch from transformers import CLIPTextConfig, CLIPTextModel, CLIPTokenizer from diffusers import AutoencoderKL, CycleDiffusionPipeline, DDIMScheduler, UNetaDConditionModel from diffusers.utils import floats_tensor, load_image, load_numpy, slow, tor...
281
0
from ....utils import logging snake_case : Optional[int] = logging.get_logger(__name__) class _snake_case ( _A ): def __init__( self , _lowerCamelCase , _lowerCamelCase=None , _lowerCamelCase=2048 ): a :Any = config.__dict__ a :Optional[Any] ...
363
from ...utils import ( OptionalDependencyNotAvailable, is_flax_available, is_torch_available, is_transformers_available, ) try: if not (is_transformers_available() and is_torch_available()): raise OptionalDependencyNotAvailable() except OptionalDependencyNotAvailable: from ...ut...
281
0
from collections import Counter from pathlib import Path from typing import Optional, Tuple import yaml class _snake_case ( yaml.SafeLoader ): def SCREAMING_SNAKE_CASE__ ( self , _lowerCamelCase ): a :Dict = [self.constructed_objects[key_node] for key_node, _ in ...
364
import json import os import unittest from transformers import MgpstrTokenizer from transformers.models.mgp_str.tokenization_mgp_str import VOCAB_FILES_NAMES from transformers.testing_utils import require_tokenizers from ...test_tokenization_common import TokenizerTesterMixin @require_tokenizers class _sn...
281
0
from __future__ import annotations snake_case : List[str] = list[list[int]] # assigning initial values to the grid snake_case : str = [ [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, 0, 3, 0, 1, 0, 0, 8, 0], [9, 0, 0, 8, 6, 3...
365
import os import unittest from transformers.models.bartpho.tokenization_bartpho import VOCAB_FILES_NAMES, BartphoTokenizer from transformers.testing_utils import get_tests_dir from ...test_tokenization_common import TokenizerTesterMixin snake_case : List[Any] = get_tests_dir('''fixtures/test_sentenc...
281
0
from math import log from scipy.constants import Boltzmann, physical_constants snake_case : Any = 3_00 # TEMPERATURE (unit = K) def __lowerCamelCase ( UpperCAmelCase_ : int , UpperCAmelCase_ : Tuple , UpperCAmelCase_ : Tuple , ): """simple docstring""" ...
366
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 Image from ..image_utils impo...
281
0
import copy from ...configuration_utils import PretrainedConfig from ...utils import logging from ..bit import BitConfig snake_case : Any = logging.get_logger(__name__) snake_case : List[Any] = { '''Intel/dpt-large''': '''https://huggingface.co/Intel/dpt-large/resolve/main/config.js...
367
def __lowerCamelCase ( UpperCAmelCase_ : int ): """simple docstring""" if not isinstance(UpperCAmelCase_ , UpperCAmelCase_ ): raise TypeError('''Input value must be an \'int\' type''' ) a :Optional[int] = 0 while number: ...
281
0
from typing import TYPE_CHECKING from ...utils import ( OptionalDependencyNotAvailable, _LazyModule, is_flax_available, is_tf_available, is_torch_available, ) snake_case : Optional[Any] = {'''configuration_unispeech''': ['''UNISPEECH_PRETRAINED_CONFIG_ARCHIVE_MAP''', '''UniSpeechC...
368
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 torch.utils.data import DataLoader, Rand...
281
0
"""simple docstring""" import numpy as np import torch from torch.utils.data import Dataset from utils import logger class _snake_case ( _snake_case ): def __init__( self , _lowerCamelCase , _lowerCamelCase ): a :List[str] = params a :Optional[int] ...
369
from . import __version__ # Backward compatibility imports, to make sure all those objects can be found in file_utils from .utils import ( CLOUDFRONT_DISTRIB_PREFIX, CONFIG_NAME, DISABLE_TELEMETRY, DUMMY_INPUTS, DUMMY_MASK, ENV_VARS_TRUE_AND_AUTO_VALUES, ENV_VARS_TRUE_VALUES, FEATURE...
281
0
import unittest from parameterized import parameterized from transformers import AutoTokenizer, GPTNeoXConfig, is_torch_available, set_seed from transformers.testing_utils import require_torch, slow, torch_device from ...generation.test_utils import GenerationTesterMixin from ...test_configuration_common import C...
370
import math def __lowerCamelCase ( UpperCAmelCase_ : float , UpperCAmelCase_ : float ): """simple docstring""" return math.pow(UpperCAmelCase_ , 2 ) - a def __lowerCamelCase ( UpperCAmelCase_ : float ): """simple docstring"""...
281
0
import warnings from collections import OrderedDict from typing import Mapping from packaging import version from ...configuration_utils import PretrainedConfig from ...onnx import OnnxConfig from ...utils import logging snake_case : str = logging.get_logger(__name__) snake_case : List[str] ...
371
from collections import OrderedDict from typing import List, Mapping from packaging import version from ...configuration_utils import PretrainedConfig from ...onnx import OnnxConfig from ...utils import logging snake_case : Union[str, Any] = logging.get_logger(__name__) snake_case : List[str] ...
281
0
import unittest import numpy as np import torch from diffusers import PNDMPipeline, PNDMScheduler, UNetaDModel from diffusers.utils.testing_utils import enable_full_determinism, require_torch, slow, torch_device enable_full_determinism() class _snake_case ( unittest.TestCase ): @property ...
350
def __lowerCamelCase ( UpperCAmelCase_ : str ): """simple docstring""" if n_term == "": return [] a :list = [] for temp in range(int(UpperCAmelCase_ ) ): series.append(F'''1/{temp + 1}''' if series else '''1''' ...
281
0
import os import unittest from tempfile import TemporaryDirectory import torch import torch.nn as nn from accelerate.utils import ( OffloadedWeightsLoader, extract_submodules_state_dict, load_offloaded_weight, offload_state_dict, offload_weight, ) class _snake_case ( nn.Module ...
351
import math from dataclasses import dataclass from typing import Optional, Tuple, Union import numpy as np import torch from ..configuration_utils import ConfigMixin, register_to_config from ..utils import BaseOutput, randn_tensor from .scheduling_utils import SchedulerMixin @dataclass # Copied from diffuse...
281
0
def __lowerCamelCase ( UpperCAmelCase_ : int , UpperCAmelCase_ : int ): """simple docstring""" return int((input_a, input_a).count(1 ) != 0 ) def __lowerCamelCase ( ): """simple docstring""" assert or_gate(0 , 0 ) =...
352
import os import pytest from datasets import ( get_dataset_config_info, get_dataset_config_names, get_dataset_infos, get_dataset_split_names, inspect_dataset, inspect_metric, ) snake_case : Any = pytest.mark.integration @pytest.mark.parametrize('''path''' , ['''paws''', ''...
281
0
def __lowerCamelCase ( UpperCAmelCase_ : int = 50 ): """simple docstring""" a :Tuple = [1] * (length + 1) for row_length in range(length + 1 ): for tile_length in range(2 , 5 ): for tile_start in range(row_leng...
353
from ...configuration_utils import PretrainedConfig class _snake_case ( _snake_case ): SCREAMING_SNAKE_CASE__ = 'bert-generation' def __init__( self , _lowerCamelCase=5_0358 , _lowerCamelCase=1024 , _lowerCamelCase=24 , _lowerCamelCase=16 , _lowerCamelCase=4096 , _lowerCamelCase="g...
281
0
from __future__ import annotations def __lowerCamelCase ( UpperCAmelCase_ : list[int | float] , UpperCAmelCase_ : int , UpperCAmelCase_ : int ): """simple docstring""" if len(_lowerCAmelCase ) == 0: raise ValueError('''find_max() arg is an...
354
import numpy as np from matplotlib import pyplot as plt from sklearn.datasets import load_iris from sklearn.metrics import ConfusionMatrixDisplay from sklearn.model_selection import train_test_split from xgboost import XGBClassifier def __lowerCamelCase ( UpperCAmelCase_ : dict ): """...
281
0
import unittest from transformers import is_vision_available from transformers.pipelines import pipeline from transformers.testing_utils import ( is_pipeline_test, nested_simplify, require_tf, require_torch, require_vision, slow, ) from .test_pipelines_common import ANY if is_vision_avail...
355
from collections import OrderedDict from typing import Mapping from packaging import version from ...configuration_utils import PretrainedConfig from ...onnx import OnnxConfig from ...utils import logging snake_case : Optional[Any] = logging.get_logger(__name__) snake_case : Dict = { ...
281
0
import tempfile import unittest from make_student import create_student_by_copying_alternating_layers from transformers import AutoConfig from transformers.file_utils import cached_property from transformers.testing_utils import require_torch snake_case : Optional[int] = 'sshleifer/bart-tiny-random'...
356
from typing import TYPE_CHECKING from ....utils import OptionalDependencyNotAvailable, _LazyModule, is_torch_available, is_vision_available snake_case : Any = {'''configuration_van''': ['''VAN_PRETRAINED_CONFIG_ARCHIVE_MAP''', '''VanConfig''']} try: if not is_torch_available(): raise...
281
0
from typing import TYPE_CHECKING from ...utils import ( OptionalDependencyNotAvailable, _LazyModule, is_flax_available, is_tf_available, is_tokenizers_available, is_torch_available, ) snake_case : Dict = { '''configuration_blenderbot_small''': [ '''BLENDERBOT_SMALL...
357
def __lowerCamelCase ( UpperCAmelCase_ : int = 100 ): """simple docstring""" a :List[Any] = 0 a :List[Any] = 0 for i in range(1 , n + 1 ): sum_of_squares += i**2 sum_of_ints += i return sum_of_int...
281
0
from typing import TYPE_CHECKING from ...utils import OptionalDependencyNotAvailable, _LazyModule, is_torch_available snake_case : List[Any] = { '''configuration_nllb_moe''': [ '''NLLB_MOE_PRETRAINED_CONFIG_ARCHIVE_MAP''', '''NllbMoeConfig''', ] } try: if...
358
import os import re from shutil import copyfile from typing import List, Optional, Tuple from ...tokenization_utils import PreTrainedTokenizer from ...utils import logging snake_case : List[str] = logging.get_logger(__name__) snake_case : Optional[Any] = { '''vocab_file''': '''vocab...
281
0
import argparse import torch from transformers import BlenderbotConfig, BlenderbotForConditionalGeneration from transformers.utils import logging logging.set_verbosity_info() snake_case : Dict = logging.get_logger(__name__) snake_case : int = [ ['''attention''', '''attn'''], ['...
359
# Copyright 2023 The HuggingFace Inc. team. All rights reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by a...
281
0
from __future__ import annotations def __lowerCamelCase ( UpperCAmelCase_ : tuple[int, int] , UpperCAmelCase_ : int ): """simple docstring""" a :Optional[int] = position a :str = [ (y + 1, x + 2), (y - 1, x + 2)...
360
from __future__ import annotations import random import unittest from transformers import TransfoXLConfig, 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 from ...tes...
281
0
from collections import Counter from timeit import timeit def __lowerCamelCase ( UpperCAmelCase_ : str = "" , ): """simple docstring""" return sum(c % 2 for c in Counter(input_str.replace(''' ''' , '''''' ).lower() ).values() ) < 2 def __lowerCamelCase ...
361
# 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 import deprecate depreca...
281
0
"""simple docstring""" from typing import List, Optional, Union import numpy as np import tensorflow as tf from .utils import logging snake_case : str = logging.get_logger(__name__) def __lowerCamelCase ( UpperCAmelCase_ : int ): """simple docstring""" ...
362
import gc import random import unittest import numpy as np import torch from transformers import CLIPTextConfig, CLIPTextModel, CLIPTokenizer from diffusers import AutoencoderKL, CycleDiffusionPipeline, DDIMScheduler, UNetaDConditionModel from diffusers.utils import floats_tensor, load_image, load_numpy, slow, tor...
281
0
def __lowerCamelCase ( UpperCAmelCase_ : int , UpperCAmelCase_ : int ): """simple docstring""" return int((input_a, input_a).count(0 ) == 0 ) def __lowerCamelCase ( ): """simple docstring""" assert and_gate(0 , 0 ) ...
363
from ...utils import ( OptionalDependencyNotAvailable, is_flax_available, is_torch_available, is_transformers_available, ) try: if not (is_transformers_available() and is_torch_available()): raise OptionalDependencyNotAvailable() except OptionalDependencyNotAvailable: from ...ut...
281
0
import json import os from datetime import date from pathlib import Path from tabulate import DataRow, TableFormat, tabulate snake_case : int = TableFormat( lineabove=None, linebelowheader=None, linebetweenrows=None, linebelow=None, headerrow=DataRow('''''', '''|''', '''|'''), ...
364
import json import os import unittest from transformers import MgpstrTokenizer from transformers.models.mgp_str.tokenization_mgp_str import VOCAB_FILES_NAMES from transformers.testing_utils import require_tokenizers from ...test_tokenization_common import TokenizerTesterMixin @require_tokenizers class _sn...
281
0
from __future__ import annotations snake_case : List[str] = [-10, -5, 0, 5, 5.1, 11, 13, 21, 3, 4, -21, -10, -5, -1, 0] snake_case : Union[str, Any] = [-5, 0, 5, 5.1, 11, 13, 21, -1, 4, -1, -10, -5, -1, 0, -1] def __lowerCamelCase ( UpperCAmelCase_ : list[float] ): ...
365
import os import unittest from transformers.models.bartpho.tokenization_bartpho import VOCAB_FILES_NAMES, BartphoTokenizer from transformers.testing_utils import get_tests_dir from ...test_tokenization_common import TokenizerTesterMixin snake_case : List[Any] = get_tests_dir('''fixtures/test_sentenc...
281
0
import logging import os import sys from dataclasses import dataclass, field from itertools import chain from typing import Optional, Union import datasets import numpy as np import torch from datasets import load_dataset import transformers from transformers import ( AutoConfig, AutoModelForMultipleChoice...
366
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 Image from ..image_utils impo...
281
0
import inspect import unittest from transformers import RegNetConfig from transformers.file_utils import cached_property, is_torch_available, is_vision_available from transformers.testing_utils import require_torch, require_vision, slow, torch_device from ...test_configuration_common import ConfigTester from ...te...
367
def __lowerCamelCase ( UpperCAmelCase_ : int ): """simple docstring""" if not isinstance(UpperCAmelCase_ , UpperCAmelCase_ ): raise TypeError('''Input value must be an \'int\' type''' ) a :Optional[int] = 0 while number: ...
281
0
from statistics import mean import numpy as np def __lowerCamelCase ( UpperCAmelCase_ : List[str] , UpperCAmelCase_ : Optional[Any] , UpperCAmelCase_ : Any , UpperCAmelCase_ : Dict ): a :Dict = 0 # Number of processes finished a :...
368
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 torch.utils.data import DataLoader, Rand...
281
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 ......
369
from . import __version__ # Backward compatibility imports, to make sure all those objects can be found in file_utils from .utils import ( CLOUDFRONT_DISTRIB_PREFIX, CONFIG_NAME, DISABLE_TELEMETRY, DUMMY_INPUTS, DUMMY_MASK, ENV_VARS_TRUE_AND_AUTO_VALUES, ENV_VARS_TRUE_VALUES, FEATURE...
281
0
import json import os import unittest from transformers.models.ctrl.tokenization_ctrl import VOCAB_FILES_NAMES, CTRLTokenizer from ...test_tokenization_common import TokenizerTesterMixin class _snake_case ( _lowerCAmelCase , unittest.TestCase ): SCREAMING_SNAKE_CASE__ = CTRLTokenizer ...
370
import math def __lowerCamelCase ( UpperCAmelCase_ : float , UpperCAmelCase_ : float ): """simple docstring""" return math.pow(UpperCAmelCase_ , 2 ) - a def __lowerCamelCase ( UpperCAmelCase_ : float ): """simple docstring"""...
281
0
import os import posixpath import uuid from dataclasses import dataclass from typing import TYPE_CHECKING, Iterable, List, Optional, Tuple, Union import numpy as np import pyarrow as pa import datasets from datasets.arrow_writer import ArrowWriter, ParquetWriter from datasets.config import MAX_SHARD_SIZE from data...
371
from collections import OrderedDict from typing import List, Mapping from packaging import version from ...configuration_utils import PretrainedConfig from ...onnx import OnnxConfig from ...utils import logging snake_case : Union[str, Any] = logging.get_logger(__name__) snake_case : List[str] ...
281
0
import math import time from transformers import Trainer, is_torch_tpu_available from transformers.trainer_utils import PredictionOutput, speed_metrics if is_torch_tpu_available(check_device=False): import torch_xla.core.xla_model as xm import torch_xla.debug.metrics as met class _snake_case (...
350
def __lowerCamelCase ( UpperCAmelCase_ : str ): """simple docstring""" if n_term == "": return [] a :list = [] for temp in range(int(UpperCAmelCase_ ) ): series.append(F'''1/{temp + 1}''' if series else '''1''' ...
281
0
def __lowerCamelCase ( ): """simple docstring""" a :Tuple = [] a :Dict = 1 while len(A__ ) < 1E6: constant.append(str(A__ ) ) i += 1 a :Tuple = """""".join(A__ ) return ( ...
351
import math from dataclasses import dataclass from typing import Optional, Tuple, Union import numpy as np import torch from ..configuration_utils import ConfigMixin, register_to_config from ..utils import BaseOutput, randn_tensor from .scheduling_utils import SchedulerMixin @dataclass # Copied from diffuse...
281
0
import argparse import json from typing import List from ltp import LTP from transformers.models.bert.tokenization_bert import BertTokenizer def __lowerCamelCase ( UpperCAmelCase_ : str ): """simple docstring""" if ( (cp >= 0x4_E00 and cp <= 0x9_FFF) o...
352
import os import pytest from datasets import ( get_dataset_config_info, get_dataset_config_names, get_dataset_infos, get_dataset_split_names, inspect_dataset, inspect_metric, ) snake_case : Any = pytest.mark.integration @pytest.mark.parametrize('''path''' , ['''paws''', ''...
281
0
import unittest from accelerate import debug_launcher from accelerate.test_utils import require_cpu, test_ops, test_script @require_cpu class _snake_case ( unittest.TestCase ): def SCREAMING_SNAKE_CASE__ ( self ): debug_launcher(test_script.main ) def SCREAMING_SNAKE_CA...
353
from ...configuration_utils import PretrainedConfig class _snake_case ( _snake_case ): SCREAMING_SNAKE_CASE__ = 'bert-generation' def __init__( self , _lowerCamelCase=5_0358 , _lowerCamelCase=1024 , _lowerCamelCase=24 , _lowerCamelCase=16 , _lowerCamelCase=4096 , _lowerCamelCase="g...
281
0
from math import cos, sin, sqrt, tau from audio_filters.iir_filter import IIRFilter def __lowerCamelCase ( UpperCAmelCase_ : int , UpperCAmelCase_ : int , UpperCAmelCase_ : float = 1 / sqrt(2 ) ): """simple docstring""" a :int = tau * f...
354
import numpy as np from matplotlib import pyplot as plt from sklearn.datasets import load_iris from sklearn.metrics import ConfusionMatrixDisplay from sklearn.model_selection import train_test_split from xgboost import XGBClassifier def __lowerCamelCase ( UpperCAmelCase_ : dict ): """...
281
0
def __lowerCamelCase ( UpperCAmelCase_ : Tuple , UpperCAmelCase_ : Union[str, Any] ): """simple docstring""" a :Optional[int] = len(UpperCAmelCase_ ) + 1 a :Optional[Any] = len(UpperCAmelCase_ ) + 1 # dp is a 2d ma...
355
from collections import OrderedDict from typing import Mapping from packaging import version from ...configuration_utils import PretrainedConfig from ...onnx import OnnxConfig from ...utils import logging snake_case : Optional[Any] = logging.get_logger(__name__) snake_case : Dict = { ...
281
0
def __lowerCamelCase ( UpperCAmelCase_ : int = 1000 ): """simple docstring""" a :int = 1, 1 a :Any = 2 while True: a :Optional[Any] = 0 a :Any = fa + fa a :Optional[...
356
from typing import TYPE_CHECKING from ....utils import OptionalDependencyNotAvailable, _LazyModule, is_torch_available, is_vision_available snake_case : Any = {'''configuration_van''': ['''VAN_PRETRAINED_CONFIG_ARCHIVE_MAP''', '''VanConfig''']} try: if not is_torch_available(): raise...
281
0
import argparse import json import os import fairseq import torch from fairseq.data import Dictionary # Register SEW's fairseq modules from sew_asapp import tasks # noqa: F401 from transformers import ( SEWConfig, SEWForCTC, SEWModel, WavaVecaCTCTokenizer, WavaVecaFeatureExtractor, WavaVe...
357
def __lowerCamelCase ( UpperCAmelCase_ : int = 100 ): """simple docstring""" a :List[Any] = 0 a :List[Any] = 0 for i in range(1 , n + 1 ): sum_of_squares += i**2 sum_of_ints += i return sum_of_int...
281
0
import math def __lowerCamelCase ( UpperCAmelCase_ : int ): """simple docstring""" return math.sqrt(_A ) * math.sqrt(_A ) == num def __lowerCamelCase ( UpperCAmelCase_ : Union[str, Any] ): """simple docstring"""...
358
import os import re from shutil import copyfile from typing import List, Optional, Tuple from ...tokenization_utils import PreTrainedTokenizer from ...utils import logging snake_case : List[str] = logging.get_logger(__name__) snake_case : Optional[Any] = { '''vocab_file''': '''vocab...
281
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 Im...
359
# Copyright 2023 The HuggingFace Inc. team. All rights reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by a...
281
0
import os import pytest import yaml from datasets.features.features import Features, Value from datasets.info import DatasetInfo, DatasetInfosDict @pytest.mark.parametrize( '''files''' , [ ['''full:README.md''', '''dataset_infos.json'''], ['''empty:README.md''', '''dataset_infos.json'''], ...
360
from __future__ import annotations import random import unittest from transformers import TransfoXLConfig, 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 from ...tes...
281
0
import argparse import hashlib import os import urllib import warnings import torch from torch import nn from tqdm import tqdm from transformers import WhisperConfig, WhisperForConditionalGeneration snake_case : List[str] = { "tiny.en": "https://openaipublic.azureedge.net/main/whisper/models/d3d...
361
# 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 import deprecate depreca...
281
0
"""simple docstring""" def __lowerCamelCase ( UpperCAmelCase_ : Union[str, Any] ): """simple docstring""" if isinstance(__snake_case , __snake_case ): raise TypeError('''\'float\' object cannot be interpreted as an integer''' ) if isinstan...
362
import gc import random import unittest import numpy as np import torch from transformers import CLIPTextConfig, CLIPTextModel, CLIPTokenizer from diffusers import AutoencoderKL, CycleDiffusionPipeline, DDIMScheduler, UNetaDConditionModel from diffusers.utils import floats_tensor, load_image, load_numpy, slow, tor...
281
0
import re from flax.core.frozen_dict import freeze from flax.traverse_util import flatten_dict, unflatten_dict from jax.experimental import PartitionSpec as P # Sentinels snake_case : Tuple = object() # For specifying empty leaf dict `{}` snake_case : int = object() def __lowerCamelCase ...
363
from ...utils import ( OptionalDependencyNotAvailable, is_flax_available, is_torch_available, is_transformers_available, ) try: if not (is_transformers_available() and is_torch_available()): raise OptionalDependencyNotAvailable() except OptionalDependencyNotAvailable: from ...ut...
281
0
import inspect import os import unittest import torch import accelerate from accelerate import debug_launcher from accelerate.test_utils import ( execute_subprocess_async, require_cpu, require_huggingface_suite, require_multi_gpu, require_single_gpu, ) from accelerate.utils import patch_environ...
364
import json import os import unittest from transformers import MgpstrTokenizer from transformers.models.mgp_str.tokenization_mgp_str import VOCAB_FILES_NAMES from transformers.testing_utils import require_tokenizers from ...test_tokenization_common import TokenizerTesterMixin @require_tokenizers class _sn...
281
0
# tests directory-specific settings - this file is run automatically # by pytest before any tests are run import sys import warnings from os.path import abspath, dirname, join # allow having multiple repository checkouts and not needing to remember to rerun # 'pip install -e .[dev]' when switching between checkou...
365
import os import unittest from transformers.models.bartpho.tokenization_bartpho import VOCAB_FILES_NAMES, BartphoTokenizer from transformers.testing_utils import get_tests_dir from ...test_tokenization_common import TokenizerTesterMixin snake_case : List[Any] = get_tests_dir('''fixtures/test_sentenc...
281
0
import argparse import re from flax.traverse_util import flatten_dict, unflatten_dict from tax import checkpoints from transformers import SwitchTransformersConfig, SwitchTransformersForConditionalGeneration from transformers.modeling_flax_pytorch_utils import load_flax_weights_in_pytorch_model from transformers.u...
366
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 Image from ..image_utils impo...
281
0
import unittest import numpy as np import requests from transformers.testing_utils import require_torch, require_vision from transformers.utils import is_torch_available, is_vision_available from ...test_image_processing_common import ImageProcessingSavingTestMixin, prepare_image_inputs if is_torch_available():...
367
def __lowerCamelCase ( UpperCAmelCase_ : int ): """simple docstring""" if not isinstance(UpperCAmelCase_ , UpperCAmelCase_ ): raise TypeError('''Input value must be an \'int\' type''' ) a :Optional[int] = 0 while number: ...
281
0
import os import re import shutil import sys import tempfile import unittest import black snake_case : int = os.path.abspath(os.path.dirname(os.path.dirname(os.path.dirname(__file__)))) sys.path.append(os.path.join(git_repo_path, '''utils''')) import check_copies # noqa: E402 # This is the refere...
368
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 torch.utils.data import DataLoader, Rand...
281
0
"""simple docstring""" import unittest from parameterized import parameterized from transformers import AutoTokenizer, GPTNeoXConfig, is_torch_available, set_seed from transformers.testing_utils import require_torch, slow, torch_device from ...generation.test_utils import GenerationTesterMixin from ...test_co...
369
from . import __version__ # Backward compatibility imports, to make sure all those objects can be found in file_utils from .utils import ( CLOUDFRONT_DISTRIB_PREFIX, CONFIG_NAME, DISABLE_TELEMETRY, DUMMY_INPUTS, DUMMY_MASK, ENV_VARS_TRUE_AND_AUTO_VALUES, ENV_VARS_TRUE_VALUES, FEATURE...
281
0
from __future__ import annotations from collections import namedtuple from dataclasses import dataclass @dataclass class _snake_case : SCREAMING_SNAKE_CASE__ = 42 SCREAMING_SNAKE_CASE__ = None SCREAMING_SNAKE_CASE__ = None snake_case : int = namedtuple('''CoinsDistribResult...
370
import math def __lowerCamelCase ( UpperCAmelCase_ : float , UpperCAmelCase_ : float ): """simple docstring""" return math.pow(UpperCAmelCase_ , 2 ) - a def __lowerCamelCase ( UpperCAmelCase_ : float ): """simple docstring"""...
281
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 ...onnx.ut...
371
from collections import OrderedDict from typing import List, Mapping from packaging import version from ...configuration_utils import PretrainedConfig from ...onnx import OnnxConfig from ...utils import logging snake_case : Union[str, Any] = logging.get_logger(__name__) snake_case : List[str] ...
281
0
import logging from dataclasses import dataclass, field from typing import Optional from seqaseq_trainer import arg_to_scheduler from transformers import TrainingArguments _lowerCamelCase : Union[str, Any] = logging.getLogger(__name__) @dataclass class _snake_case ( _snake_case ):...
350
def __lowerCamelCase ( UpperCAmelCase_ : str ): """simple docstring""" if n_term == "": return [] a :list = [] for temp in range(int(UpperCAmelCase_ ) ): series.append(F'''1/{temp + 1}''' if series else '''1''' ...
281
0
def __lowerCamelCase ( UpperCAmelCase_ : int = 50 ): """simple docstring""" a :str = [1] * (length + 1) for row_length in range(length + 1 ): for tile_length in range(2 , 5 ): for tile_start in range(row_length...
351
import math from dataclasses import dataclass from typing import Optional, Tuple, Union import numpy as np import torch from ..configuration_utils import ConfigMixin, register_to_config from ..utils import BaseOutput, randn_tensor from .scheduling_utils import SchedulerMixin @dataclass # Copied from diffuse...
281
0
import unittest from transformers import BigBirdTokenizer, BigBirdTokenizerFast from transformers.testing_utils import get_tests_dir, require_sentencepiece, require_tokenizers, require_torch, slow from transformers.utils import cached_property from ...test_tokenization_common import TokenizerTesterMixin snake_ca...
352
import os import pytest from datasets import ( get_dataset_config_info, get_dataset_config_names, get_dataset_infos, get_dataset_split_names, inspect_dataset, inspect_metric, ) snake_case : Any = pytest.mark.integration @pytest.mark.parametrize('''path''' , ['''paws''', ''...
281
0
import unittest from transformers import is_torch_available from transformers.testing_utils import require_sentencepiece, require_tokenizers, require_torch, slow if is_torch_available(): import torch from transformers import XLMRobertaModel @require_sentencepiece @require_tokenizers @require_t...
353
from ...configuration_utils import PretrainedConfig class _snake_case ( _snake_case ): SCREAMING_SNAKE_CASE__ = 'bert-generation' def __init__( self , _lowerCamelCase=5_0358 , _lowerCamelCase=1024 , _lowerCamelCase=24 , _lowerCamelCase=16 , _lowerCamelCase=4096 , _lowerCamelCase="g...
281
0
def __lowerCamelCase ( UpperCAmelCase_ : int , UpperCAmelCase_ : int ): """simple docstring""" return int(input_a == input_a == 0 ) def __lowerCamelCase ( ): """simple docstring""" print('''Truth Table of NOR Gate:''' ) ...
354
import numpy as np from matplotlib import pyplot as plt from sklearn.datasets import load_iris from sklearn.metrics import ConfusionMatrixDisplay from sklearn.model_selection import train_test_split from xgboost import XGBClassifier def __lowerCamelCase ( UpperCAmelCase_ : dict ): """...
281
0
import numpy as np import torch from torch.nn import CrossEntropyLoss from transformers import AutoModelForCausalLM, AutoTokenizer import datasets from datasets import logging snake_case : Any = '''\ ''' snake_case : int = ''' Perplexity (PPL) is one of the most common metrics for eval...
355
from collections import OrderedDict from typing import Mapping from packaging import version from ...configuration_utils import PretrainedConfig from ...onnx import OnnxConfig from ...utils import logging snake_case : Optional[Any] = logging.get_logger(__name__) snake_case : Dict = { ...
281
0
from __future__ import annotations class _snake_case : def __init__( self , _lowerCamelCase ): a :List[str] = data a :Node | None = None a :Node | None = None def __lowerCamelCase ( UpperCAmelCase_ : Node | None...
356
from typing import TYPE_CHECKING from ....utils import OptionalDependencyNotAvailable, _LazyModule, is_torch_available, is_vision_available snake_case : Any = {'''configuration_van''': ['''VAN_PRETRAINED_CONFIG_ARCHIVE_MAP''', '''VanConfig''']} try: if not is_torch_available(): raise...
281
0
def __lowerCamelCase ( UpperCAmelCase_ : int , UpperCAmelCase_ : list[int] , UpperCAmelCase_ : int ): """simple docstring""" def count_of_possible_combinations(UpperCAmelCase_ : int ) -> int: if target < 0: return 0...
357
def __lowerCamelCase ( UpperCAmelCase_ : int = 100 ): """simple docstring""" a :List[Any] = 0 a :List[Any] = 0 for i in range(1 , n + 1 ): sum_of_squares += i**2 sum_of_ints += i return sum_of_int...
281
0
import argparse import csv import logging import os import random import numpy as np import torch from torch.utils.data import DataLoader, RandomSampler, SequentialSampler, TensorDataset from tqdm import tqdm, trange from transformers import ( CONFIG_NAME, WEIGHTS_NAME, AdamW, Ope...
358
import os import re from shutil import copyfile from typing import List, Optional, Tuple from ...tokenization_utils import PreTrainedTokenizer from ...utils import logging snake_case : List[str] = logging.get_logger(__name__) snake_case : Optional[Any] = { '''vocab_file''': '''vocab...
281
0
import argparse import math import traceback import dateutil.parser as date_parser import requests def __lowerCamelCase ( UpperCAmelCase_ : Any ): """simple docstring""" a :int = {} a :List[Any] = job['''started_at'''] a :List[...
359
# Copyright 2023 The HuggingFace Inc. team. All rights reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by a...
281
0
import unittest import numpy as np from transformers.file_utils import is_torch_available, is_vision_available from transformers.testing_utils import require_torch, require_vision from ...test_image_processing_common import ImageProcessingSavingTestMixin, prepare_image_inputs if is_torch_available(): impor...
360
from __future__ import annotations import random import unittest from transformers import TransfoXLConfig, 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 from ...tes...
281
0
def __lowerCamelCase ( UpperCAmelCase_ : list ): """simple docstring""" def merge(UpperCAmelCase_ : list , UpperCAmelCase_ : list ) -> list: def _merge(): while left and right: yield (left if left[0]...
361
# 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 import deprecate depreca...
281
0
"""simple docstring""" import math from dataclasses import dataclass from typing import Optional, Tuple, Union import numpy as np import torch from ..configuration_utils import ConfigMixin, register_to_config from ..utils import BaseOutput, randn_tensor from .scheduling_utils import SchedulerMixin @data...
362
import gc import random import unittest import numpy as np import torch from transformers import CLIPTextConfig, CLIPTextModel, CLIPTokenizer from diffusers import AutoencoderKL, CycleDiffusionPipeline, DDIMScheduler, UNetaDConditionModel from diffusers.utils import floats_tensor, load_image, load_numpy, slow, tor...
281
0
# Lint as: python3 import os import re import urllib.parse from pathlib import Path from typing import Callable, List, Optional, Union from zipfile import ZipFile from ..utils.file_utils import cached_path, hf_github_url from ..utils.logging import get_logger from ..utils.version import Version snake_case : ...
363
from ...utils import ( OptionalDependencyNotAvailable, is_flax_available, is_torch_available, is_transformers_available, ) try: if not (is_transformers_available() and is_torch_available()): raise OptionalDependencyNotAvailable() except OptionalDependencyNotAvailable: from ...ut...
281
0
import argparse import re import torch from CLAP import create_model from transformers import AutoFeatureExtractor, ClapConfig, ClapModel snake_case : Tuple = { '''text_branch''': '''text_model''', '''audio_branch''': '''audio_model.audio_encoder''', '''attn''': '''attention.self''', ...
364
import json import os import unittest from transformers import MgpstrTokenizer from transformers.models.mgp_str.tokenization_mgp_str import VOCAB_FILES_NAMES from transformers.testing_utils import require_tokenizers from ...test_tokenization_common import TokenizerTesterMixin @require_tokenizers class _sn...
281
0
def __lowerCamelCase ( UpperCAmelCase_ : int ): """simple docstring""" if not isinstance(UpperCAmelCase_ , UpperCAmelCase_ ): raise TypeError('''Input value must be an \'int\' type''' ) a :Optional[int] = 0 while number: ...
365
import os import unittest from transformers.models.bartpho.tokenization_bartpho import VOCAB_FILES_NAMES, BartphoTokenizer from transformers.testing_utils import get_tests_dir from ...test_tokenization_common import TokenizerTesterMixin snake_case : List[Any] = get_tests_dir('''fixtures/test_sentenc...
281
0
from typing import List, Optional, Tuple, Union import torch from ...models import UNetaDModel from ...schedulers import KarrasVeScheduler from ...utils import randn_tensor from ..pipeline_utils import DiffusionPipeline, ImagePipelineOutput class _snake_case ( _snake_case ): SCREAMING_SNAKE_C...
366
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 Image from ..image_utils impo...
281
0
from __future__ import annotations from dataclasses import dataclass @dataclass class _snake_case : SCREAMING_SNAKE_CASE__ = 42 SCREAMING_SNAKE_CASE__ = None SCREAMING_SNAKE_CASE__ = None def __lowerCamelCase ( UpperCAmelCase_ : TreeNode | None ): """simp...
367
def __lowerCamelCase ( UpperCAmelCase_ : int ): """simple docstring""" if not isinstance(UpperCAmelCase_ , UpperCAmelCase_ ): raise TypeError('''Input value must be an \'int\' type''' ) a :Optional[int] = 0 while number: ...
281
0
from __future__ import annotations def __lowerCamelCase ( UpperCAmelCase_ : float , UpperCAmelCase_ : float , UpperCAmelCase_ : float , ): if (electron_conc, hole_conc, intrinsic_conc).count(0 ) != 1: raise ValueError('''You cannot supply more or less...
368
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 torch.utils.data import DataLoader, Rand...
281
0
"""simple docstring""" import absl # noqa: F401 # Here to have a nice missing dependency error message early on import nltk # noqa: F401 # Here to have a nice missing dependency error message early on import numpy # noqa: F401 # Here to have a nice missing dependency error message early on import six # noqa:...
369
from . import __version__ # Backward compatibility imports, to make sure all those objects can be found in file_utils from .utils import ( CLOUDFRONT_DISTRIB_PREFIX, CONFIG_NAME, DISABLE_TELEMETRY, DUMMY_INPUTS, DUMMY_MASK, ENV_VARS_TRUE_AND_AUTO_VALUES, ENV_VARS_TRUE_VALUES, FEATURE...
281
0
import argparse import requests import torch # pip3 install salesforce-lavis # I'm actually installing a slightly modified version: pip3 install git+https://github.com/nielsrogge/LAVIS.git@fix_lavis from lavis.models import load_model_and_preprocess from PIL import Image from transformers import ( AutoTokeniz...
370
import math def __lowerCamelCase ( UpperCAmelCase_ : float , UpperCAmelCase_ : float ): """simple docstring""" return math.pow(UpperCAmelCase_ , 2 ) - a def __lowerCamelCase ( UpperCAmelCase_ : float ): """simple docstring"""...
281
0
import math import torch from torch import nn from ..configuration_utils import ConfigMixin, register_to_config from .attention_processor import Attention from .embeddings import get_timestep_embedding from .modeling_utils import ModelMixin class _snake_case ( _snake_case , _snake_case ...
371
from collections import OrderedDict from typing import List, Mapping from packaging import version from ...configuration_utils import PretrainedConfig from ...onnx import OnnxConfig from ...utils import logging snake_case : Union[str, Any] = logging.get_logger(__name__) snake_case : List[str] ...
281
0
import json import os import unittest from transformers.models.ctrl.tokenization_ctrl import VOCAB_FILES_NAMES, CTRLTokenizer from ...test_tokenization_common import TokenizerTesterMixin class _snake_case ( _snake_case , unittest.TestCase ): SCREAMING_SNAKE_CASE__ = CTRLTokenizer SCR...
350
def __lowerCamelCase ( UpperCAmelCase_ : str ): """simple docstring""" if n_term == "": return [] a :list = [] for temp in range(int(UpperCAmelCase_ ) ): series.append(F'''1/{temp + 1}''' if series else '''1''' ...
281
0
import string def __lowerCamelCase ( UpperCAmelCase_ : str ): """simple docstring""" a :Optional[Any] = '''''' for i in sequence: a :List[Any] = ord(UpperCAmelCase_ ) if 65 <= extract <= 90: ou...
351
import math from dataclasses import dataclass from typing import Optional, Tuple, Union import numpy as np import torch from ..configuration_utils import ConfigMixin, register_to_config from ..utils import BaseOutput, randn_tensor from .scheduling_utils import SchedulerMixin @dataclass # Copied from diffuse...
281
0
import argparse from pathlib import Path import requests import torch from PIL import Image from transformers import ( RobertaTokenizer, TrOCRConfig, TrOCRForCausalLM, TrOCRProcessor, VisionEncoderDecoderModel, ViTConfig, ViTImageProcessor, ViTModel, ) from transformers.utils import...
352
import os import pytest from datasets import ( get_dataset_config_info, get_dataset_config_names, get_dataset_infos, get_dataset_split_names, inspect_dataset, inspect_metric, ) snake_case : Any = pytest.mark.integration @pytest.mark.parametrize('''path''' , ['''paws''', ''...
281
0
from timeit import timeit snake_case : Tuple = { '''MALAYALAM''': True, '''String''': False, '''rotor''': True, '''level''': True, '''A''': True, '''BB''': True, '''ABC''': False, '''amanaplanacanalpanama''': True, # "a man a plan a canal panama" } # Ensure our test dat...
353
from ...configuration_utils import PretrainedConfig class _snake_case ( _snake_case ): SCREAMING_SNAKE_CASE__ = 'bert-generation' def __init__( self , _lowerCamelCase=5_0358 , _lowerCamelCase=1024 , _lowerCamelCase=24 , _lowerCamelCase=16 , _lowerCamelCase=4096 , _lowerCamelCase="g...
281
0
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, DDIMInverseScheduler, DDIMScheduler, DPMSolverMultistepInverseScheduler, DPM...
354
import numpy as np from matplotlib import pyplot as plt from sklearn.datasets import load_iris from sklearn.metrics import ConfusionMatrixDisplay from sklearn.model_selection import train_test_split from xgboost import XGBClassifier def __lowerCamelCase ( UpperCAmelCase_ : dict ): """...
281
0
from ...configuration_utils import PretrainedConfig from ...utils import logging snake_case : Any = logging.get_logger(__name__) snake_case : Tuple = { '''facebook/dpr-ctx_encoder-single-nq-base''': ( '''https://huggingface.co/facebook/dpr-ctx_encoder-single-nq-base/resolve/m...
355
from collections import OrderedDict from typing import Mapping from packaging import version from ...configuration_utils import PretrainedConfig from ...onnx import OnnxConfig from ...utils import logging snake_case : Optional[Any] = logging.get_logger(__name__) snake_case : Dict = { ...
281
0
import math def __lowerCamelCase ( UpperCAmelCase_ : float , UpperCAmelCase_ : float ): """simple docstring""" return math.pow(UpperCAmelCase_ , 2 ) - a def __lowerCamelCase ( UpperCAmelCase_ : float ): """simple docstring"""...
356
from typing import TYPE_CHECKING from ....utils import OptionalDependencyNotAvailable, _LazyModule, is_torch_available, is_vision_available snake_case : Any = {'''configuration_van''': ['''VAN_PRETRAINED_CONFIG_ARCHIVE_MAP''', '''VanConfig''']} try: if not is_torch_available(): raise...
281
0
from __future__ import annotations import random import unittest from transformers import TransfoXLConfig, 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 from ...tes...
357
def __lowerCamelCase ( UpperCAmelCase_ : int = 100 ): """simple docstring""" a :List[Any] = 0 a :List[Any] = 0 for i in range(1 , n + 1 ): sum_of_squares += i**2 sum_of_ints += i return sum_of_int...
281
0
import unittest import numpy as np import requests from transformers.testing_utils import require_torch, require_vision from transformers.utils import is_torch_available, is_vision_available from ...test_image_processing_common import ImageProcessingSavingTestMixin, prepare_image_inputs if is_torc...
358
import os import re from shutil import copyfile from typing import List, Optional, Tuple from ...tokenization_utils import PreTrainedTokenizer from ...utils import logging snake_case : List[str] = logging.get_logger(__name__) snake_case : Optional[Any] = { '''vocab_file''': '''vocab...
281
0
import pytest from datasets.utils.sharding import _distribute_shards, _number_of_shards_in_gen_kwargs, _split_gen_kwargs @pytest.mark.parametrize( '''kwargs, expected''' , [ ({'''num_shards''': 0, '''max_num_jobs''': 1}, []), ({'''num_shards''': 10, '''max_num_jobs''': 1}, [range(10 )]),...
359
# Copyright 2023 The HuggingFace Inc. team. All rights reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by a...
281
0
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 snake_case : Dict = logging.get_logger(__name__) ...
360
from __future__ import annotations import random import unittest from transformers import TransfoXLConfig, 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 from ...tes...
281
0
import warnings from ...utils import logging from .image_processing_yolos import YolosImageProcessor snake_case : Tuple = logging.get_logger(__name__) class _snake_case ( _snake_case ): def __init__( self , *_lowerCamelCase , **_lowerCamelCase ): warnings.warn( ...
361
# 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 import deprecate depreca...
281
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...
362
import gc import random import unittest import numpy as np import torch from transformers import CLIPTextConfig, CLIPTextModel, CLIPTokenizer from diffusers import AutoencoderKL, CycleDiffusionPipeline, DDIMScheduler, UNetaDConditionModel from diffusers.utils import floats_tensor, load_image, load_numpy, slow, tor...
281
0
from transformers import BertTokenizer, EncoderDecoderModel, SeqaSeqTrainer, SeqaSeqTrainingArguments from transformers.testing_utils import TestCasePlus, require_torch, slow from transformers.utils import is_datasets_available if is_datasets_available(): import datasets class _snake_case ( _snak...
363
from ...utils import ( OptionalDependencyNotAvailable, is_flax_available, is_torch_available, is_transformers_available, ) try: if not (is_transformers_available() and is_torch_available()): raise OptionalDependencyNotAvailable() except OptionalDependencyNotAvailable: from ...ut...
281
0
import json import sys def __lowerCamelCase ( UpperCAmelCase_ : Dict , UpperCAmelCase_ : Optional[int] ): """simple docstring""" with open(UpperCAmelCase_ , encoding='''utf-8''' ) as f: a :List[str] = json.load(UpperCAmelCase_ ...
364
import json import os import unittest from transformers import MgpstrTokenizer from transformers.models.mgp_str.tokenization_mgp_str import VOCAB_FILES_NAMES from transformers.testing_utils import require_tokenizers from ...test_tokenization_common import TokenizerTesterMixin @require_tokenizers class _sn...
281
0
def __lowerCamelCase ( UpperCAmelCase_ : int = 100_0000 ): """simple docstring""" a :int = [i - 1 for i in range(limit + 1 )] for i in range(2 , limit + 1 ): if phi[i] == i - 1: for j in range(2 * i , limit ...
365
import os import unittest from transformers.models.bartpho.tokenization_bartpho import VOCAB_FILES_NAMES, BartphoTokenizer from transformers.testing_utils import get_tests_dir from ...test_tokenization_common import TokenizerTesterMixin snake_case : List[Any] = get_tests_dir('''fixtures/test_sentenc...
281
0