code
stringlengths
87
55.2k
code_codestyle
int64
0
349
style_context
stringlengths
135
49.1k
style_context_codestyle
int64
0
349
label
int64
0
1
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, DDIMScheduler, ...
262
def lowerCAmelCase ( lowerCAmelCase_ )-> set: lowerCAmelCase_ : Optional[int] = set() # edges = list of graph's edges lowerCAmelCase_ : List[str] = get_edges(lowerCAmelCase_ ) # While there are still elements in edges list, take an arbitrary ed...
262
1
from dataclasses import dataclass from typing import Dict, Optional, Union import torch import torch.nn.functional as F from torch import nn from ..configuration_utils import ConfigMixin, register_to_config from ..utils import BaseOutput from .attention import BasicTransformerBlock from .attention_processor import...
262
from math import sqrt def lowerCAmelCase ( lowerCAmelCase_ )-> bool: assert isinstance(lowerCAmelCase_ , lowerCAmelCase_ ) and ( number >= 0 ), "'number' must been an int and positive" lowerCAmelCase_ : List[Any] = True # 0 and 1 are ...
262
1
import os from pathlib import Path from unittest.mock import patch import pytest import zstandard as zstd from datasets.download.download_config import DownloadConfig from datasets.utils.file_utils import ( OfflineModeIsEnabled, cached_path, fsspec_get, fsspec_head, ftp_get, ftp_head, g...
262
import json import os import re import shutil import tempfile import unittest from typing import Tuple from transformers import AddedToken, BatchEncoding, PerceiverTokenizer from transformers.utils import cached_property, is_tf_available, is_torch_available from ...test_tokenization_common import TokenizerTesterMi...
262
1
from typing import TYPE_CHECKING from ...utils import OptionalDependencyNotAvailable, _LazyModule, is_torch_available _UpperCAmelCase : Union[str, Any] ={ """configuration_jukebox""": [ """JUKEBOX_PRETRAINED_CONFIG_ARCHIVE_MAP""", """JukeboxConfig""", """JukeboxPriorConfig""", ...
262
import unittest from transformers import MODEL_FOR_ZERO_SHOT_OBJECT_DETECTION_MAPPING, is_vision_available, pipeline from transformers.testing_utils import ( is_pipeline_test, nested_simplify, require_tf, require_torch, require_vision, slow, ) from .test_pipelines_common import ANY if is_...
262
1
from arguments import InitializationArguments from transformers import AutoConfig, AutoModelForCausalLM, AutoTokenizer, HfArgumentParser # Configuration _UpperCAmelCase : Union[str, Any] =HfArgumentParser(InitializationArguments) _UpperCAmelCase : Tuple =parser.parse_args() # Load codeparrot tokenize...
262
from .glue import glue_convert_examples_to_features, glue_output_modes, glue_processors, glue_tasks_num_labels from .squad import SquadExample, SquadFeatures, SquadVaProcessor, SquadVaProcessor, squad_convert_examples_to_features from .utils import DataProcessor, InputExample, InputFeatures, SingleSentenceClassifica...
262
1
import flax.linen as nn import jax import jax.numpy as jnp class snake_case__( nn.Module ): '''simple docstring''' SCREAMING_SNAKE_CASE__ : int SCREAMING_SNAKE_CASE__ : jnp.dtype = jnp.floataa def lowercase_ ( self ) ...
262
from __future__ import annotations from typing import Dict from ...configuration_utils import PretrainedConfig _UpperCAmelCase : Dict ={ """susnato/ernie-m-base_pytorch""": """https://huggingface.co/susnato/ernie-m-base_pytorch/blob/main/config.json""", """susnato/ernie-m-large_pytorch""": """https...
262
1
class snake_case__: '''simple docstring''' def __init__( self , __lowercase ) -> None: lowerCAmelCase_ : int = len(__lowercase ) lowerCAmelCase_ : Dict = [0] * len_array if len_array > 0: lowerCAmelC...
262
import unittest import numpy as np from transformers.testing_utils import require_torch, require_vision from transformers.utils import is_torch_available, is_vision_available from ...test_image_processing_common import ImageProcessingSavingTestMixin, prepare_image_inputs if is_torch_available(): import to...
262
1
import random import unittest import torch from diffusers import IFInpaintingSuperResolutionPipeline from diffusers.utils import floats_tensor from diffusers.utils.import_utils import is_xformers_available from diffusers.utils.testing_utils import skip_mps, torch_device from ..pipeline_params import ( TEXT_GU...
262
from __future__ import annotations import math class snake_case__: '''simple docstring''' def __init__( self , __lowercase ) -> None: lowerCAmelCase_ : str = size # approximate the overall size of segment tree with given value ...
262
1
import unittest from transformers import MPNetConfig, 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, ids_tensor, random_attention_mask from ...test_pipeline_mixin...
262
import argparse import collections import os import re from transformers.utils import direct_transformers_import # All paths are set with the intent you should run this script from the root of the repo with the command # python utils/check_table.py _UpperCAmelCase : Optional[int] ="""src/transformers""" _Up...
262
1
import argparse import json from pathlib import Path import requests import timm import torch from huggingface_hub import hf_hub_download from PIL import Image from transformers import DeiTImageProcessor, ViTConfig, ViTForImageClassification, ViTImageProcessor, ViTModel from transformers.utils import logging log...
262
from argparse import ArgumentParser from .add_new_model import AddNewModelCommand from .add_new_model_like import AddNewModelLikeCommand from .convert import ConvertCommand from .download import DownloadCommand from .env import EnvironmentCommand from .lfs import LfsCommands from .pt_to_tf import PTtoTFCommand from...
262
1
import os import unicodedata from shutil import copyfile from typing import Any, Dict, List, Optional, Tuple import sentencepiece as spm from ...tokenization_utils import AddedToken, PreTrainedTokenizer from ...utils import SPIECE_UNDERLINE, logging _UpperCAmelCase : Optional[Any] =logging.get_logger(__nam...
262
import os from shutil import copyfile from typing import List, Optional, Tuple from tokenizers import processors from ...tokenization_utils import AddedToken, BatchEncoding from ...tokenization_utils_fast import PreTrainedTokenizerFast from ...utils import is_sentencepiece_available, logging if is_sentencepiece_...
262
1
import unittest import numpy as np from transformers.testing_utils import require_torch, require_vision from transformers.utils import is_torch_available, is_vision_available from ...test_image_processing_common import ImageProcessingSavingTestMixin, prepare_image_inputs if is_torch_available(): import to...
262
import dataclasses import json import sys import types from argparse import ArgumentDefaultsHelpFormatter, ArgumentParser, ArgumentTypeError from copy import copy from enum import Enum from inspect import isclass from pathlib import Path from typing import Any, Callable, Dict, Iterable, List, Literal, NewType, Optio...
262
1
import sacrebleu as scb from packaging import version from sacrebleu import CHRF import datasets _UpperCAmelCase : Dict ="""\ @inproceedings{popovic-2015-chrf, title = \"chr{F}: character n-gram {F}-score for automatic {MT} evaluation\", author = \"Popovi{\'c}, Maja\", booktitle = \"Proceedings ...
262
import platform from argparse import ArgumentParser import huggingface_hub from .. import __version__ as version from ..utils import is_accelerate_available, is_torch_available, is_transformers_available, is_xformers_available from . import BaseDiffusersCLICommand def lowerCAmelCase ( lowerCAmelCase...
262
1
import json import re from typing import TYPE_CHECKING, List, Optional, Tuple, Union import numpy as np from ...utils import is_tf_available, is_torch_available, logging if TYPE_CHECKING: if is_torch_available(): import torch if is_tf_available(): import tensorflow as tf from...
262
import unittest from transformers import JukeboxTokenizer from transformers.testing_utils import require_torch class snake_case__( unittest.TestCase ): '''simple docstring''' SCREAMING_SNAKE_CASE__ : Tuple = JukeboxTokenizer SCREAMING_SNAKE_CASE__ ...
262
1
def lowerCAmelCase ( lowerCAmelCase_ )-> bool: if p < 2: raise ValueError('''p should not be less than 2!''' ) elif p == 2: return True lowerCAmelCase_ : Optional[Any] = 4 lowerCAmelCase_ : Union[str, Any] = (1 << p) - 1 fo...
262
from __future__ import annotations import requests def lowerCAmelCase ( lowerCAmelCase_ )-> dict: lowerCAmelCase_ : List[Any] = f"""https://hacker-news.firebaseio.com/v0/item/{story_id}.json?print=pretty""" return requests.get(lowerCAmelCase_ ).json() def lo...
262
1
import os import unicodedata from shutil import copyfile from typing import Any, Dict, List, Optional, Tuple import sentencepiece as spm from ...tokenization_utils import AddedToken, PreTrainedTokenizer from ...utils import SPIECE_UNDERLINE, logging _UpperCAmelCase : Dict =logging.get_logger(__name__) _Up...
262
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, require_torch, ) fro...
262
1
from dataclasses import dataclass, field from typing import Tuple from ..utils import cached_property, is_tf_available, logging, requires_backends from .benchmark_args_utils import BenchmarkArguments if is_tf_available(): import tensorflow as tf _UpperCAmelCase : Optional[int] =logging.get_logger(__...
262
from typing import Union import fire import torch from tqdm import tqdm def lowerCAmelCase ( lowerCAmelCase_ , lowerCAmelCase_ = "cpu" , lowerCAmelCase_ = None )-> None: lowerCAmelCase_ : str = torch.load(lowerCAmelCase_ , map_location=low...
262
1
import qiskit def lowerCAmelCase ( lowerCAmelCase_ , lowerCAmelCase_ )-> qiskit.result.counts.Counts: lowerCAmelCase_ : Tuple = qiskit.Aer.get_backend('''aer_simulator''' ) # Create a Quantum Circuit acting on the q register lowerCAmelCase_ ...
262
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 OptionalDependencyNotAvail...
262
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''' SCREAMING_SNAKE_CASE__ : int SCREAMING_SNAKE_CASE__ : ...
262
from ...configuration_utils import PretrainedConfig from ...utils import logging _UpperCAmelCase : Optional[Any] =logging.get_logger(__name__) _UpperCAmelCase : str ={ """facebook/vit-mae-base""": """https://huggingface.co/facebook/vit-mae-base/resolve/main/config.json""", # See all ViT MAE mo...
262
1
from jiwer import compute_measures import datasets _UpperCAmelCase : Optional[Any] ="""\ @inproceedings{inproceedings, author = {Morris, Andrew and Maier, Viktoria and Green, Phil}, year = {2004}, month = {01}, pages = {}, title = {From WER and RIL to MER and WIL: improved evaluation mea...
262
def lowerCAmelCase ( lowerCAmelCase_ = 10**9 )-> int: lowerCAmelCase_ : List[Any] = 1 lowerCAmelCase_ : Optional[int] = 2 lowerCAmelCase_ : Any = 0 lowerCAmelCase_ : str = 0 lowerCAmelCase_ : str = 0 whi...
262
1
def lowerCAmelCase ( lowerCAmelCase_ )-> int: assert ( isinstance(lowerCAmelCase_ , lowerCAmelCase_ ) and number_of_steps > 0 ), f"""number_of_steps needs to be positive integer, your input {number_of_steps}""" if number_of_steps == 1: return 1 ...
262
import inspect import unittest class snake_case__( unittest.TestCase ): '''simple docstring''' def lowercase_ ( self ) -> int: try: import diffusers # noqa: F401 except ImportError: assert False d...
262
1
from typing import Mapping from ...configuration_utils import PretrainedConfig from ...onnx import OnnxSeqaSeqConfigWithPast from ...utils import logging _UpperCAmelCase : List[str] =logging.get_logger(__name__) _UpperCAmelCase : List[Any] ={ """google/umt5-small""": """https://huggingface.co/goo...
262
import warnings from ...utils import logging from .image_processing_chinese_clip import ChineseCLIPImageProcessor _UpperCAmelCase : Any =logging.get_logger(__name__) class snake_case__( UpperCAmelCase__ ): '''simple docstring''' def __init__( self , *__lowerc...
262
1
def lowerCAmelCase ( lowerCAmelCase_ = 600_851_475_143 )-> int: try: lowerCAmelCase_ : Optional[int] = int(lowerCAmelCase_ ) except (TypeError, ValueError): raise TypeError('''Parameter n must be int or castable to int.''' ) if n <= 0: ...
262
def lowerCAmelCase ( lowerCAmelCase_ )-> set: lowerCAmelCase_ : Optional[int] = set() # edges = list of graph's edges lowerCAmelCase_ : List[str] = get_edges(lowerCAmelCase_ ) # While there are still elements in edges list, take an arbitrary ed...
262
1
_UpperCAmelCase : dict[str, float] ={ "km/h": 1.0, "m/s": 3.6, "mph": 1.60_9344, "knot": 1.852, } _UpperCAmelCase : dict[str, float] ={ "km/h": 1.0, "m/s": 0.2_7777_7778, "mph": 0.6_2137_1192, "knot": 0.5_3995_6803, } def lowerCAmelCase ( lowerCAmelCase_ ...
262
from math import sqrt def lowerCAmelCase ( lowerCAmelCase_ )-> bool: assert isinstance(lowerCAmelCase_ , lowerCAmelCase_ ) and ( number >= 0 ), "'number' must been an int and positive" lowerCAmelCase_ : List[Any] = True # 0 and 1 are ...
262
1
import gc import random import unittest import numpy as np import torch from transformers import XLMRobertaTokenizer from diffusers import ( AltDiffusionImgaImgPipeline, AutoencoderKL, PNDMScheduler, UNetaDConditionModel, ) from diffusers.image_processor import VaeImageProcessor from diffusers.pipe...
262
import json import os import re import shutil import tempfile import unittest from typing import Tuple from transformers import AddedToken, BatchEncoding, PerceiverTokenizer from transformers.utils import cached_property, is_tf_available, is_torch_available from ...test_tokenization_common import TokenizerTesterMi...
262
1
import warnings from collections import OrderedDict from typing import Any, Mapping, Optional from ... import PreTrainedTokenizer from ...configuration_utils import PretrainedConfig from ...onnx import OnnxConfig, OnnxConfigWithPast, OnnxSeqaSeqConfigWithPast from ...onnx.utils import compute_effective_axis_dimensi...
262
import unittest from transformers import MODEL_FOR_ZERO_SHOT_OBJECT_DETECTION_MAPPING, is_vision_available, pipeline from transformers.testing_utils import ( is_pipeline_test, nested_simplify, require_tf, require_torch, require_vision, slow, ) from .test_pipelines_common import ANY if is_...
262
1
import argparse import copy def lowerCAmelCase ( lowerCAmelCase_ )-> Tuple: lowerCAmelCase_ : int = {} with open(lowerCAmelCase_ ) as f: for line in f: if line.split()[0] not in dict_of_neighbours: lowerCAmelCase_ : ...
262
from .glue import glue_convert_examples_to_features, glue_output_modes, glue_processors, glue_tasks_num_labels from .squad import SquadExample, SquadFeatures, SquadVaProcessor, SquadVaProcessor, squad_convert_examples_to_features from .utils import DataProcessor, InputExample, InputFeatures, SingleSentenceClassifica...
262
1
import copy import os from typing import Union from ...configuration_utils import PretrainedConfig from ...utils import logging _UpperCAmelCase : Tuple =logging.get_logger(__name__) _UpperCAmelCase : str ={ """microsoft/git-base""": """https://huggingface.co/microsoft/git-base/resolve/main/config...
262
from __future__ import annotations from typing import Dict from ...configuration_utils import PretrainedConfig _UpperCAmelCase : Dict ={ """susnato/ernie-m-base_pytorch""": """https://huggingface.co/susnato/ernie-m-base_pytorch/blob/main/config.json""", """susnato/ernie-m-large_pytorch""": """https...
262
1
import logging import os import sys from dataclasses import dataclass, field from itertools import chain from typing import Optional, Union import datasets import numpy as np import torch from datasets import load_dataset import transformers from transformers import ( AutoConfig, AutoModelForMultipleChoice...
262
import unittest import numpy as np from transformers.testing_utils import require_torch, require_vision from transformers.utils import is_torch_available, is_vision_available from ...test_image_processing_common import ImageProcessingSavingTestMixin, prepare_image_inputs if is_torch_available(): import to...
262
1
import inspect import unittest class snake_case__( unittest.TestCase ): '''simple docstring''' def lowercase_ ( self ) -> int: try: import diffusers # noqa: F401 except ImportError: assert False d...
262
from __future__ import annotations import math class snake_case__: '''simple docstring''' def __init__( self , __lowercase ) -> None: lowerCAmelCase_ : str = size # approximate the overall size of segment tree with given value ...
262
1
import inspect import unittest from transformers import BitConfig from transformers.testing_utils import require_torch, require_vision, slow, torch_device from transformers.utils import cached_property, is_torch_available, is_vision_available from ...test_backbone_common import BackboneTesterMixin from ...test_con...
262
import argparse import collections import os import re from transformers.utils import direct_transformers_import # All paths are set with the intent you should run this script from the root of the repo with the command # python utils/check_table.py _UpperCAmelCase : Optional[int] ="""src/transformers""" _Up...
262
1
from ...utils import logging from ..ta.modeling_tf_ta import TFTaEncoderModel, TFTaForConditionalGeneration, TFTaModel from .configuration_mta import MTaConfig _UpperCAmelCase : Dict =logging.get_logger(__name__) _UpperCAmelCase : List[Any] ="""T5Config""" class snake_case__( UpperCAmelC...
262
from argparse import ArgumentParser from .add_new_model import AddNewModelCommand from .add_new_model_like import AddNewModelLikeCommand from .convert import ConvertCommand from .download import DownloadCommand from .env import EnvironmentCommand from .lfs import LfsCommands from .pt_to_tf import PTtoTFCommand from...
262
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_mobilebert import MobileBertTokenizer _UpperCAmelCase : Any =logging.get_logger(__name__) _UpperCAmelCase :...
262
import os from shutil import copyfile from typing import List, Optional, Tuple from tokenizers import processors from ...tokenization_utils import AddedToken, BatchEncoding from ...tokenization_utils_fast import PreTrainedTokenizerFast from ...utils import is_sentencepiece_available, logging if is_sentencepiece_...
262
1
import json import os import unittest from transformers.models.biogpt.tokenization_biogpt import VOCAB_FILES_NAMES, BioGptTokenizer from transformers.testing_utils import slow from ...test_tokenization_common import TokenizerTesterMixin class snake_case__( UpperCAmelCase__, unittest.TestCase )...
262
import dataclasses import json import sys import types from argparse import ArgumentDefaultsHelpFormatter, ArgumentParser, ArgumentTypeError from copy import copy from enum import Enum from inspect import isclass from pathlib import Path from typing import Any, Callable, Dict, Iterable, List, Literal, NewType, Optio...
262
1
import warnings from ...processing_utils import ProcessorMixin from ...tokenization_utils_base import BatchEncoding class snake_case__( UpperCAmelCase__ ): '''simple docstring''' SCREAMING_SNAKE_CASE__ : Optional[Any] = ["""image_processor""", """tokenizer...
262
import platform from argparse import ArgumentParser import huggingface_hub from .. import __version__ as version from ..utils import is_accelerate_available, is_torch_available, is_transformers_available, is_xformers_available from . import BaseDiffusersCLICommand def lowerCAmelCase ( lowerCAmelCase...
262
1
import argparse import shutil import time from json import JSONDecodeError from logging import getLogger from pathlib import Path from typing import Dict, List import torch from torch.utils.data import DataLoader from tqdm import tqdm from transformers import AutoModelForSeqaSeqLM, AutoTokenizer from utils import ...
262
import unittest from transformers import JukeboxTokenizer from transformers.testing_utils import require_torch class snake_case__( unittest.TestCase ): '''simple docstring''' SCREAMING_SNAKE_CASE__ : Tuple = JukeboxTokenizer SCREAMING_SNAKE_CASE__ ...
262
1
def lowerCAmelCase ( lowerCAmelCase_ )-> list: # bit count represents no. of bits in the gray code if bit_count < 0: raise ValueError('''The given input must be positive''' ) # get the generated string sequence lowerCAmelCase_ : Tuple = gray_code_s...
262
from __future__ import annotations import requests def lowerCAmelCase ( lowerCAmelCase_ )-> dict: lowerCAmelCase_ : List[Any] = f"""https://hacker-news.firebaseio.com/v0/item/{story_id}.json?print=pretty""" return requests.get(lowerCAmelCase_ ).json() def lo...
262
1
_UpperCAmelCase : int ="""Tobias Carryer""" from time import time class snake_case__: '''simple docstring''' def __init__( self , __lowercase , __lowercase , __lowercase , __lowercase=int(time() ) ) -> str: # noqa: B008 lowerCA...
262
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, require_torch, ) fro...
262
1
import unittest import numpy as np import torch from diffusers import PNDMPipeline, PNDMScheduler, UNetaDModel from diffusers.utils.testing_utils import enable_full_determinism, require_torch, slow, torch_device enable_full_determinism() class snake_case__( unittest.TestCase ): '...
262
from typing import Union import fire import torch from tqdm import tqdm def lowerCAmelCase ( lowerCAmelCase_ , lowerCAmelCase_ = "cpu" , lowerCAmelCase_ = None )-> None: lowerCAmelCase_ : str = torch.load(lowerCAmelCase_ , map_location=low...
262
1
import unittest from transformers import MODEL_FOR_ZERO_SHOT_OBJECT_DETECTION_MAPPING, is_vision_available, pipeline from transformers.testing_utils import ( is_pipeline_test, nested_simplify, require_tf, require_torch, require_vision, slow, ) from .test_pipelines_common import ANY if is_...
262
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 OptionalDependencyNotAvail...
262
1
# flake8: noqa # Lint as: python3 _UpperCAmelCase : Dict =[ """VerificationMode""", """Version""", """disable_progress_bar""", """enable_progress_bar""", """is_progress_bar_enabled""", """experimental""", ] from .info_utils import VerificationMode from .logging import disable_progress_...
262
from ...configuration_utils import PretrainedConfig from ...utils import logging _UpperCAmelCase : Optional[Any] =logging.get_logger(__name__) _UpperCAmelCase : str ={ """facebook/vit-mae-base""": """https://huggingface.co/facebook/vit-mae-base/resolve/main/config.json""", # See all ViT MAE mo...
262
1
import unittest from transformers import AutoTokenizer, NystromformerConfig, 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, ids_tensor, random_attention_mask from...
262
def lowerCAmelCase ( lowerCAmelCase_ = 10**9 )-> int: lowerCAmelCase_ : List[Any] = 1 lowerCAmelCase_ : Optional[int] = 2 lowerCAmelCase_ : Any = 0 lowerCAmelCase_ : str = 0 lowerCAmelCase_ : str = 0 whi...
262
1
import warnings from ...utils import logging from .image_processing_glpn import GLPNImageProcessor _UpperCAmelCase : str =logging.get_logger(__name__) class snake_case__( UpperCAmelCase__ ): '''simple docstring''' def __init__( self , *__lowercase , **_...
262
import inspect import unittest class snake_case__( unittest.TestCase ): '''simple docstring''' def lowercase_ ( self ) -> int: try: import diffusers # noqa: F401 except ImportError: assert False d...
262
1
import re from pathlib import Path from unittest import TestCase import pytest @pytest.mark.integration class snake_case__( UpperCAmelCase__ ): '''simple docstring''' def lowercase_ ( self , __lowercase ) -> List[str]: with open(__lowerc...
262
import warnings from ...utils import logging from .image_processing_chinese_clip import ChineseCLIPImageProcessor _UpperCAmelCase : Any =logging.get_logger(__name__) class snake_case__( UpperCAmelCase__ ): '''simple docstring''' def __init__( self , *__lowerc...
262
1
import argparse import os import re import packaging.version _UpperCAmelCase : List[Any] ="""examples/""" _UpperCAmelCase : Optional[int] ={ """examples""": (re.compile(R"""^check_min_version\(\"[^\"]+\"\)\s*$""", re.MULTILINE), """check_min_version(\"VERSION\")\n"""), """init""": (re.compile(...
262
def lowerCAmelCase ( lowerCAmelCase_ )-> set: lowerCAmelCase_ : Optional[int] = set() # edges = list of graph's edges lowerCAmelCase_ : List[str] = get_edges(lowerCAmelCase_ ) # While there are still elements in edges list, take an arbitrary ed...
262
1
from .integrations import ( is_optuna_available, is_ray_available, is_sigopt_available, is_wandb_available, run_hp_search_optuna, run_hp_search_ray, run_hp_search_sigopt, run_hp_search_wandb, ) from .trainer_utils import ( HPSearchBackend, default_hp_space_optuna, default_...
262
from math import sqrt def lowerCAmelCase ( lowerCAmelCase_ )-> bool: assert isinstance(lowerCAmelCase_ , lowerCAmelCase_ ) and ( number >= 0 ), "'number' must been an int and positive" lowerCAmelCase_ : List[Any] = True # 0 and 1 are ...
262
1
# Copyright 2021 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 required by applic...
262
import json import os import re import shutil import tempfile import unittest from typing import Tuple from transformers import AddedToken, BatchEncoding, PerceiverTokenizer from transformers.utils import cached_property, is_tf_available, is_torch_available from ...test_tokenization_common import TokenizerTesterMi...
262
1
from collections.abc import Iterable from typing import Generic, TypeVar _UpperCAmelCase : int =TypeVar("""_T""") class snake_case__( Generic[_T] ): '''simple docstring''' def __init__( self , __lowercase = None ) -> None: lowerCAmelCase_ ...
262
import unittest from transformers import MODEL_FOR_ZERO_SHOT_OBJECT_DETECTION_MAPPING, is_vision_available, pipeline from transformers.testing_utils import ( is_pipeline_test, nested_simplify, require_tf, require_torch, require_vision, slow, ) from .test_pipelines_common import ANY if is_...
262
1
import argparse import os import re # All paths are set with the intent you should run this script from the root of the repo with the command # python utils/check_dummies.py _UpperCAmelCase : Optional[Any] ="""src/diffusers""" # Matches is_xxx_available() _UpperCAmelCase : Dict =re.compile(R"""is\_([a...
262
from .glue import glue_convert_examples_to_features, glue_output_modes, glue_processors, glue_tasks_num_labels from .squad import SquadExample, SquadFeatures, SquadVaProcessor, SquadVaProcessor, squad_convert_examples_to_features from .utils import DataProcessor, InputExample, InputFeatures, SingleSentenceClassifica...
262
1
from typing import Union import fire import torch from tqdm import tqdm def lowerCAmelCase ( lowerCAmelCase_ , lowerCAmelCase_ = "cpu" , lowerCAmelCase_ = None )-> None: lowerCAmelCase_ : str = torch.load(lowerCAmelCase_ , map_location=low...
262
from __future__ import annotations from typing import Dict from ...configuration_utils import PretrainedConfig _UpperCAmelCase : Dict ={ """susnato/ernie-m-base_pytorch""": """https://huggingface.co/susnato/ernie-m-base_pytorch/blob/main/config.json""", """susnato/ernie-m-large_pytorch""": """https...
262
1
from __future__ import annotations from typing import Dict from ...configuration_utils import PretrainedConfig _UpperCAmelCase : Dict ={ """susnato/ernie-m-base_pytorch""": """https://huggingface.co/susnato/ernie-m-base_pytorch/blob/main/config.json""", """susnato/ernie-m-large_pytorch""": """https...
262
import unittest import numpy as np from transformers.testing_utils import require_torch, require_vision from transformers.utils import is_torch_available, is_vision_available from ...test_image_processing_common import ImageProcessingSavingTestMixin, prepare_image_inputs if is_torch_available(): import to...
262
1
from dataclasses import dataclass from typing import Optional import torch from torch import nn from ..configuration_utils import ConfigMixin, register_to_config from ..utils import BaseOutput from .attention import BasicTransformerBlock from .modeling_utils import ModelMixin @dataclass class snake_case__(...
262
from __future__ import annotations import math class snake_case__: '''simple docstring''' def __init__( self , __lowercase ) -> None: lowerCAmelCase_ : str = size # approximate the overall size of segment tree with given value ...
262
1
import requests def lowerCAmelCase ( lowerCAmelCase_ , lowerCAmelCase_ )-> None: lowerCAmelCase_ : Dict = {'''Content-Type''': '''application/json'''} lowerCAmelCase_ : int = requests.post(lowerCAmelCase_ , json={'''text''': message_b...
262
import argparse import collections import os import re from transformers.utils import direct_transformers_import # All paths are set with the intent you should run this script from the root of the repo with the command # python utils/check_table.py _UpperCAmelCase : Optional[int] ="""src/transformers""" _Up...
262
1
import argparse from pathlib import Path import fairseq import torch from fairseq.models.xmod import XMODModel as FairseqXmodModel from packaging import version from transformers import XmodConfig, XmodForMaskedLM, XmodForSequenceClassification from transformers.utils import logging if version.parse(fairseq.__ve...
262
from argparse import ArgumentParser from .add_new_model import AddNewModelCommand from .add_new_model_like import AddNewModelLikeCommand from .convert import ConvertCommand from .download import DownloadCommand from .env import EnvironmentCommand from .lfs import LfsCommands from .pt_to_tf import PTtoTFCommand from...
262
1
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 _UpperCAmelCase : Any =datasets.logging.get_logger(__name__) _UpperCAmelCase : Any ="""\ @InProceedings{moosavi2019minimum, author ...
262
import os from shutil import copyfile from typing import List, Optional, Tuple from tokenizers import processors from ...tokenization_utils import AddedToken, BatchEncoding from ...tokenization_utils_fast import PreTrainedTokenizerFast from ...utils import is_sentencepiece_available, logging if is_sentencepiece_...
262
1
def lowerCAmelCase ( lowerCAmelCase_ )-> set: lowerCAmelCase_ : Optional[int] = set() # edges = list of graph's edges lowerCAmelCase_ : List[str] = get_edges(lowerCAmelCase_ ) # While there are still elements in edges list, take an arbitrary ed...
262
import dataclasses import json import sys import types from argparse import ArgumentDefaultsHelpFormatter, ArgumentParser, ArgumentTypeError from copy import copy from enum import Enum from inspect import isclass from pathlib import Path from typing import Any, Callable, Dict, Iterable, List, Literal, NewType, Optio...
262
1
from typing import TYPE_CHECKING from ...utils import OptionalDependencyNotAvailable, _LazyModule, is_tokenizers_available, is_torch_available _UpperCAmelCase : List[Any] ={ """configuration_nezha""": ["""NEZHA_PRETRAINED_CONFIG_ARCHIVE_MAP""", """NezhaConfig"""], } try: if not is_torch_available...
262
import platform from argparse import ArgumentParser import huggingface_hub from .. import __version__ as version from ..utils import is_accelerate_available, is_torch_available, is_transformers_available, is_xformers_available from . import BaseDiffusersCLICommand def lowerCAmelCase ( lowerCAmelCase...
262
1
import argparse import collections import json from pathlib import Path import requests import torch import yaml from huggingface_hub import hf_hub_download from PIL import Image from transformers import ( MobileViTImageProcessor, MobileViTVaConfig, MobileViTVaForImageClassification, MobileViTVaFor...
262
import unittest from transformers import JukeboxTokenizer from transformers.testing_utils import require_torch class snake_case__( unittest.TestCase ): '''simple docstring''' SCREAMING_SNAKE_CASE__ : Tuple = JukeboxTokenizer SCREAMING_SNAKE_CASE__ ...
262
1
from math import sqrt def lowerCAmelCase ( lowerCAmelCase_ )-> bool: assert isinstance(lowerCAmelCase_ , lowerCAmelCase_ ) and ( number >= 0 ), "'number' must been an int and positive" lowerCAmelCase_ : List[Any] = True # 0 and 1 are ...
262
from __future__ import annotations import requests def lowerCAmelCase ( lowerCAmelCase_ )-> dict: lowerCAmelCase_ : List[Any] = f"""https://hacker-news.firebaseio.com/v0/item/{story_id}.json?print=pretty""" return requests.get(lowerCAmelCase_ ).json() def lo...
262
1
def lowerCAmelCase ( lowerCAmelCase_ = 4_000_000 )-> int: lowerCAmelCase_ : Tuple = [0, 1] lowerCAmelCase_ : List[Any] = 0 while fib[i] <= n: fib.append(fib[i] + fib[i + 1] ) if fib[i + 2] > n: break i += 1 lo...
262
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, require_torch, ) fro...
262
1
import unittest import numpy as np from transformers import is_flax_available from transformers.testing_utils import require_flax from ..test_modeling_flax_common import ids_tensor if is_flax_available(): import jax import jax.numpy as jnp from transformers.generation import ( FlaxF...
262
from typing import Union import fire import torch from tqdm import tqdm def lowerCAmelCase ( lowerCAmelCase_ , lowerCAmelCase_ = "cpu" , lowerCAmelCase_ = None )-> None: lowerCAmelCase_ : str = torch.load(lowerCAmelCase_ , map_location=low...
262
1
import argparse import logging import pickle from collections import Counter logging.basicConfig( format="""%(asctime)s - %(levelname)s - %(name)s - %(message)s""", datefmt="""%m/%d/%Y %H:%M:%S""", level=logging.INFO ) _UpperCAmelCase : Tuple =logging.getLogger(__name__) if __name__ == "__main__": ...
262
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 OptionalDependencyNotAvail...
262
1
from math import sqrt def lowerCAmelCase ( lowerCAmelCase_ = 1_000_000 )-> int: lowerCAmelCase_ : int = 0 lowerCAmelCase_ : int = 0 lowerCAmelCase_ : int while num_cuboids <= limit: max_cuboid_size += 1 for sum_shortest_s...
262
from ...configuration_utils import PretrainedConfig from ...utils import logging _UpperCAmelCase : Optional[Any] =logging.get_logger(__name__) _UpperCAmelCase : str ={ """facebook/vit-mae-base""": """https://huggingface.co/facebook/vit-mae-base/resolve/main/config.json""", # See all ViT MAE mo...
262
1
import logging import os import sys from dataclasses import dataclass, field from typing import Optional import torch from datasets import load_dataset from torchvision.transforms import Compose, Lambda, Normalize, RandomHorizontalFlip, RandomResizedCrop, ToTensor from torchvision.transforms.functional import Inter...
262
def lowerCAmelCase ( lowerCAmelCase_ = 10**9 )-> int: lowerCAmelCase_ : List[Any] = 1 lowerCAmelCase_ : Optional[int] = 2 lowerCAmelCase_ : Any = 0 lowerCAmelCase_ : str = 0 lowerCAmelCase_ : str = 0 whi...
262
1
import argparse from diffusers.pipelines.stable_diffusion.convert_from_ckpt import download_controlnet_from_original_ckpt if __name__ == "__main__": _UpperCAmelCase : Dict =argparse.ArgumentParser() parser.add_argument( """--checkpoint_path""", default=None, type=str, required=True, h...
262
import inspect import unittest class snake_case__( unittest.TestCase ): '''simple docstring''' def lowercase_ ( self ) -> int: try: import diffusers # noqa: F401 except ImportError: assert False d...
262
1
import json import os import re import shutil import tempfile import unittest from typing import Tuple from transformers import AddedToken, BatchEncoding, PerceiverTokenizer from transformers.utils import cached_property, is_tf_available, is_torch_available from ...test_tokenization_common import TokenizerTesterMi...
262
import warnings from ...utils import logging from .image_processing_chinese_clip import ChineseCLIPImageProcessor _UpperCAmelCase : Any =logging.get_logger(__name__) class snake_case__( UpperCAmelCase__ ): '''simple docstring''' def __init__( self , *__lowerc...
262
1
import argparse import re import numpy as np import requests import torch from huggingface_hub import hf_hub_download from PIL import Image from transformers import ( SamConfig, SamImageProcessor, SamModel, SamProcessor, SamVisionConfig, ) _UpperCAmelCase : Any ={ """iou_prediction_...
262
def lowerCAmelCase ( lowerCAmelCase_ )-> set: lowerCAmelCase_ : Optional[int] = set() # edges = list of graph's edges lowerCAmelCase_ : List[str] = get_edges(lowerCAmelCase_ ) # While there are still elements in edges list, take an arbitrary ed...
262
1
import unittest from knapsack import greedy_knapsack as kp class snake_case__( unittest.TestCase ): '''simple docstring''' def lowercase_ ( self ) -> int: lowerCAmelCase_ : Dict = [1_0, 2_0, 3_0, 4_0, 5_0, 6_0] lowerCAmel...
262
from math import sqrt def lowerCAmelCase ( lowerCAmelCase_ )-> bool: assert isinstance(lowerCAmelCase_ , lowerCAmelCase_ ) and ( number >= 0 ), "'number' must been an int and positive" lowerCAmelCase_ : List[Any] = True # 0 and 1 are ...
262
1
from ...configuration_utils import PretrainedConfig from ...utils import logging _UpperCAmelCase : str =logging.get_logger(__name__) _UpperCAmelCase : List[Any] ={ """sayakpaul/vit-msn-base""": """https://huggingface.co/sayakpaul/vit-msn-base/resolve/main/config.json""", # See all ViT MSN mode...
262
import json import os import re import shutil import tempfile import unittest from typing import Tuple from transformers import AddedToken, BatchEncoding, PerceiverTokenizer from transformers.utils import cached_property, is_tf_available, is_torch_available from ...test_tokenization_common import TokenizerTesterMi...
262
1
import numpy as np from cva import COLOR_BGR2GRAY, CV_8UC3, cvtColor, filteraD, imread, imshow, waitKey def lowerCAmelCase ( lowerCAmelCase_ , lowerCAmelCase_ , lowerCAmelCase_ , lowerCAmelCase_ , lowerCAmelCase_ , lowerCAmelCase_ )-> ...
262
import unittest from transformers import MODEL_FOR_ZERO_SHOT_OBJECT_DETECTION_MAPPING, is_vision_available, pipeline from transformers.testing_utils import ( is_pipeline_test, nested_simplify, require_tf, require_torch, require_vision, slow, ) from .test_pipelines_common import ANY if is_...
262
1
import io import math from typing import Dict, Optional, Union import numpy as np from huggingface_hub import hf_hub_download from ...image_processing_utils import BaseImageProcessor, BatchFeature from ...image_transforms import convert_to_rgb, normalize, to_channel_dimension_format, to_pil_image from ...image_uti...
262
from .glue import glue_convert_examples_to_features, glue_output_modes, glue_processors, glue_tasks_num_labels from .squad import SquadExample, SquadFeatures, SquadVaProcessor, SquadVaProcessor, squad_convert_examples_to_features from .utils import DataProcessor, InputExample, InputFeatures, SingleSentenceClassifica...
262
1
import argparse import json import os import pickle import shutil import numpy as np import torch from distiller import Distiller from lm_seqs_dataset import LmSeqsDataset from transformers import ( BertConfig, BertForMaskedLM, BertTokenizer, DistilBertConfig, DistilBertForMaskedLM, DistilB...
262
from __future__ import annotations from typing import Dict from ...configuration_utils import PretrainedConfig _UpperCAmelCase : Dict ={ """susnato/ernie-m-base_pytorch""": """https://huggingface.co/susnato/ernie-m-base_pytorch/blob/main/config.json""", """susnato/ernie-m-large_pytorch""": """https...
262
1
import os import random import sys from . import cryptomath_module as cryptoMath # noqa: N812 from . import rabin_miller as rabinMiller # noqa: N812 def lowerCAmelCase ( )-> None: print('''Making key files...''' ) make_key_files('''rsa''' , 1_024 ) print('''...
262
import unittest import numpy as np from transformers.testing_utils import require_torch, require_vision from transformers.utils import is_torch_available, is_vision_available from ...test_image_processing_common import ImageProcessingSavingTestMixin, prepare_image_inputs if is_torch_available(): import to...
262
1
def lowerCAmelCase ( lowerCAmelCase_ , lowerCAmelCase_ )-> float: def get_matched_characters(lowerCAmelCase_ , lowerCAmelCase_ ) -> str: lowerCAmelCase_ : Any = [] lowerCAmelCase_ : Union[str, Any] = min(len(_stra ...
262
from __future__ import annotations import math class snake_case__: '''simple docstring''' def __init__( self , __lowercase ) -> None: lowerCAmelCase_ : str = size # approximate the overall size of segment tree with given value ...
262
1
from __future__ import annotations import sys from collections import deque from typing import Generic, TypeVar _UpperCAmelCase : Tuple =TypeVar("""T""") class snake_case__( Generic[T] ): '''simple docstring''' SCREAMING_SNAKE_CASE__ : deque[T] # Cache stor...
262
import argparse import collections import os import re from transformers.utils import direct_transformers_import # All paths are set with the intent you should run this script from the root of the repo with the command # python utils/check_table.py _UpperCAmelCase : Optional[int] ="""src/transformers""" _Up...
262
1
import gc import unittest from transformers import CTRLConfig, is_torch_available from transformers.testing_utils import require_torch, slow, torch_device from ...generation.test_utils import GenerationTesterMixin from ...test_configuration_common import ConfigTester from ...test_modeling_common import ModelTester...
262
from argparse import ArgumentParser from .add_new_model import AddNewModelCommand from .add_new_model_like import AddNewModelLikeCommand from .convert import ConvertCommand from .download import DownloadCommand from .env import EnvironmentCommand from .lfs import LfsCommands from .pt_to_tf import PTtoTFCommand from...
262
1
import os import re import sys import traceback import warnings from pathlib import Path from typing import Dict, Optional, Union from uuid import uuida from huggingface_hub import HfFolder, ModelCard, ModelCardData, hf_hub_download, whoami from huggingface_hub.file_download import REGEX_COMMIT_HASH from huggingfac...
262
import os from shutil import copyfile from typing import List, Optional, Tuple from tokenizers import processors from ...tokenization_utils import AddedToken, BatchEncoding from ...tokenization_utils_fast import PreTrainedTokenizerFast from ...utils import is_sentencepiece_available, logging if is_sentencepiece_...
262
1
import warnings from ...utils import logging from .image_processing_poolformer import PoolFormerImageProcessor _UpperCAmelCase : int =logging.get_logger(__name__) class snake_case__( UpperCAmelCase__ ): '''simple docstring''' def __init__( self , *__lowercase...
262
import dataclasses import json import sys import types from argparse import ArgumentDefaultsHelpFormatter, ArgumentParser, ArgumentTypeError from copy import copy from enum import Enum from inspect import isclass from pathlib import Path from typing import Any, Callable, Dict, Iterable, List, Literal, NewType, Optio...
262
1
from copy import deepcopy class snake_case__: '''simple docstring''' def __init__( self , __lowercase = None , __lowercase = None ) -> None: if arr is None and size is not None: lowerCAmelCase_ : Optional[Any] = size ...
262
import platform from argparse import ArgumentParser import huggingface_hub from .. import __version__ as version from ..utils import is_accelerate_available, is_torch_available, is_transformers_available, is_xformers_available from . import BaseDiffusersCLICommand def lowerCAmelCase ( lowerCAmelCase...
262
1
import unittest from transformers import JukeboxTokenizer from transformers.testing_utils import require_torch class snake_case__( unittest.TestCase ): '''simple docstring''' SCREAMING_SNAKE_CASE__ : Tuple = JukeboxTokenizer SCREAMING_SNAKE_CASE__ ...
262
import unittest from transformers import JukeboxTokenizer from transformers.testing_utils import require_torch class snake_case__( unittest.TestCase ): '''simple docstring''' SCREAMING_SNAKE_CASE__ : Tuple = JukeboxTokenizer SCREAMING_SNAKE_CASE__ ...
262
1
import gc import unittest import torch from parameterized import parameterized from diffusers import AutoencoderKL from diffusers.utils import floats_tensor, load_hf_numpy, require_torch_gpu, slow, torch_all_close, torch_device from diffusers.utils.import_utils import is_xformers_available from diffusers.utils.tes...
262
from __future__ import annotations import requests def lowerCAmelCase ( lowerCAmelCase_ )-> dict: lowerCAmelCase_ : List[Any] = f"""https://hacker-news.firebaseio.com/v0/item/{story_id}.json?print=pretty""" return requests.get(lowerCAmelCase_ ).json() def lo...
262
1
from . import ( albert, align, altclip, audio_spectrogram_transformer, auto, autoformer, bark, bart, barthez, bartpho, beit, bert, bert_generation, bert_japanese, bertweet, big_bird, bigbird_pegasus, biogpt, bit, blenderbot, blenderb...
262
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, require_torch, ) fro...
262
1
import unittest from .lib import ( Matrix, Vector, axpy, square_zero_matrix, unit_basis_vector, zero_vector, ) class snake_case__( unittest.TestCase ): '''simple docstring''' def lowercase_ ( self ) -> None: lowerCAmelCa...
262
from typing import Union import fire import torch from tqdm import tqdm def lowerCAmelCase ( lowerCAmelCase_ , lowerCAmelCase_ = "cpu" , lowerCAmelCase_ = None )-> None: lowerCAmelCase_ : str = torch.load(lowerCAmelCase_ , map_location=low...
262
1
from typing import List, Optional, Tuple, Union import torch from ...utils import logging, randn_tensor from ..pipeline_utils import AudioPipelineOutput, DiffusionPipeline _UpperCAmelCase : Any =logging.get_logger(__name__) # pylint: disable=invalid-name class snake_case__( UpperCAmelCase__ ...
262
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 OptionalDependencyNotAvail...
262
1
import unittest from transformers import MODEL_FOR_DOCUMENT_QUESTION_ANSWERING_MAPPING, AutoTokenizer, is_vision_available from transformers.pipelines import pipeline from transformers.pipelines.document_question_answering import apply_tesseract from transformers.testing_utils import ( is_pipeline_test, nes...
262
from ...configuration_utils import PretrainedConfig from ...utils import logging _UpperCAmelCase : Optional[Any] =logging.get_logger(__name__) _UpperCAmelCase : str ={ """facebook/vit-mae-base""": """https://huggingface.co/facebook/vit-mae-base/resolve/main/config.json""", # See all ViT MAE mo...
262
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__( UpperCAmelCase__ ): ...
262
def lowerCAmelCase ( lowerCAmelCase_ = 10**9 )-> int: lowerCAmelCase_ : List[Any] = 1 lowerCAmelCase_ : Optional[int] = 2 lowerCAmelCase_ : Any = 0 lowerCAmelCase_ : str = 0 lowerCAmelCase_ : str = 0 whi...
262
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_retribert import RetriBertTokenizer _UpperCAmelCase : List[str] =logging.get_logger(__name__) _UpperCAmel...
262
import inspect import unittest class snake_case__( unittest.TestCase ): '''simple docstring''' def lowercase_ ( self ) -> int: try: import diffusers # noqa: F401 except ImportError: assert False d...
262
1
from ..utils import DummyObject, requires_backends class snake_case__( metaclass=UpperCAmelCase__ ): '''simple docstring''' SCREAMING_SNAKE_CASE__ : Optional[Any] = ["""torch""", """torchsde"""] def __init__( self , *__lowercase , **__...
262
import warnings from ...utils import logging from .image_processing_chinese_clip import ChineseCLIPImageProcessor _UpperCAmelCase : Any =logging.get_logger(__name__) class snake_case__( UpperCAmelCase__ ): '''simple docstring''' def __init__( self , *__lowerc...
262
1
import copy import os import cva import numpy as np from matplotlib import pyplot as plt class snake_case__: '''simple docstring''' def __init__( self ) -> Any: lowerCAmelCase_ : List[str] = '''''' lowerCAmelCase_ : Any = ''''''...
262
def lowerCAmelCase ( lowerCAmelCase_ )-> set: lowerCAmelCase_ : Optional[int] = set() # edges = list of graph's edges lowerCAmelCase_ : List[str] = get_edges(lowerCAmelCase_ ) # While there are still elements in edges list, take an arbitrary ed...
262
1
import logging import os from dataclasses import dataclass, field from typing import Dict, Optional import numpy as np from utils_multiple_choice import MultipleChoiceDataset, Split, processors import transformers from transformers import ( AutoConfig, AutoModelForMultipleChoice, AutoTokenizer, Dat...
262
from math import sqrt def lowerCAmelCase ( lowerCAmelCase_ )-> bool: assert isinstance(lowerCAmelCase_ , lowerCAmelCase_ ) and ( number >= 0 ), "'number' must been an int and positive" lowerCAmelCase_ : List[Any] = True # 0 and 1 are ...
262
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 _UpperCA...
262
import json import os import re import shutil import tempfile import unittest from typing import Tuple from transformers import AddedToken, BatchEncoding, PerceiverTokenizer from transformers.utils import cached_property, is_tf_available, is_torch_available from ...test_tokenization_common import TokenizerTesterMi...
262
1
def lowerCAmelCase ( lowerCAmelCase_ )-> list: def merge(lowerCAmelCase_ , lowerCAmelCase_ ) -> list: def _merge(): while left and right: yield (left if left[0] <= right[0] else right).pop(0 ) yield from left ...
262
import unittest from transformers import MODEL_FOR_ZERO_SHOT_OBJECT_DETECTION_MAPPING, is_vision_available, pipeline from transformers.testing_utils import ( is_pipeline_test, nested_simplify, require_tf, require_torch, require_vision, slow, ) from .test_pipelines_common import ANY if is_...
262
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 by a...
262
from .glue import glue_convert_examples_to_features, glue_output_modes, glue_processors, glue_tasks_num_labels from .squad import SquadExample, SquadFeatures, SquadVaProcessor, SquadVaProcessor, squad_convert_examples_to_features from .utils import DataProcessor, InputExample, InputFeatures, SingleSentenceClassifica...
262
1
def lowerCAmelCase ( lowerCAmelCase_ , lowerCAmelCase_ )-> int: lowerCAmelCase_ : Any = 1 # To kept the Calculated Value # Since C(n, k) = C(n, n-k) if k > (n - k): lowerCAmelCase_ : Optional[Any] = n - k # Calculate C(n,k) for...
262
from __future__ import annotations from typing import Dict from ...configuration_utils import PretrainedConfig _UpperCAmelCase : Dict ={ """susnato/ernie-m-base_pytorch""": """https://huggingface.co/susnato/ernie-m-base_pytorch/blob/main/config.json""", """susnato/ernie-m-large_pytorch""": """https...
262
1
from typing import TYPE_CHECKING from ...utils import ( OptionalDependencyNotAvailable, _LazyModule, is_flax_available, is_tf_available, is_torch_available, ) _UpperCAmelCase : Dict ={"""configuration_encoder_decoder""": ["""EncoderDecoderConfig"""]} try: if not is_torch_available...
262
import unittest import numpy as np from transformers.testing_utils import require_torch, require_vision from transformers.utils import is_torch_available, is_vision_available from ...test_image_processing_common import ImageProcessingSavingTestMixin, prepare_image_inputs if is_torch_available(): import to...
262
1
from collections import OrderedDict from typing import Any, Mapping, Optional from ... import PreTrainedTokenizer from ...configuration_utils import PretrainedConfig from ...onnx import OnnxConfig, OnnxConfigWithPast, OnnxSeqaSeqConfigWithPast from ...onnx.utils import compute_effective_axis_dimension from ...utils...
262
from __future__ import annotations import math class snake_case__: '''simple docstring''' def __init__( self , __lowercase ) -> None: lowerCAmelCase_ : str = size # approximate the overall size of segment tree with given value ...
262
1
from transformers import DistilBertTokenizer, DistilBertTokenizerFast from transformers.testing_utils import require_tokenizers, slow from ..bert.test_tokenization_bert import BertTokenizationTest @require_tokenizers class snake_case__( UpperCAmelCase__ ): '''simple docstring''' ...
262
import argparse import collections import os import re from transformers.utils import direct_transformers_import # All paths are set with the intent you should run this script from the root of the repo with the command # python utils/check_table.py _UpperCAmelCase : Optional[int] ="""src/transformers""" _Up...
262
1
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 OptionalDependencyNotAvail...
262
from argparse import ArgumentParser from .add_new_model import AddNewModelCommand from .add_new_model_like import AddNewModelLikeCommand from .convert import ConvertCommand from .download import DownloadCommand from .env import EnvironmentCommand from .lfs import LfsCommands from .pt_to_tf import PTtoTFCommand from...
262
1
import collections import tempfile import unittest import numpy as np from transformers.testing_utils import ( is_pt_flax_cross_test, require_flax, require_torch, require_vision, slow, torch_device, ) from transformers.utils import is_flax_available, is_torch_available, is_vision_available ...
262
import os from shutil import copyfile from typing import List, Optional, Tuple from tokenizers import processors from ...tokenization_utils import AddedToken, BatchEncoding from ...tokenization_utils_fast import PreTrainedTokenizerFast from ...utils import is_sentencepiece_available, logging if is_sentencepiece_...
262
1
from ...configuration_utils import PretrainedConfig from ...utils import logging from ...utils.backbone_utils import BackboneConfigMixin, get_aligned_output_features_output_indices UpperCAmelCase__ = logging.get_logger(__name__) class lowercase_ ( lowercase , lowercase ...
0
import dataclasses import json import sys import types from argparse import ArgumentDefaultsHelpFormatter, ArgumentParser, ArgumentTypeError from copy import copy from enum import Enum from inspect import isclass from pathlib import Path from typing import Any, Callable, Dict, Iterable, List, Literal, NewType, Optio...
262
0