code
stringlengths
82
54.1k
code_codestyle
int64
0
699
style_context
stringlengths
111
35.6k
style_context_codestyle
int64
0
699
label
int64
0
1
'''simple docstring''' def _A ( UpperCAmelCase = 1000000 ): '''simple docstring''' A__ = set(range(3 ,lowerCamelCase_ ,2 ) ) primes.add(2 ) for p in range(3 ,lowerCamelCase_ ,2 ): if p not in primes: co...
531
__snake_case : str ='\n# Transformers installation\n! pip install transformers datasets\n# To install from source instead of the last release, comment the command above and uncomment the following one.\n# ! pip install git+https://github.com/huggingface/transformers.git\n' __snake_case : ...
647
0
import unittest import numpy as np from transformers.file_utils import is_torch_available, is_vision_available from transformers.testing_utils import require_torch, require_vision from ...test_image_processing_common import ImageProcessingSavingTestMixin, prepare_image_inputs if is_torch_avai...
663
import argparse import json import requests import torch from huggingface_hub import hf_hub_download from PIL import Image from transformers import ViTImageProcessor, ViTMSNConfig, ViTMSNModel from transformers.image_utils import IMAGENET_DEFAULT_MEAN, IMAGENET_DEFAULT_STD torch.set_grad_enabled(False) de...
647
0
'''simple docstring''' import darl # noqa import gym import tqdm from diffusers.experimental import ValueGuidedRLPipeline __magic_name__ : List[str] = { 'n_samples': 64, 'horizon': 32, 'num_inference_steps': 20, 'n_guide_steps': 2, # can set to 0 for faster sampling, does not use...
672
import requests __snake_case : Optional[int] ='YOUR API KEY' def lowerCAmelCase__ ( lowerCamelCase_ : str ,lowerCamelCase_ : str = giphy_api_key): '''simple docstring''' lowerCAmelCase__ : Tuple = '''+'''.join(query.split()) lo...
647
0
"""simple docstring""" from manim import * class __UpperCAmelCase( lowerCamelCase__ ): """simple docstring""" def UpperCAmelCase_ ( self ): '''simple docstring''' lowercase__ : Union[str, Any]= Rect...
218
from collections.abc import Callable class lowerCamelCase__ : '''simple docstring''' def __init__(self ,__lowerCamelCase = None ) -> None: """simple docstring""" lowerCAmelCase__ : list = [] # Stores indexes of each item for supporting updates and ...
647
0
'''simple docstring''' from ...configuration_utils import PretrainedConfig from ...utils import logging _SCREAMING_SNAKE_CASE = logging.get_logger(__name__) _SCREAMING_SNAKE_CASE = { 'facebook/s2t-small-librispeech-asr': ( 'https://huggingface.co/fac...
369
import unittest from transformers import is_flax_available from transformers.testing_utils import require_flax, require_sentencepiece, require_tokenizers, require_torch, slow if is_flax_available(): import optax from flax.training.common_utils import onehot from transformers import AutoToke...
647
0
import os import zipfile import requests from get_ci_error_statistics import download_artifact, get_artifacts_links def A ( snake_case__ : List[str] , snake_case__ : List[Any]=7 ) -> List[str]: '''simple docstring''' __snake_case = None if token ...
313
import torch from diffusers import KDPMaDiscreteScheduler from diffusers.utils import torch_device from .test_schedulers import SchedulerCommonTest class lowerCamelCase__ ( lowerCamelCase__): '''simple docstring''' snake_case_ =(KDPMaDiscreteScheduler,) snake_case_ =10 def...
647
0
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 UpperCamelCase__ (lowerCamelCase__ ): '''simple docstring''' ...
311
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 ) -> str: """simple docstring""" ...
647
0
"""simple docstring""" from __future__ import annotations from collections.abc import Iterator from typing import Generic, TypeVar __lowercase : int = TypeVar("T") class _A ( Generic[T] ): """simple docstring""" def __init__( self : Optiona...
564
import os import unittest from transformers.models.bartpho.tokenization_bartpho import VOCAB_FILES_NAMES, BartphoTokenizer from transformers.testing_utils import get_tests_dir from ...test_tokenization_common import TokenizerTesterMixin __snake_case : List[Any] =get_tests_dir('fixtures/test_sent...
647
0
import os import tempfile import unittest from transformers.models.marian.convert_marian_tatoeba_to_pytorch import DEFAULT_REPO, TatoebaConverter from transformers.testing_utils import slow from transformers.utils import cached_property @unittest.skipUnless(os.path.exists(lowerCamelCase__ ) , 'Tatoeba directo...
398
import math import unittest def lowerCAmelCase__ ( lowerCamelCase_ : int): '''simple docstring''' assert isinstance(lowerCamelCase_ ,lowerCamelCase_) and ( number >= 0 ), "'number' must been an int and positive" if 1 < number < 4: # 2 and 3 a...
647
0
# 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 ...
175
import bza import gzip import lzma import os import shutil import struct import tarfile import warnings import zipfile from abc import ABC, abstractmethod from pathlib import Path from typing import Dict, List, Optional, Type, Union from .. import config from .filelock import FileLock from .logging import get_logg...
647
0
import os from shutil import copyfile from typing import List, Optional, Tuple import sentencepiece as spm from ...tokenization_utils import PreTrainedTokenizer from ...utils import logging _UpperCAmelCase = logging.get_logger(__name__) _UpperCAmelCase = {'vocab_file': 'sent...
558
import unittest import numpy as np from transformers.testing_utils import require_torch, require_vision from transformers.utils import is_torch_available, is_vision_available from ...test_image_processing_common import ImageProcessingSavingTestMixin, prepare_video_inputs if is_torch_available(): import ...
647
0
'''simple docstring''' import os import jsonlines import numpy as np from tqdm import tqdm lowerCAmelCase_ = 2_0_4_8 lowerCAmelCase_ = 4_0_9_6 lowerCAmelCase_ = 4_2 lowerCAmelCase_ = os.environ.pop('''PROCESS_TRAIN''', '''false''') lowerCAmelCase_ ...
531
def lowerCAmelCase__ ( lowerCamelCase_ : Dict): '''simple docstring''' lowerCAmelCase__ : Optional[Any] = len(lowerCamelCase_) while cur > 1: # Find the maximum number in arr lowerCAmelCase__ : Tuple = arr.index(max(arr[0:cur])) ...
647
0
from dataclasses import dataclass, field from typing import Optional @dataclass class lowerCamelCase : """simple docstring""" UpperCAmelCase_ = field( default="codeparrot/codeparrot" , metadata={"help": "Model name or path of mo...
663
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, To...
647
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, ) if is_sentencepiece_available(): from ..ta.t...
672
from typing import TYPE_CHECKING from ...utils import ( OptionalDependencyNotAvailable, _LazyModule, is_torch_available, ) __snake_case : int ={ 'configuration_gpt_bigcode': ['GPT_BIGCODE_PRETRAINED_CONFIG_ARCHIVE_MAP', 'GPTBigCodeConfig'], } try: if not is_torch_available...
647
0
"""simple docstring""" import requests a : Optional[int] = 'YOUR API KEY' def lowercase__(A , A = giphy_api_key ) ->Any: """simple docstring""" lowercase__ : Tuple= '''+'''.join(query.split() ) lower...
218
import copy from dataclasses import dataclass from pathlib import Path from typing import Dict, Optional, Union @dataclass class lowerCamelCase__ : '''simple docstring''' snake_case_ =None snake_case_ =False snake_case_ =False snake_case_ =False snake_case_ =Non...
647
0
'''simple docstring''' from ...configuration_utils import PretrainedConfig from ...utils import logging from ...utils.backbone_utils import BackboneConfigMixin, get_aligned_output_features_output_indices _SCREAMING_SNAKE_CASE = logging.get_logger(__name__) _SCREAMING_SNAKE_CA...
369
def lowerCAmelCase__ ( lowerCamelCase_ : Dict ,lowerCamelCase_ : Optional[int]): '''simple docstring''' lowerCAmelCase__ : int = (boundary[1] - boundary[0]) / steps lowerCAmelCase__ : Optional[int] = boundary[0] lowerCAmelCase__ : ...
647
0
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_dim...
313
from __future__ import annotations import unittest from transformers import MobileBertConfig, is_tf_available from transformers.models.auto import get_values from transformers.testing_utils import require_tf, slow from ...test_configuration_common import ConfigTester from ...test_modeling_tf_common import TFMode...
647
0
import os from shutil import copyfile from typing import Any, Dict, List, Optional, Tuple import sentencepiece as spm from ...tokenization_utils import PreTrainedTokenizer from ...utils import logging SCREAMING_SNAKE_CASE__ : Union[str, Any] = logging.get_logger(__name__) SCREAMING_SNAK...
311
import os import tempfile import unittest from transformers import NezhaConfig, is_torch_available from transformers.models.auto import get_values from transformers.testing_utils import require_torch, require_torch_gpu, slow, torch_device from ...generation.test_utils import GenerationTesterMixin from ...test_con...
647
0
"""simple docstring""" def SCREAMING_SNAKE_CASE ( snake_case): assert isinstance(lowerCamelCase_, lowerCamelCase_), f"The input value of [n={number}] is not an integer" if number == 1: return 2 elif number < 1: __snake_case = f"The input value of [n={numb...
564
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 lowerCamelCase__ ( lowerCamelCase__): '''simple docstring''' def __init__(self ...
647
0
import datasets from .nmt_bleu import compute_bleu # From: https://github.com/tensorflow/nmt/blob/master/nmt/scripts/bleu.py A_: List[Any] = '\\n@INPROCEEDINGS{Papineni02bleu:a,\n author = {Kishore Papineni and Salim Roukos and Todd Ward and Wei-jing Zhu},\n title = {BLEU: a Method for Automatic Eval...
398
import os import jsonlines import numpy as np from tqdm import tqdm __snake_case : List[str] =2_0_4_8 __snake_case : List[Any] =4_0_9_6 __snake_case : Tuple =4_2 __snake_case : List[Any] =os.environ.pop('PROCESS_TRAIN', 'false') __snake_case :...
647
0
from scipy.stats import spearmanr import datasets lowercase_: List[Any] = '\nThe Spearman rank-order correlation coefficient is a measure of the\nrelationship between two datasets. Like other correlation coefficients,\nthis one varies between -1 and +1 with 0 implying no correlation.\nPos...
648
import torch from diffusers import DiffusionPipeline class lowercase__ (__snake_case ): """simple docstring""" def __init__( self : List[Any] , __a : Optional[Any] , __a : List[str] ): super().__init__() self.register_modules(unet=__a ...
648
1
from typing import TYPE_CHECKING from ...utils import OptionalDependencyNotAvailable, _LazyModule, is_tokenizers_available, is_torch_available lowercase_: str = { 'configuration_bloom': ['BLOOM_PRETRAINED_CONFIG_ARCHIVE_MAP', 'BloomConfig', 'BloomOnnxConfig'], } try: if not is_to...
648
import warnings from ...utils import logging from .image_processing_poolformer import PoolFormerImageProcessor lowercase_: str = logging.get_logger(__name__) class lowercase__ (__snake_case ): """simple docstring""" def __init__( self : in...
648
1
from ...configuration_utils import PretrainedConfig from ...utils import logging lowercase_: int = logging.get_logger(__name__) lowercase_: str = { 'RWKV/rwkv-4-169m-pile': 'https://huggingface.co/RWKV/rwkv-4-169m-pile/resolve/main/config.json', 'RWKV/rwkv-4-430m...
648
import unittest from transformers import BertGenerationConfig, 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...
648
1
from pathlib import PurePosixPath from typing import Optional import fsspec from fsspec import AbstractFileSystem from huggingface_hub.hf_api import DatasetInfo from ..utils.file_utils import get_authentication_headers_for_url from ..utils.hub import hf_hub_url class lowercase__ (__s...
648
from __future__ import annotations import numpy as np from numpy import floataa from numpy.typing import NDArray def _lowercase ( UpperCAmelCase_ , UpperCAmelCase_ , UpperCAmelCase_ , UpperCAmelCase_ , ): """simple docstring""" snake_case__ , sna...
648
1
from collections import defaultdict from math import ceil, sqrt def _lowercase ( UpperCAmelCase_ = 1_000_000 , UpperCAmelCase_ = 10): """simple docstring""" snake_case__ : defaultdict = defaultdict(UpperCAmelCase_) for outer_width in range(3 , (t...
648
def _lowercase ( UpperCAmelCase_ = 10 , UpperCAmelCase_ = 1_000 , UpperCAmelCase_ = True): """simple docstring""" assert ( isinstance(UpperCAmelCase_ , UpperCAmelCase_) and isinstance(UpperCAmelCase_ , UpperCAmelCase_) and isinstance(UpperCA...
648
1
import numpy as np from cva import destroyAllWindows, imread, imshow, waitKey class lowercase__ : """simple docstring""" def __init__( self : Dict , __a : List[Any] , __a : int , __a : int ): if dst_width < 0 or dst_height < 0: raise ValueE...
648
from packaging import version from .import_utils import is_accelerate_available if is_accelerate_available(): import accelerate def _lowercase ( UpperCAmelCase_): """simple docstring""" if not is_accelerate_available(): return method snake_case__ : Union[str, An...
648
1
import warnings from ...utils import logging from .image_processing_glpn import GLPNImageProcessor lowercase_: Optional[Any] = logging.get_logger(__name__) class lowercase__ (__snake_case ): """simple docstring""" def __init__( self : Opti...
648
def _lowercase ( UpperCAmelCase_): """simple docstring""" snake_case__ : Any = int(UpperCAmelCase_) if decimal in (0, 1): # Exit cases for the recursion return str(UpperCAmelCase_) snake_case__ , snake_case__ : Optional[Any] = div...
648
1
from binascii import hexlify from hashlib import shaaaa from os import urandom # RFC 3526 - More Modular Exponential (MODP) Diffie-Hellman groups for # Internet Key Exchange (IKE) https://tools.ietf.org/html/rfc3526 lowercase_: int = { # 1536-bit 5: { 'prime': int( ...
648
import argparse import hashlib import os import urllib import warnings import torch from torch import nn from tqdm import tqdm from transformers import WhisperConfig, WhisperForConditionalGeneration lowercase_: Tuple = { 'tiny.en': 'https://openaipublic.azureedge.net/main/wh...
648
1
from typing import TYPE_CHECKING from ...utils import ( OptionalDependencyNotAvailable, _LazyModule, is_flax_available, is_tf_available, is_tokenizers_available, is_torch_available, ) lowercase_: Union[str, Any] = { 'configuration_distilbert': [ ...
648
from collections import namedtuple lowercase_: Optional[int] = namedtuple('from_to', 'from_ to') lowercase_: str = { 'cubicmeter': from_to(1, 1), 'litre': from_to(0.0_0_1, 10_00), 'kilolitre': from_to(1, 1), 'gallon': from_to(0.0_0_4_5_4, 2_6_4.1_7_2), ...
648
1
from pathlib import Path from typing import List from transformers import is_torch_available, is_vision_available from transformers.testing_utils import get_tests_dir, is_tool_test from transformers.tools.agent_types import AGENT_TYPE_MAPPING, AgentAudio, AgentImage, AgentText if is_torch_available()...
648
def _lowercase ( UpperCAmelCase_=28_123): """simple docstring""" snake_case__ : Dict = [1] * (limit + 1) for i in range(2 , int(limit**0.5) + 1): sum_divs[i * i] += i for k in range(i + 1 , limit // i + 1): sum_divs[k * i] += k + i sn...
648
1
import unittest import torch from diffusers import DDIMScheduler, DDPMScheduler, UNetaDModel from diffusers.training_utils import set_seed from diffusers.utils.testing_utils import slow lowercase_: Union[str, Any] = False class lowercase__ (unittest.TestCase ):...
648
from collections import OrderedDict from typing import TYPE_CHECKING, Any, List, Mapping, Optional from packaging import version if TYPE_CHECKING: from ... import PreTrainedTokenizer, TensorType from ...configuration_utils import PretrainedConfig from ...onnx import OnnxConfigWithPast, PatchingSp...
648
1
import warnings warnings.warn( 'memory_utils has been reorganized to utils.memory. Import `find_executable_batchsize` from the main `__init__`: ' '`from accelerate import find_executable_batch_size` to avoid this warning.', FutureWarning, )
648
from typing import TYPE_CHECKING from ...utils import ( OptionalDependencyNotAvailable, _LazyModule, is_tf_available, is_tokenizers_available, is_torch_available, ) lowercase_: int = { 'configuration_lxmert': ['LXMERT_PRETRAINED_CONFIG_ARCHIVE_MAP', 'LxmertC...
648
1
from typing import List, Optional, Tuple from ...tokenization_utils_fast import PreTrainedTokenizerFast from ...utils import logging from .tokenization_herbert import HerbertTokenizer lowercase_: Optional[Any] = logging.get_logger(__name__) lowercase_: Dict = {'vocab_f...
648
import unittest from transformers import DebertaVaConfig, 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 ModelTesterMixin, ids...
648
1
import argparse import os import re import numpy as np import PIL import torch from timm import create_model from torch.optim.lr_scheduler import OneCycleLR from torch.utils.data import DataLoader, Dataset from torchvision.transforms import Compose, RandomResizedCrop, Resize, ToTensor from acceler...
648
from __future__ import annotations import math def _lowercase ( UpperCAmelCase_): """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 ...
648
1
import time from contextlib import contextmanager from pathlib import Path import pytest import requests from huggingface_hub.hf_api import HfApi, HfFolder lowercase_: str = '__DUMMY_TRANSFORMERS_USER__' lowercase_: Optional[Any] = 'Dummy User' lowercase_: List[Any] ...
648
from typing import TYPE_CHECKING from ...utils import OptionalDependencyNotAvailable, _LazyModule, is_tokenizers_available, is_torch_available lowercase_: Optional[Any] = { 'configuration_canine': ['CANINE_PRETRAINED_CONFIG_ARCHIVE_MAP', 'CanineConfig'], 'tokenization_canine': [...
648
1
from __future__ import annotations def _lowercase ( UpperCAmelCase_ , UpperCAmelCase_): """simple docstring""" if nth_term == "": return [""] snake_case__ : Any = int(UpperCAmelCase_) snake_case__ : Union[str, Any] = int(UpperCAme...
648
from __future__ import annotations from math import pi def _lowercase ( UpperCAmelCase_ , UpperCAmelCase_ , UpperCAmelCase_): """simple docstring""" if (inductance, frequency, reactance).count(0) != 1: raise ValueError("""One and only one argument must be 0""") if...
648
1
import os from tempfile import TemporaryDirectory from unittest import TestCase import pytest from absl.testing import parameterized from datasets import config from datasets.arrow_reader import HF_GCP_BASE_URL from datasets.builder import DatasetBuilder from datasets.dataset_dict import IterableDat...
648
from .glue import glue_convert_examples_to_features, glue_output_modes, glue_processors, glue_tasks_num_labels from .squad import SquadExample, SquadFeatures, SquadVaProcessor, SquadVaProcessor, squad_convert_examples_to_features from .utils import DataProcessor, InputExample, InputFeatures, SingleSentenceCla...
648
1
from typing import List, Optional, Tuple, Union import torch from ...models import UNetaDModel from ...schedulers import KarrasVeScheduler from ...utils import randn_tensor from ..pipeline_utils import DiffusionPipeline, ImagePipelineOutput class lowercase__ (__snake_case ): ...
648
import torch from diffusers import CMStochasticIterativeScheduler from .test_schedulers import SchedulerCommonTest class lowercase__ (__snake_case ): """simple docstring""" __UpperCamelCase : Any = (CMStochasticIterativeScheduler,) __UpperCa...
648
1
import flax.linen as nn import jax import jax.numpy as jnp class lowercase__ (nn.Module ): """simple docstring""" __UpperCamelCase : int __UpperCamelCase : jnp.dtype = jnp.floataa def lowercase ( self : Union[str, Any] ): ...
648
import unittest from pathlib import Path from shutil import copyfile from transformers import SPIECE_UNDERLINE, is_sentencepiece_available from transformers.models.speech_to_text import SpeechaTextTokenizer from transformers.models.speech_to_text.tokenization_speech_to_text import VOCAB_FILES_NAMES, save...
648
1
from __future__ import annotations import math def _lowercase ( UpperCAmelCase_): """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 ...
648
# 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 requi...
648
1
import string def _lowercase ( UpperCAmelCase_): """simple docstring""" snake_case__ : List[Any] = """""" for i in sequence: snake_case__ : List[Any] = ord(UpperCAmelCase_) if 65 <= extract <= 90: output += chr(155 - extract) eli...
648
import unittest from accelerate import debug_launcher from accelerate.test_utils import require_cpu, test_ops, test_script @require_cpu class lowercase__ (unittest.TestCase ): """simple docstring""" def lowercase ( self : List[str] ): debug_launch...
648
1
import unittest from accelerate import debug_launcher from accelerate.test_utils import require_cpu, test_ops, test_script @require_cpu class lowercase__ (unittest.TestCase ): """simple docstring""" def lowercase ( self : List[str] ): debug_launch...
648
import math from datetime import datetime, timedelta def _lowercase ( UpperCAmelCase_): """simple docstring""" snake_case__ : Union[str, Any] = year % 19 snake_case__ : Tuple = year % 4 snake_case__ : Any = year % 7 ...
648
1
from __future__ import annotations from math import pi def _lowercase ( UpperCAmelCase_ , UpperCAmelCase_ , UpperCAmelCase_): """simple docstring""" if (inductance, frequency, reactance).count(0) != 1: raise ValueError("""One and only one argument must be 0""") if...
648
import torch from diffusers import DiffusionPipeline class lowercase__ (__snake_case ): """simple docstring""" def __init__( self : List[Any] , __a : Optional[Any] , __a : List[str] ): super().__init__() self.register_modules(unet=__a ...
648
1
import unittest import numpy as np import torch from transformers import CLIPTextConfig, CLIPTextModel, CLIPTokenizer from diffusers import ( AutoencoderKL, DDIMScheduler, DPMSolverMultistepScheduler, TextToVideoSDPipeline, UNetaDConditionModel, ) from diffusers.utils import i...
648
import warnings from ...utils import logging from .image_processing_poolformer import PoolFormerImageProcessor lowercase_: str = logging.get_logger(__name__) class lowercase__ (__snake_case ): """simple docstring""" def __init__( self : in...
648
1
def _lowercase ( ): """simple docstring""" snake_case__ : str = 0 for i in range(1 , 1_001): total += i**i return str(UpperCAmelCase_)[-10:] if __name__ == "__main__": print(solution())
648
import unittest from transformers import BertGenerationConfig, 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...
648
1
import os import unicodedata 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 SPIECE_UNDERLINE, logging lowercase_: Dict = logging.get_l...
648
from __future__ import annotations import numpy as np from numpy import floataa from numpy.typing import NDArray def _lowercase ( UpperCAmelCase_ , UpperCAmelCase_ , UpperCAmelCase_ , UpperCAmelCase_ , ): """simple docstring""" snake_case__ , sna...
648
1
# Logistic Regression from scratch # In[62]: # In[63]: # importing all the required libraries import numpy as np from matplotlib import pyplot as plt from sklearn import datasets def _lowercase ( UpperCAmelCase_): """simple docstring""" return 1 / (1 + np.exp(-z)) def _...
648
def _lowercase ( UpperCAmelCase_ = 10 , UpperCAmelCase_ = 1_000 , UpperCAmelCase_ = True): """simple docstring""" assert ( isinstance(UpperCAmelCase_ , UpperCAmelCase_) and isinstance(UpperCAmelCase_ , UpperCAmelCase_) and isinstance(UpperCA...
648
1
from ...processing_utils import ProcessorMixin class lowercase__ (__snake_case ): """simple docstring""" __UpperCamelCase : List[Any] = ['image_processor', 'feature_extractor'] __UpperCamelCase : Tuple = 'TvltImageProcessor' __Uppe...
648
from packaging import version from .import_utils import is_accelerate_available if is_accelerate_available(): import accelerate def _lowercase ( UpperCAmelCase_): """simple docstring""" if not is_accelerate_available(): return method snake_case__ : Union[str, An...
648
1
import argparse from pathlib import Path import requests import torch from PIL import Image from transformers import ( RobertaTokenizer, TrOCRConfig, TrOCRForCausalLM, TrOCRProcessor, VisionEncoderDecoderModel, ViTConfig, ViTImageProcessor, ViTModel, ) from tra...
648
def _lowercase ( UpperCAmelCase_): """simple docstring""" snake_case__ : Any = int(UpperCAmelCase_) if decimal in (0, 1): # Exit cases for the recursion return str(UpperCAmelCase_) snake_case__ , snake_case__ : Optional[Any] = div...
648
1
import argparse import gc import json import os import re import torch from huggingface_hub import hf_hub_download from transformers import AutoModelForCausalLM, AutoTokenizer, PreTrainedTokenizerFast, RwkvConfig from transformers.modeling_utils import WEIGHTS_INDEX_NAME, shard_checkpoint lower...
648
import argparse import hashlib import os import urllib import warnings import torch from torch import nn from tqdm import tqdm from transformers import WhisperConfig, WhisperForConditionalGeneration lowercase_: Tuple = { 'tiny.en': 'https://openaipublic.azureedge.net/main/wh...
648
1
from abc import ABC, abstractmethod from typing import Optional, Union from .. import Dataset, DatasetDict, Features, IterableDataset, IterableDatasetDict, NamedSplit from ..utils.typing import NestedDataStructureLike, PathLike class lowercase__ (__snake_case ): """simple doc...
648
from collections import namedtuple lowercase_: Optional[int] = namedtuple('from_to', 'from_ to') lowercase_: str = { 'cubicmeter': from_to(1, 1), 'litre': from_to(0.0_0_1, 10_00), 'kilolitre': from_to(1, 1), 'gallon': from_to(0.0_0_4_5_4, 2_6_4.1_7_2), ...
648
1
import unittest from transformers import ( MODEL_FOR_SEQUENCE_CLASSIFICATION_MAPPING, TF_MODEL_FOR_SEQUENCE_CLASSIFICATION_MAPPING, Pipeline, ZeroShotClassificationPipeline, pipeline, ) from transformers.testing_utils import is_pipeline_test, nested_simplify, require_tf, require_to...
648
def _lowercase ( UpperCAmelCase_=28_123): """simple docstring""" snake_case__ : Dict = [1] * (limit + 1) for i in range(2 , int(limit**0.5) + 1): sum_divs[i * i] += i for k in range(i + 1 , limit // i + 1): sum_divs[k * i] += k + i sn...
648
1
from __future__ import annotations import requests lowercase_: List[str] = set( 'approved_at_utc approved_by author_flair_background_color\nauthor_flair_css_class author_flair_richtext author_flair_template_id author_fullname\nauthor_premium can_mod_post category clicked content_catego...
648
from collections import OrderedDict from typing import TYPE_CHECKING, Any, List, Mapping, Optional from packaging import version if TYPE_CHECKING: from ... import PreTrainedTokenizer, TensorType from ...configuration_utils import PretrainedConfig from ...onnx import OnnxConfigWithPast, PatchingSp...
648
1
import inspect import tempfile from collections import OrderedDict, UserDict from collections.abc import MutableMapping from contextlib import ExitStack, contextmanager from dataclasses import fields from enum import Enum from typing import Any, ContextManager, List, Tuple import numpy as np from ....
648
from typing import TYPE_CHECKING from ...utils import ( OptionalDependencyNotAvailable, _LazyModule, is_tf_available, is_tokenizers_available, is_torch_available, ) lowercase_: int = { 'configuration_lxmert': ['LXMERT_PRETRAINED_CONFIG_ARCHIVE_MAP', 'LxmertC...
648
1
import unittest from transformers import MODEL_FOR_ZERO_SHOT_OBJECT_DETECTION_MAPPING, is_vision_available, pipeline from transformers.testing_utils import ( is_pipeline_test, nested_simplify, require_tf, require_torch, require_vision, slow, ) from .test_pipelines_common im...
648
import unittest from transformers import DebertaVaConfig, 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 ModelTesterMixin, ids...
648
1
import unittest import numpy as np from transformers.file_utils import is_torch_available, is_vision_available from transformers.testing_utils import require_torch, require_vision from ...test_image_processing_common import ImageProcessingSavingTestMixin, prepare_image_inputs if is_torch_availabl...
648
from __future__ import annotations import math def _lowercase ( UpperCAmelCase_): """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 ...
648
1
import unittest from transformers.utils.backbone_utils import ( BackboneMixin, get_aligned_output_features_output_indices, verify_out_features_out_indices, ) class lowercase__ (unittest.TestCase ): """simple docstring""" def lowercase ( sel...
648
from typing import TYPE_CHECKING from ...utils import OptionalDependencyNotAvailable, _LazyModule, is_tokenizers_available, is_torch_available lowercase_: Optional[Any] = { 'configuration_canine': ['CANINE_PRETRAINED_CONFIG_ARCHIVE_MAP', 'CanineConfig'], 'tokenization_canine': [...
648
1
from .glue import glue_convert_examples_to_features, glue_output_modes, glue_processors, glue_tasks_num_labels from .squad import SquadExample, SquadFeatures, SquadVaProcessor, SquadVaProcessor, squad_convert_examples_to_features from .utils import DataProcessor, InputExample, InputFeatures, SingleSentenceCla...
648
from __future__ import annotations from math import pi def _lowercase ( UpperCAmelCase_ , UpperCAmelCase_ , UpperCAmelCase_): """simple docstring""" if (inductance, frequency, reactance).count(0) != 1: raise ValueError("""One and only one argument must be 0""") if...
648
1
from __future__ import annotations import collections import pprint from pathlib import Path def _lowercase ( UpperCAmelCase_): """simple docstring""" return "".join(sorted(UpperCAmelCase_)) def _lowercase ( UpperCAmelCase_): """simple docstring""" return...
648
from .glue import glue_convert_examples_to_features, glue_output_modes, glue_processors, glue_tasks_num_labels from .squad import SquadExample, SquadFeatures, SquadVaProcessor, SquadVaProcessor, squad_convert_examples_to_features from .utils import DataProcessor, InputExample, InputFeatures, SingleSentenceCla...
648
1
import random import sys import numpy as np from matplotlib import pyplot as plt from matplotlib.colors import ListedColormap lowercase_: Any = 'Usage of script: script_name <size_of_canvas:int>' lowercase_: List[str] = [0] * 1_00 + [1] * 10 random.shuffle(choice) def...
648
import torch from diffusers import CMStochasticIterativeScheduler from .test_schedulers import SchedulerCommonTest class lowercase__ (__snake_case ): """simple docstring""" __UpperCamelCase : Any = (CMStochasticIterativeScheduler,) __UpperCa...
648
1
from typing import Any, Dict, List, Union from ..utils import add_end_docstrings, is_torch_available, is_vision_available, logging, requires_backends from .base import PIPELINE_INIT_ARGS, ChunkPipeline if is_vision_available(): from PIL import Image from ..image_utils import load_image if is_t...
648
import unittest from pathlib import Path from shutil import copyfile from transformers import SPIECE_UNDERLINE, is_sentencepiece_available from transformers.models.speech_to_text import SpeechaTextTokenizer from transformers.models.speech_to_text.tokenization_speech_to_text import VOCAB_FILES_NAMES, save...
648
1
from typing import TYPE_CHECKING from ...utils import ( OptionalDependencyNotAvailable, _LazyModule, is_tf_available, is_tokenizers_available, is_torch_available, ) lowercase_: int = { 'configuration_lxmert': ['LXMERT_PRETRAINED_CONFIG_ARCHIVE_MAP', 'LxmertC...
648
# 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 requi...
648
1
from ...configuration_utils import PretrainedConfig from ...utils import logging lowercase_: str = logging.get_logger(__name__) lowercase_: Any = { 'google/vivit-b-16x2-kinetics400': ( 'https://huggingface.co/google/vivit-b-16x2-kinetics400/resolve/main/confi...
648
import unittest from accelerate import debug_launcher from accelerate.test_utils import require_cpu, test_ops, test_script @require_cpu class lowercase__ (unittest.TestCase ): """simple docstring""" def lowercase ( self : List[str] ): debug_launch...
648
1
from __future__ import annotations from math import gcd def _lowercase ( UpperCAmelCase_ , UpperCAmelCase_ = 2 , UpperCAmelCase_ = 1 , UpperCAmelCase_ = 3 , ): """simple docstring""" if num < 2: raise ValueError("""The input value cannot be less than 2...
648
import math from datetime import datetime, timedelta def _lowercase ( UpperCAmelCase_): """simple docstring""" snake_case__ : Union[str, Any] = year % 19 snake_case__ : Tuple = year % 4 snake_case__ : Any = year % 7 ...
648
1
import collections import os import re from pathlib import Path lowercase_: Union[str, Any] = 'src/transformers' # Matches is_xxx_available() lowercase_: int = re.compile(r'is\_([a-z_]*)_available()') # Catches a one-line _import_struct = {xxx} lowercase_: Dict ...
648
import torch from diffusers import DiffusionPipeline class lowercase__ (__snake_case ): """simple docstring""" def __init__( self : List[Any] , __a : Optional[Any] , __a : List[str] ): super().__init__() self.register_modules(unet=__a ...
648
1
from __future__ import annotations def _lowercase ( UpperCAmelCase_): """simple docstring""" if len(UpperCAmelCase_) == 0: return [] snake_case__ , snake_case__ : List[str] = min(UpperCAmelCase_), max(UpperCAmelCase_) snake_case__ : List[str]...
648
import warnings from ...utils import logging from .image_processing_poolformer import PoolFormerImageProcessor lowercase_: str = logging.get_logger(__name__) class lowercase__ (__snake_case ): """simple docstring""" def __init__( self : in...
648
1
import unittest from transformers import DebertaVaTokenizer, DebertaVaTokenizerFast from transformers.testing_utils import get_tests_dir, require_sentencepiece, require_tokenizers, slow from ...test_tokenization_common import TokenizerTesterMixin lowercase_: Optional[Any] = get_tests_...
648
import unittest from transformers import BertGenerationConfig, 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...
648
1
def _lowercase ( UpperCAmelCase_): """simple docstring""" snake_case__ : Any = int(UpperCAmelCase_) if decimal in (0, 1): # Exit cases for the recursion return str(UpperCAmelCase_) snake_case__ , snake_case__ : Optional[Any] = div...
648
from __future__ import annotations import numpy as np from numpy import floataa from numpy.typing import NDArray def _lowercase ( UpperCAmelCase_ , UpperCAmelCase_ , UpperCAmelCase_ , UpperCAmelCase_ , ): """simple docstring""" snake_case__ , sna...
648
1
def _lowercase ( UpperCAmelCase_): """simple docstring""" return " ".join(input_str.split()[::-1]) if __name__ == "__main__": import doctest doctest.testmod()
648
def _lowercase ( UpperCAmelCase_ = 10 , UpperCAmelCase_ = 1_000 , UpperCAmelCase_ = True): """simple docstring""" assert ( isinstance(UpperCAmelCase_ , UpperCAmelCase_) and isinstance(UpperCAmelCase_ , UpperCAmelCase_) and isinstance(UpperCA...
648
1
def _lowercase ( UpperCAmelCase_ = 1_000_000): """simple docstring""" snake_case__ : List[str] = [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_):...
648
from packaging import version from .import_utils import is_accelerate_available if is_accelerate_available(): import accelerate def _lowercase ( UpperCAmelCase_): """simple docstring""" if not is_accelerate_available(): return method snake_case__ : Union[str, An...
648
1
from __future__ import annotations def _lowercase ( UpperCAmelCase_ , UpperCAmelCase_ = None): """simple docstring""" snake_case__ : Union[str, Any] = word_bank or [] # create a table snake_case__ : int = len(UpperCAmelCase_) + 1 ...
648
def _lowercase ( UpperCAmelCase_): """simple docstring""" snake_case__ : Any = int(UpperCAmelCase_) if decimal in (0, 1): # Exit cases for the recursion return str(UpperCAmelCase_) snake_case__ , snake_case__ : Optional[Any] = div...
648
1
import argparse import json from pathlib import Path import requests import torch from huggingface_hub import hf_hub_download from PIL import Image from transformers import ( MobileViTConfig, MobileViTForImageClassification, MobileViTForSemanticSegmentation, MobileViTImageProcesso...
648
import argparse import hashlib import os import urllib import warnings import torch from torch import nn from tqdm import tqdm from transformers import WhisperConfig, WhisperForConditionalGeneration lowercase_: Tuple = { 'tiny.en': 'https://openaipublic.azureedge.net/main/wh...
648
1
from collections import OrderedDict from typing import Mapping from ...configuration_utils import PretrainedConfig from ...onnx import OnnxConfig from ...utils import logging lowercase_: Dict = logging.get_logger(__name__) lowercase_: List[Any] = { 'bert-base-unc...
648
from collections import namedtuple lowercase_: Optional[int] = namedtuple('from_to', 'from_ to') lowercase_: str = { 'cubicmeter': from_to(1, 1), 'litre': from_to(0.0_0_1, 10_00), 'kilolitre': from_to(1, 1), 'gallon': from_to(0.0_0_4_5_4, 2_6_4.1_7_2), ...
648
1
import importlib import os import fsspec import pytest from fsspec import register_implementation from fsspec.registry import _registry as _fsspec_registry from datasets.filesystems import COMPRESSION_FILESYSTEMS, HfFileSystem, extract_path_from_uri, is_remote_filesystem from .utils import require_...
648
def _lowercase ( UpperCAmelCase_=28_123): """simple docstring""" snake_case__ : Dict = [1] * (limit + 1) for i in range(2 , int(limit**0.5) + 1): sum_divs[i * i] += i for k in range(i + 1 , limit // i + 1): sum_divs[k * i] += k + i sn...
648
1
import string def _lowercase ( UpperCAmelCase_): """simple docstring""" for key in range(len(string.ascii_uppercase)): snake_case__ : Tuple = """""" for symbol in message: if symbol in string.ascii_uppercase: snake_case__ : Dict ...
648
from collections import OrderedDict from typing import TYPE_CHECKING, Any, List, Mapping, Optional from packaging import version if TYPE_CHECKING: from ... import PreTrainedTokenizer, TensorType from ...configuration_utils import PretrainedConfig from ...onnx import OnnxConfigWithPast, PatchingSp...
648
1
import warnings from collections import OrderedDict from typing import Any, Mapping, Optional from ... import PreTrainedTokenizer from ...configuration_utils import PretrainedConfig from ...onnx import OnnxConfig, OnnxConfigWithPast, OnnxSeqaSeqConfigWithPast from ...onnx.utils import compute_effective_...
648
from typing import TYPE_CHECKING from ...utils import ( OptionalDependencyNotAvailable, _LazyModule, is_tf_available, is_tokenizers_available, is_torch_available, ) lowercase_: int = { 'configuration_lxmert': ['LXMERT_PRETRAINED_CONFIG_ARCHIVE_MAP', 'LxmertC...
648
1
from collections import OrderedDict from typing import Mapping from packaging import version from ...configuration_utils import PretrainedConfig from ...onnx import OnnxConfig from ...utils import logging lowercase_: Dict = logging.get_logger(__name__) lowercase_: List[Any] ...
648
import unittest from transformers import DebertaVaConfig, 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 ModelTesterMixin, ids...
648
1
import argparse import hashlib import os import urllib import warnings import torch from torch import nn from tqdm import tqdm from transformers import WhisperConfig, WhisperForConditionalGeneration lowercase_: Tuple = { 'tiny.en': 'https://openaipublic.azureedge.net/main/wh...
648
from __future__ import annotations import math def _lowercase ( UpperCAmelCase_): """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 ...
648
1
import math def _lowercase ( ): """simple docstring""" snake_case__ : List[Any] = input("""Enter message: """) snake_case__ : str = int(input(F'Enter key [2-{len(UpperCAmelCase_) - 1}]: ')) snake_case__ : Any = input(""...
648
from typing import TYPE_CHECKING from ...utils import OptionalDependencyNotAvailable, _LazyModule, is_tokenizers_available, is_torch_available lowercase_: Optional[Any] = { 'configuration_canine': ['CANINE_PRETRAINED_CONFIG_ARCHIVE_MAP', 'CanineConfig'], 'tokenization_canine': [...
648
1
from ...configuration_utils import PretrainedConfig from ...utils import logging lowercase_: Any = logging.get_logger(__name__) lowercase_: List[Any] = { 'google/realm-cc-news-pretrained-embedder': ( 'https://huggingface.co/google/realm-cc-news-pretrained-emb...
648
from __future__ import annotations from math import pi def _lowercase ( UpperCAmelCase_ , UpperCAmelCase_ , UpperCAmelCase_): """simple docstring""" if (inductance, frequency, reactance).count(0) != 1: raise ValueError("""One and only one argument must be 0""") if...
648
1
import json import logging import os import sys from pathlib import Path import finetune_rag from transformers.file_utils import is_apex_available from transformers.testing_utils import ( TestCasePlus, execute_subprocess_async, require_ray, require_torch_gpu, require_torch_mu...
648
from .glue import glue_convert_examples_to_features, glue_output_modes, glue_processors, glue_tasks_num_labels from .squad import SquadExample, SquadFeatures, SquadVaProcessor, SquadVaProcessor, squad_convert_examples_to_features from .utils import DataProcessor, InputExample, InputFeatures, SingleSentenceCla...
648
1
import inspect import os import unittest from pathlib import Path import torch import accelerate from accelerate.test_utils import execute_subprocess_async from accelerate.test_utils.testing import run_command class lowercase__ (unittest.TestCase ): """simple docstring"...
648
import torch from diffusers import CMStochasticIterativeScheduler from .test_schedulers import SchedulerCommonTest class lowercase__ (__snake_case ): """simple docstring""" __UpperCamelCase : Any = (CMStochasticIterativeScheduler,) __UpperCa...
648
1
lowercase_: int = [ (10_00, 'M'), (9_00, 'CM'), (5_00, 'D'), (4_00, 'CD'), (1_00, 'C'), (90, 'XC'), (50, 'L'), (40, 'XL'), (10, 'X'), (9, 'IX'), (5, 'V'), (4, 'IV'), (1, 'I'), ] def _lowercase ( UpperCAmelCase_): ""...
648
import unittest from pathlib import Path from shutil import copyfile from transformers import SPIECE_UNDERLINE, is_sentencepiece_available from transformers.models.speech_to_text import SpeechaTextTokenizer from transformers.models.speech_to_text.tokenization_speech_to_text import VOCAB_FILES_NAMES, save...
648
1
import sys from .dependency_versions_table import deps from .utils.versions import require_version, require_version_core # define which module versions we always want to check at run time # (usually the ones defined in `install_requires` in setup.py) # # order specific notes: # - tqdm must be check...
648
# 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 requi...
648
1
from collections import defaultdict from typing import Optional from ..image_utils import load_image from ..utils import ( add_end_docstrings, is_torch_available, logging, requires_backends, ) from .base import PIPELINE_INIT_ARGS, ChunkPipeline if is_torch_available(): import t...
648
import unittest from accelerate import debug_launcher from accelerate.test_utils import require_cpu, test_ops, test_script @require_cpu class lowercase__ (unittest.TestCase ): """simple docstring""" def lowercase ( self : List[str] ): debug_launch...
648
1
from ...configuration_utils import PretrainedConfig from ...utils import logging lowercase_: Dict = logging.get_logger(__name__) lowercase_: Optional[int] = { 'vinvino02/glpn-kitti': 'https://huggingface.co/vinvino02/glpn-kitti/resolve/main/config.json', # See al...
648
import math from datetime import datetime, timedelta def _lowercase ( UpperCAmelCase_): """simple docstring""" snake_case__ : Union[str, Any] = year % 19 snake_case__ : Tuple = year % 4 snake_case__ : Any = year % 7 ...
648
1
import inspect import unittest from transformers import BitConfig from transformers.testing_utils import require_torch, require_vision, slow, torch_device from transformers.utils import cached_property, is_torch_available, is_vision_available from ...test_backbone_common import BackboneTesterMixin fro...
648
import torch from diffusers import DiffusionPipeline class lowercase__ (__snake_case ): """simple docstring""" def __init__( self : List[Any] , __a : Optional[Any] , __a : List[str] ): super().__init__() self.register_modules(unet=__a ...
648
1
import logging import math import os from dataclasses import dataclass, field from glob import glob from typing import Optional from torch.utils.data import ConcatDataset import transformers from transformers import ( CONFIG_MAPPING, MODEL_WITH_LM_HEAD_MAPPING, AutoConfig, AutoMo...
648
import warnings from ...utils import logging from .image_processing_poolformer import PoolFormerImageProcessor lowercase_: str = logging.get_logger(__name__) class lowercase__ (__snake_case ): """simple docstring""" def __init__( self : in...
648
1
from math import factorial, radians def _lowercase ( UpperCAmelCase_ , UpperCAmelCase_ = 18 , UpperCAmelCase_ = 10): """simple docstring""" snake_case__ : List[str] = angle_in_degrees - ((angle_in_degrees // 360.0) * 360.0) # Converting from degre...
648
import unittest from transformers import BertGenerationConfig, 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...
648
1
import logging from transformers.configuration_utils import PretrainedConfig lowercase_: int = logging.getLogger(__name__) class lowercase__ (__snake_case ): """simple docstring""" __UpperCamelCase : int = 'masked_bert' ...
648
from __future__ import annotations import numpy as np from numpy import floataa from numpy.typing import NDArray def _lowercase ( UpperCAmelCase_ , UpperCAmelCase_ , UpperCAmelCase_ , UpperCAmelCase_ , ): """simple docstring""" snake_case__ , sna...
648
1
# NOTE: This file is deprecated and will be removed in a future version. # It only exists so that temporarely `from diffusers.pipelines import DiffusionPipeline` works from ...utils import deprecate from ..controlnet.multicontrolnet import MultiControlNetModel # noqa: F401 from ..controlnet.pipeline_contro...
648
def _lowercase ( UpperCAmelCase_ = 10 , UpperCAmelCase_ = 1_000 , UpperCAmelCase_ = True): """simple docstring""" assert ( isinstance(UpperCAmelCase_ , UpperCAmelCase_) and isinstance(UpperCAmelCase_ , UpperCAmelCase_) and isinstance(UpperCA...
648
1
import unittest from transformers import BarthezTokenizer, BarthezTokenizerFast, BatchEncoding from transformers.testing_utils import require_sentencepiece, require_tokenizers, require_torch, slow from ...test_tokenization_common import TokenizerTesterMixin @require_tokenizers @require_sentencepi...
648
from packaging import version from .import_utils import is_accelerate_available if is_accelerate_available(): import accelerate def _lowercase ( UpperCAmelCase_): """simple docstring""" if not is_accelerate_available(): return method snake_case__ : Union[str, An...
648
1
# Usage: # ./gen-card-allenai-wmt16.py import os from pathlib import Path def _lowercase ( UpperCAmelCase_ , UpperCAmelCase_ , UpperCAmelCase_ , UpperCAmelCase_): """simple docstring""" snake_case__ : Union[str, Any] = { """en""": ""...
648
def _lowercase ( UpperCAmelCase_): """simple docstring""" snake_case__ : Any = int(UpperCAmelCase_) if decimal in (0, 1): # Exit cases for the recursion return str(UpperCAmelCase_) snake_case__ , snake_case__ : Optional[Any] = div...
648
1
from typing import TYPE_CHECKING from ...utils import OptionalDependencyNotAvailable, _LazyModule, is_torch_available lowercase_: Union[str, Any] = { 'configuration_swinv2': ['SWINV2_PRETRAINED_CONFIG_ARCHIVE_MAP', 'Swinv2Config'], } try: if not is_torch_available(): raise...
648
import argparse import hashlib import os import urllib import warnings import torch from torch import nn from tqdm import tqdm from transformers import WhisperConfig, WhisperForConditionalGeneration lowercase_: Tuple = { 'tiny.en': 'https://openaipublic.azureedge.net/main/wh...
648
1
import cmath import math def _lowercase ( UpperCAmelCase_ , UpperCAmelCase_ , UpperCAmelCase_ , UpperCAmelCase_): """simple docstring""" snake_case__ : Any = math.radians(UpperCAmelCase_) snake_case__ : int = math.radian...
648
from collections import namedtuple lowercase_: Optional[int] = namedtuple('from_to', 'from_ to') lowercase_: str = { 'cubicmeter': from_to(1, 1), 'litre': from_to(0.0_0_1, 10_00), 'kilolitre': from_to(1, 1), 'gallon': from_to(0.0_0_4_5_4, 2_6_4.1_7_2), ...
648
1
import json import os from typing import Optional, Tuple from ...tokenization_utils import PreTrainedTokenizer from ...utils import logging lowercase_: List[Any] = logging.get_logger(__name__) lowercase_: int = {'vocab_file': 'vocab.json'} lowercase_: List[str] ...
648
def _lowercase ( UpperCAmelCase_=28_123): """simple docstring""" snake_case__ : Dict = [1] * (limit + 1) for i in range(2 , int(limit**0.5) + 1): sum_divs[i * i] += i for k in range(i + 1 , limit // i + 1): sum_divs[k * i] += k + i sn...
648
1
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__ (__snake_case , unittest.TestCase ): """simple docstring""...
648
from collections import OrderedDict from typing import TYPE_CHECKING, Any, List, Mapping, Optional from packaging import version if TYPE_CHECKING: from ... import PreTrainedTokenizer, TensorType from ...configuration_utils import PretrainedConfig from ...onnx import OnnxConfigWithPast, PatchingSp...
648
1
lowercase_: List[str] = [0, 2, 4, 6, 8] lowercase_: Optional[Any] = [1, 3, 5, 7, 9] def _lowercase ( UpperCAmelCase_ , UpperCAmelCase_ , UpperCAmelCase_ , UpperCAmelCase_): """simple docstring""" if remaining_length == 0: if digits...
648
from typing import TYPE_CHECKING from ...utils import ( OptionalDependencyNotAvailable, _LazyModule, is_tf_available, is_tokenizers_available, is_torch_available, ) lowercase_: int = { 'configuration_lxmert': ['LXMERT_PRETRAINED_CONFIG_ARCHIVE_MAP', 'LxmertC...
648
1
import math import os import unittest from transformers import MegatronBertConfig, is_torch_available from transformers.models.auto import get_values from transformers.testing_utils import require_sentencepiece, require_tokenizers, require_torch, slow, torch_device from ...test_configuration_common im...
648
import unittest from transformers import DebertaVaConfig, 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 ModelTesterMixin, ids...
648
1
# 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 ...
648
from __future__ import annotations import math def _lowercase ( UpperCAmelCase_): """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 ...
648
1