code
stringlengths
82
53.2k
code_codestyle
int64
0
721
style_context
stringlengths
91
41.9k
style_context_codestyle
int64
0
699
label
int64
0
1
import os import pytest import yaml from datasets.features.features import Features, Value from datasets.info import DatasetInfo, DatasetInfosDict @pytest.mark.parametrize( 'files' , [ ['full:README.md', 'dataset_infos.json'], ['empty:README.md', 'dataset_infos.json'], ['datase...
410
import gc import unittest import numpy as np import torch from transformers import CLIPTextConfig, CLIPTextModel, CLIPTokenizer from diffusers import ( AutoencoderKL, DDIMScheduler, StableDiffusionAttendAndExcitePipeline, UNetaDConditionModel, ) from diffusers.utils import load_numpy, skip_mps, slow ...
410
1
"""simple docstring""" from __future__ import annotations from collections import Counter from random import random class a : """simple docstring""" def __init__( self ) -> Any: _UpperCAmelCase = {} def __A ( self ,...
717
"""simple docstring""" import argparse import json from collections import OrderedDict from functools import partial from pathlib import Path import timm import torch from huggingface_hub import hf_hub_download from transformers import LevitConfig, LevitForImageClassificationWithTeacher, LevitImageProcessor fro...
579
0
A_ : Optional[int] = [0, 2, 4, 6, 8] A_ : List[Any] = [1, 3, 5, 7, 9] def __a ( SCREAMING_SNAKE_CASE , SCREAMING_SNAKE_CASE , SCREAMING_SNAKE_CASE , SCREAMING_SNAKE_CASE ) -> int: '''simple docstring''' if remaining_length == 0:...
303
from __future__ import annotations def __a ( SCREAMING_SNAKE_CASE , SCREAMING_SNAKE_CASE ) -> list[str]: '''simple docstring''' if nth_term == "": return [""] __UpperCAmelCase = int(SCREAMING_SNAKE_CASE ) __UpperCAmelCase ...
303
1
import gc import unittest import numpy as np import torch from transformers import CLIPTextConfig, CLIPTextModel, CLIPTokenizer from diffusers import TransformeraDModel, VQDiffusionPipeline, VQDiffusionScheduler, VQModel from diffusers.pipelines.vq_diffusion.pipeline_vq_diffusion import LearnedC...
205
from multiprocessing import Lock, Pipe, Process # lock used to ensure that two processes do not access a pipe at the same time snake_case_ : Optional[Any] =Lock() def UpperCAmelCase ( lowerCAmelCase__ , lowerCAmelCase__ , lowerCAmelCase__ , lowerCAmelCase_...
205
1
def a__ ( __UpperCamelCase , __UpperCamelCase ): while second != 0: SCREAMING_SNAKE_CASE_ = first & second first ^= second SCREAMING_SNAKE_CASE_ = c << 1 return first if __name__ == "__main__": import doctest doctest.testmod() A : ...
140
def a__ ( __UpperCamelCase ): if length <= 0 or not isinstance(__UpperCamelCase , __UpperCamelCase ): raise ValueError("Length must be a positive integer." ) return [n * (2 * n - 1) for n in range(__UpperCamelCase )] if __name__ == "__main__": print(hexagonal_num...
140
1
from collections import OrderedDict from typing import Mapping from packaging import version from ...configuration_utils import PretrainedConfig from ...onnx import OnnxConfig from ...utils import logging from ...utils.backbone_utils import BackboneConfigMixin, get_aligned_output_features_output_ind...
298
import unittest from transformers import is_flax_available from transformers.testing_utils import require_flax, require_sentencepiece, require_tokenizers, require_torch, slow if is_flax_available(): import optax from flax.training.common_utils import onehot from transformers im...
298
1
'''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 a : List[Any] = logging.get_logger(__name__) a : Union[str, Any]...
679
'''simple docstring''' import re from pathlib import Path from unittest import TestCase import pytest @pytest.mark.integration class UpperCamelCase__ ( lowercase__ ): """simple docstring""" def A_ ( self , snake_case ): '''simple docstring''' with open...
679
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, is_vision_available, ) a= { '''configuration_owlvit''': [ '''OWLVIT_PRE...
287
'''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 a= logging.get_logger(__name__) class __lowercase ( _...
287
1
"""simple docstring""" from __future__ import annotations def lowerCamelCase ( _snake_case ,_snake_case = None ,_snake_case = None ): if start is None: UpperCAmelCase__ : List[str] = 0 if end is None: UpperCAmelCase__ : str = len(_sna...
110
import os import sys import tempfile import unittest import unittest.mock as mock from pathlib import Path from huggingface_hub import HfFolder, delete_repo from huggingface_hub.file_download import http_get from requests.exceptions import HTTPError from transformers import ( AlbertTokenizer, AutoTokenize...
106
0
from __future__ import annotations import numpy as np from numpy import floataa from numpy.typing import NDArray def __lowercase ( _UpperCAmelCase , _UpperCAmelCase , _UpperCAmelCase , _UpperCAmelCase , ) -> list[float]: '''simple docstring''' __lowercase , __lowercase =...
711
from dataclasses import dataclass from typing import Optional, Tuple import torch from torch import nn from transformers import RobertaPreTrainedModel, XLMRobertaConfig, XLMRobertaModel from transformers.utils import ModelOutput @dataclass class snake_case ( __snake_case ): """simple docstring""" ...
576
0
"""simple docstring""" import argparse import json import subprocess def _lowerCamelCase ( _UpperCamelCase , _UpperCamelCase ): '''simple docstring''' __lowerCAmelCase = [] __lowerCAmelCase = ( f"curl -H \"Accept: application/vnd.github+...
636
import time import unittest from transformers import is_torch_available from transformers.testing_utils import require_torch, torch_device from ..test_modeling_common import ids_tensor if is_torch_available(): import torch from transformers.generation import ( MaxLengthCriteria, Ma...
678
0
"""simple docstring""" import copy import os from typing import Union from ...configuration_utils import PretrainedConfig from ...utils import logging UpperCAmelCase =logging.get_logger(__name__) UpperCAmelCase ={ "Salesforce/blip-vqa-base": "https://huggingface.co/Salesforce/b...
717
"""simple docstring""" from abc import ABC, abstractmethod from typing import Optional, Union from .. import Dataset, DatasetDict, Features, IterableDataset, IterableDatasetDict, NamedSplit from ..utils.typing import NestedDataStructureLike, PathLike class lowerCamelCase__ ( SCREAMIN...
255
0
"""simple docstring""" from collections import OrderedDict from typing import TYPE_CHECKING, Any, Mapping, Optional from ...configuration_utils import PretrainedConfig from ...onnx import OnnxConfig from ...utils import logging if TYPE_CHECKING: from ... import FeatureExtractionMixin, Te...
359
"""simple docstring""" from __future__ import annotations def UpperCAmelCase__ ( lowerCAmelCase__ :dict , lowerCAmelCase__ :str ) -> set[str]: '''simple docstring''' lowercase , lowercase = set(lowerCAmelCase__ ), [start] ...
359
1
'''simple docstring''' from random import randint from tempfile import TemporaryFile import numpy as np def __UpperCAmelCase ( _UpperCAmelCase : Optional[int] , _UpperCAmelCase : Tuple , _UpperCAmelCase : Any ) -> str: __snake_case = 0 if start...
680
'''simple docstring''' from typing import TYPE_CHECKING from ...utils import ( OptionalDependencyNotAvailable, _LazyModule, is_torch_available, ) a : str = { '''configuration_gpt_bigcode''': ['''GPT_BIGCODE_PRETRAINED_CONFIG_ARCHIVE_MAP''', '''GPTBigCodeConfig'''],...
680
1
def lowerCamelCase__ ( _lowercase ): '''simple docstring''' UpperCAmelCase_ : List[str] = len(_lowercase ) for _ in range(_lowercase ): for i in range(_ % 2 , arr_size - 1 , 2 ): if arr[i + 1] < arr[i]: UpperCAmelCase_, ...
30
"""simple docstring""" import gc import random import unittest import numpy as np import torch from diffusers import ( DDIMScheduler, KandinskyVaaControlnetPipeline, KandinskyVaaPriorPipeline, UNetaDConditionModel, VQModel, ) from diffusers.utils import floats_tensor, load_image, load_num...
499
0
import copy import os from typing import Union from ...configuration_utils import PretrainedConfig from ...utils import logging __lowerCAmelCase = logging.get_logger(__name__) __lowerCAmelCase = { "Salesforce/blip-vqa-base": "https://huggingface.co/Salesforce/blip-vqa-base/res...
705
import inspect import unittest from transformers import YolosConfig from transformers.testing_utils import require_torch, require_vision, slow, torch_device from transformers.utils import cached_property, is_torch_available, is_vision_available from ...test_configuration_common import ConfigTester from ...
129
0
from .glue import GlueDataset, GlueDataTrainingArguments from .language_modeling import ( LineByLineTextDataset, LineByLineWithRefDataset, LineByLineWithSOPTextDataset, TextDataset, TextDatasetForNextSentencePrediction, ) from .squad import SquadDataset, SquadDataTrainingArgume...
79
"""simple docstring""" from typing import TYPE_CHECKING from ...utils import OptionalDependencyNotAvailable, _LazyModule, is_tokenizers_available, is_torch_available _A = { 'configuration_squeezebert': [ 'SQUEEZEBERT_PRETRAINED_CONFIG_ARCHIVE_MAP', 'SqueezeBertConf...
159
0
"""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 r...
554
"""simple docstring""" from math import ceil def __lowerCamelCase ( lowerCAmelCase__ ,lowerCAmelCase__ ): A__ = list(range(0 ,lowerCAmelCase__ ) ) A__ = [item for sublist in list(device_map.values() ) for item in su...
554
1
from ..utils import DummyObject, requires_backends class __a( metaclass=_a ): """simple docstring""" lowerCAmelCase = ['''torch''', '''torchsde'''] def __init__( self ,*_SCREAMING_SNAKE_CASE ,**_SCREAMING_SNAKE_CASE ) -> Union[str, Any]: requires_bac...
30
"""simple docstring""" import inspect import unittest from typing import List import numpy as np from transformers import EfficientFormerConfig from transformers.testing_utils import require_tf, require_vision, slow from transformers.utils import cached_property, is_tf_available, is_vision_available from ...t...
621
0
'''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_image_inputs if i...
43
'''simple docstring''' def __lowerCamelCase ( _UpperCamelCase : str , _UpperCamelCase : list[str] ): '''simple docstring''' UpperCAmelCase_ = '''''' for word_or_phrase in separated: if not isinstance(_UpperCamelCase , _UpperCamelCase ...
43
1
import doctest import logging import os import unittest from pathlib import Path from typing import List, Union import transformers from transformers.testing_utils import require_tf, require_torch, slow __A = logging.getLogger() @unittest.skip('Temporarily disable the doc tests.' ) @require_torch @r...
68
'''simple docstring''' from ...configuration_utils import PretrainedConfig from ...utils import logging lowerCAmelCase__ = logging.get_logger(__name__) lowerCAmelCase__ = { 'facebook/dpr-ctx_encoder-single-nq-base': ( 'https://huggingface.co/facebook/dpr...
596
0
from __future__ import annotations def _UpperCAmelCase ( a : str , a : list[str] | None = None ): snake_case__ = word_bank or [] # create a table snake_case__ = len(a ) + 1 snake_case__ = [] for _ in range(a ): table.appe...
99
import argparse import random import joblib import numpy as np import torch from igf.igf import ( SecondaryLearner, collect_objective_set, compute_perplexity, generate_datasets, load_gpta, recopy_gpta, set_seed, train_secondary_learner, ) from torch.utils.data import DataLoader, ...
99
1
"""simple docstring""" from typing import Dict, List, Optional, Tuple, Union import numpy as np from ...image_processing_utils import BaseImageProcessor, BatchFeature, get_size_dict from ...image_transforms import ( center_crop, flip_channel_order, get_resize_output_image_size, rescale, re...
595
"""simple docstring""" import collections import os from typing import List, Optional, Tuple from transformers.utils import is_jieba_available, requires_backends if is_jieba_available(): import jieba from ...tokenization_utils import PreTrainedTokenizer from ...utils import logging snake_case_ : Union[st...
595
1
import numpy as np import skfuzzy as fuzz if __name__ == "__main__": # Create universe of discourse in Python using linspace () SCREAMING_SNAKE_CASE_ = np.linspace(start=0, stop=7_5, num=7_5, endpoint=True, retstep=False) # Create two fuzzy sets by defining any membership fu...
116
from ...configuration_utils import PretrainedConfig from ...utils import logging SCREAMING_SNAKE_CASE_ = logging.get_logger(__name__) SCREAMING_SNAKE_CASE_ = { """google/pegasus-large""": """https://huggingface.co/google/pegasus-large/resolve/main/config.json""", # See all PEG...
116
1
from __future__ import annotations from math import pi, sqrt def __UpperCamelCase (_SCREAMING_SNAKE_CASE , _SCREAMING_SNAKE_CASE ) -> tuple: if inductance <= 0: raise ValueError('Inductance cannot be 0 or negative' ) elif capacitance <= 0: raise...
235
from unittest import TestCase from datasets import Dataset from minhash_deduplication import deduplicate_dataset, make_duplicate_clusters def __UpperCamelCase () -> Optional[Any]: lowercase__ = { 'repo_name': ['test_repo1', 'test_repo2', 'test_repo3'], ...
235
1
'''simple docstring''' import numpy as np import torch from torch.nn import CrossEntropyLoss from transformers import AutoModelForCausalLM, AutoTokenizer import datasets from datasets import logging SCREAMING_SNAKE_CASE_ = "\\n\n" SCREAMING_SNAKE_CASE_ = "\nPerplexity (PPL) is one of the m...
712
'''simple docstring''' import unittest from transformers import ( MODEL_FOR_SEQUENCE_CLASSIFICATION_MAPPING, TF_MODEL_FOR_SEQUENCE_CLASSIFICATION_MAPPING, TextClassificationPipeline, pipeline, ) from transformers.testing_utils import is_pipeline_test, nested_simplify, require_tf, require_torc...
201
0
from typing import Any def snake_case (UpperCAmelCase__ , UpperCAmelCase__ , UpperCAmelCase__ , UpperCAmelCase__ , UpperCAmelCase__ , ) -> list: _validation( UpperCAmelCase__ , UpperCAmelCase__ , UpperC...
57
'''simple docstring''' from __future__ import annotations import unittest from transformers import is_tf_available from transformers.testing_utils import require_sentencepiece, require_tf, require_tokenizers, slow if is_tf_available(): import numpy as np import tensorflow as tf fro...
638
0
'''simple docstring''' from __future__ import annotations def UpperCAmelCase ( lowerCamelCase_ :int = 4 ): '''simple docstring''' snake_case_ : Union[str, Any] = abs(__snake_case ) or 4 return [[1 + x + y * row_size for x in range(__snake_case )] for y in ra...
713
'''simple docstring''' def UpperCAmelCase ( lowerCamelCase_ :str ): '''simple docstring''' return " ".join( """""".join(word[::-1] ) if len(lowerCamelCase_ ) > 4 else word for word in sentence.split() ) if __name__ == "__main__": import doctest doctest.testmod() ...
267
0
from pathlib import Path import numpy as np from PIL import Image def A__ ( SCREAMING_SNAKE_CASE_ : np.ndarray ) -> np.ndarray: """simple docstring""" _UpperCAmelCase , _UpperCAmelCase , _UpperCAmelCase = rgb[:, :, 0], rgb[:, :, 1],...
32
def lowerCamelCase__ ( _a): if not isinstance(_a , _a): SCREAMING_SNAKE_CASE : Tuple = f"Input value of [number={number}] must be an integer" raise TypeError(_a) if number < 0: return False SCREAMING_SNAKE_CASE : Union[str, Any] = number * number while number >...
25
0
"""simple docstring""" import numpy as np from numpy import ndarray from scipy.optimize import Bounds, LinearConstraint, minimize def __UpperCamelCase ( snake_case__ ): return np.dot(a_ , a_ ) class SCREAMING_SNAKE_CASE : """simple docstring""" def __init__(self , ...
705
"""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 = ...
480
0
'''simple docstring''' from typing import TYPE_CHECKING from ...utils import OptionalDependencyNotAvailable, _LazyModule, is_torch_available lowercase__ : Tuple = { 'configuration_swinv2': ['SWINV2_PRETRAINED_CONFIG_ARCHIVE_MAP', 'Swinv2Config'], } try: if not is_torch_available(): ...
98
"""simple docstring""" import warnings from contextlib import contextmanager from ...processing_utils import ProcessorMixin class a ( UpperCAmelCase__ ): UpperCamelCase : Any = 'Speech2TextFeatureExtractor' UpperCamelCase : Optional[Any] = 'S...
409
0
'''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 : List[str] = { '''configuration_spe...
713
'''simple docstring''' import os from math import logaa def __UpperCAmelCase ( _UpperCAmelCase : str = "base_exp.txt" ) -> int: __snake_case = 0 __snake_case = 0 for i, line in enumerate(open(os.path.join(os.path.dirname(_UpperCAmelCase ) , _UpperCAmelCase )...
680
0
'''simple docstring''' import unittest from accelerate import debug_launcher from accelerate.test_utils import require_cpu, test_ops, test_script @require_cpu class snake_case__ ( unittest.TestCase): def A ( self : int ) -> Optional[int]: debug_launcher(...
541
'''simple docstring''' import collections import os import re from pathlib import Path _UpperCamelCase : Optional[int] = 'src/transformers' # Matches is_xxx_available() _UpperCamelCase : int = re.compile(R'is\_([a-z_]*)_available()') # Catches a one-line _import_struct = {x...
541
1
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 = {'vocab_fi...
185
from typing import Any class lowerCamelCase__ : """simple docstring""" def __init__( self , snake_case ): '''simple docstring''' UpperCamelCase__ = data UpperCamelCase__ = None class lowerCamelCase__ : ...
185
1
"""simple docstring""" import json from typing import Dict, List, Optional, Tuple, Union from tokenizers import pre_tokenizers, processors from ...tokenization_utils_base import AddedToken, BatchEncoding, EncodedInput from ...tokenization_utils_fast import PreTrainedTokenizerFast from ...utils import Padd...
642
'''simple docstring''' from __future__ import annotations from collections import namedtuple from dataclasses import dataclass @dataclass class __lowerCamelCase : """simple docstring""" a = 42 a = None a = None A : Optional[Any] = na...
128
0
'''simple docstring''' from decimal import Decimal, getcontext from math import ceil, factorial def lowerCamelCase ( UpperCAmelCase__ : int ) -> str: if not isinstance(UpperCAmelCase__ , UpperCAmelCase__ ): raise TypeError("""Undefined for non-integers""" ...
717
'''simple docstring''' import argparse import os from io import BytesIO from pathlib import Path import requests from clip_retrieval.clip_client import ClipClient from PIL import Image from tqdm import tqdm def lowerCamelCase ( UpperCAmelCase__ : Union[str, Any] , UpperCAmelCase__ : in...
30
0
import numpy as np # Importing the Keras libraries and packages import tensorflow as tf from tensorflow.keras import layers, models if __name__ == "__main__": # Initialising the CNN # (Sequential- Building the model layer by layer) __lowerCAmelCase =models.Sequential() # Step 1 - Convolution...
333
import os import pytest from datasets import ( get_dataset_config_info, get_dataset_config_names, get_dataset_infos, get_dataset_split_names, inspect_dataset, inspect_metric, ) __lowerCAmelCase =pytest.mark.integration @pytest.mark.parametrize("path" , ["paws", "csv"] ) def ...
333
1
'''simple docstring''' # Logistic Regression from scratch # In[62]: # In[63]: # importing all the required libraries import numpy as np from matplotlib import pyplot as plt from sklearn import datasets def __UpperCamelCase( _A : str ): '''simple docstring''' return 1 / (1 + np.exp(-z ))...
496
'''simple docstring''' import argparse import json import os import numpy as np import PIL import requests import tensorflow.keras.applications.efficientnet as efficientnet import torch from huggingface_hub import hf_hub_download from PIL import Image from tensorflow.keras.preprocessing import image from transformer...
496
1
from typing import TYPE_CHECKING from ...utils import OptionalDependencyNotAvailable, _LazyModule, is_torch_available, is_vision_available _lowerCamelCase : Optional[Any] = { """configuration_pix2struct""": [ """PIX2STRUCT_PRETRAINED_CONFIG_ARCHIVE_MAP""", """Pix2StructConfi...
87
from __future__ import annotations import requests def SCREAMING_SNAKE_CASE ( lowercase_ ) -> dict: """simple docstring""" A__ = f"""https://hacker-news.firebaseio.com/v0/item/{story_id}.json?print=pretty""" return requests.get(lowercase_ ).json() def...
87
1
from string import ascii_uppercase lowercase__ :List[Any] = {str(ord(c) - 55): c for c in ascii_uppercase} def UpperCamelCase ( lowerCAmelCase__ , lowerCAmelCase__ ): '''simple docstring''' if isinstance(snake_case_ , snake_case_ ): raise TypeError('''int() c...
703
import warnings from diffusers import StableDiffusionInpaintPipeline as StableDiffusionInpaintPipeline # noqa F401 warnings.warn( "The `inpainting.py` script is outdated. Please use directly `from diffusers import" " StableDiffusionInpaintPipeline` instead." )
633
0
'''simple docstring''' from __future__ import annotations from typing import Any class A_ : def __init__( self : int , snake_case_ : int , snake_case_ : int , snake_case_ : float = 0 ): _UpperCAmelCase = row, c...
236
'''simple docstring''' # Copyright 2021 The HuggingFace Team. All rights reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-...
125
0
import os def lowerCamelCase__ (): _SCREAMING_SNAKE_CASE : Any = os.path.dirname(os.path.realpath(__lowerCamelCase ) ) _SCREAMING_SNAKE_CASE : Tuple = os.path.join(__lowerCamelCase, "triangle.txt" ) with open(__lowerCamelCase ) as f: ...
381
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_bark import ( BarkCoarseConfig, ...
381
1
"""simple docstring""" import shutil import tempfile import unittest from transformers import SPIECE_UNDERLINE, BatchEncoding, MBartaaTokenizer, MBartaaTokenizerFast, is_torch_available from transformers.testing_utils import ( get_tests_dir, nested_simplify, require_sentencepiece, require_to...
227
"""simple docstring""" import argparse import datetime def UpperCAmelCase ( snake_case : str ): _lowerCAmelCase:Dict = { '''0''': '''Sunday''', '''1''': '''Monday''', '''2''': '''Tuesday''', '''3''': '''Wednesday''', '''4''': ''...
227
1
"""simple docstring""" 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, ) UpperCAmelCase__ = {"""configuration_mbart""...
275
"""simple docstring""" from unittest.mock import patch import pyspark from datasets.packaged_modules.spark.spark import ( Spark, SparkExamplesIterable, _generate_iterable_examples, ) from ..utils import ( require_dill_gt_0_3_2, require_not_windows, ) def __UpperCAmelCase ( lower...
275
1
import collections import inspect import unittest from transformers import FocalNetConfig 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 BackboneT...
32
'''simple docstring''' import unittest from transformers import load_tool from .test_tools_common import ToolTesterMixin class __lowerCAmelCase ( unittest.TestCase , lowercase ): """simple docstring""" def _UpperCAmelCase ( self : List[str] ): ...
452
0
"""simple docstring""" import math_equivalence # From: git+https://github.com/hendrycks/math.git import datasets _A = """\ @article{hendrycksmath2021, title={Measuring Mathematical Problem Solving With the MATH Dataset}, author={Dan Hendrycks and Collin Burns and Saurav Ka...
710
"""simple docstring""" from math import isqrt def lowercase_ ( __UpperCAmelCase ) -> bool: return all(number % divisor != 0 for divisor in range(2 , isqrt(__UpperCAmelCase ) + 1 ) ) def lowercase_ ( __UpperCAmelCase = 10**6 ) -> int: lowerCAmelCase__ ...
507
0
'''simple docstring''' from diffusers.utils.testing_utils import require_onnxruntime @require_onnxruntime class a_ : pass
263
'''simple docstring''' import argparse import os import torch from transformers import ( XLNetConfig, XLNetForQuestionAnswering, XLNetForSequenceClassification, XLNetLMHeadModel, load_tf_weights_in_xlnet, ) from transformers.utils import CONFIG_NAME, WEIGHTS_NAME, logging lowercase__ ...
263
1
import argparse import json import os import torch from torch import nn from transformers import NllbMoeConfig, NllbMoeModel from transformers.modeling_utils import dtype_byte_size from transformers.utils import WEIGHTS_INDEX_NAME, WEIGHTS_NAME def a ( snake_case__: Optional[int...
409
import inspect import unittest from huggingface_hub import hf_hub_download from transformers import ASTConfig from transformers.testing_utils import require_torch, require_torchaudio, slow, torch_device from transformers.utils import cached_property, is_torch_available, is_torchaudio_available from ...tes...
409
1
import unittest import numpy as np from transformers import is_flax_available from transformers.testing_utils import require_flax from ..test_modeling_flax_common import ids_tensor if is_flax_available(): import jax import jax.numpy as jnp from transformers.generation import ( Fla...
105
import os import pytest from datasets import ( get_dataset_config_info, get_dataset_config_names, get_dataset_infos, get_dataset_split_names, inspect_dataset, inspect_metric, ) UpperCamelCase__ : List[Any] = pytest.mark.integration @pytest.mark.parametrize('path' , ...
105
1
'''simple docstring''' import math_equivalence # From: git+https://github.com/hendrycks/math.git import datasets __lowerCamelCase : Any = """\ @article{hendrycksmath2021, title={Measuring Mathematical Problem Solving With the MATH Dataset}, author={Dan Hendrycks and Collin Bur...
701
'''simple docstring''' from sklearn.metrics import fa_score, matthews_corrcoef import datasets from .record_evaluation import evaluate as evaluate_record __lowerCamelCase : Union[str, Any] = """\ @article{wang2019superglue, title={SuperGLUE: A Stickier Benchmark for General-Purpose ...
418
0
import argparse import json import os import re import shutil import torch from transformers import BioGptConfig, BioGptForCausalLM from transformers.models.biogpt.tokenization_biogpt import VOCAB_FILES_NAMES from transformers.tokenization_utils_base import TOKENIZER_CONFIG_FILE from transformers.utils import WEIGH...
214
import warnings from ...utils import logging from .image_processing_beit import BeitImageProcessor lowerCAmelCase : int = logging.get_logger(__name__) class SCREAMING_SNAKE_CASE__ ( __a ): '''simple docstring''' def __init__( self : Tuple , *low...
214
1
from ...configuration_utils import PretrainedConfig from ...utils import logging lowerCAmelCase : int =logging.get_logger(__name__) lowerCAmelCase : str ={ 'facebook/dpr-ctx_encoder-single-nq-base': ( 'https://huggingface.co/facebook/dpr-ctx_encoder-single-...
693
import pytest import requests from datasets.utils.file_utils import http_head from .utils import OfflineSimulationMode, RequestWouldHangIndefinitelyError, offline @pytest.mark.integration def _UpperCAmelCase ( ): '''simple docstring''' with offline(O...
693
1
__UpperCAmelCase = [4, 1, 7, 4, 2, 6, 4, 1, 5, 3, 7, 5] __UpperCAmelCase = [3, 7, 7, 4, 2, 6, 4, 1, 5, 3, 7, 5] __UpperCAmelCase = { 0: '''Sunday''', 1: '''Monday''', 2: '''Tuesday''', 3: '''Wednesday''', 4: '''Thursday''', 5: '''Friday''', 6: '''Saturday''', } def ...
40
'''simple docstring''' from typing import TYPE_CHECKING from ...utils import OptionalDependencyNotAvailable, _LazyModule, is_torch_available, is_vision_available a_ = { 'configuration_bridgetower': [ 'BRIDGETOWER_PRETRAINED_CONFIG_ARCHIVE_MAP', 'BridgeTowerConfi...
296
0
"""simple docstring""" from typing import TYPE_CHECKING from ...utils import OptionalDependencyNotAvailable, _LazyModule, is_tokenizers_available, is_torch_available lowerCamelCase__ : Any = { "configuration_biogpt": ["BIOGPT_PRETRAINED_CONFIG_ARCHIVE_MAP", "BioGptConfig"], "tokeniza...
18
"""simple docstring""" 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, OnnxSeqaSeqCon...
18
1
'''simple docstring''' from .testing import ( are_the_same_tensors, execute_subprocess_async, require_bnb, require_cpu, require_cuda, require_huggingface_suite, require_mps, require_multi_gpu, require_multi_xpu, require_safetensors, require_single_gpu, requ...
638
'''simple docstring''' import datasets from .evaluate import evaluate lowercase__ = "\\n@article{hendrycks2021cuad,\n title={CUAD: An Expert-Annotated NLP Dataset for Legal Contract Review},\n author={Dan Hendrycks and Collin Burns and Anya Chen and Spencer Ball},\n journal={a...
638
1
'''simple docstring''' def a ( lowerCamelCase__ ): '''simple docstring''' A_ : Any = False while is_sorted is False: # Until all the indices are traversed keep looping A_ : List[Any] = True for i in range(0 , len(lowerCamelCase__ ) - 1 , 2 ): # ...
686
'''simple docstring''' import multiprocessing import os from typing import BinaryIO, Optional, Union import fsspec from .. import Dataset, Features, NamedSplit, config from ..formatting import query_table from ..packaged_modules.json.json import Json from ..utils import logging from ..utils.typing import Nest...
686
1
from ...configuration_utils import PretrainedConfig from ...utils import logging lowercase_ = logging.get_logger(__name__) lowercase_ = { 'google/pegasus-large': 'https://huggingface.co/google/pegasus-large/resolve/main/config.json', # See all PEGASUS models at https://huggingf...
669
import warnings from transformers import AutoTokenizer from transformers.utils import is_torch_available from transformers.utils.generic import ExplicitEnum from ...processing_utils import ProcessorMixin if is_torch_available(): import torch class A_ ( __UpperCamelCase ): '''simpl...
669
1
import argparse import json import os import numpy as np import PIL import requests import tensorflow.keras.applications.efficientnet as efficientnet import torch from huggingface_hub import hf_hub_download from PIL import Image from tensorflow.keras.preprocessing import image from transformers import ( Effici...
152
import os from shutil import copyfile from typing import List, Optional, Tuple from tokenizers import processors from ...tokenization_utils import AddedToken, BatchEncoding from ...tokenization_utils_fast import PreTrainedTokenizerFast from ...utils import is_sentencepiece_available, logging if is_sentencepiece_...
152
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 # T...
11
from __future__ import annotations def __lowerCAmelCase ( A , A ): UpperCAmelCase_ = [] UpperCAmelCase_ = [] UpperCAmelCase_ = 0 UpperCAmelCase_ = sum(A ) create_state_space_tree(A , A , A , A , ...
162
0
'''simple docstring''' from unittest.mock import Mock, patch from file_transfer.send_file import send_file @patch("socket.socket" ) @patch("builtins.open" ) def __A ( a_ : Union[str, Any] ,a_ : int ): # ===== initialization ===== lowerCAmelCase : Optional[i...
551
'''simple docstring''' from __future__ import annotations lowerCAmelCase = [] def __A ( a_ : list[list[int]] ,a_ : int ,a_ : int ): for i in range(len(a_ ) ): if board[row][i] == 1: return False for i in range(len(a_ ) ): if b...
551
1
"""simple docstring""" import unittest from typing import Tuple import torch from diffusers.utils import floats_tensor, randn_tensor, torch_all_close, torch_device from diffusers.utils.testing_utils import require_torch @require_torch class a : """simple docstring""" @property...
426
import unittest from knapsack import greedy_knapsack as kp class _A ( unittest.TestCase ): def __a ( self : List[Any] ) -> Optional[int]: """simple docstring""" lowercase : Dict = [10, 20, 30, 40, ...
217
0
from typing import TYPE_CHECKING from ...utils import ( OptionalDependencyNotAvailable, _LazyModule, is_tf_available, is_tokenizers_available, is_torch_available, ) _UpperCamelCase: Dict ={ 'configuration_longformer': [ 'LONGFORMER_PRETRAINED_CONFIG_ARCHIVE_MAP', 'Longf...
706
import json import os import shutil import tempfile import unittest import numpy as np import pytest from transformers import CLIPTokenizer, CLIPTokenizerFast from transformers.models.clip.tokenization_clip import VOCAB_FILES_NAMES from transformers.testing_utils import require_vision from transformers.utils import ...
585
0
import os import re import sys import traceback import warnings from pathlib import Path from typing import Dict, Optional, Union from uuid import uuida from huggingface_hub import HfFolder, ModelCard, ModelCardData, hf_hub_download, whoami from huggingface_hub.file_download import REGEX_COMMIT_HASH from huggingface_h...
321
"""simple docstring""" from __future__ import annotations def __UpperCAmelCase ( __UpperCamelCase = 4 ): __lowercase : Dict = abs(__UpperCamelCase ) or 4 return [[1 + x + y * row_size for x in range(__UpperCamelCase )] for y in range(__UpperCamelCase )]...
76
0
'''simple docstring''' from __future__ import annotations import unittest from transformers import is_tf_available from transformers.testing_utils import require_sentencepiece, require_tf, require_tokenizers, slow from ...test_configuration_common import ConfigTester from ...test_modeling_tf_common import TF...
707
import argparse from diffusers.pipelines.stable_diffusion.convert_from_ckpt import download_controlnet_from_original_ckpt if __name__ == "__main__": snake_case__ : List[Any] = argparse.ArgumentParser() parser.add_argument( '--checkpoint_path', default=None, type=str, requi...
171
0
from collections import OrderedDict from typing import List, Mapping from packaging import version from ...configuration_utils import PretrainedConfig from ...onnx import OnnxConfig from ...utils import logging __a: Dict = logging.get_logger(__name__) __a: Optional[int] = { ...
108
'''simple docstring''' from __future__ import annotations import unittest from transformers import DistilBertConfig, is_tf_available from transformers.testing_utils import require_tf, slow from ...test_configuration_common import ConfigTester from ...test_modeling_tf_common import TFModelTeste...
601
0
import html from ...feature_extraction_utils import BatchFeature, FeatureExtractionMixin from ...utils import is_bsa_available, logging, requires_backends if is_bsa_available(): import bsa from bsa import BeautifulSoup UpperCamelCase = logging.get_logger(__name...
701
import gc import random import unittest import numpy as np import torch from PIL import Image from transformers import CLIPTextConfig, CLIPTextModel, CLIPTokenizer from diffusers import ( AutoencoderKL, DDIMScheduler, EulerAncestralDiscreteScheduler, LMSDiscreteScheduler, PNDMScheduler, ...
383
0
from argparse import ArgumentParser from ..pipelines import Pipeline, PipelineDataFormat, get_supported_tasks, pipeline from ..utils import logging from . import BaseTransformersCLICommand __SCREAMING_SNAKE_CASE : Union[str, Any] =logging.get_logger(__name__) # pylint: disable=invalid-name ...
428
import gc import random import unittest import numpy as np import torch from PIL import Image from diffusers import ( DDIMScheduler, KandinskyVaaInpaintPipeline, KandinskyVaaPriorPipeline, UNetaDConditionModel, VQModel, ) from diffusers.utils import floats_tensor, load_image, load_numpy, slo...
428
1
from jiwer import compute_measures import datasets a_ = """\ @inproceedings{inproceedings, author = {Morris, Andrew and Maier, Viktoria and Green, Phil}, year = {2004}, month = {01}, pages = {}, title = {From WER and RIL to MER and WIL: improved evaluation measures for connected speech...
286
from ..utils import DummyObject, requires_backends class UpperCAmelCase__ ( metaclass=snake_case ): """simple docstring""" lowerCAmelCase__ : List[str] = ['transformers', 'torch', 'note_seq'] def __init__( self: List[str] , *__lowerCAmelCase: Optional[int] , **...
286
1
"""simple docstring""" from statistics import mean, stdev def __snake_case ( SCREAMING_SNAKE_CASE__ : list , SCREAMING_SNAKE_CASE__ : int = 3 ) -> list: '''simple docstring''' _UpperCAmelCase : str = min(SCREAMING_SNAKE_CASE__ ) ...
289
"""simple docstring""" import argparse from pathlib import Path from typing import Dict, OrderedDict, Tuple import torch from audiocraft.models import MusicGen from transformers import ( AutoFeatureExtractor, AutoTokenizer, EncodecModel, MusicgenDecoderConfig, MusicgenForConditionalGenerat...
289
1
from collections import OrderedDict from typing import Mapping from ...configuration_utils import PretrainedConfig from ...onnx import OnnxConfig from ...utils import logging _UpperCAmelCase = logging.get_logger(__name__) _UpperCAmelCase = { 'facebook/data2vec-text-base': 'http...
240
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 = logging.get_logger(__name__) _UpperCAmelCase = '▁' _UpperCAme...
240
1
'''simple docstring''' from __future__ import annotations from random import random class UpperCAmelCase_ : """simple docstring""" def __init__( self : Dict , UpperCAmelCase : int | None = None ) -> Union[str, Any]: '''simple docstring''' lowercase...
94
'''simple docstring''' # Copyright 2023 The HuggingFace Team. All rights reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENS...
649
0
from ...utils import ( OptionalDependencyNotAvailable, is_torch_available, is_transformers_available, is_transformers_version, ) try: if not (is_transformers_available() and is_torch_available()): raise OptionalDependencyNotAvailable() except OptionalDependencyNotAvailable: from .....
576
import math def __lowercase ( _UpperCAmelCase ) -> str: '''simple docstring''' __lowercase = 0 __lowercase = 0 while num > 0: __lowercase = num % 8 __lowercase = octal + (remainder * math.floor(math.pow(10 , _UpperCAmelCase ) )) counter += 1 __lowerca...
576
1
import shutil import tempfile import unittest import numpy as np import pytest from transformers.testing_utils import require_vision from transformers.utils import is_vision_available if is_vision_available(): from PIL import Image from transformers import ( AutoProcessor, BertTokenizerFast, Bli...
540
import math def _UpperCAmelCase ( a__ = 1_0_0): '''simple docstring''' a_ : List[str] = sum(i * i for i in range(1 , n + 1)) a_ : Optional[Any] = int(math.pow(sum(range(1 , n + 1)) , 2)) return square_of_sum - sum_of_squares if __name__ == "__main_...
540
1
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_ = logging.get_logger(__name__) UpperCamelCase_ = '▁' UpperCamelCase_ = ...
142
from __future__ import annotations def SCREAMING_SNAKE_CASE ( snake_case__ , snake_case__ , snake_case__ , snake_case__ ) -> list: __UpperCAmelCase =[] __UpperCAmelCase , __UpperCAmelCase =input_list[low:mid], input_list[mid : high + 1] whil...
142
1
def lowerCamelCase__ ( _lowercase , _lowercase ): '''simple docstring''' UpperCAmelCase_ : Dict = [0 for i in range(r + 1 )] # nc0 = 1 UpperCAmelCase_ : int = 1 for i in range(1 , n + 1 ): # to compute current row from previous row. ...
30
# Copyright 2021 The HuggingFace Team. All rights reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless...
318
0
from ...processing_utils import ProcessorMixin from ...tokenization_utils_base import BatchEncoding class _SCREAMING_SNAKE_CASE ( lowerCAmelCase__): _UpperCamelCase:List[Any] = "ClapFeatureExtractor" _UpperCamelCase:List[Any] = ("RobertaTokenizer", "RobertaTokenizerFast") def __i...
75
# Copyright 2021 The HuggingFace Team. All rights reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applica...
75
1
class a_ : def __init__( self , SCREAMING_SNAKE_CASE = "" , SCREAMING_SNAKE_CASE = False ) -> None: """simple docstring""" SCREAMING_SNAKE_CASE_ = {} # A node will be a leaf if the tree contains its word SCREAMING_SNAKE_CASE_ ...
205
import inspect import tempfile import unittest from huggingface_hub import hf_hub_download from transformers import is_torch_available from transformers.testing_utils import is_flaky, require_torch, slow, torch_device from ...test_configuration_common import ConfigTester from ...test_modeling_common import Mode...
205
1
'''simple docstring''' import copy from collections import OrderedDict from typing import Dict, Mapping from packaging import version from ...configuration_utils import PretrainedConfig from ...onnx import OnnxConfig from ...utils import logging from ..auto import CONFIG_MAPPING UpperCAmelCase_ : int...
711
'''simple docstring''' import warnings from ..trainer import Trainer from ..utils import logging UpperCAmelCase_ : Union[str, Any] = logging.get_logger(__name__) class UpperCAmelCase__ ( A ): def __init__( self : int,__A : Any=None,**__A : O...
11
0
import random import unittest import numpy as np import torch from diffusers import ( DPMSolverMultistepScheduler, EulerAncestralDiscreteScheduler, EulerDiscreteScheduler, LMSDiscreteScheduler, OnnxStableDiffusionUpscalePipeline, PNDMScheduler, ) from diffusers.utils import floats_tensor ...
87
'''simple docstring''' from collections.abc import Sequence def _A ( _lowerCAmelCase = None ): """simple docstring""" if nums is None or not nums: raise ValueError('Input sequence should not be empty' ) __lowercase =nums[0] for i ...
474
0
# Copyright 2023 The HuggingFace Team. All rights reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by appli...
718
from typing import List import jiwer import jiwer.transforms as tr from packaging import version import datasets from datasets.config import PY_VERSION if PY_VERSION < version.parse('''3.8'''): import importlib_metadata else: import importlib.metadata as importlib_metadata __snake_case :int = '''''' ...
60
0
"""simple docstring""" from __future__ import annotations def lowerCAmelCase_ ( SCREAMING_SNAKE_CASE__ ) -> list: if len(SCREAMING_SNAKE_CASE__ ) == 0: return [] a_ , a_ : Dict = min(SCREAMING_SNAKE_CASE__ ), max(SCREAMING_SNAKE_CASE__ ) a_ : ...
237
"""simple docstring""" import argparse import torch from transformers import ( WavaVecaConfig, WavaVecaFeatureExtractor, WavaVecaForAudioFrameClassification, WavaVecaForSequenceClassification, WavaVecaForXVector, logging, ) logging.set_verbosity_info() SCREAMING_SNAKE_CASE_ = ...
237
1
'''simple docstring''' from math import log from scipy.constants import Boltzmann, physical_constants _A : Optional[int] =300 # TEMPERATURE (unit = K) def SCREAMING_SNAKE_CASE_ (UpperCamelCase , UpperCamelCase , UpperCamelCase , ) ...
631
'''simple docstring''' import inspect import unittest from transformers import MobileViTVaConfig from transformers.testing_utils import require_torch, require_torch_multi_gpu, require_vision, slow, torch_device from transformers.utils import cached_property, is_torch_available, is_vis...
631
1
"""simple docstring""" import numpy as np def lowercase__ ( lowerCAmelCase : np.ndarray , lowerCAmelCase : np.ndarray , lowerCAmelCase : float = 1E-1_2 , lowerCAmelCase : int = 100 , ) -> tuple[float, np.ndarray]: ...
373
"""simple docstring""" import os import tempfile import unittest from transformers import FlaubertConfig, is_torch_available from transformers.testing_utils import require_torch, require_torch_gpu, slow, torch_device from ...test_configuration_common import ConfigTester from ...test_modeling_common impor...
373
1
from __future__ import annotations from collections import Counter from random import random class _a : """simple docstring""" def __init__( self ): _lowercase ={} def __lowerCAmelCase ( self , lowerCAmelCase_ ): _lowercase ={} def __lowerCAmelCase ( ...
594
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 xopen from ..table import ar...
594
1
def __lowerCamelCase ( ): '''simple docstring''' for n in range(1 , 1000000 ): yield n * (n + 1) // 2 def __lowerCamelCase ( UpperCamelCase__ ): '''simple docstring''' snake_case_ = 1 snake_cas...
362
'''simple docstring''' class _a : """simple docstring""" def __init__( self , A__ ) -> List[Any]: # we need a list not a string, so do something to change the type _SCREAMING_SNAKE_CASE = arr.split(""",""" ) def Upp...
591
0
'''simple docstring''' def UpperCAmelCase_ (__a : List[Any] ): """simple docstring""" _a : Any = [0] * len(__a ) _a : Optional[Any] = [] _a : Union[str, Any] = [] _a : Union[str, Any] = 0 for values in graph....
319
'''simple docstring''' # DISCLAIMER: This file is strongly influenced by https://github.com/yang-song/score_sde_pytorch import math from typing import Union import torch from ..configuration_utils import ConfigMixin, register_to_config from ..utils import randn_tensor from .scheduling_utils import SchedulerM...
319
1
'''simple docstring''' import unittest from transformers import AutoTokenizer, is_flax_available from transformers.testing_utils import require_flax, require_sentencepiece, require_tokenizers, slow if is_flax_available(): import jax.numpy as jnp from transformers import FlaxXLMRobe...
69
'''simple docstring''' import enum import shutil import sys __SCREAMING_SNAKE_CASE , __SCREAMING_SNAKE_CASE = shutil.get_terminal_size() __SCREAMING_SNAKE_CASE = {'UP': 'A', 'DOWN': 'B', 'RIGHT': 'C', 'LEFT': 'D'} class lowerCAmelCase__ ( enum.Enum ): """...
688
0
import importlib.util import os import platform from argparse import ArgumentParser import huggingface_hub from .. import __version__ as version from ..utils import ( is_accelerate_available, is_flax_available, is_safetensors_available, is_tf_available, is_torch_available, ) from . import Ba...
721
import pytest import datasets # Import fixture modules as plugins _lowerCamelCase = ['tests.fixtures.files', 'tests.fixtures.hub', 'tests.fixtures.fsspec'] def __UpperCAmelCase( lowercase_ , lowercase_ ): # Mark tests as "unit" by default if not marked as "integration" ...
613
0
'''simple docstring''' import os import textwrap import pyarrow as pa import pytest from datasets import ClassLabel, Features, Image from datasets.packaged_modules.csv.csv import Csv from ..utils import require_pil @pytest.fixture def A_ ( _lowerCAmelCase : Optional[Any] ): ...
44
"""simple docstring""" from typing import List from ...configuration_utils import PretrainedConfig from ...utils import logging SCREAMING_SNAKE_CASE_ = logging.get_logger(__name__) SCREAMING_SNAKE_CASE_ = { '''snap-research/efficientformer-l1-300''': ( '''https://huggingfa...
465
0
'''simple docstring''' from ..utils import DummyObject, requires_backends class UpperCAmelCase_ ( metaclass=_a ): """simple docstring""" lowercase = ["sentencepiece"] def __init__( self : List[Any] , *snake_case_ : Optional[Any] , **snake_case_ ...
301
'''simple docstring''' def __snake_case( _lowerCAmelCase , _lowerCAmelCase ) -> float: if discount_rate < 0: raise ValueError("""Discount rate cannot be negative""" ) if not cash_flows: raise ValueError("""Cash flows list cannot be empty""" ) snake_case...
301
1
"""simple docstring""" import unittest from transformers import AutoTokenizer, NystromformerConfig, is_torch_available from transformers.testing_utils import require_torch, slow, torch_device from ...test_configuration_common import ConfigTester from ...test_modeling_common import ModelTester...
76
import json from typing import List, Optional, Tuple from tokenizers import normalizers from ...tokenization_utils_fast import PreTrainedTokenizerFast from .tokenization_lxmert import LxmertTokenizer __magic_name__ = {"vocab_file": "vocab.txt", "tokenizer_file": "tokenizer.json"} __magic_na...
254
0
from typing import Any def _lowerCamelCase( a ): if not input_list: return [] __a = [input_list.count(a ) for value in input_list] __a = max(a ) # Gets the maximum count in the input list. # Gets values of modes return sorted(...
708
"""simple docstring""" import re from pathlib import Path from unittest import TestCase import pytest @pytest.mark.integration class snake_case__ ( snake_case_ ): def a__ ( self , lowerCamelCase ): with open(lowerCamelCase , encoding="utf-8" ) as input_file: ...
67
0
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 PatchingSpec from ...tokenization...
472
import importlib import inspect import json import os import re import shutil import sys from pathlib import Path from typing import Dict, Optional, Union from urllib import request from huggingface_hub import HfFolder, cached_download, hf_hub_download, model_info from packaging import version from .. import __versi...
472
1
'''simple docstring''' def snake_case ( a_ : int ) -> "list[int]": """simple docstring""" if upper_limit < 0: raise ValueError("""Limit for the Catalan sequence must be ≥ 0""" ) UpperCamelCase_ : Optional[int] = [0] * (upper_l...
543
'''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_com...
543
1
import torch from transformers import PreTrainedModel, XLMRobertaConfig, XLMRobertaModel class lowerCamelCase( __snake_case ): '''simple docstring''' __magic_name__ = 'M-CLIP' def __init__( self , snake_case_=1024 , snake_case_=768...
27
__A : Dict = "Alexander Joslin" import operator as op from .stack import Stack def __lowerCAmelCase( _SCREAMING_SNAKE_CASE ) -> int: """simple docstring""" _A = {'*': op.mul, '/': op.truediv, '+': op.add, '-': op.sub} ...
27
1
"""simple docstring""" from typing import TYPE_CHECKING from ...utils import ( OptionalDependencyNotAvailable, _LazyModule, is_sentencepiece_available, is_tokenizers_available, is_torch_available, ) A = {'configuration_plbart': ['PLBART_PRETRAINED_CONFIG_ARCHIVE_MAP', 'PLBartConfig'...
703
"""simple docstring""" from ...configuration_utils import PretrainedConfig from ...utils import logging A = logging.get_logger(__name__) A = { 'google/fnet-base': 'https://huggingface.co/google/fnet-base/resolve/main/config.json', 'google/fnet-large': 'https://huggingface.co/google/fnet-...
109
0
import inspect import unittest from transformers import ConvNextVaConfig from transformers.models.auto import get_values from transformers.models.auto.modeling_auto import MODEL_FOR_BACKBONE_MAPPING_NAMES, MODEL_MAPPING_NAMES from transformers.testing_utils import require_torch, require_vision, slow, torch...
101
"""simple docstring""" from __future__ import annotations import math def lowerCamelCase_ ( __lowerCAmelCase , __lowerCAmelCase ) -> list: '''simple docstring''' if len(__lowerCAmelCase ) != 2 or len(a[0] ) != 2 or len(__lowerCAmelCase ) != 2 or ...
530
0
'''simple docstring''' import json import re from typing import TYPE_CHECKING, List, Optional, Tuple, Union import numpy as np from ...utils import is_tf_available, is_torch_available, logging if TYPE_CHECKING: if is_torch_available(): import torch if is_tf_available(): import tensorflow as tf...
276
'''simple docstring''' from collections import OrderedDict from typing import Mapping from ...configuration_utils import PretrainedConfig from ...onnx import OnnxConfig from ...utils import logging lowercase__ = logging.get_logger(__name__) lowercase__ = { "YituTech/conv-bert-base": "https...
276
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 lowercase_ : """simple docstring""" SCREAMING_SNAKE_CASE : int SCREAMING_...
41
"""simple docstring""" import json import os import re import sys import urllib.request import requests from bsa import BeautifulSoup _lowercase = { '''User-Agent''': '''Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36''' ''' (KHTML, like Gecko) Chrome/70.0.3538....
118
0
"""simple docstring""" from ...configuration_utils import PretrainedConfig from ...utils import logging _a : Tuple= logging.get_logger(__name__) _a : Optional[int]= { "MIT/ast-finetuned-audioset-10-10-0.4593": ( "https://huggingface.co/MIT/ast-finetuned-audioset-10-10-0.4...
703
"""simple docstring""" from typing import TYPE_CHECKING from ...utils import ( OptionalDependencyNotAvailable, _LazyModule, is_flax_available, is_tf_available, is_torch_available, ) _a : Optional[Any]= { "configuration_wav2vec2": ["WAV_2_VEC_2_PRETRAINED_CONFIG...
192
0