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 json import os import subprocess import unittest from ast import literal_eval import pytest from parameterized import parameterized_class from . import is_sagemaker_available if is_sagemaker_available(): from sagemaker import Session, Traini...
631
'''simple docstring''' _A : List[str] ='''0.21.0''' from .accelerator import Accelerator from .big_modeling import ( cpu_offload, cpu_offload_with_hook, disk_offload, dispatch_model, init_empty_weights, init_on_device, load_checkpoint_and_di...
631
1
'''simple docstring''' import unittest from typing import Tuple import torch from diffusers.utils import floats_tensor, randn_tensor, torch_all_close, torch_device from diffusers.utils.testing_utils import require_torch @require_torch class _lowercase : @proper...
631
'''simple docstring''' from ...configuration_utils import PretrainedConfig from ...utils import logging _A : Any =logging.get_logger(__name__) _A : Dict ={ '''microsoft/trocr-base-handwritten''': ( '''https://huggingface.co/microsoft/trocr-base-h...
631
1
'''simple docstring''' from math import pi, sqrt, tan def SCREAMING_SNAKE_CASE_ (UpperCamelCase ) -> float: if side_length < 0: raise ValueError("""surface_area_cube() only accepts non-negative values""" ) return 6 * side_length**2 ...
631
'''simple docstring''' # A Bipartite Graph is a graph whose vertices can be divided into two independent sets, # U and V such that every edge (u, v) either connects a vertex from U to V or a vertex # from V to U. In other words, for every edge (u, v), either u belongs to U and v to V, # ...
631
1
'''simple docstring''' from sklearn.metrics import fa_score import datasets _A : Union[str, Any] =''' The F1 score is the harmonic mean of the precision and recall. It can be computed with the equation: F1 = 2 * (precision * recall) / (precision + recall) ''' _A : ...
631
'''simple docstring''' import numpy as np import torch from torch.utils.data import Dataset, IterableDataset from ..utils.generic import ModelOutput class _lowercase ( _lowercase ): def __init__( self: Optional[Any] , UpperCamelCase__: ...
631
1
'''simple docstring''' from collections import OrderedDict from typing import Mapping from ...configuration_utils import PretrainedConfig from ...onnx import OnnxConfig from ...utils import logging _A : List[str] =logging.get_logger(__name__) _A : str ={ ...
631
'''simple docstring''' # coding=utf-8 # Copyright 2023 The HuggingFace Inc. team. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache...
631
1
'''simple docstring''' from ...utils import is_torch_available, is_transformers_available if is_transformers_available() and is_torch_available(): from .pipeline_vq_diffusion import LearnedClassifierFreeSamplingEmbeddings, VQDiffusionPipeline
631
'''simple docstring''' from typing import TYPE_CHECKING from ...utils import ( OptionalDependencyNotAvailable, _LazyModule, is_sentencepiece_available, is_speech_available, is_torch_available, ) _A : Any ={ '''configuration_trocr''': ['''TRO...
631
1
'''simple docstring''' def SCREAMING_SNAKE_CASE_ (UpperCamelCase , UpperCamelCase ) -> str: if a < 0 or b < 0: raise ValueError("""the value of both inputs must be positive""" ) lowerCamelCase__ : Tuple = str(bin(UpperCamelCase ...
631
'''simple docstring''' from ...configuration_utils import PretrainedConfig from ...utils import logging _A : Union[str, Any] =logging.get_logger(__name__) _A : List[str] ={ '''MIT/ast-finetuned-audioset-10-10-0.4593''': ( '''https://huggingface.c...
631
1
'''simple docstring''' import random import unittest import torch from diffusers import IFImgaImgSuperResolutionPipeline from diffusers.utils import floats_tensor from diffusers.utils.import_utils import is_xformers_available from diffusers.utils.testing_utils import skip_mps, tor...
631
'''simple docstring''' import argparse import os import re import packaging.version _A : List[str] ='''examples/''' _A : Any ={ '''examples''': (re.compile(r'''^check_min_version\("[^"]+"\)\s*$''', re.MULTILINE), '''check_min_version("VERSION")\n'''), ...
631
1
'''simple docstring''' import argparse import json from dataclasses import dataclass, field from functools import partial from pathlib import Path from typing import Callable, Dict, List, Tuple import timm import torch import torch.nn as nn from classy_vision.models.regnet import...
631
'''simple docstring''' import unittest import torch from diffusers import DDIMScheduler, DDPMScheduler, UNetaDModel from diffusers.training_utils import set_seed from diffusers.utils.testing_utils import slow _A : Union[str, Any] =False class _lowercase ( ...
631
1
'''simple docstring''' from math import ceil, sqrt def SCREAMING_SNAKE_CASE_ (UpperCamelCase = 1000000 ) -> int: lowerCamelCase__ : Optional[int] = 0 for outer_width in range(3 , (limit // 4) + 2 ): if outer_width**...
631
'''simple docstring''' from statistics import mean import numpy as np def SCREAMING_SNAKE_CASE_ (UpperCamelCase , UpperCamelCase , UpperCamelCase , UpperCamelCase ) -> list: lowerCamelCase__ : Optional[int] = 0 # ...
631
1
'''simple docstring''' from collections import OrderedDict from typing import Mapping from ...configuration_utils import PretrainedConfig from ...onnx import OnnxConfig from ...utils import logging _A : List[str] =logging.get_logger(__name__) _A : int ={ ...
631
'''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
631
1
'''simple docstring''' import argparse import random import joblib import numpy as np import torch from igf.igf import ( SecondaryLearner, collect_objective_set, compute_perplexity, generate_datasets, load_gpta, recopy_gpta, set_seed, train_sec...
631
'''simple docstring''' import inspect import math import tempfile import unittest import numpy as np from transformers import ViTMAEConfig from transformers.testing_utils import require_torch, require_vision, slow, torch_device from transformers.utils import cached_property, is_t...
631
1
'''simple docstring''' import math def SCREAMING_SNAKE_CASE_ (UpperCamelCase , UpperCamelCase ) -> Optional[int]: if 0 not in (x, y): # We use the relation x^y = y*log10(x), where 10 is the base. return y * math.logaa(UpperCa...
631
'''simple docstring''' import os from typing import Optional import fsspec from fsspec.archive import AbstractArchiveFileSystem from fsspec.utils import DEFAULT_BLOCK_SIZE class _lowercase ( _lowercase ): a = """""" a = ( None ...
631
1
'''simple docstring''' class _lowercase : def __init__( self: Any , UpperCamelCase__: list ): lowerCamelCase__ : Any = set_counts lowerCamelCase__ : int = max(UpperCamelCase__ ) ...
631
'''simple docstring''' import argparse import collections import json from pathlib import Path import requests import torch import yaml from huggingface_hub import hf_hub_download from PIL import Image from transformers import ( MobileViTImageProcessor, MobileViTVaCon...
631
1
'''simple docstring''' import gc import unittest from transformers import MODEL_FOR_MASKED_LM_MAPPING, TF_MODEL_FOR_MASKED_LM_MAPPING, FillMaskPipeline, pipeline from transformers.pipelines import PipelineException from transformers.testing_utils import ( is_pipeline_test, i...
631
'''simple docstring''' import inspect import unittest from transformers import MobileViTVaConfig from transformers.testing_utils import require_torch, require_torch_multi_gpu, require_vision, slow, torch_device from transformers.utils import cached_property, is_torch_available, is_vis...
631
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 _A : List[str] ={'''configuration_dpt''': ['''DPT_PRETRAINE...
631
'''simple docstring''' import json from typing import TYPE_CHECKING, List, Optional, Tuple from tokenizers import pre_tokenizers from ...tokenization_utils_fast import PreTrainedTokenizerFast from ...utils import logging if TYPE_CHECKING: from transformers.pipelines.convers...
631
1
'''simple docstring''' import warnings from ...utils import logging from .image_processing_segformer import SegformerImageProcessor _A : int =logging.get_logger(__name__) class _lowercase ( _lowercase ): def __init__( self: Optional...
631
'''simple docstring''' from typing import TYPE_CHECKING from ...utils import OptionalDependencyNotAvailable, _LazyModule, is_torch_available _A : Dict ={ '''configuration_git''': ['''GIT_PRETRAINED_CONFIG_ARCHIVE_MAP''', '''GitConfig''', '''GitVisionConfig'''], ...
631
1
'''simple docstring''' from typing import TYPE_CHECKING from ...utils import OptionalDependencyNotAvailable, _LazyModule, is_torch_available _A : Dict ={ '''configuration_git''': ['''GIT_PRETRAINED_CONFIG_ARCHIVE_MAP''', '''GitConfig''', '''GitVisionConfig'''], ...
631
'''simple docstring''' import tempfile import unittest from pathlib import Path from shutil import copyfile from transformers import BatchEncoding, MarianTokenizer from transformers.testing_utils import get_tests_dir, require_sentencepiece, slow from transformers.utils import is_sen...
631
1
'''simple docstring''' from __future__ import annotations from collections.abc import Iterable, Iterator from dataclasses import dataclass _A : List[Any] =(3, 9, -11, 0, 7, 5, 1, -1) _A : int =(4, 6, 2, 0, 8, 10, 3, -2) @dataclass class _lowercase : ...
631
'''simple docstring''' from ...configuration_utils import PretrainedConfig from ...utils import logging _A : Optional[Any] =logging.get_logger(__name__) _A : Optional[int] ={ '''RWKV/rwkv-4-169m-pile''': '''https://huggingface.co/RWKV/rwkv-4-169m-pile/res...
631
1
'''simple docstring''' def SCREAMING_SNAKE_CASE_ (UpperCamelCase ) -> list: lowerCamelCase__ : str = int(UpperCamelCase ) if n_element < 1: lowerCamelCase__ : int = ValueError("""a should be a positive number""" ) ...
631
'''simple docstring''' from ...configuration_utils import PretrainedConfig from ...utils import logging _A : str =logging.get_logger(__name__) _A : int ={ '''weiweishi/roc-bert-base-zh''': '''https://huggingface.co/weiweishi/roc-bert-base-zh/resolve/main/...
631
1
'''simple docstring''' from ...configuration_utils import PretrainedConfig from ...utils import logging _A : List[str] =logging.get_logger(__name__) _A : str ={ '''funnel-transformer/small''': '''https://huggingface.co/funnel-transformer/small/resolve/mai...
631
'''simple docstring''' import sys import turtle def SCREAMING_SNAKE_CASE_ (UpperCamelCase , UpperCamelCase ) -> tuple[float, float]: return (pa[0] + pa[0]) / 2, (pa[1] + pa[1]) / 2 def SCREAMING_SNAKE_CASE_ (UpperCamelCase , Upper...
631
1
'''simple docstring''' _A : Optional[int] ='''Input must be a string of 8 numbers plus letter''' _A : Tuple ='''TRWAGMYFPDXBNJZSQVHLCKE''' def SCREAMING_SNAKE_CASE_ (UpperCamelCase ) -> bool: if not isinstance(UpperCamelCase , Upp...
631
'''simple docstring''' from __future__ import annotations import os import tempfile import unittest from transformers import ConvBertConfig, is_tf_available from transformers.testing_utils import require_tf, slow from ...test_configuration_common import ConfigTester from ...tes...
631
1
'''simple docstring''' from random import randint from tempfile import TemporaryFile import numpy as np def SCREAMING_SNAKE_CASE_ (UpperCamelCase , UpperCamelCase , UpperCamelCase ) -> List[Any]: lowerCamelCase__ : List[Any] = 0 ...
631
'''simple docstring''' _A : List[str] ='''0.21.0''' from .accelerator import Accelerator from .big_modeling import ( cpu_offload, cpu_offload_with_hook, disk_offload, dispatch_model, init_empty_weights, init_on_device, load_checkpoint_and_di...
631
1
'''simple docstring''' def SCREAMING_SNAKE_CASE_ (UpperCamelCase ) -> list: if len(UpperCamelCase ) < 2: return collection def circle_sort_util(UpperCamelCase , UpperCamelCase , UpperCamelCase ) -> bool: lowerCa...
631
'''simple docstring''' from ...configuration_utils import PretrainedConfig from ...utils import logging _A : Any =logging.get_logger(__name__) _A : Dict ={ '''microsoft/trocr-base-handwritten''': ( '''https://huggingface.co/microsoft/trocr-base-h...
631
1
'''simple docstring''' from typing import TYPE_CHECKING from ..utils import _LazyModule _A : Tuple ={ '''config''': [ '''EXTERNAL_DATA_FORMAT_SIZE_LIMIT''', '''OnnxConfig''', '''OnnxConfigWithPast''', '''OnnxSeq2SeqConfigWithPast''...
631
'''simple docstring''' # A Bipartite Graph is a graph whose vertices can be divided into two independent sets, # U and V such that every edge (u, v) either connects a vertex from U to V or a vertex # from V to U. In other words, for every edge (u, v), either u belongs to U and v to V, # ...
631
1
'''simple docstring''' from typing import TYPE_CHECKING from ...utils import OptionalDependencyNotAvailable, _LazyModule, is_torch_available, is_vision_available _A : List[str] ={ '''configuration_mask2former''': [ '''MASK2FORMER_PRETRAINED_CONFIG_ARCHIVE_MA...
631
'''simple docstring''' import numpy as np import torch from torch.utils.data import Dataset, IterableDataset from ..utils.generic import ModelOutput class _lowercase ( _lowercase ): def __init__( self: Optional[Any] , UpperCamelCase__: ...
631
1
'''simple docstring''' import requests _A : Dict ='''''' # <-- Put your OpenWeatherMap appid here! _A : str ='''https://api.openweathermap.org/data/2.5/''' def SCREAMING_SNAKE_CASE_ (UpperCamelCase = "Chicago" , UpperCamelCase = APPID ) ...
631
'''simple docstring''' # coding=utf-8 # Copyright 2023 The HuggingFace Inc. team. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache...
631
1
'''simple docstring''' import os def SCREAMING_SNAKE_CASE_ () -> Tuple: with open(os.path.dirname(UpperCamelCase ) + """/p022_names.txt""" ) as file: lowerCamelCase__ : Optional[Any] = str(file.readlines()[0] ) lowerC...
631
'''simple docstring''' from typing import TYPE_CHECKING from ...utils import ( OptionalDependencyNotAvailable, _LazyModule, is_sentencepiece_available, is_speech_available, is_torch_available, ) _A : Any ={ '''configuration_trocr''': ['''TRO...
631
1
'''simple docstring''' import importlib import shutil import threading import warnings from typing import List import fsspec import fsspec.asyn from . import compression from .hffilesystem import HfFileSystem _A : List[str] =importlib.util.find_spec('''s3fs''') i...
631
'''simple docstring''' from ...configuration_utils import PretrainedConfig from ...utils import logging _A : Union[str, Any] =logging.get_logger(__name__) _A : List[str] ={ '''MIT/ast-finetuned-audioset-10-10-0.4593''': ( '''https://huggingface.c...
631
1
'''simple docstring''' import warnings from ...utils import logging from .image_processing_donut import DonutImageProcessor _A : Any =logging.get_logger(__name__) class _lowercase ( _lowercase ): def __init__( self: Dict , ...
631
'''simple docstring''' import argparse import os import re import packaging.version _A : List[str] ='''examples/''' _A : Any ={ '''examples''': (re.compile(r'''^check_min_version\("[^"]+"\)\s*$''', re.MULTILINE), '''check_min_version("VERSION")\n'''), ...
631
1
'''simple docstring''' import qiskit def SCREAMING_SNAKE_CASE_ (UpperCamelCase , UpperCamelCase ) -> qiskit.result.counts.Counts: lowerCamelCase__ : Union[str, Any] = qiskit.Aer.get_backend("""aer_simulator""" ) # Create a Quantum...
631
'''simple docstring''' import unittest import torch from diffusers import DDIMScheduler, DDPMScheduler, UNetaDModel from diffusers.training_utils import set_seed from diffusers.utils.testing_utils import slow _A : Union[str, Any] =False class _lowercase ( ...
631
1
'''simple docstring''' import argparse import re from pathlib import Path import requests import torch from PIL import Image from torchvision.transforms import CenterCrop, Compose, Normalize, Resize, ToTensor from transformers import ( EfficientFormerConfig, EfficientFo...
631
'''simple docstring''' from statistics import mean import numpy as np def SCREAMING_SNAKE_CASE_ (UpperCamelCase , UpperCamelCase , UpperCamelCase , UpperCamelCase ) -> list: lowerCamelCase__ : Optional[int] = 0 # ...
631
1
'''simple docstring''' from argparse import ArgumentParser from ..pipelines import Pipeline, PipelineDataFormat, get_supported_tasks, pipeline from ..utils import logging from . import BaseTransformersCLICommand _A : List[str] =logging.get_logger(__name__) # pylint: di...
631
'''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
631
1
'''simple docstring''' import glob import os import random from string import ascii_lowercase, digits import cva import numpy as np # Parrameters _A : str =(720, 1_280) # Height, Width _A : List[Any] =(0.4, 0.6) # if height or width lower than this scale,...
631
'''simple docstring''' import inspect import math import tempfile import unittest import numpy as np from transformers import ViTMAEConfig from transformers.testing_utils import require_torch, require_vision, slow, torch_device from transformers.utils import cached_property, is_t...
631
1
'''simple docstring''' import tempfile import torch from diffusers import PNDMScheduler from .test_schedulers import SchedulerCommonTest class _lowercase ( _lowercase ): a = (PNDMScheduler,) a = (("""num_inference_steps""", 50),) ...
631
'''simple docstring''' import os from typing import Optional import fsspec from fsspec.archive import AbstractArchiveFileSystem from fsspec.utils import DEFAULT_BLOCK_SIZE class _lowercase ( _lowercase ): a = """""" a = ( None ...
631
1
'''simple docstring''' import unittest from transformers import AutoTokenizer, FalconConfig, is_torch_available from transformers.testing_utils import require_torch, slow, torch_device from ...generation.test_utils import GenerationTesterMixin from ...test_configuration_common impor...
631
'''simple docstring''' import argparse import collections import json from pathlib import Path import requests import torch import yaml from huggingface_hub import hf_hub_download from PIL import Image from transformers import ( MobileViTImageProcessor, MobileViTVaCon...
631
1
'''simple docstring''' # coding=utf-8 # Copyright 2023 The HuggingFace Inc. team. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache...
631
'''simple docstring''' import inspect import unittest from transformers import MobileViTVaConfig from transformers.testing_utils import require_torch, require_torch_multi_gpu, require_vision, slow, torch_device from transformers.utils import cached_property, is_torch_available, is_vis...
631
1
'''simple docstring''' from typing import Callable, Optional, Union from ...configuration_utils import PretrainedConfig from ...utils import logging _A : Optional[int] =logging.get_logger(__name__) _A : List[Any] ={ '''microsoft/xprophetnet-large-wiki1...
631
'''simple docstring''' import json from typing import TYPE_CHECKING, List, Optional, Tuple from tokenizers import pre_tokenizers from ...tokenization_utils_fast import PreTrainedTokenizerFast from ...utils import logging if TYPE_CHECKING: from transformers.pipelines.convers...
631
1
'''simple docstring''' from dataclasses import dataclass from typing import Tuple import numpy as np import torch @dataclass class _lowercase : a = 42 # [batch_size x 3] a = 42 # [batch_size x 3] a = 42 # [batch_size x 3] ...
631
'''simple docstring''' from typing import TYPE_CHECKING from ...utils import OptionalDependencyNotAvailable, _LazyModule, is_torch_available _A : Dict ={ '''configuration_git''': ['''GIT_PRETRAINED_CONFIG_ARCHIVE_MAP''', '''GitConfig''', '''GitVisionConfig'''], ...
631
1
'''simple docstring''' import unittest from transformers import is_torch_available from transformers.testing_utils import require_torch, slow, torch_device from ...generation.test_utils import GenerationTesterMixin from ...test_configuration_common import ConfigTester from ...test_...
631
'''simple docstring''' import tempfile import unittest from pathlib import Path from shutil import copyfile from transformers import BatchEncoding, MarianTokenizer from transformers.testing_utils import get_tests_dir, require_sentencepiece, slow from transformers.utils import is_sen...
631
1
'''simple docstring''' from __future__ import annotations # This is the precision for this function which can be altered. # It is recommended for users to keep this number greater than or equal to 10. _A : Optional[int] =10 def SCREAMING_SNAKE_CASE_ (UpperCame...
631
'''simple docstring''' from ...configuration_utils import PretrainedConfig from ...utils import logging _A : Optional[Any] =logging.get_logger(__name__) _A : Optional[int] ={ '''RWKV/rwkv-4-169m-pile''': '''https://huggingface.co/RWKV/rwkv-4-169m-pile/res...
631
1
'''simple docstring''' def SCREAMING_SNAKE_CASE_ (UpperCamelCase ) -> int: lowerCamelCase__ : int = [1] lowerCamelCase__ , lowerCamelCase__ , lowerCamelCase__ : str = 0, 0, 0 lowerCamelCase__ : Optional[int] ...
631
'''simple docstring''' from ...configuration_utils import PretrainedConfig from ...utils import logging _A : str =logging.get_logger(__name__) _A : int ={ '''weiweishi/roc-bert-base-zh''': '''https://huggingface.co/weiweishi/roc-bert-base-zh/resolve/main/...
631
1
'''simple docstring''' def SCREAMING_SNAKE_CASE_ (UpperCamelCase , UpperCamelCase , UpperCamelCase , UpperCamelCase ) -> Dict: # Return True if there is node that has not iterated. lowerCamelCase__ : Dict = [False] * len(UpperC...
631
'''simple docstring''' import sys import turtle def SCREAMING_SNAKE_CASE_ (UpperCamelCase , UpperCamelCase ) -> tuple[float, float]: return (pa[0] + pa[0]) / 2, (pa[1] + pa[1]) / 2 def SCREAMING_SNAKE_CASE_ (UpperCamelCase , Upper...
631
1
'''simple docstring''' def SCREAMING_SNAKE_CASE_ (UpperCamelCase = 10 , UpperCamelCase = 1000 , UpperCamelCase = True ) -> int: assert ( isinstance(UpperCamelCase , UpperCamelCase ) and isinstance(UpperCamelCase , ...
631
'''simple docstring''' from __future__ import annotations import os import tempfile import unittest from transformers import ConvBertConfig, is_tf_available from transformers.testing_utils import require_tf, slow from ...test_configuration_common import ConfigTester from ...tes...
631
1
'''simple docstring''' import os from bleurt import score # From: git+https://github.com/google-research/bleurt.git import datasets _A : int =datasets.logging.get_logger(__name__) _A : Any ='''\ @inproceedings{bleurt, title={BLEURT: Learning Robust M...
631
'''simple docstring''' _A : List[str] ='''0.21.0''' from .accelerator import Accelerator from .big_modeling import ( cpu_offload, cpu_offload_with_hook, disk_offload, dispatch_model, init_empty_weights, init_on_device, load_checkpoint_and_di...
631
1
'''simple docstring''' import copy import os from typing import Union from ...configuration_utils import PretrainedConfig from ...utils import logging _A : Optional[int] =logging.get_logger(__name__) _A : Tuple ={ '''microsoft/git-base''': '''https:/...
631
'''simple docstring''' from ...configuration_utils import PretrainedConfig from ...utils import logging _A : Any =logging.get_logger(__name__) _A : Dict ={ '''microsoft/trocr-base-handwritten''': ( '''https://huggingface.co/microsoft/trocr-base-h...
631
1
'''simple docstring''' from typing import List, Optional, Tuple from ...tokenization_utils_fast import PreTrainedTokenizerFast from ...utils import logging from .tokenization_herbert import HerbertTokenizer _A : Optional[int] =logging.get_logger(__name__) _A : T...
631
'''simple docstring''' # A Bipartite Graph is a graph whose vertices can be divided into two independent sets, # U and V such that every edge (u, v) either connects a vertex from U to V or a vertex # from V to U. In other words, for every edge (u, v), either u belongs to U and v to V, # ...
631
1
'''simple docstring''' from math import factorial, pi def SCREAMING_SNAKE_CASE_ (UpperCamelCase , UpperCamelCase = 30 ) -> float: if not isinstance(UpperCamelCase , (int, float) ): raise ValueError("""maclaurin_sin() requires e...
631
'''simple docstring''' import numpy as np import torch from torch.utils.data import Dataset, IterableDataset from ..utils.generic import ModelOutput class _lowercase ( _lowercase ): def __init__( self: Optional[Any] , UpperCamelCase__: ...
631
1
'''simple docstring''' def SCREAMING_SNAKE_CASE_ (UpperCamelCase , UpperCamelCase = False ) -> bool: if n == 2: return True if not n % 2 or n < 2: return False if n > 5 and n % 10 not in (1, 3, 7, 9): # can quickly chec...
700
'''simple docstring''' # coding=utf-8 # Copyright 2023 The HuggingFace Inc. team. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache...
631
0
'''simple docstring''' from PIL import Image def SCREAMING_SNAKE_CASE_ (UpperCamelCase ) -> Union[str, Any]: lowerCamelCase__ , lowerCamelCase__ : Optional[Any] = image.size lowerCamelCase__ : int = 0 lowerCamelCase__...
701
'''simple docstring''' from typing import TYPE_CHECKING from ...utils import ( OptionalDependencyNotAvailable, _LazyModule, is_sentencepiece_available, is_speech_available, is_torch_available, ) _A : Any ={ '''configuration_trocr''': ['''TRO...
631
0
import math from typing import Optional import numpy as np from ...configuration_utils import PretrainedConfig from ...utils import logging _A : Dict =logging.get_logger(__name__) _A : Union[str, Any] ={ 'facebook/encodec_24khz': 'https://huggingface.co/facebook/...
702
'''simple docstring''' from ...configuration_utils import PretrainedConfig from ...utils import logging _A : Union[str, Any] =logging.get_logger(__name__) _A : List[str] ={ '''MIT/ast-finetuned-audioset-10-10-0.4593''': ( '''https://huggingface.c...
631
0
'''simple docstring''' import gc import random import unittest import numpy as np import torch from transformers import CLIPTextConfig, CLIPTextModel, CLIPTextModelWithProjection, CLIPTokenizer from diffusers import ( AutoencoderKL, DiffusionPipeline, EulerDiscreteScheduler, StableDiffus...
703
'''simple docstring''' import argparse import os import re import packaging.version _A : List[str] ='''examples/''' _A : Any ={ '''examples''': (re.compile(r'''^check_min_version\("[^"]+"\)\s*$''', re.MULTILINE), '''check_min_version("VERSION")\n'''), ...
631
0
'''simple docstring''' from collections.abc import Callable import numpy as np def SCREAMING_SNAKE_CASE_ (UpperCamelCase , UpperCamelCase , UpperCamelCase , UpperCamelCase , UpperCamelCase ) -> np.ndarray: lowerCamelCase__ ...
704
'''simple docstring''' import unittest import torch from diffusers import DDIMScheduler, DDPMScheduler, UNetaDModel from diffusers.training_utils import set_seed from diffusers.utils.testing_utils import slow _A : Union[str, Any] =False class _lowercase ( ...
631
0
'''simple docstring''' from __future__ import annotations import unittest from transformers import AutoTokenizer, MBartConfig, is_tf_available from transformers.testing_utils import require_sentencepiece, require_tf, require_tokenizers, slow from transformers.utils import cached_pro...
705
'''simple docstring''' from statistics import mean import numpy as np def SCREAMING_SNAKE_CASE_ (UpperCamelCase , UpperCamelCase , UpperCamelCase , UpperCamelCase ) -> list: lowerCamelCase__ : Optional[int] = 0 # ...
631
0
'''simple docstring''' def SCREAMING_SNAKE_CASE_ (UpperCamelCase ) -> set: lowerCamelCase__ : List[str] = set() # edges = list of graph's edges lowerCamelCase__ : Optional[int] = get_edges(lowerCamelCase_ ) # While there ...
706
'''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
631
0
'''simple docstring''' from typing import TYPE_CHECKING from ...utils import ( OptionalDependencyNotAvailable, _LazyModule, is_tf_available, is_torch_available, is_vision_available, ) _A : Tuple ={ "configuration_convnext": ["CONVNEXT_PRETRAINED_CONFIG_ARCHIVE_MAP", "...
707
'''simple docstring''' import inspect import math import tempfile import unittest import numpy as np from transformers import ViTMAEConfig from transformers.testing_utils import require_torch, require_vision, slow, torch_device from transformers.utils import cached_property, is_t...
631
0
'''simple docstring''' class _lowercase : def __init__( self: Dict , UpperCamelCase__: Any ): lowerCamelCase__ : str = val lowerCamelCase__ : Tuple = None lowerCamelCase__ : List[str] ...
708
'''simple docstring''' import os from typing import Optional import fsspec from fsspec.archive import AbstractArchiveFileSystem from fsspec.utils import DEFAULT_BLOCK_SIZE class _lowercase ( _lowercase ): a = """""" a = ( None ...
631
0
'''simple docstring''' from math import factorial _A : dict[str, int] ={str(digit): factorial(digit) for digit in range(10)} def SCREAMING_SNAKE_CASE_ (UpperCamelCase ) -> Tuple: if not isinstance(__lowerCAmelCase , __lowerCAmelCase ): ...
709
'''simple docstring''' import argparse import collections import json from pathlib import Path import requests import torch import yaml from huggingface_hub import hf_hub_download from PIL import Image from transformers import ( MobileViTImageProcessor, MobileViTVaCon...
631
0
'''simple docstring''' from __future__ import annotations import math def SCREAMING_SNAKE_CASE_ (UpperCamelCase ) -> bool: if 1 < number < 4: # 2 and 3 are primes return True elif number < 2 or number % 2 == 0 or number...
710
'''simple docstring''' import inspect import unittest from transformers import MobileViTVaConfig from transformers.testing_utils import require_torch, require_torch_multi_gpu, require_vision, slow, torch_device from transformers.utils import cached_property, is_torch_available, is_vis...
631
0
import argparse from pathlib import Path from transformers import AutoConfig, AutoTokenizer, RagConfig, RagSequenceForGeneration, RagTokenForGeneration def SCREAMING_SNAKE_CASE_ (UpperCamelCase , UpperCamelCase , UpperCamelCase , UpperCamelCase , Uppe...
711
'''simple docstring''' import json from typing import TYPE_CHECKING, List, Optional, Tuple from tokenizers import pre_tokenizers from ...tokenization_utils_fast import PreTrainedTokenizerFast from ...utils import logging if TYPE_CHECKING: from transformers.pipelines.convers...
631
0
'''simple docstring''' import json from typing import List, Optional, Tuple from tokenizers import normalizers from ...tokenization_utils_fast import PreTrainedTokenizerFast from ...utils import logging from .tokenization_distilbert import DistilBertTokenizer _A : Optiona...
712
'''simple docstring''' from typing import TYPE_CHECKING from ...utils import OptionalDependencyNotAvailable, _LazyModule, is_torch_available _A : Dict ={ '''configuration_git''': ['''GIT_PRETRAINED_CONFIG_ARCHIVE_MAP''', '''GitConfig''', '''GitVisionConfig'''], ...
631
0
'''simple docstring''' import numpy # List of input, output pairs _A : Tuple =( ((5, 2, 3), 15), ((6, 5, 9), 25), ((11, 12, 13), 41), ((1, 1, 1), 8), ((11, 12, 13), 41), ) _A : Dict =(((515, 22, 13), 555), ((61, 35, 49), 150)) _A : ...
713
'''simple docstring''' import tempfile import unittest from pathlib import Path from shutil import copyfile from transformers import BatchEncoding, MarianTokenizer from transformers.testing_utils import get_tests_dir, require_sentencepiece, slow from transformers.utils import is_sen...
631
0
'''simple docstring''' import requests from bsa import BeautifulSoup def SCREAMING_SNAKE_CASE_ (UpperCamelCase = "https://www.worldometers.info/coronavirus" ) -> str: lowerCamelCase__ : List[str] = BeautifulSoup(requests.get(lowerCAmelCase__ ).text...
714
'''simple docstring''' from ...configuration_utils import PretrainedConfig from ...utils import logging _A : Optional[Any] =logging.get_logger(__name__) _A : Optional[int] ={ '''RWKV/rwkv-4-169m-pile''': '''https://huggingface.co/RWKV/rwkv-4-169m-pile/res...
631
0
# Copyright 2023 The HuggingFace Inc. team. All rights reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # U...
715
'''simple docstring''' from ...configuration_utils import PretrainedConfig from ...utils import logging _A : str =logging.get_logger(__name__) _A : int ={ '''weiweishi/roc-bert-base-zh''': '''https://huggingface.co/weiweishi/roc-bert-base-zh/resolve/main/...
631
0
'''simple docstring''' import gc import unittest import numpy as np import torch from diffusers import DanceDiffusionPipeline, IPNDMScheduler, UNetaDModel from diffusers.utils import slow, torch_device from diffusers.utils.testing_utils import enable_full_determinism, require_torc...
716
'''simple docstring''' import sys import turtle def SCREAMING_SNAKE_CASE_ (UpperCamelCase , UpperCamelCase ) -> tuple[float, float]: return (pa[0] + pa[0]) / 2, (pa[1] + pa[1]) / 2 def SCREAMING_SNAKE_CASE_ (UpperCamelCase , Upper...
631
0
'''simple docstring''' from typing import List, Optional, Union from ...image_utils import ImageInput from ...processing_utils import ProcessorMixin from ...tokenization_utils_base import BatchEncoding, PaddingStrategy, PreTokenizedInput, TextInput, TruncationStrategy from ...utils im...
717
'''simple docstring''' from __future__ import annotations import os import tempfile import unittest from transformers import ConvBertConfig, is_tf_available from transformers.testing_utils import require_tf, slow from ...test_configuration_common import ConfigTester from ...tes...
631
0
'''simple docstring''' import timeit import numpy as np import datasets from datasets.arrow_writer import ArrowWriter from datasets.features.features import _ArrayXD def SCREAMING_SNAKE_CASE_ (UpperCamelCase ) -> List[str]: def wrapper(*UpperCa...
718
'''simple docstring''' _A : List[str] ='''0.21.0''' from .accelerator import Accelerator from .big_modeling import ( cpu_offload, cpu_offload_with_hook, disk_offload, dispatch_model, init_empty_weights, init_on_device, load_checkpoint_and_di...
631
0
'''simple docstring''' import argparse import json import os import torch from torch import nn from transformers import NllbMoeConfig, NllbMoeModel from transformers.modeling_utils import dtype_byte_size from transformers.utils import WEIGHTS_INDEX_NAME, WEIGHTS_NAME def SCREAMING_SNAKE_CASE_ (...
719
'''simple docstring''' from ...configuration_utils import PretrainedConfig from ...utils import logging _A : Any =logging.get_logger(__name__) _A : Dict ={ '''microsoft/trocr-base-handwritten''': ( '''https://huggingface.co/microsoft/trocr-base-h...
631
0
'''simple docstring''' import unittest from transformers import ( MODEL_FOR_OBJECT_DETECTION_MAPPING, AutoFeatureExtractor, AutoModelForObjectDetection, ObjectDetectionPipeline, is_vision_available, pipeline, ) from transformers.testing_utils import ( ...
720
'''simple docstring''' # A Bipartite Graph is a graph whose vertices can be divided into two independent sets, # U and V such that every edge (u, v) either connects a vertex from U to V or a vertex # from V to U. In other words, for every edge (u, v), either u belongs to U and v to V, # ...
631
0
'''simple docstring''' from collections import OrderedDict from typing import Mapping from ...configuration_utils import PretrainedConfig from ...onnx import OnnxConfig from ...utils import logging _A : Union[str, Any] =logging.get_logger(__name__) _A : Union[s...
721
'''simple docstring''' import numpy as np import torch from torch.utils.data import Dataset, IterableDataset from ..utils.generic import ModelOutput class _lowercase ( _lowercase ): def __init__( self: Optional[Any] , UpperCamelCase__: ...
631
0
'''simple docstring''' from ...configuration_utils import PretrainedConfig from ...utils import logging _A : Any =logging.get_logger(__name__) _A : List[str] ={ '''facebook/dpr-ctx_encoder-single-nq-base''': ( '''https://huggingface.co/facebook/d...
700
'''simple docstring''' # coding=utf-8 # Copyright 2023 The HuggingFace Inc. team. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache...
631
0
'''simple docstring''' import os import torch from ..logging import get_logger from .constants import FSDP_PYTORCH_VERSION, MODEL_NAME, OPTIMIZER_NAME from .versions import is_torch_version if is_torch_version('''>=''', FSDP_PYTORCH_VERSION): import torch.distributed.checkp...
701
'''simple docstring''' from typing import TYPE_CHECKING from ...utils import ( OptionalDependencyNotAvailable, _LazyModule, is_sentencepiece_available, is_speech_available, is_torch_available, ) _A : Any ={ '''configuration_trocr''': ['''TRO...
631
0
import argparse import json import os import fairseq import torch from fairseq.data import Dictionary from transformers import ( UniSpeechConfig, UniSpeechForCTC, UniSpeechForPreTraining, WavaVecaFeatureExtractor, WavaVecaPhonemeCTCTokenizer, WavaVecaProcessor, ...
702
'''simple docstring''' from ...configuration_utils import PretrainedConfig from ...utils import logging _A : Union[str, Any] =logging.get_logger(__name__) _A : List[str] ={ '''MIT/ast-finetuned-audioset-10-10-0.4593''': ( '''https://huggingface.c...
631
0
'''simple docstring''' from typing import List, Union import numpy as np from ..utils import add_end_docstrings, is_torch_available, is_vision_available, logging, requires_backends from .base import PIPELINE_INIT_ARGS, Pipeline if is_vision_available(): from PIL import Image from ..image_utils ...
703
'''simple docstring''' import argparse import os import re import packaging.version _A : List[str] ='''examples/''' _A : Any ={ '''examples''': (re.compile(r'''^check_min_version\("[^"]+"\)\s*$''', re.MULTILINE), '''check_min_version("VERSION")\n'''), ...
631
0
'''simple docstring''' def SCREAMING_SNAKE_CASE_ (UpperCamelCase = 100 ) -> str: lowerCamelCase__ : Dict = n * (n + 1) * (2 * n + 1) / 6 lowerCamelCase__ : Dict = (n * (n + 1) / 2) ** 2 return int(square_of_sum - sum_of_squares ) ...
704
'''simple docstring''' import unittest import torch from diffusers import DDIMScheduler, DDPMScheduler, UNetaDModel from diffusers.training_utils import set_seed from diffusers.utils.testing_utils import slow _A : Union[str, Any] =False class _lowercase ( ...
631
0
'''simple docstring''' from __future__ import annotations def SCREAMING_SNAKE_CASE_ (UpperCamelCase , UpperCamelCase ) -> Optional[Any]: # Checks if the entire collection has been sorted if len(UpperCamelCase ) <= 1 or n <= 1: ret...
705
'''simple docstring''' from statistics import mean import numpy as np def SCREAMING_SNAKE_CASE_ (UpperCamelCase , UpperCamelCase , UpperCamelCase , UpperCamelCase ) -> list: lowerCamelCase__ : Optional[int] = 0 # ...
631
0
'''simple docstring''' def SCREAMING_SNAKE_CASE_ (UpperCamelCase = 1000 ) -> List[Any]: return sum(e for e in range(3 , snake_case__ ) if e % 3 == 0 or e % 5 == 0 ) if __name__ == "__main__": print(F'{solution() = }')
706
'''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
631
0
'''simple docstring''' import os from datetime import datetime as dt from github import Github _A : List[Any] =[ '''good first issue''', '''feature request''', '''wip''', ] def SCREAMING_SNAKE_CASE_ () -> str: lowerCamelCase__ : Union[str, Any] = Gi...
707
'''simple docstring''' import inspect import math import tempfile import unittest import numpy as np from transformers import ViTMAEConfig from transformers.testing_utils import require_torch, require_vision, slow, torch_device from transformers.utils import cached_property, is_t...
631
0
'''simple docstring''' from __future__ import annotations import unittest from transformers import AutoTokenizer, PegasusConfig, is_tf_available from transformers.testing_utils import require_sentencepiece, require_tf, require_tokenizers, slow from transformers.utils import cached_property from ...test...
708
'''simple docstring''' import os from typing import Optional import fsspec from fsspec.archive import AbstractArchiveFileSystem from fsspec.utils import DEFAULT_BLOCK_SIZE class _lowercase ( _lowercase ): a = """""" a = ( None ...
631
0
'''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 _A : Union[str, Any] =logging.get_logger(_...
709
'''simple docstring''' import argparse import collections import json from pathlib import Path import requests import torch import yaml from huggingface_hub import hf_hub_download from PIL import Image from transformers import ( MobileViTImageProcessor, MobileViTVaCon...
631
0
'''simple docstring''' import logging import os import sys from dataclasses import dataclass, field from importlib import import_module from typing import Dict, List, Optional, Tuple import numpy as np from seqeval.metrics import accuracy_score, fa_score, precision_score, recall_sc...
710
'''simple docstring''' import inspect import unittest from transformers import MobileViTVaConfig from transformers.testing_utils import require_torch, require_torch_multi_gpu, require_vision, slow, torch_device from transformers.utils import cached_property, is_torch_available, is_vis...
631
0
from __future__ import annotations def SCREAMING_SNAKE_CASE_ (UpperCamelCase , UpperCamelCase ) -> Tuple: if len(_snake_case ) < k or k < 0: raise ValueError("""Invalid Input""" ) lowerCamelCase__ : Dict = sum(array[:k] ) ...
711
'''simple docstring''' import json from typing import TYPE_CHECKING, List, Optional, Tuple from tokenizers import pre_tokenizers from ...tokenization_utils_fast import PreTrainedTokenizerFast from ...utils import logging if TYPE_CHECKING: from transformers.pipelines.convers...
631
0
'''simple docstring''' import comet # From: unbabel-comet import torch import datasets _A : Dict =datasets.logging.get_logger(__name__) _A : List[str] ='\\n@inproceedings{rei-EtAl:2020:WMT,\n author = {Rei, Ricardo and Stewart, Craig and Farinha, ...
712
'''simple docstring''' from typing import TYPE_CHECKING from ...utils import OptionalDependencyNotAvailable, _LazyModule, is_torch_available _A : Dict ={ '''configuration_git''': ['''GIT_PRETRAINED_CONFIG_ARCHIVE_MAP''', '''GitConfig''', '''GitVisionConfig'''], ...
631
0
'''simple docstring''' class _lowercase : def __init__( self: Any ): lowerCamelCase__ : Dict = """""" lowerCamelCase__ : Any = """""" lowerCamelCase__ : List[str] = [] ...
713
'''simple docstring''' import tempfile import unittest from pathlib import Path from shutil import copyfile from transformers import BatchEncoding, MarianTokenizer from transformers.testing_utils import get_tests_dir, require_sentencepiece, slow from transformers.utils import is_sen...
631
0
'''simple docstring''' import pytest import requests from datasets.utils.file_utils import http_head from .utils import OfflineSimulationMode, RequestWouldHangIndefinitelyError, offline @pytest.mark.integration def SCREAMING_SNAKE_CASE_ () -> Optional[int]: ...
714
'''simple docstring''' from ...configuration_utils import PretrainedConfig from ...utils import logging _A : Optional[Any] =logging.get_logger(__name__) _A : Optional[int] ={ '''RWKV/rwkv-4-169m-pile''': '''https://huggingface.co/RWKV/rwkv-4-169m-pile/res...
631
0
from math import asin, atan, cos, radians, sin, sqrt, tan _A : Optional[Any] =637_8137.0 _A : Union[str, Any] =635_6752.31_4245 _A : Dict =6_378_137 def SCREAMING_SNAKE_CASE_ (UpperCamelCase , UpperCamelCase , UpperCamelCase , ...
715
'''simple docstring''' from ...configuration_utils import PretrainedConfig from ...utils import logging _A : str =logging.get_logger(__name__) _A : int ={ '''weiweishi/roc-bert-base-zh''': '''https://huggingface.co/weiweishi/roc-bert-base-zh/resolve/main/...
631
0
'''simple docstring''' def SCREAMING_SNAKE_CASE_ (UpperCamelCase , UpperCamelCase ) -> int: return int(input_a == input_a == 0 ) def SCREAMING_SNAKE_CASE_ () -> None: print("""Truth Table of NOR Gate:""" ) print("""| Input 1 ...
716
'''simple docstring''' import sys import turtle def SCREAMING_SNAKE_CASE_ (UpperCamelCase , UpperCamelCase ) -> tuple[float, float]: return (pa[0] + pa[0]) / 2, (pa[1] + pa[1]) / 2 def SCREAMING_SNAKE_CASE_ (UpperCamelCase , Upper...
631
0
'''simple docstring''' import timeit import numpy as np import datasets from datasets.arrow_writer import ArrowWriter from datasets.features.features import _ArrayXD def SCREAMING_SNAKE_CASE_ (UpperCamelCase ) -> Tuple: def wrapper(*UpperCamelCase ...
717
'''simple docstring''' from __future__ import annotations import os import tempfile import unittest from transformers import ConvBertConfig, is_tf_available from transformers.testing_utils import require_tf, slow from ...test_configuration_common import ConfigTester from ...tes...
631
0
'''simple docstring''' def SCREAMING_SNAKE_CASE_ (UpperCamelCase ) -> str: if len(__lowerCAmelCase ) <= 1: return lst lowerCamelCase__ : Optional[int] = 1 while i < len(__lowerCAmelCase ): if lst[i - 1] <= ls...
718
'''simple docstring''' _A : List[str] ='''0.21.0''' from .accelerator import Accelerator from .big_modeling import ( cpu_offload, cpu_offload_with_hook, disk_offload, dispatch_model, init_empty_weights, init_on_device, load_checkpoint_and_di...
631
0
'''simple docstring''' import logging import os from dataclasses import dataclass, field from typing import Dict, Optional import numpy as np from utils_multiple_choice import MultipleChoiceDataset, Split, processors import transformers from transformers import ( AutoConfig, AutoModelForMultiple...
719
'''simple docstring''' from ...configuration_utils import PretrainedConfig from ...utils import logging _A : Any =logging.get_logger(__name__) _A : Dict ={ '''microsoft/trocr-base-handwritten''': ( '''https://huggingface.co/microsoft/trocr-base-h...
631
0
'''simple docstring''' from typing import List, Optional, Union from ...configuration_utils import PretrainedConfig from ...utils import logging _A : str =logging.get_logger(__name__) _A : Any ={ 'huggingface/time-series-transformer-tourism-monthly': (...
720
'''simple docstring''' # A Bipartite Graph is a graph whose vertices can be divided into two independent sets, # U and V such that every edge (u, v) either connects a vertex from U to V or a vertex # from V to U. In other words, for every edge (u, v), either u belongs to U and v to V, # ...
631
0
'''simple docstring''' _A : Any =0 # The first color of the flag. _A : Union[str, Any] =1 # The second color of the flag. _A : List[str] =2 # The third color of the flag. _A : Optional[int] =(red, white, blue) def SCREAMING_SN...
721
'''simple docstring''' import numpy as np import torch from torch.utils.data import Dataset, IterableDataset from ..utils.generic import ModelOutput class _lowercase ( _lowercase ): def __init__( self: Optional[Any] , UpperCamelCase__: ...
631
0
'''simple docstring''' import math def SCREAMING_SNAKE_CASE_ (UpperCamelCase , UpperCamelCase ) -> float: if initial_intensity < 0: raise ValueError("""The value of intensity cannot be negative""" ) # handling of negative...
700
'''simple docstring''' # coding=utf-8 # Copyright 2023 The HuggingFace Inc. team. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache...
631
0
'''simple docstring''' import torch def SCREAMING_SNAKE_CASE_ () -> Dict: if torch.cuda.is_available(): lowerCamelCase__ : List[str] = torch.cuda.device_count() else: lowerCamelCase__ : int = 0 ...
701
'''simple docstring''' from typing import TYPE_CHECKING from ...utils import ( OptionalDependencyNotAvailable, _LazyModule, is_sentencepiece_available, is_speech_available, is_torch_available, ) _A : Any ={ '''configuration_trocr''': ['''TRO...
631
0
def SCREAMING_SNAKE_CASE_ (UpperCamelCase , UpperCamelCase ) -> List[str]: return x if y == 0 else greatest_common_divisor(lowercase__ , x % y ) def SCREAMING_SNAKE_CASE_ (UpperCamelCase , UpperCamelCase ) -> int: return (x * y) // gr...
702
'''simple docstring''' from ...configuration_utils import PretrainedConfig from ...utils import logging _A : Union[str, Any] =logging.get_logger(__name__) _A : List[str] ={ '''MIT/ast-finetuned-audioset-10-10-0.4593''': ( '''https://huggingface.c...
631
0
'''simple docstring''' import argparse import pathlib import fairseq import torch from fairseq.models.roberta import RobertaModel as FairseqRobertaModel from fairseq.modules import TransformerSentenceEncoderLayer from packaging import version from transformers import XLMRobertaConfig, XLMRobertaXLForMas...
703
'''simple docstring''' import argparse import os import re import packaging.version _A : List[str] ='''examples/''' _A : Any ={ '''examples''': (re.compile(r'''^check_min_version\("[^"]+"\)\s*$''', re.MULTILINE), '''check_min_version("VERSION")\n'''), ...
631
0
'''simple docstring''' import argparse import os import torch from transformers import FlavaConfig, FlavaForPreTraining from transformers.models.flava.convert_dalle_to_flava_codebook import convert_dalle_checkpoint def SCREAMING_SNAKE_CASE_ (UpperCamelCase ) -> Op...
704
'''simple docstring''' import unittest import torch from diffusers import DDIMScheduler, DDPMScheduler, UNetaDModel from diffusers.training_utils import set_seed from diffusers.utils.testing_utils import slow _A : Union[str, Any] =False class _lowercase ( ...
631
0
'''simple docstring''' def SCREAMING_SNAKE_CASE_ (UpperCamelCase ) -> List[str]: if p < 2: raise ValueError("""p should not be less than 2!""" ) elif p == 2: return True lowerCamelCase__ : int = 4 lower...
705
'''simple docstring''' from statistics import mean import numpy as np def SCREAMING_SNAKE_CASE_ (UpperCamelCase , UpperCamelCase , UpperCamelCase , UpperCamelCase ) -> list: lowerCamelCase__ : Optional[int] = 0 # ...
631
0
'''simple docstring''' import operator def SCREAMING_SNAKE_CASE_ (UpperCamelCase , UpperCamelCase = False , UpperCamelCase = None ) -> Any: lowerCamelCase__ : Optional[int] = operator.lt if reverse else operator.gt lowerCamel...
706
'''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
631
0
'''simple docstring''' from .data_collator import ( DataCollatorForLanguageModeling, DataCollatorForPermutationLanguageModeling, DataCollatorForSeqaSeq, DataCollatorForSOP, DataCollatorForTokenClassification, DataCollatorForWholeWordMask, DataCollatorWithPadding, DefaultDat...
707
'''simple docstring''' import inspect import math import tempfile import unittest import numpy as np from transformers import ViTMAEConfig from transformers.testing_utils import require_torch, require_vision, slow, torch_device from transformers.utils import cached_property, is_t...
631
0