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
'''simple docstring''' import json import os from pathlib import Path from shutil import copyfile from typing import Any, Dict, List, Optional, Tuple, Union import sentencepiece from ...tokenization_utils import PreTrainedTokenizer from ...utils import logging a : int = logging.get_logger(__name__...
679
'''simple docstring''' import json from typing import Dict, List, Optional, Tuple, Union from tokenizers import pre_tokenizers, processors from ...tokenization_utils_base import AddedToken, BatchEncoding, EncodedInput from ...tokenization_utils_fast import PreTrainedTokenizerFast from ...utils import PaddingStrate...
679
1
import inspect import unittest import numpy as np from tests.test_modeling_common import floats_tensor from transformers import MaskaFormerConfig, is_torch_available, is_vision_available from transformers.testing_utils import require_torch, require_torch_multi_gpu, require_vision, slow, torch_device from trans...
515
import numpy as np from cva import COLOR_BGR2GRAY, cvtColor, imread from numpy import array, uinta from PIL import Image from digital_image_processing import change_contrast as cc from digital_image_processing import convert_to_negative as cn from digital_image_processing import sepia as sp from digital_image_p...
515
1
from math import factorial, pi def __UpperCAmelCase ( lowerCamelCase_ : float , lowerCamelCase_ : int = 30 ) -> float: """simple docstring""" if not isinstance(lowerCamelCase_ , (int, float) ): raise ValueError('maclaurin_sin() requires ...
105
from typing import TYPE_CHECKING from ...utils import ( OptionalDependencyNotAvailable, _LazyModule, is_flax_available, is_tf_available, is_tokenizers_available, is_torch_available, ) UpperCamelCase__ : Optional[Any] = { '''configuration_whisper''': ['''WHISPER_PRETRAINE...
105
1
"""simple docstring""" 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 Ba...
487
"""simple docstring""" from ...processing_utils import ProcessorMixin class a__ ( __magic_name__ ): lowercase_ = ["image_processor", "feature_extractor"] lowercase_ = "TvltImageProcessor" lowercase_ = "TvltFeatureExtractor" def __init__( self : Tuple , Up...
487
1
'''simple docstring''' import argparse import json import logging import os import sys from unittest.mock import patch from transformers.testing_utils import TestCasePlus, get_gpu_count, slow lowerCamelCase_ = [ os.path.join(os.path.dirname(__file__), dirname) for dirname in [ """t...
330
"""simple docstring""" from typing import Union import fire import torch from tqdm import tqdm def _lowerCamelCase( a , a = "cpu" , a = None ): __a = torch.load(a , map_location=a ) for k, v in tqdm(state_dict.items() ): if not isinstance(a , tor...
528
0
from __future__ import annotations import unittest from transformers import is_tf_available, is_torch_available from transformers.testing_utils import DUMMY_UNKNOWN_IDENTIFIER, SMALL_MODEL_IDENTIFIER, is_pt_tf_cross_test, slow if is_tf_available(): from transformers import ( AutoConfig, BertConfig...
182
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, ) snake_case : str = { 'configuration_albert': ['ALBERT_P...
182
1
'''simple docstring''' from diffusers.utils.testing_utils import require_onnxruntime @require_onnxruntime class _SCREAMING_SNAKE_CASE : """simple docstring""" pass
316
'''simple docstring''' def lowerCamelCase_ ( A_ = 3 , A_ = 7 , A_ = 1_00_00_00 ): __lowerCamelCase = 0 __lowerCamelCase = 1 for current_denominator in range(1 , limit + 1 ): __lowerCamelCase = current_denominator * numerator // denominator ...
316
1
from __future__ import annotations from typing import Any class __UpperCamelCase : '''simple docstring''' def __init__( self , UpperCAmelCase_ ): lowerCAmelCase = num_of_nodes lowerCAmelCase = [] lowerCAmelCase =...
33
import io import itertools import json from dataclasses import dataclass from typing import Optional import pyarrow as pa import pyarrow.json as paj import datasets from datasets.table import table_cast from datasets.utils.file_utils import readline UpperCAmelCase_ =datasets.utils.loggi...
33
1
import argparse import os from transformers.utils import direct_transformers_import # All paths are set with the intent you should run this script from the root of the repo with the command # python utils/check_task_guides.py UpperCamelCase__ : List[Any] = '''src/transformers''' UpperCamelCase__ : ...
105
"""simple docstring""" from __future__ import annotations from collections.abc import Sequence from typing import Literal def A ( _A, _A ): """simple docstring""" snake_case_ :List[str] = list(_A ) snake_case_ :Any = list(_A ) snake_cas...
584
0
def A_ ( snake_case : int , snake_case : list ) -> Optional[Any]: '''simple docstring''' _enforce_args(snake_case , snake_case ) if n == 0: return 0 __UpperCamelCase = float('''-inf''' ) for i in range(1 , n + 1 ): ...
702
from collections.abc import Callable from math import pi, sqrt from random import uniform from statistics import mean def A_ ( snake_case : int ) -> int: '''simple docstring''' def is_in_circle(snake_case : float , snake_case : float ) -> bool: ...
451
0
import unittest from transformers import DebertaVaTokenizer, DebertaVaTokenizerFast from transformers.testing_utils import get_tests_dir, require_sentencepiece, require_tokenizers, slow from ...test_tokenization_common import TokenizerTesterMixin _lowerCamelCase : Union[str, Any] ...
663
import json import os import unittest from transformers import AutoTokenizer, GPTaTokenizer, GPTaTokenizerFast from transformers.models.gpta.tokenization_gpta import VOCAB_FILES_NAMES from transformers.testing_utils import require_tokenizers from ...test_tokenization_common import TokenizerTesterM...
663
1
def A ( __UpperCAmelCase ) -> Union[str, Any]: '''simple docstring''' if collection == []: return [] # get some information about the collection UpperCAmelCase_ = len(__UpperCAmelCase ) UpperCAmelCase_ = max(__UpperCAmelCase ) ...
701
from collections import OrderedDict from typing import Mapping from ...configuration_utils import PretrainedConfig from ...onnx import OnnxConfig from ...utils import logging UpperCamelCase_ = logging.get_logger(__name__) UpperCamelCase_ = { "bert-base-uncased": "https://huggingface.co/bert-ba...
561
0
'''simple docstring''' import argparse from pathlib import Path import fairseq import torch from fairseq.models.xmod import XMODModel as FairseqXmodModel from packaging import version from transformers import XmodConfig, XmodForMaskedLM, XmodForSequenceClassification from transformers.utils import loggin...
692
'''simple docstring''' from typing import TYPE_CHECKING from ...utils import OptionalDependencyNotAvailable, _LazyModule, is_speech_available, is_torch_available __A : str = { "configuration_audio_spectrogram_transformer": [ "AUDIO_SPECTROGRAM_TRANSFORMER_PRETRAIN...
275
0
"""simple docstring""" import functools import operator from ...configuration_utils import PretrainedConfig from ...utils import logging __lowercase : Any = logging.get_logger(__name__) __lowercase : List[Any] = { "facebook/wav2vec2-base-960h"...
712
"""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, ...
93
0
'''simple docstring''' from __future__ import annotations from math import pow, sqrt def _UpperCamelCase ( __UpperCamelCase ,__UpperCamelCase ,__UpperCamelCase ) -> dict[str, float]: if (resistance, reactance, impedance).count(0 ) != 1: raise ValueError('One and only one a...
42
"""simple docstring""" from typing import TYPE_CHECKING from ...utils import ( OptionalDependencyNotAvailable, _LazyModule, is_flax_available, is_tf_available, is_torch_available, ) snake_case_ : Tuple = {"""configuration_unispeech""": ["""UNISPEECH_PRETRAINED_CONFIG_ARCHIVE_MAP""...
595
0
import gc import unittest import numpy as np import torch from diffusers import DanceDiffusionPipeline, IPNDMScheduler, UNetaDModel from diffusers.utils import slow, torch_device from diffusers.utils.testing_utils import enable_full_determinism, require_torch_gpu, skip_mps from ..pipeline_params import U...
715
from collections import deque class __lowerCamelCase : def __init__( self , __snake_case , __snake_case , __snake_case ) -> None: """simple docstring""" UpperCAmelCase: Tuple = process_name # process name ...
166
0
'''simple docstring''' def __UpperCAmelCase ( _UpperCAmelCase : int ) -> str: if isinstance(_UpperCAmelCase , _UpperCAmelCase ): raise TypeError("'float' object cannot be interpreted as an integer" ) if isinstance(_UpperCAmelCase , _UpperCAmelCase ...
69
'''simple docstring''' 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 ...
683
0
import sys _snake_case = ( "73167176531330624919225119674426574742355349194934" "96983520312774506326239578318016984801869478851843" "85861560789112949495459501737958331952853208805511" "12540698747158523863050715693290963295227443043557" "668966489504452445231617318564030987111...
413
_snake_case = [ "DownloadConfig", "DownloadManager", "DownloadMode", "StreamingDownloadManager", ] from .download_config import DownloadConfig from .download_manager import DownloadManager, DownloadMode from .streaming_download_manager import StreamingDownloadManager
413
1
'''simple docstring''' import numpy as np import qiskit def _a ( _lowerCamelCase = 8 , _lowerCamelCase = None ) -> str: """simple docstring""" __snake_case : Any = np.random.default_rng(seed=_lowerCamelCase ) ...
26
'''simple docstring''' from __future__ import annotations import math def _a ( _lowerCamelCase , _lowerCamelCase , _lowerCamelCase , _lowerCamelCase , _lowerCamelCase ) -> int: """simple docstring""" if depth < 0: raise V...
26
1
import numpy # List of input, output pairs lowerCAmelCase__ : int = ( ((5, 2, 3), 15), ((6, 5, 9), 25), ((11, 12, 13), 41), ((1, 1, 1), 8), ((11, 12, 13), 41), ) lowerCAmelCase__ : Tuple = (((5_15, 22, 13), 5_55), ((61, 35, 49), 1_50)) lowerCAmelCase__ : Dict = ...
707
from collections import namedtuple lowerCAmelCase__ : Union[str, Any] = namedtuple('''from_to''', '''from_ to''') lowerCAmelCase__ : Tuple = { '''cubicmeter''': from_to(1, 1), '''litre''': from_to(0.0_01, 10_00), '''kilolitre''': from_to(1, 1), '''gallon''': from_to(0.0_04_54...
699
0
"""simple docstring""" from __future__ import annotations import math def lowerCAmelCase ( __UpperCamelCase , __UpperCamelCase , __UpperCamelCase , __UpperCamelCase , __UpperCamelCase ): '''simple docstring''' if depth < 0: raise ValueError("""De...
65
"""simple docstring""" from typing import TYPE_CHECKING from ....utils import OptionalDependencyNotAvailable, _LazyModule, is_torch_available _lowercase = { '''configuration_mctct''': ['''MCTCT_PRETRAINED_CONFIG_ARCHIVE_MAP''', '''MCTCTConfig'''], '''feature_extraction_mctct''': ['''MCTCTFeatureEx...
91
0
'''simple docstring''' from ...processing_utils import ProcessorMixin from ...tokenization_utils_base import BatchEncoding class a__( lowerCAmelCase__ ): '''simple docstring''' UpperCAmelCase_ : Tuple = '''ClapFeatureExtractor''' UpperCAmelCase_ : List[Any] = (...
707
'''simple docstring''' # Copyright 2023 The HuggingFace Team. All rights reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # U...
605
0
from itertools import zip_longest import requests from bsa import BeautifulSoup from pandas import DataFrame def _a ( lowerCamelCase = "laptop" ): lowerCamelCase : Union[str, Any] = F'''https://www.amazon.in/laptop/s?k={product}''' lowerCamelCase : Optional[int] ...
681
import copy import random from transformers import CLIPTokenizer class A__ ( __SCREAMING_SNAKE_CASE): def __init__( self , *__magic_name__ , **__magic_name__ ): super().__init__(*__magic_name__ , **__magic_name__ ) lowerCamelCase : Dict ...
681
1
import qiskit def UpperCAmelCase__ ( lowerCamelCase_ : int = 2 ): __a : Optional[Any] = qubits # Using Aer's simulator __a : List[Any] = qiskit.Aer.get_backend('aer_simulator' ) # Creating a Quantum Circuit acting on the q register __a :...
577
def UpperCAmelCase__ ( lowerCamelCase_ : int ): if not isinstance(lowerCamelCase_ , lowerCamelCase_ ): raise ValueError('Input must be an integer' ) if input_num <= 0: raise ValueError('Input must be positive' ) return sum( d...
577
1
'''simple docstring''' def __snake_case ( lowerCamelCase_ : list[list[int | float]] ): '''simple docstring''' __magic_name__ = len(lowerCamelCase_ ) __magic_name__ = len(matrix[0] ) __magic_name__ = min(lowerCamelCase_ , lowerCamelCase_ ...
664
'''simple docstring''' import unittest from transformers import is_torch_available from transformers.testing_utils import require_torch if is_torch_available(): import torch from transformers.generation import DisjunctiveConstraint @require_torch class UpperCamelCase_ ( unittest.TestCa...
664
1
"""simple docstring""" import argparse import json from collections import OrderedDict from pathlib import Path import requests import torch from huggingface_hub import hf_hub_download from PIL import Image from transformers import ( ConditionalDetrConfig, ConditionalDetrForObjectDetection, ConditionalD...
716
"""simple docstring""" from __future__ import annotations import unittest from transformers import MobileBertConfig, is_tf_available from transformers.models.auto import get_values from transformers.testing_utils import require_tf, slow from ...test_configuration_common import ConfigTester from ...test_modeling_tf...
147
0
'''simple docstring''' import argparse from collections import OrderedDict from pathlib import Path import torch from transformers import ( VisualBertConfig, VisualBertForMultipleChoice, VisualBertForPreTraining, VisualBertForQuestionAnswering, VisualBertForVisualReasoning, ) from transformers...
261
import pytest from datasets.utils.sharding import _distribute_shards, _number_of_shards_in_gen_kwargs, _split_gen_kwargs @pytest.mark.parametrize( '''kwargs, expected''' ,[ ({'''num_shards''': 0, '''max_num_jobs''': 1}, []), ({'''num_shards''': 10, '''max_num_jobs''': 1}, [range(10 ...
481
0
'''simple docstring''' from typing import TYPE_CHECKING from ...file_utils import _LazyModule, is_torch_available from ...utils import OptionalDependencyNotAvailable UpperCamelCase__ : List[Any] = { "configuration_gpt_neox_japanese": ["GPT_NEOX_JAPANESE_PRETRAINED_CONFIG_ARCHIVE_MAP", "GP...
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 UpperCamelCase__ : List[Any] = logging.get_logger(__name__) UpperC...
0
1
def __UpperCamelCase (_SCREAMING_SNAKE_CASE , _SCREAMING_SNAKE_CASE ) -> str: assert x is not None assert y is not None lowercase__ = len(_SCREAMING_SNAKE_CASE ) lowercase__ = len(_SCREAMING_SNAKE_CASE ) # declaring the array f...
235
# Copyright 2023 The HuggingFace Inc. team. All rights reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unl...
235
1
'''simple docstring''' from __future__ import annotations def _lowerCamelCase ( lowerCamelCase_ : list , lowerCamelCase_ : int ): """simple docstring""" if len(lowerCamelCase_ ) <= 1 or n <= 1: return insert_next(lowerCamelCase_ , n -...
389
'''simple docstring''' from collections import defaultdict def _lowerCamelCase ( lowerCamelCase_ : str , lowerCamelCase_ : str ): """simple docstring""" UpperCAmelCase_ : Optional[int] = first_str.lower().strip() UpperCAmelCase_ :...
389
1
# DISCLAIMER: This code is strongly influenced by https://github.com/pesser/pytorch_diffusion # and https://github.com/hojonathanho/diffusion import math from dataclasses import dataclass from typing import List, Optional, Tuple, Union import numpy as np import torch from diffusers.configuration_utils import C...
66
lowercase__ : Union[str, Any] = '''0.21.0''' from .accelerator import Accelerator from .big_modeling import ( cpu_offload, cpu_offload_with_hook, disk_offload, dispatch_model, init_empty_weights, init_on_device, load_checkpoint_and_dispatch, ) from .dat...
312
0
"""simple docstring""" import os from argparse import ArgumentParser from typing import List import torch.utils.data from datasets import Dataset, IterableDataset from datasets.distributed import split_dataset_by_node UpperCAmelCase = 4 UpperCAmelCase = 3 class UpperCAmelCase_ ( _...
342
"""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_convbert import ConvBertTokenizer UpperCAmelCase = logging.get_logger(__name__) ...
342
1
'''simple docstring''' def __a ( A__ = 1000 ) -> int: lowerCAmelCase = 3 lowerCAmelCase = 0 while a < n: if a % 3 == 0 or a % 5 == 0: result += a elif a % 15 == 0: result -= a a += 1 return result if __name__ == "__main__...
649
'''simple docstring''' # Copyright 2023 The HuggingFace Team. All rights reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENS...
649
1
"""simple docstring""" from __future__ import annotations class lowerCAmelCase_ : '''simple docstring''' def __init__( self : Tuple ,A_ : str ,A_ : str ) -> Tuple: A , A = text, pattern A , A = len(...
702
"""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 _lowercase = logging.get_logger(__name__) _lowercase = { ...
22
0
'''simple docstring''' 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 __l...
358
'''simple docstring''' 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 __l...
358
1
"""simple docstring""" import unittest from transformers import AutoTokenizer, FalconConfig, 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 ...t...
690
"""simple docstring""" def _a ( UpperCAmelCase__ = 10**9 ) -> int: __SCREAMING_SNAKE_CASE = 1 __SCREAMING_SNAKE_CASE = 2 __SCREAMING_SNAKE_CASE = 0 __SCREAMING_SNAKE_CASE = 0 __SCREAMING_SNAKE_CASE = 0 ...
690
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 ( ProphetNetForConditionalGen...
592
# Copyright 2023 The HuggingFace Team. All rights reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless r...
592
1
'''simple docstring''' import argparse import ast import logging import os import sys import pandas as pd import torch from tqdm import tqdm from transformers import BartForConditionalGeneration, RagRetriever, RagSequenceForGeneration, RagTokenForGeneration from transformers import logging as transformers_logging ...
707
'''simple docstring''' from __future__ import annotations import time import numpy as np snake_case__ : List[Any] = [8, 5, 9, 7] snake_case__ : str = [ [2, 0, 1, 1], [0, 1, 2, 1], [4, 0, 0, 3], [0, 2, 1, 0], [1, 0, 3, 0], ] snake_case__ : Any = [ ...
389
0
'''simple docstring''' import argparse import json 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 f...
507
"""simple docstring""" import inspect import unittest from transformers import BitConfig 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 BackboneTest...
661
0
'''simple docstring''' 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 a__ ( tf.keras.optimizers.schedules.LearningRa...
718
'''simple docstring''' import argparse from pathlib import Path import requests import torch from PIL import Image from transformers import ( RobertaTokenizer, TrOCRConfig, TrOCRForCausalLM, TrOCRProcessor, VisionEncoderDecoderModel, ViTConfig, ViTImageProcessor, ViTModel, ) from ...
355
0
'''simple docstring''' import unittest import numpy as np from transformers.testing_utils import require_torch, require_vision from transformers.utils import is_torch_available, is_vision_available from ...test_image_processing_common import ImageProcessingSavingTestMixin, prepare_image_inputs if is_torch_...
41
def a ( lowerCamelCase_ , lowerCamelCase_ ): '''simple docstring''' lowercase__ = len(lowerCamelCase_ ) lowercase__ = [[False] * (required_sum + 1) for _ in range(arr_len + 1 )] # for each arr value, a sum of zero(0) can be formed by not...
183
0
from argparse import ArgumentParser from datasets.commands.convert import ConvertCommand from datasets.commands.dummy_data import DummyDataCommand from datasets.commands.env import EnvironmentCommand from datasets.commands.run_beam import RunBeamCommand from datasets.commands.test import TestCommand from da...
716
from typing import TYPE_CHECKING from ...utils import ( OptionalDependencyNotAvailable, _LazyModule, is_torch_available, ) UpperCAmelCase = { """configuration_falcon""": ["""FALCON_PRETRAINED_CONFIG_ARCHIVE_MAP""", """FalconConfig"""], } try: if not is_torch_availab...
351
0
'''simple docstring''' from __future__ import annotations import string from itertools import cycle, product from pathlib import Path a__ : str = ( string.ascii_letters + string.digits + string.punctuation + string.whitespace ) a__ : list[int] = [ord(letter) f...
51
"""simple docstring""" import math def UpperCamelCase ( _lowerCAmelCase : int ) -> str: _UpperCAmelCase : Any = 0 _UpperCAmelCase : Dict = 0 while num > 0: _UpperCAmelCase : str = num % 8 _UpperC...
238
0
import argparse import pathlib import fairseq import torch from fairseq.models.roberta import RobertaModel as FairseqRobertaModel from fairseq.modules import TransformerSentenceEncoderLayer from packaging import version from transformers import XLMRobertaConfig, XLMRobertaXLForMaskedLM, XLMRobertaXLForSequ...
294
import unittest from transformers import is_torch_available from transformers.testing_utils import require_sentencepiece, require_tokenizers, require_torch, slow, torch_device if is_torch_available(): from transformers import AutoModelForSeqaSeqLM, AutoTokenizer @require_torch @require_se...
294
1
"""simple docstring""" import baseaa def _a ( UpperCAmelCase__ ) -> bytes: return baseaa.aaaencode(string.encode('''utf-8''' ) ) def _a ( UpperCAmelCase__ ) -> str: return baseaa.aaadecode(UpperCAmelCase__ ).decode('''utf-8''' ) if __n...
482
"""simple docstring""" import inspect import unittest from transformers import BitConfig 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 Backb...
482
1
import argparse import os import pickle import sys import torch from transformers import TransfoXLConfig, TransfoXLLMHeadModel, load_tf_weights_in_transfo_xl from transformers.models.transfo_xl import tokenization_transfo_xl as data_utils from transformers.models.transfo_xl.tokenization_transfo_xl import CORPU...
713
from typing import TYPE_CHECKING from ...utils import OptionalDependencyNotAvailable, _LazyModule, is_torch_available UpperCamelCase = { "configuration_swinv2": ["SWINV2_PRETRAINED_CONFIG_ARCHIVE_MAP", "Swinv2Config"], } try: if not is_torch_available(): raise OptionalDependencyN...
677
0
'''simple docstring''' import sys import turtle def UpperCAmelCase ( lowerCamelCase_ :tuple[float, float] , lowerCamelCase_ :tuple[float, float] ): '''simple docstring''' return (pa[0] + pa[0]) / 2, (pa[1] + pa[1]) / 2 def UpperCAmelCase ( lowerCamelCase_ :tuple[float, fl...
334
'''simple docstring''' __A : List[Any] = { 0: '0', 1: '1', 2: '2', 3: '3', 4: '4', 5: '5', 6: '6', 7: '7', 8: '8', 9: '9', 10: 'a', 11: 'b', 12: 'c', 13: 'd', 14: 'e', 15: 'f', } def UpperCAmelCase ( lowerCamelCase_ :float ...
334
1
from typing import TYPE_CHECKING from ...utils import ( OptionalDependencyNotAvailable, _LazyModule, is_flax_available, is_tf_available, is_tokenizers_available, is_torch_available, ) __UpperCamelCase = { 'configuration_blenderbot': [ 'BLENDERBOT_PRETRAINED_CONFIG_AR...
719
from collections import OrderedDict from typing import Mapping from ...configuration_utils import PretrainedConfig from ...onnx import OnnxConfig from ...utils import logging __UpperCamelCase = logging.get_logger(__name__) __UpperCamelCase = { 'facebook/data2vec-text-base': 'https://hug...
185
0
"""simple docstring""" from __future__ import annotations import bisect def UpperCAmelCase ( A__: list[int] , A__: int , A__: int = 0 , A__: int = -1 ) -> int: if hi < 0: __lowerCamelCase : Tuple = len(A__ ) while lo...
594
"""simple docstring""" import json import os import unittest from transformers import DebertaTokenizer, DebertaTokenizerFast from transformers.models.deberta.tokenization_deberta import VOCAB_FILES_NAMES from transformers.testing_utils import slow from ...test_tokenization_common import TokenizerTesterMixin cla...
594
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 from ...utils.backbone_utils import BackboneConfigMixin, get_aligned_ou...
706
'''simple docstring''' import logging import os import sys from dataclasses import dataclass, field from typing import Optional import evaluate import numpy as np import torch from datasets import load_dataset from PIL import Image from torchvision.transforms import ( CenterCrop, Compos...
179
0
'''simple docstring''' from __future__ import annotations import inspect import unittest from transformers import ViTConfig from transformers.testing_utils import require_tf, require_vision, slow from transformers.utils import cached_property, is_tf_available, is_vision_available from ...test_configuration...
379
'''simple docstring''' import json import os import tempfile import unittest import numpy as np from datasets import load_dataset from transformers.testing_utils import require_torch, require_vision, slow from transformers.utils import is_torch_available, is_vision_available from ...test_image_processing_commo...
199
0
'''simple docstring''' def __magic_name__ ( __UpperCAmelCase ) -> float: '''simple docstring''' if not nums: # Makes sure that the list is not empty raise ValueError("""List is empty""" ) __SCREAMING_SNAKE_CASE = sum(__UpperCAmelCase...
13
'''simple docstring''' from ...utils import ( OptionalDependencyNotAvailable, is_flax_available, is_torch_available, is_transformers_available, ) try: if not (is_transformers_available() and is_torch_available()): raise OptionalDependencyNotAvailable() except OptionalDependencyNotAv...
13
1
"""simple docstring""" import math import os import unittest from transformers import MegatronBertConfig, is_torch_available from transformers.models.auto import get_values from transformers.testing_utils import require_sentencepiece, require_tokenizers, require_torch, slow, torch_device from ...test...
346
from __future__ import annotations def _lowerCAmelCase ( A__ , A__ = None ): lowercase__ = word_bank or [] # create a table lowercase__ = len(A__ ) + 1 lowercase__ = [] for _ in range(A__ ): table.append([] ) # seed value lowercas...
622
0
from dataclasses import dataclass, field from typing import ClassVar, Dict from ..features import Features, Value from .base import TaskTemplate @dataclass(frozen=lowerCamelCase__ ) class __A ( lowerCamelCase__ ): """simple docstring""" UpperCAmelCase__ = f...
613
def __UpperCAmelCase( lowercase_ , lowercase_ , lowercase_ ): return round(float(moles / volume ) * nfactor ) def __UpperCAmelCase( lowercase_ , lowercase_ , lowercase_ ): return round(float((moles * 0.0_8_2_1 * temperature) / (volume) ) ...
613
1
'''simple docstring''' import random from .binary_exp_mod import bin_exp_mod def UpperCAmelCase__ ( UpperCAmelCase_ : Tuple , UpperCAmelCase_ : Union[str, Any]=10_00 ) -> Union[str, Any]: if n < 2: return False if n % 2 == 0: ret...
13
from typing import TYPE_CHECKING from ...utils import ( OptionalDependencyNotAvailable, _LazyModule, is_torch_available, ) lowerCamelCase : List[Any] ={ '''configuration_mega''': ['''MEGA_PRETRAINED_CONFIG_ARCHIVE_MAP''', '''MegaConfig''', '''MegaOnnxConfig'''], ...
228
0
import enum import os from hashlib import shaaaa from typing import Optional from .. import config from .logging import get_logger SCREAMING_SNAKE_CASE__ = get_logger(__name__) class __lowerCamelCase ( enum.Enum ): """simple docstring""" lowerCAmelCase__ =...
601
from typing import Any class __lowerCamelCase : """simple docstring""" def __init__( self , UpperCAmelCase ) -> List[str]: '''simple docstring''' lowercase_ = data lowercase_ = None class __lowerCamelCase ...
601
1
from transformers import HfArgumentParser, TensorFlowBenchmark, TensorFlowBenchmarkArguments def SCREAMING_SNAKE_CASE__ ( ) -> List[Any]: """simple docstring""" a = HfArgumentParser(snake_case_ ) a = parser.parse_args_into_dataclasses()[0] a...
387
from collections.abc import Sequence def SCREAMING_SNAKE_CASE__ ( snake_case_, snake_case_ ) -> float: """simple docstring""" return sum(c * (x**i) for i, c in enumerate(snake_case_ ) ) def SCREAMING_SNAKE_CASE__ ( snake_case_, snake_case_ ) -> float: """s...
387
1
'''simple docstring''' import os import unittest from transformers.models.bartpho.tokenization_bartpho import VOCAB_FILES_NAMES, BartphoTokenizer from transformers.testing_utils import get_tests_dir from ...test_tokenization_common import TokenizerTesterMixin lowerCamelCase__ = ...
411
'''simple docstring''' from math import factorial def _SCREAMING_SNAKE_CASE( snake_case_ : int , snake_case_ : int ) ->int: '''simple docstring''' # If either of the conditions are true, the function is being asked ...
411
1
from collections import defaultdict from math import gcd def __lowerCAmelCase ( _UpperCamelCase : int = 1_50_00_00 ) -> int: '''simple docstring''' SCREAMING_SNAKE_CASE = defaultdict(_UpperCamelCase ) SCREAMING_SNAKE_CASE = 2 while 2 * euclid_m * (euclid_m +...
439
import gc import random import unittest import numpy as np import torch from PIL import Image from transformers import CLIPTextConfig, CLIPTextModel, CLIPTokenizer from diffusers import AutoencoderKL, DDIMScheduler, DDPMScheduler, StableDiffusionUpscalePipeline, UNetaDConditionModel from diffusers.utils import floa...
439
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 import Paddin...
51
"""simple docstring""" from __future__ import annotations import random # Maximum size of the population. Bigger could be faster but is more memory expensive. lowerCamelCase__ = 200 # Number of elements selected in every generation of evolution. The selection takes # place from best to worst of that g...
51
1
'''simple docstring''' # A Bipartite Graph is a graph whose vertices can be divided into two independent sets, # U and V such that every edge (u, v) either connects a vertex from U to V or a vertex # from V to U. In other words, for every edge (u, v), either u belongs to U and v to V, # or u belongs to V and ...
75
'''simple docstring''' 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, TrainingJobAna...
75
1
import argparse import json import os import numpy as np import PIL import requests import tensorflow.keras.applications.efficientnet as efficientnet import torch from huggingface_hub import hf_hub_download from PIL import Image from tensorflow.keras.preprocessing import image from transformers import ( Effici...
106
from typing import TYPE_CHECKING from ..utils import _LazyModule __UpperCamelCase : int = { "config": [ "EXTERNAL_DATA_FORMAT_SIZE_LIMIT", "OnnxConfig", "OnnxConfigWithPast", "OnnxSeq2SeqConfigWithPast", "PatchingSpec", ], "convert": [...
106
1
from typing import Optional, Union import torch from torch import nn from torch.nn import BCEWithLogitsLoss, CrossEntropyLoss, MSELoss from ...activations import ACTaFN from ...modeling_outputs import BaseModelOutputWithPoolingAndNoAttention, ImageClassifierOutputWithNoAttention from ...modeling_u...
304
import inspect import unittest from transformers import ConvNextVaConfig from transformers.models.auto import get_values from transformers.models.auto.modeling_auto import MODEL_FOR_BACKBONE_MAPPING_NAMES, MODEL_MAPPING_NAMES from transformers.testing_utils import require_torch, require_vision, slow,...
304
1
'''simple docstring''' 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 UpperCamelCase__ ( a__ , a__ , a__ , a__ ): '''s...
58
'''simple docstring''' from typing import TYPE_CHECKING from ...utils import ( OptionalDependencyNotAvailable, _LazyModule, is_flax_available, is_tf_available, is_torch_available, ) lowercase_ = {'''configuration_vit_mae''': ['''VIT_MAE_PRETRAINED_CONFIG_ARCHIVE_MAP''', '''ViTMAEConfig''']...
58
1
'''simple docstring''' import math import random from typing import Any from .hill_climbing import SearchProblem def a_ ( lowerCamelCase : Dict , lowerCamelCase : bool = True , lowerCamelCase : float = math.inf , lowerCamelCase : ...
133
'''simple docstring''' import argparse import torch from transformers import RemBertConfig, RemBertModel, load_tf_weights_in_rembert from transformers.utils import logging logging.set_verbosity_info() def a_ ( lowerCamelCase : Union[str, Any] , lowerCamelC...
133
1
'''simple docstring''' import os import sys import tempfile import torch from .state import AcceleratorState from .utils import PrecisionType, PrepareForLaunch, is_mps_available, patch_environment def _a ( _SCREAMING_SNAKE_CASE : List[Any] , _SCREAMING_SNAKE_CASE : List[Any]=() , _SCREAMING_S...
702
'''simple docstring''' import importlib import inspect import json import os import re import shutil import sys from pathlib import Path from typing import Dict, Optional, Union from urllib import request from huggingface_hub import HfFolder, cached_download, hf_hub_download, model_info from packaging import v...
493
0
"""simple docstring""" import unittest from transformers import MODEL_FOR_ZERO_SHOT_OBJECT_DETECTION_MAPPING, is_vision_available, pipeline from transformers.testing_utils import ( is_pipeline_test, nested_simplify, require_tf, require_torch, require_vision, slow, ) from .test_pipelines...
95
"""simple docstring""" from typing import List, Optional, Union from ...configuration_utils import PretrainedConfig from ...utils import logging lowerCamelCase_ = logging.get_logger(__name__) lowerCamelCase_ = { '''huggingface/informer-tourism-monthly''': ( '''https://hugg...
95
1
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 imp...
278
import numpy as np __lowerCAmelCase :Dict = [ ['a', 'b', 'c', 'd', 'e'], ['f', 'g', 'h', 'i', 'k'], ['l', 'm', 'n', 'o', 'p'], ['q', 'r', 's', 't', 'u'], ['v', 'w', 'x', 'y', 'z'], ] class _a: def __init__( self ) -> No...
278
1
'''simple docstring''' import collections import importlib.util import os import re from pathlib import Path lowerCAmelCase__ = 'src/transformers' # Matches is_xxx_available() lowerCAmelCase__ = re.compile(R'is\_([a-z_]*)_available()') # Catches a one-line _imp...
596
'''simple docstring''' import unittest import numpy as np from transformers import AlbertConfig, 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_a...
596
1
'''simple docstring''' def A_ ( SCREAMING_SNAKE_CASE_ , SCREAMING_SNAKE_CASE_ , SCREAMING_SNAKE_CASE_ = 0 , SCREAMING_SNAKE_CASE_ = 0 ) ->int: lowercase_ = right or len(SCREAMING_SNAKE_CASE_ ) - 1 if left > right: return -1 elif list_data[left] == key: return left elif list_...
603
'''simple docstring''' from typing import List, Optional, Tuple, Union import torch from ...schedulers import DDIMScheduler from ...utils import randn_tensor from ..pipeline_utils import DiffusionPipeline, ImagePipelineOutput class _a ( __a ): """simple docstring""" def __init__( self : ...
603
1
'''simple docstring''' def __magic_name__ ( __UpperCAmelCase , __UpperCAmelCase , __UpperCAmelCase , __UpperCAmelCase ) -> Any: '''simple docstring''' global f # a global dp table for knapsack if f[i][j] < 0: if j < wt[i - 1]: __SCR...
109
import argparse import fairseq import torch from torch import nn from transformers import ( MBartaaTokenizer, MBartConfig, MBartForCausalLM, SpeechEncoderDecoderConfig, SpeechEncoderDecoderModel, WavaVecaConfig, WavaVecaFeatureExtractor, WavaVecaModel, logging, ) logging.set_ve...
439
0
import argparse import os import sys from unittest.mock import patch import pytorch_lightning as pl import timeout_decorator import torch from distillation import SummarizationDistiller, distill_main from finetune import SummarizationModule, main from transformers import MarianMTModel from t...
711
import copy import inspect import unittest import numpy as np from huggingface_hub import hf_hub_download from transformers import TimesformerConfig from transformers.models.auto import get_values from transformers.testing_utils import require_torch, require_vision, slow, torch_device from tra...
205
0
_lowerCAmelCase: Tuple = 'Alexander Joslin' import operator as op from .stack import Stack def _lowercase( __a : str ): a__ ={'*': op.mul, '/': op.truediv, '+': op.add, '-': op.sub} a__ =Stack() a__ =Stack() for i in equation: ...
20
def __magic_name__ ( SCREAMING_SNAKE_CASE = 50 ) -> int: _lowercase : Optional[int] = [[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...
66
0
from typing import TYPE_CHECKING from ...utils import OptionalDependencyNotAvailable, _LazyModule, is_torch_available, is_vision_available snake_case_ = { 'configuration_mobilenet_v2': [ 'MOBILENET_V2_PRETRAINED_CONFIG_ARCHIVE_MAP', 'MobileNetV2Config', 'Mobi...
388
from pathlib import Path from typing import List from transformers import is_torch_available, is_vision_available from transformers.testing_utils import get_tests_dir, is_tool_test from transformers.tools.agent_types import AGENT_TYPE_MAPPING, AgentAudio, AgentImage, AgentText if is_torch_availab...
388
1
'''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 A = ...
125
"""simple docstring""" from ...configuration_utils import PretrainedConfig from ...utils import logging _snake_case = logging.get_logger(__name__) _snake_case = { '''bigcode/gpt_bigcode-santacoder''': '''https://huggingface.co/bigcode/gpt_bigcode-santacoder/resolve/main/config...
580
0
'''simple docstring''' import os import shutil import tempfile import unittest import numpy as np from transformers import AutoTokenizer, BarkProcessor from transformers.testing_utils import require_torch, slow @require_torch class _A ( unittest.TestCase ): ...
712
# flake8: noqa # Lint as: python3 a = [ "VerificationMode", "Version", "disable_progress_bar", "enable_progress_bar", "is_progress_bar_enabled", "experimental", ] from .info_utils import VerificationMode from .logging import disable_progress_bar, enable_progr...
175
0
"""simple docstring""" import os import numpy import onnx def _snake_case ( _snake_case : Optional[Any] , _snake_case : Any ) -> Dict: '''simple docstring''' _A = a.name _A = b.name _A = '' _A = '' _A = ...
7
"""simple docstring""" from typing import TYPE_CHECKING from ...utils import ( OptionalDependencyNotAvailable, _LazyModule, is_tf_available, is_torch_available, is_vision_available, ) _snake_case = { "configuration_efficientformer": [ "EFFICIENTFORMER...
510
0
"""simple docstring""" from ...utils import is_torch_available, is_transformers_available if is_transformers_available() and is_torch_available(): from .pipeline_vq_diffusion import LearnedClassifierFreeSamplingEmbeddings, VQDiffusionPipeline
173
"""simple docstring""" from typing import TYPE_CHECKING from ...utils import ( OptionalDependencyNotAvailable, _LazyModule, is_tf_available, is_torch_available, is_vision_available, ) __A = {"""configuration_deit""": ["""DEIT_PRETRAINED_CONFIG_ARCHIVE_MAP""", """DeiTConfig"...
173
1
from typing import List, Optional import numpy as np from ...processing_utils import ProcessorMixin from ...utils import to_numpy class __a ( __UpperCamelCase ): __snake_case : Optional[int] = """EncodecFeatureExtractor""" __snake_case : Tuple = ("""T5Tokenizer""", """T5To...
600
import json import os import re import unittest from transformers import CodeGenTokenizer, CodeGenTokenizerFast from transformers.models.codegen.tokenization_codegen import VOCAB_FILES_NAMES from transformers.testing_utils import require_tokenizers, slow from ...test_tokenization_common import TokenizerTesterMi...
600
1
UpperCAmelCase__ : List[Any] ={0: [2, 3], 1: [0], 2: [1], 3: [4], 4: []} UpperCAmelCase__ : Union[str, Any] ={0: [1, 2, 3], 1: [2], 2: [0], 3: [4], 4: [5], 5: [3]} def _lowercase ( _UpperCAmelCase , _UpperCAmelCase , _UpperCAmelCase ) -> lis...
720
import argparse from pathlib import Path import torch from packaging import version from torch.onnx import export from diffusers import AutoencoderKL UpperCAmelCase__ : Tuple =version.parse(version.parse(torch.__version__).base_version) < version.parse('''1.11''') def _lowercase (...
269
0
import unittest import numpy as np from transformers.testing_utils import require_torch, require_vision from transformers.utils import is_torch_available, is_vision_available from ...test_image_processing_common import ImageProcessingSavingTestMixin, prepare_image_inputs if is_torch_available(): import tor...
496
import gc import random import tempfile import unittest import numpy as np import torch from transformers import CLIPTextConfig, CLIPTextModel, CLIPTokenizer from diffusers import AutoencoderKL, DDIMScheduler, LMSDiscreteScheduler, PNDMScheduler, UNetaDConditionModel from diffusers.pipelines.stable_di...
483
0
import tempfile import unittest from make_student import create_student_by_copying_alternating_layers from transformers import AutoConfig from transformers.file_utils import cached_property from transformers.testing_utils import require_torch __lowerCamelCase = '''sshleifer/bart-tiny-rand...
707
from datetime import datetime as dt import os from github import Github __lowerCamelCase = [ '''good first issue''', '''good second issue''', '''good difficult issue''', '''feature request''', '''new model''', '''wip''', ] def _a ( ): a_ : List[str] ...
478
0
import pytest from datasets.parallel import ParallelBackendConfig, parallel_backend from datasets.utils.py_utils import map_nested from .utils import require_dill_gt_0_3_2, require_joblibspark, require_not_windows def A_ ( lowercase_ ) -> Union[str, Any]: # picklable for multiprocessing ...
326
from collections import OrderedDict from ...utils import logging from .auto_factory import _BaseAutoModelClass, _LazyAutoMapping, auto_class_update from .configuration_auto import CONFIG_MAPPING_NAMES lowerCAmelCase_ = logging.get_logger(__name__) lowerCAmelCase_ = OrderedDict( [ # Base mod...
326
1
'''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 ...
713
'''simple docstring''' lowercase__ : List[Any] = '''Input must be a string of 8 numbers plus letter''' lowercase__ : Optional[Any] = '''TRWAGMYFPDXBNJZSQVHLCKE''' def _lowerCAmelCase ( __snake_case : str ) -> bool: if n...
338
0
from collections import OrderedDict from typing import Mapping from ...configuration_utils import PretrainedConfig from ...onnx import OnnxConfig from ...utils import logging SCREAMING_SNAKE_CASE :Union[str, Any] = logging.get_logger(__name__) SCREAMING_SNAKE_CASE :Dict = { 'k...
55
'''simple docstring''' import logging import os import random import sys from dataclasses import dataclass, field from typing import Optional import datasets import numpy as np import pandas as pd from datasets import load_dataset import transformers from transformers import ( AutoConfig, BartFor...
689
0
import warnings from ...utils import logging from .image_processing_deit import DeiTImageProcessor lowercase_ = logging.get_logger(__name__) class __lowerCAmelCase ( a__ ): def __init__( self , *lowerCAmelCase , **lowerCAmelCas...
703
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 ...
380
0
# Lint as: python3 import sys from collections.abc import Mapping from typing import TYPE_CHECKING import numpy as np import pyarrow as pa from .. import config from ..utils.py_utils import map_nested from .formatting import TensorFormatter if TYPE_CHECKING: import torch class lowerCAmelCase_ ( T...
10
import gc import unittest import numpy as np import torch from transformers import CLIPTextConfig, CLIPTextModel, XLMRobertaTokenizer from diffusers import AltDiffusionPipeline, AutoencoderKL, DDIMScheduler, PNDMScheduler, UNetaDConditionModel from diffusers.pipelines.alt_diffusion.modeling_roberta_series import (...
412
0
'''simple docstring''' def a__ ( lowerCAmelCase__ ) -> bool: if not isinstance(lowerCAmelCase__ , lowerCAmelCase__ ): raise ValueError('''check_bouncy() accepts only integer arguments''' ) UpperCAmelCase__ : Optional[Any] = str(lowerCAmelCase__ )...
701
'''simple docstring''' from timeit import timeit def a__ ( lowerCAmelCase__ ) -> int: if number < 0: raise ValueError('''the value of input must not be negative''' ) UpperCAmelCase__ : Tuple = 0 while number: number &= number - 1 ...
312
0
'''simple docstring''' import asyncio import os import shutil import subprocess import sys import tempfile import unittest from distutils.util import strtobool from functools import partial from pathlib import Path from typing import List, Union from unittest import mock import torch from ..state import Accelerat...
5
def lowerCAmelCase_ ( __UpperCAmelCase: float ) -> float: return 10 - x * x def lowerCAmelCase_ ( __UpperCAmelCase: float , __UpperCAmelCase: float ) -> float: # Bolzano theory in order to find if there is a root between a and b ...
253
0
"""simple docstring""" from typing import TYPE_CHECKING from ...utils import ( OptionalDependencyNotAvailable, _LazyModule, is_tf_available, is_tokenizers_available, is_torch_available, ) snake_case = { 'configuration_mobilebert': [ 'MOBILEBERT_PRETRAIN...
406
"""simple docstring""" from __future__ import annotations def UpperCamelCase_ ( SCREAMING_SNAKE_CASE_ ): if len(SCREAMING_SNAKE_CASE_ ) == 0: return [] SCREAMING_SNAKE_CASE , SCREAMING_SNAKE_CASE = min(SCREAMING_SNAKE_CASE_ ), max(SCREAMING_SNAKE_CA...
406
1
import gc import random import unittest import numpy as np import torch from PIL import Image from transformers import CLIPTextConfig, CLIPTextModel, CLIPTokenizer from diffusers import AutoencoderKL, PNDMScheduler, StableDiffusionInpaintPipeline, UNetaDConditionModel from diffusers.utils import floats_...
652
from __future__ import annotations from collections.abc import Iterator from typing import Generic, TypeVar __UpperCamelCase : Tuple = TypeVar("""T""") class __UpperCamelCase ( Generic[T] ): def __init__( self : Optional[Any] , _lowerCAmelCase : T ) -...
80
0
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 FeatureExtractionMixin, PreTrainedTokenizerBase, TensorType _...
153
from __future__ import annotations __SCREAMING_SNAKE_CASE = '#' class lowerCAmelCase_ : '''simple docstring''' def __init__( self ): SCREAMING_SNAKE_CASE_ : dict ={} def __lowerCamelCase ( self , __UpperCAmelCase ): ...
153
1
'''simple docstring''' from __future__ import annotations import math from collections.abc import Callable def __lowerCamelCase ( lowerCAmelCase_ , lowerCAmelCase_ , lowerCAmelCase_ , lowerCAmelCase_ = 100 , ) -> float: _a : List[Any] = x_start _a : Union[str, Any] ...
358
'''simple docstring''' import warnings from ...utils import logging from .image_processing_glpn import GLPNImageProcessor __lowerCAmelCase = logging.get_logger(__name__) class __magic_name__ ( _UpperCamelCase ): def __init__( self : Optional[int] ,*_UpperCAmelCase...
358
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 : Optional[int] = logging....
630
'''simple docstring''' import os from typing import Dict, List, Union import tensorflow as tf from keras_nlp.tokenizers import BytePairTokenizer from tensorflow_text import pad_model_inputs from .tokenization_gpta import GPTaTokenizer class UpperCamelCase__ ( tf.keras.layers.Layer ):...
630
1
def A__ ( _a : List[str] ): '''simple docstring''' return 10 - x * x def A__ ( _a : Any , _a : str ): '''simple docstring''' if equation(__SCREAMING_SNAKE_CASE ) * equation(__SCREAMING_SNAKE_CASE ) >= 0: raise Value...
385
"""simple docstring""" from __future__ import annotations def a__ ( __SCREAMING_SNAKE_CASE , __SCREAMING_SNAKE_CASE , __SCREAMING_SNAKE_CASE , __SCREAMING_SNAKE_CASE ) -> List[Any]: # noqa: E741 while r - l > 1: __lowerCAmelCase: str ...
346
0
import warnings from ...utils import logging from .image_processing_owlvit import OwlViTImageProcessor UpperCamelCase__ : str = logging.get_logger(__name__) class lowerCAmelCase_ ( lowerCamelCase_ ): def __init__( self ,*snake_case__ ,**snake_case__ ): ...
685
def __UpperCAmelCase ( lowerCamelCase_ : int = 10_00 ) -> int: """simple docstring""" return sum(e for e in range(3 , lowerCamelCase_ ) if e % 3 == 0 or e % 5 == 0 ) if __name__ == "__main__": print(F"""{solution() = }""")
685
1
"""simple docstring""" from typing import Optional, Tuple import jax import jax.numpy as jnp from flax import linen as nn from flax.core.frozen_dict import FrozenDict from transformers import CLIPConfig, FlaxPreTrainedModel from transformers.models.clip.modeling_flax_clip import FlaxCLIPVisionModule def ...
178
"""simple docstring""" import torch from diffusers import KDPMaDiscreteScheduler from diffusers.utils import torch_device from .test_schedulers import SchedulerCommonTest class _lowerCAmelCase ( snake_case_ ): __UpperCAmelCase : List[str] = (KDPMaDiscreteScheduler,) __Upp...
178
1
'''simple docstring''' 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 : Optional[int] = logging.get_logger(__name__) __snake_case : Tuple = { 'vo...
687
'''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 impo...
687
1
import warnings from ...utils import logging from .image_processing_yolos import YolosImageProcessor snake_case_ : str = logging.get_logger(__name__) class snake_case_ ( _lowerCAmelCase ): '''simple docstring''' def __init__( self : str , *__magic_...
488
"""simple docstring""" import torch import torch.nn as nn from transformers.modeling_utils import ModuleUtilsMixin from transformers.models.ta.modeling_ta import TaBlock, TaConfig, TaLayerNorm from ...configuration_utils import ConfigMixin, register_to_config from ...models import ModelMixin class ...
554
0
from __future__ import annotations _snake_case = 'Muhammad Umer Farooq' _snake_case = 'MIT' _snake_case = '1.0.0' _snake_case = 'Muhammad Umer Farooq' _snake_case = 'contact@muhammadumerfarooq.me' _snake_case = 'Alpha' import re from html.parser import HTMLPar...
715
from typing import TYPE_CHECKING from ...utils import ( OptionalDependencyNotAvailable, _LazyModule, is_tf_available, is_torch_available, is_vision_available, ) _snake_case = { 'configuration_convnext': ['CONVNEXT_PRETRAINED_CONFIG_ARCHIVE_MAP', 'ConvNextConfig', 'ConvNextOnnxCon...
567
0