code
stringlengths
81
54k
code_codestyle
int64
0
721
style_context
stringlengths
91
41.9k
style_context_codestyle
int64
0
699
label
int64
0
1
'''simple docstring''' import argparse import json import torch from diffusers import DDPMScheduler, LDMPipeline, UNetaDModel, VQModel def lowercase__ ( __UpperCamelCase , __UpperCamelCase=1 )-> Tuple: if n_shave_prefix_segments >= 0: return "...
705
'''simple docstring''' import argparse import torch from torch import nn from transformers import MaMaaaConfig, MaMaaaForConditionalGeneration def lowercase__ ( __UpperCamelCase )-> Any: UpperCamelCase = [ """encoder.version""", ...
35
0
'''simple docstring''' 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_warm...
706
'''simple docstring''' import inspect import unittest from transformers import MobileNetVaConfig 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_configu...
35
0
'''simple docstring''' def lowercase__ ( __UpperCamelCase , __UpperCamelCase )-> int: while b: UpperCamelCase ,UpperCamelCase = b, a % b return a def lowercase__ ( __UpperCamelCase , __UpperCamelCase )-> ...
707
'''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, PNDM...
35
0
'''simple docstring''' import json from typing import List, Optional, Tuple from tokenizers import normalizers from ...tokenization_utils_base import BatchEncoding from ...tokenization_utils_fast import PreTrainedTokenizerFast from ...utils import PaddingStrategy, logging from .tokenization_r...
708
'''simple docstring''' from typing import TYPE_CHECKING from ...utils import _LazyModule SCREAMING_SNAKE_CASE__ = {'tokenization_wav2vec2_phoneme': ['Wav2Vec2PhonemeCTCTokenizer']} if TYPE_CHECKING: from .tokenization_wavaveca_phoneme import WavaVecaPhonemeCTCTokenizer ...
35
0
'''simple docstring''' import unittest from transformers import is_torch_available from transformers.testing_utils import require_sentencepiece, require_tokenizers, require_torch, slow if is_torch_available(): import torch from transformers import XLMRobertaModel @re...
709
'''simple docstring''' SCREAMING_SNAKE_CASE__ = 8.31_44_62 # Unit - J mol-1 K-1 def lowercase__ ( __UpperCamelCase , __UpperCamelCase , __UpperCamelCase )-> float: if moles < 0 or kelvin < 0 or volume < 0: raise ValueError("""Invalid ...
35
0
'''simple docstring''' import argparse from transformers import CLIPImageProcessor, CLIPVisionModelWithProjection from diffusers import UnCLIPImageVariationPipeline, UnCLIPPipeline if __name__ == "__main__": SCREAMING_SNAKE_CASE__ = argparse.ArgumentParser() parse...
710
'''simple docstring''' import argparse import os import evaluate import torch from datasets import load_dataset from torch.optim import AdamW from torch.utils.data import DataLoader from transformers import AutoModelForSequenceClassification, AutoTokenizer, get_linear_schedule_with_warmup, set...
35
0
'''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 AutoImageProcessor, ViTImageProcessor from transformers.test...
711
'''simple docstring''' import collections import inspect import unittest from typing import Dict, List, Tuple from transformers import MaskFormerSwinConfig from transformers.testing_utils import require_torch, require_torch_multi_gpu, torch_device from transformers.utils import is_torch_availab...
35
0
'''simple docstring''' import argparse import os import subprocess from packaging.version import Version, parse from accelerate.commands.config.config_args import default_config_file, load_config_from_file SCREAMING_SNAKE_CASE__ = 'Run commands across TPU VMs for initial setup before running `...
712
'''simple docstring''' import importlib.util import os import platform from argparse import ArgumentParser import huggingface_hub from .. import __version__ as version from ..utils import ( is_accelerate_available, is_flax_available, is_safetensors_available, is_tf_availab...
35
0
'''simple docstring''' import argparse import json import os import fairseq import torch from fairseq.data import Dictionary # Register SEW's fairseq modules from sew_asapp import tasks # noqa: F401 from transformers import ( SEWConfig, SEWForCTC, SEWModel, WavaVecaCTCTokenizer, ...
713
'''simple docstring''' from math import factorial def lowercase__ ( __UpperCamelCase = 20 )-> int: UpperCamelCase = 2 * n # middle entry of odd rows starting at row 3 is the solution for n = 1, # 2, 3,... UpperCamelCase ...
35
0
'''simple docstring''' import re import string from collections import Counter import sacrebleu import sacremoses from packaging import version import datasets SCREAMING_SNAKE_CASE__ = '\n@inproceedings{xu-etal-2016-optimizing,\n title = {Optimizing Statistical Machine T...
714
'''simple docstring''' from math import sqrt def lowercase__ ( __UpperCamelCase )-> int: UpperCamelCase = 0 for i in range(1 , int(sqrt(__UpperCamelCase ) + 1 ) ): if n % i == 0 and i != sqrt(__UpperCamelCase )...
35
0
'''simple docstring''' import unittest from knapsack import knapsack as k class a_ ( unittest.TestCase ): def A__ ( self ) -> List[str]: """simple docstring""" UpperCamelCase = 0 UpperC...
715
'''simple docstring''' from typing import TYPE_CHECKING from ...utils import ( OptionalDependencyNotAvailable, _LazyModule, is_torch_available, ) SCREAMING_SNAKE_CASE__ = { 'configuration_swiftformer': [ 'SWIFTFORMER_PRETRAINED_CONFIG_ARCHIVE_MAP', ...
35
0
'''simple docstring''' from transformers import FSMTTokenizer, FSMTConfig, FSMTForConditionalGeneration SCREAMING_SNAKE_CASE__ = 'facebook/wmt19-en-de' SCREAMING_SNAKE_CASE__ = FSMTTokenizer.from_pretrained(mname) # get the correct vocab sizes, etc. from the master model SCREAMING_S...
716
'''simple docstring''' def lowercase__ ( __UpperCamelCase )-> str: if not all(char in """01""" for char in bin_string ): raise ValueError("""Non-binary value was passed to the function""" ) if not bin_string: raise ValueError("""Empty str...
35
0
'''simple docstring''' import enum import os from hashlib import shaaaa from typing import Optional from .. import config from .logging import get_logger SCREAMING_SNAKE_CASE__ = get_logger(__name__) class a_ ( enum.Enum ): '''simple docstrin...
717
'''simple docstring''' # Copyright 2022 The HuggingFace Team. All rights reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/license...
35
0
'''simple docstring''' import darl # noqa import gym import tqdm from diffusers.experimental import ValueGuidedRLPipeline SCREAMING_SNAKE_CASE__ = { 'n_samples': 6_4, 'horizon': 3_2, 'num_inference_steps': 2_0, 'n_guide_steps': 2, # can set to 0 for faster samplin...
718
'''simple docstring''' def lowercase__ ( __UpperCamelCase , __UpperCamelCase )-> str: if not isinstance(__UpperCamelCase , __UpperCamelCase ): raise ValueError("""iterations must be defined as integers""" ) if not isinstance(__UpperCamelCase , __Up...
35
0
import argparse import math import traceback import dateutil.parser as date_parser import requests def lowercase__ ( __UpperCamelCase )-> Dict: UpperCamelCase = {} UpperCamelCase = job["""started_at"""] UpperCam...
719
'''simple docstring''' import argparse import json import torch from diffusers import DDPMScheduler, LDMPipeline, UNetaDModel, VQModel def lowercase__ ( __UpperCamelCase , __UpperCamelCase=1 )-> Tuple: if n_shave_prefix_segments >= 0: return "...
35
0
import collections import inspect import unittest from typing import Dict, List, Tuple from transformers import MaskFormerSwinConfig from transformers.testing_utils import require_torch, require_torch_multi_gpu, torch_device from transformers.utils import is_torch_available from ...test_backbon...
720
'''simple docstring''' from __future__ import annotations def lowercase__ ( __UpperCamelCase , __UpperCamelCase , __UpperCamelCase )-> dict[str, float]: if (voltage, current, resistance).count(0 ) != 1: raise ValueError("""One and only one argum...
35
0
'''simple docstring''' import argparse import glob import importlib.util import os import re import black from doc_builder.style_doc import style_docstrings_in_code # All paths are set with the intent you should run this script from the root of the repo with the command # python utils/check_copie...
721
'''simple docstring''' # This script creates a super tiny model that is useful inside tests, when we just want to test that # the machinery works, without needing to the check the quality of the outcomes. # # This version creates a tiny model through reduction of a normal pre-trained model, but keep...
35
0
'''simple docstring''' from cva import destroyAllWindows, imread, imshow, waitKey def lowercase__ ( __UpperCamelCase )-> Optional[int]: # getting number of pixels in the image UpperCamelCase ,UpperCamelCase = img.shape[0], img.shape[1]...
700
'''simple docstring''' import argparse from transformers import CLIPImageProcessor, CLIPVisionModelWithProjection from diffusers import UnCLIPImageVariationPipeline, UnCLIPPipeline if __name__ == "__main__": SCREAMING_SNAKE_CASE__ = argparse.ArgumentParser() parse...
35
0
'''simple docstring''' import argparse import os import evaluate import torch from datasets import load_dataset from torch.optim import AdamW from torch.utils.data import DataLoader from transformers import AutoModelForSequenceClassification, AutoTokenizer, get_linear_schedule_with_warmup, set...
701
'''simple docstring''' from __future__ import annotations from typing import Any class a_ : def __init__( self , _SCREAMING_SNAKE_CASE = 6 ) -> None: """simple docstring""" UpperCamelCase = None Upp...
35
0
'''simple docstring''' import contextlib from multiprocessing import Pool, RLock from tqdm.auto import tqdm from ..utils import experimental, logging SCREAMING_SNAKE_CASE__ = logging.get_logger(__name__) class a_ : lowercase = None @ex...
702
'''simple docstring''' import fire from utils import calculate_rouge, save_json def lowercase__ ( __UpperCamelCase , __UpperCamelCase , __UpperCamelCase=None , **__UpperCamelCase )-> int: UpperCamelCase = [x.strip() for x in open(__UpperCame...
35
0
from argparse import ArgumentParser from .env import EnvironmentCommand def lowercase__ ( )-> Any: UpperCamelCase = ArgumentParser("""Diffusers CLI tool""" , usage="""diffusers-cli <command> [<args>]""" ) UpperCamelCase = ...
703
'''simple docstring''' from __future__ import annotations def lowercase__ ( __UpperCamelCase , __UpperCamelCase , __UpperCamelCase )-> tuple[float, list[float]]: UpperCamelCase = list(range(len(__UpperCamelCase ) ) ) UpperCame...
35
0
'''simple docstring''' import gc import unittest from diffusers import FlaxDPMSolverMultistepScheduler, FlaxStableDiffusionPipeline from diffusers.utils import is_flax_available, slow from diffusers.utils.testing_utils import require_flax if is_flax_available(): import jax import...
704
'''simple docstring''' import copy from ...configuration_utils import PretrainedConfig from ...utils import logging from ..auto import CONFIG_MAPPING SCREAMING_SNAKE_CASE__ = logging.get_logger(__name__) SCREAMING_SNAKE_CASE__ = { 'SenseTime/deformable-detr...
35
0
'''simple docstring''' import inspect import unittest from transformers import DPTConfig from transformers.file_utils import is_torch_available, is_vision_available from transformers.models.auto import get_values from transformers.testing_utils import require_torch, require_vision, slow, torch_d...
705
'''simple docstring''' import argparse import torch from torch import nn from transformers import MaMaaaConfig, MaMaaaForConditionalGeneration def lowercase__ ( __UpperCamelCase )-> Any: UpperCamelCase = [ """encoder.version""", ...
35
0
'''simple docstring''' from ..utils import DummyObject, requires_backends class a_ ( metaclass=lowerCamelCase ): lowercase = ["""speech"""] def __init__( self , *_SCREAMING_SNAKE_CASE , **_SCREAMING_SNAKE_CASE ) -> Tuple: "...
706
'''simple docstring''' import inspect import unittest from transformers import MobileNetVaConfig 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_configu...
35
0
'''simple docstring''' from sklearn.metrics import recall_score import datasets SCREAMING_SNAKE_CASE__ = '\nRecall is the fraction of the positive examples that were correctly labeled by the model as positive. It can be computed with the equation:\nRecall = TP / (TP + FN)\nWhere T...
707
'''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, PNDM...
35
0
'''simple docstring''' from typing import TYPE_CHECKING from ...utils import ( OptionalDependencyNotAvailable, _LazyModule, is_tf_available, is_torch_available, is_vision_available, ) SCREAMING_SNAKE_CASE__ = { 'configuration_blip': [ 'BLIP_...
708
'''simple docstring''' from typing import TYPE_CHECKING from ...utils import _LazyModule SCREAMING_SNAKE_CASE__ = {'tokenization_wav2vec2_phoneme': ['Wav2Vec2PhonemeCTCTokenizer']} if TYPE_CHECKING: from .tokenization_wavaveca_phoneme import WavaVecaPhonemeCTCTokenizer ...
35
0
'''simple docstring''' from typing import TYPE_CHECKING from ...utils import ( OptionalDependencyNotAvailable, _LazyModule, is_flax_available, is_sentencepiece_available, is_tf_available, is_tokenizers_available, is_torch_available, ) SCREAMING_SNAKE_CASE__ ...
709
'''simple docstring''' SCREAMING_SNAKE_CASE__ = 8.31_44_62 # Unit - J mol-1 K-1 def lowercase__ ( __UpperCamelCase , __UpperCamelCase , __UpperCamelCase )-> float: if moles < 0 or kelvin < 0 or volume < 0: raise ValueError("""Invalid ...
35
0
'''simple docstring''' import warnings from ...utils import logging from .image_processing_deformable_detr import DeformableDetrImageProcessor SCREAMING_SNAKE_CASE__ = logging.get_logger(__name__) class a_ ( lowerCamelCase ): def __init__( sel...
710
'''simple docstring''' import argparse import os import evaluate import torch from datasets import load_dataset from torch.optim import AdamW from torch.utils.data import DataLoader from transformers import AutoModelForSequenceClassification, AutoTokenizer, get_linear_schedule_with_warmup, set...
35
0
'''simple docstring''' class a_ : def __init__( self , _SCREAMING_SNAKE_CASE ) -> List[Any]: """simple docstring""" UpperCamelCase = arr.split(""",""" ) def A__ ( self ) -> Optional[int]: ...
711
'''simple docstring''' import collections import inspect import unittest from typing import Dict, List, Tuple from transformers import MaskFormerSwinConfig from transformers.testing_utils import require_torch, require_torch_multi_gpu, torch_device from transformers.utils import is_torch_availab...
35
0
'''simple docstring''' def lowercase__ ( __UpperCamelCase , __UpperCamelCase )-> str: if a < 0 or b < 0: raise ValueError("""the value of both inputs must be positive""" ) UpperCamelCase = str(bin(__UpperCamelCase ) )[2:] # remove the lead...
712
'''simple docstring''' import importlib.util import os import platform from argparse import ArgumentParser import huggingface_hub from .. import __version__ as version from ..utils import ( is_accelerate_available, is_flax_available, is_safetensors_available, is_tf_availab...
35
0
'''simple docstring''' import unittest import numpy as np from transformers import MODEL_FOR_AUDIO_CLASSIFICATION_MAPPING, TF_MODEL_FOR_AUDIO_CLASSIFICATION_MAPPING from transformers.pipelines import AudioClassificationPipeline, pipeline from transformers.testing_utils import ( is_pipeline_test, ne...
713
'''simple docstring''' from math import factorial def lowercase__ ( __UpperCamelCase = 20 )-> int: UpperCamelCase = 2 * n # middle entry of odd rows starting at row 3 is the solution for n = 1, # 2, 3,... UpperCamelCase ...
35
0
'''simple docstring''' from transformers import BertTokenizerFast from .custom_tokenization import CustomTokenizer class a_ ( lowerCamelCase ): lowercase = CustomTokenizer pass
714
'''simple docstring''' from math import sqrt def lowercase__ ( __UpperCamelCase )-> int: UpperCamelCase = 0 for i in range(1 , int(sqrt(__UpperCamelCase ) + 1 ) ): if n % i == 0 and i != sqrt(__UpperCamelCase )...
35
0
'''simple docstring''' import numpy as np class a_ : def __init__( self , _SCREAMING_SNAKE_CASE=None , _SCREAMING_SNAKE_CASE=None , _SCREAMING_SNAKE_CASE=None , _SCREAMING_SNAKE_CASE=None , _SCREAMING_SNAKE_CASE=None ) -> Optional[Any]: ...
715
'''simple docstring''' from typing import TYPE_CHECKING from ...utils import ( OptionalDependencyNotAvailable, _LazyModule, is_torch_available, ) SCREAMING_SNAKE_CASE__ = { 'configuration_swiftformer': [ 'SWIFTFORMER_PRETRAINED_CONFIG_ARCHIVE_MAP', ...
35
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...
716
'''simple docstring''' def lowercase__ ( __UpperCamelCase )-> str: if not all(char in """01""" for char in bin_string ): raise ValueError("""Non-binary value was passed to the function""" ) if not bin_string: raise ValueError("""Empty str...
35
0
'''simple docstring''' def lowercase__ ( __UpperCamelCase , __UpperCamelCase , __UpperCamelCase )-> int: if exponent == 1: return base if exponent % 2 == 0: UpperCamelCase = _modexpt(__UpperCamelCase , exponent // 2 , __Upp...
717
'''simple docstring''' # Copyright 2022 The HuggingFace Team. All rights reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/license...
35
0
'''simple docstring''' from typing import TYPE_CHECKING from ...utils import ( OptionalDependencyNotAvailable, _LazyModule, is_torch_available, ) SCREAMING_SNAKE_CASE__ = { 'configuration_swiftformer': [ 'SWIFTFORMER_PRETRAINED_CONFIG_ARCHIVE_MAP', ...
718
'''simple docstring''' def lowercase__ ( __UpperCamelCase , __UpperCamelCase )-> str: if not isinstance(__UpperCamelCase , __UpperCamelCase ): raise ValueError("""iterations must be defined as integers""" ) if not isinstance(__UpperCamelCase , __Up...
35
0
import argparse from torch import nn # transformers_old should correspond to branch `save_old_prophetnet_model_structure` here # original prophetnet_checkpoints are saved under `patrickvonplaten/..._old` respectively from transformers_old.modeling_prophetnet import ( ProphetNetForConditionalG...
719
'''simple docstring''' import argparse import json import torch from diffusers import DDPMScheduler, LDMPipeline, UNetaDModel, VQModel def lowercase__ ( __UpperCamelCase , __UpperCamelCase=1 )-> Tuple: if n_shave_prefix_segments >= 0: return "...
35
0
from __future__ import annotations def lowercase__ ( __UpperCamelCase )-> None: create_state_space_tree(__UpperCamelCase , [] , 0 , [0 for i in range(len(__UpperCamelCase ) )] ) def lowercase__ ( __UpperCamelCase , __UpperCame...
720
'''simple docstring''' from __future__ import annotations def lowercase__ ( __UpperCamelCase , __UpperCamelCase , __UpperCamelCase )-> dict[str, float]: if (voltage, current, resistance).count(0 ) != 1: raise ValueError("""One and only one argum...
35
0
'''simple docstring''' from unittest.mock import patch import pyspark from datasets.packaged_modules.spark.spark import ( Spark, SparkExamplesIterable, _generate_iterable_examples, ) from ..utils import ( require_dill_gt_0_3_2, require_not_windows, ) def ...
721
'''simple docstring''' # This script creates a super tiny model that is useful inside tests, when we just want to test that # the machinery works, without needing to the check the quality of the outcomes. # # This version creates a tiny model through reduction of a normal pre-trained model, but keep...
35
0
"""simple docstring""" from .imports import is_rich_available if is_rich_available(): from rich.traceback import install install(show_locals=False) else: raise ModuleNotFoundError("""To use the rich extension, install rich with `pip install rich`""")
36
"""simple docstring""" from collections import Counter from pathlib import Path from typing import Optional, Tuple import yaml class a ( yaml.SafeLoader ): def lowerCamelCase__ ( self : int , lowerCAmelCase : List[str] ) -> Optional[Any]: ...
36
1
"""simple docstring""" import json import os import unittest from transformers import MgpstrTokenizer from transformers.models.mgp_str.tokenization_mgp_str import VOCAB_FILES_NAMES from transformers.testing_utils import require_tokenizers from ...test_tokenization_common import TokenizerTesterMixin ...
36
"""simple docstring""" import numpy as np from matplotlib import pyplot as plt from sklearn.datasets import load_iris from sklearn.metrics import ConfusionMatrixDisplay from sklearn.model_selection import train_test_split from xgboost import XGBClassifier def __magic_name__ ( lowe...
36
1
"""simple docstring""" import unittest import numpy as np import torch from diffusers import ScoreSdeVePipeline, ScoreSdeVeScheduler, UNetaDModel from diffusers.utils.testing_utils import enable_full_determinism, require_torch, slow, torch_device enable_full_determinism() class a ( unittest...
36
"""simple docstring""" from typing import Dict import numpy as np import torch from . import residue_constants as rc from .tensor_utils import tensor_tree_map, tree_map def __magic_name__ ( lowercase ): SCREAMING_SNAKE_CASE_: Optional[Any] =[] SCREAMING_SNAKE_CAS...
36
1
"""simple docstring""" from ...configuration_utils import PretrainedConfig from ...utils import logging from ...utils.backbone_utils import BackboneConfigMixin, get_aligned_output_features_output_indices _UpperCAmelCase = logging.get_logger(__name__) _UpperCAmelCase = { """facebook/c...
36
"""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 ...
36
1
"""simple docstring""" from math import factorial _UpperCAmelCase = {str(d): factorial(d) for d in range(1_0)} def __magic_name__ ( lowercase ): return sum(DIGIT_FACTORIAL[d] for d in str(lowercase ) ) def __magic_name__ ( ): SCREAMING_SNAKE_CA...
36
"""simple docstring""" from __future__ import annotations def __magic_name__ ( lowercase , lowercase ): SCREAMING_SNAKE_CASE_: List[Any] =sorted(numsa + numsa ) SCREAMING_SNAKE_CASE_ , SCREAMING_SNAKE_CASE_: Tuple =divmod(len(lowercase ) , 2 ) ...
36
1
"""simple docstring""" import copy from typing import TYPE_CHECKING, Any, Mapping, Optional, OrderedDict from packaging import version from ...configuration_utils import PretrainedConfig from ...onnx import OnnxConfig from ...utils import logging from ..auto.configuration_auto import AutoConfig ...
36
"""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_avail...
36
1
"""simple docstring""" import json import os from collections import Counter import torch import torchvision import torchvision.transforms as transforms from PIL import Image from torch import nn from torch.utils.data import Dataset _UpperCAmelCase = {1: (1, 1), 2: (2, 1), 3: (3, 1), 4: (2...
36
"""simple docstring""" from math import pi def __magic_name__ ( lowercase , lowercase ): return 2 * pi * radius * (angle / 360) if __name__ == "__main__": print(arc_length(9_0, 1_0))
36
1
"""simple docstring""" from __future__ import annotations import collections import pprint from pathlib import Path def __magic_name__ ( lowercase ): return "".join(sorted(lowercase ) ) def __magic_name__ ( lowercase ): return word_by_signature[sig...
36
"""simple docstring""" import gc import unittest from diffusers import FlaxDPMSolverMultistepScheduler, FlaxStableDiffusionPipeline from diffusers.utils import is_flax_available, slow from diffusers.utils.testing_utils import require_flax if is_flax_available(): import jax import jax.numpy a...
36
1
"""simple docstring""" import json import os from pathlib import Path from shutil import copyfile from typing import Any, Dict, List, Optional, Tuple, Union import sentencepiece from ...tokenization_utils import PreTrainedTokenizer from ...utils import logging _UpperCAmelCase = logging.ge...
36
"""simple docstring""" def __magic_name__ ( lowercase = 200_0000 ): SCREAMING_SNAKE_CASE_: List[Any] =[0 for i in range(n + 1 )] SCREAMING_SNAKE_CASE_: Union[str, Any] =1 SCREAMING_SNAKE_CASE_: Optional[Any] =1 for i in range(2 , int(n**0.5 ) + 1 ): ...
36
1
"""simple docstring""" import argparse import logging import sys from unittest.mock import patch import run_glue_deebert from transformers.testing_utils import TestCasePlus, get_gpu_count, require_torch_non_multi_gpu, slow logging.basicConfig(level=logging.DEBUG) _UpperCAmelCase = loggin...
36
"""simple docstring""" import argparse import torch from transformers import BertForMaskedLM if __name__ == "__main__": _UpperCAmelCase = argparse.ArgumentParser( description=( """Extraction some layers of the full BertForMaskedLM or RObertaForMaskedLM for Transfer Lear...
36
1
"""simple docstring""" import copy from dataclasses import dataclass, field from typing import ClassVar, Dict from ..features import ClassLabel, Features, Image from .base import TaskTemplate @dataclass(frozen=UpperCAmelCase__ ) class a ( UpperCAmelCase__ ): UpperCamelCase : str...
36
"""simple docstring""" def __magic_name__ ( lowercase , lowercase ): return int((input_a, input_a).count(0 ) == 0 ) def __magic_name__ ( ): assert and_gate(0 , 0 ) == 0 assert and_gate(0 , 1 ) == 0 assert and_gate(1 , 0 ) ==...
36
1
"""simple docstring""" from __future__ import annotations import json import requests from bsa import BeautifulSoup from fake_useragent import UserAgent _UpperCAmelCase = {"""UserAgent""": UserAgent().random} def __magic_name__ ( lowercase ): SCREAMING_SNAKE_CASE_:...
36
"""simple docstring""" import argparse import numpy as np import torch from transformers import SpeechTaHifiGan, SpeechTaHifiGanConfig, logging logging.set_verbosity_info() _UpperCAmelCase = logging.get_logger("""transformers.models.speecht5""") def __magic_name__ ( ...
36
1
"""simple docstring""" import warnings from diffusers import StableDiffusionImgaImgPipeline # noqa F401 warnings.warn( """The `image_to_image.py` script is outdated. Please use directly `from diffusers import""" """ StableDiffusionImg2ImgPipeline` instead.""" )
36
"""simple docstring""" import argparse import requests import torch from PIL import Image from transformers import ViTMAEConfig, ViTMAEForPreTraining, ViTMAEImageProcessor def __magic_name__ ( lowercase ): if "cls_token" in name: SCREAMING_SNAKE_CASE_: Optional[int] ...
36
1
"""simple docstring""" import gc import random import tempfile import unittest import numpy as np import torch from transformers import CLIPTextConfig, CLIPTextModel, CLIPTokenizer from diffusers import AutoencoderKL, DDIMScheduler, LMSDiscreteScheduler, PNDMScheduler, UNetaDConditionModel from dif...
36
"""simple docstring""" from typing import TYPE_CHECKING from ...utils import OptionalDependencyNotAvailable, _LazyModule, is_tf_available, is_torch_available _UpperCAmelCase = { """configuration_xlm""": ["""XLM_PRETRAINED_CONFIG_ARCHIVE_MAP""", """XLMConfig""", """XLMOnnxConfig"""], """...
36
1
"""simple docstring""" # Usage: # ./gen-card-facebook-wmt19.py import os from pathlib import Path def __magic_name__ ( lowercase , lowercase , lowercase ): SCREAMING_SNAKE_CASE_: Tuple ={ """en""": """Machine learning is great, isn't it?""", ...
36
"""simple docstring""" def __magic_name__ ( lowercase ): SCREAMING_SNAKE_CASE_: int =False while is_sorted is False: # Until all the indices are traversed keep looping SCREAMING_SNAKE_CASE_: Tuple =True for i in range(0 , len(lowercase ) - 1 , ...
36
1
"""simple docstring""" import argparse import pytorch_lightning as pl import torch from torch import nn from transformers import LongformerForQuestionAnswering, LongformerModel class a ( pl.LightningModule ): def __init__( self : List[Any] , lowerCAmelCase : Li...
36
"""simple docstring""" def __magic_name__ ( lowercase ): return str(lowercase ) == str(lowercase )[::-1] def __magic_name__ ( lowercase ): return int(lowercase ) + int(str(lowercase )[::-1] ) def __magic_name__ ( lowercase = 1_0000 ): ...
36
1
"""simple docstring""" import argparse import os from pathlib import Path from typing import Dict import tensorflow as tf import torch from tqdm import tqdm from transformers import PegasusConfig, PegasusForConditionalGeneration, PegasusTokenizer from transformers.models.pegasus.configuration_pegas...
36
"""simple docstring""" from typing import TYPE_CHECKING from ...file_utils import _LazyModule, is_tokenizers_available, is_torch_available, is_vision_available from ...utils import OptionalDependencyNotAvailable _UpperCAmelCase = {"""configuration_dpt""": ["""DPT_PRETRAINED_CONFIG_ARCHIVE_MAP"""...
36
1
"""simple docstring""" import os import sys _UpperCAmelCase = os.path.join(os.path.dirname(__file__), """src""") sys.path.append(SRC_DIR) from transformers import ( AutoConfig, AutoModel, AutoModelForCausalLM, AutoModelForMaskedLM, AutoModelForQuestionAnswering, Au...
36
"""simple docstring""" from __future__ import annotations import math import random from typing import Any class a : def __init__( self : str ) -> None: '''simple docstring''' SCREAMING_SNAKE_CASE_: list[Any] =[] SCREAMING_SNAKE_CASE_: ...
36
1
"""simple docstring""" from typing import TYPE_CHECKING from ...file_utils import _LazyModule, is_tokenizers_available, is_torch_available, is_vision_available from ...utils import OptionalDependencyNotAvailable _UpperCAmelCase = {"""configuration_dpt""": ["""DPT_PRETRAINED_CONFIG_ARCHIVE_MAP"""...
36
"""simple docstring""" import string def __magic_name__ ( lowercase ): SCREAMING_SNAKE_CASE_: List[Any] ="""""" for i in sequence: SCREAMING_SNAKE_CASE_: List[Any] =ord(lowercase ) if 65 <= extract <= 90: output += chr(155 - extract ) ...
36
1
"""simple docstring""" import argparse import json import requests import torch from huggingface_hub import hf_hub_download from PIL import Image from transformers import ConvNextConfig, SegformerImageProcessor, UperNetConfig, UperNetForSemanticSegmentation def __magic_name__ ( ...
36
"""simple docstring""" import numpy as np import torch from torch.utils.data import DataLoader from accelerate.utils.dataclasses import DistributedType class a : def __init__( self : Union[str, Any] , lowerCAmelCase : List[str]=2 , lowerCAmelCase : int=3 ...
36
1
"""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 D...
36
"""simple docstring""" def __magic_name__ ( lowercase ): if upper_limit < 0: raise ValueError("""Limit for the Catalan sequence must be ≥ 0""" ) SCREAMING_SNAKE_CASE_: Tuple =[0] * (upper_limit + 1) # Base case: C(0) = C(1) = 1 SCREAMING_SNAKE_CASE_: Any =...
36
1
"""simple docstring""" from manim import * class a ( UpperCAmelCase__ ): def lowerCamelCase__ ( self : Union[str, Any] ) -> List[Any]: '''simple docstring''' SCREAMING_SNAKE_CASE_: Union[str, Any] =Rectangle(height=0.5 , width...
36
"""simple docstring""" from collections import OrderedDict from typing import Mapping from ...configuration_utils import PretrainedConfig from ...onnx import OnnxConfig _UpperCAmelCase = { """albert-base-v1""": """https://huggingface.co/albert-base-v1/resolve/main/config.json""", """a...
36
1
"""simple docstring""" import argparse import numpy as np import torch from transformers import SpeechTaHifiGan, SpeechTaHifiGanConfig, logging logging.set_verbosity_info() _UpperCAmelCase = logging.get_logger("""transformers.models.speecht5""") def __magic_name__ ( ...
36
"""simple docstring""" from collections import Counter from pathlib import Path from typing import Optional, Tuple import yaml class a ( yaml.SafeLoader ): def lowerCamelCase__ ( self : int , lowerCAmelCase : List[str] ) -> Optional[Any]: ...
36
1
"""simple docstring""" from typing import TYPE_CHECKING from ...utils import _LazyModule _UpperCAmelCase = {"""tokenization_bertweet""": ["""BertweetTokenizer"""]} if TYPE_CHECKING: from .tokenization_bertweet import BertweetTokenizer else: import sys _UpperCAmelCase = ...
36
"""simple docstring""" import numpy as np from matplotlib import pyplot as plt from sklearn.datasets import load_iris from sklearn.metrics import ConfusionMatrixDisplay from sklearn.model_selection import train_test_split from xgboost import XGBClassifier def __magic_name__ ( lowe...
36
1
"""simple docstring""" import torch import torch.nn as nn from transformers.modeling_utils import ModuleUtilsMixin from transformers.models.ta.modeling_ta import TaBlock, TaConfig, TaLayerNorm from ...configuration_utils import ConfigMixin, register_to_config from ...models import ModelMixin class ...
36
"""simple docstring""" from typing import Dict import numpy as np import torch from . import residue_constants as rc from .tensor_utils import tensor_tree_map, tree_map def __magic_name__ ( lowercase ): SCREAMING_SNAKE_CASE_: Optional[Any] =[] SCREAMING_SNAKE_CAS...
36
1
"""simple docstring""" def __magic_name__ ( lowercase ): return str(lowercase ) == str(lowercase )[::-1] def __magic_name__ ( lowercase ): return int(lowercase ) + int(str(lowercase )[::-1] ) def __magic_name__ ( lowercase = 1_0000 ): ...
36
"""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 ...
36
1
"""simple docstring""" _UpperCAmelCase = {} def __magic_name__ ( lowercase , lowercase , lowercase ): # if we are absent twice, or late 3 consecutive days, # no further prize strings are possible if late == 3 or absent == 2: return 0 # i...
36
"""simple docstring""" from __future__ import annotations def __magic_name__ ( lowercase , lowercase ): SCREAMING_SNAKE_CASE_: List[Any] =sorted(numsa + numsa ) SCREAMING_SNAKE_CASE_ , SCREAMING_SNAKE_CASE_: Tuple =divmod(len(lowercase ) , 2 ) ...
36
1
"""simple docstring""" from argparse import ArgumentParser from ..pipelines import Pipeline, PipelineDataFormat, get_supported_tasks, pipeline from ..utils import logging from . import BaseTransformersCLICommand _UpperCAmelCase = logging.get_logger(__name__) # pylint: disable=invalid-name ...
36
"""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_avail...
36
1
"""simple docstring""" import math import random def __magic_name__ ( lowercase , lowercase = False ): if deriv: return value * (1 - value) return 1 / (1 + math.exp(-value )) # Initial Value _UpperCAmelCase = 0.0_2 def __magic_name__ ...
36
"""simple docstring""" from math import pi def __magic_name__ ( lowercase , lowercase ): return 2 * pi * radius * (angle / 360) if __name__ == "__main__": print(arc_length(9_0, 1_0))
36
1
"""simple docstring""" import math from typing import Optional import numpy as np from ...configuration_utils import PretrainedConfig from ...utils import logging _UpperCAmelCase = logging.get_logger(__name__) _UpperCAmelCase = { """facebook/encodec_24khz""": """https://hugging...
36
"""simple docstring""" import gc import unittest from diffusers import FlaxDPMSolverMultistepScheduler, FlaxStableDiffusionPipeline from diffusers.utils import is_flax_available, slow from diffusers.utils.testing_utils import require_flax if is_flax_available(): import jax import jax.numpy a...
36
1
"""simple docstring""" import inspect import unittest class a ( unittest.TestCase ): def lowerCamelCase__ ( self : Any ) -> Any: '''simple docstring''' try: import diffusers # noqa: F401 except ImportError: assert ...
36
"""simple docstring""" def __magic_name__ ( lowercase = 200_0000 ): SCREAMING_SNAKE_CASE_: List[Any] =[0 for i in range(n + 1 )] SCREAMING_SNAKE_CASE_: Union[str, Any] =1 SCREAMING_SNAKE_CASE_: Optional[Any] =1 for i in range(2 , int(n**0.5 ) + 1 ): ...
36
1
"""simple docstring""" import torch from torch import nn from ...configuration_utils import ConfigMixin, register_to_config from ...models import ModelMixin class a ( UpperCAmelCase__ , UpperCAmelCase__ ): @register_to_config def __init__( self : Dict , *, ...
36
"""simple docstring""" import argparse import torch from transformers import BertForMaskedLM if __name__ == "__main__": _UpperCAmelCase = argparse.ArgumentParser( description=( """Extraction some layers of the full BertForMaskedLM or RObertaForMaskedLM for Transfer Lear...
36
1
"""simple docstring""" import unittest from transformers import JukeboxTokenizer from transformers.testing_utils import require_torch class a ( unittest.TestCase ): UpperCamelCase : List[str] = JukeboxTokenizer UpperCamelCase : Union[str, Any] = { ...
36
"""simple docstring""" def __magic_name__ ( lowercase , lowercase ): return int((input_a, input_a).count(0 ) == 0 ) def __magic_name__ ( ): assert and_gate(0 , 0 ) == 0 assert and_gate(0 , 1 ) == 0 assert and_gate(1 , 0 ) ==...
36
1
"""simple docstring""" import warnings from ...configuration_utils import PretrainedConfig from ...utils import logging _UpperCAmelCase = logging.get_logger(__name__) _UpperCAmelCase = { """xlnet-base-cased""": """https://huggingface.co/xlnet-base-cased/resolve/main/config.json""",...
36
"""simple docstring""" import argparse import numpy as np import torch from transformers import SpeechTaHifiGan, SpeechTaHifiGanConfig, logging logging.set_verbosity_info() _UpperCAmelCase = logging.get_logger("""transformers.models.speecht5""") def __magic_name__ ( ...
36
1
"""simple docstring""" from typing import TYPE_CHECKING from ...utils import ( OptionalDependencyNotAvailable, _LazyModule, is_flax_available, is_tf_available, is_tokenizers_available, is_torch_available, is_vision_available, ) _UpperCAmelCase = { """confi...
36
"""simple docstring""" import argparse import requests import torch from PIL import Image from transformers import ViTMAEConfig, ViTMAEForPreTraining, ViTMAEImageProcessor def __magic_name__ ( lowercase ): if "cls_token" in name: SCREAMING_SNAKE_CASE_: Optional[int] ...
36
1
"""simple docstring""" import contextlib import os import sqlitea import pytest from datasets import Dataset, Features, Value from datasets.io.sql import SqlDatasetReader, SqlDatasetWriter from ..utils import assert_arrow_memory_doesnt_increase, assert_arrow_memory_increases, require_sqlalchemy ...
36
"""simple docstring""" from typing import TYPE_CHECKING from ...utils import OptionalDependencyNotAvailable, _LazyModule, is_tf_available, is_torch_available _UpperCAmelCase = { """configuration_xlm""": ["""XLM_PRETRAINED_CONFIG_ARCHIVE_MAP""", """XLMConfig""", """XLMOnnxConfig"""], """...
36
1
"""simple docstring""" from .constants import ( MODEL_NAME, OPTIMIZER_NAME, RNG_STATE_NAME, SAFE_WEIGHTS_INDEX_NAME, SAFE_WEIGHTS_NAME, SCALER_NAME, SCHEDULER_NAME, TORCH_LAUNCH_PARAMS, WEIGHTS_INDEX_NAME, WEIGHTS_NAME, ) from .dataclasses import ( BnbQu...
36
"""simple docstring""" def __magic_name__ ( lowercase ): SCREAMING_SNAKE_CASE_: int =False while is_sorted is False: # Until all the indices are traversed keep looping SCREAMING_SNAKE_CASE_: Tuple =True for i in range(0 , len(lowercase ) - 1 , ...
36
1
"""simple docstring""" class a : def __init__( self : Tuple ) -> None: '''simple docstring''' SCREAMING_SNAKE_CASE_: dict[str, TrieNode] ={} # Mapping from char to TrieNode SCREAMING_SNAKE_CASE_: List[Any] =False def lowerCa...
36
"""simple docstring""" def __magic_name__ ( lowercase ): return str(lowercase ) == str(lowercase )[::-1] def __magic_name__ ( lowercase ): return int(lowercase ) + int(str(lowercase )[::-1] ) def __magic_name__ ( lowercase = 1_0000 ): ...
36
1
"""simple docstring""" import numpy as np import torch from torch.utils.data import DataLoader from accelerate.utils.dataclasses import DistributedType class a : def __init__( self : Union[str, Any] , lowerCAmelCase : List[str]=2 , lowerCAmelCase : int=3 ...
36
"""simple docstring""" from typing import TYPE_CHECKING from ...file_utils import _LazyModule, is_tokenizers_available, is_torch_available, is_vision_available from ...utils import OptionalDependencyNotAvailable _UpperCAmelCase = {"""configuration_dpt""": ["""DPT_PRETRAINED_CONFIG_ARCHIVE_MAP"""...
36
1
"""simple docstring""" def __magic_name__ ( lowercase ): if isinstance(lowercase , lowercase ): raise TypeError("""'float' object cannot be interpreted as an integer""" ) if isinstance(lowercase , lowercase ): raise TypeError("""'str' object cannot be inter...
36
"""simple docstring""" from __future__ import annotations import math import random from typing import Any class a : def __init__( self : str ) -> None: '''simple docstring''' SCREAMING_SNAKE_CASE_: list[Any] =[] SCREAMING_SNAKE_CASE_: ...
36
1
"""simple docstring""" from ...configuration_utils import PretrainedConfig from ...utils import logging _UpperCAmelCase = logging.get_logger(__name__) class a ( UpperCAmelCase__ ): UpperCamelCase : List[Any] = 'timm_backbone' def __init__( self : T...
36
"""simple docstring""" import string def __magic_name__ ( lowercase ): SCREAMING_SNAKE_CASE_: List[Any] ="""""" for i in sequence: SCREAMING_SNAKE_CASE_: List[Any] =ord(lowercase ) if 65 <= extract <= 90: output += chr(155 - extract ) ...
36
1
"""simple docstring""" from __future__ import annotations from math import gcd def __magic_name__ ( lowercase , lowercase = 2 , lowercase = 1 , lowercase = 3 , ): # A value less than 2 can cause an infinite loop in the algorithm. if num < 2: ...
36
"""simple docstring""" import numpy as np import torch from torch.utils.data import DataLoader from accelerate.utils.dataclasses import DistributedType class a : def __init__( self : Union[str, Any] , lowerCAmelCase : List[str]=2 , lowerCAmelCase : int=3 ...
36
1
"""simple docstring""" def __magic_name__ ( lowercase , lowercase ): return int((input_a, input_a).count(0 ) == 0 ) def __magic_name__ ( ): assert and_gate(0 , 0 ) == 0 assert and_gate(0 , 1 ) == 0 assert and_gate(1 , 0 ) ==...
36
"""simple docstring""" def __magic_name__ ( lowercase ): if upper_limit < 0: raise ValueError("""Limit for the Catalan sequence must be ≥ 0""" ) SCREAMING_SNAKE_CASE_: Tuple =[0] * (upper_limit + 1) # Base case: C(0) = C(1) = 1 SCREAMING_SNAKE_CASE_: Any =...
36
1
"""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_transform...
36
"""simple docstring""" from collections import OrderedDict from typing import Mapping from ...configuration_utils import PretrainedConfig from ...onnx import OnnxConfig _UpperCAmelCase = { """albert-base-v1""": """https://huggingface.co/albert-base-v1/resolve/main/config.json""", """a...
36
1
"""simple docstring""" import os import pytest from attr import dataclass _UpperCAmelCase = """us-east-1""" # defaults region @dataclass class a : UpperCamelCase : str UpperCamelCase : List[Any] = 'arn:aws:iam::558105141721:role/sagemaker_execution_role' Uppe...
36
"""simple docstring""" from collections import Counter from pathlib import Path from typing import Optional, Tuple import yaml class a ( yaml.SafeLoader ): def lowerCamelCase__ ( self : int , lowerCAmelCase : List[str] ) -> Optional[Any]: ...
36
1
"""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 ...
36
"""simple docstring""" import numpy as np from matplotlib import pyplot as plt from sklearn.datasets import load_iris from sklearn.metrics import ConfusionMatrixDisplay from sklearn.model_selection import train_test_split from xgboost import XGBClassifier def __magic_name__ ( lowe...
36
1
"""simple docstring""" import timeit import numpy as np import datasets from datasets.arrow_writer import ArrowWriter from datasets.features.features import _ArrayXD def __magic_name__ ( lowercase ): def wrapper(*lowercase , **lowercase ): SCREAMING_SNAKE_CAS...
36
"""simple docstring""" from typing import Dict import numpy as np import torch from . import residue_constants as rc from .tensor_utils import tensor_tree_map, tree_map def __magic_name__ ( lowercase ): SCREAMING_SNAKE_CASE_: Optional[Any] =[] SCREAMING_SNAKE_CAS...
36
1
"""simple docstring""" from collections import OrderedDict from typing import Mapping from ...configuration_utils import PretrainedConfig from ...onnx import OnnxConfig _UpperCAmelCase = { """albert-base-v1""": """https://huggingface.co/albert-base-v1/resolve/main/config.json""", """a...
36
"""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 ...
36
1
"""simple docstring""" from typing import TYPE_CHECKING from ...utils import ( OptionalDependencyNotAvailable, _LazyModule, is_flax_available, is_tf_available, is_tokenizers_available, is_torch_available, ) _UpperCAmelCase = { """configuration_roformer""": ["""...
36
"""simple docstring""" from __future__ import annotations def __magic_name__ ( lowercase , lowercase ): SCREAMING_SNAKE_CASE_: List[Any] =sorted(numsa + numsa ) SCREAMING_SNAKE_CASE_ , SCREAMING_SNAKE_CASE_: Tuple =divmod(len(lowercase ) , 2 ) ...
36
1
"""simple docstring""" 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 #...
36
"""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_avail...
36
1
"""simple docstring""" from queue import PriorityQueue from typing import Any import numpy as np def __magic_name__ ( lowercase , lowercase , lowercase , lowercase , lowercase , lowercase , lowercase , lowercase , lowe...
36
"""simple docstring""" from math import pi def __magic_name__ ( lowercase , lowercase ): return 2 * pi * radius * (angle / 360) if __name__ == "__main__": print(arc_length(9_0, 1_0))
36
1
"""simple docstring""" import argparse import logging import os import sys import numpy as np import onnxruntime import torch from bart_onnx.generation_onnx import BARTBeamSearchGenerator from bart_onnx.reduce_onnx_size import remove_dup_initializers import transformers from transformers import B...
36
"""simple docstring""" import gc import unittest from diffusers import FlaxDPMSolverMultistepScheduler, FlaxStableDiffusionPipeline from diffusers.utils import is_flax_available, slow from diffusers.utils.testing_utils import require_flax if is_flax_available(): import jax import jax.numpy a...
36
1
"""simple docstring""" from . import ( albert, align, altclip, audio_spectrogram_transformer, auto, autoformer, bark, bart, barthez, bartpho, beit, bert, bert_generation, bert_japanese, bertweet, big_bird, bigbird_pegasus, ...
36
"""simple docstring""" def __magic_name__ ( lowercase = 200_0000 ): SCREAMING_SNAKE_CASE_: List[Any] =[0 for i in range(n + 1 )] SCREAMING_SNAKE_CASE_: Union[str, Any] =1 SCREAMING_SNAKE_CASE_: Optional[Any] =1 for i in range(2 , int(n**0.5 ) + 1 ): ...
36
1
"""simple docstring""" from typing import TYPE_CHECKING from ...utils import ( OptionalDependencyNotAvailable, _LazyModule, is_sentencepiece_available, is_tf_available, is_tokenizers_available, is_torch_available, ) _UpperCAmelCase = {"""configuration_xlnet""": ["""...
36
"""simple docstring""" import argparse import torch from transformers import BertForMaskedLM if __name__ == "__main__": _UpperCAmelCase = argparse.ArgumentParser( description=( """Extraction some layers of the full BertForMaskedLM or RObertaForMaskedLM for Transfer Lear...
36
1
"""simple docstring""" import argparse import collections import numpy as np import torch from flax import traverse_util from tax import checkpoints from transformers import MTaConfig, UMTaEncoderModel, UMTaForConditionalGeneration from transformers.utils import logging logging.set_verbosity_in...
36
"""simple docstring""" def __magic_name__ ( lowercase , lowercase ): return int((input_a, input_a).count(0 ) == 0 ) def __magic_name__ ( ): assert and_gate(0 , 0 ) == 0 assert and_gate(0 , 1 ) == 0 assert and_gate(1 , 0 ) ==...
36
1
"""simple docstring""" import argparse import requests import torch from PIL import Image from transformers import SwinConfig, SwinForMaskedImageModeling, ViTImageProcessor def __magic_name__ ( lowercase ): SCREAMING_SNAKE_CASE_: str =SwinConfig(image_size=192 ) ...
36
"""simple docstring""" import argparse import numpy as np import torch from transformers import SpeechTaHifiGan, SpeechTaHifiGanConfig, logging logging.set_verbosity_info() _UpperCAmelCase = logging.get_logger("""transformers.models.speecht5""") def __magic_name__ ( ...
36
1
"""simple docstring""" import contextlib import importlib import io import unittest import transformers # Try to import everything from transformers to ensure every object can be loaded. from transformers import * # noqa F406 from transformers.testing_utils import DUMMY_UNKNOWN_IDENTIFIER, require_...
36
"""simple docstring""" import argparse import requests import torch from PIL import Image from transformers import ViTMAEConfig, ViTMAEForPreTraining, ViTMAEImageProcessor def __magic_name__ ( lowercase ): if "cls_token" in name: SCREAMING_SNAKE_CASE_: Optional[int] ...
36
1
"""simple docstring""" # Copyright (c) 2021-, NVIDIA CORPORATION. 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/L...
36
"""simple docstring""" from typing import TYPE_CHECKING from ...utils import OptionalDependencyNotAvailable, _LazyModule, is_tf_available, is_torch_available _UpperCAmelCase = { """configuration_xlm""": ["""XLM_PRETRAINED_CONFIG_ARCHIVE_MAP""", """XLMConfig""", """XLMOnnxConfig"""], """...
36
1
"""simple docstring""" import math import os from copy import deepcopy import datasets import evaluate import torch import transformers from datasets import load_dataset from torch.utils.data import DataLoader from transformers import AutoModelForSequenceClassification, AutoTokenizer from acceler...
36
"""simple docstring""" def __magic_name__ ( lowercase ): SCREAMING_SNAKE_CASE_: int =False while is_sorted is False: # Until all the indices are traversed keep looping SCREAMING_SNAKE_CASE_: Tuple =True for i in range(0 , len(lowercase ) - 1 , ...
36
1
"""simple docstring""" import os from itertools import chain from random import randrange, shuffle import pytest from .sola import PokerHand _UpperCAmelCase = ( """4S 3H 2C 7S 5H""", """9D 8H 2C 6S 7H""", """2D 6D 9D TH 7D""", """TC 8C 2S JH 6C""", """JH 8S TH AH QH"""...
36
"""simple docstring""" def __magic_name__ ( lowercase ): return str(lowercase ) == str(lowercase )[::-1] def __magic_name__ ( lowercase ): return int(lowercase ) + int(str(lowercase )[::-1] ) def __magic_name__ ( lowercase = 1_0000 ): ...
36
1
"""simple docstring""" from __future__ import annotations def __magic_name__ ( lowercase , lowercase ): SCREAMING_SNAKE_CASE_: List[Any] =sorted(numsa + numsa ) SCREAMING_SNAKE_CASE_ , SCREAMING_SNAKE_CASE_: Tuple =divmod(len(lowercase ) , 2 ) ...
36
"""simple docstring""" from typing import TYPE_CHECKING from ...file_utils import _LazyModule, is_tokenizers_available, is_torch_available, is_vision_available from ...utils import OptionalDependencyNotAvailable _UpperCAmelCase = {"""configuration_dpt""": ["""DPT_PRETRAINED_CONFIG_ARCHIVE_MAP"""...
36
1