code
stringlengths
86
54.5k
code_codestyle
int64
0
371
style_context
stringlengths
87
49.2k
style_context_codestyle
int64
0
349
label
int64
0
1
'''simple docstring''' from __future__ import annotations import typing from collections import Counter def lowerCAmelCase_ ( snake_case__ ): '''simple docstring''' A : typing.Counter[int] = Counter() for base in range(1 , max_p...
3
'''simple docstring''' from typing import TYPE_CHECKING from ...utils import ( OptionalDependencyNotAvailable, _LazyModule, is_sentencepiece_available, is_speech_available, is_tf_available, is_torch_available, ) lowercase : Dict = { 'configuration_speec...
3
1
from __future__ import annotations import math import numpy as np from numpy.linalg import norm def snake_case_ ( lowerCAmelCase_ : np.ndarray , lowerCAmelCase_ : np.ndarray ): return math.sqrt(sum(pow(a - b , 2 ) for a, b in zip(lowerCAmelCase_ , lowerCAmelCase_ ) ...
306
import torch from diffusers import DPMSolverSDEScheduler from diffusers.utils import torch_device from diffusers.utils.testing_utils import require_torchsde from .test_schedulers import SchedulerCommonTest @require_torchsde class lowerCAmelCase ( __a ): '''simple docstring''' _A :...
306
1
"""simple docstring""" import argparse import os from pathlib import Path import torch from bark.generation import _load_model as _bark_load_model from huggingface_hub import hf_hub_download from transformers import EncodecConfig, EncodecModel, set_seed from transformers.models.bark.configuration_ba...
136
"""simple docstring""" import contextlib import csv import json import os import sqlitea import tarfile import textwrap import zipfile import pyarrow as pa import pyarrow.parquet as pq import pytest import datasets import datasets.config @pytest.fixture(scope="""session""" ) d...
173
0
from typing import Dict, List, Optional, Union import numpy as np from ...image_processing_utils import BaseImageProcessor, BatchFeature, get_size_dict from ...image_transforms import convert_to_rgb, normalize, rescale, resize, to_channel_dimension_format from ...image_utils import ( OPENAI_CLIP_MEAN, OPENA...
359
import os try: from .build_directory_md import good_file_paths except ImportError: from build_directory_md import good_file_paths # type: ignore snake_case_ = list(good_file_paths()) assert filepaths, "good_file_paths() failed!" snake_case_ = [file for file in filepaths if file != ...
216
0
from collections import Counter import numpy as np from sklearn import datasets from sklearn.model_selection import train_test_split __lowerCAmelCase : List[Any] =datasets.load_iris() __lowerCAmelCase : Tuple =np.array(data['data']) __lowerCAmelCase : Dict =np.array(data['target']) __lowerCAmelCase...
9
"""simple docstring""" def UpperCamelCase ( _lowerCAmelCase : int ) -> int: if divisor % 5 == 0 or divisor % 2 == 0: return 0 _UpperCAmelCase : Optional[Any] = 1 _UpperCAmelCase : List[str] = 1 while repunit: _UpperCAmelCase : Tuple = ...
246
0
def lowerCamelCase__ ( a ) -> bool: return str(a ) == str(a )[::-1] def lowerCamelCase__ ( a ) -> int: return int(a ) + int(str(a )[::-1] ) def lowerCamelCase__ ( a = 1_00_00 ) -> int: _A: Tuple = ...
362
import argparse import json import os from tensorflow.core.protobuf.saved_model_pba import SavedModel # All paths are set with the intent you should run this script from the root of the repo with the command # python utils/check_copies.py UpperCAmelCase__ : Any = '.' # Internal TensorFlow ops tha...
301
0
import requests _UpperCAmelCase : Union[str, Any] = "" # <-- Put your OpenWeatherMap appid here! _UpperCAmelCase : int = "https://api.openweathermap.org/data/2.5/" def A ( lowercase = "Chicago" , lowercase = APPID ) -> Optional[int]: '''simple docstring''...
222
"""simple docstring""" from unittest import TestCase from datasets import Dataset from minhash_deduplication import deduplicate_dataset, make_duplicate_clusters def __a ( ): UpperCAmelCase_ : List[Any] = { "repo_name": ["test_repo1", "test_repo2", "test_repo3"], "p...
61
0
"""simple docstring""" import asyncio import os import shutil import subprocess import sys import tempfile import unittest from distutils.util import strtobool from functools import partial from pathlib import Path from typing import List, Union from unittest import mock import torch from ..state import Acce...
27
"""simple docstring""" def A_ ( snake_case_ : list[int] ): '''simple docstring''' if not numbers: return 0 if not isinstance(snake_case_ ,(list, tuple) ) or not all( isinstance(snake_case_ ,snake_case_ ) for number in numbers ): ...
27
1
import argparse from collections import OrderedDict from pathlib import Path import torch from transformers import ( VisualBertConfig, VisualBertForMultipleChoice, VisualBertForPreTraining, VisualBertForQuestionAnswering, VisualBertForVisualReasoning, ) from transformers.utils import logging l...
13
def A_ ( _UpperCAmelCase ): SCREAMING_SNAKE_CASE_: List[str] = [0] * len(_UpperCAmelCase ) SCREAMING_SNAKE_CASE_: List[Any] = [] SCREAMING_SNAKE_CASE_: str = [] SCREAMING_SNAKE_CASE_: List[str] = 0 for values in graph.values(): ...
13
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 : ...
157
"""simple docstring""" from typing import TYPE_CHECKING from ...utils import OptionalDependencyNotAvailable, _LazyModule, is_torch_available _SCREAMING_SNAKE_CASE : List[str] = { """configuration_bigbird_pegasus""": [ """BIGBIRD_PEGASUS_PRETRAINED_CONFIG_ARCHIVE_MAP""", """BigBi...
157
1
"""simple docstring""" from __future__ import annotations from collections import deque from collections.abc import Sequence from dataclasses import dataclass from typing import Any @dataclass class __lowerCAmelCase : lowercase = 42 lowercase = None lowercase = ...
316
"""simple docstring""" 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_param...
316
1
from collections import OrderedDict from typing import Mapping from ...configuration_utils import PretrainedConfig from ...onnx import OnnxConfig from ...utils import logging lowerCamelCase : Optional[int] = logging.get_logger(__name__) lowerCamelCase : Any = { '''xlm-mlm-en-2...
352
import math class _a : def __init__( self : List[Any] , _SCREAMING_SNAKE_CASE : Any=0 )-> Optional[Any]: # a graph with Node 0,1,...,N-1 lowerCAmelCase__ : Optional[int] = n lowerCAmelCase__ : List[Any] = [ [math.inf fo...
211
0
"""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.multicontrolnet import MultiControlNetModel # noqa: F401 fro...
64
"""simple docstring""" from typing import Dict, Optional import numpy as np import datasets UpperCAmelCase : Tuple = "\nIoU is the area of overlap between the predicted segmentation and the ground truth divided by the area of union\nbetween the predicted segmentation and the ground truth...
136
0
'''simple docstring''' import operator as op __snake_case ="scaler.pt" __snake_case ="pytorch_model" __snake_case ="random_states" __snake_case ="optimizer" __snake_case ="scheduler" __snake_case ="pytorch_model.bin" __snake_case ="pytorch_model.bin.index...
369
'''simple docstring''' 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 f...
55
0
'''simple docstring''' from typing import Tuple, Union from ...modeling_outputs import BackboneOutput from ...modeling_utils import PreTrainedModel from ...utils import is_timm_available, is_torch_available, requires_backends from ...utils.backbone_utils import BackboneMixin from .configuration_timm_backbone ...
75
# flake8: noqa # Lint as: python3 from typing import Dict, List, Optional, Type from .. import config from ..utils import logging from .formatting import ( ArrowFormatter, CustomFormatter, Formatter, PandasFormatter, PythonFormatter, TensorFormatter, format_table, query_table, ) from...
214
0
"""simple docstring""" from typing import TYPE_CHECKING from ...utils import ( OptionalDependencyNotAvailable, _LazyModule, is_flax_available, is_tf_available, is_tokenizers_available, is_torch_available, ) lowercase__ = { """configuratio...
353
"""simple docstring""" from typing import Any def _snake_case ( lowercase__ ): if not input_list: return [] _lowerCamelCase : Any = [input_list.count(lowercase__ ) for value in input_list] _lowerCamelCase : Dict = max...
12
0
import json import os import re import unicodedata from json.encoder import INFINITY from typing import Any, Dict, List, Optional, Tuple, Union import numpy as np import regex from ...tokenization_utils import AddedToken, PreTrainedTokenizer from ...tokenization_utils_base import BatchEncoding from ...utils import ...
138
import itertools from dataclasses import dataclass from typing import List, Optional import pyarrow as pa import pyarrow.parquet as pq import datasets from datasets.table import table_cast __A : Any = datasets.utils.logging.get_logger(__name__) @dataclass class __A ( datasets.Bui...
138
1
'''simple docstring''' import argparse import json import pickle from pathlib import Path import requests import torch from huggingface_hub import hf_hub_download from PIL import Image from transformers import MaskFormerConfig, MaskFormerForInstanceSegmentation, MaskFormerImageProcessor, SwinConfig ...
369
'''simple docstring''' import warnings from ...utils import logging from .image_processing_dpt import DPTImageProcessor lowerCAmelCase_ = logging.get_logger(__name__) class lowerCamelCase ( __lowerCAmelCase ): def __init__( self, *lowercase_, **lowercase_ ) -> None: war...
332
0
'''simple docstring''' 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 AutoFeatureExtractor, WavaVecaFeatureExtractor from transformers.testing_utils...
311
'''simple docstring''' import inspect import os import unittest import torch import accelerate from accelerate import Accelerator from accelerate.test_utils import execute_subprocess_async, require_multi_gpu from accelerate.utils import patch_environment class UpperCamelCase__ ( unittest.TestCase )...
311
1
'''simple docstring''' import os import re import shutil import sys import tempfile import unittest import black lowercase =os.path.abspath(os.path.dirname(os.path.dirname(os.path.dirname(__file__)))) sys.path.append(os.path.join(git_repo_path, 'utils')) import check_copies # noqa: E402 # This is ...
352
'''simple docstring''' from __future__ import annotations from random import choice def lowerCamelCase__ ( __lowerCamelCase : Optional[int] ): '''simple docstring''' return choice(__lowerCamelCase ) def lowerCamelCase__ ( __lowerCamelCase : ...
242
0
'''simple docstring''' import argparse from pathlib import Path import torch from packaging import version from torch.onnx import export from diffusers import AutoencoderKL __lowercase : Optional[Any] = version.parse(version.parse(torch.__version__).base_version) < version.parse('1.11') def ...
27
'''simple docstring''' from typing import TYPE_CHECKING from ...utils import ( OptionalDependencyNotAvailable, _LazyModule, is_flax_available, is_tf_available, is_tokenizers_available, is_torch_available, ) __lowercase : Union[str, Any] = { 'configuration_blenderbot': [ ...
27
1
"""simple docstring""" from typing import TYPE_CHECKING from ...utils import ( OptionalDependencyNotAvailable, _LazyModule, is_tokenizers_available, is_torch_available, is_vision_available, ) __lowerCamelCase : int = { """configuration_layoutlmv2""": ["""LAYOUTLMV2...
370
from tempfile import TemporaryDirectory from unittest import TestCase from unittest.mock import MagicMock, patch from transformers import AutoModel, TFAutoModel from transformers.onnx import FeaturesManager from transformers.testing_utils import SMALL_MODEL_IDENTIFIER, require_tf, require_torch @require_torc...
286
0
import os import jsonlines import numpy as np from tqdm import tqdm lowerCAmelCase = 2_0_4_8 lowerCAmelCase = 4_0_9_6 lowerCAmelCase = 4_2 lowerCAmelCase = os.environ.pop('''PROCESS_TRAIN''', '''false''') lowerCAmelCase = {'''null''': 0, '''short''': 1, '''lo...
295
import csv from collections import defaultdict from dataclasses import dataclass, field from typing import List, Optional import matplotlib.pyplot as plt import numpy as np from matplotlib.ticker import ScalarFormatter from transformers import HfArgumentParser def _lowerCamelCase( lowercase__=None ...
295
1
'''simple docstring''' from __future__ import annotations import string from itertools import cycle, product from pathlib import Path lowerCamelCase :str = ( string.ascii_letters + string.digits + string.punctuation + string.whitespace ) lowerCamelCase :list[int] = [ord(letter) for...
135
'''simple docstring''' import argparse import logging import os import re import tensorflow as tf from transformers import ( AutoConfig, AutoTokenizer, DataCollatorForLanguageModeling, PushToHubCallback, TFAutoModelForMaskedLM, create_optimizer, ) lowerCamelCase :Optional[int] ...
135
1
from __future__ import annotations import unittest from transformers import DebertaVaConfig, is_tf_available from transformers.testing_utils import require_tf, slow from ...test_configuration_common import ConfigTester from ...test_modeling_tf_common import TFModelTesterMixin, ids_tensor, random_attention_mask ...
107
"""simple docstring""" import math import flax.linen as nn import jax.numpy as jnp def a_ ( _lowerCAmelCase : jnp.ndarray , _lowerCAmelCase : int , _lowerCAmelCase : float = 1 , _lowerCAmelCase : float = 1 , _lowerCAmelCase : float = 1.0E4 , _lowerCAmelCase : bool = False , _lo...
77
0
from __future__ import annotations import unittest from transformers import AutoTokenizer, MBartConfig, is_tf_available from transformers.testing_utils import require_sentencepiece, require_tf, require_tokenizers, slow from transformers.utils import cached_property from ...test_configuration_common import Co...
350
import unittest from transformers import is_torch_available from transformers.testing_utils import require_sentencepiece, require_tokenizers, require_torch, slow, torch_device if is_torch_available(): from transformers import AutoModelForSeqaSeqLM, AutoTokenizer @require_torch @require_sent...
204
0
from __future__ import annotations def __SCREAMING_SNAKE_CASE ( UpperCamelCase__ , UpperCamelCase__ ) -> List[str]: '''simple docstring''' print(F"""Vertex\tShortest Distance from vertex {src}""" ) for i, d in enumerate(UpperCamelCase__ ): print(F"""{i}\t\t{d}""" ) ...
273
import tempfile import numpy as np import torch from transformers import AutoTokenizer, TaEncoderModel from diffusers import DDPMScheduler, UNetaDConditionModel from diffusers.models.attention_processor import AttnAddedKVProcessor from diffusers.pipelines.deepfloyd_if import IFWatermarker from diffusers.utils.t...
273
1
'''simple docstring''' import html from ...feature_extraction_utils import BatchFeature, FeatureExtractionMixin from ...utils import is_bsa_available, logging, requires_backends if is_bsa_available(): import bsa from bsa import BeautifulSoup lowercase =logging.get_logger(__name__) class __m...
366
'''simple docstring''' 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 ( Autoen...
242
0
import math from ...configuration_utils import PretrainedConfig from ...utils import logging lowerCAmelCase : Tuple = logging.get_logger(__name__) lowerCAmelCase : Dict = { """facebook/data2vec-base-960h""": """https://huggingface.co/facebook/data2vec-audio-base-960h/resolve/main...
13
from typing import TYPE_CHECKING from ...utils import ( OptionalDependencyNotAvailable, _LazyModule, is_flax_available, is_tf_available, is_torch_available, ) UpperCAmelCase_ = { 'configuration_vision_encoder_decoder': ['VisionEncoderDecoderConfig', 'VisionEncoderDecoderOnnxConfi...
12
0
"""simple docstring""" from jiwer import compute_measures import datasets UpperCAmelCase : Tuple = "\\n@inproceedings{inproceedings,\n author = {Morris, Andrew and Maier, Viktoria and Green, Phil},\n year = {2004},\n month = {01},\n pages = {},\n title = {From WER and RIL to ME...
360
"""simple docstring""" import argparse import os from pathlib import Path from typing import Dict import tensorflow as tf import torch from tqdm import tqdm from transformers import PegasusConfig, PegasusForConditionalGeneration, PegasusTokenizer from transformers.models.pegasus.configuration_pegas...
313
0
'''simple docstring''' import fire from transformers import AutoConfig, AutoModelForSeqaSeqLM, AutoTokenizer def a_ ( __snake_case : str , __snake_case : str , **__snake_case : Optional[Any] ) -> int: """simple docstring""" ...
75
'''simple docstring''' from typing import Dict, List, Optional, Union import numpy as np from ...image_processing_utils import BaseImageProcessor, BatchFeature, get_size_dict from ...image_transforms import ( center_crop, convert_to_rgb, get_resize_output_image_size, normalize, rescale, ...
75
1
import argparse from collections import defaultdict import yaml lowerCAmelCase : Any = """docs/source/en/_toctree.yml""" def A_ ( _UpperCAmelCase ): SCREAMING_SNAKE_CASE_: str = defaultdict(_UpperCAmelCase ) for doc in model_doc: counts[doc[...
127
import os # Precomputes a list of the 100 first triangular numbers lowerCAmelCase : Optional[int] = [int(0.5 * n * (n + 1)) for n in range(1, 101)] def A_ ( ): SCREAMING_SNAKE_CASE_: List[str] = os.path.dirname(os.path.realpath(_UpperCAmelCase ) ) SCREAMI...
127
1
'''simple docstring''' from __future__ import annotations from numpy import array, cos, cross, floataa, radians, sin from numpy.typing import NDArray def snake_case_ ( _lowerCAmelCase : float , _lowerCAmelCase : float , _lowerCAmelCase : bool = Fals...
23
"""simple docstring""" import torch from transformers import CamembertForMaskedLM, CamembertTokenizer def lowerCamelCase__ ( __snake_case, __snake_case, __snake_case, __snake_case=5 ) -> Union[str, Any]: """simple docstring""" assert masked_in...
194
0
def __snake_case ( _lowerCAmelCase : Optional[int] , _lowerCAmelCase : str ) -> List[str]: return base * power(_lowerCAmelCase , (exponent - 1) ) if exponent else 1 if __name__ == "__main__": print('''Raise base to the power of exponent using recursion...''') _lowerCAmelCas...
354
from collections.abc import Sequence def __snake_case ( _lowerCAmelCase : Sequence[int] | None = None ) -> int: if nums is None or not nums: raise ValueError("Input sequence should not be empty" ) A_ : Any = nums[0] for i in range(1 , len(_lowerCAmelCase ) ): ...
70
0
from __future__ import annotations from math import pi from typing import Protocol import matplotlib.pyplot as plt import numpy as np class UpperCAmelCase_ ( a): def snake_case__ ( self, __a): '''simple docstring''' return 0.0 def A ...
36
"""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 Mode...
100
0
"""simple docstring""" import unittest from transformers.testing_utils import require_bsa from transformers.utils import is_bsa_available from ...test_feature_extraction_common import FeatureExtractionSavingTestMixin if is_bsa_available(): from transformers import MarkupLMFeatureExtractor class lo...
350
import random from typing import Any def UpperCAmelCase_ ( __UpperCAmelCase : list ) -> list[Any]: for _ in range(len(__UpperCAmelCase ) ): SCREAMING_SNAKE_CASE_ = random.randint(0 , len(__UpperCAmelCase ) - 1 ) ...
210
0
'''simple docstring''' from typing import TYPE_CHECKING from ...utils import OptionalDependencyNotAvailable, _LazyModule, is_tf_available, is_torch_available __lowercase = { '''configuration_ctrl''': ['''CTRL_PRETRAINED_CONFIG_ARCHIVE_MAP''', '''CTRLConfig'''], '''tokenization_ctrl''': ['''CTRL...
272
'''simple docstring''' from ...utils import logging from ..ta.modeling_tf_ta import TFTaEncoderModel, TFTaForConditionalGeneration, TFTaModel from .configuration_mta import MTaConfig __lowercase = logging.get_logger(__name__) __lowercase = '''T5Config''' class a__( lowerCAmelCas...
272
1
import argparse import gc import json import os import shutil import warnings import torch from transformers import LlamaConfig, LlamaForCausalLM, LlamaTokenizer try: from transformers import LlamaTokenizerFast except ImportError as e: warnings.warn(e) warnings.warn( 'The converte...
116
def snake_case( __magic_name__ , __magic_name__ , __magic_name__ ) -> int: '''simple docstring''' if len(__magic_name__ ) != len(__magic_name__ ): raise ValueError('''The length of profit and weight must be same.''' ) if max_weight <= 0: ...
116
1
'''simple docstring''' from ...configuration_utils import PretrainedConfig from ...utils import logging _SCREAMING_SNAKE_CASE : str = logging.get_logger(__name__) _SCREAMING_SNAKE_CASE : Optional[int] = { "funnel-transformer/small": "https://huggingface.co/funnel-transform...
85
from typing import Optional import torch import torch.utils.checkpoint from torch import Tensor, nn from torch.nn import BCEWithLogitsLoss, CrossEntropyLoss, MSELoss from ...activations import ACTaFN from ...file_utils import add_code_sample_docstrings, add_start_docstrings, add_start_docstrings_to_mo...
317
0
def _SCREAMING_SNAKE_CASE ( _lowerCamelCase : int = 1 , _lowerCamelCase : int = 1_000) -> int: '''simple docstring''' __UpperCamelCase : Tuple = 1 __UpperCamelCase : Any = 0 for divide_by_nu...
355
def _SCREAMING_SNAKE_CASE ( _lowerCamelCase : int = 10 , _lowerCamelCase : int = 22) -> int: '''simple docstring''' __UpperCamelCase : Any = range(1 , _lowerCamelCase) __UpperCamelCase : int = r...
151
0
"""simple docstring""" import copy from ...configuration_utils import PretrainedConfig from ...utils import logging from ..bit import BitConfig __A = logging.get_logger(__name__) __A = { '''Intel/dpt-large''': '''https://huggingface.co/Intel/dpt-large/resolve/main/config.json''', # See all DPT ...
135
"""simple docstring""" from unittest import TestCase from datasets import Sequence, Value from datasets.arrow_dataset import Dataset class _lowerCamelCase ( a_ ): def _lowerCAmelCase ( self : Any ) -> str: """simple docstring""" return [ ...
242
0
'''simple docstring''' import warnings from pathlib import Path from typing import List, Tuple, Union import fire from torch import nn from transformers import AutoModelForSeqaSeqLM, AutoTokenizer, PreTrainedModel from transformers.utils import logging __snake_case = logging.get_logger(__name__) ...
367
'''simple docstring''' # Lint as: python3 import sys from collections.abc import Mapping from typing import TYPE_CHECKING, Dict, Optional import numpy as np import pyarrow as pa from .. import config from ..utils.logging import get_logger from ..utils.py_utils import map_nested from .formatting import TensorFormat...
219
0
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 ModelTesterMixin, ids_te...
88
from ...configuration_utils import PretrainedConfig from ...utils import logging snake_case_ = logging.get_logger(__name__) snake_case_ = { '''google/switch-base-8''': '''https://huggingface.co/google/switch-base-8/blob/main/config.json''', } class SCREAMING_SNAKE_CASE__ (__snake_case )...
214
0
from typing import TYPE_CHECKING from ...utils import OptionalDependencyNotAvailable, _LazyModule, is_torch_available, is_vision_available _UpperCAmelCase = {'configuration_glpn': ['GLPN_PRETRAINED_CONFIG_ARCHIVE_MAP', 'GLPNConfig']} try: if not is_vision_available(): ...
365
import os from shutil import copyfile from typing import Any, Dict, List, Optional, Tuple import sentencepiece as spm from ...tokenization_utils import PreTrainedTokenizer from ...utils import logging _UpperCAmelCase = '▁' _UpperCAmelCase = {'vocab_file': 'spiece.model'} ...
232
0
import os 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 logging UpperCAmelCase_ = logging.get_logger(__name__) UpperCAmelCase_ ...
201
"""simple docstring""" class A_ : """simple docstring""" def __init__( self :List[Any] , lowercase_ :int ) -> None: UpperCAmelCase = size UpperCAmelCase = [0] * size UpperCAmelCase ...
78
0
from typing import Dict, List from nltk.translate import gleu_score import datasets from datasets import MetricInfo lowerCAmelCase_ = """\ @misc{wu2016googles, title={Google\'s Neural Machine Translation System: Bridging the Gap between Human and Machine Translation}, author={Yonghui Wu a...
365
def lowerCamelCase_ ( lowerCAmelCase: int )-> bool: return number & 1 == 0 if __name__ == "__main__": import doctest doctest.testmod()
260
0
"""simple docstring""" from __future__ import annotations def A__ ( UpperCamelCase , UpperCamelCase , UpperCamelCase , ): if (stress, tangential_force, area).count(0 ) != 1: raise ValueError("You cannot supply more or less than 2 values" ) eli...
292
"""simple docstring""" from ...configuration_utils import PretrainedConfig from ...utils import logging _snake_case : Optional[int] = logging.get_logger(__name__) _snake_case : Optional[int] = { 'google/vivit-b-16x2-kinetics400': ( 'https://huggingface.co/google/vi...
292
1
import copy from typing import Dict, List, Optional from ...configuration_utils import PretrainedConfig from ...utils import logging from ..auto import CONFIG_MAPPING UpperCamelCase = { '''facebook/mask2former-swin-small-coco-instance''': ( '''https://huggingface.co/facebook/mask2former-swi...
353
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 transformers.utils impor...
65
0
"""simple docstring""" import copy import os import cva import numpy as np from matplotlib import pyplot as plt class lowerCAmelCase_ : '''simple docstring''' def __init__( self : List[str] ) -> int: A = '' A = '' A ...
74
"""simple docstring""" import argparse import os import torch from transformers import FlavaImageCodebook, FlavaImageCodebookConfig def __lowerCamelCase ( a_ : str , a_ : Dict , a_ : Any , a_ : str ) -> str: __SCREAMING_SNAKE_CASE :...
191
0
from math import factorial def __SCREAMING_SNAKE_CASE ( lowerCAmelCase: int , lowerCAmelCase: int , lowerCAmelCase: float ) -> float: if successes > trials: raise ValueError("successes must be lower or equal to trials" ) if trials < 0 or successes < 0: ...
189
from typing import List, Optional, Union import torch from ...models import UNetaDConditionModel, VQModel from ...pipelines import DiffusionPipeline from ...pipelines.pipeline_utils import ImagePipelineOutput from ...schedulers import DDPMScheduler from ...utils import ( is_accelerate_available, is_accelera...
189
1
"""simple docstring""" from typing import TYPE_CHECKING from ...utils import OptionalDependencyNotAvailable, _LazyModule, is_tensorflow_text_available, is_torch_available __A = { """configuration_ernie""": ["""ERNIE_PRETRAINED_CONFIG_ARCHIVE_MAP""", """ErnieConfig""", """ErnieOnnxConfig"""]...
293
"""simple docstring""" import logging import os from typing import List, TextIO, Union from conllu import parse_incr from utils_ner import InputExample, Split, TokenClassificationTask __A = logging.getLogger(__name__) class _lowerCAmelCase ( a ): """simple docstrin...
293
1
from __future__ import annotations from collections.abc import MutableSequence class a : """simple docstring""" def __init__( self , lowerCAmelCase_ , lowerCAmelCase_ ) -> None: if len(lowerCAmelCase_ ) != degree + 1: raise ...
81
import colorsys from PIL import Image # type: ignore def snake_case ( snake_case__ :float , snake_case__ :float , snake_case__ :int) -> float: _A = x _A = y for step in range(snake_case__): # noqa: B007 ...
81
1
import copy import re class A : '''simple docstring''' __lowerCamelCase : Dict = '''hp''' __lowerCamelCase : List[str] = {} __lowerCamelCase : Any = None @classmethod def a_ ( cls : List[str] ...
274
from sklearn.metrics import fa_score import datasets A : Any = ''' The F1 score is the harmonic mean of the precision and recall. It can be computed with the equation: F1 = 2 * (precision * recall) / (precision + recall) ''' A : List[Any] = ''' Args: predictions (`li...
274
1
class lowerCamelCase : """simple docstring""" def __init__( self : Tuple ) -> Optional[Any]: SCREAMING_SNAKE_CASE_ = {} def __A ( self : Tuple ) -> None: print(self.vertex ) for i in self.vertex: ...
352
from collections import OrderedDict from typing import Any, Mapping, Optional from ... import PreTrainedTokenizer from ...configuration_utils import PretrainedConfig from ...file_utils import TensorType, is_torch_available from ...onnx import OnnxConfig, OnnxConfigWithPast, OnnxSeqaSeqConfigWithPast from ...onnx.utils...
305
0
from __future__ import annotations from dataclasses import dataclass @dataclass class A__ : _UpperCAmelCase :float _UpperCAmelCase :TreeNode | None = None _UpperCAmelCase :TreeNode | None = None def A_ ( _lowerCAmelCase ) -> bool: # Validat...
52
"""simple docstring""" import logging import os from typing import List, TextIO, Union from conllu import parse_incr from utils_ner import InputExample, Split, TokenClassificationTask __A = logging.getLogger(__name__) class _lowerCAmelCase ( a ): """simple docstrin...
293
0
def __SCREAMING_SNAKE_CASE ( __UpperCamelCase : int ) -> "list[int]": """simple docstring""" if upper_limit < 0: raise ValueError("""Limit for the Catalan sequence must be ≥ 0""" ) SCREAMING_SNAKE_CASE__ = [0] * (upper_limit + 1) # Base c...
204
def __SCREAMING_SNAKE_CASE ( __UpperCamelCase : Union[str, Any] ) -> int: """simple docstring""" SCREAMING_SNAKE_CASE__ = len(__UpperCamelCase ) for i in range(length - 1 ): SCREAMING_SNAKE_CASE__ = i for k in range(i + 1...
204
1
'''simple docstring''' from __future__ import annotations def __lowerCamelCase ( A__ ) -> int: """simple docstring""" if not nums: return 0 UpperCamelCase = nums[0] UpperCamelCase = 0 for num in nums[1:]: UpperCamelCas...
28
'''simple docstring''' from __future__ import annotations def _a( UpperCamelCase__ : list[int] ): '''simple docstring''' if not nums: return 0 SCREAMING_SNAKE_CASE__ : Dict =nums[0] SCREAMING_SNAKE_CAS...
152
0
'''simple docstring''' def __magic_name__( lowerCamelCase): __lowerCAmelCase = len(lowerCamelCase) for i in range(1, lowerCamelCase): __lowerCAmelCase = collection[i] __lowerCAmelCase = 0 __lowerCAmelCase ...
355
'''simple docstring''' def __magic_name__( lowerCamelCase): __lowerCAmelCase = 1 __lowerCAmelCase = 2 while i * i <= n: __lowerCAmelCase = 0 while n % i == 0: n //= i multiplicity +=...
9
0
"""simple docstring""" import pickle import unittest import torch from accelerate import Accelerator from accelerate.state import AcceleratorState from accelerate.test_utils import require_cpu @require_cpu class SCREAMING_SNAKE_CASE_ ( unittest.TestCase ): """simple docstring""" def sna...
100
'''simple docstring''' import doctest import glob import importlib import inspect import os import re from contextlib import contextmanager from functools import wraps from unittest.mock import patch import numpy as np import pytest from absl.testing import parameterized import datasets from datasets import load...
200
0
import json import os import tempfile import unittest import numpy as np from datasets import load_dataset from transformers.testing_utils import require_torch, require_vision, slow from transformers.utils import is_torch_available, is_vision_available from ...test_image_processing_common import ImageProcessingSavin...
119
import copy from dataclasses import dataclass from pathlib import Path from typing import Dict, Optional, Union @dataclass class a_ : '''simple docstring''' UpperCAmelCase_ = None UpperCAmelCase_ = False UpperCAmelCase_ = False UpperCAmelCase_ = False UpperCAmelCase_ ...
119
1
'''simple docstring''' from ...configuration_utils import PretrainedConfig from ...utils import logging __a = logging.get_logger(__name__) __a = { 'SCUT-DLVCLab/lilt-roberta-en-base': ( 'https://huggingface.co/SCUT-DLVCLab/lilt-roberta-en-base/resolve/main/config.json' ...
145
'''simple docstring''' import unittest from transformers import is_torch_available from transformers.testing_utils import require_sentencepiece, require_tokenizers, require_torch, slow, torch_device if is_torch_available(): from transformers import AutoModelForSeqaSeqLM, AutoTokenizer @require_torch ...
145
1
"""simple docstring""" import unittest import numpy as np import requests from transformers.testing_utils import require_torch, require_vision from transformers.utils import is_torch_available, is_vision_available from ...test_image_processing_common import ImageProcessingSavingTestMixin, prepare_...
362
import qiskit def _SCREAMING_SNAKE_CASE ( _lowerCamelCase : int = 2) -> qiskit.result.counts.Counts: '''simple docstring''' __UpperCamelCase : List[str] = qubits # Using Aer's simulator __UpperCamelCase : i...
151
0
import sacrebleu as scb from packaging import version from sacrebleu import CHRF import datasets __UpperCAmelCase : Any = "\\n@inproceedings{popovic-2015-chrf,\n title = \"chr{F}: character n-gram {F}-score for automatic {MT} evaluation\",\n author = \"Popovi{\'c}, Maja\",\n bo...
111
from typing import Any, Dict, List, Union 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 ..image_utils import load_image if is_torch_available(): import torch...
111
1
'''simple docstring''' from queue import PriorityQueue from typing import Any import numpy as np def UpperCAmelCase__ ( UpperCAmelCase__, UpperCAmelCase__, UpperCAmelCase__, UpperCAmelCase__, UpperCAmelCase__, UpperCAmelCase__, UpperCAmelCase__, UpperCAmelCase__, UpperCAmelCase__...
101
'''simple docstring''' import json import logging import os import socket import git import numpy as np import torch logging.basicConfig( format='''%(asctime)s - %(levelname)s - %(name)s - PID: %(process)d - %(message)s''', datefmt='''%m/%d/%Y %H:%M:%S''', level=logging.INFO, ) __lowerCamelCase...
101
1
"""simple docstring""" import datasets lowerCAmelCase_ = '\\n@InProceedings{conneau2018xnli,\n author = "Conneau, Alexis\n and Rinott, Ruty\n and Lample, Guillaume\n and Williams, Adina\n and Bowman, Samuel R.\n ...
16
'''simple docstring''' import torch from diffusers import DDPMParallelScheduler from .test_schedulers import SchedulerCommonTest class a_ ( lowerCamelCase ): lowercase = (DDPMParallelScheduler,) def A__ ( self , **_SCREAMING_SNAKE_CASE ...
321
0
"""simple docstring""" from ...configuration_utils import PretrainedConfig from ...utils import logging __A = logging.get_logger(__name__) __A = { """SCUT-DLVCLab/lilt-roberta-en-base""": ( """https://huggingface.co/SCUT-DLVCLab/lilt-roberta-en-base/resolve/main/config.js...
369
"""simple docstring""" 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_fea...
254
0
'''simple docstring''' from typing import Tuple, Union from ...modeling_outputs import BackboneOutput from ...modeling_utils import PreTrainedModel from ...utils import is_timm_available, is_torch_available, requires_backends from ...utils.backbone_utils import BackboneMixin from .configuration_timm_backbone ...
75
"""simple docstring""" from .imports import is_rich_available if is_rich_available(): from rich.traceback import install install(show_locals=False) else: raise ModuleNotFoundError("""To use the rich extension, install rich with `pip install rich`""")
241
0
'''simple docstring''' import math from collections.abc import Callable def _lowerCamelCase ( lowerCamelCase_ : Callable[[float], float] , lowerCamelCase_ : float , lowerCamelCase_ : float ): """simple docstring""" UpperCAmelCase_ : float ...
274
'''simple docstring''' def _lowerCamelCase ( lowerCamelCase_ : int , lowerCamelCase_ : int ): """simple docstring""" return int(input_a == input_a == 0 ) def _lowerCamelCase ( ): """simple docstring""" print('Truth Table of NOR Gate:' ...
274
1
"""simple docstring""" import itertools import math def UpperCAmelCase__ (snake_case__ : int ): """simple docstring""" if 1 < number < 4: # 2 and 3 are primes return True elif number < 2 or number % 2 == 0 or number % 3 == 0: # Negatives, 0, 1, all ...
64
"""simple docstring""" from __future__ import annotations def UpperCAmelCase__ (snake_case__ : list[int] , snake_case__ : int ): """simple docstring""" if len(snake_case__ ) < k or k < 0: raise ValueError("""Invalid Input""" ) _snake_case ...
64
1
"""simple docstring""" import random def _lowercase ( __snake_case ,__snake_case ,__snake_case ) -> Optional[Any]: __lowerCAmelCase : Union[str, Any] = a[left_index] __lowerCAmelCase : Union[str, Any] = left_index + 1 for j in ...
362
"""simple docstring""" __snake_case : Any = [ 999, 800, 799, 600, 599, 500, 400, 399, 377, 355, 333, 311, 288, 266, 244, 222, 200, 199, 177, 155, 133, 111, 88, 66...
58
0
"""simple docstring""" from __future__ import annotations def __lowerCamelCase ( __UpperCamelCase , __UpperCamelCase ) -> Optional[int]: """simple docstring""" lowerCAmelCase_ : list[list[int]] = [] create_all_state(1 , lowercase__ , ...
241
import torch import torch.nn as nn from transformers import CLIPConfig, CLIPVisionModel, PreTrainedModel from ...utils import logging __lowerCAmelCase : Dict =logging.get_logger(__name__) def _UpperCamelCase ( lowercase__ , lowercase__ ): __SCREAMING_SNAKE_CASE : ...
9
0
def A__ ( __lowerCamelCase = 1, __lowerCamelCase = 10_00 ): SCREAMING_SNAKE_CASE_ = 1 SCREAMING_SNAKE_CASE_ = 0 for divide_by_number in range(__lowerCamelCase, digit + 1 ): SCREAMING_SNAKE_CASE_ = [] SCREAMING_SNAKE_CASE_ = numerator fo...
257
__UpperCAmelCase = [ (10_00, "M"), (9_00, "CM"), (5_00, "D"), (4_00, "CD"), (1_00, "C"), (90, "XC"), (50, "L"), (40, "XL"), (10, "X"), (9, "IX"), (5, "V"), (4, "IV"), (1, "I"), ] def A__ ( __lowerCamelCase ): SCREAMING_SNAKE_CASE_ = {'''...
257
1
import argparse from collections import OrderedDict from pathlib import Path import requests import torch from PIL import Image from transformers import GLPNConfig, GLPNForDepthEstimation, GLPNImageProcessor from transformers.utils import logging logging.set_verbosity_info() __UpperCAmelCase = lo...
119
import inspect import unittest from transformers import ConvNextConfig from transformers.testing_utils import require_torch, require_vision, slow, torch_device from transformers.utils import cached_property, is_torch_available, is_vision_available from ...test_backbone_common import BackboneTesterMixin from ...te...
119
1
'''simple docstring''' import os import unittest from transformers import FunnelTokenizer, FunnelTokenizerFast from transformers.models.funnel.tokenization_funnel import VOCAB_FILES_NAMES from transformers.testing_utils import require_tokenizers from ...test_tokenization_common import TokenizerTesterMixin ...
123
'''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...
123
1
import json import os import tempfile import unittest import unittest.mock as mock from pathlib import Path from requests.exceptions import HTTPError from transformers.utils import ( CONFIG_NAME, FLAX_WEIGHTS_NAME, TF2_WEIGHTS_NAME, TRANSFORMERS_CACHE, WEIGHTS_NAME, cached_file, get_file_f...
348
import io import json import unittest from parameterized import parameterized from transformers import FSMTForConditionalGeneration, FSMTTokenizer from transformers.testing_utils import get_tests_dir, require_torch, slow, torch_device from utils import calculate_bleu __snake_case = get_tes...
310
0
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_onn...
39
import warnings from contextlib import contextmanager from ....processing_utils import ProcessorMixin class SCREAMING_SNAKE_CASE__ ( UpperCamelCase__ ): __SCREAMING_SNAKE_CASE = '''MCTCTFeatureExtractor''' __SCREAMING_SNAKE_CASE = '''AutoTokenizer''' ...
39
1
import cmath import math def _A ( SCREAMING_SNAKE_CASE__ : float , SCREAMING_SNAKE_CASE__ : float , SCREAMING_SNAKE_CASE__ : float , SCREAMING_SNAKE_CASE__ : float ): UpperCamelCase :Dict = math.radians(SCREAMING_SNAKE_CASE__ ) UpperCamelCase :...
259
import inspect import unittest from transformers import DPTConfig from transformers.file_utils import is_torch_available, is_vision_available from transformers.models.auto import get_values from transformers.testing_utils import require_torch, require_vision, slow, torch_device from ...test_configuration_commo...
259
1
def _SCREAMING_SNAKE_CASE ( ) -> list[list[int]]: return [list(range(1_000 - i , -1_000 - i , -1 ) ) for i in range(1_000 )] _UpperCAmelCase = generate_large_matrix() _UpperCAmelCase = ( [[4, 3, 2, -1], [3, 2, 1, -1], [1, 1, -1, -2], [-1, -1, ...
232
from collections import OrderedDict from typing import Any, List, Mapping, Optional from ... import PreTrainedTokenizer, TensorType, is_torch_available from ...configuration_utils import PretrainedConfig from ...onnx import OnnxConfigWithPast, PatchingSpec from ...utils import logging _UpperCAmelCase ...
232
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 ..auto import CONFIG_MAPPING A_ : Tuple = logging.get_logger(__name__) A_ ...
333
import copy import inspect import unittest from transformers import PretrainedConfig, SwiftFormerConfig from transformers.testing_utils import ( require_torch, require_vision, slow, torch_device, ) from transformers.utils import cached_property, is_torch_available, is_vision_available ...
333
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__ = version.parse(version.parse(torch.__version__).base_version) < version.parse('''1.11''') def a_ ( _...
369
'''simple docstring''' import os import tempfile from functools import partial from unittest import TestCase from unittest.mock import patch import numpy as np import pytest from datasets.arrow_dataset import Dataset from datasets.search import ElasticSearchIndex, FaissIndex, MissingIndex from .utils import...
0
0
'''simple docstring''' import logging import os import sys from dataclasses import dataclass, field from typing import Optional import evaluate import numpy as np import torch from datasets import load_dataset from PIL import Image from torchvision.transforms import ( CenterCrop, Compose, Normalize, ...
185
'''simple docstring''' import argparse from typing import Dict import tensorflow as tf import torch from tqdm import tqdm from transformers import BigBirdPegasusConfig, BigBirdPegasusForConditionalGeneration A__ : str = [ # tf -> hf ("""/""", """."""), ("""layer_""", """layers."""...
185
1
from collections import OrderedDict from typing import Any, Mapping, Optional, Union from ...configuration_utils import PretrainedConfig from ...feature_extraction_utils import FeatureExtractionMixin from ...onnx import OnnxConfig from ...onnx.utils import compute_effective_axis_dimension from ...tokeniza...
368
import sys from typing import Tuple import numpy as np import torch from PIL import Image from torch import nn from transformers.image_utils import PILImageResampling from utils import img_tensorize class lowerCamelCase : """simple docstring""" ...
191
0
"""simple docstring""" from typing import TYPE_CHECKING from ...utils import ( OptionalDependencyNotAvailable, _LazyModule, is_torch_available, ) SCREAMING_SNAKE_CASE__ = { "configuration_mega": ["MEGA_PRETRAINED_CONFIG_ARCHIVE_MAP", "MegaConfig", "MegaOnnxConfig"], } try: if...
46
'''simple docstring''' from typing import Any, Dict, List, Union 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 ..image_utils import load_image if...
319
0
from ...configuration_utils import PretrainedConfig from ...utils import logging __UpperCAmelCase = logging.get_logger(__name__) __UpperCAmelCase = { 'EleutherAI/gpt-neox-20b': 'https://huggingface.co/EleutherAI/gpt-neox-20b/resolve/main/config.json', # See all GPTNeoX models at https://h...
368
import unittest from .lib import ( Matrix, Vector, axpy, square_zero_matrix, unit_basis_vector, zero_vector, ) class __a ( unittest.TestCase ): def A ( self : List[Any] ): lowerCAmelCase_ : Dict = Vector([1, 2, 3] )...
28
0
import argparse import importlib from pathlib import Path # Test all the extensions added in the setup _lowerCAmelCase : List[str] = [ "kernels/rwkv/wkv_cuda.cu", "kernels/rwkv/wkv_op.cpp", "kernels/deformable_detr/ms_deform_attn.h", "kernels/deformable_detr/cuda/ms_deform_i...
218
from ...configuration_utils import PretrainedConfig from ...utils import logging _lowerCAmelCase : Tuple = logging.get_logger(__name__) _lowerCAmelCase : Union[str, Any] = {"ctrl": "https://huggingface.co/ctrl/resolve/main/config.json"} class __magic_name__ ( lo...
218
1
'''simple docstring''' from ...configuration_utils import PretrainedConfig from ...utils import logging _a : List[str] = logging.get_logger(__name__) _a : Union[str, Any] = { """facebook/s2t-wav2vec2-large-en-de""": ( """https://huggingface.co/facebook/s2t-wav2vec2-large-en-d...
368
'''simple docstring''' from typing import TYPE_CHECKING from ...utils import OptionalDependencyNotAvailable, _LazyModule, is_sentencepiece_available _a : Union[str, Any] = {} try: if not is_sentencepiece_available(): raise OptionalDependencyNotAvailable() except OptionalDependencyNotAvailabl...
46
0
"""simple docstring""" def SCREAMING_SNAKE_CASE__ ( __UpperCAmelCase , __UpperCAmelCase ) -> Tuple: lowercase__: Any = len(_A ) lowercase__: Tuple = len(_A ) lowercase__: List[Any] = ( first_str_length if first_str_length > second_str_length else sec...
177
import argparse import re from typing import Dict import torch from datasets import Audio, Dataset, load_dataset, load_metric from transformers import AutoFeatureExtractor, pipeline def __UpperCamelCase ( _A , _A ): lowerCAmelCase_ = args.log_outputs lowerCAmelCase_ = ...
278
0
from __future__ import annotations def __magic_name__ ( A , A = None , A = None , A = False , ) -> tuple[int, float, str]: snake_case = cipher_alphabet or [chr(A ) for i in range(9_7 , 1_2_3 )] # If the argument is None or the user provided an empty ...
371
'''simple docstring''' import os from typing import Optional import fsspec from fsspec.archive import AbstractArchiveFileSystem from fsspec.utils import DEFAULT_BLOCK_SIZE class lowerCamelCase ( __lowerCAmelCase ): snake_case_ = '''''' snake_case_ = ( None # pr...
332
0
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 ( SegformerConfig, SegformerForImageClassification, SegformerForSemant...
39
class __lowerCamelCase : """simple docstring""" def __init__( self ): """simple docstring""" _UpperCAmelCase = {} # Mapping from char to TrieNode _UpperCAmelCase = False def UpperCamelCase ( s...
39
1
from __future__ import annotations import unittest from transformers import AutoTokenizer, MBartConfig, is_tf_available from transformers.testing_utils import require_sentencepiece, require_tf, require_tokenizers, slow from transformers.utils import cached_property from ...test_configuration_common import Conf...
367
import argparse import os from pathlib import Path import fairseq import torch from packaging import version from torch import nn from transformers import ( BartConfig, BartForConditionalGeneration, BartForSequenceClassification, BartModel, BartTokenizer, ) from transformers.utils import log...
22
0
"""simple docstring""" import csv import tweepy # Twitter API credentials UpperCAmelCase_ : Union[str, Any] = """""" UpperCAmelCase_ : Any = """""" UpperCAmelCase_ : List[Any] = """""" UpperCAmelCase_ : Tuple = """""" def _A (__a ) -> Tuple: """simple...
91
from typing import TYPE_CHECKING from ...utils import ( OptionalDependencyNotAvailable, _LazyModule, is_flax_available, is_sentencepiece_available, is_tf_available, is_tokenizers_available, is_torch_available, ) if is_sentencepiece_available(): from ..ta.tokenization_ta...
59
0
import math class lowercase_ : def __init__( self , __UpperCamelCase=0 ): # a graph with Node 0,1,...,N-1 """simple docstring""" UpperCamelCase_ = n UpperCamelCase_ = [ [math.inf for j in range(0 , __UpperCamelCase ...
261
from .imports import is_rich_available if is_rich_available(): from rich.traceback import install install(show_locals=False) else: raise ModuleNotFoundError('''To use the rich extension, install rich with `pip install rich`''')
261
1
'''simple docstring''' from typing import Optional, Tuple, Union import torch from einops import rearrange, reduce from diffusers import DDIMScheduler, DDPMScheduler, DiffusionPipeline, ImagePipelineOutput, UNetaDConditionModel from diffusers.schedulers.scheduling_ddim import DDIMSchedulerOutput from diffuser...
42
import os import tempfile from functools import partial from unittest import TestCase from unittest.mock import patch import numpy as np import pytest from datasets.arrow_dataset import Dataset from datasets.search import ElasticSearchIndex, FaissIndex, MissingIndex from .utils import requi...
0
0
'''simple docstring''' A = 9.8_06_65 def lowerCAmelCase__ ( lowerCamelCase : float ,lowerCamelCase : float ,lowerCamelCase : float = g ): if fluid_density <= 0: raise ValueError('Impossible fluid density' ) if volume...
351
'''simple docstring''' from collections import OrderedDict from typing import TYPE_CHECKING, Any, List, Mapping, Optional, Union from ...configuration_utils import PretrainedConfig from ...onnx import OnnxConfig from ...utils import TensorType, logging if TYPE_CHECKING: from ...onnx.config import Patchi...
227
0
"""simple docstring""" _a = [ [0, 16, 13, 0, 0, 0], [0, 0, 10, 12, 0, 0], [0, 4, 0, 0, 14, 0], [0, 0, 9, 0, 0, 20], [0, 0, 0, 7, 0, 4], [0, 0, 0, 0, 0, 0], ] def __a ( __lowerCamelCase, __lowerCamelCase, __lowerCamelCase, __lowerCamelCase ): UpperCAmelCase...
61
from typing import TYPE_CHECKING from ...utils import ( OptionalDependencyNotAvailable, _LazyModule, is_flax_available, is_sentencepiece_available, is_tf_available, is_tokenizers_available, is_torch_available, ) _A = {"configuration_xglm": ["XGLM_PRETRAINED_CONFIG_ARCHIVE_MAP", "XG...
231
0
"""simple docstring""" from maths.is_square_free import is_square_free from maths.prime_factors import prime_factors def lowerCAmelCase (__UpperCamelCase : int ): """simple docstring""" __UpperCamelCase =prime_factors(__UpperCamelCase ) if is_square_free(__UpperCamelCase ...
85
"""simple docstring""" import itertools import json import os import unittest from transformers import AddedToken, LongformerTokenizer, LongformerTokenizerFast from transformers.models.longformer.tokenization_longformer import VOCAB_FILES_NAMES from transformers.testing_utils import require_tokenizers, slow ...
85
1
"""simple docstring""" import enum import warnings from ..tokenization_utils import TruncationStrategy from ..utils import add_end_docstrings, is_tf_available, is_torch_available, logging from .base import PIPELINE_INIT_ARGS, Pipeline if is_tf_available(): import tensorflow as tf f...
84
'''simple docstring''' import absl # noqa: F401 # Here to have a nice missing dependency error message early on import nltk # noqa: F401 # Here to have a nice missing dependency error message early on import numpy # noqa: F401 # Here to have a nice missing dependency error message early on import six...
28
0
import copy from ...configuration_utils import PretrainedConfig from ...utils import logging __UpperCAmelCase = logging.get_logger(__name__) class __a ( lowerCamelCase__ ): __snake_case : Dict = 'encoder-decoder' __snake_case : int = True ...
356
import argparse import json from pathlib import Path import requests import torch from huggingface_hub import hf_hub_download from PIL import Image from transformers import ViTConfig, ViTForImageClassification, ViTImageProcessor, ViTModel from transformers.utils import logging logging.set_verbosity_info() __U...
28
0
"""simple docstring""" from ...configuration_utils import PretrainedConfig from ...utils import logging UpperCamelCase : Any = logging.get_logger(__name__) UpperCamelCase : Dict = { "google/pegasus-large": "https://huggingface.co/google/pegasus-large/resolve/main/config.json", # See all PEGASUS m...
316
"""simple docstring""" import argparse from pathlib import Path import torch from packaging import version from torch.onnx import export from diffusers import AutoencoderKL UpperCamelCase : Union[str, Any] = version.parse(version.parse(torch.__version__).base_version) < version.parse("1.11") def ...
316
1
# Lint as: python3 import itertools import os import re SCREAMING_SNAKE_CASE :Optional[int] = re.compile(R'([A-Z]+)([A-Z][a-z])') SCREAMING_SNAKE_CASE :Optional[int] = re.compile(R'([a-z\d])([A-Z])') SCREAMING_SNAKE_CASE :List[str] = re.compile(R'(?<!_)_(?!_)') ...
356
import numpy class UpperCAmelCase : '''simple docstring''' def __init__( self : List[str] ,A : numpy.ndarray ,A : numpy.ndarray ): __A = input_array # Random initial weights are assigned where first argument is the # number of nodes in previou...
124
0