code
stringlengths
82
53.2k
code_codestyle
int64
0
721
style_context
stringlengths
91
41.9k
style_context_codestyle
int64
0
699
label
int64
0
1
"""simple docstring""" from __future__ import annotations from collections import Counter from random import random class lowerCAmelCase : '''simple docstring''' def __init__( self :List[Any] ) -> Optional[int]: """simple docstrin...
516
"""simple docstring""" from typing import TYPE_CHECKING from ...utils import OptionalDependencyNotAvailable, _LazyModule, is_torch_available A : List[Any] = { 'configuration_lilt': ['LILT_PRETRAINED_CONFIG_ARCHIVE_MAP', 'LiltConfig'], } try: if not is_torch_available(): ...
516
1
"""simple docstring""" import warnings from typing import List, Optional, Union from ...image_utils import ImageInput from ...processing_utils import ProcessorMixin from ...tokenization_utils_base import BatchEncoding, PaddingStrategy, PreTokenizedInput, TextInput, TruncationStrategy from ...utils impor...
708
"""simple docstring""" import operator def _UpperCAmelCase ( __lowerCamelCase : list , __lowerCamelCase : bool = False , __lowerCamelCase : list | None = None ) -> list: _snake_case = operator.lt if reverse else operator.gt _snake_case = solutio...
430
0
"""simple docstring""" import re import string import numpy as np import datasets UpperCAmelCase__ = ''' Returns the rate at which the input predicted strings exactly match their references, ignoring any strings input as part of the regexes_to_ignore list. ''' UpperCAmelCase__ = ''' Args: predictio...
277
"""simple docstring""" import copy import inspect import unittest import numpy as np from huggingface_hub import hf_hub_download from transformers import TimesformerConfig from transformers.models.auto import get_values from transformers.testing_utils import require_torch, require_...
260
0
'''simple docstring''' from collections.abc import Generator def lowercase ( ): """simple docstring""" _A , _A : int = 0, 1 while True: _A , _A : Optional[Any] = b, a + b yield b def lowercase ( lowerCAmelCa...
719
'''simple docstring''' 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 lowerCamelCase__ ( snake...
417
0
'''simple docstring''' import os from shutil import copyfile from typing import List, Optional, Tuple from ...tokenization_utils import AddedToken from ...tokenization_utils_fast import PreTrainedTokenizerFast from ...utils import is_sentencepiece_available, logging if is_sentencepiece_available(): from ...
13
"""simple docstring""" __A : Optional[int] = ''' # 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 ''' ...
499
0
'''simple docstring''' from math import factorial, pi def __UpperCAmelCase ( a_: float, a_: int = 30 ): if not isinstance(a_, (int, float) ): raise ValueError("maclaurin_sin() requires either an int or float for theta" ) if not isinstance(a_, a_ ...
257
'''simple docstring''' import collections import os from shutil import copyfile from typing import Any, Dict, List, Optional, Tuple from ...tokenization_utils import PreTrainedTokenizer from ...utils import logging __a = logging.get_logger(__name__) __a = '▁' __a = {'vo...
257
1
"""simple docstring""" import copy from dataclasses import dataclass, field from typing import ClassVar, Dict from ..features import Audio, Features, Value from .base import TaskTemplate @dataclass(frozen=_SCREAMING_SNAKE_CASE ) class SCREAMING_SNAKE_CASE__ ( _SCREAMING_SNAKE_CASE )...
129
"""simple docstring""" import os from shutil import copyfile from typing import List, Optional, Tuple from ...tokenization_utils import AddedToken from ...tokenization_utils_fast import PreTrainedTokenizerFast from ...utils import is_sentencepiece_available, logging if is_sentencepiece_available(): from .tok...
129
1
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 : str ='''▁''' __SCREAMING_SNAKE_CASE : Union[str, An...
72
import argparse import torch from transformers import ( SpeechTaConfig, SpeechTaFeatureExtractor, SpeechTaForSpeechToSpeech, SpeechTaForSpeechToText, SpeechTaForTextToSpeech, SpeechTaProcessor, SpeechTaTokenizer, logging, ) from transformers.tokenization_utils import AddedToken ...
72
1
import argparse import json import subprocess def __A(lowerCAmelCase , lowerCAmelCase ) -> Optional[int]: """simple docstring""" _UpperCamelCase = [] _UpperCamelCase = ( F'curl -H "Accept: application/vnd.github+json" -H "Authorization: Bearer {token}"' ...
612
from __future__ import annotations lowerCamelCase__ = "#" class lowerCAmelCase__ : def __init__( self ) -> None: '''simple docstring''' _UpperCamelCase = {} def A_ ( self , a ) -> None: ''...
612
1
import os from shutil import copyfile from typing import Any, Dict, List, Optional, Tuple import sentencepiece as spm from ...tokenization_utils import PreTrainedTokenizer from ...utils import logging _UpperCamelCase : Optional[Any] = logging.get_logger(__name__) _UpperCamelCase : ...
341
import argparse import json import os import fairseq import torch from torch import nn from transformers import ( SpeechaTextaConfig, SpeechaTextaForCausalLM, SpeechaTextaTokenizer, SpeechEncoderDecoderConfig, SpeechEncoderDecoderModel, WavaVecaConfig, WavaVecaFeatureExtractor, W...
341
1
from __future__ import annotations import time from math import sqrt # 1 for manhattan, 0 for euclidean __UpperCAmelCase = 0 __UpperCAmelCase = [ [0, 0, 0, 0, 0, 0, 0], [0, 1, 0, 0, 0, 0, 0], # 0 are free path whereas 1's are obstacles [0, 0, 0, 0, 0, 0, 0], [0, 0, 1, 0, 0, 0, 0], ...
40
import gc import random import unittest import numpy as np import torch from transformers import CLIPImageProcessor, CLIPVisionConfig, CLIPVisionModel from diffusers import HeunDiscreteScheduler, PriorTransformer, ShapEImgaImgPipeline from diffusers.pipelines.shap_e import ShapERenderer from diffusers.utils import ...
214
0
import numpy as np import torch import tqdm from ...models.unet_ad import UNetaDModel from ...pipelines import DiffusionPipeline from ...utils import randn_tensor from ...utils.dummy_pt_objects import DDPMScheduler class UpperCAmelCase_ ( _A ): '''simple docstring''' d...
76
from ...configuration_utils import PretrainedConfig from ...utils import logging __lowerCAmelCase : Tuple = logging.get_logger(__name__) __lowerCAmelCase : Tuple = { 'SCUT-DLVCLab/lilt-roberta-en-base': ( 'https://huggingface.co/SCUT-DLVCLab/lilt-roberta-en-base/resolv...
76
1
'''simple docstring''' from typing import List, Optional, Union import torch from ...models import UNetaDConditionModel, VQModel from ...pipelines import DiffusionPipeline from ...pipelines.pipeline_utils import ImagePipelineOutput from ...schedulers import DDPMScheduler from ...utils import ( is_accelerat...
697
from PIL import Image def _SCREAMING_SNAKE_CASE ( lowercase : Image ): '''simple docstring''' lowerCamelCase_ , lowerCamelCase_ = image.size lowerCamelCase_ = 0 lowerCamelCase_ = image.load() for i in ...
70
0
"""simple docstring""" import unittest from transformers import is_torch_available from transformers.testing_utils import require_torch if is_torch_available(): import torch from transformers.generation import DisjunctiveConstraint @require_torch class SCREAMING_SNAKE_CASE__ ( unittest.Tes...
258
"""simple docstring""" import argparse import requests import torch from PIL import Image from torchvision.transforms import Compose, Normalize, Resize, ToTensor from transformers import SwinaSRConfig, SwinaSRForImageSuperResolution, SwinaSRImageProcessor def _A ( __lowercase ): ...
258
1
"""simple docstring""" import argparse import os import shutil import torch from emmental.modules import MagnitudeBinarizer, ThresholdBinarizer, TopKBinarizer def A_ ( snake_case__ ) -> List[Any]: _UpperCamelCase :Any = args.pruning_method _UpperCamelCase :Any ...
355
"""simple docstring""" from ...configuration_utils import PretrainedConfig from ...utils import logging UpperCamelCase__ :str = logging.get_logger(__name__) UpperCamelCase__ :Optional[int] = { """microsoft/markuplm-base""": """https://huggingface.co/microsoft/markuplm-base/resolve/main/c...
355
1
"""simple docstring""" a_ = "ABCDEFGHIJKLMNOPQRSTUVWXYZ" def a__ ( ) -> None: _A = input("Enter message: " ) _A = input("Enter key [alphanumeric]: " ) _A = input("Encrypt/Decrypt [e/d]: " ) if mode.lower().startswith("e"...
621
"""simple docstring""" import argparse import torch from torch import nn from transformers import MBartConfig, MBartForConditionalGeneration def a__ ( __lowercase ) -> Optional[int]: _A = [ "encoder.version", "decoder.version", "model.enco...
621
1
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_enabl...
360
import os from bleurt import score # From: git+https://github.com/google-research/bleurt.git import datasets SCREAMING_SNAKE_CASE__ = datasets.logging.get_logger(__name__) SCREAMING_SNAKE_CASE__ = "\\n@inproceedings{bleurt,\n title={BLEURT: Learning Robust Metrics for Text Generation},\...
631
0
'''simple docstring''' from __future__ import annotations def UpperCamelCase__ ( _lowercase : Tuple ) -> list[int]: # This function is recursive __UpperCAmelCase: int = len(_lowercase ) # If the array contains only one element, we return it (it's the stop condition of ...
719
'''simple docstring''' import numpy # List of input, output pairs SCREAMING_SNAKE_CASE_ = ( ((5, 2, 3), 15), ((6, 5, 9), 25), ((11, 12, 13), 41), ((1, 1, 1), 8), ((11, 12, 13), 41), ) SCREAMING_SNAKE_CASE_ = (((5_15, 22, 13), 5_55), ((61, 35, 49), 1_50)) SCREAMING_SNAKE_CASE_ = ...
466
0
"""simple docstring""" # Note: if you intend to run this script make sure you look under scripts/fsmt/ # to locate the appropriate script to do the work correctly. There is a set of scripts to: # - download and prepare data and run the conversion script # - perform eval to get the best hparam into the confi...
642
def lowercase ( _a ,_a ) -> str: if number < 0 or shift_amount < 0: raise ValueError("both inputs must be positive integers" ) UpperCAmelCase_: str = str(bin(_a ) ) binary_number += "0" * shift_amount return binary_number def lowercase ( _a ...
137
0
'''simple docstring''' from ...processing_utils import ProcessorMixin from ...tokenization_utils_base import BatchEncoding class __A ( UpperCamelCase__ ): a__ : Any = """ClapFeatureExtractor""" a__ : Tuple = ("""RobertaTokenizer""", """RobertaTokenizerFast""") def _...
415
'''simple docstring''' import copy from ...configuration_utils import PretrainedConfig from ...utils import logging from ..auto import CONFIG_MAPPING SCREAMING_SNAKE_CASE_: Union[str, Any] =logging.get_logger(__name__) SCREAMING_SNAKE_CASE_: Optional[Any] ={ 'ut/deta': 'https://huggingface.co/u...
415
1
def A ( _lowercase , _lowercase ): SCREAMING_SNAKE_CASE : Dict = '''''' for word_or_phrase in separated: if not isinstance(_lowercase , _lowercase ): raise Exception('''join() accepts only strings to be joined''' ) ...
248
import torch import torch.nn as nn from transformers import CLIPConfig, CLIPVisionModel, PreTrainedModel from ...utils import logging __UpperCamelCase : List[Any] = logging.get_logger(__name__) def A ( _lowercase , _lowercase ): SCREAMING_SNAKE_CASE : Union[s...
248
1
import argparse import logging import pickle import random import time import numpy as np from transformers import BertTokenizer, GPTaTokenizer, RobertaTokenizer logging.basicConfig( format='''%(asctime)s - %(levelname)s - %(name)s - %(message)s''', datefmt='''%m/%d/%Y %H:%M:%S''', level=logging.INFO ) __A ...
313
from __future__ import annotations from numpy import array, cos, cross, floataa, radians, sin from numpy.typing import NDArray def lowerCamelCase_ ( lowerCamelCase__ , lowerCamelCase__ , lowerCamelCase__ = False ): if radian_mode: return [magnitude * cos(lowerCamelCase__ ...
313
1
'''simple docstring''' from __future__ import annotations from typing import Any def A_ ( SCREAMING_SNAKE_CASE_ ) ->int: if not postfix_notation: return 0 lowercase_ = {"""+""", """-""", """*""", """/"""} lowercase_ = [] for token in postfix_notation: if tok...
451
'''simple docstring''' import os import re import unicodedata from shutil import copyfile from typing import TYPE_CHECKING, Any, Dict, List, Optional, Tuple, Union import sentencepiece as spm from ...tokenization_utils import PreTrainedTokenizer from ...utils import is_torch_available, logging if is_torch_availab...
451
1
import argparse import torch from transformers import LxmertConfig, LxmertForPreTraining, load_tf_weights_in_lxmert from transformers.utils import logging logging.set_verbosity_info() def UpperCAmelCase__( __UpperCAmelCase : List[str] , __UpperCAmelCase : Optional[Any] , __Up...
718
import argparse from transformers import TaConfig, TaForConditionalGeneration, load_tf_weights_in_ta from transformers.utils import logging logging.set_verbosity_info() def UpperCAmelCase__( __UpperCAmelCase : int , __UpperCAmelCase : int , __UpperCAmelCase : Any ): ...
679
0
'''simple docstring''' import copy from dataclasses import dataclass, field from typing import ClassVar, Dict from ..features import Audio, Features, Value from .base import TaskTemplate @dataclass(frozen=lowerCAmelCase ) class __magic_name__ ( lowerCAmelCase ): """...
111
'''simple docstring''' import unittest from transformers import CamembertTokenizer, CamembertTokenizerFast from transformers.testing_utils import get_tests_dir, require_sentencepiece, require_tokenizers, slow from transformers.utils import is_torch_available from ...test_tokenization_common import To...
111
1
from ..utils import DummyObject, requires_backends class __lowercase ( metaclass=lowerCamelCase__ ): lowerCAmelCase__ = ["""note_seq"""] def __init__( self , *lowercase_ , **lowercase_) -> Any: requires_backends(self , ...
716
from typing import TYPE_CHECKING from ...utils import ( OptionalDependencyNotAvailable, _LazyModule, is_sentencepiece_available, is_speech_available, is_torch_available, ) UpperCAmelCase__ : int = { "configuration_trocr": ["TROCR_PRETRAINED_CONFIG_AR...
676
0
from jiwer import compute_measures import datasets A : Dict = '''\ @inproceedings{inproceedings, author = {Morris, Andrew and Maier, Viktoria and Green, Phil}, year = {2004}, month = {01}, pages = {}, title = {From WER and RIL to MER and WIL: improved evaluation measures for connecte...
287
from ...processing_utils import ProcessorMixin class a_ ( _a ): a : Optional[int] = '''SpeechT5FeatureExtractor''' a : List[Any] = '''SpeechT5Tokenizer''' def __init__( self , __UpperCamelCase , __UpperCamelCase ): super().__init__(__Uppe...
287
1
"""simple docstring""" 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 SCREAMING_SNAKE_CASE_ : Optional[int] = { # 1536-bit ...
713
"""simple docstring""" import os from shutil import copyfile from typing import List, Optional, Tuple from tokenizers import processors from ...tokenization_utils import AddedToken, BatchEncoding from ...tokenization_utils_fast import PreTrainedTokenizerFast from ...utils import is_sentencepiece_available, logg...
274
0
"""simple docstring""" import argparse from transformers import ( TapasConfig, TapasForMaskedLM, TapasForQuestionAnswering, TapasForSequenceClassification, TapasModel, TapasTokenizer, load_tf_weights_in_tapas, ) from transformers.utils import logging logging.set_verbosity_info(...
93
import logging import numpy as np import pytest from scipy.linalg import eigh logging.basicConfig(level=logging.INFO, format="%(message)s") def _a ( lowercase__ : np.ndarray ): '''simple docstring''' return input_array.reshape((input_array.size, 1) ) def _a ...
85
0
'''simple docstring''' import gc import random import tempfile import unittest import numpy as np import torch from PIL import Image from transformers import CLIPTextConfig, CLIPTextModel, CLIPTokenizer from diffusers import ( AutoencoderKL, DDIMInverseScheduler, DDIMScheduler, DPMSolverMultist...
427
'''simple docstring''' import importlib import os from dataclasses import dataclass from enum import Enum from typing import Any, Dict, Optional, Union import torch from ..utils import BaseOutput _lowercase = """scheduler_config.json""" class a_ ( UpperCAmelCase__ ): lowercase_ : int ...
427
1
import numpy as np def lowerCAmelCase_ ( __a ) -> np.array: """simple docstring""" return 1 / (1 + np.exp(-vector )) def lowerCAmelCase_ ( __a ) -> np.array: """simple docstring""" return vector * sigmoid(1.7_0_2 * vector ) if...
59
from packaging import version from .import_utils import is_accelerate_available if is_accelerate_available(): import accelerate def _lowerCamelCase( lowercase__ ) -> List[Any]: '''simple docstring''' if not is_accelerate_available(): return method __lowercase= vers...
230
0
import argparse import collections import json import os import re import string import sys import numpy as np lowerCAmelCase = re.compile(R"""\b(a|an|the)\b""", re.UNICODE) lowerCAmelCase = None def __SCREAMING_SNAKE_CASE ( ) -> Union[str, Any]: '''simple ...
675
def __SCREAMING_SNAKE_CASE ( ) -> list[list[int]]: '''simple docstring''' return [list(range(1000 - i , -1000 - i , -1 ) ) for i in range(1000 )] lowerCAmelCase = generate_large_matrix() lowerCAmelCase = ( [[4, 3, 2, -1], [3, 2,...
675
1
import json import os import shutil import tempfile import unittest import numpy as np import pytest from transformers import CLIPTokenizer, CLIPTokenizerFast from transformers.models.clip.tokenization_clip import VOCAB_FILES_NAMES from transformers.testing_utils import require_vision from transformers.utils impo...
9
import copy import unittest from transformers.models.auto import get_values from transformers.testing_utils import require_torch, slow, torch_device from transformers.utils import cached_property, is_torch_available, is_vision_available from ...test_configuration_common import ConfigTester from ...test_modeling_co...
395
0
import json from typing import List, Optional, Tuple from tokenizers import normalizers from ...tokenization_utils_fast import PreTrainedTokenizerFast from ...utils import logging from .tokenization_distilbert import DistilBertTokenizer lowerCamelCase__ = logging.get_logger(__name__) lowerCamelCase__ = ...
82
import argparse import os import torch from transformers import ( XLNetConfig, XLNetForQuestionAnswering, XLNetForSequenceClassification, XLNetLMHeadModel, load_tf_weights_in_xlnet, ) from transformers.utils import CONFIG_NAME, WEIGHTS_NAME, logging lowerCamelCase__ = { '''cola''': 2,...
82
1
"""simple docstring""" import itertools import json import linecache import os import pickle import re import socket import string from collections import Counter from logging import getLogger from pathlib import Path from typing import Callable, Dict, Iterable, List import git import torch from torch.utils.data...
677
"""simple docstring""" from typing import TYPE_CHECKING from ...utils import ( OptionalDependencyNotAvailable, _LazyModule, is_torch_available, ) UpperCAmelCase = { '''configuration_encodec''': [ '''ENCODEC_PRETRAINED_CONFIG_ARCHIVE_MAP''', '''EncodecConfig''', ], ...
677
1
"""simple docstring""" 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 ...
703
"""simple docstring""" import unittest import torch from torch import nn from accelerate.test_utils import require_cuda from accelerate.utils.memory import find_executable_batch_size, release_memory def UpperCAmelCase ( ): '''simple docstring''' raise RuntimeError('CUDA out of me...
133
0
import gc import random import unittest import numpy as np import torch from transformers import CLIPImageProcessor, CLIPVisionConfig, CLIPVisionModel from diffusers import HeunDiscreteScheduler, PriorTransformer, ShapEImgaImgPipeline from diffusers.pipelines.shap_e import ShapERenderer from diffusers.utils impor...
40
def a__ ( A__, A__ ): SCREAMING_SNAKE_CASE_ : Optional[Any] = '' for i in table: res += inp[i - 1] return res def a__ ( A__ ): return data[1:] + data[0] def a__ ( A__, A__ ): SCREAMING_SNAKE_CASE_...
101
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 ...
658
import importlib import torch import yaml from omegaconf import OmegaConf from taming.models.vqgan import VQModel def A ( _lowerCamelCase , _lowerCamelCase=False ): '''simple docstring''' _lowerCAmelCase : Dict = OmegaConf.load(_lowerC...
658
1
"""simple docstring""" import torch from torch import nn from transformers import CLIPPreTrainedModel, CLIPVisionModel from ...models.attention import BasicTransformerBlock from ...utils import logging UpperCamelCase_ : Dict = logging.get_logger(__name__) # pylint: disable=invalid-name ...
115
'''simple docstring''' import argparse import json import re from pathlib import Path import requests import torch from huggingface_hub import hf_hub_download from PIL import Image from transformers import ( MobileNetVaConfig, MobileNetVaForImageClassification, MobileNetVaImageProcessor, load_tf_we...
452
0
import os import sys SCREAMING_SNAKE_CASE_ = os.path.join(os.path.dirname(__file__), """src""") sys.path.append(SRC_DIR) from transformers import ( AutoConfig, AutoModel, AutoModelForCausalLM, AutoModelForMaskedLM, AutoModelForQuestionAnswering, AutoModelForSequenceClas...
720
from ..utils import DummyObject, requires_backends class UpperCamelCase__ ( metaclass=lowerCAmelCase_ ): '''simple docstring''' __snake_case : Dict = ["sentencepiece"] def __init__( self : int ,*lowerCamelCase__ : Any ,**lowerC...
116
0
from __future__ import annotations import json import requests from bsa import BeautifulSoup from fake_useragent import UserAgent __a : List[str] = {"""UserAgent""": UserAgent().random} def UpperCAmelCase ( lowercase ): """simple docstring""" __lowercase ...
534
import torch from transformers import PreTrainedModel, XLMRobertaConfig, XLMRobertaModel class a ( __SCREAMING_SNAKE_CASE ): """simple docstring""" UpperCamelCase_ : Tuple = 'M-CLIP' def __init__( self : Any , lowerCamelCase__ : List[Any]=1_...
332
0
"""simple docstring""" import json import os import re import unicodedata from json.encoder import INFINITY from typing import Any, Dict, List, Optional, Tuple, Union import numpy as np import regex from ...tokenization_utils import AddedToken, PreTrainedTokenizer from ...token...
714
"""simple docstring""" import argparse import json import os import numpy as np import PIL import requests import tensorflow.keras.applications.efficientnet as efficientnet import torch from huggingface_hub import hf_hub_download from PIL import Image from tensorflow.keras.preprocessing import image fro...
378
0
from collections.abc import Callable import numpy as np def lowerCAmelCase( SCREAMING_SNAKE_CASE_ , SCREAMING_SNAKE_CASE_ , SCREAMING_SNAKE_CASE_ , SCREAMING_SNAKE_CASE_ , SCREAMING_SNAKE_CASE_ )-> np.ndarray: """simple docstring""" ...
628
import torch from diffusers import KDPMaDiscreteScheduler from diffusers.utils import torch_device from .test_schedulers import SchedulerCommonTest class __magic_name__ ( snake_case ): UpperCamelCase_ :Dict = (KDPMaDiscreteScheduler,) UpperCamelCase_ ...
628
1
import argparse import ast import logging import os import sys import pandas as pd import torch from tqdm import tqdm from transformers import BartForConditionalGeneration, RagRetriever, RagSequenceForGeneration, RagTokenForGeneration from transformers import logging as transformers_logging ...
701
def a_ ( _A , _A ) -> float: """simple docstring""" if digit_amount > 0: return round(number - int(_A ) , _A ) return number - int(_A ) if __name__ == "__main__": print(decimal_isolate(1.5_3, 0)) print(decimal_isola...
372
0
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 AutoTok...
381
import unittest from transformers import AlbertConfig, is_torch_available from transformers.models.auto import get_values from transformers.testing_utils import require_torch, slow, torch_device from ...test_configuration_common import ConfigTester from ...test_modeling_common import ModelTesterMixin...
381
1
import pyarrow.parquet as pq import pytest from datasets import Audio, Dataset, DatasetDict, Features, NamedSplit, Sequence, Value, config from datasets.features.image import Image from datasets.io.parquet import ParquetDatasetReader, ParquetDatasetWriter, get_writer_batch_size from ..utils import assert_arrow_memo...
700
import unittest from transformers import load_tool from .test_tools_common import ToolTesterMixin __UpperCAmelCase = '\nHugging Face was founded in 2016 by French entrepreneurs Clément Delangue, Julien Chaumond, and Thomas Wolf originally as a company that developed a chatbot app targeted at teenagers....
503
0
import tempfile import torch from diffusers import ( DEISMultistepScheduler, DPMSolverMultistepScheduler, DPMSolverSinglestepScheduler, UniPCMultistepScheduler, ) from .test_schedulers import SchedulerCommonTest class A_ ( __lowerCamelCase ): '''simple docstring''' _UpperCame...
84
def __lowerCamelCase ( _lowercase ) -> str: return "".join(chr(ord(_lowercase ) - 32 ) if 'a' <= char <= 'z' else char for char in word ) if __name__ == "__main__": from doctest import testmod testmod()
282
0
import math class lowerCamelCase_ : def lowercase ( self , lowerCamelCase_ , lowerCamelCase_ ) -> int: """simple docstring""" _UpperCamelCase = 0.0 _UpperCamelCase = 0.0 for i in range(len(__a ) ): da +=...
707
import numpy as np from cva import COLOR_BGR2GRAY, cvtColor, imread from numpy import array, uinta from PIL import Image from digital_image_processing import change_contrast as cc from digital_image_processing import convert_to_negative as cn from digital_image_processing import sepia as sp from digital_image_proces...
589
0
from typing import TYPE_CHECKING from ...utils import OptionalDependencyNotAvailable, _LazyModule, is_speech_available, is_torch_available __lowercase : str ={ """configuration_audio_spectrogram_transformer""": [ """AUDIO_SPECTROGRAM_TRANSFORMER_PRETRAINED_CONFIG_ARCHIVE_MAP""", ...
54
'''simple docstring''' import argparse import json import os import pickle import shutil import numpy as np import torch from distiller import Distiller from lm_seqs_dataset import LmSeqsDataset from transformers import ( BertConfig, BertForMaskedLM, BertTokenizer, DistilBe...
407
0
import inspect import math import tempfile import unittest import numpy as np from transformers import ViTMAEConfig 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_confi...
718
# using dfs for finding eulerian path traversal def UpperCamelCase__ ( lowerCAmelCase__ ,lowerCAmelCase__ ,lowerCAmelCase__ ,lowerCAmelCase__=None ): lowercase = (path or []) + [u] for v in graph[u]: if visited_edge[u][v] is False: lowercase , l...
72
0
"""simple docstring""" from ...configuration_utils import PretrainedConfig from ...utils import logging UpperCamelCase : str = logging.get_logger(__name__) UpperCamelCase : Dict = { "google/realm-cc-news-pretrained-embedder": ( "https://huggingface.co/google/realm...
690
"""simple docstring""" from typing import Dict, List, Optional, Tuple, 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...
690
1
import os import re import shutil import sys import tempfile import unittest import black UpperCamelCase_ = 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 # ...
705
import math def _UpperCAmelCase ( A , A ): '''simple docstring''' if ( not isinstance(A , (int, float) ) or power_factor < -1 or power_factor > 1 ): raise ValueError("power_factor must be a valid floa...
510
0
"""simple docstring""" from ...configuration_utils import PretrainedConfig from ...utils import logging a_ = logging.get_logger(__name__) a_ = {} class UpperCAmelCase_ ( snake_case ): UpperCamelCase ="llama" UpperCamelCase =["past_key_va...
76
import glob import os import random from string import ascii_lowercase, digits import cva __lowerCamelCase : Union[str, Any] = "" __lowerCamelCase : Dict = "" __lowerCamelCase : Optional[int] = "" __lowerCamelCase : Optional[A...
416
0
"""simple docstring""" import argparse import json import re from pathlib import Path import requests import torch from huggingface_hub import hf_hub_download from PIL import Image from transformers import ( MobileNetVaConfig, MobileNetVaForImageClassification, MobileNetVaImagePr...
721
"""simple docstring""" import os import time from dataclasses import dataclass, field from enum import Enum from typing import Dict, List, Optional, Union import torch from filelock import FileLock from torch.utils.data import Dataset from ...models.auto.modeling_auto import MODEL_FOR_QUESTION_...
397
0
'''simple docstring''' from __future__ import annotations from random import choice def _SCREAMING_SNAKE_CASE ( __snake_case : Optional[int] ): return choice(__snake_case ) def _SCREAMING_SNAKE_CASE ( __snake_case : list[int] , __snake_case : int )...
107
"""simple docstring""" from __future__ import annotations class __lowercase : '''simple docstring''' def __init__( self , _UpperCAmelCase , _UpperCAmelCase ): __a , __a : List[Any] =...
52
0
import argparse import torch from transformers import GPTaConfig, GPTaModel, load_tf_weights_in_gpta from transformers.utils import CONFIG_NAME, WEIGHTS_NAME, logging logging.set_verbosity_info() def A ( SCREAMING_SNAKE_CASE , SCREAMING_SNAKE_CASE , SCREAMING_SNAKE_CASE ): """simple do...
433
from math import factorial def A ( SCREAMING_SNAKE_CASE = 100 ): """simple docstring""" return sum(map(SCREAMING_SNAKE_CASE , str(factorial(SCREAMING_SNAKE_CASE ) ) ) ) if __name__ == "__main__": print(solution(int(input('Enter the Number: ').strip()))) ...
433
1
'''simple docstring''' import timeit import numpy as np import datasets from datasets.arrow_writer import ArrowWriter from datasets.features.features import _ArrayXD def _UpperCamelCase ( UpperCamelCase__ ): def wrapper(*UpperCamelCase__ , **UpperCamelCase__ ...
407
'''simple docstring''' import os import re import shutil from argparse import ArgumentParser, Namespace from datasets.commands import BaseDatasetsCLICommand from datasets.utils.logging import get_logger __A ='<<<<<<< This should probably be modified because it mentions: ' __A ='===...
407
1
"""simple docstring""" from typing import Dict from .base import GenericTensor, Pipeline class __lowerCAmelCase ( lowercase_ ): def UpperCAmelCase ( self , __UpperCAmelCase=None , __UpperCAmelCase=None , __UpperCAmelCase=None , **__UpperCAmelCase ): '''simple docstring...
711
"""simple docstring""" import unittest from typing import Dict, List, Optional, Union 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 ImageProcessingSavingTestM...
293
0
"""simple docstring""" 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_fu...
46
"""simple docstring""" import os import random import sys from . import cryptomath_module as cryptoMath # noqa: N812 from . import rabin_miller as rabinMiller # noqa: N812 def lowerCamelCase_( ) -> None: '''simple docstring''' print("Making key files..." ) make_key_...
46
1
import sys import turtle def UpperCamelCase ( lowerCAmelCase__ , lowerCAmelCase__ ): '''simple docstring''' return (pa[0] + pa[0]) / 2, (pa[1] + pa[1]) / 2 def UpperCamelCase ( lowerCAmelCase__ , lowerCAmelCase__ , lowerCAmelCase__ , lowerCAmelCase__ , ...
700
def UpperCamelCase ( lowerCAmelCase__ , lowerCAmelCase__ ): '''simple docstring''' return int((input_a, input_a).count(0 ) == 0 ) def UpperCamelCase ( ): '''simple docstring''' assert and_gate(0 , 0 ) == 0 assert and_gate(0 , 1 ) == 0 assert and_...
633
0
from __future__ import annotations import requests _snake_case = set( '''approved_at_utc approved_by author_flair_background_color author_flair_css_class author_flair_richtext author_flair_template_id author_fullname author_premium can_mod_post category clicked content_categories created_utc downs ...
382
from ...configuration_utils import PretrainedConfig from ...utils import logging _snake_case = logging.get_logger(__name__) _snake_case = { '''facebook/s2t-wav2vec2-large-en-de''': ( '''https://huggingface.co/facebook/s2t-wav2vec2-large-en-de/resolve/main/config.json''' )...
382
1
def __UpperCAmelCase ( __a : str ) -> bool: """simple docstring""" _a : List[Any] = [int(__a ) for i in ip_va_address.split('''.''' ) if i.isdigit()] return len(__a ) == 4 and all(0 <= int(__a ) <= 254 for octet in octets ) if __name__ == "__mai...
578
from collections import OrderedDict from typing import Any, List, Mapping, Optional from ... import PreTrainedTokenizer, TensorType, is_torch_available from ...configuration_utils import PretrainedConfig from ...onnx import OnnxConfigWithPast, PatchingSpec from ...utils import logging a__ = logging.get...
578
1
import os import torch from ..logging import get_logger from .constants import FSDP_PYTORCH_VERSION, MODEL_NAME, OPTIMIZER_NAME from .versions import is_torch_version if is_torch_version('''>=''', FSDP_PYTORCH_VERSION): import torch.distributed.checkpoint as dist_cp from torch.distributed.checkpoint....
410
from __future__ import annotations import time from collections.abc import Sequence from random import randint from matplotlib import pyplot as plt def _lowercase ( __SCREAMING_SNAKE_CASE , __SCREAMING_SNAKE_CASE , __SCREAMING_SNAKE_CASE ) -> tuple[int | None, int | None, float]...
410
1
'''simple docstring''' import inspect import unittest import numpy as np from tests.test_modeling_common import floats_tensor from transformers import MaskaFormerConfig, is_torch_available, is_vision_available from transformers.testing_utils import require_torch, require_torch_multi_gpu, require_vis...
708
'''simple docstring''' import unittest from transformers import BertGenerationTokenizer from transformers.testing_utils import get_tests_dir, require_sentencepiece, require_torch, slow from transformers.utils import cached_property from ...test_tokenization_common import TokenizerTesterMixin A ...
163
0
from __future__ import annotations from bisect import bisect_left from functools import total_ordering from heapq import merge @total_ordering class lowerCamelCase (SCREAMING_SNAKE_CASE__ ): """simple docstring""" def __lt__( self : Optional[int] , __magic_name__ : int ) -...
140
import json import os import re import shutil import tempfile import unittest from typing import Tuple from transformers import AddedToken, BatchEncoding, ByTaTokenizer from transformers.utils import cached_property, is_tf_available, is_torch_available from ...test_tokenization_common import TokenizerTesterMixin if...
140
1
def A(__a: int = 100 ): lowerCAmelCase_ = 0 lowerCAmelCase_ = 0 for i in range(1 , n + 1 ): sum_of_squares += i**2 sum_of_ints += i return sum_of_ints**2 - sum_of_squares if __name__ == "__main__": print(F'''{solution() = }''')
719
import copy import tempfile import unittest from huggingface_hub import HfFolder, delete_repo from parameterized import parameterized from requests.exceptions import HTTPError from transformers import AutoConfig, GenerationConfig from transformers.testing_utils import TOKEN, USER, is_staging_test class __magi...
226
0
from maths.is_square_free import is_square_free from maths.prime_factors import prime_factors def lowerCamelCase__ ( __lowerCamelCase : int ): __UpperCAmelCase : Optional[Any] = prime_factors(__lowerCamelCase ) if is_square_free(__lowerCamelCase ...
63
"""simple docstring""" from ....configuration_utils import PretrainedConfig from ....utils import logging _lowerCAmelCase = logging.get_logger(__name__) _lowerCAmelCase = { """Visual-Attention-Network/van-base""": ( """https://huggingface.co/Visual-Atten...
259
0
from datetime import datetime import matplotlib.pyplot as plt import torch def SCREAMING_SNAKE_CASE__ ( UpperCamelCase__: Union[str, Any] ): for param in module.parameters(): SCREAMING_SNAKE_CASE__ = False def SCREAMING_SNAKE_CASE__ ( ): SCREAMI...
59
from ...configuration_utils import PretrainedConfig from ...utils import logging from ...utils.backbone_utils import BackboneConfigMixin, get_aligned_output_features_output_indices _lowerCamelCase = logging.get_logger(__name__) _lowerCamelCase = { 'shi-labs/nat-mini-in1k-224': 'https://hugg...
59
1
"""simple docstring""" from math import sqrt def __snake_case ( SCREAMING_SNAKE_CASE: int ): """simple docstring""" _lowerCAmelCase = 0 for i in range(1 , int(sqrt(SCREAMING_SNAKE_CASE ) + 1 ) ): if n ...
580
"""simple docstring""" from __future__ import annotations _snake_case = [True] * 1_0_0_0_0_0_1 _snake_case = 2 while i * i <= 1_0_0_0_0_0_0: if seive[i]: for j in range(i * i, 1_0_0_0_0_0_1, i): _snake_case = False i += 1 def __snake_case ( S...
580
1
'''simple docstring''' def snake_case ( a_ : list ) -> list: """simple docstring""" if len(a_ ) <= 1: return [tuple(a_ )] UpperCamelCase_ : Optional[int] = [] def generate(a_ : int , a_ : list ): ...
712
'''simple docstring''' import pytest import datasets # Import fixture modules as plugins UpperCamelCase =["tests.fixtures.files", "tests.fixtures.hub", "tests.fixtures.fsspec"] def snake_case ( a_ : List[str] , a_ : Optional[Any] ) -> Union[str, Any]: ...
543
0
import os import time import numpy as np import onnxruntime as ort lowerCamelCase__ : int = '1' lowerCamelCase__ : Optional[int] = '0' lowerCamelCase__ : Optional[Any] = '1' lowerCamelCase__ : int = ort.SessionOptions() lowerCamelC...
31
'''simple docstring''' import torch from diffusers import UnCLIPScheduler from .test_schedulers import SchedulerCommonTest class UpperCamelCase__ ( __lowerCAmelCase ): lowerCAmelCase__ : Optional[int] = (UnCLIPScheduler,) def __a ( ...
489
0
import os from shutil import copyfile from typing import List, Optional, Tuple from ...tokenization_utils_fast import PreTrainedTokenizerFast from ...utils import is_sentencepiece_available, logging if is_sentencepiece_available(): from .tokenization_pegasus import PegasusTokenizer else: a_ :Dict ...
717
import argparse import json from pathlib import Path import requests import timm import torch from huggingface_hub import hf_hub_download from PIL import Image from timm.data import resolve_data_config from timm.data.transforms_factory import create_transform from transformers import ( BitConfig, ViTHybrid...
250
0
import gc import tempfile import unittest import numpy as np import torch from diffusers import VersatileDiffusionPipeline from diffusers.utils.testing_utils import load_image, nightly, require_torch_gpu, torch_device __snake_case :str =False class lowerCAmelCase__ ( unittest.TestCas...
106
"""simple docstring""" def __snake_case ( __A : list , __A : int , __A : int = 0 , __A : int = 0 ) -> int: '''simple docstring''' SCREAMING_SNAKE_CASE : Any = right or len(__A ) - 1 if left ...
265
0
from collections import OrderedDict from typing import Mapping from ...configuration_utils import PretrainedConfig from ...onnx import OnnxConfig from ...utils import logging a_ : Any = logging.get_logger(__name__) a_ : Tuple = { "facebook/xmod-base": "https://huggingface.c...
710
from ....configuration_utils import PretrainedConfig from ....utils import logging a_ : Any = logging.get_logger(__name__) a_ : Dict = { "Visual-Attention-Network/van-base": ( "https://huggingface.co/Visual-Attention-Network/van-base/blob/main/config.json" ), } ...
673
0
'''simple docstring''' def UpperCamelCase_ ( A__ , A__ , A__ ): def count_of_possible_combinations(A__ ) -> int: if target < 0: return 0 if target == 0: return 1 return sum(count_of_possible_combinations(target - item ) for item in array ) return count_of_po...
263
'''simple docstring''' from __future__ import annotations def UpperCamelCase_ ( A__ ): a_ = [True] * limit a_ = False a_ = False a_ = True for i in range(3 , int(limit**0.5 + 1 ) , 2 ): a_ = i * ...
263
1
"""simple docstring""" from argparse import ArgumentParser from .env import EnvironmentCommand def a ( ) -> str: __magic_name__: Any = ArgumentParser("""Diffusers CLI tool""" , usage="""diffusers-cli <command> [<args>]""" ) _...
213
"""simple docstring""" from copy import deepcopy from typing import Optional, Union import numpy as np from ...processing_utils import ProcessorMixin from ...tokenization_utils_base import BatchEncoding from ...utils import TensorType, is_tf_available, is_torch_available if is_tor...
213
1
from __future__ import annotations import math from collections import Counter from string import ascii_lowercase def lowerCAmelCase_ ( lowerCamelCase ): __magic_name__ , __magic_name__ : Union[str, Any] =analyze_text(lowerCamelCase ) __magic_name__ ...
21
'''simple docstring''' import colorsys from PIL import Image # type: ignore def lowerCamelCase_ ( __UpperCamelCase : float , __UpperCamelCase : float , __UpperCamelCase : int ) -> float: """simple docstring""" _A = ...
292
0
def UpperCamelCase ( lowerCAmelCase_ ) -> str: '''simple docstring''' if number > 0: raise ValueError('input must be a negative integer' ) _A= len(bin(lowerCAmelCase_ )[3:] ) _A= bin(abs(lowerCAmelCase_ ) - (1 << binary_numb...
711
import warnings from ...utils import logging from .image_processing_perceiver import PerceiverImageProcessor UpperCAmelCase_ = logging.get_logger(__name__) class lowerCAmelCase ( _a ): def __init__( self , *lowerCAmelCase__ , **lowerCAmelC...
476
0
import warnings from ...utils import is_sklearn_available, requires_backends if is_sklearn_available(): from scipy.stats import pearsonr, spearmanr from sklearn.metrics import fa_score, matthews_corrcoef __snake_case = ( '''This metric will be removed from the library soo...
1
'''simple docstring''' from google.protobuf import descriptor as _descriptor from google.protobuf import descriptor_pool as _descriptor_pool from google.protobuf import symbol_database as _symbol_database from google.protobuf.internal import builder as _builder # @@protoc_insertion_point(imports) __snake_case...
131
0
'''simple docstring''' def A__ ( __lowerCAmelCase : float , __lowerCAmelCase : float , __lowerCAmelCase : float , __lowerCAmelCase : float , __lowerCAmelCase : float , ): lowerCamelCase__ = [redshift, radiation_density, matter_density, dark...
720
'''simple docstring''' import shutil import tempfile import unittest import numpy as np import pytest from transformers.testing_utils import require_vision from transformers.utils import is_vision_available if is_vision_available(): from PIL import Image from transformers import AutoPro...
9
0
from dataclasses import dataclass from typing import Optional, Tuple, Union import torch import torch.nn as nn from ..configuration_utils import ConfigMixin, register_to_config from ..utils import BaseOutput, apply_forward_hook from .modeling_utils import ModelMixin from .vae import Decoder, DecoderOutput, Encoder, V...
221
'''simple docstring''' 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_ ( __snake_case : Optional[int] , __snake_case : Union[str, Any] , __sn...
676
0
'''simple docstring''' import gc import unittest import numpy as np import torch import torch.nn.functional as F from transformers import ( ClapTextConfig, ClapTextModelWithProjection, RobertaTokenizer, SpeechTaHifiGan, SpeechTaHifiGanConfig, ) from diffusers import ( AudioLDMPipeline, ...
712
'''simple docstring''' from heapq import heappop, heappush import numpy as np def _lowercase ( UpperCamelCase__ : np.ndarray, UpperCamelCase__ : tuple[int, int], UpperCamelCase__ : tuple[int, int], UpperCamelCase__ : bool, ): __A ,__A : Option...
540
0
import argparse import json import math import os import time import traceback import zipfile from collections import Counter import requests def lowerCamelCase__ ( __lowerCamelCase : Optional[Any] , __lowerCamelCase : Optional[int]=None ): __Upp...
63
'''simple docstring''' import os import sys import warnings from dataclasses import dataclass, field from io import BytesIO from typing import TYPE_CHECKING, Any, ClassVar, Dict, List, Optional, Union import numpy as np import pyarrow as pa from .. import config from ..download.streaming_download_manager import xope...
585
0
"""simple docstring""" import json import os from functools import lru_cache from typing import List, Optional, Tuple import regex as re from ...tokenization_utils import AddedToken, PreTrainedTokenizer from ...utils import logging A_ = logging.get_logger(__name__) A_ = {'''vocab_file'...
498
"""simple docstring""" from __future__ import annotations class __SCREAMING_SNAKE_CASE : def __init__( self : Any , snake_case : str , snake_case : str ): '''simple docstring''' A__ , A__ : List[s...
498
1
from typing import List, Optional, Union import numpy as np import torch import torchaudio.compliance.kaldi as ta_kaldi from ...feature_extraction_sequence_utils import SequenceFeatureExtractor from ...feature_extraction_utils import BatchFeature from ...utils import PaddingStrategy, TensorType, logging UpperCam...
37
import io import json import unittest from parameterized import parameterized from transformers import FSMTForConditionalGeneration, FSMTTokenizer from transformers.testing_utils import get_tests_dir, require_torch, slow, torch_device from utils import calculate_bleu __lowerCAmelCase : Any ...
509
0
import warnings from .generation import TFGenerationMixin class SCREAMING_SNAKE_CASE ( snake_case ): """simple docstring""" warnings.warn( "Importing `TFGenerationMixin` from `src/transformers/generation_tf_utils.py` is deprecated and will " "be remove...
62
def __A ( _lowercase , _lowercase , _lowercase , _lowercase ): '''simple docstring''' global f # a global dp table for knapsack if f[i][j] < 0: if j < wt[i - 1]: _A = mf_knapsack(i - 1 , _lowercase , _lowercase ...
62
1
'''simple docstring''' from __future__ import annotations from fractions import Fraction from math import gcd, sqrt def UpperCAmelCase ( A : str ): SCREAMING_SNAKE_CASE : Any = int(number**0.5 ) return number == sq * sq def UpperCAme...
527
import json import pathlib import unittest import numpy as np from transformers.testing_utils import require_torch, require_vision, slow from transformers.utils import is_torch_available, is_vision_available from ...test_image_processing_common import ImageProcessingSavingTestMixin, prepare_im...
328
0
from typing import TYPE_CHECKING from ...utils import ( OptionalDependencyNotAvailable, _LazyModule, is_tf_available, is_tokenizers_available, is_torch_available, is_vision_available, ) snake_case__ : Tuple = { "configuration_layoutlmv3": [ "LAYOUTLMV3_PRETRAINED...
705
import datetime import platform import subprocess from typing import Optional, Tuple, Union import numpy as np def lowercase ( __A : bytes , __A : int ) -> np.array: '''simple docstring''' snake_case : List[str] = f"""{sampling_rate}""" snake_...
315
0
"""simple docstring""" import pickle import shutil import tempfile import unittest from transformers import SPIECE_UNDERLINE, XLMRobertaTokenizer, XLMRobertaTokenizerFast from transformers.testing_utils import get_tests_dir, require_sentencepiece, require_tokenizers, slow from transformers.utils import cached_...
595
"""simple docstring""" import hashlib import unittest from typing import Dict import numpy as np from transformers import ( MODEL_FOR_MASK_GENERATION_MAPPING, TF_MODEL_FOR_MASK_GENERATION_MAPPING, is_vision_available, pipeline, ) from transformers.pipelines import MaskGenerationPipeline from t...
595
1
'''simple docstring''' import copy import os import tempfile from unittest import TestCase from unittest.mock import patch import numpy as np import pyarrow as pa import pyarrow.parquet as pq import pytest from datasets.arrow_writer import ArrowWriter, OptimizedTypedSequence, ParquetWriter, TypedSequence ...
720
'''simple docstring''' from __future__ import annotations def lowerCamelCase_ ( lowercase__ , lowercase__ , lowercase__): lowerCamelCase__ = list(range(len(lowercase__))) lowerCamelCase__ = [v / w for v, w in zip(lowercase__ , lowercase__)] index.sort(key=la...
187
0
from typing import TYPE_CHECKING from ...utils import ( OptionalDependencyNotAvailable, _LazyModule, is_tokenizers_available, is_torch_available, is_vision_available, ) a__ = { '''configuration_perceiver''': ['''PERCEIVER_PRETRAINED_CONFIG_ARCHIVE_MAP''', '''Pe...
14
"""simple docstring""" 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 ( TFBas...
96
0
from typing import Any, Dict, Optional import torch import torch.nn.functional as F from torch import nn from ..utils import maybe_allow_in_graph from .activations import get_activation from .attention_processor import Attention from .embeddings import CombinedTimestepLabelEmbeddings @maybe_allow_in_graph cla...
633
import warnings from diffusers import StableDiffusionInpaintPipeline as StableDiffusionInpaintPipeline # noqa F401 warnings.warn( "The `inpainting.py` script is outdated. Please use directly `from diffusers import" " StableDiffusionInpaintPipeline` instead." )
633
1
def UpperCAmelCase ( a_ ) -> list: """simple docstring""" return [ txt[:a] + txt[a].upper() + txt[a + 1 :] for a in range(len(a_ ) ) if txt[a].isalpha() ] if __name__ == "__main__": __import__('doctest').testmod()
55
"""simple docstring""" # Copyright 2023 The HuggingFace Inc. team. All rights reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LI...
673
0
import argparse import glob import logging import os import time from argparse import Namespace import numpy as np import torch from lightning_base import BaseTransformer, add_generic_args, generic_train from torch.utils.data import DataLoader, TensorDataset from transformers import glue_compute_metrics as com...
62
import logging import os import quant_trainer import torch from torch.utils.data import DataLoader from transformers import Trainer, is_torch_tpu_available from transformers.trainer_utils import PredictionOutput __A = logging.getLogger(__name__) if is_torch_tpu_available(check_device=False): imp...
62
1
'''simple docstring''' import cmath import math def a ( lowerCamelCase__ , lowerCamelCase__ , lowerCamelCase__ , lowerCamelCase__ ): '''simple docstring''' A_ : int = math.radians(lowerCamelCase__ ) A_ : List[str] = math.radians(lowerCamelCase_...
667
'''simple docstring''' import numpy as np from cva import COLOR_BGR2GRAY, cvtColor, imread from numpy import array, uinta from PIL import Image from digital_image_processing import change_contrast as cc from digital_image_processing import convert_to_negative as cn from digital_image_processing import sepia as...
667
1
import time import warnings from abc import ABC from copy import deepcopy from typing import Optional import torch from ..utils import add_start_docstrings, logging UpperCamelCase_ = logging.get_logger(__name__) UpperCamelCase_ = R'\n Args:\n input_ids (`torch.LongTensor` of shape `(...
709
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 UpperCamelCase_ = transforms.Compo...
142
0
def lowerCamelCase( a__ ,a__ ,a__): return not any( neighbour == 1 and colored_vertices[i] == color for i, neighbour in enumerate(a__)) def lowerCamelCase( a__ ,a__ ,a__ ,a__): # Base Case if index == len(a__): return True # Recursive ...
691
from typing import TYPE_CHECKING from ....utils import _LazyModule snake_case_ : Dict = {'''tokenization_tapex''': ['''TapexTokenizer''']} if TYPE_CHECKING: from .tokenization_tapex import TapexTokenizer else: import sys snake_case_ : Union[str, Any] = ...
691
1
import math def lowerCamelCase__ ( __lowerCAmelCase : int ): """simple docstring""" lowerCAmelCase_ = math.loga(math.sqrt(4 * positive_integer + 1 ) / 2 + 1 / 2 ) return exponent == int(__lowerCAmelCase ) def lowerCamelCase__...
704
import math class _lowerCAmelCase : def __init__( self , _UpperCamelCase=0 ) -> Tuple: # a graph with Node 0,1,...,N-1 lowerCAmelCase_ = n lowerCAmelCase_ = [ [math.inf for j in range(0 , _UpperCamelCase )] for i ...
279
0
_lowerCAmelCase: Union[str, Any] = [4, 1, 7, 4, 2, 6, 4, 1, 5, 3, 7, 5] _lowerCAmelCase: int = [3, 7, 7, 4, 2, 6, 4, 1, 5, 3, 7, 5] _lowerCAmelCase: Any = { 0: 'Sunday', 1: 'Monday', 2: 'Tuesday', 3: 'Wednesday', 4: 'Thursday', 5: 'Friday', ...
20
import json import os import torch from diffusers import UNetaDModel os.makedirs('''hub/hopper-medium-v2/unet/hor32''', exist_ok=True) os.makedirs('''hub/hopper-medium-v2/unet/hor128''', exist_ok=True) os.makedirs('''hub/hopper-medium-v2/value_function''', exist_ok=True) def A ( __UpperCamelCase ...
9
0
'''simple docstring''' import unittest from transformers import GPTNeoXJapaneseConfig, is_torch_available from transformers.models.gpt_neox_japanese.tokenization_gpt_neox_japanese import GPTNeoXJapaneseTokenizer from transformers.testing_utils import require_torch, slow, torch_device from ...test_configurat...
708
'''simple docstring''' import copy import inspect import unittest from transformers import PretrainedConfig, SwiftFormerConfig from transformers.testing_utils import ( require_torch, require_vision, slow, torch_device, ) from transformers.utils import cached_property, is_torch_available, ...
599
0