code
stringlengths
86
54.5k
code_codestyle
int64
0
371
style_context
stringlengths
87
49.2k
style_context_codestyle
int64
0
349
label
int64
0
1
"""simple docstring""" UpperCAmelCase__ : Tuple = [ 'DownloadConfig', 'DownloadManager', 'DownloadMode', 'StreamingDownloadManager', ] from .download_config import DownloadConfig from .download_manager import DownloadManager, DownloadMode from .streaming_download_m...
25
"""simple docstring""" import logging import os from logging import ( CRITICAL, # NOQA DEBUG, # NOQA ERROR, # NOQA FATAL, # NOQA INFO, # NOQA NOTSET, # NOQA WARN, # NOQA WARNING, # NOQA ) from typing import Optional from tqdm import auto as tqdm_lib ...
25
1
def SCREAMING_SNAKE_CASE ( lowercase_ , lowercase_ ) -> int: """simple docstring""" while second != 0: A__ = first & second first ^= second A__ = c << 1 return first if __name__ == "__main__": import doctest...
369
class UpperCamelCase_ : '''simple docstring''' def __init__( self : List[str] , UpperCAmelCase__ : int) ->Union[str, Any]: '''simple docstring''' A__ = n A__ = [None] * self.n A__ = 0 # index o...
231
0
"""simple docstring""" from ...configuration_utils import PretrainedConfig from ...utils import logging __A = logging.get_logger(__name__) __A = { # See all MEGATRON_BERT models at https://huggingface.co/models?filter=bert } class UpperCAmelCase (__SCREAMING_SNAKE_CASE ): """si...
177
"""simple docstring""" import json from typing import TYPE_CHECKING, List, Optional, Tuple from tokenizers import pre_tokenizers from ...tokenization_utils_base import BatchEncoding from ...tokenization_utils_fast import PreTrainedTokenizerFast from ...utils import logging from .tokenization_gpta import GPTaTokeniz...
316
0
from typing import List, Optional, Union import numpy as np from ...feature_extraction_sequence_utils import SequenceFeatureExtractor from ...feature_extraction_utils import BatchFeature from ...utils import PaddingStrategy, TensorType, logging UpperCamelCase = logging.get_logger(__name__) class ...
360
import unittest from transformers import 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 ModelTesterMixin, ids_tensor from...
65
0
"""simple docstring""" import os from typing import BinaryIO, Optional, Union import numpy as np import pyarrow.parquet as pq from .. import Audio, Dataset, Features, Image, NamedSplit, Value, config from ..features.features import FeatureType, _visit from ..formatting import query_table fro...
255
"""simple docstring""" def lowercase__ ( _UpperCAmelCase , _UpperCAmelCase ) -> Dict: '''simple docstring''' _enforce_args(_UpperCAmelCase , _UpperCAmelCase ) if n == 0: return 0 lowercase : Tuple = float('-inf' ...
255
1
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 A ( UpperCAmelCase__ ): '''simple docstring''' ...
146
def UpperCamelCase ( __magic_name__ : str ) -> List[str]: # noqa: E741 """simple docstring""" lowercase__ = len(__magic_name__ ) lowercase__ = 0 lowercase__ = [0] * n lowercase__ = [False] * n lowercase__ ...
146
1
from random import shuffle import tensorflow as tf from numpy import array def SCREAMING_SNAKE_CASE ( lowercase_ , lowercase_ ) -> Optional[Any]: """simple docstring""" A__ = int(lowercase_ ) assert noofclusters < len(lowercase_ ) ...
14
import warnings from pathlib import Path from typing import List, Tuple, Union import fire from torch import nn from transformers import AutoModelForSeqaSeqLM, AutoTokenizer, PreTrainedModel from transformers.utils import logging _a = logging.get_logger(__name__) def __A ( ...
39
0
'''simple docstring''' import numpy as np from nltk.translate import meteor_score import datasets from datasets.config import importlib_metadata, version lowerCamelCase : str = version.parse(importlib_metadata.version("nltk")) if NLTK_VERSION >= version.Version("3.6.4"): from nltk import word_toke...
370
'''simple docstring''' import os def _lowerCAmelCase ( ) -> List[str]: """simple docstring""" _SCREAMING_SNAKE_CASE =os.path.dirname(os.path.realpath(_UpperCamelCase ) ) _SCREAMING_SNAKE_CASE =os.path.join(_UpperCamelCase , 'triangle.txt' ) w...
114
0
"""simple docstring""" def A ( snake_case__ , snake_case__ ): '''simple docstring''' return price * (1 + tax_rate) if __name__ == "__main__": print(F'{price_plus_tax(100, 0.25) = }') print(F'{price_plus_tax(1_25.50, 0.05) = }')
165
"""simple docstring""" def A ( snake_case__ ): '''simple docstring''' assert isinstance(snake_case__ , snake_case__ ), f"""The input value of [n={number}] is not an integer""" if number == 1: return 2 elif number < 1: SCREAMING_SNAKE_CASE__ ...
165
1
from __future__ import annotations class __snake_case : def __init__( self : Tuple , _lowercase : int = 0 ): """simple docstring""" SCREAMING_SNAKE_CASE__ = key def __a ( self : List[Any] ...
204
import argparse import io import requests import torch from omegaconf import OmegaConf from diffusers import AutoencoderKL from diffusers.pipelines.stable_diffusion.convert_from_ckpt import ( assign_to_checkpoint, conv_attn_to_linear, create_vae_diffusers_config, renew_vae_attention_paths,...
204
1
import numpy as np from nltk.translate import meteor_score import datasets from datasets.config import importlib_metadata, version lowercase_ = version.parse(importlib_metadata.version("nltk")) if NLTK_VERSION >= version.Version("3.6.4"): from nltk import word_tokenize lowercase_ ...
7
'''simple docstring''' import pytest from datasets import inspect_metric, list_metrics, load_metric @pytest.fixture def UpperCAmelCase_ ( __lowerCamelCase : List[str] ): monkeypatch.setattr("datasets.utils.deprecation_utils._emitted_deprecation_warnings" ,set() ) @pytest....
223
0
'''simple docstring''' from typing import Dict, Iterable, 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...
83
'''simple docstring''' def _UpperCamelCase ( SCREAMING_SNAKE_CASE__ ) -> list: '''simple docstring''' snake_case : Any = len(SCREAMING_SNAKE_CASE__ ) for i in range(1 , SCREAMING_SNAKE_CASE__ ): snake_case : Optional[int] = collection[i] snak...
83
1
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, ) _SCREAMING_SNAKE_CASE = logging.getLo...
343
import os from itertools import chain from random import randrange, shuffle import pytest from .sola import PokerHand _SCREAMING_SNAKE_CASE = ( """4S 3H 2C 7S 5H""", """9D 8H 2C 6S 7H""", """2D 6D 9D TH 7D""", """TC 8C 2S JH 6C""", """JH 8S TH AH QH""", """TS KS 5S 9S AC""", ""...
343
1
import warnings from ..trainer import Trainer from ..utils import logging _A = logging.get_logger(__name__) class A ( a__ ): def __init__( self, UpperCamelCase__=None, **UpperCamelCase__ ): """simple docstring""" warnings.warn( ...
370
import pprint import requests _A = '''https://zenquotes.io/api''' def __UpperCamelCase ( ): return requests.get(API_ENDPOINT_URL + '''/today''' ).json() def __UpperCamelCase ( ): return requests.get(API_ENDPOINT_URL + '''/random''' ).json() if __name__ == "__main_...
167
0
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 lowerCamelCase = logging.get_logger(__name__) lowerCamelCase = '''▁''' lowerCamelC...
188
"""simple docstring""" class lowerCAmelCase_ : '''simple docstring''' def __init__( self : Dict ,A_ : list[int] ) -> None: A = len(A_ ) A = [0] * len_array if len_array > 0: A = array[0] f...
74
0
"""simple docstring""" from ...configuration_utils import PretrainedConfig from ...utils import logging _a : Dict= logging.get_logger(__name__) _a : List[Any]= { "caidas/swin2sr-classicalsr-x2-64": ( "https://huggingface.co/caidas/swin2sr-classicalsr-x2-64/resol...
95
"""simple docstring""" import gc import tempfile import unittest import numpy as np import torch from diffusers import VersatileDiffusionPipeline from diffusers.utils.testing_utils import load_image, nightly, require_torch_gpu, torch_device _a : int= False class UpperCamelCa...
95
1
import unittest import numpy as np import torch from torch import nn from transformers import ( CLIPImageProcessor, CLIPTextConfig, CLIPTextModelWithProjection, CLIPTokenizer, CLIPVisionConfig, CLIPVisionModelWithProjection, ) from diffusers import KandinskyVaaPriorPipeline, Pr...
232
from __future__ import annotations import sys from collections import deque from typing import Generic, TypeVar lowercase : Optional[Any] = TypeVar('T') class lowerCamelCase__ ( Generic[T]): '''simple docstring''' _A = 42 # Cache store ...
232
1
from sklearn.metrics import mean_squared_error import datasets snake_case_ = '''\ @article{scikit-learn, title={Scikit-learn: Machine Learning in {P}ython}, author={Pedregosa, F. and Varoquaux, G. and Gramfort, A. and Michel, V. and Thirion, B. and Grisel, O. and Blondel, M. and Prettenhofer, P...
216
from typing import TYPE_CHECKING from ...utils import ( OptionalDependencyNotAvailable, _LazyModule, is_flax_available, is_tf_available, is_torch_available, ) snake_case_ = {'''configuration_encoder_decoder''': ['''EncoderDecoderConfig''']} try: if not is_torch_available(): ...
216
1
import argparse A : Optional[int] = 'docs/source/_static/js/custom.js' def __lowerCAmelCase ( a__ ) -> Union[str, Any]: with open(a__ , encoding='''utf-8''' , newline='''\n''' ) as f: __a = f.readlines() __a = 0 # First let's put ...
6
from typing import TYPE_CHECKING from ...utils import ( OptionalDependencyNotAvailable, _LazyModule, is_flax_available, is_tf_available, is_tokenizers_available, is_torch_available, ) A : Optional[int] = { 'configuration_whisper': ['WHISPER_PRETRAINED_CONFIG_ARCHIVE_MAP', 'Whisper...
6
1
"""simple docstring""" import argparse import os import re import packaging.version SCREAMING_SNAKE_CASE : Dict = '''examples/''' SCREAMING_SNAKE_CASE : str = { '''examples''': (re.compile(R'''^check_min_version\(\"[^\"]+\"\)\s*$''', re.MULTILINE), '''check_min_version(\"V...
362
"""simple docstring""" import glob import os import random from string import ascii_lowercase, digits import cva import numpy as np # Parrameters SCREAMING_SNAKE_CASE : Any = (7_2_0, 1_2_8_0) # Height, Width SCREAMING_SNAKE_CASE : List[str] = (0.4, 0.6) # if height or width lo...
317
0
"""simple docstring""" from io import BytesIO from typing import List, Union import requests from ..utils import add_end_docstrings, is_decord_available, is_torch_available, logging, requires_backends from .base import PIPELINE_INIT_ARGS, Pipeline if is_decord_available(): import numpy as np f...
86
"""simple docstring""" import math import sys def __lowerCAmelCase (_UpperCamelCase ): if number != int(_UpperCamelCase ): raise ValueError('the value of input must be a natural number' ) if number < 0: raise ValueError('the value of input must not be a negative number' ) if number == 0: ret...
86
1
import json import os import subprocess import unittest from ast import literal_eval import pytest from parameterized import parameterized, parameterized_class from . import is_sagemaker_available if is_sagemaker_available(): from sagemaker import Session, TrainingJobAnalytics from sagemaker.huggingfac...
19
import datasets from .evaluate import evaluate a__ : Dict = '''\ @article{hendrycks2021cuad, title={CUAD: An Expert-Annotated NLP Dataset for Legal Contract Review}, author={Dan Hendrycks and Collin Burns and Anya Chen and Spencer Ball}, journal={arXiv preprint arXiv:2103.062...
19
1
"""simple docstring""" import argparse import io import requests import torch from omegaconf import OmegaConf from diffusers import AutoencoderKL from diffusers.pipelines.stable_diffusion.convert_from_ckpt import ( assign_to_checkpoint, conv_attn_to_linear, create_vae_diffusers_config, re...
91
import copy from typing import Any, Dict, List, Optional, Union import numpy as np import torch from ...audio_utils import mel_filter_bank, spectrogram, window_function from ...feature_extraction_sequence_utils import SequenceFeatureExtractor from ...feature_extraction_utils import BatchFeature from ...utils import...
285
0
UpperCamelCase__ = [ [0, 1_6, 1_3, 0, 0, 0], [0, 0, 1_0, 1_2, 0, 0], [0, 4, 0, 0, 1_4, 0], [0, 0, 9, 0, 0, 2_0], [0, 0, 0, 7, 0, 4], [0, 0, 0, 0, 0, 0], ] def lowerCAmelCase_ ( __A, __A, __A, __A ) -> List[Any]: '''simpl...
143
from __future__ import annotations def lowerCAmelCase_ ( __A, __A, __A, ) -> tuple: '''simple docstring''' if (electron_conc, hole_conc, intrinsic_conc).count(0 ) != 1: raise ValueError("You cannot supply more or less than 2 values" ...
143
1
from string import ascii_lowercase, ascii_uppercase def _snake_case( SCREAMING_SNAKE_CASE__ ) -> str: if not sentence: return "" lowercase : Optional[int] = dict(zip(SCREAMING_SNAKE_CASE__ , SCREAMING_SNAKE_CASE__ ) ) return lower_t...
20
from typing import Dict import numpy as np from ..utils import add_end_docstrings, is_tf_available, is_torch_available, logging from .base import PIPELINE_INIT_ARGS, GenericTensor, Pipeline, PipelineException if is_tf_available(): import tensorflow as tf from ..tf_utils import stable_softmax if is_torch_ava...
20
1
"""simple docstring""" import json import os from functools import lru_cache from typing import Dict, List, Optional, Tuple, Union import regex as re from ...tokenization_utils import AddedToken, PreTrainedTokenizer from ...tokenization_utils_base import BatchEncoding, EncodedInput from ...utils imp...
363
"""simple docstring""" import warnings from typing import List import numpy as np from ...processing_utils import ProcessorMixin from ...tokenization_utils_base import BatchEncoding from ...utils import is_flax_available, is_tf_available, is_torch_available class lowerCamelCase__ ( SC...
77
0
'''simple docstring''' from collections import Counter import numpy as np from sklearn import datasets from sklearn.model_selection import train_test_split a_ : Optional[int] = datasets.load_iris() a_ : str = np.array(data["""data"""]) a_ : Optional[Any] = np.array(data["...
55
'''simple docstring''' 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 imp...
190
0
"""simple docstring""" from ...configuration_utils import PretrainedConfig from ...utils import logging A_ = logging.get_logger(__name__) A_ = { '''edbeeching/decision-transformer-gym-hopper-medium''': ( '''https://huggingface.co/edbeeching/decision-transformer-gym-hopper-...
296
"""simple docstring""" from typing import TYPE_CHECKING from ...utils import ( OptionalDependencyNotAvailable, _LazyModule, is_sentencepiece_available, is_tokenizers_available, is_torch_available, ) A_ = { '''configuration_llama''': ['''LLAMA_PRETRAINED_CONFIG_ARCHIVE_MAP...
296
1
"""simple docstring""" import json from typing import Iterator, List, Union from tokenizers import AddedToken, Regex, Tokenizer, decoders, normalizers, pre_tokenizers, trainers from tokenizers.implementations.base_tokenizer import BaseTokenizer from tokenizers.models import Unigram from tokenizers.processors imp...
61
import argparse import torch from torch import nn from transformers import MBartConfig, MBartForConditionalGeneration def lowerCAmelCase_ ( __A ) -> Dict: '''simple docstring''' UpperCAmelCase__ = [ "encoder.version", "dec...
65
0
"""simple docstring""" from ..utils import DummyObject, requires_backends class __lowerCAmelCase ( metaclass=__magic_name__ ): UpperCamelCase__ = ['''keras_nlp'''] def __init__( self :Union[str, Any] , *__magic_name__ :Union[str, Any] , **__...
356
from ...configuration_utils import PretrainedConfig from ...utils import logging from ...utils.backbone_utils import BackboneConfigMixin, get_aligned_output_features_output_indices __UpperCamelCase : Optional[Any] = logging.get_logger(__name__) __UpperCamelCase : int = { "shi-labs/n...
347
0
"""simple docstring""" import importlib import os import sys # This is required to make the module import works (when the python process is running from the root of the repo) sys.path.append(".") def lowercase__( __SCREAMING_SNAKE_CASE : Dict ): lowercase_ : Optional[Any] ...
213
"""simple docstring""" import inspect import unittest import warnings from math import ceil, floor from transformers import LevitConfig from transformers.file_utils import cached_property, is_torch_available, is_vision_available from transformers.models.auto import get_values from transformers.testing_utils imp...
213
1
"""simple docstring""" import inspect import unittest from transformers import RegNetConfig, is_flax_available from transformers.testing_utils import require_flax, slow from transformers.utils import cached_property, is_vision_available from ...test_configuration_common import ConfigTester...
226
"""simple docstring""" import sys import turtle def lowercase ( A_ , A_ )-> tuple[float, float]: '''simple docstring''' return (pa[0] + pa[0]) / 2, (pa[1] + pa[1]) / 2 def lowercase ( A_ , A_ , A_ , A_ , ...
226
1
def UpperCAmelCase__ ( _A : float ): '''simple docstring''' if edge <= 0 or not isinstance(_A , _A ): raise ValueError('''Length must be a positive.''' ) return 3 * ((25 + 10 * (5 ** (1 / 2))) ** (1 / 2)) * (edge**2) def UpperCAmelCase__ ( _A ...
188
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 ( SwiftFormerConfig, SwiftFormerForImageClassification, ViTImageProcessor, ) from transformers.utils import logging logging.set_v...
188
1
"""simple docstring""" import pickle import shutil import tempfile import unittest from transformers import SPIECE_UNDERLINE, XGLMTokenizer, XGLMTokenizerFast from transformers.testing_utils import get_tests_dir, require_sentencepiece, require_tokenizers, slow from transformers.utils import cached_property f...
317
"""simple docstring""" from typing import TYPE_CHECKING # rely on isort to merge the imports from ...utils import OptionalDependencyNotAvailable, _LazyModule, is_torch_available SCREAMING_SNAKE_CASE : List[Any] = {'''configuration_focalnet''': ['''FOCALNET_PRETRAINED_CONFIG_ARCHIVE_MAP''', ''...
317
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 lowerCamelCase : List[str] = logging.get_logger(__name__) lowerCamel...
2
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 from transformers.utils impo...
130
0
from collections.abc import Callable import numpy as np def _a ( SCREAMING_SNAKE_CASE__ : Callable , SCREAMING_SNAKE_CASE__ : float , SCREAMING_SNAKE_CASE__ : float , SCREAMING_SNAKE_CASE__ : float , SCREAMING_SNAKE_CASE__ : float ) -> ...
366
from sympy import diff, lambdify, symbols from sympy.functions import * # noqa: F403 def _a ( SCREAMING_SNAKE_CASE__ : str , SCREAMING_SNAKE_CASE__ : complex , SCREAMING_SNAKE_CASE__ : str = "x" , SCREAMING_SNAKE_CASE__ : float = 10**-10 , SCREAMING_SN...
191
0
# Lint as: python3 # pylint: enable=line-too-long # pylint: disable=g-import-not-at-top,g-bad-import-order,wrong-import-position _UpperCAmelCase : int = """2.13.1""" import platform import pyarrow from packaging import version if version.parse(platform.python_version()) < version.parse("""3.7""...
285
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'], ['dat...
285
1
import argparse import collections import numpy as np import torch from flax import traverse_util from tax import checkpoints from transformers import MTaConfig, UMTaEncoderModel, UMTaForConditionalGeneration from transformers.utils import logging logging.set_verbosity_info() def A_ ( _lowerCAmelC...
140
import argparse import numpy as np import torch from transformers import SpeechTaHifiGan, SpeechTaHifiGanConfig, logging logging.set_verbosity_info() __lowerCamelCase : Dict = logging.get_logger("""transformers.models.speecht5""") def A_ ( _lowerCAmelCase , _lowerCAmelCase ...
140
1
'''simple docstring''' import argparse import json import os import fairseq import torch from fairseq.data import Dictionary # Register SEW's fairseq modules from sew_asapp import tasks # noqa: F401 from transformers import ( SEWConfig, SEWForCTC, SEWModel, WavaVecaCTCTokenizer, WavaVecaFe...
185
'''simple docstring''' import unittest from knapsack import knapsack as k class UpperCAmelCase_ (unittest.TestCase ): """simple docstring""" def lowercase_ ( self ) -> Optional[Any]: __lowerCamelCase : int = 0 __lowerCamelCase : Uni...
185
1
'''simple docstring''' def snake_case_ (UpperCamelCase : int = 100_0000 ): '''simple docstring''' _a = limit + 1 _a = [0] * limit for first_term in range(1 , UpperCamelCase ): for n in range(UpperCamelC...
179
'''simple docstring''' from typing import TYPE_CHECKING from ...utils import ( OptionalDependencyNotAvailable, _LazyModule, is_sentencepiece_available, is_tf_available, is_tokenizers_available, is_torch_available, ) _snake_case : List[str] = {'co...
179
1
"""simple docstring""" import mpmath # for roots of unity import numpy as np class lowerCAmelCase_ : """simple docstring""" def __init__(self , SCREAMING_SNAKE_CASE__=None , SCREAMING_SNAKE_CASE__=None ) -> Dict: """simple docstring...
25
"""simple docstring""" import unittest import numpy as np import torch from .utils_summarization import build_mask, compute_token_type_ids, process_story, truncate_or_pad class _lowerCAmelCase ( unittest.TestCase ): """simple docstring""" def snake_case ( ...
293
0
'''simple docstring''' from __future__ import annotations import math import random from collections.abc import Collection from typing import overload class A__ : def __init__( self , UpperCamelCase__ = None ) -> Optional[int]: '''simple docstring''' if comp...
368
'''simple docstring''' def UpperCAmelCase__ ( UpperCAmelCase__ = 10_00 ) -> int: return sum(2 * a * ((a - 1) // 2) for a in range(3, n + 1 ) ) if __name__ == "__main__": print(solution())
101
0
"""simple docstring""" import gc import random import unittest import numpy as np import torch from transformers import CLIPTextConfig, CLIPTextModel, CLIPTokenizer import diffusers from diffusers import ( AutoencoderKL, EulerDiscreteScheduler, StableDiffusionLatentUpscalePipeline, StableDiffusionP...
74
from __future__ import absolute_import, division, print_function, unicode_literals from torch import nn from torch.nn import CrossEntropyLoss, MSELoss from transformers import RobertaConfig from transformers.file_utils import add_start_docstrings, add_start_docstrings_to_model_forward from transformers.models.rob...
36
0
'''simple docstring''' import os import tempfile from functools import partial from unittest import TestCase from unittest.mock import patch import datasets import datasets.config from .utils import require_beam class UpperCAmelCase__ ( datasets.BeamBasedBuilder): def ...
243
'''simple docstring''' import csv import tweepy # Twitter API credentials a__ : Dict = '' a__ : List[str] = '' a__ : Optional[Any] = '' a__ : Any = '' def _lowercase ( __A ): '''simp...
243
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_singl...
168
'''simple docstring''' # Copyright 2023 The HuggingFace Inc. team. All rights reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/...
168
1
'''simple docstring''' import unittest from transformers import is_torch_available from transformers.testing_utils import require_sentencepiece, require_tokenizers, require_torch, slow if is_torch_available(): import torch from transformers import XLMRobertaModel @requir...
365
'''simple docstring''' import argparse import json import subprocess def _snake_case ( A , A ) -> Tuple: lowerCAmelCase__ = [] lowerCAmelCase__ = ( F"""curl -H \"Accept: application/vnd.github+json\" -H \"Authorization: ...
228
0
'''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 HfArg...
80
'''simple docstring''' def _UpperCamelCase ( __A ) -> int: '''simple docstring''' UpperCamelCase__ = 0 while num > 0: digit_sum += num % 10 num //= 10 return digit_sum def _UpperCamelCase ( __A = 100 ) ...
80
1
from typing import TYPE_CHECKING from ...utils import OptionalDependencyNotAvailable, _LazyModule, is_tf_available, is_torch_available _UpperCAmelCase : List[Any] = { "configuration_transfo_xl": ["TRANSFO_XL_PRETRAINED_CONFIG_ARCHIVE_MAP", "TransfoXLConfig"], "tokenization_transfo_xl": ["Tra...
158
import os import socket from contextlib import contextmanager import torch from ..commands.config.default import write_basic_config # noqa: F401 from ..state import PartialState from .dataclasses import DistributedType from .imports import is_deepspeed_available, is_tpu_available from .transformer_engine import...
158
1
import math from typing import List, Optional, Tuple, Union import numpy as np import torch from ..configuration_utils import ConfigMixin, register_to_config from .scheduling_utils import SchedulerMixin, SchedulerOutput class lowercase__ ( __lowerCamelCase , __lowerCamel...
201
import re from pathlib import Path from unittest import TestCase import pytest @pytest.mark.integration class lowercase__ ( __lowerCamelCase ): '''simple docstring''' def UpperCamelCase__ ( self, __magic_name__ ) -> Union[str, Any]: ...
201
1
"""simple docstring""" from collections import OrderedDict from typing import Any, List, Mapping, Optional from ... import PreTrainedTokenizer, TensorType, is_torch_available from ...configuration_utils import PretrainedConfig from ...onnx import OnnxConfigWithPast, PatchingSpec from ...utils import logging ...
357
"""simple docstring""" import json import os import unittest from transformers.models.blenderbot_small.tokenization_blenderbot_small import ( VOCAB_FILES_NAMES, BlenderbotSmallTokenizer, ) from ...test_tokenization_common import TokenizerTesterMixin class __snake_case ( _lowercase , ...
175
0
"""simple docstring""" from typing import TYPE_CHECKING from ...utils import OptionalDependencyNotAvailable, _LazyModule, is_torch_available _lowerCAmelCase :int = {'configuration_vit_msn': ['VIT_MSN_PRETRAINED_CONFIG_ARCHIVE_MAP', 'ViTMSNConfig']} try: if not is_torch_available(): raise Option...
263
"""simple docstring""" from ...configuration_utils import PretrainedConfig from ...utils import logging _lowerCAmelCase :List[str] = logging.get_logger(__name__) _lowerCAmelCase :Any = { 'tiiuae/falcon-40b': 'https://huggingface.co/tiiuae/falcon-40b/resolve/main/config.json', 'tiiua...
263
1
from __future__ import annotations def _a ( SCREAMING_SNAKE_CASE : list[int | str] ): """simple docstring""" create_state_space_tree(SCREAMING_SNAKE_CASE , [] , 0 , [0 for i in range(len(SCREAMING_SNAKE_CASE ) )] ) def _a ( SCREAMING_SNAKE...
365
import argparse import intel_extension_for_pytorch as ipex import torch from diffusers import DPMSolverMultistepScheduler, StableDiffusionPipeline __UpperCamelCase : Optional[int] = argparse.ArgumentParser("Stable Diffusion script with intel optimization", add_help=False) parser.add_argument("--dpm"...
51
0
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_ : Optional[Any] = logging.get_logger(__name__) a_ : Dict = { "fa...
137
import argparse import os import evaluate import torch from datasets import load_dataset from torch.optim import AdamW from torch.utils.data import DataLoader from transformers import AutoModelForSequenceClassification, AutoTokenizer, get_linear_schedule_with_warmup, set_seed from accelerate impor...
228
0
"""simple docstring""" import os import tempfile import unittest import uuid from pathlib import Path from transformers.testing_utils import get_tests_dir, require_soundfile, require_torch, require_vision from transformers.tools.agent_types import AgentAudio, AgentImage, AgentText from transformers.utils import is...
352
"""simple docstring""" def lowerCAmelCase_( lowercase_ : List[str] ) -> Optional[Any]: _lowerCamelCase = len(lowercase_ ) while cur > 1: # Find the maximum number in arr _lowerCamelCase = arr.index(max(arr[0:cur] ) ) # Reve...
73
0
from ...configuration_utils import PretrainedConfig from ...utils import logging A__ : Tuple = logging.get_logger(__name__) A__ : Any = { 's-JoL/Open-Llama-V1': 'https://huggingface.co/s-JoL/Open-Llama-V1/blob/main/config.json', } class __snake_case ( __A ): ...
103
'''simple docstring''' from typing import TYPE_CHECKING from ...utils import ( OptionalDependencyNotAvailable, _LazyModule, is_sentencepiece_available, is_tokenizers_available, is_torch_available, is_vision_available, ) UpperCamelCase__ : int = {...
344
0
from typing import Any def __lowerCamelCase ( lowerCamelCase__ , lowerCamelCase__ , lowerCamelCase__ , lowerCamelCase__ , lowerCamelCase__ , ): """simple docstring""" _validation( lowerCamelCase__ , lowerCamelCase__ , lowerCamelCase__ , low...
121
import copy import os from typing import Union from ...configuration_utils import PretrainedConfig from ...utils import logging lowerCAmelCase__ = logging.get_logger(__name__) lowerCAmelCase__ = { '''BridgeTower/bridgetower-base''': '''https://huggingface.co/BridgeTower/bridgetower-base/blob/m...
121
1
'''simple docstring''' from math import log from scipy.constants import Boltzmann, physical_constants lowercase_ = 300 # TEMPERATURE (unit = K) def lowerCamelCase ( __lowerCamelCase : float , __lowerCamelCase : float , __lowerCamelCase : float , ) ...
58
import math def lowerCAmelCase_ ( __A ) -> bool: '''simple docstring''' return math.sqrt(__A ) * math.sqrt(__A ) == num def lowerCAmelCase_ ( __A ) -> bool: '''simple docstring''' UpperC...
65
0
"""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 SCREAMING_SNAKE_CASE__ : __lowerCAmelCase : Optional[int] = 42 __lowerCAmelCase : ...
353
"""simple docstring""" def _snake_case ( UpperCamelCase : dict ): UpperCAmelCase : set[int] = set() # To detect a back edge, keep track of vertices currently in the recursion stack UpperCAmelCase : set[int] = set() return any( node not in visited and depth_f...
76
0
"""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_available():...
173
"""simple docstring""" import functools import gc import inspect import torch from .imports import is_npu_available, is_xpu_available def __magic_name__ ( *lowercase ): if not isinstance(lowercase , lowercase ): SCREAMING_SNAKE_CASE_: Optional[Any]...
173
1
def lowerCamelCase__ ( lowercase , lowercase ): """simple docstring""" SCREAMING_SNAKE_CASE : Dict = 0 while b > 0: if b & 1: res += a a += a b >>= 1 return res def lowerCamelCase__ ( lowercase , lowercase , lowe...
357
def lowerCamelCase__ ( lowercase , lowercase = 0 ): """simple docstring""" SCREAMING_SNAKE_CASE : int = length or len(lowercase ) SCREAMING_SNAKE_CASE : Optional[Any] = False for i in range(length - 1 ): if list_data[i] > list_data[i + 1]: ...
319
0
'''simple docstring''' import json from typing import List, Optional, Tuple from tokenizers import normalizers from ...tokenization_utils_fast import PreTrainedTokenizerFast from .tokenization_lxmert import LxmertTokenizer UpperCamelCase__ : str = {'''vocab_file''': '''vocab.txt''', '''tokenizer_fi...
112
'''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 #...
112
1
"""simple docstring""" from typing import Callable, List, Optional, Union import PIL import torch from transformers import ( CLIPImageProcessor, CLIPSegForImageSegmentation, CLIPSegProcessor, CLIPTextModel, CLIPTokenizer, ) from diffusers import DiffusionPipeline from diffusers.configuratio...
361
"""simple docstring""" # # This a `torch.distributed` diagnostics script that checks that all GPUs in the cluster (one or # many nodes) can talk to each other via nccl and allocate gpu memory. # # To run first adjust the number of processes and nodes: # # python -m torch.distributed.run --nproc_per_node 2 --nnod...
321
0
from __future__ import annotations import time SCREAMING_SNAKE_CASE :Dict = list[tuple[int, int]] SCREAMING_SNAKE_CASE :Any = [ [0, 0, 0, 0, 0, 0, 0], [0, 1, 0, 0, 0, 0, 0], # 0 are free path whereas 1's are obstacles [0, 0, 0, 0, 0, 0, 0], [0, 0, 1, 0, 0, 0, 0], ...
15
import numpy as np def UpperCAmelCase ( a_ , a_ , a_ = 1E-12 , a_ = 1_0_0 , ) -> tuple[float, np.ndarray]: """simple docstring""" assert np.shape(a_ )[0] == np.shape(a_ )[1] # Ensure proper dimensionality. assert np.shape(a_ )[0] == np.shape(a_ )[0] ...
15
1
"""simple docstring""" import argparse import logging import os from datetime import datetime import numpy as np import torch from torch import nn from torch.utils.data import DataLoader, RandomSampler, TensorDataset from tqdm import tqdm from transformers import GPTaLMHeadModel _lowerCAmelCase : Optio...
340
"""simple docstring""" # Lint as: python3 import os import re import urllib.parse from pathlib import Path from typing import Callable, List, Optional, Union from zipfile import ZipFile from ..utils.file_utils import cached_path, hf_github_url from ..utils.logging import get_logger from ..utils.version import...
340
1
import math import sys import cva import numpy as np def __lowerCamelCase ( snake_case__ ,snake_case__ ) -> np.ndarray: """simple docstring""" _SCREAMING_SNAKE_CASE = math.sqrt(snake_case__ ) _SCREAMING_SNAKE_CASE = ...
306
import random def __lowerCamelCase ( snake_case__ ) -> bool: """simple docstring""" _SCREAMING_SNAKE_CASE = num - 1 _SCREAMING_SNAKE_CASE = 0 while s % 2 == 0: _SCREAMING_SNAKE_CASE = s // 2 ...
306
1
import warnings from ...utils import logging from .image_processing_flava import FlavaImageProcessor lowerCamelCase_ = logging.get_logger(__name__) class __A( __lowerCamelCase ): """simple docstring""" def __init__(self , *SCREAMING_SNAKE_CASE_ , **SCREAMING_SNAKE_C...
354
import re import jax.numpy as jnp from flax.traverse_util import flatten_dict, unflatten_dict from jax.random import PRNGKey from ..utils import logging lowerCamelCase_ = logging.get_logger(__name__) def __magic_name__ ( __a : Optional[int] ): '''simple docstring''' ...
178
0
import warnings 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_ :str = logging.get_logger(__name__) a_ :Tuple = { "nvid...
277
import random import unittest import torch from diffusers import IFInpaintingPipeline from diffusers.utils import floats_tensor from diffusers.utils.import_utils import is_xformers_available from diffusers.utils.testing_utils import skip_mps, torch_device from ..pipeline_params import ( TEXT_GUIDED_IMAGE_INPAIN...
222
0
import warnings from ...utils import logging from .image_processing_flava import FlavaImageProcessor lowerCamelCase : Optional[Any] = logging.get_logger(__name__) class __lowercase (UpperCamelCase__ ): """simple docstring""" def __init__( self , *A , **A...
176
from argparse import ArgumentParser, Namespace from ..utils import logging from . import BaseTransformersCLICommand def SCREAMING_SNAKE_CASE__ ( lowercase ) -> List[str]: return ConvertCommand( args.model_type ,args.tf_checkpoint ,args.pytorch_dump_output ,args.conf...
176
1
from typing import TYPE_CHECKING from ...utils import ( OptionalDependencyNotAvailable, _LazyModule, is_sentencepiece_available, is_tf_available, is_tokenizers_available, is_torch_available, ) lowercase_ = {'configuration_xlnet': ['XLNET_PRETRAINED_CONFIG_ARCHIVE_MAP...
205
import logging import torch from torch import nn from torch.nn import CrossEntropyLoss, MSELoss from transformers.file_utils import add_start_docstrings, add_start_docstrings_to_model_forward from transformers.models.bert.modeling_bert import ( BERT_INPUTS_DOCSTRING, BERT_START_DOCSTRING, Be...
205
1
import os import unittest from transformers.models.transfo_xl.tokenization_transfo_xl import VOCAB_FILES_NAMES, TransfoXLTokenizer from ...test_tokenization_common import TokenizerTesterMixin class a ( __lowerCamelCase , unittest.TestCase ): __lowerCAmelCase : Dict ...
361
def _lowerCAmelCase ( __lowerCAmelCase ) -> list: """simple docstring""" for i in range(len(__lowerCAmelCase ) - 1 , 0 , -1 ): snake_case__ : List[Any] = False for j in range(__lowerCAmelCase , 0 , -1 ): if unsorte...
44
0
def _a ( SCREAMING_SNAKE_CASE : float ): """simple docstring""" if edge <= 0 or not isinstance(SCREAMING_SNAKE_CASE , SCREAMING_SNAKE_CASE ): raise ValueError('''Length must be a positive.''' ) return 3 * ((25 + 10 * (5 ** (1 / 2))) ** (1 / 2)) * (edge**2) def _a ( SCREAMING_...
146
from dataclasses import dataclass from typing import Dict, Optional, Union import torch import torch.nn.functional as F from torch import nn from ..configuration_utils import ConfigMixin, register_to_config from ..utils import BaseOutput from .attention import BasicTransformerBlock from .attention_processor import...
146
1
from .glue import glue_convert_examples_to_features, glue_output_modes, glue_processors, glue_tasks_num_labels from .squad import SquadExample, SquadFeatures, SquadVaProcessor, SquadVaProcessor, squad_convert_examples_to_features from .utils import DataProcessor, InputExample, InputFeatures, SingleSentenceClassificati...
360
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 BackboneTester...
90
0
from typing import TYPE_CHECKING from ...utils import ( OptionalDependencyNotAvailable, _LazyModule, is_torch_available, ) __snake_case : List[str] ={ 'configuration_encodec': [ 'ENCODEC_PRETRAINED_CONFIG_ARCHIVE_MAP', 'EncodecConfig', ], 'feature_extraction_e...
129
import warnings from contextlib import contextmanager from ...processing_utils import ProcessorMixin class lowerCamelCase__ ( lowerCamelCase__): '''simple docstring''' snake_case_ ="""Speech2TextFeatureExtractor""" snake_case_ ="""Speech2TextTokenizer""" def __init__(self ,__lo...
129
1
'''simple docstring''' def UpperCamelCase__ ( lowerCAmelCase , lowerCAmelCase = False ): """simple docstring""" if not isinstance(__a , __a ): _lowerCAmelCase = f"Expected string as input, found {type(__a...
350
'''simple docstring''' import collections import inspect import unittest from typing import Dict, List, Tuple from transformers import MaskFormerSwinConfig from transformers.testing_utils import require_torch, require_torch_multi_gpu, torch_device from transformers.utils import is_torch...
220
0
"""simple docstring""" import warnings from ...utils import logging from .image_processing_flava import FlavaImageProcessor lowercase_ = logging.get_logger(__name__) class snake_case ( _lowerCAmelCase ): '''simple docstring''' def __init__( self : Optional[int], ...
266
"""simple docstring""" import json import os from functools import lru_cache from typing import TYPE_CHECKING, List, Optional, Tuple import regex as re from ...tokenization_utils import AddedToken, PreTrainedTokenizer from ...utils import logging if TYPE_CHECKING: from transformers.pipelines.convers...
266
1
"""simple docstring""" from typing import TYPE_CHECKING from ...utils import ( OptionalDependencyNotAvailable, _LazyModule, is_sentencepiece_available, is_tokenizers_available, is_torch_available, ) lowerCAmelCase__ = {'''configuration_reformer''': ['''REFORMER_PRETRAINE...
244
"""simple docstring""" import doctest from collections import deque import numpy as np class _lowerCamelCase : def __init__(self ) -> None: UpperCamelCase = [2, 1, 2, -1] UpperCamelCase = [1, 2, 3, 4] def snake_case_ (self ) -> list...
244
1
"""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 __A ( a_ :int) ...
160
"""simple docstring""" from ...configuration_utils import PretrainedConfig from ...utils import logging UpperCAmelCase__ : Optional[Any] = logging.get_logger(__name__) UpperCAmelCase__ : Dict = { 'MIT/ast-finetuned-audioset-10-10-0.4593': ( 'https://...
25
0
'''simple docstring''' from typing import List, Optional, Union import torch from ...models import UNetaDConditionModel, VQModel from ...pipelines import DiffusionPipeline from ...pipelines.pipeline_utils import ImagePipelineOutput from ...schedulers import DDPMScheduler from ...utils impor...
362
'''simple docstring''' import argparse import json import os from pathlib import Path import requests import torch from transformers import JukeboxConfig, JukeboxModel from transformers.utils import logging logging.set_verbosity_info() __A : List[str] = logging.get_logg...
89
0
def a__ ( snake_case , snake_case , snake_case ): """simple docstring""" def update_area_of_max_square(snake_case , snake_case ) -> int: # BASE CASE if row >= rows or col >= cols: return 0 __SCREAMING_SNAKE_CASE : List[Any] = update_area_of_...
303
"""simple docstring""" from argparse import ArgumentParser, Namespace from ..utils import logging from . import BaseTransformersCLICommand def lowercase ( lowerCAmelCase__ : Namespace ) -> Tuple: return ConvertCommand( args.model_type , args.tf_checkpoint ...
45
0
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 ...
137
import argparse import dataclasses import json import logging import os import shutil from typing import List, Optional import datasets from accelerate import Accelerator from datasets import load_dataset from finetuning import finetune from tqdm.auto import tqdm import transformers from transformers...
137
1
'''simple docstring''' import re import tempfile from pathlib import Path import pytest import yaml from datasets.utils.readme import ReadMe # @pytest.fixture # def example_yaml_structure(): A =yaml.safe_load( '\\nname: ""\nallow_empty: false\nallow_empty_text: true\nsubsections:\n - name: "Da...
34
"""simple docstring""" import os import numpy import onnx def a_ ( lowerCamelCase , lowerCamelCase ): UpperCAmelCase__ = a.name UpperCAmelCase__ = b.name UpperCAmelCase__ = '' UpperCAmelCase__ = '' ...
98
0
import argparse import json import requests import torch from huggingface_hub import hf_hub_download from PIL import Image from transformers import ConvNextConfig, SegformerImageProcessor, UperNetConfig, UperNetForSemanticSegmentation def A ( __UpperCAmelCase ) -> Dict: '''simple doc...
344
import pytest UpperCamelCase_ = "__dummy_dataset1__" UpperCamelCase_ = "\nimport json\nimport os\n\nimport datasets\n\n\nREPO_URL = \"https://huggingface.co/datasets/albertvillanova/tests-raw-jsonl/resolve/main/\"\nURLS = {\"train\": REPO_URL + \"wikiann-bn-train.jsonl\", \"validation\": RE...
344
1
import argparse import torch from transformers import FunnelBaseModel, FunnelConfig, FunnelModel, load_tf_weights_in_funnel from transformers.utils import logging logging.set_verbosity_info() def SCREAMING_SNAKE_CASE ( lowercase_ , lowercase_ , lowercase_ , lowercase_ ) -> ...
14
from dataclasses import dataclass from typing import List, Optional, Union import numpy as np import torch from ...utils import BaseOutput, OptionalDependencyNotAvailable, is_torch_available, is_transformers_available @dataclass class _UpperCamelCase ( lowerCAmelCase ): UpperCAmelCase_ = ...
169
0
'''simple docstring''' def __lowerCAmelCase (__lowerCAmelCase = 4_000_000 ): _UpperCAmelCase : List[Any] = [] _UpperCAmelCase , _UpperCAmelCase : Dict = 0, 1 while b <= n: if b % 2 == 0: even_fibs.append(__lowerCAmelCase ) _UpperCAmelCase ...
322
'''simple docstring''' from __future__ import annotations from collections.abc import Callable lowerCamelCase__ = list[list[float | int]] def __lowerCAmelCase (__lowerCAmelCase , __lowerCAmelCase ): _UpperCAmelCase : int = len(__lowerCAmelCase ) _Up...
322
1
'''simple docstring''' import json from typing import List, Optional, Tuple from tokenizers import normalizers from ....tokenization_utils_fast import PreTrainedTokenizerFast from ....utils import logging from .tokenization_retribert import RetriBertTokenizer __lowerCAmelCase = logging.get_logger(__n...
89
from pathlib import Path import cva import numpy as np from matplotlib import pyplot as plt def _a ( lowerCamelCase: np.ndarray , lowerCamelCase: np.ndarray , lowerCamelCase: np.ndarray , lowerCamelCase: int , lowerCamelCase: int ) -> np.ndarray: ...
117
0
"""simple docstring""" import socket def SCREAMING_SNAKE_CASE ( ) -> str: _lowerCAmelCase : Optional[int] = socket.socket(socket.AF_INET ,socket.SOCK_STREAM ) _lowerCAmelCase : Optional[int] = socket.gethostname() _lowerCAmelCase : Tuple ...
353
"""simple docstring""" from typing import Optional import pyspark from .. import Features, NamedSplit from ..download import DownloadMode from ..packaged_modules.spark.spark import Spark from .abc import AbstractDatasetReader class __A ( SCREAMING_SNAKE_CASE_ ): def __init__( self , ...
126
0
'''simple docstring''' from typing import List, Optional, Union from ...configuration_utils import PretrainedConfig from ...utils import logging lowerCamelCase : Any = logging.get_logger(__name__) lowerCamelCase : Dict = { 'huggingface/time-series-transformer-tourism-monthly': ...
2
from typing import TYPE_CHECKING from ...utils import ( OptionalDependencyNotAvailable, _LazyModule, is_flax_available, is_sentencepiece_available, is_tf_available, is_tokenizers_available, is_torch_available, ) A : Dict = { 'configuration_xlm_roberta': [ 'XLM_ROBERTA_...
6
0
import os import sys lowercase : Any = os.path.join(os.path.dirname(__file__), "src") sys.path.append(SRC_DIR) from transformers import ( AutoConfig, AutoModel, AutoModelForCausalLM, AutoModelForMaskedLM, AutoModelForQuestionAnswering, AutoModelForSequenceClassification, ...
358
from typing import TYPE_CHECKING from ..utils import _LazyModule lowercase : Union[str, Any] = { "config": [ "EXTERNAL_DATA_FORMAT_SIZE_LIMIT", "OnnxConfig", "OnnxConfigWithPast", "OnnxSeq2SeqConfigWithPast", "PatchingSpec", ], "convert": ["expor...
171
0
'''simple docstring''' class lowerCamelCase_ : '''simple docstring''' def __init__( self : Tuple , A : Any , A : str , A : Union[str, Any] ): _UpperCAmelCase : Optional[int] = None _Upp...
31
'''simple docstring''' __SCREAMING_SNAKE_CASE : Dict = 8.3_1_4_4_6_2 # Unit - J mol-1 K-1 def UpperCamelCase_ ( _UpperCAmelCase : float , _UpperCAmelCase : float , _UpperCAmelCase : float ) -> float: """simple docstring""" if moles < ...
31
1
from typing import Dict, List, Optional, Union import numpy as np from ...image_processing_utils import BaseImageProcessor, BatchFeature, get_size_dict from ...image_transforms import ( center_crop, convert_to_rgb, get_resize_output_image_size, normalize, rescale, resize, to_channel_...
356
import io import math from typing import Dict, Optional, Union import numpy as np from huggingface_hub import hf_hub_download from ...image_processing_utils import BaseImageProcessor, BatchFeature from ...image_transforms import convert_to_rgb, normalize, to_channel_dimension_format, to_pil_image from ...image_...
328
0
def UpperCamelCase__ ( A__ , A__ ) -> str: snake_case__ : Optional[Any] = 0 while b > 0: if b & 1: res += a a += a b >>= 1 return res def UpperCamelCase__ ( A__ , A__ , A__ ) -> int: snake_case...
143
import random from .binary_exp_mod import bin_exp_mod def UpperCamelCase__ ( A__ , A__=1000 ) -> Optional[int]: if n < 2: return False if n % 2 == 0: return n == 2 # this means n is odd snake_case__ : List[Any] = n - 1 snake_case...
143
1
import random import sys import numpy as np from matplotlib import pyplot as plt from matplotlib.colors import ListedColormap lowerCamelCase : List[Any] = "Usage of script: script_name <size_of_canvas:int>" lowerCamelCase : List[str] = [0] * 100 + [1] * 10 random.shu...
208
import math def _SCREAMING_SNAKE_CASE ( lowercase : float , lowercase : float ): '''simple docstring''' return math.pow(lowercase , 2 ) - a def _SCREAMING_SNAKE_CASE ( lowercase : float ): ''...
208
1
import argparse from torch import nn # transformers_old should correspond to branch `save_old_prophetnet_model_structure` here # original prophetnet_checkpoints are saved under `patrickvonplaten/..._old` respectively from transformers_old.modeling_prophetnet import ( ProphetNetForConditionalGeneration as Prophe...
248
import os import re import shutil from argparse import ArgumentParser, Namespace from datasets.commands import BaseDatasetsCLICommand from datasets.utils.logging import get_logger __snake_case : Dict = """<<<<<<< This should probably be modified because it mentions: """ __snake_case : ...
248
1
import argparse import json import os import re import torch from transformers import BloomConfig, BloomModel from transformers.file_utils import CONFIG_NAME, WEIGHTS_NAME from transformers.utils import logging logging.set_verbosity_info() _lowercase: List[Any] = [ "word_embeddings_layernorm.we...
71
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, RegNetYaa...
71
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 rescale, resize, to_channel_dimension_format from ...image_utils import ( ChannelDimension, ImageInpu...
250
"""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, OnnxSeqaSeqConfig...
109
0
"""simple docstring""" import unittest from transformers import DonutProcessor __SCREAMING_SNAKE_CASE : Union[str, Any] = '''naver-clova-ix/donut-base''' class lowerCamelCase_( unittest.TestCase ): '''simple docstring''' def snake_case__ ( self ): ...
73
"""simple docstring""" import os import tempfile import unittest import uuid from pathlib import Path from transformers.testing_utils import get_tests_dir, require_soundfile, require_torch, require_vision from transformers.tools.agent_types import AgentAudio, AgentImage, AgentText from transformers.utils import is...
73
1
"""simple docstring""" import argparse import torch from transformers import ( SpeechTaConfig, SpeechTaFeatureExtractor, SpeechTaForSpeechToSpeech, SpeechTaForSpeechToText, SpeechTaForTextToSpeech, SpeechTaProcessor, SpeechTaTokenizer, logging, ) from transformers.tokenization_utils ...
69
'''simple docstring''' import shutil import tempfile import unittest from transformers import ClapFeatureExtractor, ClapProcessor, RobertaTokenizer, RobertaTokenizerFast from transformers.testing_utils import require_sentencepiece, require_torchaudio from .test_feature_extraction_clap import floats_list @require_...
309
0
def _a ( UpperCAmelCase ) -> int: """simple docstring""" lowerCamelCase__ : Any = len(UpperCAmelCase ) while cur > 1: # Find the maximum number in arr lowerCamelCase__ : List[Any] = arr.index(max(arr[0:cur] ) ...
265
from math import ceil from typing import List, Optional, Union import numpy as np from ...audio_utils import mel_filter_bank, spectrogram, window_function from ...feature_extraction_sequence_utils import BatchFeature, SequenceFeatureExtractor from ...utils import TensorType, logging _A : List[str] = lo...
265
1
"""simple docstring""" import gc import random import unittest import numpy as np import torch from transformers import XLMRobertaTokenizer from diffusers import ( AltDiffusionImgaImgPipeline, AutoencoderKL, PNDMScheduler, UNetaDConditionModel, ) from diffusers.image_proce...
84
"""simple docstring""" import tempfile import unittest import numpy as np import transformers from transformers import GPTaTokenizer, GPTJConfig, is_flax_available, is_torch_available from transformers.testing_utils import is_pt_flax_cross_test, require_flax, tooslow from ...generation.test_flax_utils import FlaxG...
316
0
import math from datetime import datetime, timedelta def lowerCamelCase__ ( lowercase ): """simple docstring""" SCREAMING_SNAKE_CASE : Optional[int] = year % 19 SCREAMING_SNAKE_CASE : List[str] = year % 4 SCREAMING_SNAKE_CASE : str = year % 7 S...
319
def lowerCamelCase__ ( lowercase , lowercase = 0 ): """simple docstring""" SCREAMING_SNAKE_CASE : int = length or len(lowercase ) SCREAMING_SNAKE_CASE : Optional[Any] = False for i in range(length - 1 ): if list_data[i] > list_data[i + 1]: ...
319
1