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 math from typing import Any, Callable, List, Optional, Tuple, Union import numpy as np import torch from ...models import TaFilmDecoder from ...schedulers import DDPMScheduler from ...utils import is_onnx_available, logging, randn_tensor if is_onnx_available...
35
'''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
1
'''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...
35
'''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
1
'''simple docstring''' class a_ : def __init__( self , _SCREAMING_SNAKE_CASE ) -> List[Any]: """simple docstring""" UpperCamelCase = arr.split(""",""" ) def A__ ( self ) -> Optional[int]: ...
35
'''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
1
'''simple docstring''' import gc import random import unittest import numpy as np import torch from transformers import CLIPTextConfig, CLIPTextModel, CLIPTokenizer from diffusers import AutoencoderKL, CycleDiffusionPipeline, DDIMScheduler, UNetaDConditionModel from diffusers.utils import fl...
35
'''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
1
'''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
'''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
1
'''simple docstring''' from __future__ import annotations def lowercase__ ( __UpperCamelCase )-> bool: if len(__UpperCamelCase ) < 2: raise ValueError("""Monogons and Digons are not polygons in the Euclidean space""" ) if any(i <= 0 for...
35
'''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
1
'''simple docstring''' import requests from bsa import BeautifulSoup def lowercase__ ( __UpperCamelCase = "https://www.worldometers.info/coronavirus" )-> dict: UpperCamelCase = BeautifulSoup(requests.get(__UpperCamelCase ).text , """html.par...
35
'''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
1
'''simple docstring''' import unittest from transformers import ( MODEL_FOR_CAUSAL_LM_MAPPING, TF_MODEL_FOR_CAUSAL_LM_MAPPING, TextGenerationPipeline, logging, pipeline, ) from transformers.testing_utils import ( CaptureLogger, is_pipeline_test, require_acce...
35
'''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
1
'''simple docstring''' def lowercase__ ( __UpperCamelCase , __UpperCamelCase )-> None: UpperCamelCase = len(__UpperCamelCase ) print("""The following activities are selected:""" ) # The first activity is always selected UpperCamel...
35
'''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
1
'''simple docstring''' SCREAMING_SNAKE_CASE__ = 6_5_5_2_1 def lowercase__ ( __UpperCamelCase )-> int: UpperCamelCase = 1 UpperCamelCase = 0 for plain_chr in plain_text: UpperCamelCase ...
35
'''simple docstring''' import argparse from transformers import CLIPImageProcessor, CLIPVisionModelWithProjection from diffusers import UnCLIPImageVariationPipeline, UnCLIPPipeline if __name__ == "__main__": SCREAMING_SNAKE_CASE__ = argparse.ArgumentParser() parse...
35
1
'''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...
35
'''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
1
'''simple docstring''' from __future__ import annotations import os import tempfile import unittest import numpy as np from huggingface_hub import hf_hub_download from transformers import is_tensorflow_text_available, is_tf_available from transformers.testing_utils import require_tensorflo...
35
'''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
1
'''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...
35
'''simple docstring''' from __future__ import annotations def lowercase__ ( __UpperCamelCase , __UpperCamelCase , __UpperCamelCase )-> tuple[float, list[float]]: UpperCamelCase = list(range(len(__UpperCamelCase ) ) ) UpperCame...
35
1
'''simple docstring''' from timeit import timeit def lowercase__ ( __UpperCamelCase )-> int: if number < 0: raise ValueError("""the value of input must not be negative""" ) UpperCamelCase = 0 while number: ...
35
'''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
1
'''simple docstring''' import torch from diffusers import CMStochasticIterativeScheduler from .test_schedulers import SchedulerCommonTest class a_ ( lowerCamelCase ): lowercase = (CMStochasticIterativeScheduler,) lowercase = 10 def A__ ( s...
35
'''simple docstring''' import argparse import torch from torch import nn from transformers import MaMaaaConfig, MaMaaaForConditionalGeneration def lowercase__ ( __UpperCamelCase )-> Any: UpperCamelCase = [ """encoder.version""", ...
35
1
'''simple docstring''' import argparse import torch from transformers import RemBertConfig, RemBertModel, load_tf_weights_in_rembert from transformers.utils import logging logging.set_verbosity_info() def lowercase__ ( __UpperCamelCase , __UpperCamelCase , __Upper...
35
'''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
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, ) SCREAMING_SNAKE_CASE__ = { 'configurat...
35
'''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
1
'''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...
35
'''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
1
'''simple docstring''' # Copyright 2023 The HuggingFace Inc. team. All rights reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/li...
35
'''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
1
'''simple docstring''' import baseaa def lowercase__ ( __UpperCamelCase )-> bytes: return baseaa.baaencode(string.encode("""utf-8""" ) ) def lowercase__ ( __UpperCamelCase )-> str: return baseaa.baadecode(__UpperCamel...
35
'''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
1
'''simple docstring''' # 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 SCREAMING_SNAKE_CASE__ = TypeVar('T') class ...
35
'''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
1
'''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 sa...
35
'''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
1
'''simple docstring''' import warnings from ...utils import logging from .image_processing_flava import FlavaImageProcessor SCREAMING_SNAKE_CASE__ = logging.get_logger(__name__) class a_ ( lowerCamelCase ): def __init__( self , *_SCREAMING_...
35
'''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
1
'''simple docstring''' def lowercase__ ( __UpperCamelCase , __UpperCamelCase )-> str: return "\n".join( F"{number} * {i} = {number * i}" for i in range(1 , number_of_terms + 1 ) ) if __name__ == "__main__": print(multiplication_table(number=5, num...
35
'''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
1
'''simple docstring''' import argparse from typing import List import evaluate import numpy as np import torch from datasets import DatasetDict, load_dataset # New Code # # We'll be using StratifiedKFold for this example from sklearn.model_selection import StratifiedKFold from torch.optim ...
35
'''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
1
'''simple docstring''' import argparse import requests import torch from PIL import Image from transformers import SwinConfig, SwinForMaskedImageModeling, ViTImageProcessor def lowercase__ ( __UpperCamelCase )-> List[str]: UpperCamelCase = ...
35
'''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
1
'''simple docstring''' 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, ...
35
'''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
1
'''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_...
35
'''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
1
'''simple docstring''' import unittest from transformers import TrOCRConfig from transformers.testing_utils import is_torch_available, require_torch, torch_device from ...generation.test_utils import GenerationTesterMixin from ...test_configuration_common import ConfigTester from ...test_model...
35
'''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
1
'''simple docstring''' from math import log from scipy.constants import Boltzmann, physical_constants SCREAMING_SNAKE_CASE__ = 3_0_0 # TEMPERATURE (unit = K) def lowercase__ ( __UpperCamelCase , __UpperCamelCase , __UpperCamelCase , )-> float: ...
35
'''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
1
'''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_tor...
35
'''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
1
'''simple docstring''' import mpmath # for roots of unity import numpy as np class a_ : def __init__( self , _SCREAMING_SNAKE_CASE=None , _SCREAMING_SNAKE_CASE=None ) -> Tuple: """simple docstring""" UpperCamelCase ...
35
'''simple docstring''' import argparse from transformers import CLIPImageProcessor, CLIPVisionModelWithProjection from diffusers import UnCLIPImageVariationPipeline, UnCLIPPipeline if __name__ == "__main__": SCREAMING_SNAKE_CASE__ = argparse.ArgumentParser() parse...
35
1
'''simple docstring''' import os import re import warnings from shutil import copyfile from typing import List, Optional, Tuple from ...tokenization_utils_fast import PreTrainedTokenizerFast from ...utils import is_sentencepiece_available, logging if is_sentencepiece_available(): fro...
35
'''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
1
'''simple docstring''' def lowercase__ ( __UpperCamelCase )-> list: if n_term == "": return [] UpperCamelCase = [] for temp in range(int(__UpperCamelCase ) ): series.append(F"1/{temp + 1}" if series else """1""" ...
35
'''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
1
'''simple docstring''' from collections import Counter from timeit import timeit def lowercase__ ( __UpperCamelCase = "" , )-> bool: return sum(c % 2 for c in Counter(input_str.replace(""" """ , """""" ).lower() ).values() ) < 2 def ...
35
'''simple docstring''' from __future__ import annotations def lowercase__ ( __UpperCamelCase , __UpperCamelCase , __UpperCamelCase )-> tuple[float, list[float]]: UpperCamelCase = list(range(len(__UpperCamelCase ) ) ) UpperCame...
35
1
'''simple docstring''' from ....configuration_utils import PretrainedConfig from ....utils import logging SCREAMING_SNAKE_CASE__ = logging.get_logger(__name__) SCREAMING_SNAKE_CASE__ = { 'Visual-Attention-Network/van-base': ( 'https://huggingface.co/Vi...
35
'''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
1
'''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
'''simple docstring''' import argparse import torch from torch import nn from transformers import MaMaaaConfig, MaMaaaForConditionalGeneration def lowercase__ ( __UpperCamelCase )-> Any: UpperCamelCase = [ """encoder.version""", ...
35
1
'''simple docstring''' import unittest from knapsack import knapsack as k class a_ ( unittest.TestCase ): def A__ ( self ) -> List[str]: """simple docstring""" UpperCamelCase = 0 UpperC...
35
'''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
1
'''simple docstring''' from typing import List, Optional, Union import torch from ...models import UNetaDConditionModel, VQModel from ...pipelines import DiffusionPipeline from ...pipelines.pipeline_utils import ImagePipelineOutput from ...schedulers import DDPMScheduler from ...utils import ...
35
'''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
1
'''simple docstring''' from __future__ import annotations def lowercase__ ( __UpperCamelCase )-> bool: UpperCamelCase = str(__UpperCamelCase ) return len(__UpperCamelCase ) == 9 and set(__UpperCamelCase ) == set("""123456789""" ...
35
'''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
1
'''simple docstring''' 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 ja...
35
'''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
1
'''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/license...
35
'''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
1
'''simple docstring''' # Usage: # ./gen-card-allenai-wmt16.py import os from pathlib import Path def lowercase__ ( __UpperCamelCase , __UpperCamelCase , __UpperCamelCase , __UpperCamelCase )-> Any: UpperCamelCase = { """en""": "...
35
'''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
1
'''simple docstring''' from collections import OrderedDict from typing import Mapping from ...configuration_utils import PretrainedConfig from ...onnx import OnnxConfig from ...utils import logging SCREAMING_SNAKE_CASE__ = logging.get_logger(__name__) SCREAMING_SNAKE_CASE__ ...
35
'''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
1
'''simple docstring''' import re from flax.core.frozen_dict import freeze from flax.traverse_util import flatten_dict, unflatten_dict from jax.experimental import PartitionSpec as P # Sentinels SCREAMING_SNAKE_CASE__ = object() # For specifying empty leaf dict `{}` SCREAMIN...
35
'''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
1
'''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__ ...
35
'''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
1
'''simple docstring''' import inspect import os import unittest from pathlib import Path import torch import accelerate from accelerate.test_utils import execute_subprocess_async from accelerate.test_utils.testing import run_command class a_ ( unittest.TestCase ...
35
'''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
1
'''simple docstring''' import os def lowercase__ ( __UpperCamelCase = "matrix.txt" )-> int: with open(os.path.join(os.path.dirname(__UpperCamelCase ) , __UpperCamelCase ) ) as in_file: UpperCamelCase = in_file.read() ...
35
'''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
1
'''simple docstring''' def lowercase__ ( __UpperCamelCase )-> int: if not grid or not grid[0]: raise TypeError("""The grid does not contain the appropriate information""" ) for cell_n in range(1 , len(grid[0] ) ): grid[0][cell_n]...
35
'''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
1
'''simple docstring''' from __future__ import annotations from typing import Any class a_ : def __init__( self , _SCREAMING_SNAKE_CASE ) -> None: """simple docstring""" UpperCamelCase = num_of_nodes ...
35
'''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
1
'''simple docstring''' import pickle import numpy as np from matplotlib import pyplot as plt class a_ : def __init__( self , _SCREAMING_SNAKE_CASE , _SCREAMING_SNAKE_CASE , _SCREAMING_SNAKE_CASE , _SCREAMING_SNAKE_CASE , _SCREAMING_SNAKE_CASE , _SCREAMI...
35
'''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
1
'''simple docstring''' def lowercase__ ( )-> int: return [ a * b * (1000 - a - b) for a in range(1 , 999 ) for b in range(__UpperCamelCase , 999 ) if (a * a + b * b == (1000 - a - b) ** 2) ][0] if __name__ == "__main_...
35
'''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
1
'''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...
35
'''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
1
'''simple docstring''' from typing import TYPE_CHECKING from ...utils import OptionalDependencyNotAvailable, _LazyModule, is_tokenizers_available, is_torch_available SCREAMING_SNAKE_CASE__ = { 'configuration_roc_bert': ['ROC_BERT_PRETRAINED_CONFIG_ARCHIVE_MAP', 'RoCBertConfig...
35
'''simple docstring''' import argparse from transformers import CLIPImageProcessor, CLIPVisionModelWithProjection from diffusers import UnCLIPImageVariationPipeline, UnCLIPPipeline if __name__ == "__main__": SCREAMING_SNAKE_CASE__ = argparse.ArgumentParser() parse...
35
1
'''simple docstring''' def lowercase__ ( __UpperCamelCase , __UpperCamelCase )-> list: UpperCamelCase = len(__UpperCamelCase ) UpperCamelCase = [] for i in range(len(__UpperCamelCase ) - pat_len + 1 ): Upp...
35
'''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
1
'''simple docstring''' import hashlib import unittest from typing import Dict import numpy as np from transformers import ( MODEL_FOR_MASK_GENERATION_MAPPING, TF_MODEL_FOR_MASK_GENERATION_MAPPING, is_vision_available, pipeline, ) from transformers.pipelines import MaskGene...
35
'''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
1
'''simple docstring''' from transformers import BertTokenizerFast from .custom_tokenization import CustomTokenizer class a_ ( lowerCamelCase ): lowercase = CustomTokenizer pass
35
'''simple docstring''' from __future__ import annotations def lowercase__ ( __UpperCamelCase , __UpperCamelCase , __UpperCamelCase )-> tuple[float, list[float]]: UpperCamelCase = list(range(len(__UpperCamelCase ) ) ) UpperCame...
35
1
'''simple docstring''' import copy from dataclasses import dataclass, field from typing import ClassVar, Dict from ..features import ClassLabel, Features, Value from .base import TaskTemplate @dataclass(frozen=lowerCamelCase ) class a_ ( lowerCamelCase ): #...
35
'''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
1
'''simple docstring''' import requests from bsa import BeautifulSoup def lowercase__ ( __UpperCamelCase , __UpperCamelCase )-> str: UpperCamelCase = BeautifulSoup(requests.get(__UpperCamelCase , params=__UpperCamelCase ).content , """html....
35
'''simple docstring''' import argparse import torch from torch import nn from transformers import MaMaaaConfig, MaMaaaForConditionalGeneration def lowercase__ ( __UpperCamelCase )-> Any: UpperCamelCase = [ """encoder.version""", ...
35
1
'''simple docstring''' from collections import OrderedDict from typing import Any, Mapping, Optional from ... import PreTrainedTokenizer from ...configuration_utils import PretrainedConfig from ...onnx import OnnxConfig, OnnxConfigWithPast, OnnxSeqaSeqConfigWithPast from ...onnx.utils import com...
35
'''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
1
'''simple docstring''' from argparse import ArgumentParser, Namespace from ..utils import logging from . import BaseTransformersCLICommand def lowercase__ ( __UpperCamelCase )-> str: return ConvertCommand( args.model_type , args.tf_checkpoint , ar...
35
'''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
1
'''simple docstring''' import os import re import shutil from argparse import ArgumentParser, Namespace from datasets.commands import BaseDatasetsCLICommand from datasets.utils.logging import get_logger SCREAMING_SNAKE_CASE__ = '<<<<<<< This should probably be modified because...
35
'''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
1
'''simple docstring''' from typing import List, Optional from tokenizers import ByteLevelBPETokenizer from ...tokenization_utils_fast import PreTrainedTokenizerFast from ...utils import logging from .tokenization_blenderbot_small import BlenderbotSmallTokenizer SCREAMING_SNAKE_CASE__ ...
35
'''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
1
'''simple docstring''' import inspect from typing import Callable, List, Optional, Union import torch from transformers import CLIPImageProcessor, CLIPTextModel, CLIPTokenizer from diffusers import DiffusionPipeline from diffusers.models import AutoencoderKL, UNetaDConditionModel from diffuse...
35
'''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
1
'''simple docstring''' import sys def lowercase__ ( __UpperCamelCase )-> int: UpperCamelCase = len(__UpperCamelCase ) UpperCamelCase = [[0 for x in range(__UpperCamelCase )] for x in range(__UpperCamelCase )] ...
35
'''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
1
'''simple docstring''' 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 B...
35
'''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
1
'''simple docstring''' import collections from typing import List, Optional, Union from ...tokenization_utils_base import BatchEncoding from ...utils import TensorType, add_end_docstrings, add_start_docstrings, logging from ..bert.tokenization_bert import BertTokenizer SCREAMING_SNAKE_CASE__...
35
'''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
1
'''simple docstring''' import unittest import numpy as np import torch from .utils_summarization import build_mask, compute_token_type_ids, process_story, truncate_or_pad class a_ ( unittest.TestCase ): def A__ ( self ) -> Union[str, Any]: ...
35
'''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
1
'''simple docstring''' import jax.numpy as jnp from ...utils import logging from ..ta.modeling_flax_ta import FlaxTaEncoderModel, FlaxTaForConditionalGeneration, FlaxTaModel from .configuration_mta import MTaConfig SCREAMING_SNAKE_CASE__ = logging.get_logger(__name__) SCREAMI...
35
'''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
1
'''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 @e...
35
'''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
1
'''simple docstring''' from ...utils import is_torch_available, is_transformers_available if is_transformers_available() and is_torch_available(): from .pipeline_vq_diffusion import LearnedClassifierFreeSamplingEmbeddings, VQDiffusionPipeline
35
'''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
1
'''simple docstring''' import unittest import numpy as np from datasets import load_dataset 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 ImageProcessingS...
35
'''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
1
'''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/che...
35
'''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
1
'''simple docstring''' import argparse import importlib from pathlib import Path # Test all the extensions added in the setup SCREAMING_SNAKE_CASE__ = [ 'kernels/rwkv/wkv_cuda.cu', 'kernels/rwkv/wkv_op.cpp', 'kernels/deformable_detr/ms_deform_attn.h', 'kernels/...
35
'''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
1
'''simple docstring''' import importlib.metadata import warnings from copy import deepcopy from packaging import version from ..utils import logging from .import_utils import is_accelerate_available, is_bitsandbytes_available if is_bitsandbytes_available(): import bitsandbytes as bn...
35
'''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
1
'''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, ) d...
35
'''simple docstring''' import argparse from transformers import CLIPImageProcessor, CLIPVisionModelWithProjection from diffusers import UnCLIPImageVariationPipeline, UnCLIPPipeline if __name__ == "__main__": SCREAMING_SNAKE_CASE__ = argparse.ArgumentParser() parse...
35
1
'''simple docstring''' import unittest import numpy as np from transformers import AlbertConfig, 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_availab...
35
'''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
1
'''simple docstring''' import argparse import torch from transformers import LxmertConfig, LxmertForPreTraining, load_tf_weights_in_lxmert from transformers.utils import logging logging.set_verbosity_info() def lowercase__ ( __UpperCamelCase , __UpperCamelCase , _...
35
'''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
1
'''simple docstring''' import pytest import requests from datasets.utils.file_utils import http_head from .utils import OfflineSimulationMode, RequestWouldHangIndefinitelyError, offline @pytest.mark.integration def lowercase__ ( )-> Any: with offline(OfflineSi...
35
'''simple docstring''' from __future__ import annotations def lowercase__ ( __UpperCamelCase , __UpperCamelCase , __UpperCamelCase )-> tuple[float, list[float]]: UpperCamelCase = list(range(len(__UpperCamelCase ) ) ) UpperCame...
35
1
'''simple docstring''' from collections import OrderedDict from typing import Mapping from packaging import version from ...configuration_utils import PretrainedConfig from ...onnx import OnnxConfig from ...utils import logging SCREAMING_SNAKE_CASE__ = logging.get_logger(__n...
35
'''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
1
'''simple docstring''' from PIL import Image def lowercase__ ( __UpperCamelCase , __UpperCamelCase )-> Image: UpperCamelCase = (259 * (level + 255)) / (255 * (259 - level)) def contrast(__UpperCamelCase ) -> int: return ...
35
'''simple docstring''' import argparse import torch from torch import nn from transformers import MaMaaaConfig, MaMaaaForConditionalGeneration def lowercase__ ( __UpperCamelCase )-> Any: UpperCamelCase = [ """encoder.version""", ...
35
1
'''simple docstring''' from typing import TYPE_CHECKING from ...utils import OptionalDependencyNotAvailable, _LazyModule, is_tokenizers_available, is_torch_available SCREAMING_SNAKE_CASE__ = { 'configuration_biogpt': ['BIOGPT_PRETRAINED_CONFIG_ARCHIVE_MAP', 'BioGptConfig'], ...
35
'''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
1
'''simple docstring''' import numpy as np from numpy import ndarray from scipy.optimize import Bounds, LinearConstraint, minimize def lowercase__ ( __UpperCamelCase )-> float: return np.dot(__UpperCamelCase , __UpperCamelCase ) class a_ ...
35
'''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
1
'''simple docstring''' import math from typing import Dict, Iterable, List, Optional, Tuple, Union import numpy as np from ...image_processing_utils import BaseImageProcessor, BatchFeature, get_size_dict from ...image_transforms import normalize, rescale, resize, to_channel_dimension_format fr...
35
'''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
1
'''simple docstring''' from ...utils import ( OptionalDependencyNotAvailable, is_flax_available, is_torch_available, is_transformers_available, ) try: if not (is_transformers_available() and is_torch_available()): raise OptionalDependencyNotAvailable() except...
35
'''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
1
'''simple docstring''' import json import os import subprocess import unittest from ast import literal_eval import pytest from parameterized import parameterized, parameterized_class from . import is_sagemaker_available if is_sagemaker_available(): from sagemaker import Session, T...
35
'''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
1
'''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
'''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
1
'''simple docstring''' from datetime import datetime import matplotlib.pyplot as plt import torch def lowercase__ ( __UpperCamelCase )-> List[str]: for param in module.parameters(): UpperCamelCase = False def l...
35
'''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
1
'''simple docstring''' from typing import TYPE_CHECKING from ...utils import ( OptionalDependencyNotAvailable, _LazyModule, is_sentencepiece_available, is_tokenizers_available, is_torch_available, is_vision_available, ) SCREAMING_SNAKE_CASE__ = {'pro...
35
'''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
1
'''simple docstring''' import logging import os from dataclasses import dataclass from enum import Enum from typing import List, Optional, Union from filelock import FileLock from transformers import PreTrainedTokenizer, is_tf_available, is_torch_available SCREAMING_SNAKE_CASE__ ...
35
'''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
1
'''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, WavaVecaCT...
35
'''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
1
'''simple docstring''' from math import isclose, sqrt def lowercase__ ( __UpperCamelCase , __UpperCamelCase , __UpperCamelCase )-> tuple[float, float, float]: UpperCamelCase = point_y / 4 / point_x UpperCamelCase = 2 * no...
35
'''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
1
'''simple docstring''' from ...utils import ( OptionalDependencyNotAvailable, is_torch_available, is_transformers_available, is_transformers_version, ) try: if not (is_transformers_available() and is_torch_available()): raise OptionalDependencyNotAvailable() ...
35
'''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
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 transformers import ( SwiftFormerConfig, SwiftFormerForImageClassification, ViTImageProcessor, ) fr...
35
'''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
1
'''simple docstring''' import math import unittest from transformers import BioGptConfig, 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...
35
'''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
1
'''simple docstring''' import os import zipfile import pytest from datasets.utils.extract import ( BzipaExtractor, Extractor, GzipExtractor, LzaExtractor, SevenZipExtractor, TarExtractor, XzExtractor, ZipExtractor, ZstdExtractor, ) from .utils imp...
35
'''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
1
'''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:] # re...
35
'''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
1
'''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_avai...
35
'''simple docstring''' import argparse from transformers import CLIPImageProcessor, CLIPVisionModelWithProjection from diffusers import UnCLIPImageVariationPipeline, UnCLIPPipeline if __name__ == "__main__": SCREAMING_SNAKE_CASE__ = argparse.ArgumentParser() parse...
35
1
'''simple docstring''' import argparse import datetime import json import time import warnings from logging import getLogger from pathlib import Path from typing import Dict, List import torch from tqdm import tqdm from transformers import AutoModelForSeqaSeqLM, AutoTokenizer from utils ...
35
'''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
1
'''simple docstring''' def lowercase__ ( __UpperCamelCase , __UpperCamelCase )-> int: while b: UpperCamelCase ,UpperCamelCase = b, a % b return a def lowercase__ ( __UpperCamelCase , __UpperCamelCase )-> ...
35
'''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
1