code
stringlengths
82
54.1k
code_codestyle
int64
0
699
style_context
stringlengths
111
35.6k
style_context_codestyle
int64
0
699
label
int64
0
1
'''simple docstring''' # flake8: noqa # Lint as: python3 from typing import Dict, List, Optional, Type from .. import config from ..utils import logging from .formatting import ( ArrowFormatter, CustomFormatter, Formatter, PandasFormatter, PythonFormatter, TensorFormatter, ...
427
import os from math import logaa def _lowerCAmelCase ( __magic_name__ :str = "base_exp.txt" ): UpperCAmelCase_ = 0 UpperCAmelCase_ = 0 for i, line in enumerate(open(os.path.join(os.path.dirname(__magic_name__ ) , __magic_name__ ) )...
121
0
"""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/licenses/LICENS...
346
import random import sys import numpy as np from matplotlib import pyplot as plt from matplotlib.colors import ListedColormap _lowerCamelCase : Any = 'Usage of script: script_name <size_of_canvas:int>' _lowerCamelCase : Dict = [0] * 100 + [1] * 10 random.shuffle(choice...
121
0
"""simple docstring""" def __snake_case ( __A ,__A ) -> Union[str, Any]: lowercase : Optional[int] = len(__A ) lowercase : Any = [] for i in range(len(__A ) - pat_len + 1 ): lowercase : Optional[int] = True ...
607
from __future__ import annotations def _lowerCAmelCase ( __magic_name__ :list[int | str] ): create_state_space_tree(__magic_name__ , [] , 0 , [0 for i in range(len(__magic_name__ ) )] ) def _lowerCAmelCase ( ...
121
0
import os import sys from contextlib import contextmanager # Windows only if os.name == "nt": import ctypes import msvcrt # noqa class _A ( ctypes.Structure ): SCREAMING_SNAKE_CASE_ : str =[("size", ctypes.c_int), ("visible", ctypes.c_byte)] ...
415
# tests directory-specific settings - this file is run automatically # by pytest before any tests are run import sys import warnings from os.path import abspath, dirname, join # allow having multiple repository checkouts and not needing to remember to rerun # 'pip install -e .[dev]' when switchi...
121
0
def A_ ( lowercase_ , lowercase_ ) -> Tuple: if a < 0 or b < 0: raise ValueError('''the value of both inputs must be positive''' ) _snake_case : List[str] = str(bin(lowercase_ ) )[2:] # remove the leading "0b" _snake_case : List[str] ...
326
import argparse import hashlib import os import urllib import warnings import torch from torch import nn from tqdm import tqdm from transformers import WhisperConfig, WhisperForConditionalGeneration _lowerCamelCase : Union[str, Any] = { 'tiny.en': 'https://openaipublic.azu...
121
0
'''simple docstring''' import os import unittest from transformers.models.bartpho.tokenization_bartpho import VOCAB_FILES_NAMES, BartphoTokenizer from transformers.testing_utils import get_tests_dir from ...test_tokenization_common import TokenizerTesterMixin __SCREAMING_SNAKE_CASE = get_tests_dir(...
688
import argparse import torch from transformers import MobileBertConfig, MobileBertForPreTraining, load_tf_weights_in_mobilebert from transformers.utils import logging logging.set_verbosity_info() def _lowerCAmelCase ( __magic_name__ :Union[str, Any] , __magic_na...
121
0
def lowerCAmelCase_ ( __a ) -> Any: """simple docstring""" lowerCamelCase__: int =len(__a ) while cur > 1: # Find the maximum number in arr lowerCamelCase__: str =arr.index(max(arr[0:cur] ) ) # Reverse from 0 to mi lowerCamelCase__:...
59
from typing import TYPE_CHECKING from ...utils import OptionalDependencyNotAvailable, _LazyModule, is_tokenizers_available, is_torch_available _lowerCamelCase : Dict = { 'configuration_bloom': ['BLOOM_PRETRAINED_CONFIG_ARCHIVE_MAP', 'BloomConfig', 'BloomOnnxConfig'], } try: ...
121
0
import argparse import collections import numpy as np import torch from flax import traverse_util from tax import checkpoints from transformers import MTaConfig, UMTaEncoderModel, UMTaForConditionalGeneration from transformers.utils import logging logging.set_verbosity_info() def a_ ...
246
_lowerCamelCase : dict[tuple[int, int, int], int] = {} def _lowerCAmelCase ( __magic_name__ :int , __magic_name__ :int , __magic_name__ :int ): # if we are absent twice, or late 3 consecutive days, # no further prize strings are possib...
121
0
import logging import os from typing import List, TextIO, Union from conllu import parse_incr from utils_ner import InputExample, Split, TokenClassificationTask a__ : List[Any] = logging.getLogger(__name__) class UpperCAmelCase_ ( __snake_case ): def __init__( self ,__snake_...
188
import enum import warnings from ..tokenization_utils import TruncationStrategy from ..utils import add_end_docstrings, is_tf_available, is_torch_available, logging from .base import PIPELINE_INIT_ARGS, Pipeline if is_tf_available(): import tensorflow as tf from ..models.auto.modeli...
121
0
'''simple docstring''' def __UpperCamelCase( _A : list , _A : list , _A : int ): '''simple docstring''' UpperCAmelCase__ : List[Any] = len(_A ) UpperCAmelCase__ : Optional[int] = [[0] * n for i in range(_A )] for i in range(_A ...
614
import argparse 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_seed from accelerate import Acceler...
121
0
from ..utils import DummyObject, requires_backends class _SCREAMING_SNAKE_CASE ( metaclass=__snake_case ): lowerCamelCase_ = ['onnx'] def __init__( self : int , *snake_case_ : List[str] , **snake_case_ : int ): """simple docstring""" ...
256
from typing import TYPE_CHECKING from ...utils import ( OptionalDependencyNotAvailable, _LazyModule, is_tf_available, is_torch_available, is_vision_available, ) _lowerCamelCase : Optional[Any] = { 'configuration_mobilevit': ['MOBILEVIT_PRETRAINED_CONFIG_AR...
121
0
'''simple docstring''' import argparse import pickle import numpy as np import torch from torch import nn from transformers import ReformerConfig, ReformerModelWithLMHead from transformers.utils import logging logging.set_verbosity_info() def UpperCamelCase_ ( snake_case_ : List...
427
import gc import unittest import numpy as np import torch from diffusers import AutoencoderKL, DDIMScheduler, DiTPipeline, DPMSolverMultistepScheduler, TransformeraDModel from diffusers.utils import is_xformers_available, load_numpy, slow, torch_device from diffusers.utils.testing_utils import ena...
121
0
"""simple docstring""" __A = 9.80_665 def a__ ( __SCREAMING_SNAKE_CASE , __SCREAMING_SNAKE_CASE , __SCREAMING_SNAKE_CASE = g ) -> Optional[int]: if fluid_density <= 0: raise ValueError("Impossible fluid density" ) if volume < 0: ...
346
from .integrations import ( is_optuna_available, is_ray_available, is_sigopt_available, is_wandb_available, run_hp_search_optuna, run_hp_search_ray, run_hp_search_sigopt, run_hp_search_wandb, ) from .trainer_utils import ( HPSearchBackend, default_hp_space...
121
0
"""simple docstring""" import os import tempfile import unittest from transformers import FlaubertConfig, is_torch_available from transformers.testing_utils import require_torch, require_torch_gpu, slow, torch_device from ...test_configuration_common import ConfigTester from ...test_modeling_comm...
607
def _lowerCAmelCase ( __magic_name__ :list ): if any(not isinstance(__magic_name__ , __magic_name__ ) or x < 0 for x in sequence ): raise TypeError('''Sequence must be list of non-negative integers''' ) for _ in range(len(__magic_name__ ...
121
0
__magic_name__ =8.31_44_62 # Unit - J mol-1 K-1 def __UpperCamelCase ( A , A , A ): if moles < 0 or kelvin < 0 or volume < 0: raise ValueError('''Invalid inputs. Enter positive value.''' ) return moles * kelvin * UNIVERSAL_GAS_CONSTANT / volume ...
415
import argparse import json import os from collections import OrderedDict import numpy as np import tensorflow as tf import torch def _lowerCAmelCase ( __magic_name__ :Optional[Any] ): UpperCAmelCase_ = os.path.join(args.tf_model_dir , '''parameters.jso...
121
0
from typing import TYPE_CHECKING from ...utils import ( OptionalDependencyNotAvailable, _LazyModule, is_tf_available, is_tokenizers_available, is_torch_available, ) lowerCAmelCase_ = { 'configuration_deberta': ['DEBERTA_PRETRAINED_CONFIG_ARCHIVE_MAP', 'DebertaConfig', 'DebertaOnnxCon...
326
def _lowerCAmelCase ( __magic_name__ :list[list[int]] , __magic_name__ :int , __magic_name__ :int , __magic_name__ :set ): UpperCAmelCase_, UpperCAmelCase_ = len(__magic_name__ ), len(grid[0] ) if ( min(__magic_name__ , __ma...
121
0
'''simple docstring''' import json import pathlib import unittest import numpy as np from transformers.testing_utils import require_torch, require_vision, slow from transformers.utils import is_torch_available, is_vision_available from ...test_image_processing_common import ImageProcessingSavingTestMixin, pr...
688
import logging import os from typing import List, TextIO, Union from conllu import parse_incr from utils_ner import InputExample, Split, TokenClassificationTask _lowerCamelCase : List[Any] = logging.getLogger(__name__) class snake_case__ ( __snake_case ): ...
121
0
import os import sys import tempfile import torch from .state import AcceleratorState from .utils import PrecisionType, PrepareForLaunch, is_mps_available, patch_environment def lowerCAmelCase_ ( __a , __a=() , __a=None , __a="no" , __a="29500" ) -> ...
59
def _lowerCAmelCase ( __magic_name__ :str ): UpperCAmelCase_ = '''''' for ch in key: if ch == " " or ch not in key_no_dups and ch.isalpha(): key_no_dups += ch return key_no_dups def _lowerCAmelCase ( __magic_name_...
121
0
from typing import TYPE_CHECKING from ...utils import OptionalDependencyNotAvailable, _LazyModule, is_tokenizers_available, is_torch_available _lowerCAmelCase : Dict = { 'configuration_bloom': ['BLOOM_PRETRAINED_CONFIG_ARCHIVE_MAP', 'BloomConfig', 'BloomOnnxConfig'], } try: if ...
246
from typing import TYPE_CHECKING from ...utils import OptionalDependencyNotAvailable, _LazyModule, is_torch_available _lowerCamelCase : str = { 'configuration_jukebox': [ 'JUKEBOX_PRETRAINED_CONFIG_ARCHIVE_MAP', 'JukeboxConfig', 'JukeboxPriorConfig', ...
121
0
import argparse import os import torch from transformers import FlavaImageCodebook, FlavaImageCodebookConfig def UpperCAmelCase_ ( _UpperCAmelCase :str , _UpperCAmelCase :str , _UpperCAmelCase :Optional[int] , _UpperCAmelCase :Optional[int] ) -> List[s...
188
from __future__ import annotations from collections import namedtuple from dataclasses import dataclass @dataclass class snake_case__ : '''simple docstring''' __A = 42 __A = None __A = None _lowerCamelCas...
121
0
'''simple docstring''' import argparse import torch from transformers import YosoConfig, YosoForMaskedLM def __UpperCamelCase( _A : List[str] ): '''simple docstring''' if "model" in orig_key: UpperCAmelCase__ : Optional[int] = orig_key.replace('''model.''' , '''''' ...
614
from __future__ import annotations def _lowerCAmelCase ( __magic_name__ :int ): UpperCAmelCase_ = [True] * limit UpperCAmelCase_ = False UpperCAmelCase_ = False UpperCAmelCase_ = True for i in range(3 , int(limit**0.5 + 1 ) ...
121
0
from __future__ import annotations import random # Maximum size of the population. Bigger could be faster but is more memory expensive. UpperCamelCase_ = 2_00 # Number of elements selected in every generation of evolution. The selection takes # place from best to worst of that generation and must ...
256
import argparse import logging import pickle from collections import Counter logging.basicConfig( format='%(asctime)s - %(levelname)s - %(name)s - %(message)s', datefmt='%m/%d/%Y %H:%M:%S', level=logging.INFO ) _lowerCamelCase : str = logging.getLogger(__name__) if __name__ ==...
121
0
'''simple docstring''' from collections import UserDict from typing import List, Union from ..utils import ( add_end_docstrings, is_tf_available, is_torch_available, is_vision_available, logging, requires_backends, ) from .base import PIPELINE_INIT_ARGS, Pipeline if is_vision...
427
import os from math import logaa def _lowerCAmelCase ( __magic_name__ :str = "base_exp.txt" ): UpperCAmelCase_ = 0 UpperCAmelCase_ = 0 for i, line in enumerate(open(os.path.join(os.path.dirname(__magic_name__ ) , __magic_name__ ) )...
121
0
"""simple docstring""" from __future__ import annotations import math __A = '2020.9.26' __A = 'xcodz-dot, cclaus, dhruvmanila' def a__ ( __SCREAMING_SNAKE_CASE , __SCREAMING_SNAKE_CASE , __SCREAMING_SNAKE_CASE , __SCREAMING_SNAKE_CASE , ...
346
import random import sys import numpy as np from matplotlib import pyplot as plt from matplotlib.colors import ListedColormap _lowerCamelCase : Any = 'Usage of script: script_name <size_of_canvas:int>' _lowerCamelCase : Dict = [0] * 100 + [1] * 10 random.shuffle(choice...
121
0
"""simple docstring""" import os def __snake_case ( __A = "input.txt" ) -> Optional[Any]: with open(os.path.join(os.path.dirname(__A ) ,__A ) ) as input_file: lowercase : Any = [ [int(__A ) for element in line.split(""","...
607
from __future__ import annotations def _lowerCAmelCase ( __magic_name__ :list[int | str] ): create_state_space_tree(__magic_name__ , [] , 0 , [0 for i in range(len(__magic_name__ ) )] ) def _lowerCAmelCase ( ...
121
0
from __future__ import annotations def __UpperCamelCase ( A ): if len(A ) == 0: return array UpperCamelCase__ , UpperCamelCase__ = min(A ), max(A ) # Compute the variables UpperCamelCase__ = _max - _min + 1 Up...
415
# tests directory-specific settings - this file is run automatically # by pytest before any tests are run import sys import warnings from os.path import abspath, dirname, join # allow having multiple repository checkouts and not needing to remember to rerun # 'pip install -e .[dev]' when switchi...
121
0
from __future__ import annotations from collections.abc import Callable lowerCAmelCase_ = list[list[float | int]] def A_ ( lowercase_ , lowercase_ ) -> Union[str, Any]: _snake_case : Dict = len(lowercase_ ) _snake_case : Union[str, Any] = [[0 ...
326
import argparse import hashlib import os import urllib import warnings import torch from torch import nn from tqdm import tqdm from transformers import WhisperConfig, WhisperForConditionalGeneration _lowerCamelCase : Union[str, Any] = { 'tiny.en': 'https://openaipublic.azu...
121
0
'''simple docstring''' def __a ( lowerCAmelCase__ : int ): if number > 0: raise ValueError('''input must be a negative integer''' ) a__ : Any = len(bin(lowerCAmelCase__ )[3:] ) a__ : Optional[Any] = bin(abs(lowerCAmelCase_...
688
import argparse import torch from transformers import MobileBertConfig, MobileBertForPreTraining, load_tf_weights_in_mobilebert from transformers.utils import logging logging.set_verbosity_info() def _lowerCAmelCase ( __magic_name__ :Union[str, Any] , __magic_na...
121
0
def lowerCAmelCase_ ( __a , __a ) -> Optional[Any]: """simple docstring""" lowerCamelCase__: Union[str, Any] =len(__a ) lowerCamelCase__: Dict =len(__a ) lowerCamelCase__: Any =( first_str_length if first_str_length > second_s...
59
from typing import TYPE_CHECKING from ...utils import OptionalDependencyNotAvailable, _LazyModule, is_tokenizers_available, is_torch_available _lowerCamelCase : Dict = { 'configuration_bloom': ['BLOOM_PRETRAINED_CONFIG_ARCHIVE_MAP', 'BloomConfig', 'BloomOnnxConfig'], } try: ...
121
0
from .constants import ( MODEL_NAME, OPTIMIZER_NAME, RNG_STATE_NAME, SAFE_WEIGHTS_INDEX_NAME, SAFE_WEIGHTS_NAME, SCALER_NAME, SCHEDULER_NAME, TORCH_LAUNCH_PARAMS, WEIGHTS_INDEX_NAME, WEIGHTS_NAME, ) from .dataclasses import ( BnbQuantizationConfig, Compu...
246
_lowerCamelCase : dict[tuple[int, int, int], int] = {} def _lowerCAmelCase ( __magic_name__ :int , __magic_name__ :int , __magic_name__ :int ): # if we are absent twice, or late 3 consecutive days, # no further prize strings are possib...
121
0
import argparse import os from pathlib import Path from typing import Dict import tensorflow as tf import torch from tqdm import tqdm from transformers import PegasusConfig, PegasusForConditionalGeneration, PegasusTokenizer from transformers.models.pegasus.configuration_pegasus import DEFAULTS, task_specific_pa...
188
import enum import warnings from ..tokenization_utils import TruncationStrategy from ..utils import add_end_docstrings, is_tf_available, is_torch_available, logging from .base import PIPELINE_INIT_ARGS, Pipeline if is_tf_available(): import tensorflow as tf from ..models.auto.modeli...
121
0
'''simple docstring''' def __UpperCamelCase( _A : str ): '''simple docstring''' return " ".join(input_str.split()[::-1] ) if __name__ == "__main__": import doctest doctest.testmod()
614
import argparse 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_seed from accelerate import Acceler...
121
0
import sys import tempfile import unittest import unittest.mock as mock from pathlib import Path from huggingface_hub import HfFolder, delete_repo from requests.exceptions import HTTPError from transformers import AutoImageProcessor, ViTImageProcessor from transformers.testing_utils import TOKEN, USER, ge...
256
from typing import TYPE_CHECKING from ...utils import ( OptionalDependencyNotAvailable, _LazyModule, is_tf_available, is_torch_available, is_vision_available, ) _lowerCamelCase : Optional[Any] = { 'configuration_mobilevit': ['MOBILEVIT_PRETRAINED_CONFIG_AR...
121
0
'''simple docstring''' from ...configuration_utils import PretrainedConfig from ...utils import logging _A : Any = logging.get_logger(__name__) _A : Any = { 'google/switch-base-8': 'https://huggingface.co/google/switch-base-8/blob/main/config.json', } class ...
427
import gc import unittest import numpy as np import torch from diffusers import AutoencoderKL, DDIMScheduler, DiTPipeline, DPMSolverMultistepScheduler, TransformeraDModel from diffusers.utils import is_xformers_available, load_numpy, slow, torch_device from diffusers.utils.testing_utils import ena...
121
0
"""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 BeitConfig, BeitForImageClassification, BeitForMaskedImageModeling, BeitImageProcessor from transformer...
346
from .integrations import ( is_optuna_available, is_ray_available, is_sigopt_available, is_wandb_available, run_hp_search_optuna, run_hp_search_ray, run_hp_search_sigopt, run_hp_search_wandb, ) from .trainer_utils import ( HPSearchBackend, default_hp_space...
121
0
"""simple docstring""" from abc import ABC, abstractmethod from argparse import ArgumentParser class lowerCamelCase__ ( __snake_case ): @staticmethod @abstractmethod def _UpperCAmelCase ( snake_case ) -> Any: """simple docstring""" ...
607
def _lowerCAmelCase ( __magic_name__ :list ): if any(not isinstance(__magic_name__ , __magic_name__ ) or x < 0 for x in sequence ): raise TypeError('''Sequence must be list of non-negative integers''' ) for _ in range(len(__magic_name__ ...
121
0
# using dfs for finding eulerian path traversal def __UpperCamelCase ( A , A , A , A=None ): UpperCamelCase__ = (path or []) + [u] for v in graph[u]: if visited_edge[u][v] is False: UpperCamelCase__ , UpperCam...
415
import argparse import json import os from collections import OrderedDict import numpy as np import tensorflow as tf import torch def _lowerCAmelCase ( __magic_name__ :Optional[Any] ): UpperCAmelCase_ = os.path.join(args.tf_model_dir , '''parameters.jso...
121
0
from typing import TYPE_CHECKING from ...utils import OptionalDependencyNotAvailable, _LazyModule, is_torch_available lowerCAmelCase_ = { 'configuration_blip_2': [ 'BLIP_2_PRETRAINED_CONFIG_ARCHIVE_MAP', 'Blip2Config', 'Blip2QFormerConfig', 'Blip2VisionConfig', ], ...
326
def _lowerCAmelCase ( __magic_name__ :list[list[int]] , __magic_name__ :int , __magic_name__ :int , __magic_name__ :set ): UpperCAmelCase_, UpperCAmelCase_ = len(__magic_name__ ), len(grid[0] ) if ( min(__magic_name__ , __ma...
121
0
'''simple docstring''' import argparse import logging import pickle from collections import Counter logging.basicConfig( format='%(asctime)s - %(levelname)s - %(name)s - %(message)s', datefmt='%m/%d/%Y %H:%M:%S', level=logging.INFO ) __SCREAMING_SNAKE_CASE = logging.getLogger(__name__) if __name...
688
import logging import os from typing import List, TextIO, Union from conllu import parse_incr from utils_ner import InputExample, Split, TokenClassificationTask _lowerCamelCase : List[Any] = logging.getLogger(__name__) class snake_case__ ( __snake_case ): ...
121
0
# Copyright 2023 The HuggingFace Inc. team. All rights reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required b...
59
def _lowerCAmelCase ( __magic_name__ :str ): UpperCAmelCase_ = '''''' for ch in key: if ch == " " or ch not in key_no_dups and ch.isalpha(): key_no_dups += ch return key_no_dups def _lowerCAmelCase ( __magic_name_...
121
0
from typing import Dict, List, Optional, Union import numpy as np from ...image_processing_utils import BaseImageProcessor, BatchFeature, get_size_dict from ...image_transforms import ( center_crop, get_resize_output_image_size, normalize, rescale, resize, to_channel_dimension_f...
246
from typing import TYPE_CHECKING from ...utils import OptionalDependencyNotAvailable, _LazyModule, is_torch_available _lowerCamelCase : str = { 'configuration_jukebox': [ 'JUKEBOX_PRETRAINED_CONFIG_ARCHIVE_MAP', 'JukeboxConfig', 'JukeboxPriorConfig', ...
121
0
from collections import UserDict from typing import Union import numpy as np import requests from ..utils import ( add_end_docstrings, logging, ) from .audio_classification import ffmpeg_read from .base import PIPELINE_INIT_ARGS, Pipeline a__ : Dict = logging.get_logger(__name__) ...
188
from __future__ import annotations from collections import namedtuple from dataclasses import dataclass @dataclass class snake_case__ : '''simple docstring''' __A = 42 __A = None __A = None _lowerCamelCas...
121
0
'''simple docstring''' UpperCamelCase__ : dict[tuple[int, int, int], int] = {} def __UpperCamelCase( _A : int , _A : int , _A : int ): '''simple docstring''' # if we are absent twice, or late 3 consecutive days, # no further prize strings are ...
614
from __future__ import annotations def _lowerCAmelCase ( __magic_name__ :int ): UpperCAmelCase_ = [True] * limit UpperCAmelCase_ = False UpperCAmelCase_ = False UpperCAmelCase_ = True for i in range(3 , int(limit**0.5 + 1 ) ...
121
0
import platform from argparse import ArgumentParser import huggingface_hub from .. import __version__ as version from ..utils import is_accelerate_available, is_torch_available, is_transformers_available, is_xformers_available from . import BaseDiffusersCLICommand def _lowerCamelCase ( ...
256
import argparse import logging import pickle from collections import Counter logging.basicConfig( format='%(asctime)s - %(levelname)s - %(name)s - %(message)s', datefmt='%m/%d/%Y %H:%M:%S', level=logging.INFO ) _lowerCamelCase : str = logging.getLogger(__name__) if __name__ ==...
121
0
'''simple docstring''' # tests directory-specific settings - this file is run automatically # by pytest before any tests are run import sys import warnings from os.path import abspath, dirname, join # allow having multiple repository checkouts and not needing to remember to rerun # 'pip install -e .[dev]...
427
import os from math import logaa def _lowerCAmelCase ( __magic_name__ :str = "base_exp.txt" ): UpperCAmelCase_ = 0 UpperCAmelCase_ = 0 for i, line in enumerate(open(os.path.join(os.path.dirname(__magic_name__ ) , __magic_name__ ) )...
121
0
"""simple docstring""" import gc import unittest import numpy as np import torch from diffusers import AutoencoderKL, DDIMScheduler, DiTPipeline, DPMSolverMultistepScheduler, TransformeraDModel from diffusers.utils import is_xformers_available, load_numpy, slow, torch_device from diffusers.utils.test...
346
import random import sys import numpy as np from matplotlib import pyplot as plt from matplotlib.colors import ListedColormap _lowerCamelCase : Any = 'Usage of script: script_name <size_of_canvas:int>' _lowerCamelCase : Dict = [0] * 100 + [1] * 10 random.shuffle(choice...
121
0
"""simple docstring""" import argparse import hashlib import os import urllib import warnings import torch from torch import nn from tqdm import tqdm from transformers import WhisperConfig, WhisperForConditionalGeneration lowerCAmelCase: Union[str, Any] ={ 'tiny.en': 'https...
607
from __future__ import annotations def _lowerCAmelCase ( __magic_name__ :list[int | str] ): create_state_space_tree(__magic_name__ , [] , 0 , [0 for i in range(len(__magic_name__ ) )] ) def _lowerCAmelCase ( ...
121
0
import json import os from typing import Optional, Tuple from ...tokenization_utils import PreTrainedTokenizer from ...utils import logging __magic_name__ =logging.get_logger(__name__) __magic_name__ ={'vocab_file': 'vocab.json'} __magic_name__ ={ 'vocab_file': { 'mgp-str':...
415
# tests directory-specific settings - this file is run automatically # by pytest before any tests are run import sys import warnings from os.path import abspath, dirname, join # allow having multiple repository checkouts and not needing to remember to rerun # 'pip install -e .[dev]' when switchi...
121
0
import unittest import numpy as np from transformers.testing_utils import require_torch, require_vision from transformers.utils import is_torch_available, is_vision_available from ...test_image_processing_common import ImageProcessingSavingTestMixin, prepare_image_inputs if is_torch_available(): import to...
326
import argparse import hashlib import os import urllib import warnings import torch from torch import nn from tqdm import tqdm from transformers import WhisperConfig, WhisperForConditionalGeneration _lowerCamelCase : Union[str, Any] = { 'tiny.en': 'https://openaipublic.azu...
121
0
'''simple docstring''' from typing import TYPE_CHECKING from ...utils import ( OptionalDependencyNotAvailable, _LazyModule, is_tf_available, is_torch_available, is_vision_available, ) __SCREAMING_SNAKE_CASE = { 'configuration_mobilevit': ['MOBILEVIT_PRETRAINED_CONFIG_ARCHIVE_...
688
import argparse import torch from transformers import MobileBertConfig, MobileBertForPreTraining, load_tf_weights_in_mobilebert from transformers.utils import logging logging.set_verbosity_info() def _lowerCAmelCase ( __magic_name__ :Union[str, Any] , __magic_na...
121
0
import unittest import numpy as np from transformers.file_utils import is_torch_available, is_vision_available from transformers.testing_utils import require_torch, require_vision from ...test_image_processing_common import ImageProcessingSavingTestMixin, prepare_image_inputs if is_torch_available(): im...
59
from typing import TYPE_CHECKING from ...utils import OptionalDependencyNotAvailable, _LazyModule, is_tokenizers_available, is_torch_available _lowerCamelCase : Dict = { 'configuration_bloom': ['BLOOM_PRETRAINED_CONFIG_ARCHIVE_MAP', 'BloomConfig', 'BloomOnnxConfig'], } try: ...
121
0
from ...utils import is_note_seq_available, is_transformers_available, is_torch_available from ...utils import OptionalDependencyNotAvailable try: if not (is_transformers_available() and is_torch_available()): raise OptionalDependencyNotAvailable() except OptionalDependencyNotAvailable: ...
246
_lowerCamelCase : dict[tuple[int, int, int], int] = {} def _lowerCAmelCase ( __magic_name__ :int , __magic_name__ :int , __magic_name__ :int ): # if we are absent twice, or late 3 consecutive days, # no further prize strings are possib...
121
0
import unittest from transformers import DebertaConfig, is_torch_available from transformers.testing_utils import require_sentencepiece, require_tokenizers, require_torch, slow, torch_device from ...test_configuration_common import ConfigTester from ...test_modeling_common import ModelTesterMixin, ids_tensor fr...
188
import enum import warnings from ..tokenization_utils import TruncationStrategy from ..utils import add_end_docstrings, is_tf_available, is_torch_available, logging from .base import PIPELINE_INIT_ARGS, Pipeline if is_tf_available(): import tensorflow as tf from ..models.auto.modeli...
121
0
'''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. UpperCamelCase__ : str = 10 def __UpperCamelCase( _A : int , _A : int ...
614
import argparse 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_seed from accelerate import Acceler...
121
0
from random import shuffle import tensorflow as tf from numpy import array def _lowerCamelCase ( lowerCamelCase_: List[Any] , lowerCamelCase_: int ): '''simple docstring''' A : Tuple = int(lowerCamelCase_ ) assert noofclusters < len(l...
256
from typing import TYPE_CHECKING from ...utils import ( OptionalDependencyNotAvailable, _LazyModule, is_tf_available, is_torch_available, is_vision_available, ) _lowerCamelCase : Optional[Any] = { 'configuration_mobilevit': ['MOBILEVIT_PRETRAINED_CONFIG_AR...
121
0
'''simple docstring''' import argparse import torch from diffusers.pipelines.stable_diffusion.convert_from_ckpt import download_from_original_stable_diffusion_ckpt if __name__ == "__main__": _A : List[str] = argparse.ArgumentParser() parser.add_argument( '''--checkpoint_path''', d...
427
import gc import unittest import numpy as np import torch from diffusers import AutoencoderKL, DDIMScheduler, DiTPipeline, DPMSolverMultistepScheduler, TransformeraDModel from diffusers.utils import is_xformers_available, load_numpy, slow, torch_device from diffusers.utils.testing_utils import ena...
121
0
"""simple docstring""" import gc import unittest import torch from parameterized import parameterized from diffusers import AutoencoderKL from diffusers.utils import floats_tensor, load_hf_numpy, require_torch_gpu, slow, torch_all_close, torch_device from diffusers.utils.import_utils import is_xforme...
346
from .integrations import ( is_optuna_available, is_ray_available, is_sigopt_available, is_wandb_available, run_hp_search_optuna, run_hp_search_ray, run_hp_search_sigopt, run_hp_search_wandb, ) from .trainer_utils import ( HPSearchBackend, default_hp_space...
121
0
"""simple docstring""" import json import os import unittest from transformers import OpenAIGPTTokenizer, OpenAIGPTTokenizerFast from transformers.models.openai.tokenization_openai import VOCAB_FILES_NAMES from transformers.testing_utils import require_ftfy, require_spacy, require_tokenizers from...
607
def _lowerCAmelCase ( __magic_name__ :list ): if any(not isinstance(__magic_name__ , __magic_name__ ) or x < 0 for x in sequence ): raise TypeError('''Sequence must be list of non-negative integers''' ) for _ in range(len(__magic_name__ ...
121
0
import argparse import json import os from collections import OrderedDict import numpy as np import tensorflow as tf import torch def __UpperCamelCase ( A ): UpperCamelCase__ = os.path.join(args.tf_model_dir , '''parameters.json''' ) UpperCamelCase__ ...
415
import argparse import json import os from collections import OrderedDict import numpy as np import tensorflow as tf import torch def _lowerCAmelCase ( __magic_name__ :Optional[Any] ): UpperCAmelCase_ = os.path.join(args.tf_model_dir , '''parameters.jso...
121
0
def A_ ( lowercase_ , lowercase_ ) -> Dict: if len(lowercase_ ) != len(lowercase_ ): raise ValueError('''String lengths must match!''' ) _snake_case : str = 0 for chara, chara in zip(lowercase_ , lowercase_ ): if chara != char...
326
def _lowerCAmelCase ( __magic_name__ :list[list[int]] , __magic_name__ :int , __magic_name__ :int , __magic_name__ :set ): UpperCAmelCase_, UpperCAmelCase_ = len(__magic_name__ ), len(grid[0] ) if ( min(__magic_name__ , __ma...
121
0
'''simple docstring''' import unittest from transformers import AlbertConfig, is_torch_available from transformers.models.auto import get_values from transformers.testing_utils import require_torch, slow, torch_device from ...test_configuration_common import ConfigTester from ...test_modeling_common import Mo...
688
import logging import os from typing import List, TextIO, Union from conllu import parse_incr from utils_ner import InputExample, Split, TokenClassificationTask _lowerCamelCase : List[Any] = logging.getLogger(__name__) class snake_case__ ( __snake_case ): ...
121
0
import unittest import numpy as np from diffusers import OnnxStableDiffusionInpaintPipelineLegacy from diffusers.utils.testing_utils import ( is_onnx_available, load_image, load_numpy, nightly, require_onnxruntime, require_torch_gpu, ) if is_onnx_available(): import onnxruntime as...
59
def _lowerCAmelCase ( __magic_name__ :str ): UpperCAmelCase_ = '''''' for ch in key: if ch == " " or ch not in key_no_dups and ch.isalpha(): key_no_dups += ch return key_no_dups def _lowerCAmelCase ( __magic_name_...
121
0
import enum import warnings from ..tokenization_utils import TruncationStrategy from ..utils import add_end_docstrings, is_tf_available, is_torch_available, logging from .base import PIPELINE_INIT_ARGS, Pipeline if is_tf_available(): import tensorflow as tf from ..models.auto.modeling_tf_au...
246
from typing import TYPE_CHECKING from ...utils import OptionalDependencyNotAvailable, _LazyModule, is_torch_available _lowerCamelCase : str = { 'configuration_jukebox': [ 'JUKEBOX_PRETRAINED_CONFIG_ARCHIVE_MAP', 'JukeboxConfig', 'JukeboxPriorConfig', ...
121
0
import sys from collections import defaultdict class UpperCAmelCase_ : def __init__( self ): """simple docstring""" A_ = [] def __UpperCAmelCase ( self ,__snake_case ): """simple docstring""" return self.node_position...
188
from __future__ import annotations from collections import namedtuple from dataclasses import dataclass @dataclass class snake_case__ : '''simple docstring''' __A = 42 __A = None __A = None _lowerCamelCas...
121
0
'''simple docstring''' from __future__ import annotations UpperCamelCase__ : Optional[Any] = '#' class _lowercase : '''simple docstring''' def __init__( self ) -> None: '''simple docstring''' UpperCAmelCase__ : Optional[Any] ...
614
from __future__ import annotations def _lowerCAmelCase ( __magic_name__ :int ): UpperCAmelCase_ = [True] * limit UpperCAmelCase_ = False UpperCAmelCase_ = False UpperCAmelCase_ = True for i in range(3 , int(limit**0.5 + 1 ) ...
121
0
from PIL import Image def _lowerCamelCase ( lowerCamelCase_: Image , lowerCamelCase_: float ): '''simple docstring''' def brightness(lowerCamelCase_: int ) -> float: return 128 + level + (c - 128) if not -255.0 <= level <= 255.0: ...
256
import argparse import logging import pickle from collections import Counter logging.basicConfig( format='%(asctime)s - %(levelname)s - %(name)s - %(message)s', datefmt='%m/%d/%Y %H:%M:%S', level=logging.INFO ) _lowerCamelCase : str = logging.getLogger(__name__) if __name__ ==...
121
0
'''simple docstring''' import torch from transformers import CamembertForMaskedLM, CamembertTokenizer def UpperCamelCase_ ( snake_case_ : Optional[Any] , snake_case_ : List[Any] , snake_case_ : str , snake_case_ : Dict=5 ) -> Optional[int]: '''s...
427
import os from math import logaa def _lowerCAmelCase ( __magic_name__ :str = "base_exp.txt" ): UpperCAmelCase_ = 0 UpperCAmelCase_ = 0 for i, line in enumerate(open(os.path.join(os.path.dirname(__magic_name__ ) , __magic_name__ ) )...
121
0
"""simple docstring""" def a__ ( ) -> Dict: __lowerCAmelCase: int = [3_1, 2_8, 3_1, 3_0, 3_1, 3_0, 3_1, 3_1, 3_0, 3_1, 3_0, 3_1] __lowerCAmelCase: List[str] = 6 __lowerCAmelCase: Dict = 1 __lowerCAmelCase: int = 1_9_...
346
import random import sys import numpy as np from matplotlib import pyplot as plt from matplotlib.colors import ListedColormap _lowerCamelCase : Any = 'Usage of script: script_name <size_of_canvas:int>' _lowerCamelCase : Dict = [0] * 100 + [1] * 10 random.shuffle(choice...
121
0
"""simple docstring""" import fire from utils import calculate_rouge, save_json def __snake_case ( __A ,__A ,__A=None ,**__A ) -> Dict: lowercase : int = [x.strip() for x in open(__A ).readlines()] lowercase : Union[str, Any] = ...
607
from __future__ import annotations def _lowerCAmelCase ( __magic_name__ :list[int | str] ): create_state_space_tree(__magic_name__ , [] , 0 , [0 for i in range(len(__magic_name__ ) )] ) def _lowerCAmelCase ( ...
121
0
import unittest import numpy as np from transformers.testing_utils import require_pytesseract, require_torch from transformers.utils import is_pytesseract_available, is_torch_available from ...test_image_processing_common import ImageProcessingSavingTestMixin, prepare_image_inputs if is_torch_available()...
415
# tests directory-specific settings - this file is run automatically # by pytest before any tests are run import sys import warnings from os.path import abspath, dirname, join # allow having multiple repository checkouts and not needing to remember to rerun # 'pip install -e .[dev]' when switchi...
121
0
import logging from dataclasses import dataclass, field from typing import Optional from seqaseq_trainer import arg_to_scheduler from transformers import TrainingArguments lowerCAmelCase_ = logging.getLogger(__name__) @dataclass class A (__snake_case ): _SCREAMING_SNAKE_CASE = ...
326
import argparse import hashlib import os import urllib import warnings import torch from torch import nn from tqdm import tqdm from transformers import WhisperConfig, WhisperForConditionalGeneration _lowerCamelCase : Union[str, Any] = { 'tiny.en': 'https://openaipublic.azu...
121
0
'''simple docstring''' import os import shutil import tempfile from unittest import TestCase from unittest.mock import patch import numpy as np from datasets import Dataset from transformers.models.realm.configuration_realm import RealmConfig from transformers.models.realm.retrieval_realm import _REALM_BLOCK_...
688
import argparse import torch from transformers import MobileBertConfig, MobileBertForPreTraining, load_tf_weights_in_mobilebert from transformers.utils import logging logging.set_verbosity_info() def _lowerCAmelCase ( __magic_name__ :Union[str, Any] , __magic_na...
121
0
from .glue import GlueDataset, GlueDataTrainingArguments from .language_modeling import ( LineByLineTextDataset, LineByLineWithRefDataset, LineByLineWithSOPTextDataset, TextDataset, TextDatasetForNextSentencePrediction, ) from .squad import SquadDataset, SquadDataTrainingArguments
59
from typing import TYPE_CHECKING from ...utils import OptionalDependencyNotAvailable, _LazyModule, is_tokenizers_available, is_torch_available _lowerCamelCase : Dict = { 'configuration_bloom': ['BLOOM_PRETRAINED_CONFIG_ARCHIVE_MAP', 'BloomConfig', 'BloomOnnxConfig'], } try: ...
121
0
from __future__ import annotations from collections import namedtuple from dataclasses import dataclass @dataclass class lowerCAmelCase : '''simple docstring''' snake_case = 42 snake_case = None snake_case = ...
246
_lowerCamelCase : dict[tuple[int, int, int], int] = {} def _lowerCAmelCase ( __magic_name__ :int , __magic_name__ :int , __magic_name__ :int ): # if we are absent twice, or late 3 consecutive days, # no further prize strings are possib...
121
0
a__ : str = 'Tobias Carryer' from time import time class UpperCAmelCase_ : def __init__( self ,__snake_case ,__snake_case ,__snake_case ,__snake_case=int(time() ) ): # noqa: B008 """simple docstring""" A_ = multiplier A_ = ...
188
import enum import warnings from ..tokenization_utils import TruncationStrategy from ..utils import add_end_docstrings, is_tf_available, is_torch_available, logging from .base import PIPELINE_INIT_ARGS, Pipeline if is_tf_available(): import tensorflow as tf from ..models.auto.modeli...
121
0
'''simple docstring''' def __UpperCamelCase( _A : int ): '''simple docstring''' return sum(i for i in range(1 , number // 2 + 1 ) if number % i == 0 ) == number if __name__ == "__main__": print('Program to check whether a number is a Perfect number or not...') UpperCamelCase__ :...
614
import argparse 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_seed from accelerate import Acceler...
121
0
# Copyright 2023 The HuggingFace Inc. team. All rights reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless requir...
256
from typing import TYPE_CHECKING from ...utils import ( OptionalDependencyNotAvailable, _LazyModule, is_tf_available, is_torch_available, is_vision_available, ) _lowerCamelCase : Optional[Any] = { 'configuration_mobilevit': ['MOBILEVIT_PRETRAINED_CONFIG_AR...
121
0
'''simple docstring''' from collections import deque class _lowercase : '''simple docstring''' def __init__( self : int , SCREAMING_SNAKE_CASE__ : str , SCREAMING_SNAKE_CASE__ : int , SCREAMING_SNAKE_CASE__ : int ) -> None: __lowe...
427
import gc import unittest import numpy as np import torch from diffusers import AutoencoderKL, DDIMScheduler, DiTPipeline, DPMSolverMultistepScheduler, TransformeraDModel from diffusers.utils import is_xformers_available, load_numpy, slow, torch_device from diffusers.utils.testing_utils import ena...
121
0
"""simple docstring""" import gc import unittest from diffusers import FlaxDPMSolverMultistepScheduler, FlaxStableDiffusionPipeline from diffusers.utils import is_flax_available, slow from diffusers.utils.testing_utils import require_flax if is_flax_available(): import jax import jax.numpy a...
346
from .integrations import ( is_optuna_available, is_ray_available, is_sigopt_available, is_wandb_available, run_hp_search_optuna, run_hp_search_ray, run_hp_search_sigopt, run_hp_search_wandb, ) from .trainer_utils import ( HPSearchBackend, default_hp_space...
121
0
"""simple docstring""" import argparse import os import re import packaging.version lowerCAmelCase: List[str] ='examples/' lowerCAmelCase: str ={ 'examples': (re.compile(R"^check_min_version\(\"[^\"]+\"\)\s*$", re.MULTILINE), 'check_min_version("VERSION")\n'), 'in...
607
def _lowerCAmelCase ( __magic_name__ :list ): if any(not isinstance(__magic_name__ , __magic_name__ ) or x < 0 for x in sequence ): raise TypeError('''Sequence must be list of non-negative integers''' ) for _ in range(len(__magic_name__ ...
121
0
from decimal import Decimal, getcontext from math import ceil, factorial def A(__a: int ): if not isinstance(__a , __a ): raise TypeError("Undefined for non-integers" ) elif precision < 1: raise ValueError("Undefined for non-natural numbers" ) lowerCAmelCase_ ...
122
import inspect import unittest import numpy as np from tests.test_modeling_common import floats_tensor from transformers import MaskaFormerConfig, is_torch_available, is_vision_available from transformers.testing_utils import require_torch, require_torch_multi_gpu, require_vision, slow, torch_device from transf...
122
1
from typing import Callable, Dict, Optional, Tuple import torch from torch import nn from torch.distributions import ( AffineTransform, Distribution, Independent, NegativeBinomial, Normal, StudentT, TransformedDistribution, ) class __magic_name__ (__lowercase ): def __init...
122
from typing import TYPE_CHECKING from ...utils import OptionalDependencyNotAvailable, _LazyModule, is_torch_available lowerCamelCase__ = {'''configuration_sew''': ['''SEW_PRETRAINED_CONFIG_ARCHIVE_MAP''', '''SEWConfig''']} try: if not is_torch_available(): raise OptionalDependencyNotAvailabl...
122
1
from typing import List from ...configuration_utils import PretrainedConfig from ...utils import logging lowerCamelCase__ = logging.get_logger(__name__) lowerCamelCase__ = { '''snap-research/efficientformer-l1-300''': ( '''https://huggingface.co/snap-research/efficientforme...
122
import os from argparse import ArgumentParser from typing import List import torch.utils.data from datasets import Dataset, IterableDataset from datasets.distributed import split_dataset_by_node lowerCamelCase__ = 4 lowerCamelCase__ = 3 class __magic_name__ (__lowercase ): pass...
122
1
import os import pytest from transformers.dynamic_module_utils import get_imports lowerCamelCase__ = ''' import os ''' lowerCamelCase__ = ''' def foo(): import os return False ''' lowerCamelCase__ = ''' def foo(): def bar(): if True: import...
122
import torch from torch import nn class __magic_name__ (nn.Module ): def __init__( self , _a , _a , _a , _a , _a=1 , _a=False ) -> str: super().__init__() lowerCAmelCase_ = n_token lowerCAmelCase_ = d_embed lowerCAme...
122
1
import os from distutils.util import strtobool def A(__a: Dict , __a: str ): for e in env_keys: lowerCAmelCase_ = int(os.environ.get(__a , -1 ) ) if val >= 0: return val return default def A(__a: int , __a: Union[str, Any]=False ...
122
from collections import defaultdict class __magic_name__ : def __init__( self , _a , _a ) -> Tuple: lowerCAmelCase_ = total # total no of tasks (N) # DP table will have a dimension of (2^M)*N # initially all values are set to -1 lowerCAm...
122
1
def A(__a: int ): lowerCAmelCase_ = int(__a ) if n_element < 1: lowerCAmelCase_ = ValueError("a should be a positive number" ) raise my_error lowerCAmelCase_ = [1] lowerCAmelCase_ , lowerCAmelCase_ , lowerCAmelCase_ ...
122
import gc import unittest import numpy as np import torch from transformers import CLIPTextConfig, CLIPTextModel, CLIPTokenizer from diffusers import ( AutoencoderKL, DDIMScheduler, PNDMScheduler, StableDiffusionLDMaDPipeline, UNetaDConditionModel, ) from diffusers.utils import nightly, slow...
122
1
from typing import Optional from .. import Features, NamedSplit from ..packaged_modules.text.text import Text from ..utils.typing import NestedDataStructureLike, PathLike from .abc import AbstractDatasetReader class __magic_name__ (__lowercase ): def __init__( self , _a , _a = None , _a =...
122
def A(__a: int = 50 ): lowerCAmelCase_ = [1] * (length + 1) for row_length in range(length + 1 ): for tile_length in range(2 , 5 ): for tile_start in range(row_length - tile_length + 1 ): ways_number[row_length] += ways_number[ row_length...
122
1
import argparse import json from pathlib import Path import requests import torch from huggingface_hub import cached_download, hf_hub_url from PIL import Image from transformers import DPTConfig, DPTForDepthEstimation, DPTForSemanticSegmentation, DPTImageProcessor from transformers.utils import logging loggin...
122
import doctest import logging import os import unittest from pathlib import Path from typing import List, Union import transformers from transformers.testing_utils import require_tf, require_torch, slow lowerCamelCase__ = logging.getLogger() @unittest.skip('''Temporarily disable the doc tests.''' )...
122
1
from ..utils import DummyObject, requires_backends class __magic_name__ (metaclass=__lowercase ): lowerCamelCase__ = ['''speech'''] def __init__( self , *_a , **_a ) -> str: requires_backends(self , ["speech"] ) class __magic_name__ (metacl...
122
from typing import TYPE_CHECKING from ...utils import OptionalDependencyNotAvailable, _LazyModule, is_flax_available, is_torch_available lowerCamelCase__ = {'''configuration_speech_encoder_decoder''': ['''SpeechEncoderDecoderConfig''']} try: if not is_torch_available(): raise OptionalDepende...
122
1
from scipy.stats import spearmanr import datasets lowerCamelCase__ = ''' The Spearman rank-order correlation coefficient is a measure of the relationship between two datasets. Like other correlation coefficients, this one varies between -1 and +1 with 0 implying no correlation. Positive correlation...
122
from math import factorial def A(__a: int , __a: int ): # If either of the conditions are true, the function is being asked # to calculate a factorial of a negative number, which is not possible if n < k or k < 0: raise ValueError("Please enter positive integers for n and k where n...
122
1
import argparse from pathlib import Path from transformers import AutoConfig, AutoTokenizer, RagConfig, RagSequenceForGeneration, RagTokenForGeneration def A(__a: Dict , __a: str , __a: str , __a: Path , __a: str = None , __a: str = None , __a: str =...
122
from string import ascii_uppercase lowerCamelCase__ = {char: i for i, char in enumerate(ascii_uppercase)} lowerCamelCase__ = dict(enumerate(ascii_uppercase)) def A(__a: str , __a: str ): lowerCAmelCase_ = len(__a ) lowerCAmelCase_ = ...
122
1
from math import factorial def A(__a: int , __a: int ): # If either of the conditions are true, the function is being asked # to calculate a factorial of a negative number, which is not possible if n < k or k < 0: raise ValueError("Please enter positive integers for n and k where n...
122
from itertools import product def A(__a: int , __a: int ): lowerCAmelCase_ = sides_number lowerCAmelCase_ = max_face_number * dice_number lowerCAmelCase_ = [0] * (max_total + 1) lowerCAmelCase_ = 1 lowerCAmelCase_ =...
122
1
from typing import TYPE_CHECKING from ...utils import OptionalDependencyNotAvailable, _LazyModule, is_torch_available lowerCamelCase__ = { '''configuration_pegasus_x''': ['''PEGASUS_X_PRETRAINED_CONFIG_ARCHIVE_MAP''', '''PegasusXConfig'''], } try: if not is_torch_available(): raise Optio...
122
from ..utils import DummyObject, requires_backends class __magic_name__ (metaclass=__lowercase ): lowerCamelCase__ = ['''speech'''] def __init__( self , *_a , **_a ) -> str: requires_backends(self , ["speech"] ) class __magic_name__ (metacl...
122
1
# Copyright 2023 The HuggingFace Team. All rights reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by app...
122
from collections import OrderedDict from typing import List, Mapping from packaging import version from ...configuration_utils import PretrainedConfig from ...onnx import OnnxConfig from ...utils import logging lowerCamelCase__ = logging.get_logger(__name__) lowerCamelCase__ = { '...
122
1
from string import ascii_uppercase lowerCamelCase__ = {char: i for i, char in enumerate(ascii_uppercase)} lowerCamelCase__ = dict(enumerate(ascii_uppercase)) def A(__a: str , __a: str ): lowerCAmelCase_ = len(__a ) lowerCAmelCase_ = ...
122
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, StableDiffusionXLImgaImgPipeline, UNeta...
122
1
from typing import TYPE_CHECKING from ...utils import ( OptionalDependencyNotAvailable, _LazyModule, is_tf_available, is_torch_available, is_vision_available, ) lowerCamelCase__ = { '''configuration_blip''': [ '''BLIP_PRETRAINED_CONFIG_ARCHIVE_MAP''', '''Blip...
122
import inspect import unittest from math import floor from transformers import CvtConfig from transformers.file_utils import cached_property, is_torch_available, is_vision_available from transformers.testing_utils import require_torch, require_vision, slow, torch_device from ...test_configuration_common import ...
122
1
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 import TensorType class __magic_name__ (__lowercas...
122
from __future__ import annotations def A(__a: list[int] , __a: list[int] , __a: int ): lowerCAmelCase_ = list(range(len(__a ) ) ) lowerCAmelCase_ = [v / w for v, w in zip(__a , __a )] index.sort(key=lambda __a : ratio[i] , ...
122
1
def A(__a: int ): lowerCAmelCase_ = (1 + 24 * n) ** 0.5 return ((1 + root) / 6) % 1 == 0 def A(__a: int = 5000 ): lowerCAmelCase_ = [(i * (3 * i - 1)) // 2 for i in range(1 , __a )] for i, pentagonal_i in enumerate(__a ): for j in range(_...
122
from typing import TYPE_CHECKING from ...file_utils import _LazyModule, is_tokenizers_available, is_torch_available, is_vision_available from ...utils import OptionalDependencyNotAvailable lowerCamelCase__ = {'''configuration_dpt''': ['''DPT_PRETRAINED_CONFIG_ARCHIVE_MAP''', '''DPTConfig''']} try:...
122
1
def A(__a: int = 200_0000 ): lowerCAmelCase_ = [0 for i in range(n + 1 )] lowerCAmelCase_ = 1 lowerCAmelCase_ = 1 for i in range(2 , int(n**0.5 ) + 1 ): if primality_list[i] == 0: for j in range(i * i , n + 1 , _...
122
from sklearn.metrics import mean_squared_error import datasets lowerCamelCase__ = '''\ @article{scikit-learn, title={Scikit-learn: Machine Learning in {P}ython}, author={Pedregosa, F. and Varoquaux, G. and Gramfort, A. and Michel, V. and Thirion, B. and Grisel, O. and Blondel, M. and Pre...
122
1
import unittest from transformers import AlbertConfig, is_torch_available from transformers.models.auto import get_values from transformers.testing_utils import require_torch, slow, torch_device from ...test_configuration_common import ConfigTester from ...test_modeling_common import ModelTesterMixin, ids_tenso...
122
from typing import TYPE_CHECKING from ...utils import OptionalDependencyNotAvailable, _LazyModule, is_torch_available lowerCamelCase__ = {'''configuration_vit_msn''': ['''VIT_MSN_PRETRAINED_CONFIG_ARCHIVE_MAP''', '''ViTMSNConfig''']} try: if not is_torch_available(): raise OptionalDependency...
122
1