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
import argparse import pytorch_lightning as pl import torch from torch import nn from transformers import LongformerForQuestionAnswering, LongformerModel class _A ( pl.LightningModule ): def __init__( self : int , _A : int ) -> List[Any]: ...
308
import os def snake_case( __magic_name__ = "input.txt" ) -> int: '''simple docstring''' with open(os.path.join(os.path.dirname(__magic_name__ ) , __magic_name__ ) ) as input_file: lowercase : Any = [ [int(...
308
1
"""simple docstring""" from ...configuration_utils import PretrainedConfig from ...utils import logging __A = logging.get_logger(__name__) __A = { 'google/switch-base-8': 'https://huggingface.co/google/switch-base-8/blob/main/config.json', } class lowercase ( snake_ca...
352
import unittest from parameterized import parameterized from transformers import AutoTokenizer, GPTNeoXConfig, 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 import ...
277
0
from __future__ import annotations import time from math import sqrt # 1 for manhattan, 0 for euclidean _lowerCAmelCase : Dict = 0 _lowerCAmelCase : str = [ [0, 0, 0, 0, 0, 0, 0], [0, 1, 0, 0, 0, 0, 0], # 0 are free path whereas 1's are obstacles [0, 0, 0, 0, 0, 0, 0...
169
'''simple docstring''' import random import unittest import torch from diffusers import IFImgaImgSuperResolutionPipeline from diffusers.utils import floats_tensor from diffusers.utils.import_utils import is_xformers_available from diffusers.utils.testing_utils import skip_mps, torch_device from ..pipeline_params ...
141
0
"""simple docstring""" import importlib import sys from argparse import REMAINDER, ArgumentParser from pathlib import Path import torch_xla.distributed.xla_multiprocessing as xmp def a__ ( ): UpperCAmelCase_ = ArgumentParser( description=( ...
241
"""simple docstring""" import warnings from ...utils import logging from .image_processing_flava import FlavaImageProcessor lowerCamelCase = logging.get_logger(__name__) class lowercase__ ( SCREAMING_SNAKE_CASE ): '''simple docstring''' ...
241
1
from ...configuration_utils import PretrainedConfig from ...utils import logging A : Tuple = logging.get_logger(__name__) A : Any = { 'facebook/s2t-wav2vec2-large-en-de': ( 'https://huggingface.co/facebook/s2t-wav2vec2-large-en-de/resolve/main/config.json' ), ...
305
from typing import TYPE_CHECKING from ...utils import OptionalDependencyNotAvailable, _LazyModule, is_tf_available, is_torch_available UpperCamelCase = { '''configuration_groupvit''': [ '''GROUPVIT_PRETRAINED_CONFIG_ARCHIVE_MAP''', '''GroupViTConfig''', '''GroupViTOn...
87
0
from arguments import InitializationArguments from transformers import AutoConfig, AutoModelForCausalLM, AutoTokenizer, HfArgumentParser # Configuration UpperCAmelCase_ : Optional[int] = HfArgumentParser(InitializationArguments) UpperCAmelCase_ : int = parser.parse_args() # Load codeparrot tokenize...
360
def SCREAMING_SNAKE_CASE_ ( __A : int , __A : int ) -> int: """simple docstring""" while b: a_ , a_ : int = b, a % b return a def SCREAMING_SNAKE_CASE_ ( __A : int , __A : int ...
120
0
"""simple docstring""" import os import re import warnings from shutil import copyfile from typing import TYPE_CHECKING, Any, Dict, List, Optional, Tuple import sentencepiece as spm from ...tokenization_utils import PreTrainedTokenizer if TYPE_CHECKING: from ...tokenization_utils_base import TextInpu...
91
"""simple docstring""" import warnings from ...utils import logging from .image_processing_deit import DeiTImageProcessor UpperCAmelCase_ : Optional[Any] = logging.get_logger(__name__) class lowerCAmelCase__ ( UpperCAmelCase__ ): '''simple docstring''' def __ini...
91
1
from collections import UserDict from typing import List, Union from ..utils import ( add_end_docstrings, is_tf_available, is_torch_available, is_vision_available, logging, requires_backends, ) from .base import PIPELINE_INIT_ARGS, Pipeline if is_vision_available(): from PIL import Imag...
366
import unittest import numpy as np from transformers.testing_utils import require_flax, require_tf, require_torch from transformers.utils import ( expand_dims, flatten_dict, is_flax_available, is_tf_available, is_torch_available, reshape, squeeze, transpose, ) if i...
307
0
import os import unittest from transformers import BertTokenizerFast from transformers.models.bert.tokenization_bert import ( VOCAB_FILES_NAMES, BasicTokenizer, BertTokenizer, WordpieceTokenizer, _is_control, _is_punctuation, _is_whitespace, ) from transformers.testin...
187
'''simple docstring''' from typing import TYPE_CHECKING from ...utils import OptionalDependencyNotAvailable, _LazyModule, is_tokenizers_available, is_torch_available _UpperCamelCase = { 'configuration_biogpt': ['BIOGPT_PRETRAINED_CONFIG_ARCHIVE_MAP', 'BioGptConfig'], ...
208
0
import gc import unittest from diffusers import FlaxDPMSolverMultistepScheduler, FlaxStableDiffusionPipeline from diffusers.utils import is_flax_available, slow from diffusers.utils.testing_utils import require_flax if is_flax_available(): import jax import jax.numpy as jnp from flax.jax_utils i...
295
def lowerCamelCase__ ( ) -> int: '''simple docstring''' return 1 def lowerCamelCase__ ( UpperCamelCase__ : int ) -> int: '''simple docstring''' return 0 if x < 0 else two_pence(x - 2 ) + one_pence() def lowerCamelCase__ ...
295
1
"""simple docstring""" from __future__ import annotations def UpperCAmelCase__ ( SCREAMING_SNAKE_CASE : str ): '''simple docstring''' return [ord(SCREAMING_SNAKE_CASE ) - 96 for elem in plain] def UpperCAmelCase__ ( SCREAMING_SNAKE_CASE : l...
46
class __lowercase : """simple docstring""" def __init__( self : List[Any] , lowerCAmelCase__ : Optional[int] , lowerCAmelCase__ : List[Any]): SCREAMING_SNAKE_CASE_: List[str] = name SCREAMING_SNAKE_CASE_: Union[str, Any] = val ...
13
0
import requests from bsa import BeautifulSoup def lowerCAmelCase_ ( UpperCamelCase_ , UpperCamelCase_ ) -> str: UpperCamelCase_ = BeautifulSoup(requests.get(UpperCamelCase_ , params=UpperCamelCase_ ).content , "html.parser" ) UpperCam...
328
import io import math from typing import Dict, Optional, Union import numpy as np from huggingface_hub import hf_hub_download from ...image_processing_utils import BaseImageProcessor, BatchFeature from ...image_transforms import convert_to_rgb, normalize, to_channel_dimension_format, to_pil_image from ...image_...
328
1
import os from bleurt import score # From: git+https://github.com/google-research/bleurt.git import datasets _snake_case = datasets.logging.get_logger(__name__) _snake_case = '\\n@inproceedings{bleurt,\n title={BLEURT: Learning Robust Metrics for Text Generation},\n author={T...
26
__a :Dict = '0.18.2' from .configuration_utils import ConfigMixin from .utils import ( OptionalDependencyNotAvailable, is_flax_available, is_inflect_available, is_invisible_watermark_available, is_k_diffusion_available, is_k_diffusion_version, is_librosa_availa...
312
0
'''simple docstring''' from typing import List, Optional, Tuple, Union import torch from ...models import UNetaDModel from ...schedulers import ScoreSdeVeScheduler from ...utils import randn_tensor from ..pipeline_utils import DiffusionPipeline, ImagePipelineOutput class lowercase_ (lowercase_...
351
'''simple docstring''' from collections import OrderedDict from typing import Any, Mapping, Optional from ... import PreTrainedTokenizer, TensorType, is_torch_available from ...configuration_utils import PretrainedConfig from ...onnx import OnnxConfigWithPast from ...utils import logging lowerCAmelCase__ ...
52
0
"""simple docstring""" import os import unittest from transformers.models.transfo_xl.tokenization_transfo_xl import VOCAB_FILES_NAMES, TransfoXLTokenizer from ...test_tokenization_common import TokenizerTesterMixin class a ( a_, unittest.TestCase ): UpperCAmelCase_ : List[str] ...
220
"""simple docstring""" _UpperCamelCase : List[str] = { 'meter': 'm', 'kilometer': 'km', 'megametre': 'Mm', 'gigametre': 'Gm', 'terametre': 'Tm', 'petametre': 'Pm', 'exametre': 'Em', 'zettametre': 'Zm', 'yottametre': 'Ym', } # Exponent of the factor(meter) _UpperCame...
220
1
"""simple docstring""" _SCREAMING_SNAKE_CASE = [ 'DownloadConfig', 'DownloadManager', 'DownloadMode', 'StreamingDownloadManager', ] from .download_config import DownloadConfig from .download_manager import DownloadManager, DownloadMode from .streaming_download_manager...
358
from math import isqrt def snake_case ( snake_case__ :int) -> list[int]: _A = [True] * max_number for i in range(2 , isqrt(max_number - 1) + 1): if is_prime[i]: for j in range(i**2 , snake_case__ ...
81
0
from __future__ import annotations from fractions import Fraction def snake_case_ ( snake_case , snake_case ) -> bool: return ( num != den and num % 10 == den // 10 and (num // 10) / (den % 10) == num / den ) def snake_case_ ( snake_...
196
from collections import UserDict from typing import List, Union from ..utils import ( add_end_docstrings, is_tf_available, is_torch_available, is_vision_available, logging, requires_backends, ) from .base import PIPELINE_INIT_ARGS, Pipeline if is_vision_available(): from...
196
1
'''simple docstring''' from typing import List, Optional from ...configuration_utils import PretrainedConfig from ...utils import logging __UpperCamelCase = logging.get_logger(__name__) __UpperCamelCase = { '''huggingface/autoformer-tourism-monthly''': '''https://hu...
350
'''simple docstring''' from __future__ import annotations import unittest from transformers import is_tf_available from transformers.testing_utils import require_sentencepiece, require_tf, require_tokenizers, slow if is_tf_available(): import numpy as np import tensorflow as tf ...
13
0
'''simple docstring''' def lowercase__ ( __lowercase : int , __lowercase : int ) -> int: """simple docstring""" while a != 0: __UpperCamelCase , __UpperCamelCase = b % a, a return b def lowercase__ ( __lowerca...
53
'''simple docstring''' import argparse import json import pickle from pathlib import Path import requests import torch from huggingface_hub import hf_hub_download from PIL import Image from transformers import MaskFormerConfig, MaskFormerForInstanceSegmentation, MaskFormerImageProcessor, SwinConfig from transform...
31
0
'''simple docstring''' import collections.abc from typing import Optional, Tuple, Union import torch import torch.utils.checkpoint from torch import nn from torch.nn import BCEWithLogitsLoss, CrossEntropyLoss, MSELoss from ...activations import ACTaFN from ...modeling_outputs import Base...
351
'''simple docstring''' from arguments import InitializationArguments from transformers import AutoConfig, AutoModelForCausalLM, AutoTokenizer, HfArgumentParser # Configuration lowercase__ : List[Any] = HfArgumentParser(InitializationArguments) lowercase__ : List[Any] ...
190
0
"""simple docstring""" from __future__ import annotations import math def __a ( __lowerCamelCase, __lowerCamelCase ): UpperCAmelCase_ : Any = u for i in range(1, __lowerCamelCase ): UpperCAmelCase_ : int = temp * (u - i) return temp def ...
61
import argparse import torch from transformers import LxmertConfig, LxmertForPreTraining, load_tf_weights_in_lxmert from transformers.utils import logging logging.set_verbosity_info() def lowercase_ (A : str , A : List[Any] , A : Any ): # Initialise PyTorch model snake_...
277
0
def lowerCAmelCase_ ( _lowercase : str) -> int: assert column_title.isupper() a__ : Union[str, Any] = 0 a__ : Any = len(_lowercase) - 1 a__ : Dict = 0 while index >= 0: a__ : Optional[Any] ...
370
from __future__ import annotations import math def lowerCAmelCase_ ( _lowercase : int) -> list[int]: """simple docstring""" if num <= 0: a__ : Tuple = F'''{num}: Invalid input, please enter a positive integer.''' raise ValueE...
266
0
"""simple docstring""" from __future__ import annotations from typing import Any def __lowerCamelCase ( __UpperCamelCase ) -> int: """simple docstring""" if not postfix_notation: return 0 lowerCAmelCase_ : Tuple = {"+", "-", "*", "/"} lowerCAmelCase_ :...
241
"""simple docstring""" import inspect import os import sys import unittest import accelerate from accelerate.test_utils import execute_subprocess_async, require_tpu class __lowerCamelCase ( unittest.TestCase ): '''simple docstring''' def lowerCamelCase ( self : Optional...
241
1
import importlib import json import os import sys import tempfile import unittest from pathlib import Path import transformers import transformers.models.auto from transformers.models.auto.configuration_auto import CONFIG_MAPPING, AutoConfig from transformers.models.bert.configuration_bert import Bert...
315
# 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 require...
315
1
import unittest from transformers import EsmConfig, is_torch_available from transformers.testing_utils import TestCasePlus, require_torch, slow, torch_device from ...test_configuration_common import ConfigTester from ...test_modeling_common import ModelTesterMixin, ids_tensor, random_attention_mask from .....
7
'''simple docstring''' from statistics import mean, stdev def UpperCamelCase_ ( A__ : list , A__ : int = 3 ): '''simple docstring''' lowerCAmelCase_ : List[str] = min(A__ ) lowerCAmelCase_ : Optional[int] = ...
120
0
import math def UpperCAmelCase_( a__ ): """simple docstring""" if 1 < number < 4: # 2 and 3 are primes return True elif number < 2 or number % 2 == 0 or number % 3 == 0: # Negatives, 0, 1, all even numbers, all multiples of 3 are not primes return False ...
19
import torch from torch import nn from transformers import CLIPPreTrainedModel, CLIPVisionModel from ...models.attention import BasicTransformerBlock from ...utils import logging a__ : Tuple = logging.get_logger(__name__) # pylint: disable=invalid-name class a_ ( a__ ): ...
19
1
"""simple docstring""" from sympy import diff, lambdify, symbols from sympy.functions import * # noqa: F403 def _lowercase ( __snake_case ,__snake_case ,__snake_case = "x" ,__snake_case = 10**-10 ,__snake_case = 1 ,) -> complex: __lowerCAmelCase : ...
269
# 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 clas...
307
0
'''simple docstring''' from math import cos, sin, sqrt, tau from audio_filters.iir_filter import IIRFilter def _snake_case ( _SCREAMING_SNAKE_CASE : Union[str, Any] , _SCREAMING_SNAKE_CASE : Any , _SCREAMING_SNAKE_CASE : Optional[Any] = 1 / sqrt(2 ...
358
'''simple docstring''' from torch import nn def _snake_case ( _SCREAMING_SNAKE_CASE : Optional[int] ) -> Union[str, Any]: """simple docstring""" if act_fn in ["swish", "silu"]: return nn.SiLU() elif act_fn == "mish": return nn.Mish() elif a...
187
0
def _lowerCamelCase( ) -> List[str]: '''simple docstring''' for n in range(1 , 1_0_0_0_0_0_0 ): yield n * (n + 1) // 2 def _lowerCamelCase( lowercase__ ) -> Any: '''simple docstring''' __lowercase= 1 __lowercase= 2 while i * i <= n: __lowercase...
295
from typing import TYPE_CHECKING from ...file_utils import _LazyModule, is_tokenizers_available, is_torch_available from ...utils import OptionalDependencyNotAvailable lowerCAmelCase = {'''configuration_gpt_neox''': ['''GPT_NEOX_PRETRAINED_CONFIG_ARCHIVE_MAP''', '''GPTNeoXConfig''']} try: if not is_t...
295
1
import logging from dataclasses import dataclass, field from typing import Optional from seqaseq_trainer import arg_to_scheduler from transformers import TrainingArguments snake_case__ : Union[str, Any] = logging.getLogger(__name__) @dataclass class A_ ( _A ...
363
import math def _a ( lowerCamelCase: int ) -> int: '''simple docstring''' if not isinstance(lowerCamelCase , lowerCamelCase ): __A = F"""Input value of [number={number}] must be an integer""" rais...
250
0
import requests from bsa import BeautifulSoup def A_ ( snake_case : str , snake_case : dict ) -> str: '''simple docstring''' __UpperCamelCase = BeautifulSoup(requests.get(snake_case , params=snake_case ).content ...
328
import warnings from ...configuration_utils import PretrainedConfig from ...utils import logging lowercase__ : Any = logging.get_logger(__name__) lowercase__ : Tuple = { "xlnet-base-cased": "https://huggingface.co/xlnet-base-cased/resolve/main/config.json", "...
328
1
from typing import Optional, Tuple, Union import flax import flax.linen as nn import jax import jax.numpy as jnp from flax.core.frozen_dict import FrozenDict from ..configuration_utils import ConfigMixin, flax_register_to_config from ..utils import BaseOutput from .embeddings_flax import FlaxTimes...
347
import shutil import tempfile import unittest import numpy as np import pytest from transformers.testing_utils import require_vision from transformers.utils import is_vision_available if is_vision_available(): from PIL import Image from transformers import AutoProcessor, BertTokenizer, ...
347
1
from manim import * class _lowerCamelCase( _a ): def UpperCamelCase ( self) -> List[str]: """simple docstring""" _lowercase : Union[str, Any] = Rectangle(height=0.5, width=0.5) _lowercase : List[Any] ...
21
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 from .utils import require_elasticsearch, re...
52
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 ( __UpperCAmelCase ) -> Optional[int]: # picklable for multiprocessing ...
355
# 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 # # Unless required by ...
344
0
import os from shutil import copyfile from typing import Any, Dict, List, Optional, Tuple import sentencepiece as spm from ...tokenization_utils import AddedToken, PreTrainedTokenizer from ...utils import logging __snake_case = logging.get_logger(__name__) __snake_case = {"""vocab_file""": """sentenc...
348
"""simple docstring""" import os import unittest from transformers import BertTokenizerFast from transformers.models.bert.tokenization_bert import ( VOCAB_FILES_NAMES, BasicTokenizer, BertTokenizer, WordpieceTokenizer, _is_control, _is_punctuation, _is_whites...
81
0
'''simple docstring''' def A (__lowerCamelCase :int ): if not isinstance(__lowerCamelCase , __lowerCamelCase ): _lowerCAmelCase = f'Input value of [number={number}] must be an integer' raise TypeError(__lowerCamelCase ) if number < 1: ...
354
'''simple docstring''' import os def A (): with open(os.path.dirname(__lowerCamelCase ) + """/grid.txt""" ) as f: _lowerCAmelCase = [] # noqa: E741 for _ in range(20 ): l.append([int(__lowerCamelCase ) for x in f.readline().split()] ) ...
229
0
from typing import TYPE_CHECKING from ...utils import ( OptionalDependencyNotAvailable, _LazyModule, is_sentencepiece_available, is_speech_available, is_torch_available, ) UpperCAmelCase__ = { "configuration_trocr": ["TROCR_PRETRAINED_CONFIG_ARCHIVE_MAP", "TrO...
0
from ...utils import ( OptionalDependencyNotAvailable, is_torch_available, is_transformers_available, is_transformers_version, ) try: if not (is_transformers_available() and is_torch_available() and is_transformers_version(""">=""", """4.25.0""")): raise OptionalDependencyNotAvaila...
13
0
'''simple docstring''' from typing import TYPE_CHECKING from ...utils import OptionalDependencyNotAvailable, _LazyModule, is_torch_available UpperCAmelCase : Dict = { 'configuration_blip_2': [ 'BLIP_2_PRETRAINED_CONFIG_ARCHIVE_MAP', 'Blip2Config', 'Blip2QFormerConfi...
354
'''simple docstring''' from __future__ import annotations import math from collections import Counter from string import ascii_lowercase def a__ ( a__ ): """simple docstring""" __SCREAMING_SNAKE_CASE , __SCREAMING_SNAKE_CASE = analyze_text(a__ ) ...
331
0
'''simple docstring''' from typing import Any, Callable, Dict, List, Optional, Union import torch from transformers import CLIPImageProcessor, CLIPTextModel, CLIPTokenizer from diffusers import ( AutoencoderKL, DDIMScheduler, DiffusionPipeline, LMSDiscreteScheduler, ...
190
'''simple docstring''' from __future__ import annotations from numpy import array, cos, cross, floataa, radians, sin from numpy.typing import NDArray def _lowerCAmelCase ( __snake_case : float , __snake_case : float , __snake_case : bool = False ) -> ...
190
1
'''simple docstring''' from scipy.stats import pearsonr, spearmanr from sklearn.metrics import fa_score, matthews_corrcoef import datasets lowercase__ = "\\n@inproceedings{wang2019glue,\n title={{GLUE}: A Multi-Task Benchmark and Analysis Platform for Natural Language Understanding},\n au...
365
'''simple docstring''' from collections import OrderedDict from typing import Any, Mapping, Optional, Union from ...configuration_utils import PretrainedConfig from ...feature_extraction_utils import FeatureExtractionMixin from ...onnx import OnnxConfig from ...onnx.utils import compute_effective_axis_dim...
280
0
"""simple docstring""" import argparse import OmegaConf import torch from diffusers import DDIMScheduler, LDMPipeline, UNetLDMModel, VQModel def _SCREAMING_SNAKE_CASE ( _lowercase : Optional[Any] , _lowercase : Union[str, Any] , _lowercas...
105
"""simple docstring""" import argparse import struct import unittest class snake_case : '''simple docstring''' def __init__( self : Optional[int], _lowerCamelCase : bytes ): '''simple docstring''' __A = data # Initialize hash values __A = [ ...
266
0
def lowerCAmelCase__ ( SCREAMING_SNAKE_CASE_ , SCREAMING_SNAKE_CASE_ ) -> int: if len(SCREAMING_SNAKE_CASE_ ) != len(SCREAMING_SNAKE_CASE_ ): raise ValueError('String lengths must match!' ) lowerCAmelCase__ : Optional[int] = 0 for chara, chara...
307
from typing import TYPE_CHECKING from ...utils import ( OptionalDependencyNotAvailable, _LazyModule, is_tf_available, is_torch_available, is_vision_available, ) lowerCamelCase__ = { """configuration_blip""": [ """BLIP_PRETRAINED_CONFIG_ARCHIVE_MAP""", ""...
307
1
"""simple docstring""" import importlib import json import os import sys import tempfile import unittest from pathlib import Path import transformers import transformers.models.auto from transformers.models.auto.configuration_auto import CONFIG_MAPPING, AutoConfig from transformers.models.bert.configuration_bert...
315
"""simple docstring""" from scipy.stats import spearmanr import datasets a = ''' The Spearman rank-order correlation coefficient is a measure of the relationship between two datasets. Like other correlation coefficients, this one varies between -1 and +1 with 0 implying no correlation. Positive correlati...
315
1
import unittest from transformers import RoFormerTokenizer, RoFormerTokenizerFast from transformers.testing_utils import require_rjieba, require_tokenizers from ...test_tokenization_common import TokenizerTesterMixin @require_rjieba @require_tokenizers class UpperCamelCase__ ( lowerCAmelC...
193
from itertools import permutations def __lowercase ( _SCREAMING_SNAKE_CASE ) -> bool: '''simple docstring''' if num[3] % 2 != 0: return False if (num[2] + num[3] + num[4]) % 3 != 0: return False if num[5] % ...
193
1
import unittest from transformers import ( MODEL_FOR_SEQ_TO_SEQ_CAUSAL_LM_MAPPING, TF_MODEL_FOR_SEQ_TO_SEQ_CAUSAL_LM_MAPPING, TextaTextGenerationPipeline, pipeline, ) from transformers.testing_utils import is_pipeline_test, require_tf, require_torch from transformers.utils import is_torch_available f...
19
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 import Accelerator, Dist...
19
1
"""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...
365
import torch from diffusers import DDIMParallelScheduler from .test_schedulers import SchedulerCommonTest class __lowerCAmelCase ( lowerCAmelCase): _a = (DDIMParallelScheduler,) _a = (('''eta''', 0.0), ('''num_inference_steps''', 50)) def SCREAMING_SNAKE_CAS...
158
0
import tensorflow as tf from ...tf_utils import shape_list class lowercase ( tf.keras.layers.Layer ): def __init__( self , _a , _a , _a , _a , _a=1 , _a=False , **_a ) -> Optional[int]: super().__init__(**_a ) ...
26
def lowerCamelCase__ ( _A ): '''simple docstring''' snake_case_ = len(_A ) for i in range(_A ): for j in range(i + 1 , _A ): if numbers[j] < numbers[i]: snake_case_ , snake_case_ = numbers[j], numbers[i] ...
187
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, r...
364
'''simple docstring''' import unittest import numpy as np import torch from diffusers import PNDMPipeline, PNDMScheduler, UNetaDModel from diffusers.utils.testing_utils import enable_full_determinism, require_torch, slow, torch_device enable_full_determinism() class _...
89
0
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
'''simple docstring''' import argparse import torch from transformers import ( SpeechTaConfig, SpeechTaFeatureExtractor, SpeechTaForSpeechToSpeech, SpeechTaForSpeechToText, SpeechTaForTextToSpeech, SpeechTaProcessor, SpeechTaTokenizer, logging, ) from transformers.tokenization_utils ...
250
0
"""simple docstring""" import argparse import hashlib # hashlib is only used inside the Test class import struct class UpperCamelCase__ : """simple docstring""" def __init__( self : Dict , SCREAMING_SNAKE_CASE_ : Tuple ): ...
359
"""simple docstring""" import os from bleurt import score # From: git+https://github.com/google-research/bleurt.git import datasets lowercase__ : Tuple = datasets.logging.get_logger(__name__) lowercase__ : List[Any] = """\ @inproceedings{bleurt, titl...
289
0
"""simple docstring""" from typing import Optional, Tuple, Union import flax import flax.linen as nn import jax import jax.numpy as jnp from flax.core.frozen_dict import FrozenDict from ..configuration_utils import ConfigMixin, flax_register_to_config from ..utils import BaseOutput from .embeddings_flax import Fla...
347
"""simple docstring""" import datasets __SCREAMING_SNAKE_CASE : Tuple = '\\n@InProceedings{conneau2018xnli,\n author = "Conneau, Alexis\n and Rinott, Ruty\n and Lample, Guillaume\n and Williams, Adina\n and Bowman, Samuel R.\n ...
347
1
'''simple docstring''' def snake_case__ ( lowerCamelCase__ : Any=2_8_1_2_3 ) -> Tuple: A_ : Tuple = [1] * (limit + 1) for i in range(2 , int(limit**0.5 ) + 1 ): sum_divs[i * i] += i for k in range(i + 1 , ...
350
'''simple docstring''' import argparse from collections import OrderedDict from pathlib import Path import torch from huggingface_hub import hf_hub_download from PIL import Image from torchvision.transforms import functional as F from transformers import DetrImageProcessor, TableTransforme...
4
0
"""simple docstring""" from __future__ import annotations import time from collections.abc import Sequence from random import randint from matplotlib import pyplot as plt def A ( snake_case :Sequence[float] , snake_case :int , snake_case :int ) -> tuple[int | ...
316
"""simple docstring""" def A ( snake_case :list[int] , snake_case :list[int] ) -> None: __UpperCamelCase = len(snake_case ) print('The following activities are selected:' ) # The first activity is always selected __UpperCamelCase = 0 print(snake_case...
316
1
'''simple docstring''' import importlib import sys from argparse import REMAINDER, ArgumentParser from pathlib import Path import torch_xla.distributed.xla_multiprocessing as xmp def a__ ( ): """simple docstring""" __SCREAMING_SNAKE_CASE = ArgumentParser( descrip...
365
'''simple docstring''' import itertools from dataclasses import dataclass from typing import List, Optional import pyarrow as pa import pyarrow.parquet as pq import datasets from datasets.table import table_cast UpperCAmelCase : List[str] = datasets.utils.logging.get_logger(__name__) @...
331
0
lowerCamelCase = 8.3144598 def UpperCAmelCase__ ( _A : float , _A : float ): '''simple docstring''' if temperature < 0: raise Exception('''Temperature cannot be less than 0 K''' ) if molar_mass <= 0: raise Exception('''Molar mass cannot be...
188
'''simple docstring''' from unittest import TestCase from datasets import Sequence, Value from datasets.arrow_dataset import Dataset class _lowercase ( UpperCAmelCase__ ): '''simple docstring''' def a ( self : int ) -> Optional[Any]: return ...
229
0
"""simple docstring""" from typing import TYPE_CHECKING from ...utils import OptionalDependencyNotAvailable, _LazyModule, is_torch_available A__ : Union[str, Any] = { 'configuration_bigbird_pegasus': [ 'BIGBIRD_PEGASUS_PRETRAINED_CONFIG_ARCHIVE_MAP', 'BigBirdPegasusConfig', ...
358
"""simple docstring""" import gc import random import unittest import numpy as np import torch from transformers import XLMRobertaTokenizer from diffusers import ( AltDiffusionImgaImgPipeline, AutoencoderKL, PNDMScheduler, UNetaDConditionModel, ) from diffusers.image_processor import VaeImag...
209
0
'''simple docstring''' from typing import TYPE_CHECKING from ...utils import ( OptionalDependencyNotAvailable, _LazyModule, is_flax_available, is_tf_available, is_tokenizers_available, is_torch_available, ) lowercase__ : List[Any] = { '''configuration_electra''': ['...
324
'''simple docstring''' import unittest from transformers import DebertaConfig, is_torch_available from transformers.testing_utils import require_sentencepiece, require_tokenizers, require_torch, slow, torch_device from ...test_configuration_common import ConfigTester from ...test_modeling_common import ModelTeste...
331
0
import math def __lowerCamelCase ( __a :int ) -> bool: """simple docstring""" if 1 < number < 4: # 2 and 3 are primes return True elif number < 2 or number % 2 == 0 or number % 3 == 0: # Negatives, 0, 1, all even numbers, all mult...
276
from string import ascii_uppercase A : List[str] = {str(ord(c) - 5_5): c for c in ascii_uppercase} def __lowerCamelCase ( __a :int , __a :int ) -> str: """simple docstring""" if isinstance(__a , __a ): raise TypeE...
276
1
'''simple docstring''' import argparse import os import gluonnlp as nlp import mxnet as mx import numpy as np import torch from gluonnlp.base import get_home_dir from gluonnlp.model.bert import BERTEncoder from gluonnlp.model.utils import _load_vocab from gluonnlp.vocab import Vocab from packaging import versio...
58
from __future__ import annotations import math import random from collections.abc import Collection from typing import overload class _A: """simple docstring""" def __init__( self , _A = None ): if components is None: __A : int = [] ...
280
0
"""simple docstring""" from __future__ import annotations import math from collections.abc import Callable def UpperCAmelCase__ ( lowerCAmelCase__ :Callable[[int | float], int | float] , lowerCAmelCase__ :int | float , lowerCAmelCase__ :int | float , lowerCAmelCase__ :i...
352
"""simple docstring""" from typing import TYPE_CHECKING from ...utils import ( OptionalDependencyNotAvailable, _LazyModule, is_flax_available, is_tf_available, is_torch_available, is_vision_available, ) __lowerCAmelCase : List[str] ={"""configuration_vit""": ["...
32
0
import unittest from transformers import RoFormerTokenizer, RoFormerTokenizerFast from transformers.testing_utils import require_rjieba, require_tokenizers from ...test_tokenization_common import TokenizerTesterMixin @require_rjieba @require_tokenizers class __SCREAMING_SNAKE_CASE( a_ ...
307
import warnings from typing import List, Optional, Union from ...processing_utils import ProcessorMixin from ...tokenization_utils_base import BatchEncoding, PaddingStrategy, PreTokenizedInput, TextInput, TruncationStrategy from ...utils import TensorType class __SCREAMING_SNAKE_CASE( a_ ...
307
1
'''simple docstring''' from ..utils import DummyObject, requires_backends class __A ( metaclass=UpperCamelCase__ ): a__ : int = ["""flax""", """transformers"""] def __init__(self : Union[str, Any] , *__a : Optional[Any] , **__a : Dict ): ...
106
'''simple docstring''' import argparse import logging import os import sys import numpy as np import onnxruntime import torch from bart_onnx.generation_onnx import BARTBeamSearchGenerator from bart_onnx.reduce_onnx_size import remove_dup_initializers import transformers from transformers import BartForConditiona...
106
1
def UpperCamelCase__( UpperCamelCase__ : list[list[float]] )->list[list[float]]: A__ = [] for data in source_data: for i, el in enumerate(UpperCamelCase__ ): if len(UpperCamelCase__ ) < i + 1: ...
193
a__: Dict = {0: [2, 3], 1: [0], 2: [1], 3: [4], 4: []} a__: str = {0: [1, 2, 3], 1: [2], 2: [0], 3: [4], 4: [5], 5: [3]} def UpperCamelCase__( UpperCamelCase__ : dict[int, list[int]] , UpperCamelCase__ : int , UpperCamelCase__ : list...
193
1
'''simple docstring''' import json import re from typing import TYPE_CHECKING, List, Optional, Tuple, Union import numpy as np from ...utils import is_tf_available, is_torch_available, logging if TYPE_CHECKING: if is_torch_available(): import torch if is_tf_available(): ...
107
'''simple docstring''' import doctest import glob import importlib import inspect import os import re from contextlib import contextmanager from functools import wraps from unittest.mock import patch import numpy as np import pytest from absl.testing import parameterized import datasets from datasets import load...
107
1
'''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 from .utils import re...
56
'''simple docstring''' import math import unittest def __a(SCREAMING_SNAKE_CASE_ : int ): '''simple docstring''' assert isinstance(SCREAMING_SNAKE_CASE_ , SCREAMING_SNAKE_CASE_ ) and ( number >= 0 ), "'number' must been an int and positive" if 1 < number <...
158
0
'''simple docstring''' import argparse import struct import unittest class UpperCAmelCase__ : """simple docstring""" def __init__( self : List[str] ,_a : bytes ): '''simple docstring''' _a : Optional[int] = data # Initialize has...
5
'''simple docstring''' import inspect import unittest from transformers import ViTMSNConfig from transformers.testing_utils import require_torch, require_vision, slow, torch_device from transformers.utils import cached_property, is_torch_available, is_vision_available from ...test_configuration_common import ...
5
1
import shutil import tempfile import unittest from unittest.mock import patch from transformers import ( DefaultFlowCallback, IntervalStrategy, PrinterCallback, ProgressCallback, Trainer, TrainerCallback, TrainingArguments, is_torch_available, ) from transformers.testing_...
143
'''simple docstring''' import fire from torch.utils.data import DataLoader from tqdm import tqdm from transformers import AutoTokenizer from utils import SeqaSeqDataset, pickle_save def __lowerCamelCase ( lowerCAmelCase_ , lowerCAmelCase_ , lowerCAmelCase_=1024 , lowerCAmelCa...
89
0
'''simple docstring''' from typing import TYPE_CHECKING from ...utils import ( OptionalDependencyNotAvailable, _LazyModule, is_tf_available, is_torch_available, is_vision_available, ) _lowerCamelCase = { """configuration_mobilevit""": ["""MOBILEVIT_PRETRAINED_CONFIG_ARCHIVE_MAP"...
353
'''simple docstring''' import argparse import torch from transformers import GPTaConfig, GPTaModel, load_tf_weights_in_gpta from transformers.utils import CONFIG_NAME, WEIGHTS_NAME, logging logging.set_verbosity_info() def a__ ( _SCREAMING_SNAKE_CASE : Optional[Any] , _SCREAMING...
67
0
import pytest from datasets import Dataset, DatasetDict, Features, NamedSplit, Value from datasets.io.text import TextDatasetReader from ..utils import assert_arrow_memory_doesnt_increase, assert_arrow_memory_increases def _snake_case ( lowerCAmelCase : str , lowerCAmelCase : Union[str, ...
18
import unittest from transformers import XLMConfig, is_torch_available from transformers.testing_utils import require_torch, slow, torch_device from ...generation.test_utils import GenerationTesterMixin from ...test_configuration_common import ConfigTester from ...test_modeling_common import ModelTes...
308
0
import unittest from diffusers import FlaxAutoencoderKL from diffusers.utils import is_flax_available from diffusers.utils.testing_utils import require_flax from .test_modeling_common_flax import FlaxModelTesterMixin if is_flax_available(): import jax @require_flax class __SCREAMING_SNAKE_CASE (...
363
from __future__ import annotations from math import ceil, floor, sqrt def __lowercase ( _UpperCamelCase = 2000000 ) ->int: """simple docstring""" lowercase : list[int] = [0] lowercase : int for idx in range(1, ceil(sqrt(target * 2 ...
173
0
'''simple docstring''' 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 __lowerCAmelCase ( UpperCamelCase__ ) -> tup...
67
'''simple docstring''' from ...configuration_utils import PretrainedConfig from ...utils import logging __snake_case =logging.get_logger(__name__) __snake_case ={ """facebook/s2t-wav2vec2-large-en-de""": ( """https://huggingface.co/facebook/s2t-wav2vec2-large-en-d...
4
0
from math import factorial def lowercase_ ( A__ = 100 ) -> int: """simple docstring""" return sum(int(A__ ) for x in str(factorial(A__ ) ) ) if __name__ == "__main__": print(solution(int(input("Enter the Number: ").strip())))
137
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, blend...
137
1
'''simple docstring''' from ...configuration_utils import PretrainedConfig from ...utils import logging lowercase__ : List[Any] = logging.get_logger(__name__) lowercase__ : str = { # See all MEGATRON_BERT models at https://huggingface.co/models?filter=bert } class __low...
324
'''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 _lowerCamelCase ( unittest.TestCas...
331
0
from typing import Dict, Optional import numpy as np import datasets A : Any = "\nIoU is the area of overlap between the predicted segmentation and the ground truth divided by the area of union\nbetween the predicted segmentation and the ground truth. For binary (two classes) or multi-class se...
305
from ....utils import logging A : List[str] = logging.get_logger(__name__) class lowerCamelCase (SCREAMING_SNAKE_CASE__ ): """simple docstring""" def __init__( self : List[str] , __magic_name__ : Optional[Any] , __magic_name__ : Any=None ...
305
1
'''simple docstring''' from ...configuration_utils import PretrainedConfig from ...utils import logging _SCREAMING_SNAKE_CASE = logging.get_logger(__name__) _SCREAMING_SNAKE_CASE = { "microsoft/swinv2-tiny-patch4-window8-256": ( "https://huggingface.co/microsoft/swinv2...
158
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 lowerCAmelCase__(__snake_case ) -> int: # picklable for multiprocessing ...
209
0
from .configuration_bert_masked import MaskedBertConfig from .modeling_bert_masked import ( MaskedBertForMultipleChoice, MaskedBertForQuestionAnswering, MaskedBertForSequenceClassification, MaskedBertForTokenClassification, MaskedBertModel, ) from .modules import *
351
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 PaddingStrategy, logging _Uppe...
158
0
'''simple docstring''' A__: str = ''' # Transformers 설치 방법 ! pip install transformers datasets # 마지막 릴리스 대신 소스에서 설치하려면, 위 명령을 주석으로 바꾸고 아래 명령을 해제하세요. # ! pip install git+https://github.com/huggingface/transformers.git ''' A__: Optional[Any] = [{'''type''': '''cod...
276
'''simple docstring''' from collections import OrderedDict from typing import Mapping from ...configuration_utils import PretrainedConfig from ...onnx import OnnxConfig from ...utils import logging A__: List[str] = logging.get_logger(__name__) A__: Union[str, Any] ...
276
1
import argparse 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 Accelerator, DistributedT...
353
import logging import os import sys from dataclasses import dataclass, field from typing import Optional import torch from datasets import load_dataset from torchvision.transforms import Compose, Lambda, Normalize, RandomHorizontalFlip, RandomResizedCrop, ToTensor from torchvision.transforms.functional import Inter...
117
0
from typing import TYPE_CHECKING from ...utils import ( OptionalDependencyNotAvailable, _LazyModule, is_tf_available, is_torch_available, is_vision_available, ) a__ = { 'configuration_mobilevit': ['MOBILEVIT_PRETRAINED_CONFIG_ARCHIVE_MAP', 'MobileViTConfig', 'MobileViTOnnx...
235
from collections import OrderedDict from typing import Mapping from ...configuration_utils import PretrainedConfig from ...onnx import OnnxConfig from ...utils import logging UpperCAmelCase_ : str = logging.get_logger(__name__) UpperCAmelCase_ : List[str] = { '...
32
0
"""simple docstring""" def lowercase ( a__ : int ) -> "list[int]": if upper_limit < 0: raise ValueError('''Limit for the Catalan sequence must be ≥ 0''' ) _UpperCamelCase = [0] * (upper_limit + 1) # Base case: C(0) = C(1) = 1 _UpperCamelCa...
54
"""simple docstring""" import warnings from typing import List import numpy as np from ...processing_utils import ProcessorMixin from ...tokenization_utils_base import BatchEncoding from ...utils import is_flax_available, is_tf_available, is_torch_available class UpperCAmelCase_ ( _lowercase): ...
54
1
"""simple docstring""" from __future__ import annotations import unittest from transformers import is_tf_available from transformers.testing_utils import require_sentencepiece, require_tf, require_tokenizers, slow if is_tf_available(): import numpy as np import tensorflow as tf from tra...
106
"""simple docstring""" def __SCREAMING_SNAKE_CASE ( A_ , A_ ): return numa ^ numa < 0 if __name__ == "__main__": import doctest doctest.testmod()
106
1
from ...configuration_utils import PretrainedConfig from ...utils import logging lowerCAmelCase_ = logging.get_logger(__name__) lowerCAmelCase_ = { '''microsoft/biogpt''': '''https://huggingface.co/microsoft/biogpt/resolve/main/config.json''', # See all BioGPT models at https://huggingface....
279
import logging import os import random import sys from dataclasses import dataclass, field from typing import Optional import datasets import evaluate import numpy as np from datasets import load_dataset import transformers from transformers import ( AutoConfig, AutoModelForSequenceClassification, A...
279
1
from typing import Any, Callable, Dict, List, Optional, Union import torch from transformers import CLIPImageProcessor, CLIPTextModel, CLIPTokenizer from diffusers import ( AutoencoderKL, DDIMScheduler, DiffusionPipeline, LMSDiscreteScheduler, PNDMScheduler, StableDiffusionPipeline, U...
107
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 import jit from transformer...
107
1
"""simple docstring""" from typing import TYPE_CHECKING from ...utils import ( OptionalDependencyNotAvailable, _LazyModule, is_flax_available, is_tf_available, is_tokenizers_available, is_torch_available, ) __A = { '''configuration_distilbert''': [ '...
361
"""simple docstring""" import copy from ...configuration_utils import PretrainedConfig from ...utils import logging from ..auto import CONFIG_MAPPING __A = logging.get_logger(__name__) __A = { '''ut/deta''': '''https://huggingface.co/ut/deta/resolve/main/config.json''', } class _snake_case ...
64
0
import argparse import struct import unittest class lowerCamelCase__ : def __init__(self , UpperCAmelCase ) -> None: _lowercase =data # Initialize hash values _lowercase =[ 0X6_a_0_9_e_6_6_7, 0Xb_b_6_7_a_e_8_5, ...
5
from typing import TYPE_CHECKING from ...utils import OptionalDependencyNotAvailable, _LazyModule, is_tf_available, is_torch_available UpperCAmelCase__ = { '''configuration_xlm''': ['''XLM_PRETRAINED_CONFIG_ARCHIVE_MAP''', '''XLMConfig''', '''XLMOnnxConfig'''], '''tokenization_xlm''': ['''XLMToke...
5
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 A_( ...
251
'''simple docstring''' from __future__ import annotations import unittest from transformers import BlenderbotConfig, BlenderbotTokenizer, is_tf_available from transformers.testing_utils import require_tf, require_tokenizers, slow from transformers.utils import cached_property from ...test_configuration_co...
251
1
from typing import TYPE_CHECKING from ...utils import OptionalDependencyNotAvailable, _LazyModule, is_tokenizers_available, is_torch_available a : Optional[Any] = { "configuration_squeezebert": [ "SQUEEZEBERT_PRETRAINED_CONFIG_ARCHIVE_MAP", "SqueezeBertConfig",...
114
'''simple docstring''' import torch from transformers import PreTrainedModel, XLMRobertaConfig, XLMRobertaModel class a__ ( UpperCAmelCase__ ): lowerCamelCase : Dict ="M-CLIP" def __init__( self : Tuple , a : Optional[int]=10_24 , a : Tuple=7_68 , **a : ...
67
0
'''simple docstring''' import json import os import tempfile from transformers.testing_utils import check_json_file_has_correct_format class __A : a__ : Union[str, Any] = None def _lowercase (self : Union[str, Any] ): UpperCAmelCase_ = self.feature_ext...
106
'''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_output_features_...
106
1
import gc import random import tempfile import unittest import numpy as np import torch from PIL import Image from transformers import CLIPTextConfig, CLIPTextModel, CLIPTokenizer from diffusers import ( AutoencoderKL, DDIMInverseScheduler, DDIMScheduler, DPMSolverMultistepInverseScheduler, ...
10
"""simple docstring""" def __magic_name__ ( lowercase , lowercase ): SCREAMING_SNAKE_CASE_: Union[str, Any] =int(lowercase ) # Initialize Result SCREAMING_SNAKE_CASE_: str =[] # Traverse through all denomination for denomination in reversed(l...
173
0
"""simple docstring""" from typing import TYPE_CHECKING from ...utils import ( OptionalDependencyNotAvailable, _LazyModule, is_flax_available, is_sentencepiece_available, is_tf_available, is_tokenizers_available, is_torch_available, ) _lowercase : Tuple ...
86
"""simple docstring""" from typing import Dict import numpy as np from ..utils import add_end_docstrings, is_tf_available, is_torch_available, logging from .base import PIPELINE_INIT_ARGS, GenericTensor, Pipeline, PipelineException if is_tf_available(): import tensorflow as tf from ...
86
1
import json import os import re import unicodedata from json.encoder import INFINITY from typing import Any, Dict, List, Optional, Tuple, Union import numpy as np import regex from ...tokenization_utils import AddedToken, PreTrainedTokenizer from ...tokenization_utils_base import BatchEncoding from ...utils im...
137
# 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 # # Unless required by ap...
137
1
"""simple docstring""" from manim import * class _UpperCAmelCase( lowerCamelCase ): def UpperCAmelCase ( self) -> Any: '''simple docstring''' _UpperCamelCase = Rectangle(height=0.5 , width=0.5) _UpperCamelCase ...
100
"""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/licens...
100
1
from google.protobuf import descriptor as _descriptor from google.protobuf import descriptor_pool as _descriptor_pool from google.protobuf import symbol_database as _symbol_database from google.protobuf.internal import builder as _builder # @@protoc_insertion_point(imports) UpperCAmelCase : List[Any] ...
280
import tempfile import torch from diffusers import IPNDMScheduler from .test_schedulers import SchedulerCommonTest class SCREAMING_SNAKE_CASE ( lowerCamelCase__ ): __lowerCamelCase : Optional[int] =(IPNDMScheduler,) __lowerCamelCase : int =(('num_inference_steps', 50),)...
302
0
'''simple docstring''' from string import ascii_lowercase, ascii_uppercase def A (__lowerCamelCase :str ): if not sentence: return "" _lowerCAmelCase = dict(zip(__lowerCamelCase , __lowerCamelCase ) ) return lower_to_upper.get(sentence[0] , sentence[0] ...
229
'''simple docstring''' from typing import TYPE_CHECKING from ....utils import OptionalDependencyNotAvailable, _LazyModule, is_torch_available, is_vision_available _lowercase = {"""configuration_van""": ["""VAN_PRETRAINED_CONFIG_ARCHIVE_MAP""", """VanConfig"""]} try: if not is_torch_available(): ...
229
1
'''simple docstring''' import warnings from typing import Dict import numpy as np from ..utils import ExplicitEnum, add_end_docstrings, is_tf_available, is_torch_available from .base import PIPELINE_INIT_ARGS, GenericTensor, Pipeline if is_tf_available(): from ..models.auto.modeling_tf_auto import TF...
158
'''simple docstring''' from typing import TYPE_CHECKING from ...utils import ( OptionalDependencyNotAvailable, _LazyModule, is_flax_available, is_sentencepiece_available, is_tf_available, is_tokenizers_available, is_torch_available, ) _SCREAMING_SNAKE_CASE = {"config...
158
1
import argparse import glob import logging import os from argparse import Namespace from importlib import import_module import numpy as np import torch from lightning_base import BaseTransformer, add_generic_args, generic_train from seqeval.metrics import accuracy_score, fa_score, precision_score, recall_s...
352
import warnings from typing import List, Optional, Union from ...processing_utils import ProcessorMixin from ...tokenization_utils_base import BatchEncoding, PaddingStrategy, PreTokenizedInput, TextInput, TruncationStrategy from ...utils import TensorType class lowerCamelCase ( A_ ): ...
137
0
def _a ( ) -> Optional[int]: a = 0 for i in range(1 , 1_001 ): total += i**i return str(a )[-10:] if __name__ == "__main__": print(solution())
0
from typing import Optional, Tuple, Union import flax import flax.linen as nn import jax import jax.numpy as jnp from flax.core.frozen_dict import FrozenDict from ..configuration_utils import ConfigMixin, flax_register_to_config from ..utils import BaseOutput from .embeddings_flax import FlaxTim...
117
0
'''simple docstring''' from ...configuration_utils import PretrainedConfig from ...utils import logging __snake_case : Any = logging.get_logger(__name__) __snake_case : int = { 'tanreinama/GPTSAN-2.8B-spout_is_uniform': ( 'https://huggingface.co/tanreinama/GPT...
136
'''simple docstring''' from __future__ import annotations from typing import Any class lowerCamelCase : '''simple docstring''' def __init__( self : List[str] , lowerCAmelCase_ : int ) -> None: '''simple docstring''' A__ : Any =num...
136
1
"""simple docstring""" class UpperCamelCase_ : """simple docstring""" def __init__( self : Optional[Any] ) -> None: __SCREAMING_SNAKE_CASE = {} # Mapping from char to TrieNode __SCREAMING_SNAKE_CASE = False def UpperCAmelCase_ ( self : ...
54
"""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.TestCase): """s...
54
1
import os import unittest from transformers.models.cpmant.tokenization_cpmant import VOCAB_FILES_NAMES, CpmAntTokenizer from transformers.testing_utils import require_jieba, tooslow from ...test_tokenization_common import TokenizerTesterMixin @require_jieba class lowerCamelCase (SCREAMING_SNAKE_CASE__ , ...
305
import shutil import tempfile import unittest import numpy as np import pytest from transformers.testing_utils import require_vision from transformers.utils import is_vision_available if is_vision_available(): from PIL import Image from transformers import AutoProcessor, BlipaProcessor, BlipImageProces...
305
1