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
from typing import List, Optional, Union import numpy as np import PIL.Image from ...image_processing_utils import BaseImageProcessor, BatchFeature from ...image_transforms import rescale, resize, to_channel_dimension_format from ...image_utils import ( ChannelDimension, PILImageResamplin...
27
# Copyright 2022 The HuggingFace Team. All rights reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless r...
27
1
import gc import random import unittest import numpy as np import torch from transformers import CLIPImageProcessor, CLIPVisionConfig, CLIPVisionModel from diffusers import HeunDiscreteScheduler, PriorTransformer, ShapEImgaImgPipeline from diffusers.pipelines.shap_e import ShapERenderer from dif...
27
from ... import PretrainedConfig __A : Optional[Any] = { "sijunhe/nezha-cn-base": "https://huggingface.co/sijunhe/nezha-cn-base/resolve/main/config.json", } class lowerCamelCase( __snake_case ): '''simple docstring''' __magic_name__ = ...
27
1
import math __A : List[str] = 10 __A : Any = 7 __A : str = BALLS_PER_COLOUR * NUM_COLOURS def __lowerCAmelCase( _SCREAMING_SNAKE_CASE = 20 ) -> str: """simple docstring""" _A = math.c...
27
from collections import defaultdict from math import ceil, sqrt def __lowerCAmelCase( _SCREAMING_SNAKE_CASE = 1_000_000 , _SCREAMING_SNAKE_CASE = 10 ) -> int: """simple docstring""" _A = defaultdict(_SCREAMING_SNAKE_CASE ) ...
27
1
# Copyright 2021 The HuggingFace Team. All rights reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless r...
27
from math import pi, sqrt, tan def __lowerCAmelCase( _SCREAMING_SNAKE_CASE ) -> float: """simple docstring""" if side_length < 0: raise ValueError('surface_area_cube() only accepts non-negative values' ) return 6 * side_length**2 ...
27
1
def __lowerCAmelCase( _SCREAMING_SNAKE_CASE , _SCREAMING_SNAKE_CASE , _SCREAMING_SNAKE_CASE ) -> int: """simple docstring""" def count_of_possible_combinations(_SCREAMING_SNAKE_CASE ) -> int: if target < 0: return 0 ...
27
import numpy as np def __lowerCAmelCase( _SCREAMING_SNAKE_CASE ) -> np.array: """simple docstring""" return (2 / (1 + np.exp(-2 * vector ))) - 1 if __name__ == "__main__": import doctest doctest.testmod()
27
1
import string def __lowerCAmelCase( _SCREAMING_SNAKE_CASE ) -> str: """simple docstring""" _A = '' for i in sequence: _A = ord(_SCREAMING_SNAKE_CASE ) if 65 <= extract <= 90: output += chr(155 ...
27
from typing import TYPE_CHECKING from ...utils import OptionalDependencyNotAvailable, _LazyModule, is_sentencepiece_available __A : Optional[Any] = {} try: if not is_sentencepiece_available(): raise OptionalDependencyNotAvailable() except OptionalDependencyNotAvailable: ...
27
1
import itertools import string from collections.abc import Generator, Iterable def __lowerCAmelCase( _SCREAMING_SNAKE_CASE , _SCREAMING_SNAKE_CASE ) -> Generator[tuple[str, ...], None, None]: """simple docstring""" _A = iter(_SCRE...
27
import json import os from pathlib import Path import pytest from datasets.download.download_config import DownloadConfig from datasets.download.download_manager import DownloadManager from datasets.utils.file_utils import hash_url_to_filename __A : List[Any] = "http://www.m...
27
1
class lowerCamelCase: '''simple docstring''' def __init__( self , snake_case_ ): _A = len(snake_case_ ) _A = [0] * len_array if len_array > 0: _A = array[0] for i in range(1 ...
27
from __future__ import annotations from fractions import Fraction from math import gcd, sqrt def __lowerCAmelCase( _SCREAMING_SNAKE_CASE ) -> bool: """simple docstring""" _A = int(number**0.5 ) return number == sq * sq ...
27
1
import warnings from ...utils import logging from .image_processing_mobilevit import MobileViTImageProcessor __A : str = logging.get_logger(__name__) class lowerCamelCase( __snake_case ): '''simple docstring''' def __init__( self , ...
27
from __future__ import annotations import math def __lowerCAmelCase( _SCREAMING_SNAKE_CASE ) -> list[int]: """simple docstring""" if num <= 0: _A = F"{num}: Invalid input, please enter a positive integer." raise ValueErro...
27
1
import fire from utils import calculate_rouge, save_json def __lowerCAmelCase( _SCREAMING_SNAKE_CASE , _SCREAMING_SNAKE_CASE , _SCREAMING_SNAKE_CASE=None , **_SCREAMING_SNAKE_CASE ) -> List[str]: """simple docstring""" ...
27
__A : Dict = "Alexander Joslin" import operator as op from .stack import Stack def __lowerCAmelCase( _SCREAMING_SNAKE_CASE ) -> int: """simple docstring""" _A = {'*': op.mul, '/': op.truediv, '+': op.add, '-': op.sub} ...
27
1
from __future__ import annotations def __lowerCAmelCase( _SCREAMING_SNAKE_CASE , _SCREAMING_SNAKE_CASE , _SCREAMING_SNAKE_CASE , _SCREAMING_SNAKE_CASE , _SCREAMING_SNAKE_CASE , ) -> None: """simple docstring""" ...
27
import unittest import numpy as np import torch from diffusers import KarrasVePipeline, KarrasVeScheduler, UNetaDModel from diffusers.utils.testing_utils import enable_full_determinism, require_torch, slow, torch_device enable_full_determinism() class lowerCamelCase( un...
27
1
import warnings from ...utils import logging from .image_processing_dpt import DPTImageProcessor __A : Optional[Any] = logging.get_logger(__name__) class lowerCamelCase( __snake_case ): '''simple docstring''' def __init__( self , ...
27
import itertools import os import random import tempfile import unittest import numpy as np from transformers import TvltFeatureExtractor, is_datasets_available from transformers.testing_utils import check_json_file_has_correct_format, require_torch, require_torchaudio from transformers.utils.im...
27
1
import sys import webbrowser import requests from bsa import BeautifulSoup from fake_useragent import UserAgent if __name__ == "__main__": print("Googling.....") __A : Dict = "https://www.google.com/search?q=" + " ".join(sys.argv[1:]) __A : Optional[Any] = ...
27
def __lowerCAmelCase( _SCREAMING_SNAKE_CASE ) -> bool: """simple docstring""" if not isinstance(_SCREAMING_SNAKE_CASE , _SCREAMING_SNAKE_CASE ): raise ValueError('check_bouncy() accepts only integer arguments' ) _A = str(_S...
27
1
from __future__ import annotations from fractions import Fraction from math import gcd, sqrt def __lowerCAmelCase( _SCREAMING_SNAKE_CASE ) -> bool: """simple docstring""" _A = int(number**0.5 ) return number == sq * sq ...
27
def __lowerCAmelCase( _SCREAMING_SNAKE_CASE , _SCREAMING_SNAKE_CASE ) -> float: """simple docstring""" return price * (1 + tax_rate) if __name__ == "__main__": print(f"{price_plus_tax(100, 0.2_5) = }") print(f"{price_plus_tax(1_2_5.5_0, 0.0_5) ...
27
1
from dataclasses import dataclass from typing import Optional, Tuple, Union import torch import torch.nn as nn from ..configuration_utils import ConfigMixin, register_to_config from ..utils import BaseOutput from .embeddings import GaussianFourierProjection, TimestepEmbedding, Timesteps from .mod...
27
from collections.abc import Callable def __lowerCAmelCase( _SCREAMING_SNAKE_CASE , _SCREAMING_SNAKE_CASE , _SCREAMING_SNAKE_CASE ) -> float: """simple docstring""" _A = a _A = b if function(_SCREAMING_S...
27
1
import os from shutil import copyfile from typing import List, Optional, Tuple from ...tokenization_utils import AddedToken from ...tokenization_utils_fast import PreTrainedTokenizerFast from ...utils import is_sentencepiece_available, logging if is_sentencepiece_available(): from .tokenizatio...
27
import unittest from transformers import AutoTokenizer, NystromformerConfig, is_torch_available from transformers.testing_utils import require_torch, slow, torch_device from ...test_configuration_common import ConfigTester from ...test_modeling_common import ModelTesterMixin, ids_tensor, random_atte...
27
1
import argparse import requests import torch from PIL import Image from transformers import CLIPProcessor, GroupViTConfig, GroupViTModel def __lowerCAmelCase( _SCREAMING_SNAKE_CASE ) -> Tuple: """simple docstring""" if "img_encoder.pos_embed" i...
27
from typing import TYPE_CHECKING from ...utils import ( OptionalDependencyNotAvailable, _LazyModule, is_flax_available, is_tf_available, is_tokenizers_available, is_torch_available, ) __A : Dict = { "configuration_blenderbot": [ "BLENDER...
27
1
def __lowerCAmelCase( _SCREAMING_SNAKE_CASE ) -> int: """simple docstring""" _A = [[0 for _ in range(_SCREAMING_SNAKE_CASE )] for _ in range(m + 1 )] for i in range(m + 1 ): _A = 1 for n in range(m + 1 ): ...
27
import sys from .dependency_versions_table import deps from .utils.versions import require_version, require_version_core # define which module versions we always want to check at run time # (usually the ones defined in `install_requires` in setup.py) # # order specific notes: # - tqdm must be c...
27
1
from unittest.mock import patch import pyspark from datasets.packaged_modules.spark.spark import ( Spark, SparkExamplesIterable, _generate_iterable_examples, ) from ..utils import ( require_dill_gt_0_3_2, require_not_windows, ) def __lowerCAmelCase( _...
27
def __lowerCAmelCase( _SCREAMING_SNAKE_CASE , _SCREAMING_SNAKE_CASE ) -> int: """simple docstring""" return int((input_a, input_a).count(0 ) != 0 ) def __lowerCAmelCase( ) -> None: """simple docstring""" ...
27
1
import re import jax.numpy as jnp from flax.traverse_util import flatten_dict, unflatten_dict from jax.random import PRNGKey from ..utils import logging __A : int = logging.get_logger(__name__) def __lowerCAmelCase( _SCREAMING_SNAKE_CASE ) -> Unio...
27
from __future__ import annotations import unittest from transformers import EsmConfig, is_tf_available from transformers.testing_utils import require_tf, slow from ...test_configuration_common import ConfigTester from ...test_modeling_tf_common import TFModelTesterMixin, floats_tensor, ids_tensor...
27
1
from ...configuration_utils import PretrainedConfig from ...utils import logging __A : Optional[int] = logging.get_logger(__name__) __A : Union[str, Any] = {"openai-gpt": "https://huggingface.co/openai-gpt/resolve/main/config.json"} class lowe...
27
import logging from pathlib import Path import numpy as np import pytorch_lightning as pl import torch from pytorch_lightning.callbacks import EarlyStopping, ModelCheckpoint from pytorch_lightning.utilities import rank_zero_only from utils_rag import save_json def __lowerCAmelCase( ...
27
1
# 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 # # Unl...
27
def __lowerCAmelCase( _SCREAMING_SNAKE_CASE , _SCREAMING_SNAKE_CASE ) -> int: """simple docstring""" print('\nThe shortest path matrix using Floyd Warshall algorithm\n' ) for i in range(_SCREAMING_SNAKE_CASE ): for j in range(_SCREAM...
27
1
import warnings from ...utils import logging from .image_processing_owlvit import OwlViTImageProcessor __A : str = logging.get_logger(__name__) class lowerCamelCase( __snake_case ): '''simple docstring''' def __init__( self , *sna...
27
# Copyright 2022 The HuggingFace Team. All rights reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless r...
27
1
from math import factorial class lowerCamelCase: '''simple docstring''' def __init__( self , snake_case_ , snake_case_ ): _A = real if isinstance(snake_case_ , snake_case_ ): _A = [1...
27
from ... import PretrainedConfig __A : Optional[Any] = { "sijunhe/nezha-cn-base": "https://huggingface.co/sijunhe/nezha-cn-base/resolve/main/config.json", } class lowerCamelCase( __snake_case ): '''simple docstring''' __magic_name__ = ...
27
1
def __lowerCAmelCase( _SCREAMING_SNAKE_CASE ) -> list: """simple docstring""" def merge(_SCREAMING_SNAKE_CASE , _SCREAMING_SNAKE_CASE ) -> list: def _merge(): while left and right: yield (left if left[0] <= ri...
27
from collections import defaultdict from math import ceil, sqrt def __lowerCAmelCase( _SCREAMING_SNAKE_CASE = 1_000_000 , _SCREAMING_SNAKE_CASE = 10 ) -> int: """simple docstring""" _A = defaultdict(_SCREAMING_SNAKE_CASE ) ...
27
1
def __lowerCAmelCase( _SCREAMING_SNAKE_CASE ) -> None: """simple docstring""" _A = generate_pascal_triangle(_SCREAMING_SNAKE_CASE ) for row_idx in range(_SCREAMING_SNAKE_CASE ): # Print left spaces for _ in range(num_rows - ...
27
from math import pi, sqrt, tan def __lowerCAmelCase( _SCREAMING_SNAKE_CASE ) -> float: """simple docstring""" if side_length < 0: raise ValueError('surface_area_cube() only accepts non-negative values' ) return 6 * side_length**2 ...
27
1
import argparse import csv import logging import os import random import numpy as np import torch from torch.utils.data import DataLoader, RandomSampler, SequentialSampler, TensorDataset from tqdm import tqdm, trange from transformers import ( CONFIG_NAME, WEIGHTS_NAME, AdamW, ...
27
import numpy as np def __lowerCAmelCase( _SCREAMING_SNAKE_CASE ) -> np.array: """simple docstring""" return (2 / (1 + np.exp(-2 * vector ))) - 1 if __name__ == "__main__": import doctest doctest.testmod()
27
1
import unittest import numpy as np import torch from transformers import CLIPTextConfig, CLIPTextModel, CLIPTokenizer from diffusers import ( AutoencoderKL, DDIMScheduler, DPMSolverMultistepScheduler, TextToVideoSDPipeline, UNetaDConditionModel, ) from diffusers.utils impo...
27
from typing import TYPE_CHECKING from ...utils import OptionalDependencyNotAvailable, _LazyModule, is_sentencepiece_available __A : Optional[Any] = {} try: if not is_sentencepiece_available(): raise OptionalDependencyNotAvailable() except OptionalDependencyNotAvailable: ...
27
1
from __future__ import annotations __A : List[str] = { "A": ["B", "C", "E"], "B": ["A", "D", "E"], "C": ["A", "F", "G"], "D": ["B"], "E": ["A", "B", "D"], "F": ["C"], "G": ["C"], } class lowerCamelCase: '''simple docstring'''...
27
import json import os from pathlib import Path import pytest from datasets.download.download_config import DownloadConfig from datasets.download.download_manager import DownloadManager from datasets.utils.file_utils import hash_url_to_filename __A : List[Any] = "http://www.m...
27
1
def __lowerCAmelCase( _SCREAMING_SNAKE_CASE , _SCREAMING_SNAKE_CASE ) -> int: """simple docstring""" print('\nThe shortest path matrix using Floyd Warshall algorithm\n' ) for i in range(_SCREAMING_SNAKE_CASE ): for j in range(_SCREAM...
27
from __future__ import annotations from fractions import Fraction from math import gcd, sqrt def __lowerCAmelCase( _SCREAMING_SNAKE_CASE ) -> bool: """simple docstring""" _A = int(number**0.5 ) return number == sq * sq ...
27
1
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_devic...
27
from __future__ import annotations import math def __lowerCAmelCase( _SCREAMING_SNAKE_CASE ) -> list[int]: """simple docstring""" if num <= 0: _A = F"{num}: Invalid input, please enter a positive integer." raise ValueErro...
27
1
from random import shuffle import tensorflow as tf from numpy import array def __lowerCAmelCase( _SCREAMING_SNAKE_CASE , _SCREAMING_SNAKE_CASE ) -> Optional[int]: """simple docstring""" _A = int(_SCREAMING_SNAKE_CASE ) a...
27
__A : Dict = "Alexander Joslin" import operator as op from .stack import Stack def __lowerCAmelCase( _SCREAMING_SNAKE_CASE ) -> int: """simple docstring""" _A = {'*': op.mul, '/': op.truediv, '+': op.add, '-': op.sub} ...
27
1
from __future__ import annotations def __lowerCAmelCase( _SCREAMING_SNAKE_CASE , _SCREAMING_SNAKE_CASE ) -> Dict: """simple docstring""" if len(_SCREAMING_SNAKE_CASE ) <= 1 or n <= 1: return insert_next(_SCREAMING_SNAKE_CAS...
27
import unittest import numpy as np import torch from diffusers import KarrasVePipeline, KarrasVeScheduler, UNetaDModel from diffusers.utils.testing_utils import enable_full_determinism, require_torch, slow, torch_device enable_full_determinism() class lowerCamelCase( un...
27
1
import operator as op __A : List[Any] = "scaler.pt" __A : Optional[int] = "pytorch_model" __A : List[str] = "random_states" __A : Any = "optimizer" __A : Optional[int] = "scheduler" __A : List[Any] ...
27
import itertools import os import random import tempfile import unittest import numpy as np from transformers import TvltFeatureExtractor, is_datasets_available from transformers.testing_utils import check_json_file_has_correct_format, require_torch, require_torchaudio from transformers.utils.im...
27
1
from typing import Any, Dict, List, Union 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 ..image_utils import load_image if is_torch_available(): impor...
27
def __lowerCAmelCase( _SCREAMING_SNAKE_CASE ) -> bool: """simple docstring""" if not isinstance(_SCREAMING_SNAKE_CASE , _SCREAMING_SNAKE_CASE ): raise ValueError('check_bouncy() accepts only integer arguments' ) _A = str(_S...
27
1
from argparse import ArgumentParser from . import BaseTransformersCLICommand def __lowerCAmelCase( _SCREAMING_SNAKE_CASE ) -> Union[str, Any]: """simple docstring""" return DownloadCommand(args.model , args.cache_dir , args.force...
27
def __lowerCAmelCase( _SCREAMING_SNAKE_CASE , _SCREAMING_SNAKE_CASE ) -> float: """simple docstring""" return price * (1 + tax_rate) if __name__ == "__main__": print(f"{price_plus_tax(100, 0.2_5) = }") print(f"{price_plus_tax(1_2_5.5_0, 0.0_5) ...
27
1
import collections from typing import List, Optional, Union from ...tokenization_utils_base import BatchEncoding from ...utils import TensorType, add_end_docstrings, add_start_docstrings, logging from ..bert.tokenization_bert_fast import BertTokenizerFast from .tokenization_dpr import DPRContextEncod...
27
from collections.abc import Callable def __lowerCAmelCase( _SCREAMING_SNAKE_CASE , _SCREAMING_SNAKE_CASE , _SCREAMING_SNAKE_CASE ) -> float: """simple docstring""" _A = a _A = b if function(_SCREAMING_S...
27
1
from typing import TYPE_CHECKING from ...utils import ( OptionalDependencyNotAvailable, _LazyModule, is_sentencepiece_available, is_tokenizers_available, is_torch_available, ) __A : List[str] = {} try: if not is_sentencepiece_available(): raise Opt...
27
import unittest from transformers import AutoTokenizer, NystromformerConfig, is_torch_available from transformers.testing_utils import require_torch, slow, torch_device from ...test_configuration_common import ConfigTester from ...test_modeling_common import ModelTesterMixin, ids_tensor, random_atte...
27
1
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: from ....
27
from typing import TYPE_CHECKING from ...utils import ( OptionalDependencyNotAvailable, _LazyModule, is_flax_available, is_tf_available, is_tokenizers_available, is_torch_available, ) __A : Dict = { "configuration_blenderbot": [ "BLENDER...
27
1
import inspect from typing import List, Optional, Tuple, Union import numpy as np import PIL import torch import torch.utils.checkpoint from ...models import UNetaDModel, VQModel from ...schedulers import ( DDIMScheduler, DPMSolverMultistepScheduler, EulerAncestralDiscreteScheduler...
27
import sys from .dependency_versions_table import deps from .utils.versions import require_version, require_version_core # define which module versions we always want to check at run time # (usually the ones defined in `install_requires` in setup.py) # # order specific notes: # - tqdm must be c...
27
1
def __lowerCAmelCase( _SCREAMING_SNAKE_CASE ) -> int: """simple docstring""" if not isinstance(_SCREAMING_SNAKE_CASE , _SCREAMING_SNAKE_CASE ): _A = F"Input value of [number={number}] must be an integer" raise TypeError(_S...
27
def __lowerCAmelCase( _SCREAMING_SNAKE_CASE , _SCREAMING_SNAKE_CASE ) -> int: """simple docstring""" return int((input_a, input_a).count(0 ) != 0 ) def __lowerCAmelCase( ) -> None: """simple docstring""" ...
27
1
import json import os from pathlib import Path import pytest from datasets.download.download_config import DownloadConfig from datasets.download.download_manager import DownloadManager from datasets.utils.file_utils import hash_url_to_filename __A : List[Any] = "http://www.m...
27
from __future__ import annotations import unittest from transformers import EsmConfig, is_tf_available from transformers.testing_utils import require_tf, slow from ...test_configuration_common import ConfigTester from ...test_modeling_tf_common import TFModelTesterMixin, floats_tensor, ids_tensor...
27
1
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, convert_to_rgb, get_resize_output_image_size, normalize, rescale, resize...
27
import logging from pathlib import Path import numpy as np import pytorch_lightning as pl import torch from pytorch_lightning.callbacks import EarlyStopping, ModelCheckpoint from pytorch_lightning.utilities import rank_zero_only from utils_rag import save_json def __lowerCAmelCase( ...
27
1
import json import os import tempfile from transformers.testing_utils import check_json_file_has_correct_format class lowerCamelCase: '''simple docstring''' __magic_name__ = None def lowerCAmelCase__ ( self ): _A = ...
27
def __lowerCAmelCase( _SCREAMING_SNAKE_CASE , _SCREAMING_SNAKE_CASE ) -> int: """simple docstring""" print('\nThe shortest path matrix using Floyd Warshall algorithm\n' ) for i in range(_SCREAMING_SNAKE_CASE ): for j in range(_SCREAM...
27
1
# Copyright 2022 The HuggingFace Team. All rights reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless r...
27
# Copyright 2022 The HuggingFace Team. All rights reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless r...
27
1
def __lowerCAmelCase( _SCREAMING_SNAKE_CASE ) -> str: """simple docstring""" _A = int(_SCREAMING_SNAKE_CASE ) if decimal in (0, 1): # Exit cases for the recursion return str(_SCREAMING_SNAKE_CASE ) _A, _A = divmod(_...
27
from ... import PretrainedConfig __A : Optional[Any] = { "sijunhe/nezha-cn-base": "https://huggingface.co/sijunhe/nezha-cn-base/resolve/main/config.json", } class lowerCamelCase( __snake_case ): '''simple docstring''' __magic_name__ = ...
27
1
from typing import TYPE_CHECKING from ...file_utils import _LazyModule, is_torch_available from ...utils import OptionalDependencyNotAvailable __A : Union[str, Any] = { "configuration_gpt_neox_japanese": ["GPT_NEOX_JAPANESE_PRETRAINED_CONFIG_ARCHIVE_MAP", "GPTNeoXJapaneseConf...
27
from collections import defaultdict from math import ceil, sqrt def __lowerCAmelCase( _SCREAMING_SNAKE_CASE = 1_000_000 , _SCREAMING_SNAKE_CASE = 10 ) -> int: """simple docstring""" _A = defaultdict(_SCREAMING_SNAKE_CASE ) ...
27
1
from typing import TYPE_CHECKING from ...utils import ( OptionalDependencyNotAvailable, _LazyModule, is_flax_available, is_sentencepiece_available, is_tf_available, is_tokenizers_available, is_torch_available, ) __A : List[str] = { "configur...
27
from math import pi, sqrt, tan def __lowerCAmelCase( _SCREAMING_SNAKE_CASE ) -> float: """simple docstring""" if side_length < 0: raise ValueError('surface_area_cube() only accepts non-negative values' ) return 6 * side_length**2 ...
27
1
import inspect import logging import os import random import shutil import tempfile import unittest import pytest import torch from torch import nn from torch.utils.data import DataLoader, TensorDataset from accelerate import Accelerator from accelerate.test_utils import execute_subprocess_a...
27
import numpy as np def __lowerCAmelCase( _SCREAMING_SNAKE_CASE ) -> np.array: """simple docstring""" return (2 / (1 + np.exp(-2 * vector ))) - 1 if __name__ == "__main__": import doctest doctest.testmod()
27
1
from sympy import diff, lambdify, symbols from sympy.functions import * # noqa: F403 def __lowerCAmelCase( _SCREAMING_SNAKE_CASE , _SCREAMING_SNAKE_CASE , _SCREAMING_SNAKE_CASE = "x" , _SCREAMING_SNAKE_CASE = 10**-10 , _SCREAMING_SNAKE_CASE = 1 ...
27
from typing import TYPE_CHECKING from ...utils import OptionalDependencyNotAvailable, _LazyModule, is_sentencepiece_available __A : Optional[Any] = {} try: if not is_sentencepiece_available(): raise OptionalDependencyNotAvailable() except OptionalDependencyNotAvailable: ...
27
1
import gc import random import unittest import numpy as np import torch from PIL import Image from transformers import CLIPTextConfig, CLIPTextModel, CLIPTokenizer from diffusers import AutoencoderKL, DDIMScheduler, DDPMScheduler, StableDiffusionUpscalePipeline, UNetaDConditionModel from diffuse...
27
import json import os from pathlib import Path import pytest from datasets.download.download_config import DownloadConfig from datasets.download.download_manager import DownloadManager from datasets.utils.file_utils import hash_url_to_filename __A : List[Any] = "http://www.m...
27
1
import os import pytest from attr import dataclass __A : int = "us-east-1" # defaults region @dataclass class lowerCamelCase: '''simple docstring''' __magic_name__ = 42 __magic_name__ = 'arn:aws:iam::558105141721:role/sagemaker_e...
27
from __future__ import annotations from fractions import Fraction from math import gcd, sqrt def __lowerCAmelCase( _SCREAMING_SNAKE_CASE ) -> bool: """simple docstring""" _A = int(number**0.5 ) return number == sq * sq ...
27
1
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 ViTConfig, ViTForImageClassification, ViTImageProcessor, ViTModel from transformers.utils import logging logging.set_v...
27
from __future__ import annotations import math def __lowerCAmelCase( _SCREAMING_SNAKE_CASE ) -> list[int]: """simple docstring""" if num <= 0: _A = F"{num}: Invalid input, please enter a positive integer." raise ValueErro...
27
1
import argparse import os import torch from diffusers import ( CMStochasticIterativeScheduler, ConsistencyModelPipeline, UNetaDModel, ) __A : Union[str, Any] = { "sample_size": 32, "in_channels": 3, "out_channels": 3, "layers_per_block": 2, ...
27
__A : Dict = "Alexander Joslin" import operator as op from .stack import Stack def __lowerCAmelCase( _SCREAMING_SNAKE_CASE ) -> int: """simple docstring""" _A = {'*': op.mul, '/': op.truediv, '+': op.add, '-': op.sub} ...
27
1
from __future__ import annotations def __lowerCAmelCase( _SCREAMING_SNAKE_CASE , _SCREAMING_SNAKE_CASE ) -> set[str]: """simple docstring""" _A, _A = set(_SCREAMING_SNAKE_CASE ), [start] while stack: _A = ...
27
import unittest import numpy as np import torch from diffusers import KarrasVePipeline, KarrasVeScheduler, UNetaDModel from diffusers.utils.testing_utils import enable_full_determinism, require_torch, slow, torch_device enable_full_determinism() class lowerCamelCase( un...
27
1
import os from shutil import copyfile from typing import Any, Dict, List, Optional, Tuple import sentencepiece as spm from ...tokenization_utils import AddedToken, PreTrainedTokenizer from ...utils import logging __A : Union[str, Any] = logging.get_logger(__name__) __A ...
27
import itertools import os import random import tempfile import unittest import numpy as np from transformers import TvltFeatureExtractor, is_datasets_available from transformers.testing_utils import check_json_file_has_correct_format, require_torch, require_torchaudio from transformers.utils.im...
27
1
from typing import TYPE_CHECKING from ...utils import ( OptionalDependencyNotAvailable, _LazyModule, is_tf_available, is_torch_available, is_vision_available, ) __A : Dict = { "configuration_convnext": ["CONVNEXT_PRETRAINED_CONFIG_ARCHIVE_MAP", "ConvN...
27
def __lowerCAmelCase( _SCREAMING_SNAKE_CASE ) -> bool: """simple docstring""" if not isinstance(_SCREAMING_SNAKE_CASE , _SCREAMING_SNAKE_CASE ): raise ValueError('check_bouncy() accepts only integer arguments' ) _A = str(_S...
27
1
import re from flax.core.frozen_dict import freeze from flax.traverse_util import flatten_dict, unflatten_dict from jax.experimental import PartitionSpec as P # Sentinels __A : Optional[Any] = object() # For specifying empty leaf dict `{}` __A : Union[str, Any] ...
27
def __lowerCAmelCase( _SCREAMING_SNAKE_CASE , _SCREAMING_SNAKE_CASE ) -> float: """simple docstring""" return price * (1 + tax_rate) if __name__ == "__main__": print(f"{price_plus_tax(100, 0.2_5) = }") print(f"{price_plus_tax(1_2_5.5_0, 0.0_5) ...
27
1
from typing import TYPE_CHECKING from ...utils import OptionalDependencyNotAvailable, _LazyModule, is_torch_available, is_vision_available __A : List[str] = { "configuration_conditional_detr": [ "CONDITIONAL_DETR_PRETRAINED_CONFIG_ARCHIVE_MAP", "ConditionalDe...
27
from collections.abc import Callable def __lowerCAmelCase( _SCREAMING_SNAKE_CASE , _SCREAMING_SNAKE_CASE , _SCREAMING_SNAKE_CASE ) -> float: """simple docstring""" _A = a _A = b if function(_SCREAMING_S...
27
1
import baseaa def __lowerCAmelCase( _SCREAMING_SNAKE_CASE ) -> bytes: """simple docstring""" return baseaa.aaaencode(string.encode('utf-8' ) ) def __lowerCAmelCase( _SCREAMING_SNAKE_CASE ) -> str: """sim...
27
import unittest from transformers import AutoTokenizer, NystromformerConfig, is_torch_available from transformers.testing_utils import require_torch, slow, torch_device from ...test_configuration_common import ConfigTester from ...test_modeling_common import ModelTesterMixin, ids_tensor, random_atte...
27
1
import argparse import re import numpy as np import requests import torch from huggingface_hub import hf_hub_download from PIL import Image from transformers import ( SamConfig, SamImageProcessor, SamModel, SamProcessor, SamVisionConfig, ) __A : Tuple ...
27
from typing import TYPE_CHECKING from ...utils import ( OptionalDependencyNotAvailable, _LazyModule, is_flax_available, is_tf_available, is_tokenizers_available, is_torch_available, ) __A : Dict = { "configuration_blenderbot": [ "BLENDER...
27
1
import math def __lowerCAmelCase( _SCREAMING_SNAKE_CASE ) -> str: """simple docstring""" _A = 0 _A = 0 while num > 0: _A = num % 8 _A = octal + (remainder * math.floor(math.pow(10 ...
27
import sys from .dependency_versions_table import deps from .utils.versions import require_version, require_version_core # define which module versions we always want to check at run time # (usually the ones defined in `install_requires` in setup.py) # # order specific notes: # - tqdm must be c...
27
1
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_modeling_common import ModelTesterMixin,...
27
def __lowerCAmelCase( _SCREAMING_SNAKE_CASE , _SCREAMING_SNAKE_CASE ) -> int: """simple docstring""" return int((input_a, input_a).count(0 ) != 0 ) def __lowerCAmelCase( ) -> None: """simple docstring""" ...
27
1
import unittest from transformers import AutoTokenizer, NystromformerConfig, is_torch_available from transformers.testing_utils import require_torch, slow, torch_device from ...test_configuration_common import ConfigTester from ...test_modeling_common import ModelTesterMixin, ids_tensor, random_atte...
27
from __future__ import annotations import unittest from transformers import EsmConfig, is_tf_available from transformers.testing_utils import require_tf, slow from ...test_configuration_common import ConfigTester from ...test_modeling_tf_common import TFModelTesterMixin, floats_tensor, ids_tensor...
27
1
import copy import os from typing import Union from ...configuration_utils import PretrainedConfig from ...models.auto.modeling_auto import MODEL_FOR_CAUSAL_LM_MAPPING_NAMES from ...utils import logging from ..auto import CONFIG_MAPPING __A : str = logging.get_logger(__name__)...
27
import logging from pathlib import Path import numpy as np import pytorch_lightning as pl import torch from pytorch_lightning.callbacks import EarlyStopping, ModelCheckpoint from pytorch_lightning.utilities import rank_zero_only from utils_rag import save_json def __lowerCAmelCase( ...
27
1
import argparse import datetime def __lowerCAmelCase( _SCREAMING_SNAKE_CASE ) -> str: """simple docstring""" _A = { '0': 'Sunday', '1': 'Monday', '2': 'Tuesday', '3': 'Wednesday', '4': 'Thursday',...
27
def __lowerCAmelCase( _SCREAMING_SNAKE_CASE , _SCREAMING_SNAKE_CASE ) -> int: """simple docstring""" print('\nThe shortest path matrix using Floyd Warshall algorithm\n' ) for i in range(_SCREAMING_SNAKE_CASE ): for j in range(_SCREAM...
27
1
from collections import OrderedDict from typing import TYPE_CHECKING, Any, Mapping, Optional from ...configuration_utils import PretrainedConfig from ...onnx import OnnxConfig from ...utils import logging if TYPE_CHECKING: from ... import FeatureExtractionMixin, TensorType __A : Opti...
27
# Copyright 2022 The HuggingFace Team. All rights reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless r...
27
1
def __lowerCAmelCase( _SCREAMING_SNAKE_CASE , _SCREAMING_SNAKE_CASE ) -> list[int]: """simple docstring""" _A = int(_SCREAMING_SNAKE_CASE ) # Initialize Result _A = [] # Traverse through all denomination fo...
27
from ... import PretrainedConfig __A : Optional[Any] = { "sijunhe/nezha-cn-base": "https://huggingface.co/sijunhe/nezha-cn-base/resolve/main/config.json", } class lowerCamelCase( __snake_case ): '''simple docstring''' __magic_name__ = ...
27
1
from __future__ import annotations import unittest from transformers import FunnelConfig, is_tf_available from transformers.testing_utils import require_tf from ...test_configuration_common import ConfigTester from ...test_modeling_tf_common import TFModelTesterMixin, ids_tensor, random_attention...
27
from collections import defaultdict from math import ceil, sqrt def __lowerCAmelCase( _SCREAMING_SNAKE_CASE = 1_000_000 , _SCREAMING_SNAKE_CASE = 10 ) -> int: """simple docstring""" _A = defaultdict(_SCREAMING_SNAKE_CASE ) ...
27
1
import importlib import os import fsspec import pytest from fsspec import register_implementation from fsspec.registry import _registry as _fsspec_registry from datasets.filesystems import COMPRESSION_FILESYSTEMS, HfFileSystem, extract_path_from_uri, is_remote_filesystem from .utils import requ...
27
from math import pi, sqrt, tan def __lowerCAmelCase( _SCREAMING_SNAKE_CASE ) -> float: """simple docstring""" if side_length < 0: raise ValueError('surface_area_cube() only accepts non-negative values' ) return 6 * side_length**2 ...
27
1
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...
27
import numpy as np def __lowerCAmelCase( _SCREAMING_SNAKE_CASE ) -> np.array: """simple docstring""" return (2 / (1 + np.exp(-2 * vector ))) - 1 if __name__ == "__main__": import doctest doctest.testmod()
27
1
def __lowerCAmelCase( _SCREAMING_SNAKE_CASE ) -> list[list[int]]: """simple docstring""" _A = [] if len(_SCREAMING_SNAKE_CASE ) == 1: return [nums.copy()] for _ in range(len(_SCREAMING_SNAKE_CASE ) ): _A = ...
27
from typing import TYPE_CHECKING from ...utils import OptionalDependencyNotAvailable, _LazyModule, is_sentencepiece_available __A : Optional[Any] = {} try: if not is_sentencepiece_available(): raise OptionalDependencyNotAvailable() except OptionalDependencyNotAvailable: ...
27
1
from __future__ import annotations import math def __lowerCAmelCase( _SCREAMING_SNAKE_CASE ) -> list[int]: """simple docstring""" if num <= 0: _A = F"{num}: Invalid input, please enter a positive integer." raise ValueErro...
27
import json import os from pathlib import Path import pytest from datasets.download.download_config import DownloadConfig from datasets.download.download_manager import DownloadManager from datasets.utils.file_utils import hash_url_to_filename __A : List[Any] = "http://www.m...
27
1
import unittest import numpy as np from transformers import RoFormerConfig, is_flax_available from transformers.testing_utils import require_flax, slow from ...test_modeling_flax_common import FlaxModelTesterMixin, ids_tensor, random_attention_mask if is_flax_available(): import jax.numpy a...
27
from __future__ import annotations from fractions import Fraction from math import gcd, sqrt def __lowerCAmelCase( _SCREAMING_SNAKE_CASE ) -> bool: """simple docstring""" _A = int(number**0.5 ) return number == sq * sq ...
27
1
import os from typing import Optional import fsspec from fsspec.archive import AbstractArchiveFileSystem from fsspec.utils import DEFAULT_BLOCK_SIZE class lowerCamelCase( __snake_case ): '''simple docstring''' __magic_name__ = '' __magic_name__ = ...
27
from __future__ import annotations import math def __lowerCAmelCase( _SCREAMING_SNAKE_CASE ) -> list[int]: """simple docstring""" if num <= 0: _A = F"{num}: Invalid input, please enter a positive integer." raise ValueErro...
27
1
def __lowerCAmelCase( _SCREAMING_SNAKE_CASE ) -> bool: """simple docstring""" _A = n ** (1 / 3) return (val * val * val) == n if __name__ == "__main__": print(perfect_cube(27)) print(perfect_cube(4))
27
__A : Dict = "Alexander Joslin" import operator as op from .stack import Stack def __lowerCAmelCase( _SCREAMING_SNAKE_CASE ) -> int: """simple docstring""" _A = {'*': op.mul, '/': op.truediv, '+': op.add, '-': op.sub} ...
27
1
from ...configuration_utils import PretrainedConfig from ...utils import logging __A : List[Any] = logging.get_logger(__name__) __A : Union[str, Any] = { "facebook/nllb-moe-54B": "https://huggingface.co/facebook/nllb-moe-54b/resolve/main/config.json", } ...
27
import unittest import numpy as np import torch from diffusers import KarrasVePipeline, KarrasVeScheduler, UNetaDModel from diffusers.utils.testing_utils import enable_full_determinism, require_torch, slow, torch_device enable_full_determinism() class lowerCamelCase( un...
27
1
from typing import TYPE_CHECKING from ...utils import _LazyModule __A : List[str] = {"tokenization_byt5": ["ByT5Tokenizer"]} if TYPE_CHECKING: from .tokenization_byta import ByTaTokenizer else: import sys __A : Tuple = _LazyModule(__name__, globals()...
27
import itertools import os import random import tempfile import unittest import numpy as np from transformers import TvltFeatureExtractor, is_datasets_available from transformers.testing_utils import check_json_file_has_correct_format, require_torch, require_torchaudio from transformers.utils.im...
27
1
import argparse import json from collections import OrderedDict from pathlib import Path import requests import torch from huggingface_hub import hf_hub_download from PIL import Image from transformers import PoolFormerConfig, PoolFormerForImageClassification, PoolFormerImageProcessor from tran...
27
def __lowerCAmelCase( _SCREAMING_SNAKE_CASE ) -> bool: """simple docstring""" if not isinstance(_SCREAMING_SNAKE_CASE , _SCREAMING_SNAKE_CASE ): raise ValueError('check_bouncy() accepts only integer arguments' ) _A = str(_S...
27
1
import logging from pathlib import Path import numpy as np import pytorch_lightning as pl import torch from pytorch_lightning.callbacks import EarlyStopping, ModelCheckpoint from pytorch_lightning.utilities import rank_zero_only from utils_rag import save_json def __lowerCAmelCase( ...
27
def __lowerCAmelCase( _SCREAMING_SNAKE_CASE , _SCREAMING_SNAKE_CASE ) -> float: """simple docstring""" return price * (1 + tax_rate) if __name__ == "__main__": print(f"{price_plus_tax(100, 0.2_5) = }") print(f"{price_plus_tax(1_2_5.5_0, 0.0_5) ...
27
1
def __lowerCAmelCase( _SCREAMING_SNAKE_CASE ) -> int: """simple docstring""" if a < 0: raise ValueError('Input value must be a positive integer' ) elif isinstance(_SCREAMING_SNAKE_CASE , _SCREAMING_SNAKE_CASE ): raise TypeEr...
27
from collections.abc import Callable def __lowerCAmelCase( _SCREAMING_SNAKE_CASE , _SCREAMING_SNAKE_CASE , _SCREAMING_SNAKE_CASE ) -> float: """simple docstring""" _A = a _A = b if function(_SCREAMING_S...
27
1
import os from shutil import copyfile from typing import Any, Dict, List, Optional, Tuple import sentencepiece as spm from ...tokenization_utils import PreTrainedTokenizer from ...utils import logging __A : List[str] = logging.get_logger(__name__) __A : List[Any] ...
27
import unittest from transformers import AutoTokenizer, NystromformerConfig, is_torch_available from transformers.testing_utils import require_torch, slow, torch_device from ...test_configuration_common import ConfigTester from ...test_modeling_common import ModelTesterMixin, ids_tensor, random_atte...
27
1
import gc import random import unittest import numpy as np import torch from diffusers import ( DDIMScheduler, KandinskyVaaControlnetPipeline, KandinskyVaaPriorPipeline, UNetaDConditionModel, VQModel, ) from diffusers.utils import floats_tensor, load_image, load_numpy, sl...
27
from typing import TYPE_CHECKING from ...utils import ( OptionalDependencyNotAvailable, _LazyModule, is_flax_available, is_tf_available, is_tokenizers_available, is_torch_available, ) __A : Dict = { "configuration_blenderbot": [ "BLENDER...
27
1
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_torch_available, is_vision_available f...
27
import sys from .dependency_versions_table import deps from .utils.versions import require_version, require_version_core # define which module versions we always want to check at run time # (usually the ones defined in `install_requires` in setup.py) # # order specific notes: # - tqdm must be c...
27
1
import collections.abc from typing import Optional, Tuple, Union import torch import torch.utils.checkpoint from torch import nn from torch.nn import BCEWithLogitsLoss, CrossEntropyLoss, MSELoss from ...activations import ACTaFN from ...modeling_outputs import BaseModelOutputWithNoAttention, Imag...
27
def __lowerCAmelCase( _SCREAMING_SNAKE_CASE , _SCREAMING_SNAKE_CASE ) -> int: """simple docstring""" return int((input_a, input_a).count(0 ) != 0 ) def __lowerCAmelCase( ) -> None: """simple docstring""" ...
27
1
import os import numpy import onnx def __lowerCAmelCase( _SCREAMING_SNAKE_CASE , _SCREAMING_SNAKE_CASE ) -> Optional[int]: """simple docstring""" _A = a.name _A = b.name _A = '' _A = ...
27
from __future__ import annotations import unittest from transformers import EsmConfig, is_tf_available from transformers.testing_utils import require_tf, slow from ...test_configuration_common import ConfigTester from ...test_modeling_tf_common import TFModelTesterMixin, floats_tensor, ids_tensor...
27
1
from collections.abc import Callable def __lowerCAmelCase( _SCREAMING_SNAKE_CASE , _SCREAMING_SNAKE_CASE , _SCREAMING_SNAKE_CASE ) -> float: """simple docstring""" _A = a _A = b if function(_SCREAMING_S...
27
import logging from pathlib import Path import numpy as np import pytorch_lightning as pl import torch from pytorch_lightning.callbacks import EarlyStopping, ModelCheckpoint from pytorch_lightning.utilities import rank_zero_only from utils_rag import save_json def __lowerCAmelCase( ...
27
1
import sys from .dependency_versions_table import deps from .utils.versions import require_version, require_version_core # define which module versions we always want to check at run time # (usually the ones defined in `install_requires` in setup.py) # # order specific notes: # - tqdm must be c...
27
def __lowerCAmelCase( _SCREAMING_SNAKE_CASE , _SCREAMING_SNAKE_CASE ) -> int: """simple docstring""" print('\nThe shortest path matrix using Floyd Warshall algorithm\n' ) for i in range(_SCREAMING_SNAKE_CASE ): for j in range(_SCREAM...
27
1
def __lowerCAmelCase( _SCREAMING_SNAKE_CASE = 1_000 ) -> int: """simple docstring""" _A = -1 _A = 0 for a in range(1 , n // 3 ): # Solving the two equations a**2+b**2=c**2 and a+b+c=N eliminating c _A ...
27
# Copyright 2022 The HuggingFace Team. All rights reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless r...
27
1
import json from typing import List, Optional, Tuple from tokenizers import normalizers from ...tokenization_utils_fast import PreTrainedTokenizerFast from ...utils import logging from .tokenization_squeezebert import SqueezeBertTokenizer __A : Union[str, Any] = logging.get_l...
27
from ... import PretrainedConfig __A : Optional[Any] = { "sijunhe/nezha-cn-base": "https://huggingface.co/sijunhe/nezha-cn-base/resolve/main/config.json", } class lowerCamelCase( __snake_case ): '''simple docstring''' __magic_name__ = ...
27
1
from typing import TYPE_CHECKING from ...utils import ( OptionalDependencyNotAvailable, _LazyModule, is_tf_available, is_torch_available, is_vision_available, ) __A : str = { "configuration_mobilevit": ["MOBILEVIT_PRETRAINED_CONFIG_ARCHIVE_MAP", "Mobi...
27
from collections import defaultdict from math import ceil, sqrt def __lowerCAmelCase( _SCREAMING_SNAKE_CASE = 1_000_000 , _SCREAMING_SNAKE_CASE = 10 ) -> int: """simple docstring""" _A = defaultdict(_SCREAMING_SNAKE_CASE ) ...
27
1
import importlib.metadata import warnings from copy import deepcopy from packaging import version from ..utils import logging from .import_utils import is_accelerate_available, is_bitsandbytes_available if is_bitsandbytes_available(): import bitsandbytes as bnb import torch import torch....
27
from math import pi, sqrt, tan def __lowerCAmelCase( _SCREAMING_SNAKE_CASE ) -> float: """simple docstring""" if side_length < 0: raise ValueError('surface_area_cube() only accepts non-negative values' ) return 6 * side_length**2 ...
27
1
def __lowerCAmelCase( _SCREAMING_SNAKE_CASE , _SCREAMING_SNAKE_CASE ) -> int: """simple docstring""" _A = 0 while b > 0: if b & 1: res += a a += a b >>= 1 return res def __lo...
27
import numpy as np def __lowerCAmelCase( _SCREAMING_SNAKE_CASE ) -> np.array: """simple docstring""" return (2 / (1 + np.exp(-2 * vector ))) - 1 if __name__ == "__main__": import doctest doctest.testmod()
27
1
import json from typing import List, Optional, Tuple from tokenizers import normalizers from ...tokenization_utils_fast import PreTrainedTokenizerFast from .tokenization_electra import ElectraTokenizer __A : int = {"vocab_file": "vocab.txt", "tokenizer_file": "tokenizer.json"}...
27
from typing import TYPE_CHECKING from ...utils import OptionalDependencyNotAvailable, _LazyModule, is_sentencepiece_available __A : Optional[Any] = {} try: if not is_sentencepiece_available(): raise OptionalDependencyNotAvailable() except OptionalDependencyNotAvailable: ...
27
1
import numpy as np __A : int = [ ["a", "b", "c", "d", "e"], ["f", "g", "h", "i", "k"], ["l", "m", "n", "o", "p"], ["q", "r", "s", "t", "u"], ["v", "w", "x", "y", "z"], ] class lowerCamelCase: '''simple docstring''' def __init...
27
import json import os from pathlib import Path import pytest from datasets.download.download_config import DownloadConfig from datasets.download.download_manager import DownloadManager from datasets.utils.file_utils import hash_url_to_filename __A : List[Any] = "http://www.m...
27
1
from __future__ import annotations import math def __lowerCAmelCase( _SCREAMING_SNAKE_CASE ) -> bool: """simple docstring""" if 1 < number < 4: # 2 and 3 are primes return True elif number < 2 or number % 2 == 0 or number % 3 ...
27
from __future__ import annotations from fractions import Fraction from math import gcd, sqrt def __lowerCAmelCase( _SCREAMING_SNAKE_CASE ) -> bool: """simple docstring""" _A = int(number**0.5 ) return number == sq * sq ...
27
1
def __lowerCAmelCase( _SCREAMING_SNAKE_CASE , _SCREAMING_SNAKE_CASE ) -> int: """simple docstring""" _A = '' for i in table: res += inp[i - 1] return res def __lowerCAmelCase( _SCREAMING_SNAKE_CASE ) ...
27
from __future__ import annotations import math def __lowerCAmelCase( _SCREAMING_SNAKE_CASE ) -> list[int]: """simple docstring""" if num <= 0: _A = F"{num}: Invalid input, please enter a positive integer." raise ValueErro...
27
1
from ..utils import DummyObject, requires_backends class lowerCamelCase( metaclass=__snake_case ): '''simple docstring''' __magic_name__ = ['torch', 'torchsde'] def __init__( self , *snake_case_ , **snake_case_ ): re...
27
__A : Dict = "Alexander Joslin" import operator as op from .stack import Stack def __lowerCAmelCase( _SCREAMING_SNAKE_CASE ) -> int: """simple docstring""" _A = {'*': op.mul, '/': op.truediv, '+': op.add, '-': op.sub} ...
27
1
import torch from diffusers import CMStochasticIterativeScheduler from .test_schedulers import SchedulerCommonTest class lowerCamelCase( __snake_case ): '''simple docstring''' __magic_name__ = (CMStochasticIterativeScheduler,) __magic_name__ = 10 ...
27
import unittest import numpy as np import torch from diffusers import KarrasVePipeline, KarrasVeScheduler, UNetaDModel from diffusers.utils.testing_utils import enable_full_determinism, require_torch, slow, torch_device enable_full_determinism() class lowerCamelCase( un...
27
1
def __lowerCAmelCase( _SCREAMING_SNAKE_CASE ) -> bool: """simple docstring""" if not isinstance(_SCREAMING_SNAKE_CASE , _SCREAMING_SNAKE_CASE ): raise ValueError('check_bouncy() accepts only integer arguments' ) _A = str(_S...
27
import itertools import os import random import tempfile import unittest import numpy as np from transformers import TvltFeatureExtractor, is_datasets_available from transformers.testing_utils import check_json_file_has_correct_format, require_torch, require_torchaudio from transformers.utils.im...
27
1