code
stringlengths
81
54k
code_codestyle
int64
0
721
style_context
stringlengths
91
41.9k
style_context_codestyle
int64
0
699
label
int64
0
1
import os import random import sys from . import cryptomath_module as cryptomath from . import rabin_miller lowerCamelCase_ : str = 3 def A__ ( lowerCamelCase ) -> int: print("""Generating primitive root of p""" ) while True: UpperCamelCase_: ...
716
import argparse from transformers import TaConfig, TaForConditionalGeneration, load_tf_weights_in_ta from transformers.utils import logging logging.set_verbosity_info() def A__ ( lowerCamelCase , lowerCamelCase , lowerCamelCase ) -> Union[str, Any]: # Initialise PyTorc...
670
0
import os from typing import Any, Callable, Dict, List, Optional, Tuple, Union import torch from torch import nn from ...models.controlnet import ControlNetModel, ControlNetOutput from ...models.modeling_utils import ModelMixin from ...utils import logging lowerCamelCase_ : str = logging.get_logger(_...
717
from typing import TYPE_CHECKING from ...utils import ( OptionalDependencyNotAvailable, _LazyModule, is_flax_available, is_tf_available, is_tokenizers_available, is_torch_available, ) lowerCamelCase_ : str = { """configuration_roformer""": ["""ROFORMER_PRETRAINED_CONFIG_ARC...
670
0
from typing import List, Optional from tokenizers import ByteLevelBPETokenizer from ...tokenization_utils_fast import PreTrainedTokenizerFast from ...utils import logging from .tokenization_blenderbot_small import BlenderbotSmallTokenizer lowerCamelCase_ : Union[str, Any] = logging.get_logger(__name_...
718
from sympy import diff, lambdify, symbols from sympy.functions import * # noqa: F403 def A__ ( lowerCamelCase , lowerCamelCase , lowerCamelCase = "x" , lowerCamelCase = 10**-10 , lowerCamelCase = 1 , ) -> complex: UpperCamelCase_: Optional[Any] = ...
670
0
import argparse import os import re lowerCamelCase_ : int = """src/transformers/models/auto""" # re pattern that matches mapping introductions: # SUPER_MODEL_MAPPING_NAMES = OrderedDict or SUPER_MODEL_MAPPING = OrderedDict lowerCamelCase_ : str = re.compile(r"""[A-Z_]+_MAPPING(\s+|_[...
719
from typing import TYPE_CHECKING from ...utils import ( OptionalDependencyNotAvailable, _LazyModule, is_flax_available, is_tf_available, is_tokenizers_available, is_torch_available, ) lowerCamelCase_ : Optional[Any] = { """configuration_distilbert""": [ """DISTILBER...
670
0
lowerCamelCase_ : Optional[Any] = """ # Transformers installation ! pip install transformers datasets # To install from source instead of the last release, comment the command above and uncomment the following one. # ! pip install git+https://github.com/huggingface/transformers.git """ lowerCamelCase_ ...
720
from manim import * class _UpperCamelCase ( _A ): '''simple docstring''' def lowerCAmelCase__ ( self : int ): UpperCamelCase_: Dict = Rectangle(height=0.5 , width=0.5 ) UpperCamelCase_: Dict = Rectangle(height=0.46 ,...
670
0
import json import os from pathlib import Path from shutil import copyfile from typing import Any, Dict, List, Optional, Tuple, Union import sentencepiece from ...tokenization_utils import BatchEncoding, PreTrainedTokenizer from ...utils import logging lowerCamelCase_ : Union[str, Any] = logging.get_...
721
import shutil import tempfile import unittest from transformers import ClapFeatureExtractor, ClapProcessor, RobertaTokenizer, RobertaTokenizerFast from transformers.testing_utils import require_sentencepiece, require_torchaudio from .test_feature_extraction_clap import floats_list @require_torchaudio @require_sente...
670
0
from __future__ import annotations def A__ ( lowerCamelCase , lowerCamelCase , lowerCamelCase ) -> dict[str, float]: if (voltage, current, resistance).count(0 ) != 1: raise ValueError("""One and only one argument must be 0""" ) if resistance < 0: ...
700
import warnings from ..trainer import Trainer from ..utils import logging lowerCamelCase_ : Dict = logging.get_logger(__name__) class _UpperCamelCase ( _A ): '''simple docstring''' def __init__( self : List[str] , snake_case_ : Tuple=None , **sn...
670
0
from typing import TYPE_CHECKING from ...utils import OptionalDependencyNotAvailable, _LazyModule, is_torch_available lowerCamelCase_ : str = { """configuration_swinv2""": ["""SWINV2_PRETRAINED_CONFIG_ARCHIVE_MAP""", """Swinv2Config"""], } try: if not is_torch_available(): r...
701
import argparse import numpy as np import torch from transformers import SpeechTaHifiGan, SpeechTaHifiGanConfig, logging logging.set_verbosity_info() lowerCamelCase_ : Optional[int] = logging.get_logger("""transformers.models.speecht5""") def A__ ( lowerCamelCase , lower...
670
0
def A__ ( lowerCamelCase , lowerCamelCase , lowerCamelCase , lowerCamelCase , lowerCamelCase ) -> int: if index == number_of_items: return 0 UpperCamelCase_: Union[str, Any] = 0 UpperCamelCase_: Optional[int] = 0 UpperCamel...
702
lowerCamelCase_ : Optional[Any] = """ # Transformers installation ! pip install transformers datasets # To install from source instead of the last release, comment the command above and uncomment the following one. # ! pip install git+https://github.com/huggingface/transformers.git """ lowerCamelCase_ ...
670
0
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_sentencepiece @slow # see ht...
703
import cva import numpy as np class _UpperCamelCase : '''simple docstring''' def __init__( self : Dict , snake_case_ : float , snake_case_ : int ): if k in (0.04, 0.06): UpperCamelCase_: Union[str, Any] = k UpperCam...
670
0
import json import os import shutil import tempfile import unittest import numpy as np import pytest from transformers import MgpstrTokenizer from transformers.models.mgp_str.tokenization_mgp_str import VOCAB_FILES_NAMES from transformers.testing_utils import require_torch, require_vision from transformers.utils imp...
704
import random def A__ ( lowerCamelCase , lowerCamelCase , lowerCamelCase = False ) -> dict: UpperCamelCase_: dict = {i: [] for i in range(lowerCamelCase )} # if probability is greater or equal than 1, then generate a complete graph if probability ...
670
0
# 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_controlnet i...
705
import os import unittest from huggingface_hub.utils import are_progress_bars_disabled import transformers.models.bart.tokenization_bart from transformers import logging from transformers.testing_utils import CaptureLogger, mockenv, mockenv_context from transformers.utils.logging import disable_progress_bar, enable_...
670
0
import math from enum import Enum from typing import Optional, Union from torch.optim import Optimizer from torch.optim.lr_scheduler import LambdaLR from .utils import logging snake_case : Tuple = logging.get_logger(__name__) class _UpperCamelCase ( _A ): '''simple docstring'...
706
import os from huggingface_hub.constants import HUGGINGFACE_HUB_CACHE, hf_cache_home lowerCamelCase_ : Optional[int] = HUGGINGFACE_HUB_CACHE lowerCamelCase_ : List[str] = """config.json""" lowerCamelCase_ : Any = """diffusion_pytorch_model.bin""" lowerCamelCase_ : Un...
670
0
import math import unittest def A__ ( lowerCamelCase ) -> bool: assert isinstance(lowerCamelCase , lowerCamelCase ) and ( number >= 0 ), "'number' must been an int and positive" if 1 < number < 4: # 2 and 3 are primes return True e...
707
import inspect import os import sys import unittest import accelerate from accelerate.test_utils import execute_subprocess_async, require_tpu class _UpperCamelCase ( unittest.TestCase ): '''simple docstring''' def lowerCAmelCase__ ( self : Optional[int] ): Up...
670
0
import requests def A__ ( lowerCamelCase , lowerCamelCase ) -> None: UpperCamelCase_: Union[str, Any] = {"""Content-Type""": """application/json"""} UpperCamelCase_: List[Any] = requests.post(lowerCamelCase , json={"""text""": message_body} ,...
708
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_sentencepiece @slow # see ht...
670
0
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 _UpperCamelCase ( _A ): '''simp...
709
def A__ ( lowerCamelCase , lowerCamelCase ) -> int: while second != 0: UpperCamelCase_: Optional[Any] = first & second first ^= second UpperCamelCase_: Any = c << 1 return first if __name__ == "__main__": import doctest ...
670
0
def A__ ( lowerCamelCase ) -> int: if not grid or not grid[0]: raise TypeError("""The grid does not contain the appropriate information""" ) for cell_n in range(1 , len(grid[0] ) ): grid[0][cell_n] += grid[0][cell_n - 1] UpperCamelCase_: O...
710
import logging import os import sys from dataclasses import dataclass, field from itertools import chain from typing import Optional, Union import datasets import numpy as np import torch from datasets import load_dataset import transformers from transformers import ( AutoConfig, AutoModelForMultipleChoice, ...
670
0
import unittest import numpy as np import torch from transformers import CLIPTextConfig, CLIPTextModel from diffusers import DDIMScheduler, LDMPipeline, UNetaDModel, VQModel from diffusers.utils.testing_utils import enable_full_determinism, require_torch, slow, torch_device enable_full_determinism() class ...
711
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_multi_gpu, ) logging....
670
0
import tempfile import unittest import numpy as np from huggingface_hub import HfFolder, delete_repo from requests.exceptions import HTTPError from transformers import BertConfig, is_flax_available from transformers.testing_utils import TOKEN, USER, is_staging_test, require_flax if is_flax_available(): impo...
712
class _UpperCamelCase : '''simple docstring''' def __init__( self : List[str] , snake_case_ : int , snake_case_ : Optional[Any]=None , snake_case_ : List[str]=None ): UpperCamelCase_: List[Any] = data UpperCamelCase_: ...
670
0
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_score from t...
713
# 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 required by applicab...
670
0
import argparse import math import os from copy import deepcopy import torch from audio_diffusion.models import DiffusionAttnUnetaD from diffusion import sampling from torch import nn from diffusers import DanceDiffusionPipeline, IPNDMScheduler, UNetaDModel lowerCamelCase_ : List[str] = { """gwf-...
714
import unittest import numpy as np import torch from transformers import CLIPTextConfig, CLIPTextModel from diffusers import DDIMScheduler, LDMPipeline, UNetaDModel, VQModel from diffusers.utils.testing_utils import enable_full_determinism, require_torch, slow, torch_device enable_full_determinism() class ...
670
0
from typing import TYPE_CHECKING # rely on isort to merge the imports from ...utils import OptionalDependencyNotAvailable, _LazyModule, is_torch_available lowerCamelCase_ : List[str] = {"""configuration_focalnet""": ["""FOCALNET_PRETRAINED_CONFIG_ARCHIVE_MAP""", """FocalNetConfig"""]} try:...
715
def A__ ( lowerCamelCase = 50 ) -> int: UpperCamelCase_: List[Any] = [[0] * 3 for _ in range(length + 1 )] for row_length in range(length + 1 ): for tile_length in range(2 , 5 ): for tile_start in range(row_length - tile_length + 1 ...
670
0
import math import torch from torch import nn from ..configuration_utils import ConfigMixin, register_to_config from .attention_processor import Attention from .embeddings import get_timestep_embedding from .modeling_utils import ModelMixin class _UpperCamelCase ( _A , _A ): '...
716
import argparse from transformers import TaConfig, TaForConditionalGeneration, load_tf_weights_in_ta from transformers.utils import logging logging.set_verbosity_info() def A__ ( lowerCamelCase , lowerCamelCase , lowerCamelCase ) -> Union[str, Any]: # Initialise PyTorc...
670
0
from collections import OrderedDict from typing import Mapping from packaging import version from ...configuration_utils import PretrainedConfig from ...onnx import OnnxConfig from ...utils import logging lowerCamelCase_ : str = logging.get_logger(__name__) lowerCamelCase_ : Optional[int] ...
717
from typing import TYPE_CHECKING from ...utils import ( OptionalDependencyNotAvailable, _LazyModule, is_flax_available, is_tf_available, is_tokenizers_available, is_torch_available, ) lowerCamelCase_ : str = { """configuration_roformer""": ["""ROFORMER_PRETRAINED_CONFIG_ARC...
670
0
from ...configuration_utils import PretrainedConfig from ...utils import logging lowerCamelCase_ : List[str] = logging.get_logger(__name__) lowerCamelCase_ : str = { """google/switch-base-8""": """https://huggingface.co/google/switch-base-8/blob/main/config.json""", } class _...
718
from sympy import diff, lambdify, symbols from sympy.functions import * # noqa: F403 def A__ ( lowerCamelCase , lowerCamelCase , lowerCamelCase = "x" , lowerCamelCase = 10**-10 , lowerCamelCase = 1 , ) -> complex: UpperCamelCase_: Optional[Any] = ...
670
0
import copy from ...configuration_utils import PretrainedConfig from ...utils import logging lowerCamelCase_ : Union[str, Any] = logging.get_logger(__name__) class _UpperCamelCase ( _A ): '''simple docstring''' __UpperCamelCase : List[Any] = """encoder-...
719
from typing import TYPE_CHECKING from ...utils import ( OptionalDependencyNotAvailable, _LazyModule, is_flax_available, is_tf_available, is_tokenizers_available, is_torch_available, ) lowerCamelCase_ : Optional[Any] = { """configuration_distilbert""": [ """DISTILBER...
670
0
# 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 required by applicab...
720
from manim import * class _UpperCamelCase ( _A ): '''simple docstring''' def lowerCAmelCase__ ( self : int ): UpperCamelCase_: Dict = Rectangle(height=0.5 , width=0.5 ) UpperCamelCase_: Dict = Rectangle(height=0.46 ,...
670
0
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 _UpperCamelCase ( _A ): '''simple docstring''' ...
721
import shutil import tempfile import unittest from transformers import ClapFeatureExtractor, ClapProcessor, RobertaTokenizer, RobertaTokenizerFast from transformers.testing_utils import require_sentencepiece, require_torchaudio from .test_feature_extraction_clap import floats_list @require_torchaudio @require_sente...
670
0
from math import ceil def a ( lowerCamelCase_ , lowerCamelCase_ ): '''simple docstring''' lowercase__ = list(range(0 , lowerCamelCase_ ) ) lowercase__ = [item for sublist in list(device_map.values() ) for item in sublist] ...
671
import json from typing import List, Optional, Tuple from tokenizers import normalizers from ...tokenization_utils_fast import PreTrainedTokenizerFast from ...utils import logging from .tokenization_bert import BertTokenizer A__ : Dict = logging.get_logger(__name__) A__ : Dict =...
671
1
import json import os import shutil import tempfile import unittest import numpy as np import pytest from transformers import BertTokenizer, BertTokenizerFast from transformers.models.bert.tokenization_bert import VOCAB_FILES_NAMES from transformers.testing_utils import require_vision from transformers.utils i...
671
from typing import TYPE_CHECKING from ...utils import ( OptionalDependencyNotAvailable, _LazyModule, is_flax_available, is_tf_available, is_torch_available, ) A__ : Any = {'configuration_unispeech': ['UNISPEECH_PRETRAINED_CONFIG_ARCHIVE_MAP', 'UniSpeechConfig']} try: ...
671
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 A__ : List[str] = logging.get_logger(__name__) A__ : Optional[Any] = { ...
671
import json import os import tempfile import transformers import datasets from utils import generate_example_dataset, get_duration A__ : Dict = 50_00_00 A__ , A__ : str = os.path.split(__file__) A__ : Optional[Any] = os.path.join(RESULTS_BASEPATH, 'res...
671
1
from __future__ import annotations from collections import deque from collections.abc import Sequence from dataclasses import dataclass from typing import Any @dataclass class _UpperCAmelCase : """simple docstring""" lowercase__ = 42 lowercase__ = None lowe...
671
class _UpperCAmelCase : """simple docstring""" def __init__( self : Optional[int], lowerCamelCase : str = "", lowerCamelCase : bool = False ): '''simple docstring''' # Mapping from the first character of the prefix of the node lowercase...
671
1
from typing import Callable, Optional, Union from ...configuration_utils import PretrainedConfig from ...utils import logging A__ : Dict = logging.get_logger(__name__) A__ : Tuple = { 'microsoft/xprophetnet-large-wiki100-cased': ( 'https://huggingface.co/microsoft/...
671
import json import os import shutil import tempfile import unittest import numpy as np import pytest from transformers import MgpstrTokenizer from transformers.models.mgp_str.tokenization_mgp_str import VOCAB_FILES_NAMES from transformers.testing_utils import require_torch, require_vision from transformers.uti...
671
1
from __future__ import annotations from math import pi from typing import Protocol import matplotlib.pyplot as plt import numpy as np class _UpperCAmelCase ( A__ ): """simple docstring""" def lowercase__ ( self : str, lowerCamelCase : float ): '''...
671
def a ( lowerCamelCase_ , lowerCamelCase_ , lowerCamelCase_ ): '''simple docstring''' if exponent == 1: return base if exponent % 2 == 0: lowercase__ = _modexpt(lowerCamelCase_ , exponent // 2 , lowerCamelCase_ ) % modulo_value ...
671
1
import argparse import datetime def a ( lowerCamelCase_ ): '''simple docstring''' lowercase__ = { '''0''': '''Sunday''', '''1''': '''Monday''', '''2''': '''Tuesday''', '''3''': '''Wednesday''', '''4''': '''Thursday''', ...
671
import inspect from typing import Callable, List, Optional, Union import torch from transformers import ( CLIPImageProcessor, CLIPTextModel, CLIPTokenizer, WhisperForConditionalGeneration, WhisperProcessor, ) from diffusers import ( AutoencoderKL, DDIMScheduler, DiffusionPipelin...
671
1
from math import sqrt def a ( lowerCamelCase_ = 100_0000 ): '''simple docstring''' lowercase__ = 0 lowercase__ = 0 lowercase__ = 42 while num_cuboids <= limit: max_cuboid_size += 1 for sum_shortest_sides in range(2 ...
671
from __future__ import annotations from collections import deque from collections.abc import Iterator from dataclasses import dataclass @dataclass class _UpperCAmelCase : """simple docstring""" lowercase__ = 42 lowercase__ = 42 class _UpperCAmelCase ...
671
1
import gc import random import unittest import numpy as np import torch from PIL import Image from transformers import CLIPTextConfig, CLIPTextModel, CLIPTokenizer from diffusers import ( AutoencoderKL, DDIMScheduler, EulerAncestralDiscreteScheduler, LMSDiscreteScheduler, PNDMScheduler, ...
671
class _UpperCAmelCase : """simple docstring""" def __init__( self : Optional[int], lowerCamelCase : Union[str, Any] ): '''simple docstring''' # we need a list not a string, so do something to change the type lowercase__ = arr.split('''...
671
1
import pickle import unittest import torch from accelerate import Accelerator from accelerate.state import AcceleratorState from accelerate.test_utils import require_cpu @require_cpu class _UpperCAmelCase ( unittest.TestCase ): """simple docstring""" def lowercase__ ( self :...
671
from itertools import count def a ( lowerCamelCase_ = 50 ): '''simple docstring''' lowercase__ = [1] * min_block_length for n in count(lowerCamelCase_ ): fill_count_functions.append(1 ) for block_length in range(lowerCamelCase_ , ...
671
1
# DISCLAIMER: This file is strongly influenced by https://github.com/yang-song/score_sde_pytorch import math from dataclasses import dataclass from typing import Optional, Tuple, Union import torch from ..configuration_utils import ConfigMixin, register_to_config from ..utils import BaseOutput, randn_tensor f...
671
import copy from typing import Any, Dict, List, Optional, Union import numpy as np import torch from ...audio_utils import mel_filter_bank, spectrogram, window_function from ...feature_extraction_sequence_utils import SequenceFeatureExtractor from ...feature_extraction_utils import BatchFeature from ...utils i...
671
1
import argparse import json import os from collections import OrderedDict import torch from transformers import LukeConfig, LukeForMaskedLM, MLukeTokenizer, XLMRobertaTokenizer from transformers.tokenization_utils_base import AddedToken @torch.no_grad() def a ( lowerCamelCase_ , lowerCamelC...
671
from __future__ import annotations from collections import deque from collections.abc import Sequence from dataclasses import dataclass from typing import Any @dataclass class _UpperCAmelCase : """simple docstring""" lowercase__ = 42 lowercase__ = None lowe...
671
1
import os def a ( ): '''simple docstring''' lowercase__ = os.path.dirname(os.path.realpath(lowerCamelCase_ ) ) lowercase__ = os.path.join(lowerCamelCase_ , '''triangle.txt''' ) with open(lowerCamelCase_ ) as f: lower...
671
from transformers import DistilBertTokenizer, DistilBertTokenizerFast from transformers.testing_utils import require_tokenizers, slow from ..bert.test_tokenization_bert import BertTokenizationTest @require_tokenizers class _UpperCAmelCase ( A__ ): """simple docstring""" lowercase__ ...
671
1
import argparse import re from typing import Dict import torch from datasets import Audio, Dataset, load_dataset, load_metric from transformers import AutoFeatureExtractor, pipeline def a ( lowerCamelCase_ , lowerCamelCase_ ): '''simple docstring''' lowercase__ =...
671
from __future__ import annotations def a ( lowerCamelCase_ ): '''simple docstring''' lowercase__ = 0.00 lowercase__ = 0 for resistor in resistors: if resistor <= 0: lowercase__ = F"""Resistor at index {index} has a n...
671
1
import os from shutil import copyfile from typing import List, Optional, Tuple from ...tokenization_utils import AddedToken from ...tokenization_utils_fast import PreTrainedTokenizerFast from ...utils import is_sentencepiece_available, logging if is_sentencepiece_available(): from .tokenization_camembe...
671
import argparse import re import requests import torch # git clone https://github.com/salesforce/BLIP.git from models.blip import blip_decoder from models.blip_itm import blip_itm from models.blip_vqa import blip_vqa from PIL import Image from torchvision import transforms from torchvision.transforms.functiona...
671
1
import inspect import unittest from transformers import DecisionTransformerConfig, 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_c...
671
import unittest import numpy as np from transformers.testing_utils import require_torch, require_vision from transformers.utils import is_torch_available, is_vision_available from ...test_image_processing_common import ImageProcessingSavingTestMixin, prepare_image_inputs if is_torch_available(): impo...
671
1
class _UpperCAmelCase : """simple docstring""" def __init__( self : Optional[int], lowerCamelCase : str = "", lowerCamelCase : bool = False ): '''simple docstring''' # Mapping from the first character of the prefix of the node lowercase...
671
import argparse import os import re A__ : Optional[int] = 'src/transformers' # Pattern that looks at the indentation in a line. A__ : Union[str, Any] = re.compile(r'^(\s*)\S') # Pattern that matches `"key":" and puts `key` in group 0. A__ : List[str] = re.compil...
671
1
def a ( lowerCamelCase_ ): '''simple docstring''' lowercase__ = set() # edges = list of graph's edges lowercase__ = get_edges(lowerCamelCase_ ) # While there are still elements in edges list, take an arbitrary edge # (from_node, to_node) ...
671
from math import sqrt def a ( lowerCamelCase_ ): '''simple docstring''' assert isinstance(lowerCamelCase_ , lowerCamelCase_ ) and ( number >= 0 ), "'number' must been an int and positive" lowercase__ = True # 0 and 1 are none primes. ...
671
1
from typing import List, Optional, Tuple, Union import PIL import torch from torchvision import transforms from diffusers.pipeline_utils import DiffusionPipeline, ImagePipelineOutput from diffusers.schedulers import DDIMScheduler from diffusers.utils import randn_tensor A__ : Optional[Any] = ...
671
import argparse import re from typing import Dict import torch from datasets import Audio, Dataset, load_dataset, load_metric from transformers import AutoFeatureExtractor, pipeline def a ( lowerCamelCase_ , lowerCamelCase_ ): '''simple docstring''' lowercase__ =...
671
1
import math def a ( lowerCamelCase_ ): '''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 ...
671
from functools import reduce A__ : Union[str, Any] = ( '73167176531330624919225119674426574742355349194934' '96983520312774506326239578318016984801869478851843' '85861560789112949495459501737958331952853208805511' '12540698747158523863050715693290963295227443043557' '66896648...
671
1
from typing import Optional, Tuple, Union import tensorflow as tf from ...activations_tf import ACTaFN from ...file_utils import add_code_sample_docstrings, add_start_docstrings, add_start_docstrings_to_model_forward from ...modeling_tf_outputs import ( TFBaseModelOutputWithNoAttention, TFBaseModelOutp...
671
# DISCLAIMER: This file is strongly influenced by https://github.com/yang-song/score_sde_pytorch import math from dataclasses import dataclass from typing import Optional, Tuple, Union import torch from ..configuration_utils import ConfigMixin, register_to_config from ..utils import BaseOutput, randn_tensor f...
671
1
import os import tempfile import unittest from transformers import FlaubertConfig, is_torch_available from transformers.testing_utils import require_torch, require_torch_gpu, slow, torch_device from ...test_configuration_common import ConfigTester from ...test_modeling_common import ModelTesterMixin, ids_tenso...
671
from collections import defaultdict from math import gcd def a ( lowerCamelCase_ = 150_0000 ): '''simple docstring''' lowercase__ = defaultdict(lowerCamelCase_ ) lowercase__ = 2 while 2 * euclid_m * (euclid_m + 1) <= limit: for eucli...
671
1
import functools def a ( lowerCamelCase_ , lowerCamelCase_ ): '''simple docstring''' lowercase__ = len(lowerCamelCase_ ) lowercase__ = len(lowerCamelCase_ ) @functools.cache def min_distance(lowerCamelCase_ , lowerCamelCas...
671
import json from typing import List, Optional, Tuple from tokenizers import normalizers from ...tokenization_utils_fast import PreTrainedTokenizerFast from ...utils import logging from .tokenization_bert import BertTokenizer A__ : Dict = logging.get_logger(__name__) A__ : Dict =...
671
1
from itertools import count def a ( lowerCamelCase_ = 50 ): '''simple docstring''' lowercase__ = [1] * min_block_length for n in count(lowerCamelCase_ ): fill_count_functions.append(1 ) for block_length in range(lowerCamelCase_ , ...
671
from typing import TYPE_CHECKING from ...utils import ( OptionalDependencyNotAvailable, _LazyModule, is_flax_available, is_tf_available, is_torch_available, ) A__ : Any = {'configuration_unispeech': ['UNISPEECH_PRETRAINED_CONFIG_ARCHIVE_MAP', 'UniSpeechConfig']} try: ...
671
1
import os from shutil import copyfile from typing import List, Optional, Tuple from ...tokenization_utils import AddedToken from ...tokenization_utils_fast import PreTrainedTokenizerFast from ...utils import is_sentencepiece_available, logging if is_sentencepiece_available(): from .tokenization_xlnet i...
671
import json import os import tempfile import transformers import datasets from utils import generate_example_dataset, get_duration A__ : Dict = 50_00_00 A__ , A__ : str = os.path.split(__file__) A__ : Optional[Any] = os.path.join(RESULTS_BASEPATH, 'res...
671
1
import os from shutil import copyfile from typing import Any, Dict, List, Optional, Tuple import sentencepiece as spm from ...tokenization_utils import AddedToken, BatchEncoding, PreTrainedTokenizer from ...utils import logging A__ : Union[str, Any] = logging.get_logger(__name__) A__ : ...
671
class _UpperCAmelCase : """simple docstring""" def __init__( self : Optional[int], lowerCamelCase : str = "", lowerCamelCase : bool = False ): '''simple docstring''' # Mapping from the first character of the prefix of the node lowercase...
671
1
import random def a ( lowerCamelCase_ , lowerCamelCase_ , lowerCamelCase_ ): '''simple docstring''' lowercase__ = a[left_index] lowercase__ = left_index + 1 for j in range(left_index + 1 , lowerCamelCase_ ): if a[j] < piv...
671
import json import os import shutil import tempfile import unittest import numpy as np import pytest from transformers import MgpstrTokenizer from transformers.models.mgp_str.tokenization_mgp_str import VOCAB_FILES_NAMES from transformers.testing_utils import require_torch, require_vision from transformers.uti...
671
1
A__ : Optional[int] = frozenset( [ 'prompt', 'height', 'width', 'guidance_scale', 'negative_prompt', 'prompt_embeds', 'negative_prompt_embeds', 'cross_attention_kwargs', ] ) A__ : str = frozenset(['prompt', '...
671
def a ( lowerCamelCase_ , lowerCamelCase_ , lowerCamelCase_ ): '''simple docstring''' if exponent == 1: return base if exponent % 2 == 0: lowercase__ = _modexpt(lowerCamelCase_ , exponent // 2 , lowerCamelCase_ ) % modulo_value ...
671
1
from collections import defaultdict from math import ceil, sqrt def a ( lowerCamelCase_ = 100_0000 , lowerCamelCase_ = 10 ): '''simple docstring''' lowercase__ = defaultdict(lowerCamelCase_ ) for outer_width in range(3 , (t_limit // 4) + 2 )...
671
import inspect from typing import Callable, List, Optional, Union import torch from transformers import ( CLIPImageProcessor, CLIPTextModel, CLIPTokenizer, WhisperForConditionalGeneration, WhisperProcessor, ) from diffusers import ( AutoencoderKL, DDIMScheduler, DiffusionPipelin...
671
1
from typing import TYPE_CHECKING from ...utils import OptionalDependencyNotAvailable, _LazyModule, is_sentencepiece_available A__ : Optional[int] = {} try: if not is_sentencepiece_available(): raise OptionalDependencyNotAvailable() except OptionalDependencyNotAvailable: ...
671
from __future__ import annotations from collections import deque from collections.abc import Iterator from dataclasses import dataclass @dataclass class _UpperCAmelCase : """simple docstring""" lowercase__ = 42 lowercase__ = 42 class _UpperCAmelCase ...
671
1
import argparse import torch from transformers import BertConfig, BertForPreTraining, load_tf_weights_in_bert from transformers.utils import logging logging.set_verbosity_info() def a ( lowerCamelCase_ , lowerCamelCase_ , lowerCamelCase_ ): '''simple docstring''' #...
671
class _UpperCAmelCase : """simple docstring""" def __init__( self : Optional[int], lowerCamelCase : Union[str, Any] ): '''simple docstring''' # we need a list not a string, so do something to change the type lowercase__ = arr.split('''...
671
1
class _UpperCAmelCase : """simple docstring""" def __init__( self : Union[str, Any], lowerCamelCase : Union[str, Any] ): '''simple docstring''' lowercase__ = val lowercase__ = None lowercase__ = None ...
671
from itertools import count def a ( lowerCamelCase_ = 50 ): '''simple docstring''' lowercase__ = [1] * min_block_length for n in count(lowerCamelCase_ ): fill_count_functions.append(1 ) for block_length in range(lowerCamelCase_ , ...
671
1
A__ : int = { 'A': ['B', 'C', 'E'], 'B': ['A', 'D', 'E'], 'C': ['A', 'F', 'G'], 'D': ['B'], 'E': ['A', 'B', 'D'], 'F': ['C'], 'G': ['C'], } def a ( lowerCamelCase_ , lowerCamelCase_ , lowerCamelCase_ ): '''simple docstring''' ...
671
import copy from typing import Any, Dict, List, Optional, Union import numpy as np import torch from ...audio_utils import mel_filter_bank, spectrogram, window_function from ...feature_extraction_sequence_utils import SequenceFeatureExtractor from ...feature_extraction_utils import BatchFeature from ...utils i...
671
1
import unittest import numpy as np from transformers.testing_utils import require_torch, require_vision from transformers.utils import is_torch_available, is_vision_available from ...test_image_processing_common import ImageProcessingSavingTestMixin, prepare_image_inputs if is_torch_available(): impo...
671
from __future__ import annotations from collections import deque from collections.abc import Sequence from dataclasses import dataclass from typing import Any @dataclass class _UpperCAmelCase : """simple docstring""" lowercase__ = 42 lowercase__ = None lowe...
671
1
from typing import TYPE_CHECKING from ...utils import ( OptionalDependencyNotAvailable, _LazyModule, is_flax_available, is_sentencepiece_available, is_tf_available, is_tokenizers_available, is_torch_available, ) A__ : Union[str, Any] = {'configuration_mbart': ['MBAR...
671
from transformers import DistilBertTokenizer, DistilBertTokenizerFast from transformers.testing_utils import require_tokenizers, slow from ..bert.test_tokenization_bert import BertTokenizationTest @require_tokenizers class _UpperCAmelCase ( A__ ): """simple docstring""" lowercase__ ...
671
1
import json import os from collections import Counter import torch import torchvision import torchvision.transforms as transforms from PIL import Image from torch import nn from torch.utils.data import Dataset A__ : Tuple = {1: (1, 1), 2: (2, 1), 3: (3, 1), 4: (2, 2), 5: (5, 1), 6: (3, 2), 7: ...
671
from __future__ import annotations def a ( lowerCamelCase_ ): '''simple docstring''' lowercase__ = 0.00 lowercase__ = 0 for resistor in resistors: if resistor <= 0: lowercase__ = F"""Resistor at index {index} has a n...
671
1
from ..utils import DummyObject, requires_backends class _UpperCAmelCase ( metaclass=A__ ): """simple docstring""" lowercase__ = ["""onnx"""] def __init__( self : Optional[Any], *lowerCamelCase : int, **lowerCamelCase : List[str] ): ...
671
import argparse import re import requests import torch # git clone https://github.com/salesforce/BLIP.git from models.blip import blip_decoder from models.blip_itm import blip_itm from models.blip_vqa import blip_vqa from PIL import Image from torchvision import transforms from torchvision.transforms.functiona...
671
1
from typing import TYPE_CHECKING from ...utils import ( OptionalDependencyNotAvailable, _LazyModule, is_tf_available, is_torch_available, is_vision_available, ) A__ : Tuple = { 'configuration_efficientformer': [ 'EFFICIENTFORMER_PRETRAINED_CONFIG_ARCHIVE_MAP', ...
671
import unittest import numpy as np from transformers.testing_utils import require_torch, require_vision from transformers.utils import is_torch_available, is_vision_available from ...test_image_processing_common import ImageProcessingSavingTestMixin, prepare_image_inputs if is_torch_available(): impo...
671
1
import os import re import shutil import sys import tempfile import unittest import black A__ : Tuple = os.path.abspath(os.path.dirname(os.path.dirname(os.path.dirname(__file__)))) sys.path.append(os.path.join(git_repo_path, 'utils')) import check_copies # noqa: E402 # This is the referenc...
671
import argparse import os import re A__ : Optional[int] = 'src/transformers' # Pattern that looks at the indentation in a line. A__ : Union[str, Any] = re.compile(r'^(\s*)\S') # Pattern that matches `"key":" and puts `key` in group 0. A__ : List[str] = re.compil...
671
1
# Copyright 2021 The HuggingFace Team. All rights reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by ap...
671
from math import sqrt def a ( lowerCamelCase_ ): '''simple docstring''' assert isinstance(lowerCamelCase_ , lowerCamelCase_ ) and ( number >= 0 ), "'number' must been an int and positive" lowercase__ = True # 0 and 1 are none primes. ...
671
1
import collections import os import re from pathlib import Path A__ : Optional[Any] = 'src/transformers' # Matches is_xxx_available() A__ : List[str] = re.compile(r'is\_([a-z_]*)_available()') # Catches a one-line _import_struct = {xxx} A__ : Any = re.compile(r...
671
import argparse import re from typing import Dict import torch from datasets import Audio, Dataset, load_dataset, load_metric from transformers import AutoFeatureExtractor, pipeline def a ( lowerCamelCase_ , lowerCamelCase_ ): '''simple docstring''' lowercase__ =...
671
1
import os import tempfile import unittest import numpy as np from diffusers.utils import is_flax_available from diffusers.utils.testing_utils import require_flax, slow if is_flax_available(): import jax import jax.numpy as jnp from flax.jax_utils import replicate from flax.trainin...
671
from functools import reduce A__ : Union[str, Any] = ( '73167176531330624919225119674426574742355349194934' '96983520312774506326239578318016984801869478851843' '85861560789112949495459501737958331952853208805511' '12540698747158523863050715693290963295227443043557' '66896648...
671
1
import argparse from tax import checkpoints from transformers import AutoConfig, FlaxAutoModelForSeqaSeqLM def a ( lowerCamelCase_ , lowerCamelCase_ , lowerCamelCase_ ): '''simple docstring''' lowercase__ = AutoConfig.from_pretrained(lowerCamelCase_ ...
671
# DISCLAIMER: This file is strongly influenced by https://github.com/yang-song/score_sde_pytorch import math from dataclasses import dataclass from typing import Optional, Tuple, Union import torch from ..configuration_utils import ConfigMixin, register_to_config from ..utils import BaseOutput, randn_tensor f...
671
1
from __future__ import annotations from math import ceil, floor, sqrt def a ( lowerCamelCase_ = 200_0000 ): '''simple docstring''' lowercase__ = [0] lowercase__ = 42 for idx in range(1 , ceil(sqrt(target * 2 ) * 1.1 ) ): ...
671
from collections import defaultdict from math import gcd def a ( lowerCamelCase_ = 150_0000 ): '''simple docstring''' lowercase__ = defaultdict(lowerCamelCase_ ) lowercase__ = 2 while 2 * euclid_m * (euclid_m + 1) <= limit: for eucli...
671
1
from __future__ import annotations A__ : Tuple = tuple[int, int, int] A__ : List[str] = tuple[str, str, str] # used alphabet -------------------------- # from string.ascii_uppercase A__ : Union[str, Any] = 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' # ------------------------...
671
import json from typing import List, Optional, Tuple from tokenizers import normalizers from ...tokenization_utils_fast import PreTrainedTokenizerFast from ...utils import logging from .tokenization_bert import BertTokenizer A__ : Dict = logging.get_logger(__name__) A__ : Dict =...
671
1
from typing import TYPE_CHECKING from ...utils import OptionalDependencyNotAvailable, _LazyModule, is_tokenizers_available, is_torch_available A__ : List[str] = { 'configuration_graphormer': ['GRAPHORMER_PRETRAINED_CONFIG_ARCHIVE_MAP', 'GraphormerConfig'], } try: if not is_torch_av...
671
from typing import TYPE_CHECKING from ...utils import ( OptionalDependencyNotAvailable, _LazyModule, is_flax_available, is_tf_available, is_torch_available, ) A__ : Any = {'configuration_unispeech': ['UNISPEECH_PRETRAINED_CONFIG_ARCHIVE_MAP', 'UniSpeechConfig']} try: ...
671
1
import logging import os import threading import time try: import warnings except ImportError: A__ : str = None try: import msvcrt except ImportError: A__ : Any = None try: import fcntl except ImportError: A__ : Dict = ...
671
import json import os import tempfile import transformers import datasets from utils import generate_example_dataset, get_duration A__ : Dict = 50_00_00 A__ , A__ : str = os.path.split(__file__) A__ : Optional[Any] = os.path.join(RESULTS_BASEPATH, 'res...
671
1
import doctest import logging import os import unittest from pathlib import Path from typing import List, Union import transformers from transformers.testing_utils import require_tf, require_torch, slow A__ : Optional[int] = logging.getLogger() @unittest.skip("""Temporarily disable the doc tes...
671
class _UpperCAmelCase : """simple docstring""" def __init__( self : Optional[int], lowerCamelCase : str = "", lowerCamelCase : bool = False ): '''simple docstring''' # Mapping from the first character of the prefix of the node lowercase...
671
1
from datetime import datetime as dt import os from github import Github A__ : Any = [ 'good first issue', 'good second issue', 'good difficult issue', 'feature request', 'new model', 'wip', ] def a ( ): '''simple docstring''' lowercase__ ...
671
import json import os import shutil import tempfile import unittest import numpy as np import pytest from transformers import MgpstrTokenizer from transformers.models.mgp_str.tokenization_mgp_str import VOCAB_FILES_NAMES from transformers.testing_utils import require_torch, require_vision from transformers.uti...
671
1
from collections.abc import Callable import numpy as np def a ( lowerCamelCase_ , lowerCamelCase_ , lowerCamelCase_ , lowerCamelCase_ , lowerCamelCase_ ): '''simple docstring''' lowercase__ = int(np.ceil((x_end - xa) / step_size ) ) ...
671
def a ( lowerCamelCase_ , lowerCamelCase_ , lowerCamelCase_ ): '''simple docstring''' if exponent == 1: return base if exponent % 2 == 0: lowercase__ = _modexpt(lowerCamelCase_ , exponent // 2 , lowerCamelCase_ ) % modulo_value ...
671
1
def a ( lowerCamelCase_ , lowerCamelCase_ ): '''simple docstring''' return [sentence[i : i + ngram_size] for i in range(len(lowerCamelCase_ ) - ngram_size + 1 )] if __name__ == "__main__": from doctest import testmod testmod()
671
import inspect from typing import Callable, List, Optional, Union import torch from transformers import ( CLIPImageProcessor, CLIPTextModel, CLIPTokenizer, WhisperForConditionalGeneration, WhisperProcessor, ) from diffusers import ( AutoencoderKL, DDIMScheduler, DiffusionPipelin...
671
1
from __future__ import annotations import inspect import unittest from math import floor import numpy as np from transformers import CvtConfig from transformers.testing_utils import require_tf, require_vision, slow from transformers.utils import cached_property, is_tf_available, is_vision_available from ...t...
671
from __future__ import annotations from collections import deque from collections.abc import Iterator from dataclasses import dataclass @dataclass class _UpperCAmelCase : """simple docstring""" lowercase__ = 42 lowercase__ = 42 class _UpperCAmelCase ...
671
1
import copy from dataclasses import dataclass from pathlib import Path from typing import Dict, Optional, Union @dataclass class _UpperCAmelCase : """simple docstring""" lowercase__ = None lowercase__ = False lowercase__ = False lowercase__ ...
671
class _UpperCAmelCase : """simple docstring""" def __init__( self : Optional[int], lowerCamelCase : Union[str, Any] ): '''simple docstring''' # we need a list not a string, so do something to change the type lowercase__ = arr.split('''...
671
1
def a ( lowerCamelCase_ ): '''simple docstring''' try: lowercase__ = float(lowerCamelCase_ ) except ValueError: raise ValueError('''Please enter a valid number''' ) lowercase__ = decimal - int(lowerCamelCase_ ) if f...
671
from itertools import count def a ( lowerCamelCase_ = 50 ): '''simple docstring''' lowercase__ = [1] * min_block_length for n in count(lowerCamelCase_ ): fill_count_functions.append(1 ) for block_length in range(lowerCamelCase_ , ...
671
1
from typing import TYPE_CHECKING from ...utils import ( OptionalDependencyNotAvailable, _LazyModule, is_flax_available, is_tf_available, is_torch_available, ) A__ : Any = {'configuration_unispeech': ['UNISPEECH_PRETRAINED_CONFIG_ARCHIVE_MAP', 'UniSpeechConfig']} try: ...
671
import copy from typing import Any, Dict, List, Optional, Union import numpy as np import torch from ...audio_utils import mel_filter_bank, spectrogram, window_function from ...feature_extraction_sequence_utils import SequenceFeatureExtractor from ...feature_extraction_utils import BatchFeature from ...utils i...
671
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 required ...
671
from __future__ import annotations from collections import deque from collections.abc import Sequence from dataclasses import dataclass from typing import Any @dataclass class _UpperCAmelCase : """simple docstring""" lowercase__ = 42 lowercase__ = None lowe...
671
1
import unittest from transformers import AutoTokenizer, NystromformerConfig, is_torch_available from transformers.testing_utils import require_torch, slow, torch_device from ...test_configuration_common import ConfigTester from ...test_modeling_common import ModelTesterMixin, ids_tensor, random_attention_mask ...
671
from transformers import DistilBertTokenizer, DistilBertTokenizerFast from transformers.testing_utils import require_tokenizers, slow from ..bert.test_tokenization_bert import BertTokenizationTest @require_tokenizers class _UpperCAmelCase ( A__ ): """simple docstring""" lowercase__ ...
671
1
import inspect from typing import Callable, List, Optional, Union import torch from transformers import ( CLIPImageProcessor, CLIPTextModel, CLIPTokenizer, WhisperForConditionalGeneration, WhisperProcessor, ) from diffusers import ( AutoencoderKL, DDIMScheduler, DiffusionPipelin...
671
from __future__ import annotations def a ( lowerCamelCase_ ): '''simple docstring''' lowercase__ = 0.00 lowercase__ = 0 for resistor in resistors: if resistor <= 0: lowercase__ = F"""Resistor at index {index} has a n...
671
1
def a ( ): '''simple docstring''' return 1 def a ( lowerCamelCase_ ): '''simple docstring''' return 0 if x < 0 else two_pence(x - 2 ) + one_pence() def a ( lowerCamelCase_ ): '''simple docstring''' return 0 if x...
671
import argparse import re import requests import torch # git clone https://github.com/salesforce/BLIP.git from models.blip import blip_decoder from models.blip_itm import blip_itm from models.blip_vqa import blip_vqa from PIL import Image from torchvision import transforms from torchvision.transforms.functiona...
671
1
def a ( lowerCamelCase_ ): '''simple docstring''' if isinstance(lowerCamelCase_ , lowerCamelCase_ ): raise TypeError('''\'float\' object cannot be interpreted as an integer''' ) if isinstance(lowerCamelCase_ , lowerCamelCase_ ): raise T...
671
import unittest import numpy as np from transformers.testing_utils import require_torch, require_vision from transformers.utils import is_torch_available, is_vision_available from ...test_image_processing_common import ImageProcessingSavingTestMixin, prepare_image_inputs if is_torch_available(): impo...
671
1
from argparse import ArgumentParser from datasets.commands.convert import ConvertCommand from datasets.commands.dummy_data import DummyDataCommand from datasets.commands.env import EnvironmentCommand from datasets.commands.run_beam import RunBeamCommand from datasets.commands.test import TestCommand from datase...
671
import argparse import os import re A__ : Optional[int] = 'src/transformers' # Pattern that looks at the indentation in a line. A__ : Union[str, Any] = re.compile(r'^(\s*)\S') # Pattern that matches `"key":" and puts `key` in group 0. A__ : List[str] = re.compil...
671
1
def a ( lowerCamelCase_ ): '''simple docstring''' if not isinstance(lowerCamelCase_ , lowerCamelCase_ ): raise TypeError('''only integers accepted as input''' ) else: lowercase__ = str(abs(lowerCamelCase_ ) ) lowerc...
671
from math import sqrt def a ( lowerCamelCase_ ): '''simple docstring''' assert isinstance(lowerCamelCase_ , lowerCamelCase_ ) and ( number >= 0 ), "'number' must been an int and positive" lowercase__ = True # 0 and 1 are none primes. ...
671
1
from __future__ import annotations def a ( lowerCamelCase_ , lowerCamelCase_ ): '''simple docstring''' if partitions <= 0: raise ValueError('''partitions must be a positive number!''' ) if partitions > number_of_bytes: raise ValueError('''partitio...
671
import argparse import re from typing import Dict import torch from datasets import Audio, Dataset, load_dataset, load_metric from transformers import AutoFeatureExtractor, pipeline def a ( lowerCamelCase_ , lowerCamelCase_ ): '''simple docstring''' lowercase__ =...
671
1
from typing import TYPE_CHECKING from ...utils import OptionalDependencyNotAvailable, _LazyModule, is_torch_available A__ : Any = { 'configuration_git': ['GIT_PRETRAINED_CONFIG_ARCHIVE_MAP', 'GitConfig', 'GitVisionConfig'], 'processing_git': ['GitProcessor'], } try: if not is_t...
671
from functools import reduce A__ : Union[str, Any] = ( '73167176531330624919225119674426574742355349194934' '96983520312774506326239578318016984801869478851843' '85861560789112949495459501737958331952853208805511' '12540698747158523863050715693290963295227443043557' '66896648...
671
1
import logging import os import sys from dataclasses import dataclass, field from typing import Optional import evaluate import numpy as np import torch from datasets import load_dataset from PIL import Image from torchvision.transforms import ( CenterCrop, Compose, Normalize, RandomHorizontalFl...
671
# DISCLAIMER: This file is strongly influenced by https://github.com/yang-song/score_sde_pytorch import math from dataclasses import dataclass from typing import Optional, Tuple, Union import torch from ..configuration_utils import ConfigMixin, register_to_config from ..utils import BaseOutput, randn_tensor f...
671
1
import tempfile import torch from diffusers import ( DEISMultistepScheduler, DPMSolverMultistepScheduler, DPMSolverSinglestepScheduler, UniPCMultistepScheduler, ) from .test_schedulers import SchedulerCommonTest class _UpperCAmelCase ( A__ ): """simple docstring""" lower...
671
from collections import defaultdict from math import gcd def a ( lowerCamelCase_ = 150_0000 ): '''simple docstring''' lowercase__ = defaultdict(lowerCamelCase_ ) lowercase__ = 2 while 2 * euclid_m * (euclid_m + 1) <= limit: for eucli...
671
1
from typing import TYPE_CHECKING from ...utils import ( OptionalDependencyNotAvailable, _LazyModule, is_tf_available, is_torch_available, is_vision_available, ) A__ : List[str] = {'configuration_deit': ['DEIT_PRETRAINED_CONFIG_ARCHIVE_MAP', 'DeiTConfig', 'DeiTOnnxConfig']} ...
671
import json from typing import List, Optional, Tuple from tokenizers import normalizers from ...tokenization_utils_fast import PreTrainedTokenizerFast from ...utils import logging from .tokenization_bert import BertTokenizer A__ : Dict = logging.get_logger(__name__) A__ : Dict =...
671
1
import math def a ( lowerCamelCase_ , lowerCamelCase_ = 0 , lowerCamelCase_ = 0 ): '''simple docstring''' lowercase__ = end or len(lowerCamelCase_ ) for i in range(lowerCamelCase_ , lowerCamelCase_ ): lowercase__ = i ...
671
from typing import TYPE_CHECKING from ...utils import ( OptionalDependencyNotAvailable, _LazyModule, is_flax_available, is_tf_available, is_torch_available, ) A__ : Any = {'configuration_unispeech': ['UNISPEECH_PRETRAINED_CONFIG_ARCHIVE_MAP', 'UniSpeechConfig']} try: ...
671
1
from jiwer import compute_measures import datasets A__ : Tuple = '\\n@inproceedings{inproceedings,\n author = {Morris, Andrew and Maier, Viktoria and Green, Phil},\n year = {2004},\n month = {01},\n pages = {},\n title = {From WER and RIL to MER and WIL: improved evaluation meas...
671
import json import os import tempfile import transformers import datasets from utils import generate_example_dataset, get_duration A__ : Dict = 50_00_00 A__ , A__ : str = os.path.split(__file__) A__ : Optional[Any] = os.path.join(RESULTS_BASEPATH, 'res...
671
1
from typing import TYPE_CHECKING from ...utils import OptionalDependencyNotAvailable, _LazyModule, is_tokenizers_available, is_torch_available A__ : Optional[Any] = { 'configuration_mvp': ['MVP_PRETRAINED_CONFIG_ARCHIVE_MAP', 'MvpConfig', 'MvpOnnxConfig'], 'tokenization_mvp': ['MvpToke...
671
class _UpperCAmelCase : """simple docstring""" def __init__( self : Optional[int], lowerCamelCase : str = "", lowerCamelCase : bool = False ): '''simple docstring''' # Mapping from the first character of the prefix of the node lowercase...
671
1
import json from typing import List, Optional, Tuple from tokenizers import normalizers from ...tokenization_utils_fast import PreTrainedTokenizerFast from .tokenization_lxmert import LxmertTokenizer A__ : List[str] = {'vocab_file': 'vocab.txt', 'tokenizer_file': 'tokenizer.json'} A__ : ...
671
import json import os import shutil import tempfile import unittest import numpy as np import pytest from transformers import MgpstrTokenizer from transformers.models.mgp_str.tokenization_mgp_str import VOCAB_FILES_NAMES from transformers.testing_utils import require_torch, require_vision from transformers.uti...
671
1
import argparse import gdown import numpy as np import torch from huggingface_hub import hf_hub_download from transformers import ( CLIPTokenizer, CLIPTokenizerFast, VideoMAEImageProcessor, XCLIPConfig, XCLIPModel, XCLIPProcessor, XCLIPTextConfig, XCLIPVisionConfig, ) def ...
671
def a ( lowerCamelCase_ , lowerCamelCase_ , lowerCamelCase_ ): '''simple docstring''' if exponent == 1: return base if exponent % 2 == 0: lowercase__ = _modexpt(lowerCamelCase_ , exponent // 2 , lowerCamelCase_ ) % modulo_value ...
671
1