code
stringlengths
81
54k
code_codestyle
int64
0
721
style_context
stringlengths
91
41.9k
style_context_codestyle
int64
0
699
label
int64
0
1
from __future__ import annotations import math def A__ ( __A , __A , __A , __A , __A ): '''simple docstring''' if depth < 0: raise ValueError("""Depth cannot be less than 0""" ) if len(__A ) == 0: raise ValueError("""Scores cannot b...
15
import multiprocessing import time from arguments import PretokenizationArguments from datasets import load_dataset from transformers import AutoTokenizer, HfArgumentParser def A__ ( __A ): '''simple docstring''' _lowerCamelCase : Tuple = {} ...
15
1
import ast import os import re import shutil import tempfile import unittest from unittest import mock import torch from accelerate.test_utils.examples import compare_against_test from accelerate.test_utils.testing import TempDirTestCase, require_trackers, run_command, slow from accelerate.utils import wr...
15
import gc import random import unittest import torch from diffusers import ( IFImgaImgPipeline, IFImgaImgSuperResolutionPipeline, IFInpaintingPipeline, IFInpaintingSuperResolutionPipeline, IFPipeline, IFSuperResolutionPipeline, ) from diffusers.models.attention_processor import A...
15
1
import math from ...configuration_utils import PretrainedConfig from ...utils import logging lowerCAmelCase : Union[str, Any] =logging.get_logger(__name__) lowerCAmelCase : int ={ "facebook/data2vec-base-960h": "https://huggingface.co/facebook/data2vec-audio-base-960h/resolve/ma...
15
from collections import OrderedDict from typing import Mapping from packaging import version from ...configuration_utils import PretrainedConfig from ...onnx import OnnxConfig from ...utils import logging from ...utils.backbone_utils import BackboneConfigMixin, get_aligned_output_features_output_indices ...
15
1
from math import ceil def A__ ( __A , __A ): '''simple docstring''' _lowerCamelCase : List[Any] = list(range(0 , __A ) ) _lowerCamelCase : List[str] = [item for sublist in list(device_map.values() ) for item in sublist] ...
15
import torch from diffusers import EulerDiscreteScheduler from diffusers.utils import torch_device from .test_schedulers import SchedulerCommonTest class __snake_case ( __lowerCAmelCase ): '''simple docstring''' _snake_case = (EulerDiscreteScheduler,) ...
15
1
lowerCAmelCase : Optional[Any] ="\n# Installazione di Transformers\n! pip install transformers datasets\n# Per installare dalla fonte invece dell'ultima versione rilasciata, commenta il comando sopra e\n# rimuovi la modalità commento al comando seguente.\n# ! pip install git+https://github.com/huggingface/t...
15
import json import os from typing import Optional, Tuple from ...tokenization_utils import PreTrainedTokenizer from ...utils import logging lowerCAmelCase : Dict =logging.get_logger(__name__) lowerCAmelCase : Dict ={"vocab_file": "vocab.json"} lowerCAmelCase : List[str] ...
15
1
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 DetrConfig, DetrForObjectDetection, DetrForSegmentation, DetrImageProcessor, ResNetConfig from transformers.utils import logging l...
15
import unittest from transformers.utils.backbone_utils import ( BackboneMixin, get_aligned_output_features_output_indices, verify_out_features_out_indices, ) class __snake_case ( unittest.TestCase ): '''simple docstring''' def _SCREAMING_SNAKE_CASE (...
15
1
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...
15
import math def A__ ( __A ): '''simple docstring''' assert isinstance(__A , __A ) and ( number >= 0 ), "'number' must been an int and positive" if 1 < number < 4: # 2 and 3 are primes return True elif number < 2 or not numbe...
15
1
from ...configuration_utils import PretrainedConfig from ...utils import logging lowerCAmelCase : Optional[int] =logging.get_logger(__name__) lowerCAmelCase : int ={ "weiweishi/roc-bert-base-zh": "https://huggingface.co/weiweishi/roc-bert-base-zh/resolve/main/config.json", } ...
15
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...
15
1
import itertools import json import linecache import os import pickle import re import socket import string from collections import Counter from logging import getLogger from pathlib import Path from typing import Callable, Dict, Iterable, List import git import torch from torch.utils.data import Datase...
15
import json import os import shutil import tempfile import unittest import numpy as np import pytest from transformers import MgpstrTokenizer from transformers.models.mgp_str.tokenization_mgp_str import VOCAB_FILES_NAMES from transformers.testing_utils import require_torch, require_vision from transformer...
15
1
import warnings from diffusers import StableDiffusionInpaintPipeline as StableDiffusionInpaintPipeline # noqa F401 warnings.warn( "The `inpainting.py` script is outdated. Please use directly `from diffusers import" " StableDiffusionInpaintPipeline` instead." )
15
import importlib import sys from argparse import REMAINDER, ArgumentParser from pathlib import Path import torch_xla.distributed.xla_multiprocessing as xmp def A__ ( ): '''simple docstring''' _lowerCamelCase : Optional[int] = ArgumentParser( ...
15
1
import pickle import shutil import tempfile import unittest from transformers import SPIECE_UNDERLINE, XLMRobertaTokenizer, XLMRobertaTokenizerFast from transformers.testing_utils import get_tests_dir, require_sentencepiece, require_tokenizers, slow from transformers.utils import cached_property from ...test...
15
def A__ ( __A , __A ): '''simple docstring''' _enforce_args(__A , __A ) if n == 0: return 0 _lowerCamelCase : Tuple = float("""-inf""" ) for i in range(1 , n + 1 ): _lowerCamelCase : Any = max( __A ,...
15
1
import json import os from typing import Optional, Tuple from ...tokenization_utils import PreTrainedTokenizer from ...utils import logging lowerCAmelCase : Dict =logging.get_logger(__name__) lowerCAmelCase : Dict ={"vocab_file": "vocab.json"} lowerCAmelCase : List[str] ...
15
from __future__ import annotations class __snake_case : '''simple docstring''' def __init__( self : Tuple , _UpperCamelCase : int = 0) ->str: """simple docstring""" _lowerCamelCase : Union[str, Any] = ke...
15
1
import os from shutil import copyfile from typing import List, Optional, Tuple from ...tokenization_utils import AddedToken from ...tokenization_utils_fast import PreTrainedTokenizerFast from ...utils import is_sentencepiece_available, logging if is_sentencepiece_available(): from .tokenization_rembert...
15
from typing import Optional from .. import Features, NamedSplit from ..packaged_modules.text.text import Text from ..utils.typing import NestedDataStructureLike, PathLike from .abc import AbstractDatasetReader class __snake_case ( __lowerCAmelCase ): '''simple docstring''' ...
15
1
import numpy as np import torch from torch.utils.data import DataLoader from accelerate.utils.dataclasses import DistributedType class __snake_case : '''simple docstring''' def __init__( self : Optional[Any] , _UpperCamelCase : List[str]=2 , _...
15
lowerCAmelCase : Tuple =0 # The first color of the flag. lowerCAmelCase : Union[str, Any] =1 # The second color of the flag. lowerCAmelCase : Any =2 # The third color of the flag. lowerCAmelCase : List[str] =(red, white, blue) def A__ ( __A...
15
1
import math import random def A__ ( __A , __A = False ): '''simple docstring''' if deriv: return value * (1 - value) return 1 / (1 + math.exp(-value )) # Initial Value lowerCAmelCase : Optional[int] =0.02 def A__ ...
15
from __future__ import annotations lowerCAmelCase : int =[] def A__ ( __A , __A , __A ): '''simple docstring''' for i in range(len(__A ) ): if board[row][i] == 1: return False for i in range(len(__A ) ): if board[i]...
15
1
def A__ ( __A , __A , __A , __A ): '''simple docstring''' global f # a global dp table for knapsack if f[i][j] < 0: if j < wt[i - 1]: _lowerCamelCase : List[str] = mf_knapsack(i - 1 , __A , __A , __A ) else: ...
15
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 lowerCAmelCase : int ...
15
1
from typing import TYPE_CHECKING from ...utils import OptionalDependencyNotAvailable, _LazyModule, is_torch_available lowerCAmelCase : Optional[int] ={ "configuration_megatron_bert": ["MEGATRON_BERT_PRETRAINED_CONFIG_ARCHIVE_MAP", "MegatronBertConfig"], } try: if not is_torch_available...
15
def A__ ( __A ): '''simple docstring''' _lowerCamelCase : Tuple = 0 for ch in input_str: _lowerCamelCase : Optional[Any] = ord(__A ) _lowerCamelCase : List[str] = pow(2 , __A ) # If we already turned o...
15
1
from __future__ import annotations lowerCAmelCase : int =[] def A__ ( __A , __A , __A ): '''simple docstring''' for i in range(len(__A ) ): if board[row][i] == 1: return False for i in range(len(__A ) ): if board[i]...
15
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 @req...
15
1
import importlib import sys from argparse import REMAINDER, ArgumentParser from pathlib import Path import torch_xla.distributed.xla_multiprocessing as xmp def A__ ( ): '''simple docstring''' _lowerCamelCase : Optional[int] = ArgumentParser( ...
15
from typing import Dict, List, Optional, Union import numpy as np from ...image_processing_utils import BaseImageProcessor, BatchFeature, get_size_dict from ...image_transforms import center_crop, normalize, rescale, resize, to_channel_dimension_format from ...image_utils import ( IMAGENET_STANDARD_MEAN, ...
15
1
from __future__ import annotations def A__ ( __A ): # This function is recursive '''simple docstring''' _lowerCamelCase : Tuple = len(__A ) # If the array contains only one element, we return it (it's the stop condition of # recursion) if...
15
from __future__ import annotations from math import pi from typing import Protocol import matplotlib.pyplot as plt import numpy as np class __snake_case ( __lowerCAmelCase ): '''simple docstring''' def _SCREAMING_SNAKE_CASE ( self : Optional[Any] ...
15
1
import inspect import unittest from transformers import YolosConfig 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_configuration_common import ConfigTester from ...tes...
15
import argparse from pathlib import Path import torch from packaging import version from torch.onnx import export from diffusers import AutoencoderKL lowerCAmelCase : Tuple =version.parse(version.parse(torch.__version__).base_version) < version.parse("1.11") def A__ ( ...
15
1
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(): i...
15
from math import log from scipy.constants import Boltzmann, physical_constants lowerCAmelCase : List[Any] =300 # TEMPERATURE (unit = K) def A__ ( __A , __A , __A , ): '''simple docstring''' if donor_conc <= 0: raise ValueError("""Dono...
15
1
import doctest from collections import deque import numpy as np class __snake_case : '''simple docstring''' def __init__( self : Any) ->None: """simple docstring""" _lowerCamelCase : int = [2, 1, 2, -1] ...
15
import multiprocessing import time from arguments import PretokenizationArguments from datasets import load_dataset from transformers import AutoTokenizer, HfArgumentParser def A__ ( __A ): '''simple docstring''' _lowerCamelCase : Tuple = {} ...
15
1
from scipy.stats import spearmanr import datasets lowerCAmelCase : Dict ="\nThe Spearman rank-order correlation coefficient is a measure of the\nrelationship between two datasets. Like other correlation coefficients,\nthis one varies between -1 and +1 with 0 implying no correlation.\nPositive correl...
15
import gc import random import unittest import torch from diffusers import ( IFImgaImgPipeline, IFImgaImgSuperResolutionPipeline, IFInpaintingPipeline, IFInpaintingSuperResolutionPipeline, IFPipeline, IFSuperResolutionPipeline, ) from diffusers.models.attention_processor import A...
15
1
import argparse import struct import unittest class __snake_case : '''simple docstring''' def __init__( self : List[Any] , _UpperCamelCase : bytes) ->None: """simple docstring""" _lowerCamelCase : str = ...
15
from collections import OrderedDict from typing import Mapping from packaging import version from ...configuration_utils import PretrainedConfig from ...onnx import OnnxConfig from ...utils import logging from ...utils.backbone_utils import BackboneConfigMixin, get_aligned_output_features_output_indices ...
15
1
def A__ ( __A , __A , __A ): '''simple docstring''' if len(__A ) != len(__A ): raise ValueError("""The length of profit and weight must be same.""" ) if max_weight <= 0: raise ValueError("""max_weight must greater than zero.""" ) if any(p < 0 for p in p...
15
import torch from diffusers import EulerDiscreteScheduler from diffusers.utils import torch_device from .test_schedulers import SchedulerCommonTest class __snake_case ( __lowerCAmelCase ): '''simple docstring''' _snake_case = (EulerDiscreteScheduler,) ...
15
1
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 ( __low...
15
import json import os from typing import Optional, Tuple from ...tokenization_utils import PreTrainedTokenizer from ...utils import logging lowerCAmelCase : Dict =logging.get_logger(__name__) lowerCAmelCase : Dict ={"vocab_file": "vocab.json"} lowerCAmelCase : List[str] ...
15
1
import argparse from typing import Dict import tensorflow as tf import torch from tqdm import tqdm from transformers import BigBirdPegasusConfig, BigBirdPegasusForConditionalGeneration lowerCAmelCase : Optional[int] =[ # tf -> hf ("/", "."), ("layer_", "layers."), ("kernel"...
15
import unittest from transformers.utils.backbone_utils import ( BackboneMixin, get_aligned_output_features_output_indices, verify_out_features_out_indices, ) class __snake_case ( unittest.TestCase ): '''simple docstring''' def _SCREAMING_SNAKE_CASE (...
15
1
import warnings from .generation import TFGenerationMixin class __snake_case ( __lowerCAmelCase ): '''simple docstring''' warnings.warn( 'Importing `TFGenerationMixin` from `src/transformers/generation_tf_utils.py` is deprecated and will ' 'be remo...
15
import math def A__ ( __A ): '''simple docstring''' assert isinstance(__A , __A ) and ( number >= 0 ), "'number' must been an int and positive" if 1 < number < 4: # 2 and 3 are primes return True elif number < 2 or not numbe...
15
1
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: F401 # Here to have a nice...
15
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...
15
1
from ..utils import DummyObject, requires_backends class __snake_case ( metaclass=__lowerCAmelCase ): '''simple docstring''' _snake_case = ['onnx'] def __init__( self : Optional[Any] , *_UpperCamelCase : Tuple , **_UpperCam...
15
import json import os import shutil import tempfile import unittest import numpy as np import pytest from transformers import MgpstrTokenizer from transformers.models.mgp_str.tokenization_mgp_str import VOCAB_FILES_NAMES from transformers.testing_utils import require_torch, require_vision from transformer...
15
1
import argparse import os import torch from transformers.utils import WEIGHTS_NAME lowerCAmelCase : Optional[Any] =["small", "medium", "large"] lowerCAmelCase : Dict ="lm_head.decoder.weight" lowerCAmelCase : str ="lm_head.weight" def A__ ( _...
15
import importlib import sys from argparse import REMAINDER, ArgumentParser from pathlib import Path import torch_xla.distributed.xla_multiprocessing as xmp def A__ ( ): '''simple docstring''' _lowerCamelCase : Optional[int] = ArgumentParser( ...
15
1
import itertools import os import random import tempfile import unittest import numpy as np from datasets import load_dataset from transformers import is_speech_available from transformers.testing_utils import check_json_file_has_correct_format, require_torch, require_torchaudio from transformers.utils.imp...
15
def A__ ( __A , __A ): '''simple docstring''' _enforce_args(__A , __A ) if n == 0: return 0 _lowerCamelCase : Tuple = float("""-inf""" ) for i in range(1 , n + 1 ): _lowerCamelCase : Any = max( __A ,...
15
1
import argparse import torch from transformers import MobileBertConfig, MobileBertForPreTraining, load_tf_weights_in_mobilebert from transformers.utils import logging logging.set_verbosity_info() def A__ ( __A , __A , __A ): '''simple docstring''' # Init...
15
from __future__ import annotations class __snake_case : '''simple docstring''' def __init__( self : Tuple , _UpperCamelCase : int = 0) ->str: """simple docstring""" _lowerCamelCase : Union[str, Any] = ke...
15
1
from collections.abc import Callable import numpy as np def A__ ( __A , __A , __A , __A , __A ): '''simple docstring''' _lowerCamelCase : Union[str, Any] = int(np.ceil((x_end - xa) / step_size ) ) _lowerCamelCase : int = n...
15
from typing import Optional from .. import Features, NamedSplit from ..packaged_modules.text.text import Text from ..utils.typing import NestedDataStructureLike, PathLike from .abc import AbstractDatasetReader class __snake_case ( __lowerCAmelCase ): '''simple docstring''' ...
15
1
def A__ ( __A , __A ): '''simple docstring''' if a < 0 or b < 0: raise ValueError("""the value of both inputs must be positive""" ) _lowerCamelCase : str = str(bin(__A ) )[2:] # remove the leading "0b" _lowerCamelCase : Dict = st...
15
lowerCAmelCase : Tuple =0 # The first color of the flag. lowerCAmelCase : Union[str, Any] =1 # The second color of the flag. lowerCAmelCase : Any =2 # The third color of the flag. lowerCAmelCase : List[str] =(red, white, blue) def A__ ( __A...
15
1
import math import os import sys def A__ ( __A ): '''simple docstring''' _lowerCamelCase : Dict = """""" try: with open(__A , """rb""" ) as binary_file: _lowerCamelCase : List[Any] = binary_file.read() ...
15
from __future__ import annotations lowerCAmelCase : int =[] def A__ ( __A , __A , __A ): '''simple docstring''' for i in range(len(__A ) ): if board[row][i] == 1: return False for i in range(len(__A ) ): if board[i]...
15
1
from ..utils import DummyObject, requires_backends class __snake_case ( metaclass=__lowerCAmelCase ): '''simple docstring''' _snake_case = ['torch', 'transformers', 'onnx'] def __init__( self : List[str] , *_UpperCamelCase : Li...
15
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 lowerCAmelCase : int ...
15
1
import argparse import torch from datasets import load_dataset from donut import DonutModel from transformers import ( DonutImageProcessor, DonutProcessor, DonutSwinConfig, DonutSwinModel, MBartConfig, MBartForCausalLM, VisionEncoderDecoderModel, XLMRobertaTokenizerFast, ...
15
def A__ ( __A ): '''simple docstring''' _lowerCamelCase : Tuple = 0 for ch in input_str: _lowerCamelCase : Optional[Any] = ord(__A ) _lowerCamelCase : List[str] = pow(2 , __A ) # If we already turned o...
15
1
def A__ ( __A ): '''simple docstring''' assert isinstance(__A , __A ), F"""The input value of [n={number}] is not an integer""" if number == 1: return 2 elif number < 1: _lowerCamelCase : Optional[int] = F"""The input value of [n={number...
15
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 @req...
15
1
import os import tempfile import unittest from transformers import FlaubertConfig, is_torch_available from transformers.testing_utils import require_torch, require_torch_gpu, slow, torch_device from ...test_configuration_common import ConfigTester from ...test_modeling_common import ModelTesterMixin, ids_tens...
15
from typing import Dict, List, Optional, Union import numpy as np from ...image_processing_utils import BaseImageProcessor, BatchFeature, get_size_dict from ...image_transforms import center_crop, normalize, rescale, resize, to_channel_dimension_format from ...image_utils import ( IMAGENET_STANDARD_MEAN, ...
15
1
import math lowerCAmelCase : List[str] =10 lowerCAmelCase : List[Any] =7 lowerCAmelCase : Dict =BALLS_PER_COLOUR * NUM_COLOURS def A__ ( __A = 20 ): '''simple docstring''' _lowerCamelCase : Optional[Any] = math.co...
15
from __future__ import annotations from math import pi from typing import Protocol import matplotlib.pyplot as plt import numpy as np class __snake_case ( __lowerCAmelCase ): '''simple docstring''' def _SCREAMING_SNAKE_CASE ( self : Optional[Any] ...
15
1
import logging import math from functools import partial from typing import Any, Callable, Dict, Iterable, List, Optional, Sequence, Tuple, Union import torch from .tensor_utils import tensor_tree_map, tree_map def A__ ( __A ): '''simple docstring''' _lowerCame...
15
import argparse from pathlib import Path import torch from packaging import version from torch.onnx import export from diffusers import AutoencoderKL lowerCAmelCase : Tuple =version.parse(version.parse(torch.__version__).base_version) < version.parse("1.11") def A__ ( ...
15
1
import uuid from typing import Any, Dict, List, Optional, Union from ..utils import add_end_docstrings, is_tf_available, is_torch_available, logging from .base import PIPELINE_INIT_ARGS, Pipeline if is_tf_available(): import tensorflow as tf if is_torch_available(): import torch lowerCAmelCa...
15
from math import log from scipy.constants import Boltzmann, physical_constants lowerCAmelCase : List[Any] =300 # TEMPERATURE (unit = K) def A__ ( __A , __A , __A , ): '''simple docstring''' if donor_conc <= 0: raise ValueError("""Dono...
15
1
import numpy as np import datasets lowerCAmelCase : Optional[int] ="\nCompute the Mahalanobis Distance\n\nMahalonobis distance is the distance between a point and a distribution.\nAnd not between two distinct points. It is effectively a multivariate equivalent of the Euclidean distance.\nIt was intr...
15
import multiprocessing import time from arguments import PretokenizationArguments from datasets import load_dataset from transformers import AutoTokenizer, HfArgumentParser def A__ ( __A ): '''simple docstring''' _lowerCamelCase : Tuple = {} ...
15
1
import argparse import os import re lowerCAmelCase : Optional[Any] ="src/transformers/models/auto" # re pattern that matches mapping introductions: # SUPER_MODEL_MAPPING_NAMES = OrderedDict or SUPER_MODEL_MAPPING = OrderedDict lowerCAmelCase : List[Any] =re.compile(r"[A-Z_]+_MAP...
15
import gc import random import unittest import torch from diffusers import ( IFImgaImgPipeline, IFImgaImgSuperResolutionPipeline, IFInpaintingPipeline, IFInpaintingSuperResolutionPipeline, IFPipeline, IFSuperResolutionPipeline, ) from diffusers.models.attention_processor import A...
15
1
import unittest from huggingface_hub import hf_hub_download from transformers import MODEL_FOR_VIDEO_CLASSIFICATION_MAPPING, VideoMAEFeatureExtractor from transformers.pipelines import VideoClassificationPipeline, pipeline from transformers.testing_utils import ( is_pipeline_test, nested_simplify, ...
15
from collections import OrderedDict from typing import Mapping from packaging import version from ...configuration_utils import PretrainedConfig from ...onnx import OnnxConfig from ...utils import logging from ...utils.backbone_utils import BackboneConfigMixin, get_aligned_output_features_output_indices ...
15
1
import datasets from .evaluate import evaluate lowerCAmelCase : int ="\\n@inproceedings{Rajpurkar2016SQuAD10,\n title={SQuAD: 100, 000+ Questions for Machine Comprehension of Text},\n author={Pranav Rajpurkar and Jian Zhang and Konstantin Lopyrev and Percy Liang},\n booktitle={EMNLP},\n year={20...
15
import torch from diffusers import EulerDiscreteScheduler from diffusers.utils import torch_device from .test_schedulers import SchedulerCommonTest class __snake_case ( __lowerCAmelCase ): '''simple docstring''' _snake_case = (EulerDiscreteScheduler,) ...
15
1
import logging import os from typing import List, Tuple import numpy as np import psutil import torch import torch.distributed as dist from transformers import RagRetriever lowerCAmelCase : List[str] =logging.getLogger(__name__) class __snake_case ( __lowerCAmelCase ): ...
15
import json import os from typing import Optional, Tuple from ...tokenization_utils import PreTrainedTokenizer from ...utils import logging lowerCAmelCase : Dict =logging.get_logger(__name__) lowerCAmelCase : Dict ={"vocab_file": "vocab.json"} lowerCAmelCase : List[str] ...
15
1
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 @req...
15
import unittest from transformers.utils.backbone_utils import ( BackboneMixin, get_aligned_output_features_output_indices, verify_out_features_out_indices, ) class __snake_case ( unittest.TestCase ): '''simple docstring''' def _SCREAMING_SNAKE_CASE (...
15
1
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(): ...
15
import math def A__ ( __A ): '''simple docstring''' assert isinstance(__A , __A ) and ( number >= 0 ), "'number' must been an int and positive" if 1 < number < 4: # 2 and 3 are primes return True elif number < 2 or not numbe...
15
1
# 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...
15
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...
15
1
from typing import Optional, Union import numpy as np from ...image_processing_utils import BaseImageProcessor, BatchFeature from ...image_transforms import get_image_size, pad, rescale, to_channel_dimension_format from ...image_utils import ChannelDimension, ImageInput, make_list_of_images, to_numpy_array, val...
15
import json import os import shutil import tempfile import unittest import numpy as np import pytest from transformers import MgpstrTokenizer from transformers.models.mgp_str.tokenization_mgp_str import VOCAB_FILES_NAMES from transformers.testing_utils import require_torch, require_vision from transformer...
15
1
def A__ ( __A , __A , __A , __A , __A ): '''simple docstring''' if index == number_of_items: return 0 _lowerCamelCase : Optional[int] = 0 _lowerCamelCase : str = 0 _lowerCamelCase : List[Any] = knapsack(__...
15
import importlib import sys from argparse import REMAINDER, ArgumentParser from pathlib import Path import torch_xla.distributed.xla_multiprocessing as xmp def A__ ( ): '''simple docstring''' _lowerCamelCase : Optional[int] = ArgumentParser( ...
15
1
import itertools import json import os import unittest from transformers import AddedToken, RobertaTokenizer, RobertaTokenizerFast from transformers.models.roberta.tokenization_roberta import VOCAB_FILES_NAMES from transformers.testing_utils import require_tokenizers, slow from ...test_tokenization_common im...
15
def A__ ( __A , __A ): '''simple docstring''' _enforce_args(__A , __A ) if n == 0: return 0 _lowerCamelCase : Tuple = float("""-inf""" ) for i in range(1 , n + 1 ): _lowerCamelCase : Any = max( __A ,...
15
1
from .dependency_versions_table import deps from .utils.versions import require_version, require_version_core # define which module versions we always want to check at run time # (usually the ones defined in `install_requires` in setup.py) # # order specific notes: # - tqdm must be checked before tokenizers ...
15
from __future__ import annotations class __snake_case : '''simple docstring''' def __init__( self : Tuple , _UpperCamelCase : int = 0) ->str: """simple docstring""" _lowerCamelCase : Union[str, Any] = ke...
15
1
def A__ ( __A = 10**9 ): '''simple docstring''' _lowerCamelCase : Union[str, Any] = 1 _lowerCamelCase : List[str] = 2 _lowerCamelCase : Union[str, Any] = 0 _lowerCamelCase : List[str] = 0 _lowerCamel...
15
from typing import Optional from .. import Features, NamedSplit from ..packaged_modules.text.text import Text from ..utils.typing import NestedDataStructureLike, PathLike from .abc import AbstractDatasetReader class __snake_case ( __lowerCAmelCase ): '''simple docstring''' ...
15
1
import inspect import unittest from transformers import MobileNetVaConfig 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_configuration_common import ConfigTester from ...
15
lowerCAmelCase : Tuple =0 # The first color of the flag. lowerCAmelCase : Union[str, Any] =1 # The second color of the flag. lowerCAmelCase : Any =2 # The third color of the flag. lowerCAmelCase : List[str] =(red, white, blue) def A__ ( __A...
15
1
def A__ ( __A ): '''simple docstring''' _lowerCamelCase : Tuple = 0 for ch in input_str: _lowerCamelCase : Optional[Any] = ord(__A ) _lowerCamelCase : List[str] = pow(2 , __A ) # If we already turned o...
15
from __future__ import annotations lowerCAmelCase : int =[] def A__ ( __A , __A , __A ): '''simple docstring''' for i in range(len(__A ) ): if board[row][i] == 1: return False for i in range(len(__A ) ): if board[i]...
15
1
import gc import random import unittest import numpy as np import torch from PIL import Image from diffusers import ( DDIMScheduler, KandinskyVaaControlnetImgaImgPipeline, KandinskyVaaPriorEmbaEmbPipeline, UNetaDConditionModel, VQModel, ) from diffusers.utils import floats_tensor, l...
15
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 lowerCAmelCase : int ...
15
1
import unittest from transformers import SqueezeBertConfig, is_torch_available from transformers.testing_utils import require_sentencepiece, require_tokenizers, require_torch, slow, torch_device from ...test_configuration_common import ConfigTester from ...test_modeling_common import ModelTesterMixin, ids_tenso...
15
def A__ ( __A ): '''simple docstring''' _lowerCamelCase : Tuple = 0 for ch in input_str: _lowerCamelCase : Optional[Any] = ord(__A ) _lowerCamelCase : List[str] = pow(2 , __A ) # If we already turned o...
15
1
from collections import OrderedDict from typing import Mapping from ...configuration_utils import PretrainedConfig from ...onnx import OnnxConfig from ...utils import logging lowerCAmelCase : Optional[int] =logging.get_logger(__name__) lowerCAmelCase : List[Any] ={ "kssteven/i...
15
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 @req...
15
1
from typing import Dict import numpy as np import torch from . import residue_constants as rc from .tensor_utils import tensor_tree_map, tree_map def A__ ( __A ): '''simple docstring''' _lowerCamelCase : Dict = [] _lowerCamelCase : List...
15
from typing import Dict, List, Optional, Union import numpy as np from ...image_processing_utils import BaseImageProcessor, BatchFeature, get_size_dict from ...image_transforms import center_crop, normalize, rescale, resize, to_channel_dimension_format from ...image_utils import ( IMAGENET_STANDARD_MEAN, ...
15
1
class __snake_case : '''simple docstring''' def __init__( self : Optional[int] , _UpperCamelCase : str = "" , _UpperCamelCase : bool = False) ->None: """simple docstring""" _lowerCamelCase : dict[str, RadixNode] ...
15
from __future__ import annotations from math import pi from typing import Protocol import matplotlib.pyplot as plt import numpy as np class __snake_case ( __lowerCAmelCase ): '''simple docstring''' def _SCREAMING_SNAKE_CASE ( self : Optional[Any] ...
15
1
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_full_det...
15
import argparse from pathlib import Path import torch from packaging import version from torch.onnx import export from diffusers import AutoencoderKL lowerCAmelCase : Tuple =version.parse(version.parse(torch.__version__).base_version) < version.parse("1.11") def A__ ( ...
15
1
from ...utils import is_torch_available, is_transformers_available if is_transformers_available() and is_torch_available(): from .pipeline_vq_diffusion import LearnedClassifierFreeSamplingEmbeddings, VQDiffusionPipeline
15
from math import log from scipy.constants import Boltzmann, physical_constants lowerCAmelCase : List[Any] =300 # TEMPERATURE (unit = K) def A__ ( __A , __A , __A , ): '''simple docstring''' if donor_conc <= 0: raise ValueError("""Dono...
15
1
import json import os import tempfile from unittest.mock import patch import torch from torch.utils.data import DataLoader, TensorDataset from accelerate import DistributedType, infer_auto_device_map, init_empty_weights from accelerate.accelerator import Accelerator from accelerate.state import GradientStat...
15
import multiprocessing import time from arguments import PretokenizationArguments from datasets import load_dataset from transformers import AutoTokenizer, HfArgumentParser def A__ ( __A ): '''simple docstring''' _lowerCamelCase : Tuple = {} ...
15
1
from __future__ import annotations def A__ ( __A , __A ): '''simple docstring''' _lowerCamelCase : Union[str, Any] = 0 _lowerCamelCase : Optional[int] = len(__A ) - 1 while i < j: if nums[i] + nums[j] == target: ...
15
import gc import random import unittest import torch from diffusers import ( IFImgaImgPipeline, IFImgaImgSuperResolutionPipeline, IFInpaintingPipeline, IFInpaintingSuperResolutionPipeline, IFPipeline, IFSuperResolutionPipeline, ) from diffusers.models.attention_processor import A...
15
1
import copy import re class __snake_case : '''simple docstring''' _snake_case = 'hp' _snake_case = {} _snake_case = None @classmethod def _SCREAMING_SNAKE_CASE ( cls : List[Any] , _UpperC...
15
from collections import OrderedDict from typing import Mapping from packaging import version from ...configuration_utils import PretrainedConfig from ...onnx import OnnxConfig from ...utils import logging from ...utils.backbone_utils import BackboneConfigMixin, get_aligned_output_features_output_indices ...
15
1
import json import os import shutil import tempfile import unittest import numpy as np import pytest from transformers import CLIPTokenizer, CLIPTokenizerFast from transformers.models.clip.tokenization_clip import VOCAB_FILES_NAMES from transformers.testing_utils import require_vision from transformers.ut...
15
import torch from diffusers import EulerDiscreteScheduler from diffusers.utils import torch_device from .test_schedulers import SchedulerCommonTest class __snake_case ( __lowerCAmelCase ): '''simple docstring''' _snake_case = (EulerDiscreteScheduler,) ...
15
1
import logging import os from dataclasses import dataclass, field from typing import Dict, Optional import datasets import numpy as np import tensorflow as tf from transformers import ( AutoConfig, AutoTokenizer, EvalPrediction, HfArgumentParser, PreTrainedTokenizer, TFAutoModel...
15
import json import os from typing import Optional, Tuple from ...tokenization_utils import PreTrainedTokenizer from ...utils import logging lowerCAmelCase : Dict =logging.get_logger(__name__) lowerCAmelCase : Dict ={"vocab_file": "vocab.json"} lowerCAmelCase : List[str] ...
15
1
import json from typing import List, Optional, Tuple from tokenizers import normalizers from ...tokenization_utils_fast import PreTrainedTokenizerFast from ...utils import logging from .tokenization_distilbert import DistilBertTokenizer lowerCAmelCase : str =logging.get_logger(__name__) low...
15
import unittest from transformers.utils.backbone_utils import ( BackboneMixin, get_aligned_output_features_output_indices, verify_out_features_out_indices, ) class __snake_case ( unittest.TestCase ): '''simple docstring''' def _SCREAMING_SNAKE_CASE (...
15
1
# flake8: noqa # Lint as: python3 from typing import Dict, List, Optional, Type from .. import config from ..utils import logging from .formatting import ( ArrowFormatter, CustomFormatter, Formatter, PandasFormatter, PythonFormatter, TensorFormatter, format_table, query_...
15
import math def A__ ( __A ): '''simple docstring''' assert isinstance(__A , __A ) and ( number >= 0 ), "'number' must been an int and positive" if 1 < number < 4: # 2 and 3 are primes return True elif number < 2 or not numbe...
15
1
def A__ ( __A ): '''simple docstring''' def merge(__A , __A ) -> list: def _merge(): while left and right: yield (left if left[0] <= right[0] else right).pop(0 ) yield from left yield from right return l...
15
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...
15
1
def A__ ( __A ): '''simple docstring''' if not all(x.isalpha() for x in string ): raise ValueError("""String must only contain alphabetic characters.""" ) _lowerCamelCase : str = sorted(string.lower() ) return len(__A ) == len(set(__A ) ) if _...
15
import json import os import shutil import tempfile import unittest import numpy as np import pytest from transformers import MgpstrTokenizer from transformers.models.mgp_str.tokenization_mgp_str import VOCAB_FILES_NAMES from transformers.testing_utils import require_torch, require_vision from transformer...
15
1
import argparse import fairseq import torch from transformers import UniSpeechSatConfig, UniSpeechSatForCTC, UniSpeechSatForPreTraining, logging logging.set_verbosity_info() lowerCAmelCase : Optional[Any] =logging.get_logger(__name__) lowerCAmelCase : Union[str, Any] ={ "pos...
15
import importlib import sys from argparse import REMAINDER, ArgumentParser from pathlib import Path import torch_xla.distributed.xla_multiprocessing as xmp def A__ ( ): '''simple docstring''' _lowerCamelCase : Optional[int] = ArgumentParser( ...
15
1
from ...configuration_utils import PretrainedConfig from ...utils import logging lowerCAmelCase : str =logging.get_logger(__name__) lowerCAmelCase : Tuple ={ "edbeeching/decision-transformer-gym-hopper-medium": ( "https://huggingface.co/edbeeching/decision-transformer-gym-...
15
def A__ ( __A , __A ): '''simple docstring''' _enforce_args(__A , __A ) if n == 0: return 0 _lowerCamelCase : Tuple = float("""-inf""" ) for i in range(1 , n + 1 ): _lowerCamelCase : Any = max( __A ,...
15
1
import os import shutil import tempfile import unittest import numpy as np from transformers import AutoTokenizer, BarkProcessor from transformers.testing_utils import require_torch, slow @require_torch class __snake_case ( unittest.TestCase ): '''simple docstring''' ...
15
from __future__ import annotations class __snake_case : '''simple docstring''' def __init__( self : Tuple , _UpperCamelCase : int = 0) ->str: """simple docstring""" _lowerCamelCase : Union[str, Any] = ke...
15
1
def A__ ( __A , __A ): '''simple docstring''' _lowerCamelCase : Optional[int] = """""" for i in table: res += inp[i - 1] return res def A__ ( __A ): '''simple docstring''' return data[1:] + data[0] ...
15
from typing import Optional from .. import Features, NamedSplit from ..packaged_modules.text.text import Text from ..utils.typing import NestedDataStructureLike, PathLike from .abc import AbstractDatasetReader class __snake_case ( __lowerCAmelCase ): '''simple docstring''' ...
15
1
import json import os import unittest from transformers.models.blenderbot_small.tokenization_blenderbot_small import ( VOCAB_FILES_NAMES, BlenderbotSmallTokenizer, ) from ...test_tokenization_common import TokenizerTesterMixin class __snake_case ( __lowerCAmelCase , unittest.TestCase ): ...
15
lowerCAmelCase : Tuple =0 # The first color of the flag. lowerCAmelCase : Union[str, Any] =1 # The second color of the flag. lowerCAmelCase : Any =2 # The third color of the flag. lowerCAmelCase : List[str] =(red, white, blue) def A__ ( __A...
15
1
import unittest from pathlib import Path from tempfile import TemporaryDirectory from transformers import AutoConfig, TFGPTaLMHeadModel, is_keras_nlp_available, is_tf_available from transformers.models.gpta.tokenization_gpta import GPTaTokenizer from transformers.testing_utils import require_keras_nlp, require_t...
15
from __future__ import annotations lowerCAmelCase : int =[] def A__ ( __A , __A , __A ): '''simple docstring''' for i in range(len(__A ) ): if board[row][i] == 1: return False for i in range(len(__A ) ): if board[i]...
15
1
import warnings from typing import List, Optional, Union from ...processing_utils import ProcessorMixin from ...tokenization_utils_base import BatchEncoding, PaddingStrategy, PreTokenizedInput, TextInput, TruncationStrategy from ...utils import TensorType class __snake_case ( __lowerCAmelCase ): ...
15
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 lowerCAmelCase : int ...
15
1
import os import tempfile from functools import partial from unittest import TestCase from unittest.mock import patch import numpy as np import pytest from datasets.arrow_dataset import Dataset from datasets.search import ElasticSearchIndex, FaissIndex, MissingIndex from .utils import require_elasticsear...
15
def A__ ( __A ): '''simple docstring''' _lowerCamelCase : Tuple = 0 for ch in input_str: _lowerCamelCase : Optional[Any] = ord(__A ) _lowerCamelCase : List[str] = pow(2 , __A ) # If we already turned o...
15
1
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 cla...
15
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 @req...
15
1
# Copyright 2022 The HuggingFace Team and The OpenBMB 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 # #...
15
from typing import Dict, List, Optional, Union import numpy as np from ...image_processing_utils import BaseImageProcessor, BatchFeature, get_size_dict from ...image_transforms import center_crop, normalize, rescale, resize, to_channel_dimension_format from ...image_utils import ( IMAGENET_STANDARD_MEAN, ...
15
1
import json import multiprocessing as mp import re from collections import defaultdict from functools import partial from typing import Dict, List, Optional, Set, Tuple, Type from datasets import Dataset from datasketch import MinHash, MinHashLSH from dpu_utils.utils.iterators import ThreadedIterator from tq...
15
from __future__ import annotations from math import pi from typing import Protocol import matplotlib.pyplot as plt import numpy as np class __snake_case ( __lowerCAmelCase ): '''simple docstring''' def _SCREAMING_SNAKE_CASE ( self : Optional[Any] ...
15
1
import json import os from functools import lru_cache from typing import List, Optional, Tuple import regex as re from ...tokenization_utils import AddedToken, PreTrainedTokenizer from ...utils import logging lowerCAmelCase : Dict =logging.get_logger(__name__) lowerCAmelCase : Li...
15
import argparse from pathlib import Path import torch from packaging import version from torch.onnx import export from diffusers import AutoencoderKL lowerCAmelCase : Tuple =version.parse(version.parse(torch.__version__).base_version) < version.parse("1.11") def A__ ( ...
15
1
import argparse import logging import sys from unittest.mock import patch import run_glue_deebert from transformers.testing_utils import TestCasePlus, get_gpu_count, require_torch_non_multi_gpu, slow logging.basicConfig(level=logging.DEBUG) lowerCAmelCase : Dict =logging.getLogger() ...
15
from math import log from scipy.constants import Boltzmann, physical_constants lowerCAmelCase : List[Any] =300 # TEMPERATURE (unit = K) def A__ ( __A , __A , __A , ): '''simple docstring''' if donor_conc <= 0: raise ValueError("""Dono...
15
1
from collections import OrderedDict from typing import Mapping from packaging import version from ...configuration_utils import PretrainedConfig from ...onnx import OnnxConfig from ...utils import logging from ...utils.backbone_utils import BackboneConfigMixin, get_aligned_output_features_output_indices ...
15
import multiprocessing import time from arguments import PretokenizationArguments from datasets import load_dataset from transformers import AutoTokenizer, HfArgumentParser def A__ ( __A ): '''simple docstring''' _lowerCamelCase : Tuple = {} ...
15
1
import secrets from random import shuffle from string import ascii_letters, ascii_lowercase, ascii_uppercase, digits, punctuation def A__ ( __A = 8 ): '''simple docstring''' _lowerCamelCase : str = ascii_letters + digits + punctuation return "".jo...
15
import gc import random import unittest import torch from diffusers import ( IFImgaImgPipeline, IFImgaImgSuperResolutionPipeline, IFInpaintingPipeline, IFInpaintingSuperResolutionPipeline, IFPipeline, IFSuperResolutionPipeline, ) from diffusers.models.attention_processor import A...
15
1
from __future__ import annotations from collections.abc import Callable from typing import Any, Generic, TypeVar lowerCAmelCase : Optional[int] =TypeVar("T") class __snake_case ( Generic[T] ): '''simple docstring''' def __init__( self : Tuple ...
15
from collections import OrderedDict from typing import Mapping from packaging import version from ...configuration_utils import PretrainedConfig from ...onnx import OnnxConfig from ...utils import logging from ...utils.backbone_utils import BackboneConfigMixin, get_aligned_output_features_output_indices ...
15
1
from __future__ import annotations from math import pi def A__ ( __A , __A , __A ): '''simple docstring''' if (inductance, frequency, reactance).count(0 ) != 1: raise ValueError("""One and only one argument must be 0""" ) if inductance < 0: ...
15
import torch from diffusers import EulerDiscreteScheduler from diffusers.utils import torch_device from .test_schedulers import SchedulerCommonTest class __snake_case ( __lowerCAmelCase ): '''simple docstring''' _snake_case = (EulerDiscreteScheduler,) ...
15
1
import os import zipfile import requests from get_ci_error_statistics import download_artifact, get_artifacts_links def A__ ( __A , __A=7 ): '''simple docstring''' _lowerCamelCase : List[Any] = None if token is not None: _lowerCamelC...
15
import json import os from typing import Optional, Tuple from ...tokenization_utils import PreTrainedTokenizer from ...utils import logging lowerCAmelCase : Dict =logging.get_logger(__name__) lowerCAmelCase : Dict ={"vocab_file": "vocab.json"} lowerCAmelCase : List[str] ...
15
1
from ...processing_utils import ProcessorMixin from ...tokenization_utils_base import BatchEncoding class __snake_case ( __lowerCAmelCase ): '''simple docstring''' _snake_case = ['image_processor', 'tokenizer'] _snake_case = 'AutoImageProcesso...
15
import unittest from transformers.utils.backbone_utils import ( BackboneMixin, get_aligned_output_features_output_indices, verify_out_features_out_indices, ) class __snake_case ( unittest.TestCase ): '''simple docstring''' def _SCREAMING_SNAKE_CASE (...
15
1
from __future__ import annotations from collections import deque from collections.abc import Sequence from dataclasses import dataclass from typing import Any @dataclass class __snake_case : '''simple docstring''' _snake_case = 42 _snake_case =...
15
import math def A__ ( __A ): '''simple docstring''' assert isinstance(__A , __A ) and ( number >= 0 ), "'number' must been an int and positive" if 1 < number < 4: # 2 and 3 are primes return True elif number < 2 or not numbe...
15
1
import copy from collections import OrderedDict from typing import Dict, Mapping from packaging import version from ...configuration_utils import PretrainedConfig from ...onnx import OnnxConfig from ...utils import logging from ..auto import CONFIG_MAPPING lowerCAmelCase : Tuple =logging.get...
15
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...
15
1
from __future__ import annotations from numpy import array, cos, cross, floataa, radians, sin from numpy.typing import NDArray def A__ ( __A , __A , __A = False ): '''simple docstring''' if radian_mode: return [magnitude * cos(__A ), magnitude * sin(__A...
15
import json import os import shutil import tempfile import unittest import numpy as np import pytest from transformers import MgpstrTokenizer from transformers.models.mgp_str.tokenization_mgp_str import VOCAB_FILES_NAMES from transformers.testing_utils import require_torch, require_vision from transformer...
15
1
import logging import os import quant_trainer import torch from torch.utils.data import DataLoader from transformers import Trainer, is_torch_tpu_available from transformers.trainer_utils import PredictionOutput lowerCAmelCase : Union[str, Any] =logging.getLogger(__name__) if is_torch_tpu_...
15
import importlib import sys from argparse import REMAINDER, ArgumentParser from pathlib import Path import torch_xla.distributed.xla_multiprocessing as xmp def A__ ( ): '''simple docstring''' _lowerCamelCase : Optional[int] = ArgumentParser( ...
15
1
class __snake_case : '''simple docstring''' def __init__( self : int) ->Tuple: """simple docstring""" _lowerCamelCase : Tuple = {} def _SCREAMING_SNAKE_CASE ( self : str) ->None: ...
15
def A__ ( __A , __A ): '''simple docstring''' _enforce_args(__A , __A ) if n == 0: return 0 _lowerCamelCase : Tuple = float("""-inf""" ) for i in range(1 , n + 1 ): _lowerCamelCase : Any = max( __A ,...
15
1
import numpy as np import qiskit def A__ ( __A = 8 , __A = None ): '''simple docstring''' _lowerCamelCase : Any = np.random.default_rng(seed=__A ) # Roughly 25% of the qubits will contribute to the key. # So we take more than we need. ...
15
from __future__ import annotations class __snake_case : '''simple docstring''' def __init__( self : Tuple , _UpperCamelCase : int = 0) ->str: """simple docstring""" _lowerCamelCase : Union[str, Any] = ke...
15
1