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 os import time import warnings from dataclasses import dataclass, field from enum import Enum from typing import List, Optional, Union import torch from filelock import FileLock from torch.utils.data import Dataset from ...tokenization_utils_base import PreTrainedTokenizerBase from ...utils import logging ...
364
from typing import TYPE_CHECKING from ....utils import _LazyModule a : Tuple = {'tokenization_tapex': ['TapexTokenizer']} if TYPE_CHECKING: from .tokenization_tapex import TapexTokenizer else: import sys a : List[Any] = _LazyModule(__name__, globals()['_...
82
0
import unittest import numpy as np from transformers.testing_utils import require_pytesseract, require_torch from transformers.utils import is_pytesseract_available, is_torch_available from ...test_image_processing_common import ImageProcessingSavingTestMixin, prepare_image_inputs if is_torch_ava...
365
import unittest from transformers import ( MODEL_FOR_SEQUENCE_CLASSIFICATION_MAPPING, TF_MODEL_FOR_SEQUENCE_CLASSIFICATION_MAPPING, Pipeline, ZeroShotClassificationPipeline, pipeline, ) from transformers.testing_utils import is_pipeline_test, nested_simplify, require_tf, require_to...
82
0
"""simple docstring""" from typing import List import jiwer import jiwer.transforms as tr from packaging import version import datasets from datasets.config import PY_VERSION if PY_VERSION < version.parse('3.8'): import importlib_metadata else: import importlib.metadata as importlib_...
366
import argparse from collections import OrderedDict from pathlib import Path import requests import torch from PIL import Image from transformers import GLPNConfig, GLPNForDepthEstimation, GLPNImageProcessor from transformers.utils import logging logging.set_verbosity_info() a : List[...
82
0
import numpy as np def lowerCAmelCase_ (lowerCAmelCase__: Union[str, Any] , lowerCAmelCase__: Any , lowerCAmelCase__: Dict , lowerCAmelCase__: Tuple , lowerCAmelCase__: List[Any] ): """simple docstring""" ...
367
from __future__ import annotations def lowerCAmelCase_ (lowerCAmelCase__: list[int | float] , lowerCAmelCase__: int , lowerCAmelCase__: int ): """simple docstring""" if len(lowerCAmelCase__ ) == 0: raise ValueError("""fin...
82
0
import argparse import torch from transformers import FunnelBaseModel, FunnelConfig, FunnelModel, load_tf_weights_in_funnel from transformers.utils import logging logging.set_verbosity_info() def lowerCAmelCase_ (lowerCAmelCase__: List[Any] , lowerCAmelCase__: Opti...
368
import json from typing import List, Optional, Tuple from tokenizers import normalizers from ...tokenization_utils_fast import PreTrainedTokenizerFast from ...utils import logging from .tokenization_squeezebert import SqueezeBertTokenizer a : Optional[Any] = logging.get_logger(__na...
82
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_ (lowerCAmel...
369
import inspect import unittest import numpy as np from tests.test_modeling_common import floats_tensor from transformers import MaskaFormerConfig, is_torch_available, is_vision_available from transformers.testing_utils import require_torch, require_torch_multi_gpu, require_vision, slow, torch_device f...
82
0
from multiprocessing import Lock, Pipe, Process # lock used to ensure that two processes do not access a pipe at the same time a : Union[str, Any] = Lock() def lowerCAmelCase_ (lowerCAmelCase__: Optional[int] , lowerCAmelCase__: int , lowerCAmelCase...
370
from collections import defaultdict class _a : def __init__(self, SCREAMING_SNAKE_CASE_, SCREAMING_SNAKE_CASE_ ) -> List[str]: UpperCAmelCase_: Optional[int] = total # total no of tasks (N) # DP table will have a dimension of (2^M)*N ...
82
0
import unittest import numpy as np from diffusers import LMSDiscreteScheduler, OnnxStableDiffusionInpaintPipeline from diffusers.utils.testing_utils import ( is_onnx_available, load_image, nightly, require_onnxruntime, require_torch_gpu, ) from ..test_pipelines_onnx_common im...
371
import unittest from transformers import load_tool from .test_tools_common import ToolTesterMixin class _a ( unittest.TestCase , _lowerCAmelCase ): def __snake_case (self ) -> Optional[int]: UpperCAmelCase_: Optional[int] = l...
82
0
import argparse from collections import defaultdict import yaml a : List[Any] = 'docs/source/en/_toctree.yml' def lowerCAmelCase_ (lowerCAmelCase__: str ): """simple docstring""" UpperCAmelCase_: Optional[int] = d...
350
a : Tuple = 'Tobias Carryer' from time import time class _a : def __init__(self, SCREAMING_SNAKE_CASE_, SCREAMING_SNAKE_CASE_, SCREAMING_SNAKE_CASE_, SCREAMING_SNAKE_CASE_=int(time() ) ) -> List[Any]: # noqa: B008 UpperCAmelCase_: List[str]...
82
0
import copy import unittest from transformers.models.auto import get_values from transformers.testing_utils import require_torch, slow, torch_device from transformers.utils import cached_property, is_torch_available, is_vision_available from ...test_configuration_common import ConfigTester from ...tes...
351
import logging import math import os from dataclasses import dataclass, field from glob import glob from typing import Optional from torch.utils.data import ConcatDataset import transformers from transformers import ( CONFIG_MAPPING, MODEL_WITH_LM_HEAD_MAPPING, AutoConfig, AutoMo...
82
0
def lowerCAmelCase_ (lowerCAmelCase__: str ): """simple docstring""" return " ".join(input_str.split()[::-1] ) if __name__ == "__main__": import doctest doctest.testmod()
352
def lowerCAmelCase_ (lowerCAmelCase__: int , lowerCAmelCase__: float , lowerCAmelCase__: float ): """simple docstring""" return round(float(moles / volume ) * nfactor ) def lowerCAmelCase_ (lowerCAmelCase__: f...
82
0
from operator import delitem, getitem, setitem import pytest from data_structures.hashing.hash_map import HashMap def lowerCAmelCase_ (lowerCAmelCase__: List[Any] ): """simple docstring""" return getitem, k def lowerCAmelCase_ ...
353
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...
82
0
import os from shutil import copyfile from typing import Any, Dict, List, Optional, Tuple import sentencepiece as spm from ...tokenization_utils import PreTrainedTokenizer from ...utils import logging a : Union[str, Any] = logging.get_logger(__name__) a : Optional[An...
354
from __future__ import annotations import inspect import unittest from math import floor import numpy as np from transformers import CvtConfig from transformers.testing_utils import require_tf, require_vision, slow from transformers.utils import cached_property, is_tf_available, is_vision_available...
82
0
import argparse import re import torch from CLAP import create_model from transformers import AutoFeatureExtractor, ClapConfig, ClapModel a : Optional[int] = { 'text_branch': 'text_model', 'audio_branch': 'audio_model.audio_encoder', 'attn': 'attention.self', ...
355
import importlib import os import fsspec import pytest from fsspec import register_implementation from fsspec.registry import _registry as _fsspec_registry from datasets.filesystems import COMPRESSION_FILESYSTEMS, HfFileSystem, extract_path_from_uri, is_remote_filesystem from .utils import require_...
82
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...
356
import argparse import re import torch from CLAP import create_model from transformers import AutoFeatureExtractor, ClapConfig, ClapModel a : Optional[int] = { 'text_branch': 'text_model', 'audio_branch': 'audio_model.audio_encoder', 'attn': 'attention.self', 'se...
82
0
import gc import unittest import numpy as np import torch from diffusers import AutoencoderKL, DDIMScheduler, DiTPipeline, DPMSolverMultistepScheduler, TransformeraDModel from diffusers.utils import is_xformers_available, load_numpy, slow, torch_device from diffusers.utils.testing_utils import enable_...
357
import json from typing import List, Optional, Tuple from tokenizers import normalizers from ...tokenization_utils_fast import PreTrainedTokenizerFast from .tokenization_electra import ElectraTokenizer a : List[str] = {'vocab_file': 'vocab.txt', 'tokenizer_file': 'tokenizer.json'} ...
82
0
from typing import TYPE_CHECKING from ...utils import ( OptionalDependencyNotAvailable, _LazyModule, is_flax_available, is_sentencepiece_available, is_tf_available, is_tokenizers_available, is_torch_available, ) if is_sentencepiece_available(): from ..ta.tokenization_ta import TaToke...
358
import coval # From: git+https://github.com/ns-moosavi/coval.git # noqa: F401 from coval.conll import reader, util from coval.eval import evaluator import datasets a : Dict = datasets.logging.get_logger(__name__) a : Any = '\\n@InProceedings{moosavi2019minimum,\n ...
82
0
import gc import unittest import numpy as np import torch from diffusers import DanceDiffusionPipeline, IPNDMScheduler, UNetaDModel from diffusers.utils import slow, torch_device from diffusers.utils.testing_utils import enable_full_determinism, require_torch_gpu, skip_mps from ..pipeline_params im...
359
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...
82
0
import numpy as np import torch import torch.nn as nn from transformers import CLIPConfig, CLIPVisionModelWithProjection, PreTrainedModel from ...utils import logging a : str = logging.get_logger(__name__) class _a ( _lowerCAmelCase ): A = ...
360
import math from typing import Optional import numpy as np from ...configuration_utils import PretrainedConfig from ...utils import logging a : Tuple = logging.get_logger(__name__) a : Optional[Any] = { 'facebook/encodec_24khz': 'https://huggingface.co/facebo...
82
0
import shutil import tempfile import unittest from transformers import SPIECE_UNDERLINE, BatchEncoding, MBartTokenizer, MBartTokenizerFast, is_torch_available from transformers.testing_utils import ( get_tests_dir, nested_simplify, require_sentencepiece, require_tokenizers, requir...
361
import unittest from parameterized import parameterized from transformers import OpenLlamaConfig, is_torch_available, set_seed from transformers.testing_utils import require_torch, torch_device from ...generation.test_utils import GenerationTesterMixin from ...test_configuration_common import ConfigT...
82
0
import argparse import glob import logging import os import sys import time from collections import defaultdict from pathlib import Path from typing import Dict, List, Tuple import numpy as np import pytorch_lightning as pl import torch from callbacks import SeqaSeqLoggingCallback, get_checkpoint_...
362
from __future__ import annotations def lowerCAmelCase_ (lowerCAmelCase__: list[float] ): """simple docstring""" UpperCAmelCase_: Union[str, Any] = 0.00 UpperCAmelCase_: List[str] = 0 for resistor in resistors: ...
82
0
import unittest from transformers import ( MODEL_FOR_SEQUENCE_CLASSIFICATION_MAPPING, TF_MODEL_FOR_SEQUENCE_CLASSIFICATION_MAPPING, Pipeline, ZeroShotClassificationPipeline, pipeline, ) from transformers.testing_utils import is_pipeline_test, nested_simplify, require_tf, require_to...
363
import argparse import os import torch from transformers import ( XLNetConfig, XLNetForQuestionAnswering, XLNetForSequenceClassification, XLNetLMHeadModel, load_tf_weights_in_xlnet, ) from transformers.utils import CONFIG_NAME, WEIGHTS_NAME, logging a : str ...
82
0
import shutil import tempfile import unittest import numpy as np import pytest from transformers.testing_utils import require_vision from transformers.utils import is_vision_available if is_vision_available(): from PIL import Image from transformers import ( AutoProcessor, BertTokenizerFast, B...
364
from typing import TYPE_CHECKING from ....utils import _LazyModule a : Tuple = {'tokenization_tapex': ['TapexTokenizer']} if TYPE_CHECKING: from .tokenization_tapex import TapexTokenizer else: import sys a : List[Any] = _LazyModule(__name__, globals()['_...
82
0
import warnings from ...utils import logging from .image_processing_poolformer import PoolFormerImageProcessor a : List[str] = logging.get_logger(__name__) class _a ( _lowerCAmelCase ): def __init__(self, *SCREAMING_SNAKE_CASE_, **SCREAMING_SNAKE_CASE...
365
import unittest from transformers import ( MODEL_FOR_SEQUENCE_CLASSIFICATION_MAPPING, TF_MODEL_FOR_SEQUENCE_CLASSIFICATION_MAPPING, Pipeline, ZeroShotClassificationPipeline, pipeline, ) from transformers.testing_utils import is_pipeline_test, nested_simplify, require_tf, require_to...
82
0
"""simple docstring""" from __future__ import annotations import numpy as np from numpy import floataa from numpy.typing import NDArray def lowerCAmelCase_ (lowerCAmelCase__: NDArray[floataa] , lowerCAmelCase__: NDArray[floataa] , lowerCAmelCase__: ...
366
import argparse from collections import OrderedDict from pathlib import Path import requests import torch from PIL import Image from transformers import GLPNConfig, GLPNForDepthEstimation, GLPNImageProcessor from transformers.utils import logging logging.set_verbosity_info() a : List[...
82
0
import functools import operator from ...configuration_utils import PretrainedConfig from ...utils import logging a : List[Any] = logging.get_logger(__name__) a : List[Any] = { 'microsoft/unispeech-large-1500h-cv': ( 'https://huggingface.co/microsoft/un...
367
from __future__ import annotations def lowerCAmelCase_ (lowerCAmelCase__: list[int | float] , lowerCAmelCase__: int , lowerCAmelCase__: int ): """simple docstring""" if len(lowerCAmelCase__ ) == 0: raise ValueError("""fin...
82
0
from collections.abc import Sequence def lowerCAmelCase_ (lowerCAmelCase__: Sequence[float] , lowerCAmelCase__: float ): """simple docstring""" return sum(c * (x**i) for i, c in enumerate(lowerCAmelCase__ ) ) def lower...
368
import json from typing import List, Optional, Tuple from tokenizers import normalizers from ...tokenization_utils_fast import PreTrainedTokenizerFast from ...utils import logging from .tokenization_squeezebert import SqueezeBertTokenizer a : Optional[Any] = logging.get_logger(__na...
82
0
"""simple docstring""" from typing import Dict, List, Optional, Tuple, Union import numpy as np from ...image_processing_utils import BaseImageProcessor, BatchFeature, get_size_dict from ...image_transforms import ( center_crop, flip_channel_order, get_resize_output_image_size, ...
369
import inspect import unittest import numpy as np from tests.test_modeling_common import floats_tensor from transformers import MaskaFormerConfig, is_torch_available, is_vision_available from transformers.testing_utils import require_torch, require_torch_multi_gpu, require_vision, slow, torch_device f...
82
0
from pathlib import Path from typing import List from transformers import is_torch_available, is_vision_available from transformers.testing_utils import get_tests_dir, is_tool_test from transformers.tools.agent_types import AGENT_TYPE_MAPPING, AgentAudio, AgentImage, AgentText if is_torch_available(): ...
370
from collections import defaultdict class _a : def __init__(self, SCREAMING_SNAKE_CASE_, SCREAMING_SNAKE_CASE_ ) -> List[str]: UpperCAmelCase_: Optional[int] = total # total no of tasks (N) # DP table will have a dimension of (2^M)*N ...
82
0
from __future__ import annotations a : str = tuple[int, int, int] a : Optional[Any] = tuple[str, str, str] # used alphabet -------------------------- # from string.ascii_uppercase a : Optional[Any] = 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' # -------------------...
371
import unittest from transformers import load_tool from .test_tools_common import ToolTesterMixin class _a ( unittest.TestCase , _lowerCAmelCase ): def __snake_case (self ) -> Optional[int]: UpperCAmelCase_: Optional[int] = l...
82
0
def lowerCAmelCase_ (lowerCAmelCase__: int = 6_0_0_8_5_1_4_7_5_1_4_3 ): """simple docstring""" try: UpperCAmelCase_: Any = int(lowerCAmelCase__ ) except (TypeError, ValueError): raise TypeError("""Parameter n must be int or casta...
350
a : Tuple = 'Tobias Carryer' from time import time class _a : def __init__(self, SCREAMING_SNAKE_CASE_, SCREAMING_SNAKE_CASE_, SCREAMING_SNAKE_CASE_, SCREAMING_SNAKE_CASE_=int(time() ) ) -> List[Any]: # noqa: B008 UpperCAmelCase_: List[str]...
82
0
import collections from typing import List, Optional, Union from ...tokenization_utils_base import BatchEncoding from ...utils import TensorType, add_end_docstrings, add_start_docstrings, logging from ..bert.tokenization_bert import BertTokenizer a : Tuple = logging.get_logger(__name_...
351
import logging import math import os from dataclasses import dataclass, field from glob import glob from typing import Optional from torch.utils.data import ConcatDataset import transformers from transformers import ( CONFIG_MAPPING, MODEL_WITH_LM_HEAD_MAPPING, AutoConfig, AutoMo...
82
0
import copy from dataclasses import dataclass from pathlib import Path from typing import Dict, Optional, Union @dataclass class _a : A = None A = False A = False A = False A = None A ...
352
def lowerCAmelCase_ (lowerCAmelCase__: int , lowerCAmelCase__: float , lowerCAmelCase__: float ): """simple docstring""" return round(float(moles / volume ) * nfactor ) def lowerCAmelCase_ (lowerCAmelCase__: f...
82
0
import logging import os import sys from dataclasses import dataclass, field from typing import Optional import evaluate import numpy as np import torch from datasets import load_dataset from PIL import Image from torchvision.transforms import ( CenterCrop, Compose, Normalize, Ra...
353
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...
82
0
from typing import TYPE_CHECKING from ...utils import OptionalDependencyNotAvailable, _LazyModule, is_tf_available, is_torch_available a : List[str] = { 'configuration_xlm': ['XLM_PRETRAINED_CONFIG_ARCHIVE_MAP', 'XLMConfig', 'XLMOnnxConfig'], 'tokenization_xlm': ['XLMTokenizer'...
354
from __future__ import annotations import inspect import unittest from math import floor import numpy as np from transformers import CvtConfig from transformers.testing_utils import require_tf, require_vision, slow from transformers.utils import cached_property, is_tf_available, is_vision_available...
82
0
import importlib import sys from argparse import REMAINDER, ArgumentParser from pathlib import Path import torch_xla.distributed.xla_multiprocessing as xmp def lowerCAmelCase_ (): """simple docstring""" UpperCAmelCase_: Any = ArgumentParser( ...
355
import importlib import os import fsspec import pytest from fsspec import register_implementation from fsspec.registry import _registry as _fsspec_registry from datasets.filesystems import COMPRESSION_FILESYSTEMS, HfFileSystem, extract_path_from_uri, is_remote_filesystem from .utils import require_...
82
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_tens...
356
import argparse import re import torch from CLAP import create_model from transformers import AutoFeatureExtractor, ClapConfig, ClapModel a : Optional[int] = { 'text_branch': 'text_model', 'audio_branch': 'audio_model.audio_encoder', 'attn': 'attention.self', 'se...
82
0
import argparse import logging import os from pathlib import Path from typing import Any, Dict import pytorch_lightning as pl from pytorch_lightning.utilities import rank_zero_info from transformers import ( AdamW, AutoConfig, AutoModel, AutoModelForPreTraining, AutoModelForQ...
357
import json from typing import List, Optional, Tuple from tokenizers import normalizers from ...tokenization_utils_fast import PreTrainedTokenizerFast from .tokenization_electra import ElectraTokenizer a : List[str] = {'vocab_file': 'vocab.txt', 'tokenizer_file': 'tokenizer.json'} ...
82
0
from ...utils import ( OptionalDependencyNotAvailable, is_torch_available, is_transformers_available, is_transformers_version, ) try: if not (is_transformers_available() and is_torch_available() and is_transformers_version('>=', '4.25.0')): raise OptionalDependencyNotAvailable() except Optional...
358
import coval # From: git+https://github.com/ns-moosavi/coval.git # noqa: F401 from coval.conll import reader, util from coval.eval import evaluator import datasets a : Dict = datasets.logging.get_logger(__name__) a : Any = '\\n@InProceedings{moosavi2019minimum,\n ...
82
0
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 _a ( _lowerCAmelCase ): # to overwrite at feature extractactor spe...
359
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...
82
0
import cva import numpy as np class _a : def __init__(self, SCREAMING_SNAKE_CASE_, SCREAMING_SNAKE_CASE_ ) -> Tuple: if k in (0.0_4, 0.0_6): UpperCAmelCase_: Any = k UpperCAmelCase_: Optional[int] = window_size...
360
import math from typing import Optional import numpy as np from ...configuration_utils import PretrainedConfig from ...utils import logging a : Tuple = logging.get_logger(__name__) a : Optional[Any] = { 'facebook/encodec_24khz': 'https://huggingface.co/facebo...
82
0
import html from ...feature_extraction_utils import BatchFeature, FeatureExtractionMixin from ...utils import is_bsa_available, logging, requires_backends if is_bsa_available(): import bsa from bsa import BeautifulSoup a : List[Any] = logging.get_logger(__name__) ...
361
import unittest from parameterized import parameterized from transformers import OpenLlamaConfig, is_torch_available, set_seed from transformers.testing_utils import require_torch, torch_device from ...generation.test_utils import GenerationTesterMixin from ...test_configuration_common import ConfigT...
82
0
import argparse import json import requests import torch from huggingface_hub import hf_hub_download from PIL import Image from transformers import ConvNextConfig, SegformerImageProcessor, UperNetConfig, UperNetForSemanticSegmentation def lowerCAmelCase_ (lowerCAmelCase__: ...
362
from __future__ import annotations def lowerCAmelCase_ (lowerCAmelCase__: list[float] ): """simple docstring""" UpperCAmelCase_: Union[str, Any] = 0.00 UpperCAmelCase_: List[str] = 0 for resistor in resistors: ...
82
0
def lowerCAmelCase_ (lowerCAmelCase__: int ): """simple docstring""" return str(lowerCAmelCase__ ) == str(lowerCAmelCase__ )[::-1] def lowerCAmelCase_ (lowerCAmelCase__: int ): """simple docstring""" ret...
363
import argparse import os import torch from transformers import ( XLNetConfig, XLNetForQuestionAnswering, XLNetForSequenceClassification, XLNetLMHeadModel, load_tf_weights_in_xlnet, ) from transformers.utils import CONFIG_NAME, WEIGHTS_NAME, logging a : str ...
82
0
import argparse from argparse import Namespace import torch from torch import nn from transformers import XGLMConfig, XGLMForCausalLM def lowerCAmelCase_ (lowerCAmelCase__: Optional[Any] ): """simple docstring""" UpperCAmelCase_: Optional[int] = [ ""...
364
from typing import TYPE_CHECKING from ....utils import _LazyModule a : Tuple = {'tokenization_tapex': ['TapexTokenizer']} if TYPE_CHECKING: from .tokenization_tapex import TapexTokenizer else: import sys a : List[Any] = _LazyModule(__name__, globals()['_...
82
0
import json import os from dataclasses import dataclass from functools import partial from typing import Callable import flax.linen as nn import jax import jax.numpy as jnp import joblib import optax import wandb from flax import jax_utils, struct, traverse_util from flax.serialization import from...
365
import unittest from transformers import ( MODEL_FOR_SEQUENCE_CLASSIFICATION_MAPPING, TF_MODEL_FOR_SEQUENCE_CLASSIFICATION_MAPPING, Pipeline, ZeroShotClassificationPipeline, pipeline, ) from transformers.testing_utils import is_pipeline_test, nested_simplify, require_tf, require_to...
82
0
"""simple docstring""" import math import tensorflow as tf from packaging import version def lowerCAmelCase_ (lowerCAmelCase__: Optional[int] ): """simple docstring""" UpperCAmelCase_: Union[str, Any] = tf.convert_to_tensor(l...
366
import argparse from collections import OrderedDict from pathlib import Path import requests import torch from PIL import Image from transformers import GLPNConfig, GLPNForDepthEstimation, GLPNImageProcessor from transformers.utils import logging logging.set_verbosity_info() a : List[...
82
0
from typing import TYPE_CHECKING from ....utils import OptionalDependencyNotAvailable, _LazyModule, is_torch_available a : Optional[Any] = { 'configuration_trajectory_transformer': [ 'TRAJECTORY_TRANSFORMER_PRETRAINED_CONFIG_ARCHIVE_MAP', 'TrajectoryTransformerConf...
367
from __future__ import annotations def lowerCAmelCase_ (lowerCAmelCase__: list[int | float] , lowerCAmelCase__: int , lowerCAmelCase__: int ): """simple docstring""" if len(lowerCAmelCase__ ) == 0: raise ValueError("""fin...
82
0
a : Tuple = 'Tobias Carryer' from time import time class _a : def __init__(self, SCREAMING_SNAKE_CASE_, SCREAMING_SNAKE_CASE_, SCREAMING_SNAKE_CASE_, SCREAMING_SNAKE_CASE_=int(time() ) ) -> List[Any]: # noqa: B008 UpperCAmelCase_: List[str] ...
368
import json from typing import List, Optional, Tuple from tokenizers import normalizers from ...tokenization_utils_fast import PreTrainedTokenizerFast from ...utils import logging from .tokenization_squeezebert import SqueezeBertTokenizer a : Optional[Any] = logging.get_logger(__na...
82
0
"""simple docstring""" from __future__ import annotations import time a : Optional[Any] = list[tuple[int, int]] a : int = [ [0, 0, 0, 0, 0, 0, 0], [0, 1, 0, 0, 0, 0, 0], # 0 are free path whereas 1's are obstacles [0, 0, 0, 0, 0, 0, 0], [0, ...
369
import inspect import unittest import numpy as np from tests.test_modeling_common import floats_tensor from transformers import MaskaFormerConfig, is_torch_available, is_vision_available from transformers.testing_utils import require_torch, require_torch_multi_gpu, require_vision, slow, torch_device f...
82
0
from collections.abc import Sequence def lowerCAmelCase_ (lowerCAmelCase__: Sequence[float] , lowerCAmelCase__: bool = False ): """simple docstring""" if not arr: return 0 UpperCAmelCase_: Optional[Any] = 0 if allow_...
370
from collections import defaultdict class _a : def __init__(self, SCREAMING_SNAKE_CASE_, SCREAMING_SNAKE_CASE_ ) -> List[str]: UpperCAmelCase_: Optional[int] = total # total no of tasks (N) # DP table will have a dimension of (2^M)*N ...
82
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 a : Any = logging.get_logger(__...
371
import unittest from transformers import load_tool from .test_tools_common import ToolTesterMixin class _a ( unittest.TestCase , _lowerCAmelCase ): def __snake_case (self ) -> Optional[int]: UpperCAmelCase_: Optional[int] = l...
82
0
import inspect from typing import Optional, Union import numpy as np import PIL import torch from torch.nn import functional as F from torchvision import transforms from transformers import CLIPFeatureExtractor, CLIPModel, CLIPTextModel, CLIPTokenizer from diffusers import ( AutoencoderKL, ...
350
a : Tuple = 'Tobias Carryer' from time import time class _a : def __init__(self, SCREAMING_SNAKE_CASE_, SCREAMING_SNAKE_CASE_, SCREAMING_SNAKE_CASE_, SCREAMING_SNAKE_CASE_=int(time() ) ) -> List[Any]: # noqa: B008 UpperCAmelCase_: List[str]...
82
0
import importlib import os from dataclasses import dataclass from enum import Enum from typing import Any, Dict, Optional, Union import torch from ..utils import BaseOutput a : str = 'scheduler_config.json' class _a ( _lowerCAmelCase ): A ...
351
import logging import math import os from dataclasses import dataclass, field from glob import glob from typing import Optional from torch.utils.data import ConcatDataset import transformers from transformers import ( CONFIG_MAPPING, MODEL_WITH_LM_HEAD_MAPPING, AutoConfig, AutoMo...
82
0
import unittest from transformers import PegasusTokenizer, PegasusTokenizerFast 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...
352
def lowerCAmelCase_ (lowerCAmelCase__: int , lowerCAmelCase__: float , lowerCAmelCase__: float ): """simple docstring""" return round(float(moles / volume ) * nfactor ) def lowerCAmelCase_ (lowerCAmelCase__: f...
82
0
import unittest from transformers import MraConfig, is_torch_available from transformers.testing_utils import require_torch, slow, torch_device from ...test_configuration_common import ConfigTester from ...test_modeling_common import ModelTesterMixin, floats_tensor, ids_tensor, random_attention_mask ...
353
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...
82
0
import argparse import shutil from pathlib import Path from tqdm import tqdm from transformers import AutoTokenizer def lowerCAmelCase_ (lowerCAmelCase__: str , lowerCAmelCase__: int , lowerCAmelCase__: Union[str, Any] , lowerCAmelCase__: Dict...
354
from __future__ import annotations import inspect import unittest from math import floor import numpy as np from transformers import CvtConfig from transformers.testing_utils import require_tf, require_vision, slow from transformers.utils import cached_property, is_tf_available, is_vision_available...
82
0
import torch from diffusers import DPMSolverSDEScheduler from diffusers.utils import torch_device from diffusers.utils.testing_utils import require_torchsde from .test_schedulers import SchedulerCommonTest @require_torchsde class _a ( _lowerCAmelCase ): A = ...
355
import importlib import os import fsspec import pytest from fsspec import register_implementation from fsspec.registry import _registry as _fsspec_registry from datasets.filesystems import COMPRESSION_FILESYSTEMS, HfFileSystem, extract_path_from_uri, is_remote_filesystem from .utils import require_...
82
0
from __future__ import annotations import unittest from transformers import DebertaVaConfig, 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_atte...
356
import argparse import re import torch from CLAP import create_model from transformers import AutoFeatureExtractor, ClapConfig, ClapModel a : Optional[int] = { 'text_branch': 'text_model', 'audio_branch': 'audio_model.audio_encoder', 'attn': 'attention.self', 'se...
82
0
from __future__ import annotations from collections.abc import MutableSequence class _a : def __init__(self, SCREAMING_SNAKE_CASE_, SCREAMING_SNAKE_CASE_ ) -> None: if len(SCREAMING_SNAKE_CASE_ ) != degree + 1: raise ValueError( """The nu...
357
import json from typing import List, Optional, Tuple from tokenizers import normalizers from ...tokenization_utils_fast import PreTrainedTokenizerFast from .tokenization_electra import ElectraTokenizer a : List[str] = {'vocab_file': 'vocab.txt', 'tokenizer_file': 'tokenizer.json'} ...
82
0
from __future__ import annotations import pandas as pd def lowerCAmelCase_ (lowerCAmelCase__: list[int] , lowerCAmelCase__: list[int] , lowerCAmelCase__: int ): """simple docstring""" UpperCAmelCase_: int = [0] * no_of_processes Uppe...
358
import coval # From: git+https://github.com/ns-moosavi/coval.git # noqa: F401 from coval.conll import reader, util from coval.eval import evaluator import datasets a : Dict = datasets.logging.get_logger(__name__) a : Any = '\\n@InProceedings{moosavi2019minimum,\n ...
82
0
from ...configuration_utils import PretrainedConfig from ...utils import logging a : Tuple = logging.get_logger(__name__) a : int = { 'EleutherAI/gpt-neox-20b': 'https://huggingface.co/EleutherAI/gpt-neox-20b/resolve/main/config.json', # See all GPTNeoX models ...
359
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...
82
0
import argparse import json from pathlib import Path import requests import torch from huggingface_hub import hf_hub_download from PIL import Image from transformers import ViTConfig, ViTForImageClassification, ViTImageProcessor, ViTModel from transformers.utils import logging logging.set_verbosi...
360
import math from typing import Optional import numpy as np from ...configuration_utils import PretrainedConfig from ...utils import logging a : Tuple = logging.get_logger(__name__) a : Optional[Any] = { 'facebook/encodec_24khz': 'https://huggingface.co/facebo...
82
0
import gc import random import unittest import numpy as np import torch from transformers import ( CLIPImageProcessor, CLIPTextConfig, CLIPTextModel, CLIPTokenizer, CLIPVisionConfig, CLIPVisionModelWithProjection, ) from diffusers import AutoencoderKL, DDIMScheduler, DDP...
361
import unittest from parameterized import parameterized from transformers import OpenLlamaConfig, is_torch_available, set_seed from transformers.testing_utils import require_torch, torch_device from ...generation.test_utils import GenerationTesterMixin from ...test_configuration_common import ConfigT...
82
0
import sys from typing import Tuple import numpy as np import torch from PIL import Image from torch import nn from transformers.image_utils import PILImageResampling from utils import img_tensorize class _a : def __init__(self, SCREAMING_SNAKE_CASE_, SCREAMING_SNAKE...
362
from __future__ import annotations def lowerCAmelCase_ (lowerCAmelCase__: list[float] ): """simple docstring""" UpperCAmelCase_: Union[str, Any] = 0.00 UpperCAmelCase_: List[str] = 0 for resistor in resistors: ...
82
0
from typing import TYPE_CHECKING from ...utils import ( OptionalDependencyNotAvailable, _LazyModule, is_sentencepiece_available, is_tokenizers_available, is_torch_available, ) a : List[Any] = {} try: if not is_sentencepiece_available(): raise OptionalDep...
363
import argparse import os import torch from transformers import ( XLNetConfig, XLNetForQuestionAnswering, XLNetForSequenceClassification, XLNetLMHeadModel, load_tf_weights_in_xlnet, ) from transformers.utils import CONFIG_NAME, WEIGHTS_NAME, logging a : str ...
82
0
import os import re import shutil import sys import tempfile import unittest import black a : List[Any] = 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 reference...
364
from typing import TYPE_CHECKING from ....utils import _LazyModule a : Tuple = {'tokenization_tapex': ['TapexTokenizer']} if TYPE_CHECKING: from .tokenization_tapex import TapexTokenizer else: import sys a : List[Any] = _LazyModule(__name__, globals()['_...
82
0
def lowerCAmelCase_ (lowerCAmelCase__: int = 1_0_0_0 ): """simple docstring""" UpperCAmelCase_: Union[str, Any] = -1 UpperCAmelCase_: List[Any] = 0 for a in range(1 , n // 3 ): # Solving the two equations a**...
365
import unittest from transformers import ( MODEL_FOR_SEQUENCE_CLASSIFICATION_MAPPING, TF_MODEL_FOR_SEQUENCE_CLASSIFICATION_MAPPING, Pipeline, ZeroShotClassificationPipeline, pipeline, ) from transformers.testing_utils import is_pipeline_test, nested_simplify, require_tf, require_to...
82
0
"""simple docstring""" import argparse import re from typing import Dict import torch from datasets import Audio, Dataset, load_dataset, load_metric from transformers import AutoFeatureExtractor, pipeline def lowerCAmelCase_ (lowerCAmelCase__: Dataset , lowerC...
366
import argparse from collections import OrderedDict from pathlib import Path import requests import torch from PIL import Image from transformers import GLPNConfig, GLPNForDepthEstimation, GLPNImageProcessor from transformers.utils import logging logging.set_verbosity_info() a : List[...
82
0
import unittest from transformers import load_tool from .test_tools_common import ToolTesterMixin class _a ( unittest.TestCase , _lowerCAmelCase ): def __snake_case (self ) -> Optional[int]: UpperCAmelCase_: Optional[int] = ...
367
from __future__ import annotations def lowerCAmelCase_ (lowerCAmelCase__: list[int | float] , lowerCAmelCase__: int , lowerCAmelCase__: int ): """simple docstring""" if len(lowerCAmelCase__ ) == 0: raise ValueError("""fin...
82
0
from typing import TYPE_CHECKING # rely on isort to merge the imports from ...utils import OptionalDependencyNotAvailable, _LazyModule, is_torch_available a : str = {'configuration_focalnet': ['FOCALNET_PRETRAINED_CONFIG_ARCHIVE_MAP', 'FocalNetConfig']} try: if not is_torch_available...
368
import json from typing import List, Optional, Tuple from tokenizers import normalizers from ...tokenization_utils_fast import PreTrainedTokenizerFast from ...utils import logging from .tokenization_squeezebert import SqueezeBertTokenizer a : Optional[Any] = logging.get_logger(__na...
82
0
"""simple docstring""" from __future__ import annotations import json import requests from bsa import BeautifulSoup from fake_useragent import UserAgent a : Any = {'UserAgent': UserAgent().random} def lowerCAmelCase_ (lowerCAmelCase__: Optional[int...
369
import inspect import unittest import numpy as np from tests.test_modeling_common import floats_tensor from transformers import MaskaFormerConfig, is_torch_available, is_vision_available from transformers.testing_utils import require_torch, require_torch_multi_gpu, require_vision, slow, torch_device f...
82
0
# Copyright 2023 The HuggingFace Team. All rights reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless require...
370
from collections import defaultdict class _a : def __init__(self, SCREAMING_SNAKE_CASE_, SCREAMING_SNAKE_CASE_ ) -> List[str]: UpperCAmelCase_: Optional[int] = total # total no of tasks (N) # DP table will have a dimension of (2^M)*N ...
82
0
from typing import List, Optional, Union from ...processing_utils import ProcessorMixin from ...tokenization_utils_base import BatchEncoding, PaddingStrategy, PreTokenizedInput, TextInput, TruncationStrategy from ...utils import TensorType class _a ( _lowerCAmelCase ): A = ...
371
import unittest from transformers import load_tool from .test_tools_common import ToolTesterMixin class _a ( unittest.TestCase , _lowerCAmelCase ): def __snake_case (self ) -> Optional[int]: UpperCAmelCase_: Optional[int] = l...
82
0
from collections import defaultdict from math import ceil, sqrt def lowerCAmelCase_ (lowerCAmelCase__: int = 1_0_0_0_0_0_0 , lowerCAmelCase__: int = 1_0 ): """simple docstring""" UpperCAmelCase_: defaultdict = defaultdict(lowe...
350
a : Tuple = 'Tobias Carryer' from time import time class _a : def __init__(self, SCREAMING_SNAKE_CASE_, SCREAMING_SNAKE_CASE_, SCREAMING_SNAKE_CASE_, SCREAMING_SNAKE_CASE_=int(time() ) ) -> List[Any]: # noqa: B008 UpperCAmelCase_: List[str]...
82
0
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 lowerCAmelCase_ (lowerCAmelCase__: Any , lo...
351
import logging import math import os from dataclasses import dataclass, field from glob import glob from typing import Optional from torch.utils.data import ConcatDataset import transformers from transformers import ( CONFIG_MAPPING, MODEL_WITH_LM_HEAD_MAPPING, AutoConfig, AutoMo...
82
0
from collections import OrderedDict from typing import Mapping from packaging import version from ...configuration_utils import PretrainedConfig from ...onnx import OnnxConfig from ...utils import logging a : Union[str, Any] = logging.get_logger(__name__) a : Any ...
352
def lowerCAmelCase_ (lowerCAmelCase__: int , lowerCAmelCase__: float , lowerCAmelCase__: float ): """simple docstring""" return round(float(moles / volume ) * nfactor ) def lowerCAmelCase_ (lowerCAmelCase__: f...
82
0
import os from typing import BinaryIO, Optional, Union import numpy as np import pyarrow.parquet as pq from .. import Audio, Dataset, Features, Image, NamedSplit, Value, config from ..features.features import FeatureType, _visit from ..formatting import query_table from ..packaged_modules import _PAC...
353
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...
82
0
from typing import Optional, Union import torch from torch import nn from torch.nn import BCEWithLogitsLoss, CrossEntropyLoss, MSELoss from ...activations import ACTaFN from ...modeling_outputs import BaseModelOutputWithPoolingAndNoAttention, ImageClassifierOutputWithNoAttention from ...modeling_utils...
354
from __future__ import annotations import inspect import unittest from math import floor import numpy as np from transformers import CvtConfig from transformers.testing_utils import require_tf, require_vision, slow from transformers.utils import cached_property, is_tf_available, is_vision_available...
82
0
def lowerCAmelCase_ (lowerCAmelCase__: str ): """simple docstring""" UpperCAmelCase_: Optional[Any] = """""" for ch in key: if ch == " " or ch not in key_no_dups and ch.isalpha(): key_no_dups += ch return key_no_dups ...
355
import importlib import os import fsspec import pytest from fsspec import register_implementation from fsspec.registry import _registry as _fsspec_registry from datasets.filesystems import COMPRESSION_FILESYSTEMS, HfFileSystem, extract_path_from_uri, is_remote_filesystem from .utils import require_...
82
0
from __future__ import annotations def lowerCAmelCase_ (lowerCAmelCase__ ): """simple docstring""" UpperCAmelCase_: Union[str, Any] = 0.00 UpperCAmelCase_: List[str] = 0 for resistor in resistors: if resistor <...
356
import argparse import re import torch from CLAP import create_model from transformers import AutoFeatureExtractor, ClapConfig, ClapModel a : Optional[int] = { 'text_branch': 'text_model', 'audio_branch': 'audio_model.audio_encoder', 'attn': 'attention.self', 'se...
82
0
from __future__ import annotations class _a : def __init__(self, SCREAMING_SNAKE_CASE_ ) -> None: UpperCAmelCase_: str = data UpperCAmelCase_: Node | None = None UpperCAmelCase_: Node | None = None ...
357
import json from typing import List, Optional, Tuple from tokenizers import normalizers from ...tokenization_utils_fast import PreTrainedTokenizerFast from .tokenization_electra import ElectraTokenizer a : List[str] = {'vocab_file': 'vocab.txt', 'tokenizer_file': 'tokenizer.json'} ...
82
0
import tempfile import torch from diffusers import PNDMScheduler from .test_schedulers import SchedulerCommonTest class _a ( _lowerCAmelCase ): A = (PNDMScheduler,) A = (('''num_inference_steps''', 50),) def __snake_case (self, **SCREAMING_SNAKE...
358
import coval # From: git+https://github.com/ns-moosavi/coval.git # noqa: F401 from coval.conll import reader, util from coval.eval import evaluator import datasets a : Dict = datasets.logging.get_logger(__name__) a : Any = '\\n@InProceedings{moosavi2019minimum,\n ...
82
0
import unittest from diffusers import FlaxAutoencoderKL from diffusers.utils import is_flax_available from diffusers.utils.testing_utils import require_flax from .test_modeling_common_flax import FlaxModelTesterMixin if is_flax_available(): import jax @require_flax class _a...
359
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...
82
0
class _a : def __init__(self ) -> str: UpperCAmelCase_: Dict = 0 UpperCAmelCase_: Any = 0 UpperCAmelCase_: List[Any] = {} def __snake_case (self, SCREAMING_SNAKE_CASE_ ) -> str: if vertex not...
360
import math from typing import Optional import numpy as np from ...configuration_utils import PretrainedConfig from ...utils import logging a : Tuple = logging.get_logger(__name__) a : Optional[Any] = { 'facebook/encodec_24khz': 'https://huggingface.co/facebo...
82
0
def lowerCAmelCase_ (lowerCAmelCase__: int ): """simple docstring""" UpperCAmelCase_: Optional[int] = int(lowerCAmelCase__ ) if n_element < 1: UpperCAmelCase_: Tuple = ValueError("""a should be a positive number""" ...
361
import unittest from parameterized import parameterized from transformers import OpenLlamaConfig, is_torch_available, set_seed from transformers.testing_utils import require_torch, torch_device from ...generation.test_utils import GenerationTesterMixin from ...test_configuration_common import ConfigT...
82
0
def lowerCAmelCase_ (lowerCAmelCase__: int , lowerCAmelCase__: float , lowerCAmelCase__: float ): """simple docstring""" return round(float(moles / volume ) * nfactor ) def lowerCAmelCase_ (lowerCAmelCase__: f...
362
from __future__ import annotations def lowerCAmelCase_ (lowerCAmelCase__: list[float] ): """simple docstring""" UpperCAmelCase_: Union[str, Any] = 0.00 UpperCAmelCase_: List[str] = 0 for resistor in resistors: ...
82
0
from argparse import ArgumentParser from . import BaseTransformersCLICommand def lowerCAmelCase_ (lowerCAmelCase__: List[str] ): """simple docstring""" return DownloadCommand(args.model , args.cache_dir , args.force , args.trust_remote...
363
import argparse import os import torch from transformers import ( XLNetConfig, XLNetForQuestionAnswering, XLNetForSequenceClassification, XLNetLMHeadModel, load_tf_weights_in_xlnet, ) from transformers.utils import CONFIG_NAME, WEIGHTS_NAME, logging a : str ...
82
0
import unittest from parameterized import parameterized from transformers import OpenLlamaConfig, is_torch_available, set_seed from transformers.testing_utils import require_torch, torch_device from ...generation.test_utils import GenerationTesterMixin from ...test_configuration_common import ConfigTester from ....
364
from typing import TYPE_CHECKING from ....utils import _LazyModule a : Tuple = {'tokenization_tapex': ['TapexTokenizer']} if TYPE_CHECKING: from .tokenization_tapex import TapexTokenizer else: import sys a : List[Any] = _LazyModule(__name__, globals()['_...
82
0
import numpy as np def lowerCAmelCase_ (lowerCAmelCase__: Optional[int] , lowerCAmelCase__: Any , lowerCAmelCase__: Dict , lowerCAmelCase__: Tuple , lowerCAmelCase__: Optional[Any] ): """simple docstring""" Upper...
365
import unittest from transformers import ( MODEL_FOR_SEQUENCE_CLASSIFICATION_MAPPING, TF_MODEL_FOR_SEQUENCE_CLASSIFICATION_MAPPING, Pipeline, ZeroShotClassificationPipeline, pipeline, ) from transformers.testing_utils import is_pipeline_test, nested_simplify, require_tf, require_to...
82
0
"""simple docstring""" from __future__ import annotations def lowerCAmelCase_ (lowerCAmelCase__: int , lowerCAmelCase__: int ): """simple docstring""" if b == 0: return (1, 0) (UpperCAmelCase_): List[Any] = ...
366
import argparse from collections import OrderedDict from pathlib import Path import requests import torch from PIL import Image from transformers import GLPNConfig, GLPNForDepthEstimation, GLPNImageProcessor from transformers.utils import logging logging.set_verbosity_info() a : List[...
82
0
import unittest from transformers import ( MODEL_FOR_SEQUENCE_CLASSIFICATION_MAPPING, TF_MODEL_FOR_SEQUENCE_CLASSIFICATION_MAPPING, TextClassificationPipeline, pipeline, ) from transformers.testing_utils import is_pipeline_test, nested_simplify, require_tf, require_torch, slow from ....
367
from __future__ import annotations def lowerCAmelCase_ (lowerCAmelCase__: list[int | float] , lowerCAmelCase__: int , lowerCAmelCase__: int ): """simple docstring""" if len(lowerCAmelCase__ ) == 0: raise ValueError("""fin...
82
0
from ....configuration_utils import PretrainedConfig from ....utils import logging a : Any = logging.get_logger(__name__) a : Dict = { 'speechbrain/m-ctc-t-large': 'https://huggingface.co/speechbrain/m-ctc-t-large/resolve/main/config.json', # See all M-CTC-T models...
368
import json from typing import List, Optional, Tuple from tokenizers import normalizers from ...tokenization_utils_fast import PreTrainedTokenizerFast from ...utils import logging from .tokenization_squeezebert import SqueezeBertTokenizer a : Optional[Any] = logging.get_logger(__na...
82
0
"""simple docstring""" # this script reports modified .py files under the desired list of top-level sub-dirs passed as a list of arguments, e.g.: # python ./utils/get_modified_files.py utils src tests examples # # it uses git to find the forking point and which files were modified - i.e. files not...
369
import inspect import unittest import numpy as np from tests.test_modeling_common import floats_tensor from transformers import MaskaFormerConfig, is_torch_available, is_vision_available from transformers.testing_utils import require_torch, require_torch_multi_gpu, require_vision, slow, torch_device f...
82
0
import re from typing import Callable, List, Optional, Union import tensorflow as tf try: from tensorflow.keras.optimizers.legacy import Adam except ImportError: from tensorflow.keras.optimizers import Adam class _a ( tf.keras.optimizers.schedules.LearningRateSchedule )...
370
from collections import defaultdict class _a : def __init__(self, SCREAMING_SNAKE_CASE_, SCREAMING_SNAKE_CASE_ ) -> List[str]: UpperCAmelCase_: Optional[int] = total # total no of tasks (N) # DP table will have a dimension of (2^M)*N ...
82
0
import collections import os import re from pathlib import Path a : Union[str, Any] = 'src/transformers' # Matches is_xxx_available() a : int = re.compile(r'is\_([a-z_]*)_available()') # Catches a one-line _import_struct = {xxx} a : List[Any] = re....
371
import unittest from transformers import load_tool from .test_tools_common import ToolTesterMixin class _a ( unittest.TestCase , _lowerCAmelCase ): def __snake_case (self ) -> Optional[int]: UpperCAmelCase_: Optional[int] = l...
82
0
from typing import List, Optional, Union import numpy as np import PIL import torch from PIL import Image from ...models import UNetaDConditionModel, VQModel from ...pipelines import DiffusionPipeline from ...pipelines.pipeline_utils import ImagePipelineOutput from ...schedulers import DDPMScheduler...
350
a : Tuple = 'Tobias Carryer' from time import time class _a : def __init__(self, SCREAMING_SNAKE_CASE_, SCREAMING_SNAKE_CASE_, SCREAMING_SNAKE_CASE_, SCREAMING_SNAKE_CASE_=int(time() ) ) -> List[Any]: # noqa: B008 UpperCAmelCase_: List[str]...
82
0
def lowerCAmelCase_ (lowerCAmelCase__: Tuple ): """simple docstring""" UpperCAmelCase_: str = len(lowerCAmelCase__ ) UpperCAmelCase_: Any = sum(lowerCAmelCase__ ) UpperCAmelCase_: Tuple = [[False...
351
import logging import math import os from dataclasses import dataclass, field from glob import glob from typing import Optional from torch.utils.data import ConcatDataset import transformers from transformers import ( CONFIG_MAPPING, MODEL_WITH_LM_HEAD_MAPPING, AutoConfig, AutoMo...
82
0
from collections import OrderedDict from typing import Mapping from packaging import version from ...configuration_utils import PretrainedConfig from ...onnx import OnnxConfig from ...utils import logging a : Any = logging.get_logger(__name__) a : str = { 'h...
352
def lowerCAmelCase_ (lowerCAmelCase__: int , lowerCAmelCase__: float , lowerCAmelCase__: float ): """simple docstring""" return round(float(moles / volume ) * nfactor ) def lowerCAmelCase_ (lowerCAmelCase__: f...
82
0
def lowerCAmelCase_ (lowerCAmelCase__: list[int] , lowerCAmelCase__: list[int] , lowerCAmelCase__: int ): """simple docstring""" return not any( neighbour == 1 and colored_vertices[i] == color for i, neighbour in enumerate(lowerCAmel...
353
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...
82
0