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 unittest from transformers import PegasusTokenizer, PegasusTokenizerFast from transformers.testing_utils import get_tests_dir, require_sentencepiece, require_tokenizers, require_torch, slow from transformers.utils import cached_property from ...test_tokenization_common import TokenizerTeste...
57
'''simple docstring''' from __future__ import annotations from functools import lru_cache from math import ceil UpperCAmelCase__ : Optional[Any] = 1_00 UpperCAmelCase__ : Any = set(range(3, NUM_PRIMES, 2)) primes.add(2) UpperCAmelCase__ : int for prime in range(3, ceil(NUM_PRIMES**0.5)...
48
0
"""simple docstring""" def lowerCAmelCase ( __UpperCamelCase , __UpperCamelCase ): '''simple docstring''' UpperCAmelCase__ : Optional[Any] = 1 # To kept the Calculated Value # Since C(n, k) = C(n, n-k) if k > (n - k): UpperCAmelCase__ : Op...
714
"""simple docstring""" from ...configuration_utils import PretrainedConfig from ...utils import logging __UpperCAmelCase = logging.get_logger(__name__) class __lowercase ( __lowerCamelCase ): snake_case_ = """timm_backbone""" def __init__( self...
194
0
'''simple docstring''' from ...configuration_utils import PretrainedConfig from ...utils import logging UpperCamelCase__ : Tuple = logging.get_logger(__name__) UpperCamelCase__ : List[Any] = { '''microsoft/biogpt''': '''https://huggingface.co/microsoft/biogpt/resolve/m...
578
from itertools import product def A(__a: int , __a: int ): lowerCAmelCase_ = sides_number lowerCAmelCase_ = max_face_number * dice_number lowerCAmelCase_ = [0] * (max_total + 1) lowerCAmelCase_ = 1 lowerCAmelCase_ =...
122
0
def snake_case__ ( UpperCAmelCase : float ): return 1_0 - x * x def snake_case__ ( UpperCAmelCase : float , UpperCAmelCase : float ): # Bolzano theory in order to find if there is a root between a and b if equation(UpperCAmelCase...
111
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....
111
1
'''simple docstring''' 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 ...
676
import sys from .dependency_versions_table import deps from .utils.versions import require_version, require_version_core # define which module versions we always want to check at run time # (usually the ones defined in `install_requires` in setup.py) # # order specific notes: # - tqdm must be checked befor...
305
0
import unittest from pathlib import Path from tempfile import NamedTemporaryFile, TemporaryDirectory from transformers import BertConfig, BertTokenizerFast, FeatureExtractionPipeline from transformers.convert_graph_to_onnx import ( convert, ensure_valid_input, generate_identified_filename, infer...
709
from collections import deque from math import floor from random import random from time import time class SCREAMING_SNAKE_CASE__ : '''simple docstring''' def __init__( self : Any ) -> int: """simple docstring""" _UpperCAmelCase = {} def lowerCamelCase ...
402
0
import argparse from argparse import Namespace import torch from torch import nn from transformers import XGLMConfig, XGLMForCausalLM def SCREAMING_SNAKE_CASE ( UpperCAmelCase__ ): """simple docstring""" _SCREAMING_SNAKE_CASE = [ 'decoder.version', ...
605
# tests directory-specific settings - this file is run automatically # by pytest before any tests are run import sys import warnings from os.path import abspath, dirname, join # allow having multiple repository checkouts and not needing to remember to rerun # 'pip install -e .[dev]' when switching bet...
605
1
import unittest from diffusers.pipelines.pipeline_utils import is_safetensors_compatible class SCREAMING_SNAKE_CASE ( unittest.TestCase ): """simple docstring""" def __lowerCAmelCase ( self ): """simple docstring""" snake_case_ = [ 'safety_checker/pytor...
46
from ...configuration_utils import PretrainedConfig from ...utils import logging from ...utils.backbone_utils import BackboneConfigMixin, get_aligned_output_features_output_indices A = logging.get_logger(__name__) A = { 'google/bit-50': 'https://huggingface.co/google/bit-50/resolve/...
46
1
'''simple docstring''' import json import os import shutil import tempfile import unittest import numpy as np import pytest from transformers import MgpstrTokenizer from transformers.models.mgp_str.tokenization_mgp_str import VOCAB_FILES_NAMES from transformers.testing_utils import require_torch, require_vision fro...
48
'''simple docstring''' import random import unittest import torch from diffusers import IFImgaImgSuperResolutionPipeline 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 ..pipelin...
38
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 = logging.get_logger(__name__) A = { "google/efficientnet-b7": "https...
717
import csv import tweepy # Twitter API credentials A = "" A = "" A = "" A = "" def __UpperCAmelCase ( __A ) -> None: '''simple docstring''' UpperCAmelCase__ = tweepy.OAuthHandler(__A , __A ) auth...
277
0
def lowercase ( __A : list ) -> list: '''simple docstring''' if len(__A ) <= 1: return lst snake_case : List[Any] = 1 while i < len(__A ): if lst[i - 1] <= lst[i]: i += 1 else: snake_case , snake_case...
36
'''simple docstring''' import numpy as np def __A ( UpperCAmelCase ,UpperCAmelCase ,UpperCAmelCase = 1E-12 ,UpperCAmelCase = 1_0_0 ,) -> tuple[float, np.ndarray]: '''simple docstring''' assert np.shape(UpperCAmelCase )[0] == np.shape(UpperCAmelCase )[1] ...
435
0
def _lowerCamelCase ( snake_case ): if n == 1 or not isinstance(lowerCAmelCase__ , lowerCAmelCase__ ): return 0 elif n == 2: return 1 else: _lowerCAmelCase = [0, 1] for i in range(2 , n + 1 ): ...
706
import unittest from transformers import PegasusConfig, PegasusTokenizer, is_flax_available from transformers.testing_utils import require_flax, slow from ...test_configuration_common import ConfigTester from ...test_modeling_flax_common import FlaxModelTesterMixin, ids_tensor if is_flax_available(): import os ...
225
0
def __lowerCAmelCase( _SCREAMING_SNAKE_CASE , _SCREAMING_SNAKE_CASE ) -> float: """simple docstring""" return price * (1 + tax_rate) if __name__ == "__main__": print(f"{price_plus_tax(100, 0.2_5) = }") print(f"{price_plus_tax(1_2_5.5_0, 0.0_5) ...
27
import requests _SCREAMING_SNAKE_CASE : Optional[int] = "" # <-- Put your OpenWeatherMap appid here! _SCREAMING_SNAKE_CASE : Optional[Any] = "https://api.openweathermap.org/data/2.5/" def UpperCAmelCase__ (UpperCamelCase_ = "Chicago" ,UpperCamelCase_ = APPID ...
550
0
"""simple docstring""" from __future__ import annotations from math import pi # Define the Reduced Planck Constant ℏ (H bar), speed of light C, value of # Pi and the function lowerCamelCase_ : Optional[Any] = 1.0_5457_1817E-34 # unit of ℏ : J * s lowerCamelCase_ : Dict = 3E8 ...
302
"""simple docstring""" from __future__ import annotations def UpperCAmelCase__ ( _UpperCAmelCase , _UpperCAmelCase , _UpperCAmelCase , _UpperCAmelCase ): """simple docstring""" if (direction == 1 and array[indexa] > array[indexa]) or ( direction == 0 a...
302
1
from typing import TYPE_CHECKING from ...utils import _LazyModule SCREAMING_SNAKE_CASE = {'tokenization_wav2vec2_phoneme': ['Wav2Vec2PhonemeCTCTokenizer']} if TYPE_CHECKING: from .tokenization_wavaveca_phoneme import WavaVecaPhonemeCTCTokenizer else: import sys SCREAMING_S...
99
'''simple docstring''' import warnings from collections import OrderedDict from typing import Any, Mapping, Optional from ... import PreTrainedTokenizer from ...configuration_utils import PretrainedConfig from ...onnx import OnnxConfig, OnnxConfigWithPast, OnnxSeqaSeqConfigWithPast from ...onnx.utils import ...
400
0
'''simple docstring''' import argparse import glob import logging import os from argparse import Namespace from importlib import import_module import numpy as np import torch from lightning_base import BaseTransformer, add_generic_args, generic_train from seqeval.metrics import accuracy_score, fa_score, precision_...
711
'''simple docstring''' import unicodedata from dataclasses import dataclass from typing import Optional, Union import numpy as np from transformers.data.data_collator import DataCollatorMixin from transformers.file_utils import PaddingStrategy from transformers.tokenization_utils_base import PreTrainedTokenizerBa...
339
0
from .glue import GlueDataset, GlueDataTrainingArguments from .language_modeling import ( LineByLineTextDataset, LineByLineWithRefDataset, LineByLineWithSOPTextDataset, TextDataset, TextDatasetForNextSentencePrediction, ) from .squad import SquadDataset, SquadDataTrainingArguments
30
class snake_case__ : def __init__( self , UpperCamelCase_ , UpperCamelCase_ ) -> Optional[int]: """simple docstring""" a_ : Optional[Any] = name a_ : Union[str, Any] = val def __str__( self ) -> Tup...
419
0
from typing import List, Optional, Union import numpy as np import tensorflow as tf from .utils import logging __a : Optional[Any] = logging.get_logger(__name__) def a_ ( __snake_case ) -> List[int]: '''simple docstring''' if isinstance(__snake_case...
707
from __future__ import annotations def a_ ( __snake_case ) -> list: '''simple docstring''' if len(__snake_case ) == 0: return [] UpperCamelCase_ , UpperCamelCase_ = min(__snake_case ), max(__snake_case ) UpperCamelCase_ ...
559
0
'''simple docstring''' import operator as op def _a ( _lowerCamelCase ) -> Tuple: """simple docstring""" __snake_case : List[Any] = [] __snake_case : Optional[int] = lambda _lowerCamelCase ...
26
'''simple docstring''' import inspect import unittest from transformers import ViTHybridConfig from transformers.testing_utils import require_accelerate, require_torch, require_vision, slow, torch_device from transformers.utils import cached_property, is_torch_available, is_vision_available from ...test_config...
394
0
'''simple docstring''' from typing import TYPE_CHECKING from ...utils import ( OptionalDependencyNotAvailable, _LazyModule, is_tokenizers_available, is_torch_available, is_vision_available, ) UpperCamelCase_ = { "configuration_perceiver": ["PERCEIVER_PRETRAINED_CONFIG_A...
599
'''simple docstring''' import os import re import shutil from argparse import ArgumentParser, Namespace from datasets.commands import BaseDatasetsCLICommand from datasets.utils.logging import get_logger UpperCamelCase_ = "<<<<<<< This should probably be modified because it mentions: " UpperCa...
599
1
def a_ ( __lowercase : int = 1_000 ) -> int: return sum(2 * a * ((a - 1) // 2) for a in range(3 , n + 1 ) ) if __name__ == "__main__": print(solution())
686
import absl # noqa: F401 # Here to have a nice missing dependency error message early on import nltk # noqa: F401 # Here to have a nice missing dependency error message early on import numpy # noqa: F401 # Here to have a nice missing dependency error message early on import six # noqa: F401 # Here to have a nice m...
686
1
import shutil import tempfile import unittest import numpy as np import pytest from transformers import is_speech_available, is_vision_available from transformers.testing_utils import require_torch if is_vision_available(): from transformers import TvltImageProcessor if is_speech_available(): from tran...
714
from typing import Optional, Tuple, Union import flax import flax.linen as nn import jax import jax.numpy as jnp from flax.core.frozen_dict import FrozenDict from ..configuration_utils import ConfigMixin, flax_register_to_config from ..utils import BaseOutput from .embeddings_flax import FlaxTimestepEmbedding, FlaxTi...
107
0
"""simple docstring""" from math import factorial def _lowercase ( __lowerCAmelCase = 100 ) -> int: return sum(int(__lowerCAmelCase ) for x in str(factorial(__lowerCAmelCase ) ) ) if __name__ == "__main__": print(solution(int(input("Enter the Number: ").strip())))...
680
"""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-2.0 # # U...
680
1
"""simple docstring""" import tempfile import unittest from transformers import TaConfig, is_torch_available from transformers.testing_utils import ( require_sentencepiece, require_tokenizers, require_torch, slow, torch_device, ) from ...generation.test_utils import GenerationTesterMixin from...
714
"""simple docstring""" import argparse import json import os import sys import tempfile import unittest from argparse import Namespace from dataclasses import dataclass, field from enum import Enum from pathlib import Path from typing import List, Literal, Optional import yaml from transformers import HfArgument...
128
0
from ...configuration_utils import PretrainedConfig from ...utils import logging a : int = logging.get_logger(__name__) a : int = {"""ctrl""": """https://huggingface.co/ctrl/resolve/main/config.json"""} class _lowercase ( UpperCAmelCase__ ): '''simple ...
613
from ...configuration_utils import PretrainedConfig from ...utils import logging a : Any = logging.get_logger(__name__) a : List[str] = { """transfo-xl-wt103""": """https://huggingface.co/transfo-xl-wt103/resolve/main/config.json""", } class _lowercase ( Upper...
613
1
'''simple docstring''' from collections import deque from math import floor from random import random from time import time class A__ : """simple docstring""" def __init__( self : int ) -> Optional[int]: """simple docstring""" _UpperCAmelCase ...
720
'''simple docstring''' from typing import TYPE_CHECKING from ...utils import ( OptionalDependencyNotAvailable, _LazyModule, is_torch_available, ) __a = { 'configuration_swiftformer': [ 'SWIFTFORMER_PRETRAINED_CONFIG_ARCHIVE_MAP', 'SwiftFormerConfig', 'SwiftF...
257
0
"""simple docstring""" import operator def _snake_case ( _snake_case : str , _snake_case : List[str] = False , _snake_case : Optional[Any] = None ) -> list: '''simple docstring''' _A = operator.lt if reverse else operator.gt _A ...
7
from dataclasses import dataclass, field from typing import Tuple from ..utils import cached_property, is_torch_available, is_torch_tpu_available, logging, requires_backends from .benchmark_args_utils import BenchmarkArguments if is_torch_available(): import torch if is_torch_tpu_available(check_device=Fal...
205
0
"""simple docstring""" import random def __UpperCAmelCase ( lowercase ,lowercase ,lowercase = False ): """simple docstring""" _UpperCAmelCase = {i: [] for i in range(_lowerCamelCase )} # if probability is greater or equal than 1, then generate a complete graph if proba...
700
"""simple docstring""" from __future__ import annotations from random import choice def __UpperCAmelCase ( lowercase ): """simple docstring""" return choice(lowercase ) def __UpperCAmelCase ( lowercase ,lowercase ): """simple docstring""" _UpperCAmelCase ...
275
0
'''simple docstring''' 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 a_ = logging.get_logger(__name__) a_ = {'vocab_file': 'spiece.model...
685
'''simple docstring''' 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_commo...
634
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 _snake_case : Dict = logging.get_logger(__name__) _snake_case : ...
214
from typing import List, Optional, Union from ...configuration_utils import PretrainedConfig from ...utils import logging _snake_case : List[str] = logging.get_logger(__name__) _snake_case : Optional[int] = { 'huggingface/time-series-transformer-tourism-mon...
214
1
'''simple docstring''' import numpy as np import datasets UpperCamelCase_ = """ Compute the Mahalanobis Distance Mahalonobis distance is the distance between a point and a distribution. And not between two distinct points. It is effectively a multivariate equivalent of the Euclidean distance. ...
92
from collections import OrderedDict from typing import Mapping from ...configuration_utils import PretrainedConfig from ...onnx import OnnxConfig from ...utils import logging A_ : Optional[Any] = logging.get_logger(__name__) A_ : Optional[Any] = ...
57
0
'''simple docstring''' from typing import TYPE_CHECKING from ...utils import OptionalDependencyNotAvailable, _LazyModule, is_torch_available a_ : List[Any] = { """configuration_timesformer""": ["""TIMESFORMER_PRETRAINED_CONFIG_ARCHIVE_MAP""", """TimesformerConfig"""], } t...
703
'''simple docstring''' import unittest import numpy as np from transformers import DistilBertConfig, is_flax_available from transformers.testing_utils import require_flax, slow from ...test_modeling_flax_common import FlaxModelTesterMixin, ids_tensor, random_attention_mask if is_flax_available()...
445
0
import argparse import os import re import packaging.version UpperCAmelCase_ = """examples/""" UpperCAmelCase_ = { """examples""": (re.compile(r"""^check_min_version\(\"[^\"]+\"\)\s*$""", re.MULTILINE), """check_min_version(\"VERSION\")\n"""), """init""": (re.compile(r"""^__vers...
2
import json import os from typing import Dict, List, Optional, Tuple from ...tokenization_utils import PreTrainedTokenizer from ...utils import logging UpperCAmelCase_ = logging.get_logger(__name__) UpperCAmelCase_ = { """vocab_file""": """vocab.json""", """tokenizer_config...
2
1
"""simple docstring""" import contextlib import os import sqlitea import pytest from datasets import Dataset, Features, Value from datasets.io.sql import SqlDatasetReader, SqlDatasetWriter from ..utils import assert_arrow_memory_doesnt_increase, assert_arrow_memory_increases, require_sqlalchemy def A ...
708
"""simple docstring""" import string import numpy def A ( snake_case :int , snake_case :int ) -> int: return b if a == 0 else greatest_common_divisor(b % a , snake_case ) class __lowerCAmelCase : lowercase = string.ascii_uppercase + string.digits #...
293
0
import os import re import shutil from argparse import ArgumentParser, Namespace from datasets.commands import BaseDatasetsCLICommand from datasets.utils.logging import get_logger a__ : str = """<<<<<<< This should probably be modified because it mentions: """ a__ : Dict = ...
165
import copy import os from collections import OrderedDict from typing import TYPE_CHECKING, Any, Dict, Mapping, Optional, Union if TYPE_CHECKING: from ...processing_utils import ProcessorMixin from ...utils import TensorType from ...configuration_utils import PretrainedConfig from ...onnx import Onnx...
165
1
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 _lowercase ( SCREAMING_SNAKE_CASE_ : dict ): ...
181
import gc import random import unittest import numpy as np import torch from PIL import Image from transformers import XLMRobertaTokenizerFast from diffusers import DDIMScheduler, KandinskyInpaintPipeline, KandinskyPriorPipeline, UNetaDConditionModel, VQModel from diffusers.pipelines.kandinsky.text_en...
181
1
from typing import TYPE_CHECKING from ...utils import ( OptionalDependencyNotAvailable, _LazyModule, is_tf_available, is_tokenizers_available, is_torch_available, ) __a : str = { '''configuration_deberta''': ['''DEBERTA_PRETRAINED_CONFIG_ARCHIVE_...
397
import logging from dataclasses import dataclass, field from pathlib import Path from typing import Optional, Union from .generation.configuration_utils import GenerationConfig from .training_args import TrainingArguments from .utils import add_start_docstrings __a : Dict = ...
397
1
'''simple docstring''' import collections import inspect import unittest from transformers import SwinvaConfig 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_...
474
'''simple docstring''' import unittest from pathlib import Path from tempfile import TemporaryDirectory from transformers import AutoConfig, TFGPTaLMHeadModel, is_keras_nlp_available, is_tf_available from transformers.models.gpta.tokenization_gpta import GPTaTokenizer from transformers.testing_utils imp...
474
1
import json import os import shutil import tempfile import unittest from multiprocessing import get_context from pathlib import Path import datasets import numpy as np from datasets import load_dataset from parameterized import parameterized from transformers import AutoProcessor from transformers.models.wavaveca im...
55
'''simple docstring''' def __UpperCamelCase ( a : int = 50 ) ->int: snake_case = [1] * (length + 1) for row_length in range(3 , length + 1 ): for block_length in range(3 , row_length + 1 ): for block_start in range(row_length - block_len...
342
0
"""simple docstring""" import argparse import re import requests import torch # git clone https://github.com/salesforce/BLIP.git from models.blip import blip_decoder from models.blip_itm import blip_itm from models.blip_vqa import blip_vqa from PIL import Image from torchvision import transforms from torchvisi...
507
"""simple docstring""" import inspect import os import unittest import torch import accelerate from accelerate import debug_launcher from accelerate.test_utils import ( execute_subprocess_async, require_cpu, require_huggingface_suite, require_multi_gpu, require_single_gpu, ) from accelerate...
507
1
"""simple docstring""" from typing import TYPE_CHECKING from ...utils import ( OptionalDependencyNotAvailable, _LazyModule, is_flax_available, is_tensorflow_text_available, is_tf_available, is_tokenizers_available, is_torch_available, ) lowercase__ = { """configuration...
610
"""simple docstring""" import warnings from typing import List, Optional, Union from ...processing_utils import ProcessorMixin from ...tokenization_utils_base import BatchEncoding, PaddingStrategy, PreTokenizedInput, TextInput, TruncationStrategy from ...utils import TensorType class __lowerCamelCase ...
610
1
from __future__ import annotations import math import random from collections.abc import Collection from typing import overload class a : def __init__( self : Optional[int] , SCREAMING_SNAKE_CASE_ : Collection[float] | None = None ): if components is None: ...
707
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 ...test_mod...
189
0
from __future__ import annotations def UpperCamelCase_ ( __a ) -> int: # preprocessing the first row for i in range(1 , len(matrix[0] ) ): matrix[0][i] += matrix[0][i - 1] # preprocessing the first column for i in range(1 , len(__a ) ...
37
def A__ (snake_case : int ) -> bool: if number < 0: raise ValueError("""number must not be negative""" ) return number & (number - 1) == 0 if __name__ == "__main__": import doctest doctest.testmod()
279
0
import os import re from shutil import copyfile from typing import List, Optional, Tuple from ...tokenization_utils import PreTrainedTokenizer from ...utils import logging _snake_case = logging.get_logger(__name__) _snake_case = { "vocab_file": "vocab.txt", "merges_file": "bpe.codes", } _snak...
658
from ...configuration_utils import PretrainedConfig from ...utils import logging from ...utils.backbone_utils import BackboneConfigMixin, get_aligned_output_features_output_indices _snake_case = logging.get_logger(__name__) _snake_case = { "microsoft/focalnet-tiny": "https://huggingface.co/microsof...
658
1
from __future__ import annotations def __A ( __lowerCamelCase , __lowerCamelCase ) -> Optional[int]: # Checks if the entire collection has been sorted if len(lowerCAmelCase_ ) <= 1 or n <= 1: return insert_next(lowerCAmelCase_ , n - 1 ) ...
468
def _UpperCamelCase ( lowerCAmelCase_ ) ->int: if n == 1 or not isinstance(lowerCAmelCase_ , lowerCAmelCase_ ): return 0 elif n == 2: return 1 else: UpperCAmelCase = [0, 1] for i in range(2 , n + 1 ): sequence.append(sequence[i - 1] + s...
377
0
import inspect import os import unittest from pathlib import Path import torch import accelerate from accelerate.test_utils import execute_subprocess_async from accelerate.test_utils.testing import run_command class UpperCAmelCase_ ( unittest.TestCase): lowerCamelCase__ = inspect.getfi...
712
import requests from bsa import BeautifulSoup def A ( _lowerCamelCase = "https://www.worldometers.info/coronavirus" ): '''simple docstring''' _lowerCAmelCase : str = BeautifulSoup(requests.get(_lowerCamelCase ).text , "html.parser"...
658
0
def lowerCamelCase__ (__lowerCamelCase ): _SCREAMING_SNAKE_CASE : Any = 0 # if input_string is "aba" than new_input_string become "a|b|a" _SCREAMING_SNAKE_CASE : int = "" _SCREAMING_SNAKE_CASE : Any = "" # ...
249
def lowerCamelCase__ (__lowerCamelCase = 50 ): _SCREAMING_SNAKE_CASE : Dict = [[0] * 3 for _ in range(length + 1 )] for row_length in range(length + 1 ): for tile_length in range(2, 5 ): for tile_start in range(row_lengt...
249
1
"""simple docstring""" from __future__ import annotations from collections import deque from collections.abc import Iterator from dataclasses import dataclass @dataclass class __lowerCAmelCase : '''simple docstring''' __UpperCAmelCase : int __UpperCAmelCase : in...
721
"""simple docstring""" import unittest from transformers import ( MODEL_FOR_SEQUENCE_CLASSIFICATION_MAPPING, TF_MODEL_FOR_SEQUENCE_CLASSIFICATION_MAPPING, Pipeline, ZeroShotClassificationPipeline, pipeline, ) from transformers.testing_utils import is_pipeline_test, nested_si...
65
0
'''simple docstring''' import argparse _lowercase : Optional[int] = """docs/source/_static/js/custom.js""" def lowerCamelCase__ ( A : List[str] ): '''simple docstring''' with open(A , encoding='''utf-8''' , newline='''\n''' ) as f: UpperCAmelCase ...
210
'''simple docstring''' import unittest import numpy as np import torch from diffusers import PNDMPipeline, PNDMScheduler, UNetaDModel from diffusers.utils.testing_utils import enable_full_determinism, require_torch, slow, torch_device enable_full_determinism() class UpperCamelCase__( unittest.TestCa...
210
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, ...
534
from statistics import mean import numpy as np def SCREAMING_SNAKE_CASE__ ( __a , __a , __a , __a ): snake_case_ : Optional[Any] = 0 # Number of processes finished snake_case_ : List[str] = 0 # Displays the finished process. # If it is 0, th...
534
1
"""simple docstring""" from typing import Optional, Tuple, Union import flax import flax.linen as nn import jax import jax.numpy as jnp from flax.core.frozen_dict import FrozenDict from ..configuration_utils import ConfigMixin, flax_register_to_config from ..utils import BaseOutput from .embeddings_flax import ...
178
from collections.abc import Generator from math import sin def _A (UpperCamelCase : bytes ) ->bytes: '''simple docstring''' if len(UpperCamelCase ) != 32: raise ValueError("""Input must be of length 32""" ) lowerCamelCase__ : Tuple = B"""""" for i in [...
157
0
import json import sys import tempfile import unittest from pathlib import Path import transformers from transformers import ( CONFIG_MAPPING, IMAGE_PROCESSOR_MAPPING, AutoConfig, AutoImageProcessor, CLIPConfig, CLIPImageProcessor, ) from transformers.testing_utils import DUMMY_U...
584
import warnings from ...processing_utils import ProcessorMixin from ...tokenization_utils_base import BatchEncoding class a__ ( __SCREAMING_SNAKE_CASE ): _A = ["image_processor", "tokenizer"] _A = "CLIPImageProcessor" _A = ("CLIPTokeni...
584
1
'''simple docstring''' from __future__ import annotations a : Optional[Any] = '''Muhammad Umer Farooq''' a : int = '''MIT''' a : Dict = '''1.0.0''' a : Optional[int] = '''Muhammad Umer Farooq''' a : Optional[Any] ...
69
import re def __a ( __UpperCAmelCase : str ) -> list: """simple docstring""" return [char.split() for char in re.split(R"[^ a-z A-Z 0-9 \s]" , str_ )] def __a ( __UpperCAmelCase : str ) -> str: """simple docstring""" ...
488
0
'''simple docstring''' import numpy as np from nltk.translate import meteor_score import datasets from datasets.config import importlib_metadata, version A__ : Optional[Any] =version.parse(importlib_metadata.version('nltk')) if NLTK_VERSION >= version.Version('3.6.4'): from nltk import word_tok...
499
'''simple docstring''' import argparse import gdown import numpy as np import torch from huggingface_hub import hf_hub_download from transformers import ( CLIPTokenizer, CLIPTokenizerFast, VideoMAEImageProcessor, XCLIPConfig, XCLIPModel, XCLIPProcessor, XCLIPTextConfig, ...
499
1
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, TensorType _SCREAMING_SNAKE_CASE ...
401
import argparse import torch from transformers import ( SpeechTaConfig, SpeechTaFeatureExtractor, SpeechTaForSpeechToSpeech, SpeechTaForSpeechToText, SpeechTaForTextToSpeech, SpeechTaProcessor, SpeechTaTokenizer, logging, ) from transformers.tokenization_utils import Adde...
401
1
'''simple docstring''' import os from shutil import copyfile from typing import List, Optional, Tuple from ...tokenization_utils import AddedToken from ...tokenization_utils_fast import PreTrainedTokenizerFast from ...utils import is_sentencepiece_available, logging if is_sentencepiece_avai...
68
'''simple docstring''' import re from filelock import FileLock try: import nltk snake_case_ = True except (ImportError, ModuleNotFoundError): snake_case_ = False if NLTK_AVAILABLE: with FileLock('.lock') as lock: nltk.download('punkt'...
68
1
def lowerCamelCase__ (__lowerCamelCase ): if not isinstance(__lowerCamelCase, __lowerCamelCase ): raise ValueError("Input must be an integer" ) if input_num <= 0: raise ValueError("Input must be positive" ) return sum( divisor for div...
249
"""simple docstring""" from ...configuration_utils import PretrainedConfig from ...utils import logging UpperCAmelCase__ = logging.get_logger(__name__) class a ( lowerCAmelCase_ ): _snake_case : List[Any] = 'timm_backbone' def __init__( self : List[Any] , __lower...
277
0
"""simple docstring""" import argparse import json import requests import torch from huggingface_hub import hf_hub_download from PIL import Image from transformers import SegformerImageProcessor, SwinConfig, UperNetConfig, UperNetForSemanticSegmentation def lowercase__ ( snake_c...
397
"""simple docstring""" from __future__ import annotations def lowercase__ ( snake_case_ :list[int] ): __UpperCAmelCase = len(snake_case_ ) // 2 # choose the middle 3 elements __UpperCAmelCase = lst[m - 1 : m + 2] # if middle element is peak if thre...
397
1
from math import factorial def __SCREAMING_SNAKE_CASE ( a__ : int = 100 ) -> int: return sum(int(a__ ) for x in str(factorial(a__ ) ) ) if __name__ == "__main__": print(solution(int(input('''Enter the Number: ''').strip())))
17
def _lowerCAmelCase ( __lowerCAmelCase = 200 ) -> int: """simple docstring""" snake_case__ : Optional[int] = [1, 2, 5, 10, 20, 50, 100, 200] snake_case__ : List[Any] = [0] * (pence + 1) snake_case__ : str = 1 # base case: 1 w...
252
0
'''simple docstring''' def _lowerCamelCase( UpperCamelCase__ : list[int] , UpperCamelCase__ : int ) -> bool: A : int = len(UpperCamelCase__ ) A : Dict = [[False] * (required_sum + 1) for _ in range(arr_len + 1 )] # for ea...
537
'''simple docstring''' # Usage: # ./gen-card-facebook-wmt19.py import os from pathlib import Path def _lowerCamelCase( UpperCamelCase__ : List[Any] , UpperCamelCase__ : Optional[Any] , UpperCamelCase__ : List[Any] ) -> List[Any]: A : Any = { ...
537
1
def __lowerCAmelCase ( A , A ): UpperCAmelCase_ = "" for i in table: res += inp[i - 1] return res def __lowerCAmelCase ( A ): return data[1:] + data[0] def __lowerCAmelCase ( A , A ): UpperCAmelCase_ = "" for i in range(le...
162
snake_case = {str(digit): digit**5 for digit in range(1_0)} def SCREAMING_SNAKE_CASE__ ( snake_case__ :int ) -> int: return sum(DIGITS_FIFTH_POWER[digit] for digit in str(snake_case__ ) ) def SCREAMING_SNAKE_CASE__ ( ) -> int: return sum( numb...
67
0
'''simple docstring''' from abc import ABC, abstractmethod from argparse import ArgumentParser class a__ ( snake_case__ ): '''simple docstring''' @staticmethod @abstractmethod def __SCREAMING_SNAKE_CASE ( lo...
711
'''simple docstring''' import tempfile import unittest import numpy as np from huggingface_hub import HfFolder, delete_repo from requests.exceptions import HTTPError from transformers import BertConfig, is_flax_available from transformers.testing_utils import TOKEN, USER, is_staging_test, r...
98
0
"""simple docstring""" from typing import Callable, Optional, Union from ...configuration_utils import PretrainedConfig from ...utils import logging UpperCAmelCase : Dict = logging.get_logger(__name__) UpperCAmelCase : Union[str, Any] = { "microsoft/xprophetnet-large-wiki...
567
"""simple docstring""" import functools import operator from ...configuration_utils import PretrainedConfig from ...utils import logging UpperCAmelCase : Tuple = logging.get_logger(__name__) UpperCAmelCase : List[str] = { "asapp/sew-tiny-100k": "https://huggingface.co/as...
567
1
import pyarrow.parquet as pq import pytest from datasets import Audio, Dataset, DatasetDict, Features, NamedSplit, Sequence, Value, config from datasets.features.image import Image from datasets.io.parquet import ParquetDatasetReader, ParquetDatasetWriter, get_writer_batch_size from ..utils import assert_arrow_memor...
718
import numpy as np import torch from torch.nn import CrossEntropyLoss from transformers import AutoModelForCausalLM, AutoTokenizer import datasets from datasets import logging __a = '\\n\n' __a = '\nPerplexity (PPL) is one of the most common metrics for evaluating language models.\nIt...
300
0
import bza import gzip import lzma import os import shutil import struct import tarfile import warnings import zipfile from abc import ABC, abstractmethod from pathlib import Path from typing import Dict, List, Optional, Type, Union from .. import config from .filelock import FileLock from .logging import get_logg...
413
"""simple docstring""" import importlib import inspect import os import re # All paths are set with the intent you should run this script from the root of the repo with the command # python utils/check_config_docstrings.py __A = "src/transformers" # This is to make sure the transformers m...
346
0
"""simple docstring""" import json import os import unittest from transformers.models.ctrl.tokenization_ctrl import VOCAB_FILES_NAMES, CTRLTokenizer from ...test_tokenization_common import TokenizerTesterMixin class lowerCAmelCase ( snake_case__ , unittest.TestCase ): ...
709
"""simple docstring""" import gc import unittest import numpy as np import torch from diffusers import ( AudioDiffusionPipeline, AutoencoderKL, DDIMScheduler, DDPMScheduler, DiffusionPipeline, Mel, UNetaDConditionModel, UNetaDModel, ) from diffusers.utils imp...
304
0
'''simple docstring''' from ...configuration_utils import PretrainedConfig from ...utils import logging __UpperCamelCase = logging.get_logger(__name__) __UpperCamelCase = { "uclanlp/visualbert-vqa": "https://huggingface.co/uclanlp/visualbert-vqa/resolve/main/config...
26
'''simple docstring''' import argparse import torch from transformers import BlenderbotConfig, BlenderbotForConditionalGeneration from transformers.utils import logging logging.set_verbosity_info() __UpperCamelCase = logging.get_logger(__name__) __UpperCamelCase ...
26
1
import gc import unittest import torch from transformers import CLIPTextConfig, CLIPTextModel, CLIPTextModelWithProjection, CLIPTokenizer from diffusers import ( AutoencoderKL, DDIMScheduler, DDPMScheduler, PriorTransformer, StableUnCLIPPipeline, UNetaDConditionModel, ) from diffusers.pipeline...
711
import argparse from pathlib import Path import torch from packaging import version from torch.onnx import export from diffusers import AutoencoderKL lowerCAmelCase : Tuple =version.parse(version.parse(torch.__version__).base_version) < version.parse("1.11") def A__ ( ...
15
0
'''simple docstring''' from typing import TYPE_CHECKING from ...utils import OptionalDependencyNotAvailable, _LazyModule, is_tokenizers_available _SCREAMING_SNAKE_CASE = {"tokenization_herbert": ["HerbertTokenizer"]} try: if not is_tokenizers_available(): raise Optional...
369
'''simple docstring''' import argparse import json from pathlib import Path import requests import timm import torch from huggingface_hub import hf_hub_download from PIL import Image from transformers import DeiTImageProcessor, ViTConfig, ViTForImageClassification, ViTImageProcessor, Vi...
369
1
"""simple docstring""" def UpperCAmelCase__ (lowerCAmelCase_ , lowerCAmelCase_ ): '''simple docstring''' __SCREAMING_SNAKE_CASE = [0 for i in range(r + 1 )] # nc0 = 1 __SCREAMING_SNAKE_CASE = 1 for i in range(1 , n + 1 ): ...
553
"""simple docstring""" from __future__ import annotations def UpperCAmelCase__ (lowerCAmelCase_ ): '''simple docstring''' __SCREAMING_SNAKE_CASE = str(lowerCAmelCase_ ) return n == n[::-1] def UpperCAmelCase__ (lowerCAmelCase_ = 100_0000 ): ...
553
1
'''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, get_resize_output_image_size, normalize, rescale, res...
69
import argparse import torch from torch import nn from transformers import MaMaaaConfig, MaMaaaForConditionalGeneration def __lowercase ( snake_case ): """simple docstring""" __magic_name__ :Optional[Any] = [ '''encoder.version''', '''decoder.version''', ...
0
0
'''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 rescale, resize, to_channel_dimension_format from ...image_utils import ( ChannelDimension, ImageIn...
720
'''simple docstring''' from collections import defaultdict from graphs.minimum_spanning_tree_prims import prisms_algorithm as mst def __UpperCamelCase ( ) -> Tuple: '''simple docstring''' _a , _a = 9, 14 # noqa: F841 _a = [ [0, 1, 4], ...
276
0
'''simple docstring''' import copy import json import os import tempfile from transformers import is_torch_available from .test_configuration_utils import config_common_kwargs class A ( _a ): def __init__( self : Union[str, Any] , low...
22
"""simple docstring""" from typing import List, Optional, TypeVar from .arrow_dataset import Dataset, _concatenate_map_style_datasets, _interleave_map_style_datasets from .dataset_dict import DatasetDict, IterableDatasetDict from .info import DatasetInfo from .iterable_dataset import IterableDataset, _concate...
499
0
import re from typing import Callable, List, Optional, Union import tensorflow as tf try: from tensorflow.keras.optimizers.legacy import Adam except ImportError: from tensorflow.keras.optimizers import Adam class snake_case_ ( tf.keras.optimizers.schedules.LearningRateSchedule ): ...
240
import argparse import json from dataclasses import dataclass, field from functools import partial from pathlib import Path from typing import Callable, Dict, List, Tuple import timm import torch import torch.nn as nn from classy_vision.models.regnet import RegNet, RegNetParams, RegNetYaagf, RegNetYaagf, RegNetY...
240
1
"""simple docstring""" import os import unittest from transformers import BatchEncoding from transformers.models.bert.tokenization_bert import ( BasicTokenizer, WordpieceTokenizer, _is_control, _is_punctuation, _is_whitespace, ) from transformers.models.prophetnet.tokenization_prophetnet ...
77
'''simple docstring''' from typing import List, Optional from ...configuration_utils import PretrainedConfig from ...utils import logging a : List[str] = logging.get_logger(__name__) a : Tuple = { '''huggingface/autoformer-tourism-monthly''': '''https:...
69
0
'''simple docstring''' import itertools import os import re __lowercase : List[str] = re.compile(r'''([A-Z]+)([A-Z][a-z])''') __lowercase : Optional[int] = re.compile(r'''([a-z\d])([A-Z])''') __lowercase : int = re.compile(r'''(?<!_)_(?!_)''') __lowercase : ...
714
from ...configuration_utils import PretrainedConfig from ...utils import logging __lowercase : List[Any] = logging.get_logger(__name__) __lowercase : Optional[Any] = { '''google/realm-cc-news-pretrained-embedder''': ( '''https://huggingface.co/google/realm-cc-news-pretra...
315
0
'''simple docstring''' import warnings from typing import List, Optional, Union from ...processing_utils import ProcessorMixin from ...tokenization_utils_base import BatchEncoding, PaddingStrategy, PreTokenizedInput, TextInput, TruncationStrategy from ...utils import TensorType class UpperCamelCase...
50
'''simple docstring''' def A__ ( ): return [list(range(1000 - i , -1000 - i , -1 ) ) for i in range(1000 )] UpperCamelCase : Dict = generate_large_matrix() UpperCamelCase : Any = ( [[4, 3, 2, -1], [3, 2, 1, -1], [1, 1, -1, -2], [-1, -1, -...
50
1
import argparse import logging import os import datasets import tensorflow as tf from transformers import AutoTokenizer __UpperCAmelCase : Union[str, Any] = logging.getLogger(__name__) def lowerCamelCase_ ( ): _a : Optional[int] = argparse.ArgumentParser( descri...
703
from __future__ import annotations def lowerCamelCase_ ( UpperCamelCase_ ): # This function is recursive _a : Any = len(UpperCamelCase_ ) # If the array contains only one element, we return it (it's the stop condition of # recursion) if array_length <= 1: ...
249
0
from typing import TYPE_CHECKING from ...utils import OptionalDependencyNotAvailable, _LazyModule, is_torch_available SCREAMING_SNAKE_CASE__ : Optional[int] = { """configuration_x_clip""": [ """XCLIP_PRETRAINED_CONFIG_ARCHIVE_MAP""", """XCLIPConfig""", """XCLIPTextConfig...
0
import numpy as np from PIL import Image def _UpperCAmelCase ( UpperCAmelCase : np.ndarray , UpperCAmelCase : int , UpperCAmelCase : int ): """simple docstring""" __lowerCamelCase : List[str] = np.array(UpperCAmelCase...
519
0
import itertools import random import unittest import numpy as np from transformers import BatchFeature, SpeechTaFeatureExtractor from transformers.testing_utils import require_torch from transformers.utils.import_utils import is_torch_available from ...test_sequence_feature_extraction_common import SequenceF...
671
from typing import TYPE_CHECKING from ...utils import ( OptionalDependencyNotAvailable, _LazyModule, is_flax_available, is_tf_available, is_torch_available, ) A__ : Any = {'configuration_unispeech': ['UNISPEECH_PRETRAINED_CONFIG_ARCHIVE_MAP', 'UniSpeechConfig']} try: ...
671
1
'''simple docstring''' from typing import TYPE_CHECKING from ...utils import ( OptionalDependencyNotAvailable, _LazyModule, is_flax_available, is_tf_available, is_torch_available, ) _a : Any = { "configuration_resnet": ["RESNET_PRETRAINED_CONFIG_ARCHIVE_MAP", "ResNetCo...
56
import dataclasses import json import sys import types from argparse import ArgumentDefaultsHelpFormatter, ArgumentParser, ArgumentTypeError from copy import copy from enum import Enum from inspect import isclass from pathlib import Path from typing import Any, Callable, Dict, Iterable, List, Literal, NewType,...
520
0
'''simple docstring''' from ...configuration_utils import PretrainedConfig from ...utils import logging lowercase =logging.get_logger(__name__) lowercase ={ 'google/realm-cc-news-pretrained-embedder': ( 'https://huggingface.co/google/realm-cc-news-pretrained-embedder/resolve/main/con...
709
'''simple docstring''' import argparse import json from pathlib import Path import requests import torch from huggingface_hub import hf_hub_download from PIL import Image from transformers import DetrConfig, DetrForObjectDetection, DetrForSegmentation, DetrImageProcessor, ResNetConfig from transformers.utils...
331
0
"""simple docstring""" import unittest from transformers import XLMConfig, is_torch_available from transformers.testing_utils import require_torch, slow, torch_device from ...generation.test_utils import GenerationTesterMixin from ...test_configuration_common import ConfigTester from ...test_modeling_common import M...
420
"""simple docstring""" from collections.abc import Sequence from queue import Queue class UpperCAmelCase_ : def __init__( self : Optional[Any] , __UpperCamelCase : List[Any] , __UpperCamelCase : List[str] , __UpperCamelCase : Tuple , __UpperCamelCase : Optional[int]=...
420
1
import functools def _UpperCAmelCase ( SCREAMING_SNAKE_CASE__ : str , SCREAMING_SNAKE_CASE__ : str ): __UpperCamelCase =len(SCREAMING_SNAKE_CASE__ ) __UpperCamelCase =len(SCREAMING_SNAKE_CASE__ ) @functools.cache def min_dis...
682
# Copyright 2021 The HuggingFace Team. All rights reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applic...
682
1
from __future__ import annotations def _UpperCAmelCase (UpperCamelCase__ : list , UpperCamelCase__ : int | None = None , UpperCamelCase__ : int | None = None ): if start is None: _A : Dict = 0 if end is None: _A : O...
503
import math def _UpperCAmelCase (UpperCamelCase__ : int ): return math.sqrt(UpperCamelCase__ ) * math.sqrt(UpperCamelCase__ ) == num def _UpperCAmelCase (UpperCamelCase__ : int ): _A : Dict = 0 _A : Dict = n while left <=...
503
1
import math from typing import Optional import numpy as np from ...configuration_utils import PretrainedConfig from ...utils import logging A__ : List[str] = logging.get_logger(__name__) A__ : int = { """facebook/encodec_24khz""": """https://huggingface.co/facebook/encodec_24...
706
"""simple docstring""" from pathlib import PurePosixPath from typing import Optional import fsspec from fsspec import AbstractFileSystem from huggingface_hub.hf_api import DatasetInfo from ..utils.file_utils import get_authentication_headers_for_url from ..utils.hub import hf_hub_url class _lowercase ...
660
0
import argparse import json from pathlib import Path import requests import timm import torch from huggingface_hub import hf_hub_download from PIL import Image from transformers import DeiTConfig, DeiTForImageClassificationWithTeacher, DeiTImageProcessor from transformers.utils import logging logging.set_verbos...
500
import tempfile import torch from diffusers import ( DEISMultistepScheduler, DPMSolverMultistepScheduler, DPMSolverSinglestepScheduler, UniPCMultistepScheduler, ) from .test_schedulers import SchedulerCommonTest class UpperCAmelCase_ ( a): lowerCamelCase__ = (UniP...
500
1
import argparse import logging import pickle from collections import Counter logging.basicConfig( format="""%(asctime)s - %(levelname)s - %(name)s - %(message)s""", datefmt="""%m/%d/%Y %H:%M:%S""", level=logging.INFO ) _UpperCAmelCase : Union[str, Any] = logging.getLogger(__name__) if __...
704
import logging import os import sys from dataclasses import dataclass, field from typing import Optional import torch from datasets import load_dataset from torchvision.transforms import Compose, Lambda, Normalize, RandomHorizontalFlip, RandomResizedCrop, ToTensor from torchvision.transforms.functional import In...
188
0
from typing import TYPE_CHECKING from ...utils import OptionalDependencyNotAvailable, _LazyModule, is_torch_available _snake_case = { """configuration_luke""": ["""LUKE_PRETRAINED_CONFIG_ARCHIVE_MAP""", """LukeConfig"""], """tokenization_luke""": ["""LukeTokenizer"""], } try: if not is...
655
import io import os import unicodedata from typing import Any, Dict, List, Optional, Tuple import sentencepiece as spm from ...tokenization_utils import PreTrainedTokenizer from ...utils import logging _snake_case = logging.get_logger(__name__) _snake_case = """▁""" _snake_case ...
655
1
from __future__ import annotations class snake_case__: '''simple docstring''' def __init__( self , __lowercase ) -> Any: lowerCAmelCase_ : Union[str, Any] = TypeError( '''Matrices must be formed from a list of zero or mor...
619
import math from enum import Enum from typing import Optional, Union from torch.optim import Optimizer from torch.optim.lr_scheduler import LambdaLR from .utils import logging _UpperCAmelCase : Tuple =logging.get_logger(__name__) class snake_case__( UpperCAmelCase__ ): ...
619
1
from __future__ import annotations import unittest from transformers import LEDConfig, 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 from ...test_pipeline_m...
687
import glob import os import random from string import ascii_lowercase, digits import cva a = """""" a = """""" a = """""" a = 1 # (0 is vertical, 1 is horizontal) def UpperCamelCase_( ): """simple docstring"""...
687
1
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 ): '''simple docst...
670
from manim import * class _UpperCamelCase ( _A ): '''simple docstring''' def lowerCAmelCase__ ( self : int ): UpperCamelCase_: Dict = Rectangle(height=0.5 , width=0.5 ) UpperCamelCase_: Dict = Rectangle(height=0.46 ,...
670
1
import warnings from typing import List, Optional, Union from ...processing_utils import ProcessorMixin from ...tokenization_utils_base import BatchEncoding, PaddingStrategy, PreTokenizedInput, TextInput, TruncationStrategy from ...utils import TensorType class snake_case_ ( _UpperCamelCase ): ...
488
from ...utils import ( OptionalDependencyNotAvailable, is_torch_available, is_transformers_available, is_transformers_version, ) try: if not (is_transformers_available() and is_torch_available() and is_transformers_version(""">=""", """4.25.0""")): raise OptionalDependencyNotAvailable() ex...
112
0
'''simple docstring''' from manim import * class a ( _a ): """simple docstring""" def lowerCamelCase__ ( self : str ) -> Any: __UpperCAmelCase : Tuple = Rectangle(height=0.5 , width=0.5 ) ...
266
'''simple docstring''' import argparse import json from pathlib import Path import requests import torch from huggingface_hub import hf_hub_download from PIL import Image from timm import create_model from timm.data import resolve_data_config from timm.data.transforms_factory import create_trans...
266
1
'''simple docstring''' from collections import OrderedDict from typing import TYPE_CHECKING, Any, Mapping, Optional, Union from ...configuration_utils import PretrainedConfig from ...onnx import OnnxConfig from ...utils import logging if TYPE_CHECKING: from ... import FeatureExtractio...
28
def snake_case__ ( lowercase , lowercase ): lowerCAmelCase_: list[list[str]] = [[] for _ in range(lowercase )] lowerCAmelCase_: Optional[Any] = key - 1 if key <= 0: raise ValueError("Height of grid can't be 0 or negative" ) if key == 1 or len(lowercase ...
613
0
import warnings from ...utils import logging from .image_processing_owlvit import OwlViTImageProcessor A__: str = logging.get_logger(__name__) class _a ( UpperCamelCase__): """simple docstring""" def __init__( self: int , *__lowerCamelCase: Optio...
716
def lowerCAmelCase_ ( A_): UpperCamelCase__: Union[str, Any] = "" for ch in key: if ch == " " or ch not in key_no_dups and ch.isalpha(): key_no_dups += ch return key_no_dups def lowerCAmelCase_ ( A_): UpperCamelCase__...
221
0
"""simple docstring""" class lowerCamelCase__ : def __init__( self : Optional[Any] , _lowercase : Optional[Any] ): # we need a list not a string, so do something to change the type A = arr.split(',' ) def __a ( self : ...
690
"""simple docstring""" import pandas as pd from matplotlib import pyplot as plt from sklearn.linear_model import LinearRegression # Splitting the dataset into the Training set and Test set from sklearn.model_selection import train_test_split # Fitting Polynomial Regression to the dataset from sklearn.preprocessi...
690
1
from math import log from scipy.constants import Boltzmann, physical_constants lowerCAmelCase : List[Any] =300 # TEMPERATURE (unit = K) def A__ ( __A , __A , __A , ): '''simple docstring''' if donor_conc <= 0: raise ValueError("""Dono...
718
import unittest from transformers.utils.backbone_utils import ( BackboneMixin, get_aligned_output_features_output_indices, verify_out_features_out_indices, ) class __snake_case ( unittest.TestCase ): '''simple docstring''' def _SCREAMING_SNAKE_CASE (...
15
0
'''simple docstring''' import copy from ...configuration_utils import PretrainedConfig from ...utils import logging from ..auto import CONFIG_MAPPING lowerCamelCase_ = logging.get_logger(__name__) lowerCamelCase_ = { """ut/deta""": """https://huggingface.co/ut/deta/resolve/main/config....
418
"""simple docstring""" def a__ ( snake_case__ = 50_00_00_00 ) -> int: lowerCamelCase = set() lowerCamelCase = int((limit - 24) ** (1 / 2) ) lowerCamelCase = set(range(3 , prime_square_limit + 1 , 2 ) ) primes.add(2 ...
543
0
"""simple docstring""" from dataclasses import dataclass from enum import Enum from typing import List, Optional, Union import numpy as np import PIL from PIL import Image from ...utils import BaseOutput, is_torch_available, is_transformers_available @dataclass class snake_case ( _A ): ''...
713
"""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-2.0 ...
215
0