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
def __snake_case ( __UpperCamelCase : int = 100 ): """simple docstring""" A_ = n * (n + 1) * (2 * n + 1) / 6 A_ = (n * (n + 1) / 2) ** 2 return int(square_of_sum - sum_of_squares ) if __name__ == "__main__": print(F"{solution() = }...
86
"""simple docstring""" import argparse import torch from transformers import BertForMaskedLM if __name__ == "__main__": _a = argparse.ArgumentParser( description=( """Extraction some layers of the full BertForMaskedLM or RObertaForMaskedLM for Transfer Lear...
19
0
'''simple docstring''' 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 snake_case_ = logging.getLogger(__name...
706
'''simple docstring''' from typing import Optional import pyspark from .. import Features, NamedSplit from ..download import DownloadMode from ..packaged_modules.spark.spark import Spark from .abc import AbstractDatasetReader class SCREAMING_SNAKE_CASE__ ( _UpperCAmelCase ): ...
68
0
from __future__ import annotations from random import random class __A : """simple docstring""" def __init__( self , a__ = None): """simple docstring""" _lowerCamelCase : Any = value _lowerCamelCase : Lis...
114
import copy from typing import Any, Dict, List, Optional, Union import numpy as np from ...audio_utils import mel_filter_bank, spectrogram, window_function from ...feature_extraction_sequence_utils import SequenceFeatureExtractor from ...feature_extraction_utils import BatchFeature from ...utils import TensorTy...
114
1
"""simple docstring""" 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 lowercase__( _...
477
"""simple docstring""" import unittest from transformers import DebertaVaTokenizer, DebertaVaTokenizerFast from transformers.testing_utils import get_tests_dir, require_sentencepiece, require_tokenizers, slow from ...test_tokenization_common import TokenizerTesterMixin __SCREAMING_SNAKE_CASE =get_test...
477
1
from typing import List, Optional, Union from ...configuration_utils import PretrainedConfig from ...utils import logging A__ : Tuple = logging.get_logger(__name__) A__ : Dict = { """huggingface/informer-tourism-monthly""": ( """https://huggingface.co/huggingface/informe...
233
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_ = "▁" UpperCamelCase_ = {"vocab_file": "spiece.model"} UpperC...
256
0
'''simple docstring''' from ...configuration_utils import PretrainedConfig from ...utils import logging a_ : Tuple = logging.get_logger(__name__) a_ : List[str] = { """MIT/ast-finetuned-audioset-10-10-0.4593""": ( """https://huggingface.co/MIT/...
445
'''simple docstring''' 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 ImageProcessingSavingTes...
445
1
from abc import ABC, abstractmethod from argparse import ArgumentParser class __A( UpperCAmelCase ): @staticmethod @abstractmethod def lowercase__ ( __UpperCamelCase : ArgumentParser ): raise NotImplementedError() @abstractmethod ...
272
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, logging if is_sent...
272
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, TFBaseModelOutputWit...
720
from ...configuration_utils import PretrainedConfig from ...utils import logging lowerCamelCase_ = logging.get_logger(__name__) lowerCamelCase_ = { '''sayakpaul/vit-msn-base''': '''https://huggingface.co/sayakpaul/vit-msn-base/resolve/main/config.json''', # See all ViT MSN models ...
161
0
'''simple docstring''' import json import os import sys import tempfile import unittest from pathlib import Path from shutil import copyfile from huggingface_hub import HfFolder, Repository, create_repo, delete_repo from requests.exceptions import HTTPError import transformers fro...
26
'''simple docstring''' from __future__ import annotations from typing import Any class _A : def __init__( self : str , __magic_name__ : int , __magic_name__ : int , __magic_name__ : float = 0 ) -> None: """simple d...
26
1
"""simple docstring""" import os import unittest from transformers import BertTokenizerFast from transformers.models.bert.tokenization_bert import ( VOCAB_FILES_NAMES, BasicTokenizer, BertTokenizer, WordpieceTokenizer, _is_control, _is_punctuation, _is_whitespace, ) from transformers...
720
"""simple docstring""" import warnings from typing import List, Optional, Tuple, Union import numpy as np import PIL import torch from ...models import UNetaDModel from ...schedulers import RePaintScheduler from ...utils import PIL_INTERPOLATION, logging, randn_tensor from ..pipeline_utils import DiffusionPipeli...
628
0
"""simple docstring""" import argparse import json from typing import List from ltp import LTP from transformers.models.bert.tokenization_bert import BertTokenizer def lowerCAmelCase_ (_SCREAMING_SNAKE_CASE :Optional[Any] ) -> List[Any]: # This defines a "chinese character" as anything in...
473
"""simple docstring""" import os from shutil import copyfile from typing import List, Optional, Tuple import sentencepiece as spm from ...tokenization_utils import PreTrainedTokenizer from ...utils import logging UpperCamelCase = logging.get_logger(__name__) UpperCamelCase = {'vocab_file': ...
473
1
'''simple docstring''' def _a ( lowerCAmelCase_ ): """simple docstring""" if n_term == "": return [] _snake_case : list = [] for temp in range(int(lowerCAmelCase_ ) ): series.append(f'''1/{temp + 1}''' if series else '''1''' ) ...
47
'''simple docstring''' from collections.abc import Generator def _a ( ): """simple docstring""" _snake_case , _snake_case : Union[str, Any] = 0, 1 while True: _snake_case , _snake_case : List[str] = b, a + b ...
47
1
"""simple docstring""" def UpperCAmelCase__ (snake_case__ : int ): """simple docstring""" _snake_case : List[str] = abs(snake_case__ ) _snake_case : Optional[Any] = 0 while n > 0: res += n % 10 n //= 10 return res d...
609
"""simple docstring""" import unicodedata from dataclasses import dataclass from typing import Optional, Union import numpy as np from transformers.data.data_collator import DataCollatorMixin from transformers.file_utils import PaddingStrategy from transformers.tokenization_utils_base import Pr...
609
1
def lowercase ( __snake_case : Optional[Any] , __snake_case : Any , __snake_case : Any ): if n == 0: return 1 elif n % 2 == 1: return (binary_exponentiation(__snake_case , n - 1 , __snake_case ) * a) % mod else: low...
720
"""simple docstring""" # Copyright 2021 The HuggingFace Team. All rights reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/lic...
141
0
'''simple docstring''' from typing import Optional import torch import torch.utils.checkpoint from torch import Tensor, nn from torch.nn import BCEWithLogitsLoss, CrossEntropyLoss, MSELoss from ...activations import ACTaFN from ...file_utils import add_code_sample_docstrings, add_start_docstrings, add_start_docst...
325
def A ( snake_case__ : List[str] ) -> Optional[Any]: '''simple docstring''' if not head: return True # split the list to two parts __snake_case , __snake_case = head.next, head while fast and fast.next: __snake_case = fast.next.next __sna...
313
0
import json import logging import os import socket import git import numpy as np import torch logging.basicConfig( format='''%(asctime)s - %(levelname)s - %(name)s - PID: %(process)d - %(message)s''', datefmt='''%m/%d/%Y %H:%M:%S''', level=logging.INFO, ) lowercase_ = logg...
336
import math import random def lowerCAmelCase ( UpperCAmelCase, UpperCAmelCase = False ) ->float: """simple docstring""" if deriv: return value * (1 - value) return 1 / (1 + math.exp(-value )) # Initial Value lowercase...
336
1
import argparse import random import joblib import numpy as np import torch from igf.igf import ( SecondaryLearner, collect_objective_set, compute_perplexity, generate_datasets, load_gpta, recopy_gpta, set_seed, train_secondary_learner, ) from torch.utils.data import DataLoader, Ran...
40
'''simple docstring''' class UpperCAmelCase : def __init__( self : Union[str, Any] ): UpperCAmelCase__ :dict[str, TrieNode] = {} # Mapping from char to TrieNode UpperCAmelCase__ :Union[str, Any] = False def __SCREAMING_SNAKE_CASE ( self :...
467
0
def _snake_case (__lowercase , __lowercase): UpperCamelCase_ = len(__lowercase) UpperCamelCase_ = len(__lowercase) UpperCamelCase_ = [[False for _ in range(m + 1)] for _ in range(n + 1)] UpperCamelCase_ = True for i in rang...
618
import logging import os from dataclasses import dataclass from typing import List, Optional, Union import tqdm from filelock import FileLock from transformers import ( BartTokenizer, BartTokenizerFast, DataProcessor, PreTrainedTokenizer, RobertaTokenizer, RobertaTo...
618
1
"""simple docstring""" import argparse from transformers import BigBirdConfig, BigBirdForPreTraining, BigBirdForQuestionAnswering, load_tf_weights_in_big_bird from transformers.utils import logging logging.set_verbosity_info() def __a ( a, a, a, a ): """simple docstring""" ...
388
"""simple docstring""" import sys import tempfile import unittest import unittest.mock as mock from pathlib import Path from huggingface_hub import HfFolder, delete_repo from requests.exceptions import HTTPError from transformers import AutoFeatureExtractor, WavaVecaFeatureExtractor from transformers.testing_u...
388
1
import argparse import OmegaConf import torch from diffusers import DDIMScheduler, LDMPipeline, UNetLDMModel, VQModel def a__ (__lowercase :List[Any] , __lowercase :Optional[int] , __lowercase :Tuple ) -> Dict: _A : Union[str, Any] = OmegaConf...
710
from ..utils import DummyObject, requires_backends class UpperCAmelCase__ ( metaclass=__snake_case ): __snake_case : Optional[Any] = ["note_seq"] def __init__( self ,*A__ ,**A__ ): requires_backends(self ,['''note_seq''']...
332
0
from typing import TYPE_CHECKING from ...utils import OptionalDependencyNotAvailable, _LazyModule, is_sentencepiece_available __A = {} try: if not is_sentencepiece_available(): raise OptionalDependencyNotAvailable() except OptionalDependencyNotAvailable: pass else: __A...
59
import logging import os from typing import Dict, List, Optional, Union import torch import torch.nn as nn from accelerate.utils.imports import ( is_abit_bnb_available, is_abit_bnb_available, is_bnb_available, ) from ..big_modeling import dispatch_model, init_empty_weights from .dataclasses import ...
59
1
"""simple docstring""" import os import re import shutil import sys import tempfile import unittest import black lowercase_ = 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 ...
65
"""simple docstring""" from __future__ import annotations def lowercase ( lowerCAmelCase__ : int , lowerCAmelCase__ : int ) -> list[str]: if partitions <= 0: raise ValueError('''partitions must be a positive number!''' ) if partitions > number_of_bytes: ...
65
1
from typing import TYPE_CHECKING from ...utils import ( OptionalDependencyNotAvailable, _LazyModule, is_flax_available, is_tf_available, is_tokenizers_available, is_torch_available, is_vision_available, ) a_ : Any = { 'configuration_owlvit': [ 'OWLVIT_P...
73
'''simple docstring''' def _lowercase ( UpperCamelCase__ : int, UpperCamelCase__ : int ): return 1 if input_a == input_a else 0 def _lowercase ( ): assert xnor_gate(0, 0 ) == 1 assert xnor_gate(0, 1 ) == 0 assert xnor_gate(1, ...
365
0
import math from typing import Callable, List, Optional, Union import numpy as np import PIL import torch from PIL import Image from transformers import CLIPTextModel, CLIPTokenizer from diffusers.models import AutoencoderKL, UNetaDConditionModel from diffusers.pipelines.stable_diffusion.pipeline_stable_diffusion...
710
import string def SCREAMING_SNAKE_CASE( __UpperCamelCase ) -> str: a__ : Optional[int] = "" for i in sequence: a__ : List[str] = ord(__UpperCamelCase ) if 65 <= extract <= 90: output += chr(1_55 - extract ) elif 97 <= extract <...
207
0
"""simple docstring""" from __future__ import annotations def snake_case ( UpperCamelCase__ : int , UpperCamelCase__ : int ) -> tuple[int, int]: if b == 0: return (1, 0) ((lowerCamelCase) , (lowerCamelCase)) : Optional[Any] = ...
222
"""simple docstring""" import argparse from typing import Dict import tensorflow as tf import torch from tqdm import tqdm from transformers import BigBirdPegasusConfig, BigBirdPegasusForConditionalGeneration __lowerCamelCase :int = [ # tf -> hf ('/', '.'), ('layer_', 'layers.'), ('...
222
1
"""simple docstring""" def UpperCamelCase ( UpperCAmelCase ) ->int: """simple docstring""" if len(A__ ) <= 1: return [tuple(A__ )] a_ = [] def generate(UpperCAmelCase , UpperCAmelCase ): if k == 1: res.append(tuple(arr[:] ) ) ...
714
"""simple docstring""" import functools import logging import os import sys import threading from logging import ( CRITICAL, # NOQA DEBUG, # NOQA ERROR, # NOQA FATAL, # NOQA INFO, # NOQA NOTSET, # NOQA WARN, # NOQA WARNING, # NOQA ) from typing import Optional import hugg...
210
0
'''simple docstring''' import shutil import tempfile import unittest from transformers import SPIECE_UNDERLINE, BatchEncoding, MBartaaTokenizer, MBartaaTokenizerFast, is_torch_available from transformers.testing_utils import ( get_tests_dir, nested_simplify, require_sentencepiece, require_tokeniz...
13
'''simple docstring''' import argparse A__ : Optional[Any] = """docs/source/_static/js/custom.js""" def UpperCAmelCase__ ( UpperCAmelCase_ : Optional[int] ) -> int: with open(UpperCAmelCase_ , encoding='utf-8' , newline='\n' ) as f: _...
13
1
from ...processing_utils import ProcessorMixin class _lowerCamelCase( _a ): lowercase_ : str = ["""image_processor""", """feature_extractor"""] lowercase_ : int = """TvltImageProcessor""" lowercase_ : Optional[int] = """Tvlt...
702
from typing import Dict from .base import GenericTensor, Pipeline class _lowerCamelCase( _a ): def UpperCamelCase ( self, lowerCamelCase=None, lowerCamelCase=None, lowerCamelCase=None, **lowerCamelCase) -> int: """simple docstring""" if tokenize_kwa...
354
0
from __future__ import annotations import math import random from collections.abc import Collection from typing import overload class lowerCAmelCase_ : """simple docstring""" def __init__( self :Dict , lowerCamelCase__ :Collection[float] | None = None ): if co...
45
import math def A ( lowercase__ : Tuple , lowercase__ : Union[str, Any] ) -> Optional[Any]: if 0 not in (x, y): # We use the relation x^y = y*log10(x), where 10 is the base. return y * math.logaa(lowercase__ ) else: if x == 0: # 0 raised to any number is 0 return 0 elif y == 0:...
45
1
'''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, MobileNetVaImageProces...
706
'''simple docstring''' def _lowerCAmelCase (_lowercase , _lowercase ): """simple docstring""" return int(input_a == input_a == 0 ) def _lowerCAmelCase (): """simple docstring""" print("Truth Table of NOR Gate:" ) print...
394
0
import unittest from transformers.testing_utils import CaptureStdout from transformers.tools.python_interpreter import evaluate def SCREAMING_SNAKE_CASE__ ( _lowercase : List[str] ) -> Optional[Any]: '''simple docstring''' return x + 2 class ...
266
def lowerCamelCase__ ( __A :int ,__A :float ,__A :float ): """simple docstring""" return round(float(moles / volume ) * nfactor ) def lowerCamelCase__ ( __A :float ,__A :float ,__A :float ): """simple docstring""" ...
268
0
'''simple docstring''' import logging import os from dataclasses import dataclass from typing import List, Optional, Union import tqdm from filelock import FileLock from transformers import ( BartTokenizer, BartTokenizerFast, DataProcessor, PreTrainedTokenizer, RobertaTokenizer, RobertaTokeni...
428
'''simple docstring''' from random import randint, random def __UpperCamelCase ( UpperCAmelCase , UpperCAmelCase , UpperCAmelCase , UpperCAmelCase = False , UpperCAmelCase = False , UpperCAmelCase = 5 , ): lowercase__ : Optional[Any] = [[-1] * number_of_cells] # Create a highway w...
428
1
from ...configuration_utils import PretrainedConfig from ...utils import logging __magic_name__ =logging.get_logger(__name__) __magic_name__ ={ '''google/pegasus-large''': '''https://huggingface.co/google/pegasus-large/resolve/main/config.json''', # See all PEGASUS models at https://hugging...
415
from __future__ import annotations import inspect import unittest from typing import List, Tuple from transformers import RegNetConfig from transformers.testing_utils import require_tf, require_vision, slow from transformers.utils import cached_property, is_tf_available, is_vision_available from ...test_co...
415
1
from typing import TYPE_CHECKING from ...utils import OptionalDependencyNotAvailable, _LazyModule, is_torch_available SCREAMING_SNAKE_CASE__ : str = { """configuration_x_clip""": [ """XCLIP_PRETRAINED_CONFIG_ARCHIVE_MAP""", """XCLIPConfig""", """XCLIPTextConfig""", ...
701
import argparse import json from pathlib import Path import requests import torch from huggingface_hub import cached_download, hf_hub_url from PIL import Image from transformers import DPTConfig, DPTForDepthEstimation, DPTForSemanticSegmentation, DPTImageProcessor from transformers.utils import logging loggi...
180
0
import argparse from pathlib import Path import torch from packaging import version from torch.onnx import export from diffusers import AutoencoderKL UpperCamelCase = version.parse(version.parse(torch.__version__).base_version) < version.parse('1.11') def __lowerCamelCase ( __l...
269
import unittest from transformers import AutoTokenizer, FalconConfig, is_torch_available from transformers.testing_utils import require_torch, slow, torch_device from ...generation.test_utils import GenerationTesterMixin from ...test_configuration_common import ConfigTester from ...test_modeling_common import ...
269
1
'''simple docstring''' import unittest import numpy as np import requests 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 ImageProcessingSavingT...
666
'''simple docstring''' import unittest import numpy as np import torch from diffusers import DDIMPipeline, DDIMScheduler, UNetaDModel from diffusers.utils.testing_utils import enable_full_determinism, require_torch_gpu, slow, torch_device from ..pipeline_params import UNCONDITION...
666
1
import warnings from contextlib import contextmanager from ...processing_utils import ProcessorMixin from .feature_extraction_wavaveca import WavaVecaFeatureExtractor from .tokenization_wavaveca import WavaVecaCTCTokenizer class UpperCamelCase_ ( snake_case__ ): _a ...
364
from typing import TYPE_CHECKING from ...utils import ( OptionalDependencyNotAvailable, _LazyModule, is_flax_available, is_tf_available, is_torch_available, ) _lowercase : Dict ={ """configuration_resnet""": ["""RESNET_PRETRAINED_CONFIG_ARCHIVE_MAP""", """Re...
364
1
from ..utils import DummyObject, requires_backends class UpperCamelCase ( metaclass=__a ): """simple docstring""" SCREAMING_SNAKE_CASE_ : Optional[Any] = ["flax"] def __init__( self ,*UpperCAmelCase_ ,**UpperCAmelCase_ ): requires_backends(sel...
706
"""simple docstring""" import argparse import torch from ...utils import logging from . import AlbertConfig, AlbertForPreTraining, load_tf_weights_in_albert logging.set_verbosity_info() def __SCREAMING_SNAKE_CASE ( __UpperCAmelCase , __UpperCAmelCase , __UpperCAmelCase ...
600
0
"""simple docstring""" def __lowerCamelCase ( UpperCamelCase__ = 1000 ): """simple docstring""" _UpperCAmelCase = -1 _UpperCAmelCase = 0 for a in range(1 , n // 3 ): # Solving the two equations a**2+b**2=c**2 and a+b+c=N eliminating c _UpperCAmelCase = (n * n - 2 * a * n) ...
657
"""simple docstring""" from typing import TYPE_CHECKING from ...utils import ( OptionalDependencyNotAvailable, _LazyModule, is_flax_available, is_tf_available, is_tokenizers_available, is_torch_available, ) __magic_name__ = { '''configuration_electra''': ['''ELECTRA_PRETRAINE...
657
1
import collections import importlib.util import os import re from pathlib import Path __snake_case : Dict ='src/transformers' # Matches is_xxx_available() __snake_case : Optional[int] =re.compile(R'is\_([a-z_]*)_available()') # Catches a one-line _import_struct = {xxx} __snake_...
700
from __future__ import annotations def lowerCAmelCase__ ( lowerCamelCase_ : list[int]): '''simple docstring''' return len(set(lowerCamelCase_)) == len(lowerCamelCase_) if __name__ == "__main__": import doctest doctest.testmod()
90
0
'''simple docstring''' import json import os from typing import Dict, List, Optional, Tuple import regex as re from ...tokenization_utils import PreTrainedTokenizer from ...utils import logging a_ : List[Any] = logging.get_logger(__name__) a_ : List[Any] ...
675
'''simple docstring''' def __snake_case ( UpperCAmelCase_ : str ): lowerCamelCase_ = "" for ch in key: if ch == " " or ch not in key_no_dups and ch.isalpha(): key_no_dups += ch return key_no_dups def __snake_case ( UpperCAmelCase_ : str ): lowerCamelCase_ ...
675
1
import gc import unittest from transformers import CTRLConfig, is_torch_available from transformers.testing_utils import require_torch, slow, torch_device from ...generation.test_utils import GenerationTesterMixin from ...test_configuration_common import ConfigTester from ...test_modeling_common import ModelTeste...
721
import argparse import gc import json import os import torch from datasets import load_dataset from torch.optim import AdamW from torch.utils.data import DataLoader from transformers import AutoModelForSequenceClassification, AutoTokenizer, get_linear_schedule_with_warmup, set_seed from accelerate import Accelera...
561
0
'''simple docstring''' def _a (__SCREAMING_SNAKE_CASE ): """simple docstring""" _UpperCamelCase =[0] * len(__SCREAMING_SNAKE_CASE ) for i in range(1 , len(__SCREAMING_SNAKE_CASE ) ): # use last results for better performance - dynamic programming _UpperCamelCase ...
404
'''simple docstring''' import copy from ...configuration_utils import PretrainedConfig from ...utils import logging from ..auto import CONFIG_MAPPING __lowerCamelCase : Any = logging.get_logger(__name__) __lowerCamelCase : List[str] = { 'SenseTime/deformable-detr': 'https://huggingface.c...
404
1
def _UpperCAmelCase ( UpperCAmelCase : int ): """simple docstring""" __lowerCamelCase : int = 0 __lowerCamelCase : int = len(UpperCAmelCase ) for i in range(n - 1 ): for j in ra...
458
import argparse import shutil from pathlib import Path from tqdm import tqdm from transformers import AutoTokenizer def _UpperCAmelCase ( UpperCAmelCase : Any , UpperCAmelCase : int , UpperCAmelCase : int , UpperCAmelCase : Any=1_024 )...
458
1
import darl # noqa import gym import tqdm from diffusers.experimental import ValueGuidedRLPipeline lowercase : Optional[Any] = { 'n_samples': 64, 'horizon': 32, 'num_inference_steps': 20, 'n_guide_steps': 2, # can set to 0 for faster sampling, does not use value network ...
557
"""simple docstring""" import unittest import numpy as np from transformers import DistilBertConfig, is_flax_available from transformers.testing_utils import require_flax, slow from ...test_modeling_flax_common import FlaxModelTesterMixin, ids_tensor, random_attention_mask if is_flax_available(): imp...
34
0
def lowerCamelCase__ ( snake_case_ : Dict , snake_case_ : Optional[Any] ) -> float: if digit_amount > 0: return round(number - int(snake_case_ ) , snake_case_ ) return number - int(snake_case_ ) if __name__ == "__main__": print(decimal_isolate(1.5...
711
import argparse import json import os import fairseq import torch from fairseq.data import Dictionary from transformers import ( UniSpeechConfig, UniSpeechForCTC, UniSpeechForPreTraining, WavaVecaFeatureExtractor, WavaVecaPhonemeCTCTokenizer, WavaVecaProcessor, l...
388
0
'''simple docstring''' from typing import TYPE_CHECKING from ...utils import ( OptionalDependencyNotAvailable, _LazyModule, is_flax_available, is_tf_available, is_tokenizers_available, is_torch_available, ) __lowerCamelCase : List[Any] = {'''...
653
'''simple docstring''' import pytest from datasets.parallel import ParallelBackendConfig, parallel_backend from datasets.utils.py_utils import map_nested from .utils import require_dill_gt_0_3_2, require_joblibspark, require_not_windows def __UpperCAmelCase ( __magic_name_...
653
1
'''simple docstring''' import random import unittest import torch from diffusers import IFImgaImgSuperResolutionPipeline from diffusers.utils import floats_tensor from diffusers.utils.import_utils import is_xformers_available from diffusers.utils.testing_utils import skip_mps, torch_device fro...
266
'''simple docstring''' import argparse import json from pathlib import Path import requests import torch from huggingface_hub import hf_hub_download from PIL import Image from timm import create_model from timm.data import resolve_data_config from timm.data.transforms_factory import create_trans...
266
1
from typing import TYPE_CHECKING from ...utils import ( OptionalDependencyNotAvailable, _LazyModule, is_sentencepiece_available, is_tokenizers_available, is_torch_available, ) SCREAMING_SNAKE_CASE__ : Any = {"""configuration_plbart""": ["""PLBART_PRETRAINED_...
79
"""simple docstring""" import itertools from dataclasses import dataclass from typing import Any, Callable, Dict, List, Optional, Union import pandas as pd import pyarrow as pa import datasets import datasets.config from datasets.features.features import require_storage_cast from datasets.table import table_cast f...
91
0
'''simple docstring''' from typing import Optional import pyspark from .. import Features, NamedSplit from ..download import DownloadMode from ..packaged_modules.spark.spark import Spark from .abc import AbstractDatasetReader class _lowercase ( _lowercase ): ...
631
'''simple docstring''' # coding=utf-8 # Copyright 2023 The HuggingFace Inc. team. # # 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...
631
1
'''simple docstring''' import argparse import copy def _SCREAMING_SNAKE_CASE ( __snake_case : str ): _A = {} with open(UpperCamelCase_ ) as f: for line in f: if line.split()[0] not in dict_of_neighbours: _A = [] ...
107
'''simple docstring''' from __future__ import annotations from collections import Counter from random import random class A : def __init__( self : Optional[int] ): """simple docstring""" lowerCAmelCase__ = {} def __SCREAMING_SNAKE_CASE ( self ...
48
0
def SCREAMING_SNAKE_CASE ( lowerCamelCase_): a__ ,a__ = [], [] while len(__snake_case) > 1: a__ ,a__ = min(__snake_case), max(__snake_case) start.append(__snake_case) end.append(__snake_case) collection.remove(__s...
705
"""simple docstring""" import unittest from transformers import BertGenerationConfig, is_torch_available from transformers.testing_utils import require_torch, slow, torch_device from ...generation.test_utils import GenerationTesterMixin from ...test_configuration_common import ConfigTester from ...test_...
200
0
import dataclasses import json import sys import types from argparse import ArgumentDefaultsHelpFormatter, ArgumentParser, ArgumentTypeError from copy import copy from enum import Enum from inspect import isclass from pathlib import Path from typing import Any, Callable, Dict, Iterable, List, Literal, NewType, Op...
188
import unittest import numpy as np import torch from diffusers import VersatileDiffusionImageVariationPipeline from diffusers.utils.testing_utils import load_image, require_torch_gpu, slow, torch_device a__ : Optional[int] = False class UpperCAmelCase_ ( unittest.TestCase ): pass ...
188
1
import faiss # noqa: F401 # Here to have a nice missing dependency error message early on import numpy # noqa: F401 # Here to have a nice missing dependency error message early on import requests # noqa: F401 # Here to have a nice missing dependency error message early on import sklearn # noqa: F401 # Here to ...
700
import shutil import tempfile import unittest import numpy as np import pytest from transformers.testing_utils import require_vision from transformers.utils import is_vision_available if is_vision_available(): from PIL import Image from transformers import AutoProcessor, BlipaProcessor, BlipImageProcess...
362
0
def UpperCAmelCase_ ( _UpperCAmelCase , _UpperCAmelCase ): lowerCamelCase_: Any = len(_UpperCAmelCase ) lowerCamelCase_: str = [[False] * (required_sum + 1) for _ in range(arr_len + 1 )] # for each arr value, a sum of zero(0) can be formed by not t...
423
from typing import Dict, List, Optional, Union import numpy as np from ...image_processing_utils import BaseImageProcessor, BatchFeature, get_size_dict from ...image_transforms import ( center_crop, get_resize_output_image_size, normalize, rescale, resize, to_channel_dimension_forma...
423
1
"""simple docstring""" import importlib import sys from argparse import REMAINDER, ArgumentParser from pathlib import Path import torch_xla.distributed.xla_multiprocessing as xmp def lowerCAmelCase_ ( ): """simple docstring""" __lowercase = Argum...
705
"""simple docstring""" from typing import TYPE_CHECKING from ...utils import OptionalDependencyNotAvailable, _LazyModule, is_tf_available, is_torch_available UpperCAmelCase__ ={ "configuration_data2vec_audio": ["DATA2VEC_AUDIO_PRETRAINED_CONFIG_ARCHIVE_MAP", "Data2VecAudioConfig"], "c...
442
0
"""simple docstring""" from pathlib import Path from typing import List from transformers import is_torch_available, is_vision_available from transformers.testing_utils import get_tests_dir, is_tool_test from transformers.tools.agent_types import AGENT_TYPE_MAPPING, AgentAudio, AgentImage, AgentText if is...
255
"""simple docstring""" import gc import random import unittest import numpy as np import torch from transformers import XLMRobertaTokenizer from diffusers import ( AltDiffusionImgaImgPipeline, AutoencoderKL, PNDMScheduler, UNetaDConditionModel, ) from diffusers.image_processor import VaeIma...
255
1
'''simple docstring''' from __future__ import annotations def lowerCamelCase__ ( __lowerCamelCase : List[str] ): '''simple docstring''' if not nums: return 0 _UpperCAmelCase : str =nums[0] _UpperCAmelCase : Optional[int] =0...
701
'''simple docstring''' def lowerCamelCase__ ( __lowerCamelCase : int = 1_0_0 ): '''simple docstring''' _UpperCAmelCase : int =set() _UpperCAmelCase : Union[str, Any] =0 _UpperCAmelCase : Optional[Any] =n + 1 # ma...
331
0
'''simple docstring''' def UpperCamelCase__ ( lowerCAmelCase ): """simple docstring""" if num <= 0: raise ValueError("""Input must be a positive integer""" ) _lowerCAmelCase = [True] * (num + 1) _lowerCAmelCase =...
207
"""simple docstring""" from typing import TYPE_CHECKING from ...utils import ( OptionalDependencyNotAvailable, _LazyModule, is_sentencepiece_available, is_tokenizers_available, is_torch_available, ) A_ = {"configuration_plbart": ["PLBART_PRETRAINED_CONFIG_ARCHIVE_MAP", "PLB...
391
0
"""simple docstring""" import math import qiskit def lowerCamelCase ( _snake_case = 1 ,_snake_case = 1 ,_snake_case = 1 ): if ( isinstance(_snake_case ,_snake_case ) or isinstance(_snake_case ,_snake_case ) or isinstance(_snake_case ,_snake_cas...
254
"""simple docstring""" import timeit import numpy as np import datasets from datasets.arrow_writer import ArrowWriter from datasets.features.features import _ArrayXD def lowerCamelCase ( _snake_case ): def wrapper(*_snake_case ,**_snake_case ): UpperCAmelCase__ : str ...
254
1
'''simple docstring''' import unittest import numpy as np import torch from transformers import CLIPTextConfig, CLIPTextModel, CLIPTokenizer from diffusers import ( AutoencoderKL, DDIMScheduler, DPMSolverMultistepScheduler, TextToVideoSDPipeline, UNetaDConditionModel, ) from diffusers.utils impo...
245
'''simple docstring''' from __future__ import annotations import numpy as np from numpy import floataa from numpy.typing import NDArray def _A ( snake_case , snake_case , snake_case , snake_case , ) -> list[float]: _lowercase , _lowercase : Union[st...
245
1
'''simple docstring''' import math def snake_case__ ( _A: Tuple = 100 ) -> int: '''simple docstring''' lowerCAmelCase = sum(i * i for i in range(1 , n + 1 ) ) lowerCAmelCase = int(math.pow(sum(range(1 , n + 1 ) ) , ...
711
'''simple docstring''' import operator as op def snake_case__ ( _A: Optional[Any] ) -> Tuple: '''simple docstring''' lowerCAmelCase = [] lowerCAmelCase = lambda _A , _A : int(x / y ) # noqa: E731 integer division operation low...
605
0
'''simple docstring''' import unittest from transformers import AutoConfig, AutoTokenizer, BertConfig, TensorType, is_flax_available from transformers.testing_utils import DUMMY_UNKNOWN_IDENTIFIER, require_flax, slow if is_flax_available(): import jax from transformers.models.auto.modeling_flax_auto ...
689
'''simple docstring''' import string from math import logaa def a_ ( UpperCamelCase_ , UpperCamelCase_ ): A_ = document.translate( str.maketrans("" , "" , string.punctuation ) ).replace("\n" , "" ) A_ = document_without_punctuation.split(...
452
0
import functools import logging import os import sys import threading from logging import ( CRITICAL, # NOQA DEBUG, # NOQA ERROR, # NOQA FATAL, # NOQA INFO, # NOQA NOTSET, # NOQA WARN, # NOQA WARNING, # NOQA ) from typing import Optional import huggingface_hub.utils as hf_...
59
import os from pathlib import Path from unittest.mock import patch import pytest import zstandard as zstd from datasets.download.download_config import DownloadConfig from datasets.utils.file_utils import ( OfflineModeIsEnabled, cached_path, fsspec_get, fsspec_head, ftp_get, ftp_head, ...
59
1
import gc import unittest import numpy as np import torch from diffusers import AutoencoderKL, DDIMScheduler, DiTPipeline, DPMSolverMultistepScheduler, TransformeraDModel from diffusers.utils import is_xformers_available, load_numpy, slow, torch_device from diffusers.utils.testing_utils import enable_full_dete...
324
import tempfile import unittest import numpy as np import transformers from transformers import GPTaTokenizer, GPTJConfig, is_flax_available, is_torch_available from transformers.testing_utils import is_pt_flax_cross_test, require_flax, tooslow from ...generation.test_flax_utils import FlaxGenerationTesterMix...
324
1
import math from collections.abc import Callable def __UpperCAmelCase( lowercase_ , lowercase_ , lowercase_ ): _lowerCamelCase : float = xa _lowerCamelCase : float = xa while True: if x_n == x_na or function(lowercase_ ) == funct...
613
import warnings from ...utils import logging from .image_processing_donut import DonutImageProcessor _lowerCamelCase = logging.get_logger(__name__) class __A ( lowerCamelCase__ ): """simple docstring""" def __init__( self , *a__ , ...
613
1
import numpy as np import pandas as pd from sklearn.preprocessing import Normalizer from sklearn.svm import SVR from statsmodels.tsa.statespace.sarimax import SARIMAX def lowerCAmelCase__( lowercase : list , lowercase : list , lowercase : list , lowercase : ...
243
import inspect import unittest from transformers import YolosConfig from transformers.testing_utils import require_torch, require_vision, slow, torch_device from transformers.utils import cached_property, is_torch_available, is_vision_available from ...test_configuration_common import ConfigTester from ...test_...
243
1
"""simple docstring""" import argparse import pathlib import fairseq import torch from fairseq.models.roberta import RobertaModel as FairseqRobertaModel from fairseq.modules import TransformerSentenceEncoderLayer from packaging import version from transformers import XLMRobertaConfig, XLMRobertaXLForMaskedLM, X...
709
"""simple docstring""" # Function to print upper half of diamond (pyramid) def lowercase_ ( _UpperCAmelCase ): """simple docstring""" for i in range(0 , _UpperCAmelCase ): for _ in range(0 , n - i - 1 ): # printing spaces print(''' ''' , end=''''...
361
0
'''simple docstring''' import math import sys import cva import numpy as np def UpperCamelCase__ ( _lowercase : np.ndarray , _lowercase : float ) -> np.ndarray: # For applying gaussian function for each element in matrix. __UpperCAmelCase: Tuple = ma...
523
'''simple docstring''' import inspect import logging import os import random import shutil import tempfile import unittest import pytest import torch from torch import nn from torch.utils.data import DataLoader, TensorDataset from accelerate import Accelerator from accelerate.test_utils import execute_subproces...
523
1
from collections import OrderedDict from typing import Mapping from ...configuration_utils import PretrainedConfig from ...onnx import OnnxConfig from ...utils import logging UpperCamelCase__ = logging.get_logger(__name__) UpperCamelCase__ = { '''bert-base-uncased''': '''https://hug...
701
# 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 req...
143
0
"""simple docstring""" from __future__ import annotations __A = [ [-1, 0], # left [0, -1], # down [1, 0], # right [0, 1], # up ] def a__ ( __SCREAMING_SNAKE_CASE , __SCREAMING_SNAKE_CASE , __SCREAMING_SNAKE_CASE , __SCREAMING_...
346
"""simple docstring""" from ...configuration_utils import PretrainedConfig from ...utils import logging __A = logging.get_logger(__name__) __A = { "facebook/xglm-564M": "https://huggingface.co/facebook/xglm-564M/resolve/main/config.json", # See all XGLM models at https://huggin...
346
1
import argparse import torch from transformers import BlenderbotConfig, BlenderbotForConditionalGeneration from transformers.utils import logging logging.set_verbosity_info() lowerCamelCase : Dict = logging.get_logger(__name__) lowerCamelCase : Optional[int] = [ ["attention",...
713
from collections import OrderedDict from typing import TYPE_CHECKING, Any, Mapping, Optional from packaging import version from ...configuration_utils import PretrainedConfig from ...onnx import OnnxConfig from ...onnx.utils import compute_effective_axis_dimension from ...utils import logging if TYPE_CHECKIN...
649
0
"""simple docstring""" from string import ascii_lowercase, ascii_uppercase def __SCREAMING_SNAKE_CASE ( lowerCamelCase_: str ): """simple docstring""" if not sentence: return "" snake_case : Optional[Any] = dict(zip(lowerCame...
449
"""simple docstring""" from random import randint, random def __SCREAMING_SNAKE_CASE ( lowerCamelCase_: int , lowerCamelCase_: int , lowerCamelCase_: int , lowerCamelCase_: bool = False , lowerCamelCase_: bool = False , lowerCamelCase_...
449
1
def __UpperCAmelCase ( lowerCamelCase_ : Optional[Any] ) -> List[Any]: """simple docstring""" SCREAMING_SNAKE_CASE_ : Any = len(lowerCamelCase_ ) SCREAMING_SNAKE_CASE_ : Tuple = sum(lowerCamelCase_ ) SCREAMING_SNAKE_CASE...
685
import unittest import numpy as np from transformers.testing_utils import require_pytesseract, require_torch from transformers.utils import is_pytesseract_available, is_torch_available from ...test_image_processing_common import ImageProcessingSavingTestMixin, prepare_image_inputs if is_torch_available(): ...
685
1
def __lowercase ( _UpperCAmelCase ) -> Optional[Any]: '''simple docstring''' if a < 0: raise ValueError("Input value must be a positive integer" ) elif isinstance(UpperCamelCase__ , UpperCamelCase__ ): raise TypeError("Input value must be a 'int' type" ) return bin...
321
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 ...
503
0
'''simple docstring''' from collections import OrderedDict from typing import TYPE_CHECKING, Any, List, Mapping, Optional, Union from ...configuration_utils import PretrainedConfig from ...onnx import OnnxConfig from ...utils import TensorType, logging if TYPE_CHECKING: from ...onnx.config import Patching...
710
'''simple docstring''' import json import os import unittest from transformers import AutoTokenizer, GPTaTokenizer, GPTaTokenizerFast from transformers.models.gpta.tokenization_gpta import VOCAB_FILES_NAMES from transformers.testing_utils import require_tokenizers from ...test_tokenization_common import Tokeni...
384
0
"""simple docstring""" import logging import os import sys import warnings from dataclasses import dataclass, field from random import randint from typing import Optional import datasets import evaluate import numpy as np from datasets import DatasetDict, load_dataset import transformers from transformers import...
636
"""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 ( _A, _A, _A ): """simple docstring""" # Initialise PyTorch model ...
584
0
'''simple docstring''' import unittest import numpy as np import requests 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 ImageProcessingSavingTestMix...
399
'''simple docstring''' from ...configuration_utils import PretrainedConfig from ...utils import logging _lowerCAmelCase = logging.get_logger(__name__) _lowerCAmelCase = { '''funnel-transformer/small''': '''https://huggingface.co/funnel-transformer/small/resolve/m...
399
1
'''simple docstring''' import os from pathlib import Path from unittest.mock import patch import pytest import zstandard as zstd from datasets.download.download_config import DownloadConfig from datasets.utils.file_utils import ( OfflineModeIsEnabled, cached_path, fsspec_...
596
'''simple docstring''' def __UpperCAmelCase ( lowerCamelCase_ , lowerCamelCase_ , lowerCamelCase_) -> float: if principal <= 0: raise Exception('Principal borrowed must be > 0') if rate_per_annum < 0: raise Exception('Rate of interest must be >= 0') if years_to_...
596
1
'''simple docstring''' from typing import List from ...configuration_utils import PretrainedConfig from ...utils import logging lowercase_ : Optional[Any] = logging.get_logger(__name__) lowercase_ : str = { '''snap-research/efficientformer-l1-300''': ( '''https:...
653
'''simple docstring''' from random import shuffle import tensorflow as tf from numpy import array def SCREAMING_SNAKE_CASE ( lowercase_ : List[str] , lowercase_ : Optional[int] ): lowercase = int(lowercase_ ) assert noofclusters < len(lowercas...
653
1
from typing import List, Optional, Union import numpy as np from ...feature_extraction_sequence_utils import SequenceFeatureExtractor from ...feature_extraction_utils import BatchFeature from ...utils import PaddingStrategy, TensorType, logging __UpperCamelCase : str = logging...
328
import math import os import re import sys import unittest from pathlib import Path from typing import Tuple from unittest.mock import patch from parameterized import parameterized from transformers.testing_utils import ( CaptureStderr, ExtendSysPath, TestCasePlus, execute...
328
1
"""simple docstring""" __UpperCAmelCase = '\n# Transformers installation\n! pip install transformers datasets\n# To install from source instead of the last release, comment the command above and uncomment the following one.\n# ! pip install git+https://github.com/huggingface/transformers.git\n...
709
"""simple docstring""" from typing import Any, Callable, Dict, List, Optional, Union import torch from transformers import CLIPImageProcessor, CLIPTextModel, CLIPTokenizer from diffusers import ( AutoencoderKL, DDIMScheduler, DiffusionPipeline, LMSDiscreteScheduler, PNDMSc...
256
0
def snake_case_ ( _SCREAMING_SNAKE_CASE = 3 , _SCREAMING_SNAKE_CASE = 7 , _SCREAMING_SNAKE_CASE = 1_0_0_0_0_0_0 ): __lowercase = 0 __lowercase = 1 for current_denominator in range(1 , limit + 1 ): __lowercase = current_denominator * numerator // d...
402
import math import os import re import sys import unittest from pathlib import Path from typing import Tuple from unittest.mock import patch from parameterized import parameterized from transformers.testing_utils import ( CaptureStderr, ExtendSysPath, TestCasePlus, execute_subprocess_async, ge...
402
1
from typing import TYPE_CHECKING # rely on isort to merge the imports from ...utils import OptionalDependencyNotAvailable, _LazyModule, is_torch_available A = {"configuration_focalnet": ["FOCALNET_PRETRAINED_CONFIG_ARCHIVE_MAP", "FocalNetConfig"]} try: if not is_torch_available(): ...
277
from typing import TYPE_CHECKING from ....utils import OptionalDependencyNotAvailable, _LazyModule, is_torch_available A = {"configuration_mmbt": ["MMBTConfig"]} try: if not is_torch_available(): raise OptionalDependencyNotAvailable() except OptionalDependencyNotAvailable: pass...
277
1
"""simple docstring""" from typing import TYPE_CHECKING from ...utils import OptionalDependencyNotAvailable, _LazyModule, is_tf_available, is_torch_available _a = { """configuration_groupvit""": [ """GROUPVIT_PRETRAINED_CONFIG_ARCHIVE_MAP""", """GroupViTConfig""",...
19
'''simple docstring''' from argparse import ArgumentParser from . import BaseTransformersCLICommand def a ( _UpperCAmelCase ) -> int: """simple docstring""" return DownloadCommand(args.model , args.cache_dir , args.force , args.trust_remote_code ) ...
697
0
import unittest from transformers import BigBirdConfig, is_flax_available from transformers.testing_utils import require_flax, slow from ...test_modeling_flax_common import FlaxModelTesterMixin, ids_tensor, random_attention_mask if is_flax_available(): import jax from transformers.models.big_bird.modeling...
86
lowerCamelCase_ = [sum(int(c, 10) ** 2 for c in i.__str__()) for i in range(10_00_00)] def __magic_name__ ( __a : int ): '''simple docstring''' UpperCamelCase__ = 0 while number: # Increased Speed Slightly by checking every 5 digits together. sum...
86
1
from ..utils import DummyObject, requires_backends class lowercase_ (metaclass=lowercase__ ): snake_case =['keras_nlp'] def __init__( self , *lowercase_ , **lowercase_) -> str: requires_backends(self , ['keras_nlp'])
20
import unittest import numpy as np import torch from torch import nn from transformers import ( CLIPImageProcessor, CLIPTextConfig, CLIPTextModelWithProjection, CLIPTokenizer, CLIPVisionConfig, CLIPVisionModelWithProjection, ) from diffusers import KandinskyVaaPriorPipeline, PriorTransforme...
20
1
"""simple docstring""" from pickle import UnpicklingError import jax import jax.numpy as jnp import numpy as np from flax.serialization import from_bytes from flax.traverse_util import flatten_dict from ..utils import logging A_ = logging.get_logger(__name__) def U...
28
"""simple docstring""" import random import timeit from functools import wraps from typing import Callable, Optional from ..configuration_utils import PretrainedConfig from ..models.auto.modeling_tf_auto import TF_MODEL_MAPPING, TF_MODEL_WITH_LM_HEAD_MAPPING from ..utils import is_pyanvml_availab...
28
1
"""simple docstring""" import pytest from datasets.splits import SplitDict, SplitInfo from datasets.utils.py_utils import asdict @pytest.mark.parametrize( """split_dict""" , [ SplitDict(), SplitDict({"""train""": SplitInfo(name="""train""" , num_bytes=13_37 , num_examples=42 , dataset...
182
# DISCLAIMER: This code is strongly influenced by https://github.com/pesser/pytorch_diffusion # and https://github.com/hojonathanho/diffusion import math from dataclasses import dataclass from typing import List, Optional, Tuple, Union import numpy as np import torch from diffusers.configuration_ut...
397
0
from __future__ import annotations _lowercase = 10 def _A (UpperCamelCase : list[int] ) ->list[int]: '''simple docstring''' lowerCamelCase__ : Optional[Any] = 1 lowerCamelCase__ : List[Any] = max(UpperCamelCase ) while placement <...
96
# Author: OMKAR PATHAK, Nwachukwu Chidiebere # Use a Python dictionary to construct the graph. from __future__ import annotations from pprint import pformat from typing import Generic, TypeVar _lowercase = TypeVar('''T''') class __A ( Generic[T] ): def __init__(self , ...
96
1
from dataclasses import dataclass, field from typing import ClassVar, Dict from ..features import Features, Sequence, Value from .base import TaskTemplate @dataclass(frozen=_lowerCAmelCase ) class a (_lowerCAmelCase ): """simple docstring""" __UpperCAmelCase : str = ...
81
'''simple docstring''' from typing import TYPE_CHECKING from ...utils import OptionalDependencyNotAvailable, _LazyModule, is_tokenizers_available, is_torch_available __SCREAMING_SNAKE_CASE : List[str] = { '''configuration_graphormer''': ['''GRAPHORMER_PRETRAINED_CONFIG_ARCHIVE_MAP''', '''Graph...
452
0
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, logging if is_sentencepie...
392
from typing import List, Optional, Union from ...configuration_utils import PretrainedConfig from ...utils import logging lowercase : List[str] = logging.get_logger(__name__) lowercase : Any = { """huggingface/time-series-transformer-tourism-monthly""": ( """https://hugging...
392
1
'''simple docstring''' from typing import Optional, Tuple, Union import torch from einops import rearrange, reduce from diffusers import DDIMScheduler, DDPMScheduler, DiffusionPipeline, ImagePipelineOutput, UNetaDConditionModel from diffusers.schedulers.scheduling_ddim import DDIMSchedulerOutput f...
69
'''simple docstring''' import unittest from transformers import AutoTokenizer, FalconConfig, is_torch_available from transformers.testing_utils import require_torch, slow, torch_device from ...generation.test_utils import GenerationTesterMixin from ...test_configuration_common import ConfigTester ...
69
1
'''simple docstring''' import os import pytest from datasets import ( get_dataset_config_info, get_dataset_config_names, get_dataset_infos, get_dataset_split_names, inspect_dataset, inspect_metric, ) A = pytest.mark.integration @pytest.mark.para...
721
from __future__ import annotations def __UpperCAmelCase ( __A ) -> list[int]: '''simple docstring''' UpperCAmelCase__ = [True] * limit UpperCAmelCase__ = False UpperCAmelCase__ = False Upper...
277
0
'''simple docstring''' from operator import delitem, getitem, setitem import pytest from data_structures.hashing.hash_map import HashMap def A_ ( snake_case ): return getitem, k def A_ ( snake_case , snake_case ): return setitem, k, v def A_ ( sna...
143
'''simple docstring''' def A_ ( snake_case , snake_case ): if a < 0 or b < 0: raise ValueError("the value of both inputs must be positive" ) SCREAMING_SNAKE_CASE:int = str(bin(snake_case ) )[2:] # remove the leading "0b" SCREAMING_SNAKE_CASE:Dict = str(bi...
143
1
import unittest from .lib import ( Matrix, Vector, axpy, square_zero_matrix, unit_basis_vector, zero_vector, ) class lowercase ( unittest.TestCase ): '''simple docstring''' def snake_case_ ( self ) -> None...
707
def _lowerCAmelCase ( A__: int , A__: int ): '''simple docstring''' if number < 0 or shift_amount < 0: raise ValueError('''both inputs must be positive integers''' ) UpperCAmelCase = str(bin(A__ ) ) binary_number += "0" * shift_amount ret...
391
0
from typing import TYPE_CHECKING from ...utils import ( OptionalDependencyNotAvailable, _LazyModule, is_flax_available, is_tf_available, is_torch_available, ) __a = {'configuration_vit_mae': ['VIT_MAE_PRETRAINED_CONFIG_ARCHIVE_MAP', 'ViTMAEConfig']} try: if not is...
97
from __future__ import annotations from math import ceil, floor, sqrt def A_ ( _UpperCAmelCase = 2_00_00_00 ): SCREAMING_SNAKE_CASE_: list[int] = [0] SCREAMING_SNAKE_CASE_: int for idx in range(1 , ceil(sqrt(target * 2 ) * 1.1 ) ...
671
0
import itertools from dataclasses import dataclass from typing import Optional import pandas as pd import pyarrow as pa import datasets from datasets.table import table_cast @dataclass class lowerCamelCase_ ( datasets.BuilderConfig ): '''simple docstring''' __UpperCAmelCase ...
710
from typing import List from ...configuration_utils import PretrainedConfig from ...utils import logging a : Any = logging.get_logger(__name__) a : int = { '''snap-research/efficientformer-l1-300''': ( '''https://huggingface.co/snap-research/efficientformer-l1-300/resolve/main/config.json''' ...
527
0
'''simple docstring''' import warnings from typing import Dict, List, Optional, Tuple from ...tokenization_utils import AddedToken, PreTrainedTokenizer from ...utils import logging __snake_case : Dict = logging.get_logger(__name__) class lowercase_ ( snake_case_ ): a_ = ["""inpu...
660
from typing import TYPE_CHECKING from ...utils import ( OptionalDependencyNotAvailable, _LazyModule, is_sentencepiece_available, is_torch_available, ) a_ = { 'configuration_speecht5': [ 'SPEECHT5_PRETRAINED_CONFIG_ARCHIVE_MAP', 'SPEECHT5_PRETRAINED_HIFIGAN_CONFIG_ARCHIV...
417
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 ...
718
"""simple docstring""" import re import tempfile from pathlib import Path import pytest import yaml from datasets.utils.readme import ReadMe # @pytest.fixture # def example_yaml_structure(): __lowerCamelCase = yaml.safe_load( "\\nname: \"\"\nallow_empty: false\nallow_empty_tex...
536
0