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
"""simple docstring""" import gc import unittest import numpy as np import torch from transformers import CLIPTextConfig, CLIPTextModel, XLMRobertaTokenizer from diffusers import AltDiffusionPipeline, AutoencoderKL, DDIMScheduler, PNDMScheduler, UNetaDConditionModel from diffusers.pipelines.alt_diffusion.modelin...
57
"""simple docstring""" import unittest from transformers import ( MODEL_FOR_SEQ_TO_SEQ_CAUSAL_LM_MAPPING, TF_MODEL_FOR_SEQ_TO_SEQ_CAUSAL_LM_MAPPING, TextaTextGenerationPipeline, pipeline, ) from transformers.testing_utils import is_pipeline_test, require_tf, require_torch from transformers.utils i...
57
1
"""simple docstring""" def _lowerCamelCase ( _UpperCamelCase ): '''simple docstring''' __lowerCAmelCase = 0 while len(_UpperCamelCase ) > 1: __lowerCAmelCase = 0 # Consider two files with minimum cost to be merged for _ in range(2 ): __lowe...
57
"""simple docstring""" import argparse import pytorch_lightning as pl import torch from torch import nn from transformers import LongformerForQuestionAnswering, LongformerModel class _UpperCamelCase ( pl.LightningModule ): '''simple docstring''' def __init__( self , __a ): ...
57
1
"""simple docstring""" import os import re import shutil import sys import tempfile import unittest import black A : Any = os.path.abspath(os.path.dirname(os.path.dirname(os.path.dirname(__file__)))) sys.path.append(os.path.join(git_repo_path, "utils")) import check_copies # noqa: E402 # This ...
57
"""simple docstring""" def _lowerCamelCase ( _UpperCamelCase ): '''simple docstring''' __lowerCAmelCase = False while is_sorted is False: # Until all the indices are traversed keep looping __lowerCAmelCase = True for i in range(0 , len(_UpperCamelCase ) - ...
57
1
"""simple docstring""" from math import sqrt def _lowerCamelCase ( _UpperCamelCase = 100_0000 ): '''simple docstring''' __lowerCAmelCase = 0 __lowerCAmelCase = 0 __lowerCAmelCase = 42 while num_cuboids <= limit: max_cuboid_size += 1 for sum_shorte...
57
"""simple docstring""" import warnings from ...processing_utils import ProcessorMixin from ...tokenization_utils_base import BatchEncoding class _UpperCamelCase ( lowerCAmelCase__ ): '''simple docstring''' __UpperCAmelCase : Union[str, Any] =["""image_processor""", """t...
57
1
"""simple docstring""" from copy import deepcopy from typing import Optional, Union import numpy as np from ...processing_utils import ProcessorMixin from ...tokenization_utils_base import BatchEncoding from ...utils import TensorType, is_tf_available, is_torch_available if is_torch_available(): import torch ...
57
"""simple docstring""" from diffusers.utils.testing_utils import require_onnxruntime @require_onnxruntime class _UpperCamelCase : '''simple docstring''' pass
57
1
"""simple docstring""" from __future__ import annotations import unittest from transformers import BlenderbotSmallConfig, BlenderbotSmallTokenizer, is_tf_available from transformers.testing_utils import require_tf, require_tokenizers, slow from transformers.utils import cached_property from ...test_configuratio...
57
"""simple docstring""" import sys from collections import defaultdict class _UpperCamelCase : '''simple docstring''' def __init__( self ): __lowerCAmelCase = [] def snake_case ( self , __a ): return self.node_position[vertex] d...
57
1
"""simple docstring""" def _lowerCamelCase ( ): '''simple docstring''' __lowerCAmelCase = [] __lowerCAmelCase = 1 while len(_UpperCamelCase ) < 1e6: constant.append(str(_UpperCamelCase ) ) i += 1 __lowerCAmelCase = "".join(_UpperCamelCase...
57
"""simple docstring""" import argparse from collections import OrderedDict from pathlib import Path import torch from transformers import ( VisualBertConfig, VisualBertForMultipleChoice, VisualBertForPreTraining, VisualBertForQuestionAnswering, VisualBertForVisualReasoning, ) from transformer...
57
1
"""simple docstring""" import argparse from pathlib import Path import torch from packaging import version from torch.onnx import export from diffusers import AutoencoderKL A : Tuple = version.parse(version.parse(torch.__version__).base_version) < version.parse("1.11") def _lowerCamelCase ( _U...
57
"""simple docstring""" class _UpperCamelCase ( lowerCAmelCase__ ): '''simple docstring''' pass class _UpperCamelCase ( lowerCAmelCase__ ): '''simple docstring''' pass class _UpperCamelCase : '''simple docstring''' def __init__( self ...
57
1
"""simple docstring""" from __future__ import annotations import unittest from transformers import RoFormerConfig, is_tf_available from transformers.testing_utils import require_tf, slow from ...test_configuration_common import ConfigTester from ...test_modeling_tf_common import TFModelTesterMixin, ids_tensor, ...
57
"""simple docstring""" def _lowerCamelCase ( _UpperCamelCase , _UpperCamelCase ): '''simple docstring''' if not isinstance(_UpperCamelCase , _UpperCamelCase ): raise ValueError("iterations must be defined as integers" ) if not isinstance(_UpperCamelCase , _UpperCamelCas...
57
1
"""simple docstring""" from ... import PretrainedConfig A : List[Any] = { "sijunhe/nezha-cn-base": "https://huggingface.co/sijunhe/nezha-cn-base/resolve/main/config.json", } class _UpperCamelCase ( lowerCAmelCase__ ): '''simple docstring''' __UpperCAmelCase : ...
57
"""simple docstring""" def _lowerCamelCase ( ): '''simple docstring''' __lowerCAmelCase = [] __lowerCAmelCase = 1 while len(_UpperCamelCase ) < 1e6: constant.append(str(_UpperCamelCase ) ) i += 1 __lowerCAmelCase = "".join(_UpperCamelCase...
57
1
"""simple docstring""" import itertools import random import unittest import numpy as np from transformers import ASTFeatureExtractor from transformers.testing_utils import require_torch, require_torchaudio from transformers.utils.import_utils import is_torch_available from ...test_sequence_feature_extraction_c...
57
"""simple docstring""" import numpy as np from cva import COLOR_BGR2GRAY, cvtColor, imread from numpy import array, uinta from PIL import Image from digital_image_processing import change_contrast as cc from digital_image_processing import convert_to_negative as cn from digital_image_processing import sepia as sp...
57
1
"""simple docstring""" import json import sys import tempfile import unittest from pathlib import Path import transformers from transformers import ( CONFIG_MAPPING, IMAGE_PROCESSOR_MAPPING, AutoConfig, AutoImageProcessor, CLIPConfig, CLIPImageProcessor, ) from transformers.testing_utils i...
57
"""simple docstring""" from typing import TYPE_CHECKING from ...utils import OptionalDependencyNotAvailable, _LazyModule, is_tokenizers_available, is_torch_available A : Optional[int] = { "configuration_altclip": [ "ALTCLIP_PRETRAINED_CONFIG_ARCHIVE_MAP", "AltCLIPConfig", ...
57
1
"""simple docstring""" import operator as op def _lowerCamelCase ( _UpperCamelCase ): '''simple docstring''' __lowerCAmelCase = [] __lowerCAmelCase = lambda _UpperCamelCase , _UpperCamelCase : int(x / y ) # noqa: E731 integer division operation __lowerCAmelC...
57
"""simple docstring""" import logging from dataclasses import dataclass, field from typing import Optional from seqaseq_trainer import arg_to_scheduler from transformers import TrainingArguments A : Dict = logging.getLogger(__name__) @dataclass class _UpperCamelCase ( lowerCAmelCase__ ): ...
57
1
"""simple docstring""" import argparse import requests import torch from PIL import Image from torchvision.transforms import Compose, Normalize, Resize, ToTensor from transformers import SwinaSRConfig, SwinaSRForImageSuperResolution, SwinaSRImageProcessor def _lowerCamelCase ( _UpperCamelCase ): '''s...
57
"""simple docstring""" import argparse import os import re import packaging.version A : Any = "examples/" A : Optional[Any] = { "examples": (re.compile(R"^check_min_version\(\"[^\"]+\"\)\s*$", re.MULTILINE), "check_min_version(\"VERSION\")\n"), "init": (re.compile(R"^__versio...
57
1
"""simple docstring""" from ...configuration_utils import PretrainedConfig from ...utils import logging A : Tuple = logging.get_logger(__name__) A : int = { "weiweishi/roc-bert-base-zh": "https://huggingface.co/weiweishi/roc-bert-base-zh/resolve/main/config.json", } class _Uppe...
57
"""simple docstring""" from typing import TYPE_CHECKING from ...utils import ( OptionalDependencyNotAvailable, _LazyModule, is_flax_available, is_tf_available, is_tokenizers_available, is_torch_available, ) A : Tuple = { "configuration_blenderbot": [ "BLENDERBOT...
57
1
"""simple docstring""" import argparse import logging import os import re import tensorflow as tf from transformers import ( AutoConfig, AutoTokenizer, DataCollatorForLanguageModeling, PushToHubCallback, TFAutoModelForMaskedLM, create_optimizer, ) A : Dict = logging.getLog...
57
"""simple docstring""" def _lowerCamelCase ( _UpperCamelCase = 6008_5147_5143 ): '''simple docstring''' try: __lowerCAmelCase = int(_UpperCamelCase ) except (TypeError, ValueError): raise TypeError("Parameter n must be int or castable to int." ) if n <= 0: ...
57
1
"""simple docstring""" import collections import os import re from pathlib import Path A : Optional[int] = "src/transformers" # Matches is_xxx_available() A : Optional[Any] = re.compile(R"is\_([a-z_]*)_available()") # Catches a one-line _import_struct = {xxx} A : int = ...
57
"""simple docstring""" import copy import json import os import tempfile from transformers import is_torch_available from .test_configuration_utils import config_common_kwargs class _UpperCamelCase ( lowerCAmelCase__ ): '''simple docstring''' def __init__( self , __a , __...
57
1
"""simple docstring""" # This code is adapted from OpenAI's release # https://github.com/openai/human-eval/blob/master/human_eval/execution.py import contextlib import faulthandler import io import multiprocessing import os import platform import signal import tempfile def _lowerCamelCase ( _UpperCamelCase ...
57
"""simple docstring""" A : int = { "Pillow": "Pillow", "accelerate": "accelerate>=0.11.0", "compel": "compel==0.1.8", "black": "black~=23.1", "datasets": "datasets", "filelock": "filelock", "flax": "flax>=0.4.1", "hf-doc-builder": "hf-doc-builder>=0.3.0", "huggingf...
57
1
"""simple docstring""" import numpy as np from cva import COLOR_BGR2GRAY, cvtColor, imread from numpy import array, uinta from PIL import Image from digital_image_processing import change_contrast as cc from digital_image_processing import convert_to_negative as cn from digital_image_processing import sepia as sp...
57
"""simple docstring""" import warnings from typing import Dict, List, Optional, Tuple from ...tokenization_utils import AddedToken, PreTrainedTokenizer from ...utils import logging A : str = logging.get_logger(__name__) class _UpperCamelCase ( lowerCAmelCase__ ): '''simple docstring''...
57
1
"""simple docstring""" def _lowerCamelCase ( _UpperCamelCase ): '''simple docstring''' if n == 1 or not isinstance(_UpperCamelCase , _UpperCamelCase ): return 0 elif n == 2: return 1 else: __lowerCAmelCase = [0, 1] for i in range(2 , n + 1 ): ...
57
"""simple docstring""" import numpy # List of input, output pairs A : Any = ( ((5, 2, 3), 1_5), ((6, 5, 9), 2_5), ((1_1, 1_2, 1_3), 4_1), ((1, 1, 1), 8), ((1_1, 1_2, 1_3), 4_1), ) A : str = (((5_1_5, 2_2, 1_3), 5_5_5), ((6_1, 3_5, 4_9), 1_5_0)) A : Union[str, ...
57
1
"""simple docstring""" def _lowerCamelCase ( _UpperCamelCase ): '''simple docstring''' __lowerCAmelCase = False while is_sorted is False: # Until all the indices are traversed keep looping __lowerCAmelCase = True for i in range(0 , len(_UpperCamelCase ) - ...
57
"""simple docstring""" import json import os import shutil import tempfile import unittest import numpy as np import pytest from transformers import BertTokenizer, BertTokenizerFast from transformers.models.bert.tokenization_bert import VOCAB_FILES_NAMES from transformers.testing_utils import require_vision from...
57
1
"""simple docstring""" import unittest from transformers import is_torch_available, is_vision_available from transformers.testing_utils import require_torch, require_vision, slow, torch_device if is_torch_available(): import torch from transformers import AutoModelForImageClassification if is_vision_availab...
57
"""simple docstring""" from __future__ import annotations def _lowerCamelCase ( _UpperCamelCase = 4 ): '''simple docstring''' __lowerCAmelCase = abs(_UpperCamelCase ) or 4 return [[1 + x + y * row_size for x in range(_UpperCamelCase )] for y in range(_UpperCamelCase )]...
57
1
"""simple docstring""" import argparse import pytorch_lightning as pl import torch from torch import nn from transformers import LongformerForQuestionAnswering, LongformerModel class _UpperCamelCase ( pl.LightningModule ): '''simple docstring''' def __init__( self , __a ): ...
57
"""simple docstring""" import unittest from transformers import ( MODEL_FOR_SEQ_TO_SEQ_CAUSAL_LM_MAPPING, TF_MODEL_FOR_SEQ_TO_SEQ_CAUSAL_LM_MAPPING, TextaTextGenerationPipeline, pipeline, ) from transformers.testing_utils import is_pipeline_test, require_tf, require_torch from transformers.utils i...
57
1
"""simple docstring""" import sys from collections import defaultdict class _UpperCamelCase : '''simple docstring''' def __init__( self ): __lowerCAmelCase = [] def snake_case ( self , __a ): return self.node_position[vertex] d...
57
"""simple docstring""" import argparse import pytorch_lightning as pl import torch from torch import nn from transformers import LongformerForQuestionAnswering, LongformerModel class _UpperCamelCase ( pl.LightningModule ): '''simple docstring''' def __init__( self , __a ): ...
57
1
"""simple docstring""" # NOTE: This file is deprecated and will be removed in a future version. # It only exists so that temporarely `from diffusers.pipelines import DiffusionPipeline` works from ...utils import deprecate from ..controlnet.pipeline_flax_controlnet import FlaxStableDiffusionControlNetPipeline # n...
57
"""simple docstring""" def _lowerCamelCase ( _UpperCamelCase ): '''simple docstring''' __lowerCAmelCase = False while is_sorted is False: # Until all the indices are traversed keep looping __lowerCAmelCase = True for i in range(0 , len(_UpperCamelCase ) - ...
57
1
"""simple docstring""" import torch from diffusers import DDPMParallelScheduler from .test_schedulers import SchedulerCommonTest class _UpperCamelCase ( lowerCAmelCase__ ): '''simple docstring''' __UpperCAmelCase : Any =(DDPMParallelScheduler,) def snake_cas...
57
"""simple docstring""" import warnings from ...processing_utils import ProcessorMixin from ...tokenization_utils_base import BatchEncoding class _UpperCamelCase ( lowerCAmelCase__ ): '''simple docstring''' __UpperCAmelCase : Union[str, Any] =["""image_processor""", """t...
57
1
"""simple docstring""" import numpy as np from PIL import Image def _lowerCamelCase ( _UpperCamelCase , _UpperCamelCase , _UpperCamelCase ): '''simple docstring''' __lowerCAmelCase = np.array(_UpperCamelCase ) if arr.shape[0] != arr.shape[1]: raise ValueError("The in...
57
"""simple docstring""" from diffusers.utils.testing_utils import require_onnxruntime @require_onnxruntime class _UpperCamelCase : '''simple docstring''' pass
57
1
"""simple docstring""" from typing import Dict, List, Optional, Union import numpy as np from transformers.utils import is_vision_available from transformers.utils.generic import TensorType from ...image_processing_utils import BaseImageProcessor, BatchFeature, get_size_dict from ...image_transforms import ( ...
57
"""simple docstring""" import sys from collections import defaultdict class _UpperCamelCase : '''simple docstring''' def __init__( self ): __lowerCAmelCase = [] def snake_case ( self , __a ): return self.node_position[vertex] d...
57
1
"""simple docstring""" import os import sys import warnings from dataclasses import dataclass, field from io import BytesIO from typing import TYPE_CHECKING, Any, ClassVar, Dict, List, Optional, Union import numpy as np import pyarrow as pa from .. import config from ..download.streaming_download_manager import ...
57
"""simple docstring""" import argparse from collections import OrderedDict from pathlib import Path import torch from transformers import ( VisualBertConfig, VisualBertForMultipleChoice, VisualBertForPreTraining, VisualBertForQuestionAnswering, VisualBertForVisualReasoning, ) from transformer...
57
1
"""simple docstring""" from collections import OrderedDict from typing import Mapping from ...configuration_utils import PretrainedConfig from ...onnx import OnnxConfig from ...utils import logging A : str = logging.get_logger(__name__) A : List[Any] = { "distilbert-base-uncased...
57
"""simple docstring""" class _UpperCamelCase ( lowerCAmelCase__ ): '''simple docstring''' pass class _UpperCamelCase ( lowerCAmelCase__ ): '''simple docstring''' pass class _UpperCamelCase : '''simple docstring''' def __init__( self ...
57
1
"""simple docstring""" import warnings from ...configuration_utils import PretrainedConfig from ...utils import logging A : Optional[int] = logging.get_logger(__name__) A : Optional[Any] = { "xlnet-base-cased": "https://huggingface.co/xlnet-base-cased/resolve/main/config.json", ...
57
"""simple docstring""" def _lowerCamelCase ( _UpperCamelCase , _UpperCamelCase ): '''simple docstring''' if not isinstance(_UpperCamelCase , _UpperCamelCase ): raise ValueError("iterations must be defined as integers" ) if not isinstance(_UpperCamelCase , _UpperCamelCas...
57
1
"""simple docstring""" import math import flax.linen as nn import jax.numpy as jnp def _lowerCamelCase ( _UpperCamelCase , _UpperCamelCase , _UpperCamelCase = 1 , _UpperCamelCase = 1 , _UpperCamelCase = 1.0e4 , _UpperCamelCase = False , _UpperCamelCase = 1.0 , ): '''simple docstring'''...
57
"""simple docstring""" def _lowerCamelCase ( ): '''simple docstring''' __lowerCAmelCase = [] __lowerCAmelCase = 1 while len(_UpperCamelCase ) < 1e6: constant.append(str(_UpperCamelCase ) ) i += 1 __lowerCAmelCase = "".join(_UpperCamelCase...
57
1
"""simple docstring""" import json from typing import TYPE_CHECKING, List, Optional, Tuple from tokenizers import pre_tokenizers, processors from ...tokenization_utils_base import AddedToken, BatchEncoding from ...tokenization_utils_fast import PreTrainedTokenizerFast from ...utils import logging from .tokenizat...
57
"""simple docstring""" import numpy as np from cva import COLOR_BGR2GRAY, cvtColor, imread from numpy import array, uinta from PIL import Image from digital_image_processing import change_contrast as cc from digital_image_processing import convert_to_negative as cn from digital_image_processing import sepia as sp...
57
1
"""simple docstring""" from typing import TYPE_CHECKING from ...utils import OptionalDependencyNotAvailable, _LazyModule, is_sentencepiece_available A : Dict = {} try: if not is_sentencepiece_available(): raise OptionalDependencyNotAvailable() except OptionalDependencyNotAvailable: pass else:...
57
"""simple docstring""" from typing import TYPE_CHECKING from ...utils import OptionalDependencyNotAvailable, _LazyModule, is_tokenizers_available, is_torch_available A : Optional[int] = { "configuration_altclip": [ "ALTCLIP_PRETRAINED_CONFIG_ARCHIVE_MAP", "AltCLIPConfig", ...
57
1
"""simple docstring""" from sklearn.metrics import fa_score import datasets A : Optional[int] = "\nThe F1 score is the harmonic mean of the precision and recall. It can be computed with the equation:\nF1 = 2 * (precision * recall) / (precision + recall)\n" A : int = "\nArgs:\n p...
57
"""simple docstring""" import logging from dataclasses import dataclass, field from typing import Optional from seqaseq_trainer import arg_to_scheduler from transformers import TrainingArguments A : Dict = logging.getLogger(__name__) @dataclass class _UpperCamelCase ( lowerCAmelCase__ ): ...
57
1
"""simple docstring""" import numpy as np from matplotlib import pyplot as plt from sklearn.datasets import load_iris from sklearn.metrics import ConfusionMatrixDisplay from sklearn.model_selection import train_test_split from xgboost import XGBClassifier def _lowerCamelCase ( _UpperCamelCase ): '''sim...
57
"""simple docstring""" import argparse import os import re import packaging.version A : Any = "examples/" A : Optional[Any] = { "examples": (re.compile(R"^check_min_version\(\"[^\"]+\"\)\s*$", re.MULTILINE), "check_min_version(\"VERSION\")\n"), "init": (re.compile(R"^__versio...
57
1
"""simple docstring""" import argparse import json from pathlib import Path import requests import torch from huggingface_hub import cached_download, hf_hub_url from PIL import Image from transformers import DPTConfig, DPTForDepthEstimation, DPTForSemanticSegmentation, DPTImageProcessor from transformers.utils i...
57
"""simple docstring""" from typing import TYPE_CHECKING from ...utils import ( OptionalDependencyNotAvailable, _LazyModule, is_flax_available, is_tf_available, is_tokenizers_available, is_torch_available, ) A : Tuple = { "configuration_blenderbot": [ "BLENDERBOT...
57
1
"""simple docstring""" from diffusers.utils.testing_utils import require_onnxruntime @require_onnxruntime class _UpperCamelCase : '''simple docstring''' pass
57
"""simple docstring""" def _lowerCamelCase ( _UpperCamelCase = 6008_5147_5143 ): '''simple docstring''' try: __lowerCAmelCase = int(_UpperCamelCase ) except (TypeError, ValueError): raise TypeError("Parameter n must be int or castable to int." ) if n <= 0: ...
57
1
"""simple docstring""" from typing import Optional from torch import nn from .transformer_ad import TransformeraDModel, TransformeraDModelOutput class _UpperCamelCase ( nn.Module ): '''simple docstring''' def __init__( self , __a = 16 , __a = 88 , __a = None , _...
57
"""simple docstring""" import copy import json import os import tempfile from transformers import is_torch_available from .test_configuration_utils import config_common_kwargs class _UpperCamelCase ( lowerCAmelCase__ ): '''simple docstring''' def __init__( self , __a , __...
57
1
"""simple docstring""" from __future__ import annotations import math A : Any = "2020.9.26" A : List[str] = "xcodz-dot, cclaus, dhruvmanila" def _lowerCamelCase ( _UpperCamelCase , _UpperCamelCase , _UpperCamelCase , _UpperCamelCase , _UpperCamelCase ): '''simp...
57
"""simple docstring""" A : int = { "Pillow": "Pillow", "accelerate": "accelerate>=0.11.0", "compel": "compel==0.1.8", "black": "black~=23.1", "datasets": "datasets", "filelock": "filelock", "flax": "flax>=0.4.1", "hf-doc-builder": "hf-doc-builder>=0.3.0", "huggingf...
57
1
"""simple docstring""" def _lowerCamelCase ( _UpperCamelCase ): '''simple docstring''' return "".join(chr(ord(_UpperCamelCase ) - 32 ) if "a" <= char <= "z" else char for char in word ) if __name__ == "__main__": from doctest import testmod testmod()
57
"""simple docstring""" import warnings from typing import Dict, List, Optional, Tuple from ...tokenization_utils import AddedToken, PreTrainedTokenizer from ...utils import logging A : str = logging.get_logger(__name__) class _UpperCamelCase ( lowerCAmelCase__ ): '''simple docstring''...
57
1
"""simple docstring""" def _lowerCamelCase ( _UpperCamelCase ): '''simple docstring''' assert ( isinstance(_UpperCamelCase , _UpperCamelCase ) and number_of_steps > 0 ), f"number_of_steps needs to be positive integer, your input {number_of_steps}" if number_of_steps == 1: ...
57
"""simple docstring""" import numpy # List of input, output pairs A : Any = ( ((5, 2, 3), 1_5), ((6, 5, 9), 2_5), ((1_1, 1_2, 1_3), 4_1), ((1, 1, 1), 8), ((1_1, 1_2, 1_3), 4_1), ) A : str = (((5_1_5, 2_2, 1_3), 5_5_5), ((6_1, 3_5, 4_9), 1_5_0)) A : Union[str, ...
57
1
"""simple docstring""" import argparse import os import re import packaging.version A : Any = "examples/" A : Optional[Any] = { "examples": (re.compile(R"^check_min_version\(\"[^\"]+\"\)\s*$", re.MULTILINE), "check_min_version(\"VERSION\")\n"), "init": (re.compile(R"^__versio...
57
"""simple docstring""" import json import os import shutil import tempfile import unittest import numpy as np import pytest from transformers import BertTokenizer, BertTokenizerFast from transformers.models.bert.tokenization_bert import VOCAB_FILES_NAMES from transformers.testing_utils import require_vision from...
57
1
"""simple docstring""" import warnings from ...processing_utils import ProcessorMixin from ...tokenization_utils_base import BatchEncoding class _UpperCamelCase ( lowerCAmelCase__ ): '''simple docstring''' __UpperCAmelCase : Union[str, Any] =["""image_processor""", """t...
57
"""simple docstring""" from __future__ import annotations def _lowerCamelCase ( _UpperCamelCase = 4 ): '''simple docstring''' __lowerCAmelCase = abs(_UpperCamelCase ) or 4 return [[1 + x + y * row_size for x in range(_UpperCamelCase )] for y in range(_UpperCamelCase )]...
57
1
"""simple docstring""" import numpy as np import torch import torch.nn as nn from transformers import CLIPConfig, CLIPVisionModelWithProjection, PreTrainedModel from ...utils import logging A : str = logging.get_logger(__name__) class _UpperCamelCase ( lowerCAmelCase__ ): '''simple do...
57
"""simple docstring""" import unittest from transformers import ( MODEL_FOR_SEQ_TO_SEQ_CAUSAL_LM_MAPPING, TF_MODEL_FOR_SEQ_TO_SEQ_CAUSAL_LM_MAPPING, TextaTextGenerationPipeline, pipeline, ) from transformers.testing_utils import is_pipeline_test, require_tf, require_torch from transformers.utils i...
57
1
"""simple docstring""" import json import os import unittest from typing import Tuple from transformers import WavaVecaPhonemeCTCTokenizer from transformers.models.wavaveca.tokenization_wavaveca import VOCAB_FILES_NAMES from transformers.models.wavaveca_phoneme.tokenization_wavaveca_phoneme import WavaVecaPhoneme...
57
"""simple docstring""" import argparse import pytorch_lightning as pl import torch from torch import nn from transformers import LongformerForQuestionAnswering, LongformerModel class _UpperCamelCase ( pl.LightningModule ): '''simple docstring''' def __init__( self , __a ): ...
57
1
"""simple docstring""" from typing import TYPE_CHECKING from ...utils import ( OptionalDependencyNotAvailable, _LazyModule, is_flax_available, is_tf_available, is_tokenizers_available, is_torch_available, ) A : Optional[int] = { "configuration_blenderbot_small": [ ...
57
"""simple docstring""" def _lowerCamelCase ( _UpperCamelCase ): '''simple docstring''' __lowerCAmelCase = False while is_sorted is False: # Until all the indices are traversed keep looping __lowerCAmelCase = True for i in range(0 , len(_UpperCamelCase ) - ...
57
1
"""simple docstring""" # Lint as: python3 import itertools import os import re A : Dict = re.compile(R"([A-Z]+)([A-Z][a-z])") A : Union[str, Any] = re.compile(R"([a-z\d])([A-Z])") A : Any = re.compile(R"(?<!_)_(?!_)") A : List[Any] = re.compile(R"(_{2,})")...
57
"""simple docstring""" import warnings from ...processing_utils import ProcessorMixin from ...tokenization_utils_base import BatchEncoding class _UpperCamelCase ( lowerCAmelCase__ ): '''simple docstring''' __UpperCAmelCase : Union[str, Any] =["""image_processor""", """t...
57
1
"""simple docstring""" from manim import * class _UpperCamelCase ( lowerCAmelCase__ ): '''simple docstring''' def snake_case ( self ): __lowerCAmelCase = Rectangle(height=0.5 , width=0.5 ) __lowerCAmelCase = Rectangle(height=0.4_6 ,...
57
"""simple docstring""" from diffusers.utils.testing_utils import require_onnxruntime @require_onnxruntime class _UpperCamelCase : '''simple docstring''' pass
57
1
"""simple docstring""" from typing import TYPE_CHECKING from ...utils import ( OptionalDependencyNotAvailable, _LazyModule, is_flax_available, is_tf_available, is_tokenizers_available, is_torch_available, ) A : Tuple = { "configuration_blenderbot": [ "BLENDERBOT...
57
"""simple docstring""" import sys from collections import defaultdict class _UpperCamelCase : '''simple docstring''' def __init__( self ): __lowerCAmelCase = [] def snake_case ( self , __a ): return self.node_position[vertex] d...
57
1
"""simple docstring""" import copy import json import os import tempfile from transformers import is_torch_available from .test_configuration_utils import config_common_kwargs class _UpperCamelCase ( lowerCAmelCase__ ): '''simple docstring''' def __init__( self , __a , __...
57
"""simple docstring""" import argparse from collections import OrderedDict from pathlib import Path import torch from transformers import ( VisualBertConfig, VisualBertForMultipleChoice, VisualBertForPreTraining, VisualBertForQuestionAnswering, VisualBertForVisualReasoning, ) from transformer...
57
1
"""simple docstring""" import argparse from transformers import CLIPImageProcessor, CLIPVisionModelWithProjection from diffusers import UnCLIPImageVariationPipeline, UnCLIPPipeline if __name__ == "__main__": A : Optional[int] = argparse.ArgumentParser() parser.add_argument("--dump_path", defau...
57
"""simple docstring""" class _UpperCamelCase ( lowerCAmelCase__ ): '''simple docstring''' pass class _UpperCamelCase ( lowerCAmelCase__ ): '''simple docstring''' pass class _UpperCamelCase : '''simple docstring''' def __init__( self ...
57
1
"""simple docstring""" import numpy as np import datasets A : List[Any] = "\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...
57
"""simple docstring""" def _lowerCamelCase ( _UpperCamelCase , _UpperCamelCase ): '''simple docstring''' if not isinstance(_UpperCamelCase , _UpperCamelCase ): raise ValueError("iterations must be defined as integers" ) if not isinstance(_UpperCamelCase , _UpperCamelCas...
57
1
"""simple docstring""" from typing import TYPE_CHECKING from ...utils import ( OptionalDependencyNotAvailable, _LazyModule, is_sentencepiece_available, is_speech_available, is_tf_available, is_torch_available, ) A : Dict = { "configuration_speech_to_text": ["SPEECH_TO_T...
57
"""simple docstring""" def _lowerCamelCase ( ): '''simple docstring''' __lowerCAmelCase = [] __lowerCAmelCase = 1 while len(_UpperCamelCase ) < 1e6: constant.append(str(_UpperCamelCase ) ) i += 1 __lowerCAmelCase = "".join(_UpperCamelCase...
57
1
"""simple docstring""" import argparse import json from collections import OrderedDict from pathlib import Path import requests import torch from huggingface_hub import hf_hub_download from PIL import Image from transformers import PoolFormerConfig, PoolFormerForImageClassification, PoolFormerImageProcessor from...
57
"""simple docstring""" import numpy as np from cva import COLOR_BGR2GRAY, cvtColor, imread from numpy import array, uinta from PIL import Image from digital_image_processing import change_contrast as cc from digital_image_processing import convert_to_negative as cn from digital_image_processing import sepia as sp...
57
1
"""simple docstring""" import json import os from pathlib import Path import pytest from datasets.download.download_config import DownloadConfig from datasets.download.download_manager import DownloadManager from datasets.utils.file_utils import hash_url_to_filename A : Optional[Any] = "http://ww...
57
"""simple docstring""" from typing import TYPE_CHECKING from ...utils import OptionalDependencyNotAvailable, _LazyModule, is_tokenizers_available, is_torch_available A : Optional[int] = { "configuration_altclip": [ "ALTCLIP_PRETRAINED_CONFIG_ARCHIVE_MAP", "AltCLIPConfig", ...
57
1
"""simple docstring""" import argparse import os import torch from diffusers import ( CMStochasticIterativeScheduler, ConsistencyModelPipeline, UNetaDModel, ) A : List[str] = { "sample_size": 3_2, "in_channels": 3, "out_channels": 3, "layers_per_block": 2, "num_cla...
57
"""simple docstring""" import logging from dataclasses import dataclass, field from typing import Optional from seqaseq_trainer import arg_to_scheduler from transformers import TrainingArguments A : Dict = logging.getLogger(__name__) @dataclass class _UpperCamelCase ( lowerCAmelCase__ ): ...
57
1
"""simple docstring""" from __future__ import annotations def _lowerCamelCase ( _UpperCamelCase ): '''simple docstring''' __lowerCAmelCase = 0.00 __lowerCAmelCase = 0 for resistor in resistors: if resistor <= 0: __lowerCAmelCase = f"Resistor at ind...
57
"""simple docstring""" import argparse import os import re import packaging.version A : Any = "examples/" A : Optional[Any] = { "examples": (re.compile(R"^check_min_version\(\"[^\"]+\"\)\s*$", re.MULTILINE), "check_min_version(\"VERSION\")\n"), "init": (re.compile(R"^__versio...
57
1
"""simple docstring""" import unittest import numpy as np from transformers import DistilBertConfig, is_flax_available from transformers.testing_utils import require_flax, slow from ...test_modeling_flax_common import FlaxModelTesterMixin, ids_tensor, random_attention_mask if is_flax_available(): import jax....
57
"""simple docstring""" from typing import TYPE_CHECKING from ...utils import ( OptionalDependencyNotAvailable, _LazyModule, is_flax_available, is_tf_available, is_tokenizers_available, is_torch_available, ) A : Tuple = { "configuration_blenderbot": [ "BLENDERBOT...
57
1
"""simple docstring""" import json import os import shutil import sys import tempfile import unittest import unittest.mock as mock from pathlib import Path from huggingface_hub import HfFolder, delete_repo from requests.exceptions import HTTPError from transformers import AutoConfig, BertConfig, GPTaConfig from ...
57
"""simple docstring""" def _lowerCamelCase ( _UpperCamelCase = 6008_5147_5143 ): '''simple docstring''' try: __lowerCAmelCase = int(_UpperCamelCase ) except (TypeError, ValueError): raise TypeError("Parameter n must be int or castable to int." ) if n <= 0: ...
57
1
"""simple docstring""" import logging from dataclasses import dataclass, field from typing import Optional from seqaseq_trainer import arg_to_scheduler from transformers import TrainingArguments A : Dict = logging.getLogger(__name__) @dataclass class _UpperCamelCase ( lowerCAmelCase__ ): ...
57
"""simple docstring""" import copy import json import os import tempfile from transformers import is_torch_available from .test_configuration_utils import config_common_kwargs class _UpperCamelCase ( lowerCAmelCase__ ): '''simple docstring''' def __init__( self , __a , __...
57
1
"""simple docstring""" # 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...
57
"""simple docstring""" A : int = { "Pillow": "Pillow", "accelerate": "accelerate>=0.11.0", "compel": "compel==0.1.8", "black": "black~=23.1", "datasets": "datasets", "filelock": "filelock", "flax": "flax>=0.4.1", "hf-doc-builder": "hf-doc-builder>=0.3.0", "huggingf...
57
1
"""simple docstring""" 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 ....
57
"""simple docstring""" import warnings from typing import Dict, List, Optional, Tuple from ...tokenization_utils import AddedToken, PreTrainedTokenizer from ...utils import logging A : str = logging.get_logger(__name__) class _UpperCamelCase ( lowerCAmelCase__ ): '''simple docstring''...
57
1
"""simple docstring""" def _lowerCamelCase ( _UpperCamelCase , _UpperCamelCase , _UpperCamelCase , _UpperCamelCase , _UpperCamelCase , ): '''simple docstring''' __lowerCAmelCase = [redshift, radiation_density, matter_density, dark_energy] if any(p < 0 for p in parameters ...
57
"""simple docstring""" import numpy # List of input, output pairs A : Any = ( ((5, 2, 3), 1_5), ((6, 5, 9), 2_5), ((1_1, 1_2, 1_3), 4_1), ((1, 1, 1), 8), ((1_1, 1_2, 1_3), 4_1), ) A : str = (((5_1_5, 2_2, 1_3), 5_5_5), ((6_1, 3_5, 4_9), 1_5_0)) A : Union[str, ...
57
1
"""simple docstring""" from typing import List, Union import numpy as np from ..utils import add_end_docstrings, is_torch_available, is_vision_available, logging, requires_backends from .base import PIPELINE_INIT_ARGS, Pipeline if is_vision_available(): from PIL import Image from ..image_utils import load_i...
57
"""simple docstring""" import json import os import shutil import tempfile import unittest import numpy as np import pytest from transformers import BertTokenizer, BertTokenizerFast from transformers.models.bert.tokenization_bert import VOCAB_FILES_NAMES from transformers.testing_utils import require_vision from...
57
1
"""simple docstring""" import warnings from ...processing_utils import ProcessorMixin from ...tokenization_utils_base import BatchEncoding class _UpperCamelCase ( lowerCAmelCase__ ): '''simple docstring''' __UpperCAmelCase : List[str] =["""image_processor""", """tokeniz...
57
"""simple docstring""" from __future__ import annotations def _lowerCamelCase ( _UpperCamelCase = 4 ): '''simple docstring''' __lowerCAmelCase = abs(_UpperCamelCase ) or 4 return [[1 + x + y * row_size for x in range(_UpperCamelCase )] for y in range(_UpperCamelCase )]...
57
1
"""simple docstring""" import argparse import glob import logging import os import time from argparse import Namespace import numpy as np import torch from lightning_base import BaseTransformer, add_generic_args, generic_train from torch.utils.data import DataLoader, TensorDataset from transformers import glue_c...
57
"""simple docstring""" import unittest from transformers import ( MODEL_FOR_SEQ_TO_SEQ_CAUSAL_LM_MAPPING, TF_MODEL_FOR_SEQ_TO_SEQ_CAUSAL_LM_MAPPING, TextaTextGenerationPipeline, pipeline, ) from transformers.testing_utils import is_pipeline_test, require_tf, require_torch from transformers.utils i...
57
1
"""simple docstring""" 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 OptionalDependencyNotAva...
57
"""simple docstring""" import argparse import pytorch_lightning as pl import torch from torch import nn from transformers import LongformerForQuestionAnswering, LongformerModel class _UpperCamelCase ( pl.LightningModule ): '''simple docstring''' def __init__( self , __a ): ...
57
1
"""simple docstring""" from __future__ import annotations import time import numpy as np A : Union[str, Any] = [8, 5, 9, 7] A : Dict = [ [2, 0, 1, 1], [0, 1, 2, 1], [4, 0, 0, 3], [0, 2, 1, 0], [1, 0, 3, 0], ] A : Optional[Any] = [ [3, 2, 1, 4], ...
57
"""simple docstring""" def _lowerCamelCase ( _UpperCamelCase ): '''simple docstring''' __lowerCAmelCase = False while is_sorted is False: # Until all the indices are traversed keep looping __lowerCAmelCase = True for i in range(0 , len(_UpperCamelCase ) - ...
57
1
"""simple docstring""" class _UpperCamelCase ( lowerCAmelCase__ ): '''simple docstring''' pass class _UpperCamelCase ( lowerCAmelCase__ ): '''simple docstring''' pass class _UpperCamelCase : '''simple docstring''' def __init__( self ...
57
"""simple docstring""" import warnings from ...processing_utils import ProcessorMixin from ...tokenization_utils_base import BatchEncoding class _UpperCamelCase ( lowerCAmelCase__ ): '''simple docstring''' __UpperCAmelCase : Union[str, Any] =["""image_processor""", """t...
57
1
"""simple docstring""" import warnings from typing import Dict, List, Optional, Tuple from ...tokenization_utils import AddedToken, PreTrainedTokenizer from ...utils import logging A : str = logging.get_logger(__name__) class _UpperCamelCase ( lowerCAmelCase__ ): '''simple docstring''...
57
"""simple docstring""" from diffusers.utils.testing_utils import require_onnxruntime @require_onnxruntime class _UpperCamelCase : '''simple docstring''' pass
57
1
"""simple docstring""" 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...
57
"""simple docstring""" import sys from collections import defaultdict class _UpperCamelCase : '''simple docstring''' def __init__( self ): __lowerCAmelCase = [] def snake_case ( self , __a ): return self.node_position[vertex] d...
57
1
"""simple docstring""" from __future__ import annotations import copy import tempfile import unittest from transformers import CONFIG_MAPPING, AutoConfig, BertConfig, GPTaConfig, TaConfig, TapasConfig, is_tf_available from transformers.testing_utils import ( DUMMY_UNKNOWN_IDENTIFIER, SMALL_MODEL_IDENTIFI...
57
"""simple docstring""" import argparse from collections import OrderedDict from pathlib import Path import torch from transformers import ( VisualBertConfig, VisualBertForMultipleChoice, VisualBertForPreTraining, VisualBertForQuestionAnswering, VisualBertForVisualReasoning, ) from transformer...
57
1
"""simple docstring""" import os def _lowerCamelCase ( ): '''simple docstring''' with open(os.path.dirname(_UpperCamelCase ) + "/p022_names.txt" ) as file: __lowerCAmelCase = str(file.readlines()[0] ) __lowerCAmelCase = names.replace("\"" , "" ).sp...
57
"""simple docstring""" class _UpperCamelCase ( lowerCAmelCase__ ): '''simple docstring''' pass class _UpperCamelCase ( lowerCAmelCase__ ): '''simple docstring''' pass class _UpperCamelCase : '''simple docstring''' def __init__( self ...
57
1
"""simple docstring""" from ..utils import DummyObject, requires_backends class _UpperCamelCase ( metaclass=lowerCAmelCase__ ): '''simple docstring''' __UpperCAmelCase : Optional[int] =["""torch"""] def __init__( self , *__a , **__a ): req...
57
"""simple docstring""" def _lowerCamelCase ( _UpperCamelCase , _UpperCamelCase ): '''simple docstring''' if not isinstance(_UpperCamelCase , _UpperCamelCase ): raise ValueError("iterations must be defined as integers" ) if not isinstance(_UpperCamelCase , _UpperCamelCas...
57
1
"""simple docstring""" import argparse import json import os import fairseq import torch from fairseq.data import Dictionary from transformers import ( UniSpeechConfig, UniSpeechForCTC, UniSpeechForPreTraining, WavaVecaFeatureExtractor, WavaVecaPhonemeCTCTokenizer, WavaVecaProcessor, ...
57
"""simple docstring""" def _lowerCamelCase ( ): '''simple docstring''' __lowerCAmelCase = [] __lowerCAmelCase = 1 while len(_UpperCamelCase ) < 1e6: constant.append(str(_UpperCamelCase ) ) i += 1 __lowerCAmelCase = "".join(_UpperCamelCase...
57
1
"""simple docstring""" from __future__ import annotations class _UpperCamelCase : '''simple docstring''' def __init__( self , __a , __a ): __lowerCAmelCase , __lowerCAmelCase = text, pattern __lowerCAmelCase , __lowerCAmelCase = len(...
57
"""simple docstring""" import numpy as np from cva import COLOR_BGR2GRAY, cvtColor, imread from numpy import array, uinta from PIL import Image from digital_image_processing import change_contrast as cc from digital_image_processing import convert_to_negative as cn from digital_image_processing import sepia as sp...
57
1
"""simple docstring""" from dataclasses import dataclass from typing import Optional, Tuple, Union import numpy as np import torch from ..configuration_utils import ConfigMixin, register_to_config from ..utils import BaseOutput, randn_tensor from .scheduling_utils import SchedulerMixin @dataclass class _UpperC...
57
"""simple docstring""" from typing import TYPE_CHECKING from ...utils import OptionalDependencyNotAvailable, _LazyModule, is_tokenizers_available, is_torch_available A : Optional[int] = { "configuration_altclip": [ "ALTCLIP_PRETRAINED_CONFIG_ARCHIVE_MAP", "AltCLIPConfig", ...
57
1
"""simple docstring""" import heapq as hq import math from collections.abc import Iterator class _UpperCamelCase : '''simple docstring''' def __init__( self , __a ): __lowerCAmelCase = str(id_ ) __lowerCAmelCase = None __lowerCAmelCas...
57
"""simple docstring""" import logging from dataclasses import dataclass, field from typing import Optional from seqaseq_trainer import arg_to_scheduler from transformers import TrainingArguments A : Dict = logging.getLogger(__name__) @dataclass class _UpperCamelCase ( lowerCAmelCase__ ): ...
57
1
"""simple docstring""" import unittest from transformers import MraConfig, is_torch_available from transformers.testing_utils import require_torch, slow, torch_device from ...test_configuration_common import ConfigTester from ...test_modeling_common import ModelTesterMixin, floats_tensor, ids_tensor, random_atte...
57
"""simple docstring""" import argparse import os import re import packaging.version A : Any = "examples/" A : Optional[Any] = { "examples": (re.compile(R"^check_min_version\(\"[^\"]+\"\)\s*$", re.MULTILINE), "check_min_version(\"VERSION\")\n"), "init": (re.compile(R"^__versio...
57
1
"""simple docstring""" def _lowerCamelCase ( _UpperCamelCase ): '''simple docstring''' if not nums: # Makes sure that the list is not empty raise ValueError("List is empty" ) __lowerCAmelCase = sum(_UpperCamelCase ) / len(_UpperCamelCase ) # Calculate the averag...
57
"""simple docstring""" from typing import TYPE_CHECKING from ...utils import ( OptionalDependencyNotAvailable, _LazyModule, is_flax_available, is_tf_available, is_tokenizers_available, is_torch_available, ) A : Tuple = { "configuration_blenderbot": [ "BLENDERBOT...
57
1
"""simple docstring""" def _lowerCamelCase ( _UpperCamelCase ): '''simple docstring''' __lowerCAmelCase = "" for ch in key: if ch == " " or ch not in key_no_dups and ch.isalpha(): key_no_dups += ch return key_no_dups def _lowerCamelCase ( _UpperCamelCase ): ...
57
"""simple docstring""" def _lowerCamelCase ( _UpperCamelCase = 6008_5147_5143 ): '''simple docstring''' try: __lowerCAmelCase = int(_UpperCamelCase ) except (TypeError, ValueError): raise TypeError("Parameter n must be int or castable to int." ) if n <= 0: ...
57
1
"""simple docstring""" 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 ...
57
"""simple docstring""" import copy import json import os import tempfile from transformers import is_torch_available from .test_configuration_utils import config_common_kwargs class _UpperCamelCase ( lowerCAmelCase__ ): '''simple docstring''' def __init__( self , __a , __...
57
1
"""simple docstring""" from collections import OrderedDict from typing import TYPE_CHECKING, Any, Mapping, Optional, Union from ...configuration_utils import PretrainedConfig from ...onnx import OnnxConfig, OnnxSeqaSeqConfigWithPast from ...utils import logging if TYPE_CHECKING: from ...feature_extraction_util...
57
"""simple docstring""" A : int = { "Pillow": "Pillow", "accelerate": "accelerate>=0.11.0", "compel": "compel==0.1.8", "black": "black~=23.1", "datasets": "datasets", "filelock": "filelock", "flax": "flax>=0.4.1", "hf-doc-builder": "hf-doc-builder>=0.3.0", "huggingf...
57
1
"""simple docstring""" import argparse import hashlib import os import urllib import warnings import torch from torch import nn from tqdm import tqdm from transformers import WhisperConfig, WhisperForConditionalGeneration A : Dict = { "tiny.en": "https://openaipublic.azureedge.net/main/whispe...
57
"""simple docstring""" import warnings from typing import Dict, List, Optional, Tuple from ...tokenization_utils import AddedToken, PreTrainedTokenizer from ...utils import logging A : str = logging.get_logger(__name__) class _UpperCamelCase ( lowerCAmelCase__ ): '''simple docstring''...
57
1
"""simple docstring""" # this script reports modified .py files under the desired list of top-level sub-dirs passed as a list of arguments, e.g.: # python ./utils/get_modified_files.py utils src tests examples # # it uses git to find the forking point and which files were modified - i.e. files not under git won'...
57
"""simple docstring""" import numpy # List of input, output pairs A : Any = ( ((5, 2, 3), 1_5), ((6, 5, 9), 2_5), ((1_1, 1_2, 1_3), 4_1), ((1, 1, 1), 8), ((1_1, 1_2, 1_3), 4_1), ) A : str = (((5_1_5, 2_2, 1_3), 5_5_5), ((6_1, 3_5, 4_9), 1_5_0)) A : Union[str, ...
57
1
"""simple docstring""" import tempfile import torch from diffusers import ( DEISMultistepScheduler, DPMSolverMultistepScheduler, DPMSolverSinglestepScheduler, UniPCMultistepScheduler, ) from .test_schedulers import SchedulerCommonTest class _UpperCamelCase ( lowerCAmelCase__ ): '''s...
57
"""simple docstring""" import json import os import shutil import tempfile import unittest import numpy as np import pytest from transformers import BertTokenizer, BertTokenizerFast from transformers.models.bert.tokenization_bert import VOCAB_FILES_NAMES from transformers.testing_utils import require_vision from...
57
1
"""simple docstring""" from dataclasses import dataclass from typing import List, Optional, Union import numpy as np import PIL from PIL import Image from ...utils import ( BaseOutput, OptionalDependencyNotAvailable, is_flax_available, is_k_diffusion_available, is_k_diffusion_version, is_...
57
"""simple docstring""" from __future__ import annotations def _lowerCamelCase ( _UpperCamelCase = 4 ): '''simple docstring''' __lowerCAmelCase = abs(_UpperCamelCase ) or 4 return [[1 + x + y * row_size for x in range(_UpperCamelCase )] for y in range(_UpperCamelCase )]...
57
1
"""simple docstring""" from __future__ import annotations class _UpperCamelCase : '''simple docstring''' def __init__( self , __a = 0 ): __lowerCAmelCase = key def snake_case ( self , __a , __a ): assert isinstance(__a , ...
57
"""simple docstring""" import unittest from transformers import ( MODEL_FOR_SEQ_TO_SEQ_CAUSAL_LM_MAPPING, TF_MODEL_FOR_SEQ_TO_SEQ_CAUSAL_LM_MAPPING, TextaTextGenerationPipeline, pipeline, ) from transformers.testing_utils import is_pipeline_test, require_tf, require_torch from transformers.utils i...
57
1
"""simple docstring""" from .imports import is_tqdm_available if is_tqdm_available(): from tqdm.auto import tqdm as _tqdm from ..state import PartialState def _lowerCamelCase ( _UpperCamelCase = True , *_UpperCamelCase , **_UpperCamelCase ): '''simple docstring''' if not is_tqdm_availa...
57
"""simple docstring""" import argparse import pytorch_lightning as pl import torch from torch import nn from transformers import LongformerForQuestionAnswering, LongformerModel class _UpperCamelCase ( pl.LightningModule ): '''simple docstring''' def __init__( self , __a ): ...
57
1
"""simple docstring""" import inspect import os import torch from transformers import AutoModel from transformers.testing_utils import mockenv_context from transformers.trainer_utils import set_seed import accelerate from accelerate.accelerator import Accelerator from accelerate.state import AcceleratorState fro...
57
"""simple docstring""" def _lowerCamelCase ( _UpperCamelCase ): '''simple docstring''' __lowerCAmelCase = False while is_sorted is False: # Until all the indices are traversed keep looping __lowerCAmelCase = True for i in range(0 , len(_UpperCamelCase ) - ...
57
1
"""simple docstring""" from __future__ import annotations from random import random from typing import Generic, TypeVar A : Optional[int] = TypeVar("KT") A : Optional[Any] = TypeVar("VT") class _UpperCamelCase ( Generic[KT, VT] ): '''simple docstring''' def ...
57
"""simple docstring""" import warnings from ...processing_utils import ProcessorMixin from ...tokenization_utils_base import BatchEncoding class _UpperCamelCase ( lowerCAmelCase__ ): '''simple docstring''' __UpperCAmelCase : Union[str, Any] =["""image_processor""", """t...
57
1
"""simple docstring""" import unittest from transformers import AlbertConfig, is_torch_available from transformers.models.auto import get_values from transformers.testing_utils import require_torch, slow, torch_device from ...test_configuration_common import ConfigTester from ...test_modeling_common import Model...
57
"""simple docstring""" from diffusers.utils.testing_utils import require_onnxruntime @require_onnxruntime class _UpperCamelCase : '''simple docstring''' pass
57
1
"""simple docstring""" import argparse import torch # Step 1. clone https://github.com/microsoft/unilm # Step 2. git checkout to https://github.com/microsoft/unilm/commit/b94ec76c36f02fb2b0bf0dcb0b8554a2185173cd # Step 3. cd unilm # Step 4. ln -s $(realpath wavlm/modules.py) ./ # create simlink # import classes...
57
"""simple docstring""" import sys from collections import defaultdict class _UpperCamelCase : '''simple docstring''' def __init__( self ): __lowerCAmelCase = [] def snake_case ( self , __a ): return self.node_position[vertex] d...
57
1
"""simple docstring""" # Copyright 2022 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 # # ...
57
"""simple docstring""" import argparse from collections import OrderedDict from pathlib import Path import torch from transformers import ( VisualBertConfig, VisualBertForMultipleChoice, VisualBertForPreTraining, VisualBertForQuestionAnswering, VisualBertForVisualReasoning, ) from transformer...
57
1
"""simple docstring""" import json import os import unittest from transformers import BatchEncoding, LEDTokenizer, LEDTokenizerFast from transformers.models.led.tokenization_led import VOCAB_FILES_NAMES from transformers.testing_utils import require_tokenizers, require_torch from transformers.utils import cached_...
57
"""simple docstring""" class _UpperCamelCase ( lowerCAmelCase__ ): '''simple docstring''' pass class _UpperCamelCase ( lowerCAmelCase__ ): '''simple docstring''' pass class _UpperCamelCase : '''simple docstring''' def __init__( self ...
57
1
"""simple docstring""" import sacrebleu as scb from packaging import version from sacrebleu import TER import datasets A : Optional[Any] = "\\n@inproceedings{snover-etal-2006-study,\n title = \"A Study of Translation Edit Rate with Targeted Human Annotation\",\n author = \"Snover, Matthew a...
57
"""simple docstring""" def _lowerCamelCase ( _UpperCamelCase , _UpperCamelCase ): '''simple docstring''' if not isinstance(_UpperCamelCase , _UpperCamelCase ): raise ValueError("iterations must be defined as integers" ) if not isinstance(_UpperCamelCase , _UpperCamelCas...
57
1
"""simple docstring""" from typing import Callable, List, Optional, Union import PIL import torch from transformers import ( CLIPImageProcessor, CLIPSegForImageSegmentation, CLIPSegProcessor, CLIPTextModel, CLIPTokenizer, ) from diffusers import DiffusionPipeline from diffusers.configuration_...
57
"""simple docstring""" def _lowerCamelCase ( ): '''simple docstring''' __lowerCAmelCase = [] __lowerCAmelCase = 1 while len(_UpperCamelCase ) < 1e6: constant.append(str(_UpperCamelCase ) ) i += 1 __lowerCAmelCase = "".join(_UpperCamelCase...
57
1
"""simple docstring""" import re from filelock import FileLock try: import nltk A : str = True except (ImportError, ModuleNotFoundError): A : Optional[int] = False if NLTK_AVAILABLE: with FileLock(".lock") as lock: nltk.download("punkt", quiet=True) def _lowerCamelCase ( _...
57
"""simple docstring""" import numpy as np from cva import COLOR_BGR2GRAY, cvtColor, imread from numpy import array, uinta from PIL import Image from digital_image_processing import change_contrast as cc from digital_image_processing import convert_to_negative as cn from digital_image_processing import sepia as sp...
57
1
"""simple docstring""" from typing import TYPE_CHECKING from ...utils import ( OptionalDependencyNotAvailable, _LazyModule, is_flax_available, is_tf_available, is_torch_available, is_vision_available, ) A : Optional[Any] = {"configuration_vit": ["VIT_PRETRAINED_CONFIG_ARCHI...
57
"""simple docstring""" from typing import TYPE_CHECKING from ...utils import OptionalDependencyNotAvailable, _LazyModule, is_tokenizers_available, is_torch_available A : Optional[int] = { "configuration_altclip": [ "ALTCLIP_PRETRAINED_CONFIG_ARCHIVE_MAP", "AltCLIPConfig", ...
57
1