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
def UpperCamelCase( __UpperCamelCase : str ): return " ".join( ''''''.join(word[::-1] ) if len(__UpperCamelCase ) > 4 else word for word in sentence.split() ) if __name__ == "__main__": import doctest doctest.testmod() print(reverse_long_words('''Hey wollef sroirraw''')) ...
103
import argparse import fairseq import torch from torch import nn from transformers import ( MBartaaTokenizer, MBartConfig, MBartForCausalLM, SpeechEncoderDecoderConfig, SpeechEncoderDecoderModel, WavaVecaConfig, WavaVecaFeatureExtractor, WavaVecaModel, logging, ) logging.set_ver...
176
0
'''simple docstring''' from __future__ import annotations from fractions import Fraction def a_ ( lowerCamelCase : int , lowerCamelCase : int ): return ( num != den and num % 10 == den // 10 and (num // 10) / (den % 10) == num / den ) ...
366
'''simple docstring''' import copy import unittest from transformers.models.auto import get_values from transformers.testing_utils import require_torch, slow, torch_device from transformers.utils import cached_property, is_torch_available, is_vision_available from ...test_configuration_common im...
55
0
'''simple docstring''' import os from huggingface_hub.constants import HUGGINGFACE_HUB_CACHE, hf_cache_home UpperCamelCase__ = HUGGINGFACE_HUB_CACHE UpperCamelCase__ = '''config.json''' UpperCamelCase__ = '''diffusion_pytorch_model.bin''' UpperCamelCase__ ...
181
'''simple docstring''' import re from filelock import FileLock try: import nltk UpperCamelCase__ = True except (ImportError, ModuleNotFoundError): UpperCamelCase__ = False if NLTK_AVAILABLE: with FileLock('''.lock''') as lock: nltk.download('''punkt''', qu...
181
1
def _UpperCamelCase ( UpperCamelCase_ : str = "The quick brown fox jumps over the lazy dog" , ) -> bool: """simple docstring""" lowerCAmelCase__ = set() # Replace all the whitespace in our sentence lowerCAmelCase__ = input_str.replace(' ' ...
352
import qiskit def _UpperCamelCase ( UpperCamelCase_ : int , UpperCamelCase_ : int ) -> qiskit.result.counts.Counts: """simple docstring""" lowerCAmelCase__ = qiskit.Aer.get_backend('aer_simulator' ) # Create a Quantum Circuit acti...
122
0
def a__ ( __UpperCamelCase = 1_0_0_0_0_0_0 ): SCREAMING_SNAKE_CASE_ = [i - 1 for i in range(limit + 1 )] for i in range(2 , limit + 1 ): if phi[i] == i - 1: for j in range(2 * i , limit + 1 , __UpperCamelCase ): ...
118
from ....configuration_utils import PretrainedConfig from ....utils import logging A : str = logging.get_logger(__name__) # TODO: upload to AWS A : Dict = { "yjernite/retribert-base-uncased": ( "https://huggingface.co/yjernite/retribert-base-uncased/resolve/main/config.json"...
118
1
"""simple docstring""" import numpy as np from transformers import BatchFeature from transformers.testing_utils import require_tf, require_torch from .test_feature_extraction_common import FeatureExtractionSavingTestMixin class UpperCAmelCase_ ( a__ ): lowercase__ = None ...
354
"""simple docstring""" # Copyright 2022 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 #...
230
0
import argparse from transformers import CLIPImageProcessor, CLIPVisionModelWithProjection from diffusers import UnCLIPImageVariationPipeline, UnCLIPPipeline if __name__ == "__main__": __lowerCAmelCase : List[str] = argparse.ArgumentParser() parser.add_argument('--dump_path', default=None, t...
107
from __future__ import annotations from fractions import Fraction from math import gcd, sqrt def __UpperCamelCase ( lowerCAmelCase__ : int ): __a : int = int(number**0.5 ) return number == sq * sq def __UpperCamelCase ( lowerCAmelCase__ : int , lowerCAmelCas...
216
0
"""simple docstring""" from __future__ import annotations def __lowerCAmelCase ( lowercase : list[int] , lowercase : int ) -> list[int]: """simple docstring""" snake_case : str = 0 snake_case : List[str] = len(lowercase ) - 1 ...
112
"""simple docstring""" import copy import os from typing import Union from ...configuration_utils import PretrainedConfig from ...utils import logging __snake_case = logging.get_logger(__name__) __snake_case = { """BAAI/AltCLIP""": """https://huggingface.co/BAAI/AltCLIP/resolve...
112
1
from typing import TYPE_CHECKING from ...utils import ( OptionalDependencyNotAvailable, _LazyModule, is_flax_available, is_tf_available, is_torch_available, ) _lowerCamelCase ={"configuration_vit_mae": ["VIT_MAE_PRETRAINED_CONFIG_ARCHIVE_MAP", "ViTMAEConfig"]} try: if not is_torc...
334
import copy from typing import Any, Dict, List, Optional, Union import numpy as np 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 TensorType,...
252
0
"""simple docstring""" import logging from dataclasses import dataclass, field from typing import Optional from seqaseq_trainer import arg_to_scheduler from transformers import TrainingArguments __UpperCamelCase : List[Any] = logging.getLogger(__name__) @dataclass class a ( a__ ...
309
"""simple docstring""" def _SCREAMING_SNAKE_CASE (_UpperCAmelCase : list[int] , _UpperCAmelCase : str ): lowerCAmelCase = int(_UpperCAmelCase ) # Initialize Result lowerCAmelCase = [] # Traverse through all denomination for denomination in reversed(_UpperCAmelCa...
309
1
"""simple docstring""" from __future__ import annotations from random import random class a__ : def __init__( self : Tuple, lowerCAmelCase : int | None = None ) -> List[Any]: lowercase : Tuple = value lowercas...
255
"""simple docstring""" from __future__ import annotations import unittest import numpy as np from transformers import LayoutLMConfig, is_tf_available from transformers.testing_utils import require_tf, slow from ...test_configuration_common import ConfigTester from ...test_modeling_tf_comm...
255
1
'''simple docstring''' def _a ( _lowerCamelCase = 3 , _lowerCamelCase = 7 , _lowerCamelCase = 100_0000 ) -> int: """simple docstring""" __snake_case : Dict = 0 __snake_case : Tuple = 1 for current_deno...
363
'''simple docstring''' __UpperCamelCase = "ABCDEFGHIJKLMNOPQRSTUVWXYZ" def _a ( ) -> None: """simple docstring""" __snake_case : Dict = input("""Enter message: """ ) __snake_case : Optional[int] = ...
13
0
"""simple docstring""" import argparse from pathlib import Path import torch from transformers import OPTConfig, OPTModel from transformers.utils import logging logging.set_verbosity_info() __a = logging.get_logger(__name__) def A_ ( _lowercase ): '''simple docstring''' snake_...
66
import os import sys from contextlib import contextmanager # Windows only if os.name == "nt": import ctypes import msvcrt # noqa class __UpperCAmelCase ( ctypes.Structure ): # _fields is a specific attr expected by ctypes UpperCamelCase = [("""size...
336
0
from dataclasses import dataclass from typing import Optional import torch from torch import nn from ..configuration_utils import ConfigMixin, register_to_config from ..utils import BaseOutput from .attention import BasicTransformerBlock from .modeling_utils import ModelMixin @dataclass class lowercase (...
97
import json import pathlib import unittest import numpy as np from transformers.testing_utils import require_torch, require_vision, slow from transformers.utils import is_torch_available, is_vision_available from ...test_image_processing_common import ImageProcessingSavingTestMixin, prepare_image_inputs if is_tor...
97
1
SCREAMING_SNAKE_CASE : dict[tuple[int, int, int], int] = {} def UpperCamelCase_( lowerCamelCase_ , lowerCamelCase_ , lowerCamelCase_ ) -> int: # if we are absent twice, or late 3 consecutive days, # no further prize strings are possible if late == 3 ...
21
import collections import tempfile import unittest import numpy as np from transformers.testing_utils import ( is_pt_flax_cross_test, require_flax, require_torch, require_vision, slow, torch_device, ) from transformers.utils import is_flax_available, is_torch_available, is_vision_available ...
21
1
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(): from .tokenization_big_bird import Bi...
364
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 ...test_modeling_common import Model...
141
0
def _SCREAMING_SNAKE_CASE ( lowercase : list , lowercase : list ): '''simple docstring''' _validate_point(lowercase ) _validate_point(lowercase ) if len(lowercase ) != len(lowercase ): raise ValueError('Both po...
204
lowerCamelCase : Tuple = [ [0, 16, 13, 0, 0, 0], [0, 0, 10, 12, 0, 0], [0, 4, 0, 0, 14, 0], [0, 0, 9, 0, 0, 20], [0, 0, 0, 7, 0, 4], [0, 0, 0, 0, 0, 0], ] def _SCREAMING_SNAKE_CASE ( lowercase : Optional[Any] , lowercase : int , lo...
204
1
import logging from pathlib import Path import numpy as np import pytorch_lightning as pl import torch from pytorch_lightning.callbacks import EarlyStopping, ModelCheckpoint from pytorch_lightning.utilities import rank_zero_only from utils_rag import save_json def A_ ( A__ ) -> str...
369
import logging import os import sys from dataclasses import dataclass, field from importlib import import_module from typing import Dict, List, Optional, Tuple import numpy as np from seqeval.metrics import accuracy_score, fa_score, precision_score, recall_score from torch import nn from utils_ner import Split, ...
225
0
from __future__ import annotations import time from collections.abc import Sequence from random import randint from matplotlib import pyplot as plt def UpperCAmelCase ( lowercase , lowercase , lowercase ): """simple docstring""" if not arr: return None,...
210
import argparse import json from pathlib import Path import requests import timm import torch from huggingface_hub import hf_hub_download from PIL import Image from transformers import DeiTConfig, DeiTForImageClassificationWithTeacher, DeiTImageProcessor from transformers.utils import logging logging....
143
0
import itertools import json import linecache import os import pickle import re import socket import string from collections import Counter from logging import getLogger from pathlib import Path from typing import Callable, Dict, Iterable, List import git import torch from torch.utils.data import Dataset from trans...
369
import math from dataclasses import dataclass from typing import Optional, Tuple, Union import numpy as np import torch from ..configuration_utils import ConfigMixin, register_to_config from ..utils import BaseOutput, randn_tensor from .scheduling_utils import SchedulerMixin @dataclass # Copied from ...
329
0
import gc import unittest import torch from parameterized import parameterized from diffusers import AutoencoderKL from diffusers.utils import floats_tensor, load_hf_numpy, require_torch_gpu, slow, torch_all_close, torch_device from diffusers.utils.import_utils import is_xformers_available from d...
24
'''simple docstring''' from . import ( albert, align, altclip, audio_spectrogram_transformer, auto, autoformer, bark, bart, barthez, bartpho, beit, bert, bert_generation, bert_japanese, bertweet, big_bird, bigbird_pegasus, biogpt, bit, ...
67
0
"""simple docstring""" import argparse import os from pathlib import Path import torch from bark.generation import _load_model as _bark_load_model from huggingface_hub import hf_hub_download from transformers import EncodecConfig, EncodecModel, set_seed from transformers.models.bark.configuration_bark impo...
254
"""simple docstring""" import itertools import os import random import tempfile import unittest import numpy as np from datasets import load_dataset from transformers import is_speech_available from transformers.testing_utils import check_json_file_has_correct_format, require_torch, require_torchaudio from...
254
1
def UpperCamelCase ( __lowercase : Dict = 60_08_51_47_51_43 ): '''simple docstring''' try: A_ : List[str] = int(_UpperCamelCase ) except (TypeError, ValueError): raise TypeError('Parameter n must be int or castable to int.' ) if n <= 0: raise ValueErro...
140
"""simple docstring""" import json import os import shutil import tempfile import unittest import numpy as np import pytest from transformers import BertTokenizer, BertTokenizerFast from transformers.models.bert.tokenization_bert import VOCAB_FILES_NAMES from transformers.testing_utils import require_vision from...
57
0
import os from itertools import chain from random import randrange, shuffle import pytest from .sola import PokerHand _lowerCamelCase : int = ( '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', 'KD 6S 9D TH AD',...
355
'''simple docstring''' from __future__ import annotations def __a ( UpperCAmelCase ) ->list[int]: """simple docstring""" return [ord(UpperCAmelCase ) - 96 for elem in plain] def __a ( UpperCAmelCase ) ->str: """simple docstring""" return "".join...
337
0
'''simple docstring''' import logging from dataclasses import dataclass, field from typing import Optional from seqaseq_trainer import arg_to_scheduler from transformers import TrainingArguments UpperCamelCase_ = logging.getLogger(__name__) @dataclass class a_ (_a ): __lowerCAmelCase :...
309
'''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
1
'''simple docstring''' from collections import deque class _lowercase : def __init__( self: int , UpperCamelCase__: str , UpperCamelCase__: int , UpperCamelCase__: int ): lowerCamelCase__ : int ...
129
'''simple docstring''' from __future__ import annotations from typing import Any class _lowercase ( _lowercase ): pass class _lowercase : def __init__( self: Optional[int] , UpperCamelCase__: Any ): l...
129
1
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_torchaudio @require...
277
import unittest import numpy as np from transformers import is_flax_available from transformers.testing_utils import require_flax from ..test_modeling_flax_common import ids_tensor if is_flax_available(): import jax import jax.numpy as jnp from transformers.generation import ( FlaxFo...
13
0
"""simple docstring""" from __future__ import annotations import unittest from transformers import XGLMConfig, XGLMTokenizer, is_tf_available from transformers.testing_utils import require_tf, slow from ...test_configuration_common import ConfigTester from ...test_modeling_tf_common import TFModelTesterMixin,...
350
"""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_...
1
0
'''simple docstring''' import os from shutil import copyfile from typing import List, Optional, Tuple from ...tokenization_utils_fast import PreTrainedTokenizerFast from ...utils import is_sentencepiece_available, logging if is_sentencepiece_available(): from .tokenization_pegasus import PegasusTokeni...
34
'''simple docstring''' import argparse import logging import os from pathlib import Path from typing import Any, Dict import pytorch_lightning as pl from pytorch_lightning.utilities import rank_zero_info from transformers import ( AdamW, AutoConfig, AutoModel, AutoModelForPreTraining, ...
34
1
'''simple docstring''' import os from shutil import copyfile from typing import Any, Dict, List, Optional, Tuple import sentencepiece as spm from ...tokenization_utils import AddedToken, PreTrainedTokenizer from ...utils import logging __lowerCAmelCase = logging.get_logger(__name__) __lowerC...
355
'''simple docstring''' def UpperCAmelCase_ (__a : int = 1_0**1_2 ): """simple docstring""" _a : List[str] = 1 _a : Optional[int] = 0 _a : Any = 1 _a : List[str] = 1 while numerator <= 2 * min_total - 1: ...
5
0
import logging import os from dataclasses import dataclass, field from typing import Dict, Optional import datasets import numpy as np import tensorflow as tf from transformers import ( AutoConfig, AutoTokenizer, EvalPrediction, HfArgumentParser, PreTrainedTokenizer, TFAutoModel...
157
'''simple docstring''' def _lowerCamelCase ( lowercase : int ) -> bool: if num < 0: return False _a = num _a = 0 while num > 0: _a = rev_num * 10 + (num % 10) num //= 10 return num_copy == rev_num if __name__ == "__main...
63
0
import tempfile import unittest from transformers import AutoModelForSeqaSeqLM, AutoTokenizer from transformers.testing_utils import ( is_torch_available, require_optimum, require_torch, slow, ) if is_torch_available(): import torch @require_torch @require_optimum @slow class __lowerca...
66
import math import tensorflow as tf from packaging import version def __lowerCamelCase ( lowerCamelCase__ : Optional[Any] ): '''simple docstring''' lowerCamelCase = tf.convert_to_tensor(lowerCamelCase__ ) lowerCamelCase = 0.5 * (1.0 + tf.math....
66
1
"""simple docstring""" import dataclasses import json import warnings from dataclasses import dataclass, field from time import time from typing import List from ..utils import logging __A = logging.get_logger(__name__) def a__ ( __SCREAMING_SNAKE_CASE=None , _...
217
"""simple docstring""" 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, UNetaDConditio...
217
1
"""simple docstring""" from ...configuration_utils import PretrainedConfig from ...utils import logging a : Optional[int] = logging.get_logger(__name__) a : List[Any] = { '''microsoft/markuplm-base''': '''https://huggingface.co/microsoft/marku...
79
"""simple docstring""" from collections import OrderedDict from typing import Mapping from ...configuration_utils import PretrainedConfig from ...onnx import OnnxConfig a : Optional[int] = { '''albert-base-v1''': '''https://huggingface.co/albert-base-v1/resolve/m...
79
1
"""simple docstring""" from itertools import zip_longest import requests from bsa import BeautifulSoup from pandas import DataFrame def lowerCAmelCase__ ( UpperCamelCase__ = "laptop" ): '''simple docstring''' _a : str = F"""https://www.amazon.i...
294
"""simple docstring""" import collections import tempfile import unittest import numpy as np from transformers.testing_utils import ( is_pt_flax_cross_test, require_flax, require_torch, require_vision, slow, torch_device, ) from transformers.utils import is_f...
269
0
import tempfile import unittest from transformers import SPIECE_UNDERLINE, BatchEncoding, PLBartTokenizer, is_torch_available from transformers.testing_utils import ( get_tests_dir, nested_simplify, require_sentencepiece, require_tokenizers, require_torch, ) from ...test_to...
351
import inspect import unittest from huggingface_hub import hf_hub_download from transformers import ConvNextConfig, UperNetConfig from transformers.testing_utils import require_torch, require_torch_multi_gpu, require_vision, slow, torch_device from transformers.utils import is_torch_available, is_v...
247
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 __snake_case ( __UpperCamelCase : Optional[Any] ): # picklable for mul...
312
from typing import Optional, Union import torch from torch import nn from ...configuration_utils import ConfigMixin, register_to_config from ...models.modeling_utils import ModelMixin class _a ( snake_case_ , snake_case_ ): """simple docstring""" @register_t...
312
1
"""simple docstring""" from ...processing_utils import ProcessorMixin class UpperCAmelCase_ ( _UpperCamelCase ): __SCREAMING_SNAKE_CASE : Optional[int] = ['image_processor', 'feature_extractor'] __SCREAMING_SNAKE_CASE : Union[str, Any] = 'T...
202
"""simple docstring""" import copy import os from collections import OrderedDict from typing import TYPE_CHECKING, Any, Dict, Mapping, Optional, Union if TYPE_CHECKING: from ...processing_utils import ProcessorMixin from ...utils import TensorType from ...configuration_utils import PretrainedConfig from .....
202
1
from ...configuration_utils import PretrainedConfig from ...utils import logging _SCREAMING_SNAKE_CASE = logging.get_logger(__name__) _SCREAMING_SNAKE_CASE = { """caidas/swin2sr-classicalsr-x2-64""": ( """https://huggingface.co/caidas/swin2sr-classicalsr-x2-64/resolve/main/config.js...
343
import argparse import json from typing import List from ltp import LTP from transformers import BertTokenizer def lowercase( UpperCamelCase_ ) -> List[Any]: '''simple docstring''' # This defines a "chinese character" as anything in the CJK Unicode block: # https://en.wikipedia...
343
1
_UpperCAmelCase : Any = 256 # Modulus to hash a string _UpperCAmelCase : str = 100_0003 def __lowerCamelCase ( UpperCamelCase__ , UpperCamelCase__ ): '''simple docstring''' snake_case_ = len(UpperCamelCase__ ) s...
200
from __future__ import annotations def __lowerCamelCase ( UpperCamelCase__ , UpperCamelCase__ = None , UpperCamelCase__ = None ): '''simple docstring''' if start is None: snake_case_ = 0 if end is None: sn...
200
1
"""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, Sta...
301
"""simple docstring""" from collections import OrderedDict from ...utils import logging from .auto_factory import _BaseAutoModelClass, _LazyAutoMapping, auto_class_update from .configuration_auto import CONFIG_MAPPING_NAMES SCREAMING_SNAKE_CASE_ = logging.get_logger(__name__) SCREAMING_SNAKE_CA...
301
1
from pathlib import Path import json import tempfile from transformers import FSMTTokenizer, FSMTConfig, FSMTForConditionalGeneration from transformers.models.fsmt.tokenization_fsmt import VOCAB_FILES_NAMES __A : Tuple = "tiny-wmt19-en-ru" # Build # borrowed from a test __A : Dict ...
361
'''simple docstring''' import argparse import json from pathlib import Path import requests import timm import torch from huggingface_hub import hf_hub_download from PIL import Image from transformers import DeiTImageProcessor, ViTConfig, ViTForImageClassification, ViTImageProcessor, ViTM...
89
0
import os # All paths are set with the intent you should run this script from the root of the repo with the command # python utils/check_doctest_list.py UpperCAmelCase__ = "." if __name__ == "__main__": UpperCAmelCase__ = os.path.join(REPO_PATH, "utils/documentation_tests.t...
0
'''simple docstring''' def lowerCAmelCase_ ( snake_case_ : int , snake_case_ : int ) -> int: '''simple docstring''' return x if y == 0 else greatest_common_divisor(snake_case_ , x % y ) def lowerCAmelCase_ ( snake_case_ : int , ...
1
0
import unittest import numpy as np import torch from .utils_summarization import build_mask, compute_token_type_ids, process_story, truncate_or_pad class __snake_case ( unittest.TestCase ): def UpperCAmelCase__ ( self : Tuple ): __snake_case: Dict ...
358
import argparse from collections import defaultdict import yaml __UpperCAmelCase : int = "docs/source/en/_toctree.yml" def A__ ( SCREAMING_SNAKE_CASE__) -> Dict: __snake_case: Union[str, Any] = defaultdict(SCREAMING_SNAKE_CASE__) for doc in model_d...
293
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 =logging.get_logger(__name__) a ={ """facebook/data2vec-vision-base-ft""": ( ...
73
UpperCAmelCase__ = { '''A''': '''.-''', '''B''': '''-...''', '''C''': '''-.-.''', '''D''': '''-..''', '''E''': '''.''', '''F''': '''..-.''', '''G''': '''--.''', '''H''': '''....''', '''I''': '''..''', '''J''': '''.---''', '''K''': '''-.-''', '''L''': '''.-..''', '''M''': '''--''', '''N''': '''-.''',...
5
0
def lowerCamelCase__ ( A__ : int , A__ : int ): '''simple docstring''' __lowerCamelCase = 1 # To kept the Calculated Value # Since C(n, k) = C(n, n-k) if k > (n - k): __lowerCamelCase = n - k # Calculate C(n,k) ...
361
from math import ceil, sqrt def lowerCamelCase__ ( A__ : int = 1000000 ): '''simple docstring''' __lowerCamelCase = 0 for outer_width in range(3 , (limit // 4) + 2 ): if outer_width**2 > limit: __lowerCamelCase ...
29
0
"""simple docstring""" from maths.prime_check import is_prime def lowercase (snake_case__ : int ) -> int: '''simple docstring''' if not isinstance(snake_case__ , snake_case__ ): lowerCAmelCase = f'''Input value of [numbe...
155
"""simple docstring""" import copy from dataclasses import dataclass, field from typing import ClassVar, Dict from ..features import Audio, ClassLabel, Features from .base import TaskTemplate @dataclass(frozen=_a ) class SCREAMING_SNAKE_CASE__ ( _a ): _a = field(default='a...
155
1
"""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 # # Unle...
54
"""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/licenses/LICENSE-2.0 # #...
54
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, get_resize_output_image_size, normalize, rescale, resize, to_channel_dimension_for...
59
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...
59
1
import math import tensorflow as tf from packaging import version def snake_case( __magic_name__ ) -> List[Any]: '''simple docstring''' lowercase : Any = tf.convert_to_tensor(__magic_name__ ) lowercase : Optional[Any] = 0.5...
371
import os import re import sys import traceback import warnings from pathlib import Path from typing import Dict, Optional, Union from uuid import uuida from huggingface_hub import HfFolder, ModelCard, ModelCardData, hf_hub_download, whoami from huggingface_hub.file_download import REGEX_COMMIT_HAS...
116
0
from __future__ import annotations from collections.abc import Iterator from typing import Any class UpperCamelCase_ : '''simple docstring''' def __init__( self , a ) -> List[str]: snake_case_ = data snake_case_ = None class ...
178
import numpy as np from sklearn.datasets import fetch_california_housing from sklearn.metrics import mean_absolute_error, mean_squared_error from sklearn.model_selection import train_test_split from xgboost import XGBRegressor def __UpperCAmelCase ( a_): return (data["data"], data["target...
178
1
import unittest from transformers import TrOCRConfig from transformers.testing_utils import is_torch_available, require_torch, torch_device from ...generation.test_utils import GenerationTesterMixin from ...test_configuration_common import ConfigTester from ...test_modeling_common import ModelTesterMix...
367
from manim import * class a ( __lowerCamelCase ): def __lowerCamelCase ( self :Union[str, Any] ): snake_case__ : Optional[Any] = Rectangle(height=0.5 ,width=0.5 ) snake_case__ : Optional[int] = Rectangle(he...
44
0
"""simple docstring""" from math import isqrt, loga def snake_case_ ( A_ : int ): '''simple docstring''' _lowerCamelCase : Optional[Any] = [True] * max_number for i in range(2, isqrt(max_number - 1 ) + 1 ): if is...
72
"""simple docstring""" from collections import OrderedDict from typing import TYPE_CHECKING, Any, Mapping, Optional from ...configuration_utils import PretrainedConfig from ...onnx import OnnxConfig from ...utils import logging if TYPE_CHECKING: from ... import FeatureExtractionMixin, TensorType S...
46
0
"""simple docstring""" def lowercase__ ( _UpperCAmelCase ) -> int: '''simple docstring''' assert isinstance(_UpperCAmelCase , _UpperCAmelCase ), f'''The input value of [n={number}] is not an integer''' if number == 1: ret...
53
"""simple docstring""" import os from pathlib import Path def lowercase__ ( ) -> str: '''simple docstring''' from torch.utils.cpp_extension import load lowercase : List[str] = Path(_UpperCAmelCase ).resolve().parent.pare...
53
1
'''simple docstring''' import argparse import os import re lowerCAmelCase__ = '''src/transformers''' # Pattern that looks at the indentation in a line. lowerCAmelCase__ = re.compile(R'''^(\s*)\S''') # Pattern that matches `"key":" and puts `key` in group 0. lowerCAmelCase__ = re...
104
'''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 OptionalDependencyNotAvailable: ...
97
0
"""simple docstring""" from typing import Dict, List, Optional, Union import numpy as np from ...image_processing_utils import BaseImageProcessor, BatchFeature, get_size_dict from ...image_transforms import ( center_crop, get_resize_output_image_size, normalize, rescale, ...
365
"""simple docstring""" import unittest from pathlib import Path from tempfile import TemporaryDirectory from transformers import AutoConfig, TFAutoModel, is_tensorflow_text_available, is_tf_available from transformers.models.bert.tokenization_bert import BertTokenizer from transformers.testi...
215
0
import gc import unittest from transformers import CTRLConfig, 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 ModelTesterMi...
101
import os import sys lowercase__ :Tuple = os.path.join(os.path.dirname(__file__), "src") sys.path.append(SRC_DIR) from transformers import ( AutoConfig, AutoModel, AutoModelForCausalLM, AutoModelForMaskedLM, AutoModelForQuestionAnswering, AutoModelForSequenceClassification, AutoTok...
101
1
'''simple docstring''' def _A ( A__ , A__ ): """simple docstring""" if a < 0 or b < 0: raise ValueError('''the value of both inputs must be positive''' ) __lowercase = str(bin(A__ ) )[2:] # remove the leading "0b" __lowercase = str(bin(A__ ) )...
52
'''simple docstring''' from typing import TYPE_CHECKING from ...utils import OptionalDependencyNotAvailable, _LazyModule, is_torch_available, is_vision_available lowerCAmelCase__ = {'''configuration_glpn''': ['''GLPN_PRETRAINED_CONFIG_ARCHIVE_MAP''', '''GLPNConfig''']} try: if not is_vision_avail...
52
1
"""simple docstring""" from sklearn.metrics import fa_score import datasets __magic_name__ = "\nThe F1 score is the harmonic mean of the precision and recall. It can be computed with the equation:\nF1 = 2 * (precision * recall) / (precision + recall)\n" __magic_name__ = "\nArgs:\n predicti...
100
"""simple docstring""" import requests from bsa import BeautifulSoup def _lowerCAmelCase ( UpperCamelCase_ = "AAPL" ): __SCREAMING_SNAKE_CASE = f"https://in.finance.yahoo.com/quote/{symbol}?s={symbol}" __SCREAMING_SNAKE_CASE = BeautifulSoup(requests.get(UpperCamelCase_ ...
100
1
import json from typing import TYPE_CHECKING, List, Optional, Tuple from tokenizers import pre_tokenizers from ...tokenization_utils_fast import PreTrainedTokenizerFast from ...utils import logging if TYPE_CHECKING: from transformers.pipelines.conversational import Conversation _UpperCAmelCase : List...
364
from __future__ import annotations def SCREAMING_SNAKE_CASE ( _UpperCAmelCase , _UpperCAmelCase ) -> bool: lowerCamelCase__ : List[Any] = get_failure_array(_UpperCAmelCase ) # 2) Step through text searching for pattern lowerCamelCase__ , lowerCamelCase__ ...
45
0
"""simple docstring""" import warnings from ...utils import logging from .image_processing_beit import BeitImageProcessor A_ : str = logging.get_logger(__name__) class lowerCamelCase (A__ ): def __init__( self : Tuple , *__UpperCAmelCase : List[str] ...
165
"""simple docstring""" from collections import defaultdict class lowerCamelCase : def __init__( self : List[str] , __UpperCAmelCase : Dict , __UpperCAmelCase : Any ) -> Any: SCREAMING_SNAKE_CASE__ = total # total no of tasks (N) # DP ...
165
1
"""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 i...
354
"""simple docstring""" def _snake_case ( lowercase__ ): # if the collection is empty, returns empty if collection == []: return [] # get some information about the collection _lowerCamelCase : List[str] = len(lowercase__ ) _lowerCame...
12
0
import argparse import os # New Code # 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 import...
50
from bisect import bisect from itertools import accumulate def __magic_name__ ( A : Optional[Any], A : List[str], A : Tuple, A : Optional[Any] ): '''simple docstring''' a = sorted(zip(A, A ), key=lambda A : x[0] / x[1], reverse=A ) a , a ...
107
0
'''simple docstring''' import logging import os from dataclasses import dataclass, field from functools import partial from pathlib import Path from tempfile import TemporaryDirectory from typing import List, Optional import faiss import torch from datasets import Features, Sequence, Value, load_dataset fro...
142
'''simple docstring''' from typing import List, Optional, Union from ...processing_utils import ProcessorMixin from ...tokenization_utils_base import BatchEncoding, PaddingStrategy, PreTokenizedInput, TextInput, TruncationStrategy from ...utils import TensorType class _a ( __lowerCAmelCase ...
142
1
'''simple docstring''' _lowerCAmelCase = {0: [2, 3], 1: [0], 2: [1], 3: [4], 4: []} _lowerCAmelCase = {0: [1, 2, 3], 1: [2], 2: [0], 3: [4], 4: [5], 5: [3]} def __lowerCAmelCase ( snake_case__ , snake_case__ , snake_case__ ): __UpperC...
298
'''simple docstring''' import os import warnings from typing import List, Optional from ...tokenization_utils_base import BatchEncoding from ...utils import logging from .configuration_rag import RagConfig UpperCamelCase_ = logging.get_logger(__name__) class a_ : def __init__( self ...
309
0
from __future__ import annotations import unittest from transformers import DistilBertConfig, is_tf_available from transformers.testing_utils import require_tf, slow from ...test_configuration_common import ConfigTester from ...test_modeling_tf_common import TFModelTesterMixin, ids_tensor, random_attenti...
335
class lowercase : # Public class to implement a graph '''simple docstring''' def __init__(self , __a , __a , __a ) -> None: """simple docstring""" UpperCAmelCase__ = row UpperCAmelCase__ = col UpperCAmelCase__ = graph ...
335
1
"""simple docstring""" import unittest from parameterized import parameterized from transformers import LlamaConfig, is_torch_available, set_seed from transformers.testing_utils import require_torch, slow, torch_device from ...generation.test_utils import GenerationTesterMixin from ...test_configuration_common imp...
316
"""simple docstring""" def A ( snake_case :int ) -> int: __UpperCamelCase = [1] __UpperCamelCase , __UpperCamelCase , __UpperCamelCase = 0, 0, 0 __UpperCamelCase = ugly_nums[ia] * 2 __UpperCamelCase = ugly_nums[ia] * 3 __UpperCamelCase ...
316
1
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 lowercase ( _SCREAMING_SNAKE_CASE ): def __init__( self , A_ , A_ = None ...
110
import json import os import unittest from transformers.models.ctrl.tokenization_ctrl import VOCAB_FILES_NAMES, CTRLTokenizer from ...test_tokenization_common import TokenizerTesterMixin class lowercase ( _SCREAMING_SNAKE_CASE , unittest.TestCase ): __lowercase : Any = CTRLTokenizer...
110
1
"""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 # #...
61
"""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(): from .t...
61
1
from collections.abc import Sequence from queue import Queue class A__ : """simple docstring""" def __init__( self , __snake_case , __snake_case , __snake_case , __snake_case=None , __snake_case=None ): snake_case = start snake_...
213
import argparse import json from collections import OrderedDict import torch from huggingface_hub import cached_download, hf_hub_url from transformers import AutoImageProcessor, CvtConfig, CvtForImageClassification def UpperCAmelCase__ (UpperCamelCase_ ): """simple docstring"""...
213
1
'''simple docstring''' import os import re import unicodedata from shutil import copyfile from typing import TYPE_CHECKING, Any, Dict, List, Optional, Tuple, Union import sentencepiece as spm from ...tokenization_utils import PreTrainedTokenizer from ...utils import is_torch_available, logging ...
55
'''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/LICENS...
55
1
"""simple docstring""" from typing import Dict, List, Optional from ...tokenization_utils import AddedToken, PreTrainedTokenizer from ...utils import logging __SCREAMING_SNAKE_CASE : Union[str, Any] = logging.get_logger(__name__) __SCREAMING_SNAKE_CASE : Union[str, Any] = { ...
73
"""simple docstring""" from typing import TYPE_CHECKING from ...utils import ( OptionalDependencyNotAvailable, _LazyModule, is_flax_available, is_tf_available, is_torch_available, ) __SCREAMING_SNAKE_CASE : List[str] = { '''configuration_vision_encoder_decoder''': ['''Vis...
73
1
import math import flax.linen as nn import jax.numpy as jnp def SCREAMING_SNAKE_CASE_ ( __A : jnp.ndarray , __A : int , __A : float = 1 , __A : float = 1 , __A : float = 1.0e4 , __A : bool = False , __A : float = 1.0 , ) -> jnp.ndarray: ...
32
'''simple docstring''' from datasets.utils.patching import _PatchedModuleObj, patch_submodule from . import _test_patching def _UpperCamelCase ( ): '''simple docstring''' import os as original_os from os import path as original_path from os import rename as original_rename from os.path im...
346
0
from typing import TYPE_CHECKING from ...utils import OptionalDependencyNotAvailable, _LazyModule, is_torch_available UpperCAmelCase = { """configuration_jukebox""": [ """JUKEBOX_PRETRAINED_CONFIG_ARCHIVE_MAP""", """JukeboxConfig""", """JukeboxPriorConfig""", """JukeboxV...
356
import numpy as np from transformers import BatchFeature from transformers.testing_utils import require_tf, require_torch from .test_feature_extraction_common import FeatureExtractionSavingTestMixin class lowerCAmelCase_ ( lowerCamelCase__ ): '''simple docstring''' __snake_case = None...
267
0
from collections.abc import Callable from math import pi, sqrt from random import uniform from statistics import mean def __SCREAMING_SNAKE_CASE ( snake_case_ ): '''simple docstring''' def is_in_circle(snake_case_ , snake_case_ ) -> bool: _UpperCAmelCase ...
133
import argparse import json import numpy import torch from transformers.models.xlm.tokenization_xlm import VOCAB_FILES_NAMES from transformers.utils import CONFIG_NAME, WEIGHTS_NAME, logging logging.set_verbosity_info() def __SCREAMING_SNAKE_CASE ( snake_case_ , snake_case_ ): '''sim...
133
1
import os from typing import Optional import fsspec from fsspec.archive import AbstractArchiveFileSystem from fsspec.utils import DEFAULT_BLOCK_SIZE class A__ ( __snake_case ): _UpperCAmelCase :Union[str, Any] = '' _UpperCAmelCase :str = ( ...
140
class A__ : # Public class to implement a graph def __init__( self , A_ , A_ , A_ ): '''simple docstring''' UpperCamelCase : Optional[int] = row UpperCamelCase : Any = col UpperCamelCase : Optional[Any] ...
140
1
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 Accelerator...
51
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_ : Dict = {"configuration_mbart"...
51
1
def lowerCamelCase_( _lowerCamelCase , _lowerCamelCase ) -> float: '''simple docstring''' _validate_point(_lowerCamelCase ) _validate_point(_lowerCamelCase ) if len(_lowerCamelCase ) != len(_lowerCamelCase ): raise ValueError("Both points must be in the same n-dime...
366
"""simple docstring""" import random import unittest import numpy as np import transformers from transformers import is_flax_available, is_torch_available from transformers.testing_utils import is_pt_flax_cross_test, require_flax if is_flax_available(): import os import jax.numpy as jnp from jax imp...
340
0
'''simple docstring''' class a__ : def __init__( self : List[Any] , a : Tuple ): """simple docstring""" __lowerCamelCase = arr.split(''',''' ) def SCREAMING_SNAKE_CASE__ ( self : Optional[int] ): """simple docstring""" ...
67
"""simple docstring""" # flake8: noqa # Lint as: python3 _UpperCAmelCase = [ """VerificationMode""", """Version""", """disable_progress_bar""", """enable_progress_bar""", """is_progress_bar_enabled""", """experimental""", ] from .info_utils import VerificationMode from .l...
173
0
'''simple docstring''' import os import tempfile from functools import partial from unittest import TestCase from unittest.mock import patch import numpy as np import pytest from datasets.arrow_dataset import Dataset from datasets.search import ElasticSearchIndex, FaissIndex, MissingIndex...
228
'''simple docstring''' import torch from transformers import CamembertForMaskedLM, CamembertTokenizer def _snake_case ( A , A , A , A=5 ) -> List[str]: # Adapted from https://github.com/pytorch/fairseq/blob/master/fairseq/models/roberta/hub_interface.py ...
228
1
import math import tensorflow as tf from packaging import version def snake_case ( snake_case__ :Tuple) -> Union[str, Any]: _A = tf.convert_to_tensor(snake_case__) _A = 0.5 * (1.0 + tf.math.erf(x / tf.cast(tf.sqrt(2.0) , x.dtype))) return x *...
180
import collections import importlib.util import os import re from pathlib import Path _SCREAMING_SNAKE_CASE = 'src/transformers' # Matches is_xxx_available() _SCREAMING_SNAKE_CASE = re.compile(R'is\_([a-z_]*)_available()') # Catches a one-line _import_struct = {xxx} _SCREAMI...
180
1
from math import sqrt import numpy as np from sympy import symbols # Coefficient # Speed of light (m/s) __SCREAMING_SNAKE_CASE = 299792458 # Symbols __SCREAMING_SNAKE_CASE , __SCREAMING_SNAKE_CASE , __SCREAMING_SNAKE_CASE , __SCREAMING_SNAKE_CASE = symbols("""ct...
256
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 __SCREAMING_SNAKE_CASE = logging.get_logger(__name__) __SCREAMING_SNAKE_CASE ...
256
1
"""simple docstring""" import unittest from transformers import ( MODEL_FOR_CAUSAL_LM_MAPPING, TF_MODEL_FOR_CAUSAL_LM_MAPPING, TextGenerationPipeline, logging, pipeline, ) from transformers.testing_utils import ( CaptureLogger, is_pipeline_test, require_accelerate, require_...
266
"""simple docstring""" import itertools import random import unittest import numpy as np from transformers import ASTFeatureExtractor from transformers.testing_utils import require_torch, require_torchaudio from transformers.utils.import_utils import is_torch_available from ...test_sequence_feature_extracti...
266
1
"""simple docstring""" import contextlib import copy import random from typing import Any, Dict, Iterable, Optional, Union import numpy as np import torch from .utils import deprecate, is_transformers_available if is_transformers_available(): import transformers def _lowerCAmelCase ( ...
354
"""simple docstring""" import cva import numpy as np class __SCREAMING_SNAKE_CASE : def __init__( self : Union[str, Any] , snake_case : float , snake_case : int ): '''simple docstring''' if k in (0.04, 0.06): ...
296
0
import math def SCREAMING_SNAKE_CASE_ ( snake_case__ ) -> bool: lowerCAmelCase = math.loga(math.sqrt(4 * positive_integer + 1 ) / 2 + 1 / 2 ) return exponent == int(snake_case__ ) def SCREAMING_SNAKE_CASE_ ( snake_case__ = 1 / 1_2_3_4_5 ...
338
from typing import TYPE_CHECKING from ...utils import _LazyModule lowercase__ : int = {'''tokenization_wav2vec2_phoneme''': ['''Wav2Vec2PhonemeCTCTokenizer''']} if TYPE_CHECKING: from .tokenization_wavaveca_phoneme import WavaVecaPhonemeCTCTokenizer else: import sys lowercase__ : Option...
338
1
'''simple docstring''' from __future__ import annotations class _snake_case : def __init__( self ,_snake_case ,_snake_case ): UpperCAmelCase_ : List[Any] = text, pattern UpperCAmelCase_ : Dict = len(_snake_case ...
363
'''simple docstring''' def a__ ( _SCREAMING_SNAKE_CASE : int , _SCREAMING_SNAKE_CASE : int ) -> int: """simple docstring""" return int((input_a, input_a).count(0 ) != 0 ) def a__ ( ) -> None: """simple docstring""" ...
67
0
'''simple docstring''' from collections.abc import Generator def SCREAMING_SNAKE_CASE_ ( ) -> Generator[int, None, None]: _a : Any =0, 1 while True: _a : List[str] =b, a + b yield b def SCREAMING_SNAKE_CASE_ ...
276
from diffusers.utils.testing_utils import require_onnxruntime @require_onnxruntime class UpperCAmelCase_ : """simple docstring""" pass
235
0
'''simple docstring''' class _snake_case : def __init__( self , _lowerCamelCase): UpperCAmelCase__ : int = set_counts UpperCAmelCase__ : Optional[int] = max(_lowerCamelCase) UpperCAmelCase__ : Lis...
352
'''simple docstring''' import functools def _UpperCamelCase ( UpperCamelCase__ , UpperCamelCase__ ): # Validation if not isinstance(UpperCamelCase__ , UpperCamelCase__ ) or not all(isinstance(UpperCamelCase__ , UpperCamelCase__ ) for day in days ): raise V...
283
0
'''simple docstring''' import torch from diffusers import DDPMParallelScheduler from .test_schedulers import SchedulerCommonTest class A__ ( UpperCamelCase ): """simple docstring""" UpperCamelCase_ : Optional[Any] = (DDPMParallelScheduler,) def...
145
'''simple docstring''' import heapq as hq import math from collections.abc import Iterator class A__ : """simple docstring""" def __init__( self : Any , lowerCAmelCase__ : Any ) -> Dict: """simple docstring""" _UpperCAmelCase ...
145
1
'''simple docstring''' import os from datetime import datetime as dt from github import Github UpperCamelCase__ : List[Any] = [ 'good first issue', 'good second issue', 'good difficult issue', 'enhancement', 'new pipeline/model', 'new scheduler', ...
365
'''simple docstring''' # XXX: we want transformers master here - in the absense of conftest manipulating sys.path: # hack it in for now: import sys from pathlib import Path UpperCamelCase__ : Optional[Any] = Path(__file__).resolve().parents[3] / 'src' sys.path.insert(1, str(git_...
164
0
from __future__ import annotations from fractions import Fraction def UpperCAmelCase ( a_ , a_ ) -> bool: """simple docstring""" return ( num != den and num % 1_0 == den // 1_0 and (num // 1_0) / (den % 1_0) == num / den ) def UpperCAmelCase ( a_ ) -> l...
15
import dataclasses import json import sys import types from argparse import ArgumentDefaultsHelpFormatter, ArgumentParser, ArgumentTypeError from copy import copy from enum import Enum from inspect import isclass from pathlib import Path from typing import Any, Callable, Dict, Iterable, List, Literal, NewType, Optiona...
15
1
"""simple docstring""" from __future__ import annotations from collections.abc import Callable from typing import Generic, TypeVar UpperCamelCase_ = TypeVar('T') UpperCamelCase_ = TypeVar('U') class snake_case ( Generic[T, U] ): def __init__( self , __UpperCAmelCase ...
366
"""simple docstring""" import unittest from transformers import LiltConfig, 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 i...
303
0
"""simple docstring""" import os import re import shutil import sys import tempfile import unittest import black _a = os.path.abspath(os.path.dirname(os.path.dirname(os.path.dirname(__file__)))) sys.path.append(os.path.join(git_repo_path, """utils""")) import check_copies # ...
194
"""simple docstring""" import argparse import torch from transformers import BertForMaskedLM if __name__ == "__main__": _a = argparse.ArgumentParser( description=( """Extraction some layers of the full BertForMaskedLM or RObertaForMaskedLM for Transfer Le...
194
1
"""simple docstring""" import warnings from ...processing_utils import ProcessorMixin from ...tokenization_utils_base import BatchEncoding class a ( a__ ): snake_case__ = ['''image_processor''', '''tokenizer'''] snake_case__ = '''CLIPImageProcessor''' snake_case__ ...
354
"""simple docstring""" from __future__ import annotations import unittest from transformers import EsmConfig, is_tf_available from transformers.testing_utils import require_tf, slow from ...test_configuration_common import ConfigTester from ...test_modeling_tf_common import TFModelTesterMixin, floats_tensor, i...
309
0
import copy import random from transformers import CLIPTokenizer class _A ( __UpperCAmelCase ): def __init__( self : int , *__SCREAMING_SNAKE_CASE : List[Any] , **__SCREAMING_SNAKE_CASE : List[Any]): '''simple docstring''' su...
49
from typing import Optional from .. import Features, NamedSplit from ..packaged_modules.text.text import Text from ..utils.typing import NestedDataStructureLike, PathLike from .abc import AbstractDatasetReader class _A ( __UpperCAmelCase ): def __init__( self : Optional[int] ...
49
1
"""simple docstring""" import os from datetime import datetime as dt from github import Github UpperCAmelCase : int = [ "good first issue", "good second issue", "good difficult issue", "enhancement", "new pipeline/model", "new scheduler", "wip", ] def...
355
"""simple docstring""" from __future__ import annotations import numpy as np def _SCREAMING_SNAKE_CASE (__lowerCAmelCase ) -> tuple[np.ndarray, np.ndarray]: '''simple docstring''' lowercase_ , lowercase_ = np.shape(__lowerCAmelCase ) if rows !...
313
0
from typing import TYPE_CHECKING from ...utils import _LazyModule lowerCamelCase = {'processing_wav2vec2_with_lm': ['Wav2Vec2ProcessorWithLM']} if TYPE_CHECKING: from .processing_wavaveca_with_lm import WavaVecaProcessorWithLM else: import sys lowerCamelCase = _LazyModule(__n...
199
from typing import TYPE_CHECKING from ...utils import ( OptionalDependencyNotAvailable, _LazyModule, is_flax_available, is_sentencepiece_available, is_tf_available, is_tokenizers_available, is_torch_available, ) if is_sentencepiece_available(): from ..ta.tokenization_ta import TaToken...
199
1
"""simple docstring""" from collections import OrderedDict from typing import TYPE_CHECKING, Any, Mapping, Optional, Union from ...configuration_utils import PretrainedConfig from ...onnx import OnnxConfig from ...utils import logging if TYPE_CHECKING: from ... import FeatureExtractionMixin, ...
239
"""simple docstring""" from __future__ import annotations import math def __lowerCamelCase ( a_ : int , a_ : int , a_ : bool , a_ : list[int] , a_ : float ) -> int: if depth < 0: raise Va...
239
1
import argparse import os import shutil from pathlib import Path import onnx import torch from packaging import version from torch.onnx import export from diffusers import OnnxRuntimeModel, OnnxStableDiffusionPipeline, StableDiffusionPipeline __lowercase = version.parse(version.parse(torch.__version__).b...
43
import gc import random import unittest import torch from diffusers import ( IFImgaImgPipeline, IFImgaImgSuperResolutionPipeline, IFInpaintingPipeline, IFInpaintingSuperResolutionPipeline, IFPipeline, IFSuperResolutionPipeline, ) from diffusers.models.attention_processor import AttnAddedKVPro...
101
0
import random import unittest import torch from diffusers import IFInpaintingSuperResolutionPipeline from diffusers.utils import floats_tensor from diffusers.utils.import_utils import is_xformers_available from diffusers.utils.testing_utils import skip_mps, torch_device from ..pipeline_params import ( ...
358
import argparse import OmegaConf import torch from diffusers import DDIMScheduler, LDMPipeline, UNetLDMModel, VQModel def UpperCamelCase_( snake_case__: Optional[int] , snake_case__: List[Any] , snake_case__: Union[str, Any] ) -> Tuple: UpperCAmelCase__ = OmegaConf....
335
0