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 math import sqrt def A__ ( SCREAMING_SNAKE_CASE_ : int ) -> bool: """simple docstring""" if 1 < number < 4: # 2 and 3 are primes return True elif number < 2 or number % 2 == 0 or number % 3 == 0: # Negatives, 0, 1, all even numbers, all mult...
32
UpperCAmelCase_ = { "A": ".-", "B": "-...", "C": "-.-.", "D": "-..", "E": ".", "F": "..-.", "G": "--.", "H": "....", "I": "..", "J": ".---", "K": "-.-", "L": ".-..", "M": "--", "N": "-.", "O": "---", "P": ".--.", "Q": "--.-", "R": ".-.", "S": "...", "T": "-", "U": "..-", "V": "...-", "W"...
32
1
import baseaa def A__ ( SCREAMING_SNAKE_CASE_ : str ) -> bytes: """simple docstring""" return baseaa.baaencode(string.encode('''utf-8''' ) ) def A__ ( SCREAMING_SNAKE_CASE_ : bytes ) -> str: """simple docstring""" ...
32
import gc import unittest import numpy as np import torch from diffusers import DanceDiffusionPipeline, IPNDMScheduler, UNetaDModel from diffusers.utils import slow, torch_device from diffusers.utils.testing_utils import enable_full_determinism, require_torch_gpu, skip_mps from ..pipeline_params import UNCONDI...
32
1
import os import tempfile from functools import partial from unittest import TestCase from unittest.mock import patch import datasets import datasets.config from .utils import require_beam class __UpperCamelCase ( datasets.BeamBasedBuilder ): def UpperCamelCase( self ): ...
32
from collections import OrderedDict from ...utils import logging from .auto_factory import _BaseAutoModelClass, _LazyAutoMapping, auto_class_update from .configuration_auto import CONFIG_MAPPING_NAMES UpperCAmelCase_ = logging.get_logger(__name__) UpperCAmelCase_ = OrderedDict( [ ...
32
1
import enum import os from hashlib import shaaaa from typing import Optional from .. import config from .logging import get_logger UpperCAmelCase_ = get_logger(__name__) class __UpperCamelCase ( enum.Enum ): __A : int = """all_checks""" __A : Tuple = ...
32
import baseaa def A__ ( SCREAMING_SNAKE_CASE_ : str ) -> bytes: """simple docstring""" return baseaa.baaencode(string.encode('''utf-8''' ) ) def A__ ( SCREAMING_SNAKE_CASE_ : bytes ) -> str: """simple docstring""" ...
32
1
from collections import defaultdict from graphs.minimum_spanning_tree_prims import prisms_algorithm as mst def A__ ( ) -> Tuple: """simple docstring""" _UpperCAmelCase , _UpperCAmelCase = 9, 14 # noqa: F841 _UpperCAmelCase = [ [0, 1...
32
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_format, ) ...
32
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, ids_tensor f...
32
from ..utils import DummyObject, requires_backends class __UpperCamelCase ( metaclass=A__ ): __A : str = ["""torch""", """scipy"""] def __init__( self , *_UpperCamelCase , **_UpperCamelCase ): requires_backends(self , ['''torc...
32
1
from typing import TYPE_CHECKING from ...utils import OptionalDependencyNotAvailable, _LazyModule, is_torch_available, is_vision_available UpperCAmelCase_ = {"configuration_yolos": ["YOLOS_PRETRAINED_CONFIG_ARCHIVE_MAP", "YolosConfig", "YolosOnnxConfig"]} try: if not is_vision_available(): ...
32
def A__ ( SCREAMING_SNAKE_CASE_ : int = 2_00_00_00 ) -> int: """simple docstring""" _UpperCAmelCase = [0 for i in range(n + 1 )] _UpperCAmelCase = 1 _UpperCAmelCase = 1 for i in range(2 , int(n**0.5 ) + 1 ...
32
1
from ...configuration_utils import PretrainedConfig from ...utils import logging UpperCAmelCase_ = logging.get_logger(__name__) UpperCAmelCase_ = { "SCUT-DLVCLab/lilt-roberta-en-base": ( "https://huggingface.co/SCUT-DLVCLab/lilt-roberta-en-base/resolve/main/config.json" ), }...
32
import warnings from ...utils import logging from .image_processing_glpn import GLPNImageProcessor UpperCAmelCase_ = logging.get_logger(__name__) class __UpperCamelCase ( A__ ): def __init__( self , *_UpperCamelCase , **_UpperCamelCase ): ...
32
1
import logging from transformers import PretrainedConfig UpperCAmelCase_ = logging.getLogger(__name__) UpperCAmelCase_ = { "bertabs-finetuned-cnndm": "https://huggingface.co/remi/bertabs-finetuned-cnndm-extractive-abstractive-summarization/resolve/main/config.json", } class __U...
32
from typing import List, Optional, Union from ...processing_utils import ProcessorMixin from ...tokenization_utils_base import BatchEncoding, PaddingStrategy, PreTokenizedInput, TextInput, TruncationStrategy from ...utils import TensorType class __UpperCamelCase ( A__ ): __A : Dict ...
32
1
import unittest from transformers import BertGenerationConfig, 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 ModelTes...
32
from typing import TYPE_CHECKING from ...utils import OptionalDependencyNotAvailable, _LazyModule, is_tf_available, is_torch_available UpperCAmelCase_ = { "configuration_xlm": ["XLM_PRETRAINED_CONFIG_ARCHIVE_MAP", "XLMConfig", "XLMOnnxConfig"], "tokenization_xlm": ["XLMTokenizer"], } try: ...
32
1
from typing import List, Optional, Union from ...processing_utils import ProcessorMixin from ...tokenization_utils_base import BatchEncoding, PaddingStrategy, PreTokenizedInput, TextInput, TruncationStrategy from ...utils import TensorType class __UpperCamelCase ( A__ ): __A : Dict ...
32
from ...configuration_utils import PretrainedConfig from ...utils import logging UpperCAmelCase_ = logging.get_logger(__name__) UpperCAmelCase_ = { "microsoft/biogpt": "https://huggingface.co/microsoft/biogpt/resolve/main/config.json", # See all BioGPT models at https://huggingface....
32
1
from typing import TYPE_CHECKING from ...utils import OptionalDependencyNotAvailable, _LazyModule, is_torch_available UpperCAmelCase_ = { "configuration_instructblip": [ "INSTRUCTBLIP_PRETRAINED_CONFIG_ARCHIVE_MAP", "InstructBlipConfig", "InstructBlipQFormerConfig", ...
32
from typing import List from .keymap import KEYMAP, get_character def A__ ( SCREAMING_SNAKE_CASE_ : str ) -> List[str]: """simple docstring""" def decorator(SCREAMING_SNAKE_CASE_ : List[Any] ): _UpperCAmelCase = getattr(SCREAMING_SNAKE_...
32
1
def A__ ( SCREAMING_SNAKE_CASE_ : str , SCREAMING_SNAKE_CASE_ : int ) -> list[str]: """simple docstring""" return [sentence[i : i + ngram_size] for i in range(len(SCREAMING_SNAKE_CASE_ ) - ngram_size + 1 )] if __name__ == "__main__": from doc...
32
import unittest from transformers import LiltConfig, 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, ...
32
1
import unittest from transformers import AutoTokenizer, is_flax_available from transformers.testing_utils import require_flax, require_sentencepiece, require_tokenizers, slow if is_flax_available(): import jax.numpy as jnp from transformers import FlaxXLMRobertaModel @require_sentencepiece @require_...
32
from ...configuration_utils import PretrainedConfig from ...utils import logging UpperCAmelCase_ = logging.get_logger(__name__) UpperCAmelCase_ = { "RWKV/rwkv-4-169m-pile": "https://huggingface.co/RWKV/rwkv-4-169m-pile/resolve/main/config.json", "RWKV/rwkv-4-430m-pile": "https://hug...
32
1
from argparse import ArgumentParser, Namespace from ..utils import logging from . import BaseTransformersCLICommand def A__ ( SCREAMING_SNAKE_CASE_ : Namespace ) -> Optional[int]: """simple docstring""" return ConvertCommand( args.model_type , args.tf_chec...
32
def A__ ( SCREAMING_SNAKE_CASE_ : int , SCREAMING_SNAKE_CASE_ : int ) -> str: """simple docstring""" if a < 0 or b < 0: raise ValueError('''the value of both inputs must be positive''' ) _UpperCAmelCase = str(bin(SCREAMING_SNAKE_C...
32
1
import gc import unittest import numpy as np import torch from diffusers import DanceDiffusionPipeline, IPNDMScheduler, UNetaDModel from diffusers.utils import slow, torch_device from diffusers.utils.testing_utils import enable_full_determinism, require_torch_gpu, skip_mps from ..pipeline_params import UNCONDI...
32
from ...configuration_utils import PretrainedConfig from ...utils import logging UpperCAmelCase_ = logging.get_logger(__name__) UpperCAmelCase_ = { "tiiuae/falcon-40b": "https://huggingface.co/tiiuae/falcon-40b/resolve/main/config.json", "tiiuae/falcon-7b": "https://huggingface.co/t...
32
1
from __future__ import annotations def A__ ( SCREAMING_SNAKE_CASE_ : list[int] ) -> int: """simple docstring""" if not nums: return 0 _UpperCAmelCase = nums[0] _UpperCAmelCase = 0 for num in nums[1:]: _UpperCAmelCase ...
32
from math import sqrt def A__ ( SCREAMING_SNAKE_CASE_ : int ) -> bool: """simple docstring""" if 1 < number < 4: # 2 and 3 are primes return True elif number < 2 or number % 2 == 0 or number % 3 == 0: # Negatives, 0, 1, all even numbers, all mult...
32
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...
32
def A__ ( SCREAMING_SNAKE_CASE_ : int ) -> bool: """simple docstring""" if not isinstance(SCREAMING_SNAKE_CASE_ , SCREAMING_SNAKE_CASE_ ): _UpperCAmelCase = F'''Input value of [number={number}] must be an integer''' raise TypeError(SCR...
32
1
import copy from typing import Dict, Optional from ...configuration_utils import PretrainedConfig from ...utils import logging from ..auto import CONFIG_MAPPING from ..detr import DetrConfig from ..swin import SwinConfig UpperCAmelCase_ = { "facebook/maskformer-swin-base-ade": ( "https://...
32
from dataclasses import dataclass, field from typing import ClassVar, Dict from ..features import Features, Value from .base import TaskTemplate @dataclass(frozen=A__ ) class __UpperCamelCase ( A__ ): __A : str = field(default="""language-modeling""" , metadata={"""include_i...
32
1
from typing import TYPE_CHECKING from ...utils import OptionalDependencyNotAvailable, _LazyModule, is_tf_available, is_torch_available UpperCAmelCase_ = { "configuration_ctrl": ["CTRL_PRETRAINED_CONFIG_ARCHIVE_MAP", "CTRLConfig"], "tokenization_ctrl": ["CTRLTokenizer"], } try: if not is_t...
32
import os import re import warnings from shutil import copyfile from typing import TYPE_CHECKING, Any, Dict, List, Optional, Tuple import sentencepiece as spm from ...tokenization_utils import PreTrainedTokenizer if TYPE_CHECKING: from ...tokenization_utils_base import TextInput from ...utils import loggin...
32
1
from . import __version__ # Backward compatibility imports, to make sure all those objects can be found in file_utils from .utils import ( CLOUDFRONT_DISTRIB_PREFIX, CONFIG_NAME, DISABLE_TELEMETRY, DUMMY_INPUTS, DUMMY_MASK, ENV_VARS_TRUE_AND_AUTO_VALUES, ENV_VARS_TRUE_VALUES, FEAT...
32
from __future__ import annotations def A__ ( SCREAMING_SNAKE_CASE_ : int ) -> bool: """simple docstring""" _UpperCAmelCase = str(SCREAMING_SNAKE_CASE_ ) return len(SCREAMING_SNAKE_CASE_ ) == 9 and set(SCREAMING_SNAKE_CASE_ ) == set('''12...
32
1
import logging import os import sys from dataclasses import dataclass, field from importlib import import_module from typing import Dict, List, Optional, Tuple import numpy as np from seqeval.metrics import accuracy_score, fa_score, precision_score, recall_score from torch import nn from utils_ner import Split, ...
32
import numpy as np def A__ ( SCREAMING_SNAKE_CASE_ : np.ndarray , SCREAMING_SNAKE_CASE_ : float ) -> np.ndarray: """simple docstring""" return np.where(vector > 0 , SCREAMING_SNAKE_CASE_ , (alpha * (np.exp(SCREAMING_SNAKE_CASE_ ) - 1)) ) i...
32
1
from dataclasses import dataclass, field from typing import ClassVar, Dict from ..features import Features, Value from .base import TaskTemplate @dataclass(frozen=A__ ) class __UpperCamelCase ( A__ ): __A : str = field(default="""language-modeling""" , metadata={"""include_i...
32
UpperCAmelCase_ = { "A": ".-", "B": "-...", "C": "-.-.", "D": "-..", "E": ".", "F": "..-.", "G": "--.", "H": "....", "I": "..", "J": ".---", "K": "-.-", "L": ".-..", "M": "--", "N": "-.", "O": "---", "P": ".--.", "Q": "--.-", "R": ".-.", "S": "...", "T": "-", "U": "..-", "V": "...-", "W"...
32
1
import time from dataclasses import dataclass from multiprocessing import Pool from unittest import TestCase from unittest.mock import patch import multiprocess import numpy as np import pytest from datasets.utils.py_utils import ( NestedDataStructure, asdict, iflatmap_unordered, map_nested, ...
32
import gc import unittest import numpy as np import torch from diffusers import DanceDiffusionPipeline, IPNDMScheduler, UNetaDModel from diffusers.utils import slow, torch_device from diffusers.utils.testing_utils import enable_full_determinism, require_torch_gpu, skip_mps from ..pipeline_params import UNCONDI...
32
1
import os import shutil import tempfile import unittest import numpy as np from transformers import AutoTokenizer, BarkProcessor from transformers.testing_utils import require_torch, slow @require_torch class __UpperCamelCase ( unittest.TestCase ): def UpperCamelCase( self ...
32
from collections import OrderedDict from ...utils import logging from .auto_factory import _BaseAutoModelClass, _LazyAutoMapping, auto_class_update from .configuration_auto import CONFIG_MAPPING_NAMES UpperCAmelCase_ = logging.get_logger(__name__) UpperCAmelCase_ = OrderedDict( [ ...
32
1
import unittest import torch from torch import nn from diffusers.models.activations import get_activation class __UpperCamelCase ( unittest.TestCase ): def UpperCamelCase( self ): _UpperCAmelCase = get_activation('''swish''' ) self.assertIs...
32
import baseaa def A__ ( SCREAMING_SNAKE_CASE_ : str ) -> bytes: """simple docstring""" return baseaa.baaencode(string.encode('''utf-8''' ) ) def A__ ( SCREAMING_SNAKE_CASE_ : bytes ) -> str: """simple docstring""" ...
32
1
import numpy as np import datasets UpperCAmelCase_ = "\nCompute the Mahalanobis Distance\n\nMahalonobis distance is the distance between a point and a distribution.\nAnd not between two distinct points. It is effectively a multivariate equivalent of the Euclidean distance.\nIt was introduced by Prof....
32
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_format, ) ...
32
1
import copy from typing import Any, Dict, List, Optional, Union import numpy as np from ...audio_utils import mel_filter_bank, spectrogram, window_function from ...feature_extraction_sequence_utils import SequenceFeatureExtractor from ...feature_extraction_utils import BatchFeature from ...utils import TensorTy...
32
from ..utils import DummyObject, requires_backends class __UpperCamelCase ( metaclass=A__ ): __A : str = ["""torch""", """scipy"""] def __init__( self , *_UpperCamelCase , **_UpperCamelCase ): requires_backends(self , ['''torc...
32
1
from ...configuration_utils import PretrainedConfig from ...utils import logging UpperCAmelCase_ = logging.get_logger(__name__) UpperCAmelCase_ = { "funnel-transformer/small": "https://huggingface.co/funnel-transformer/small/resolve/main/config.json", "funnel-transformer/small-base"...
32
def A__ ( SCREAMING_SNAKE_CASE_ : int = 2_00_00_00 ) -> int: """simple docstring""" _UpperCAmelCase = [0 for i in range(n + 1 )] _UpperCAmelCase = 1 _UpperCAmelCase = 1 for i in range(2 , int(n**0.5 ) + 1 ...
32
1
from math import isqrt def A__ ( SCREAMING_SNAKE_CASE_ : int ) -> list[int]: """simple docstring""" _UpperCAmelCase = [True] * max_number for i in range(2 , isqrt(max_number - 1 ) + 1 ): if is_prime[i]: for j in range(i**2 ...
32
import warnings from ...utils import logging from .image_processing_glpn import GLPNImageProcessor UpperCAmelCase_ = logging.get_logger(__name__) class __UpperCamelCase ( A__ ): def __init__( self , *_UpperCamelCase , **_UpperCamelCase ): ...
32
1
from typing import Optional import torch import torch.utils.checkpoint from torch import Tensor, nn from torch.nn import BCEWithLogitsLoss, CrossEntropyLoss, MSELoss from ...activations import ACTaFN from ...file_utils import add_code_sample_docstrings, add_start_docstrings, add_start_docstrings_to_model_forwar...
32
from typing import List, Optional, Union from ...processing_utils import ProcessorMixin from ...tokenization_utils_base import BatchEncoding, PaddingStrategy, PreTokenizedInput, TextInput, TruncationStrategy from ...utils import TensorType class __UpperCamelCase ( A__ ): __A : Dict ...
32
1
import importlib import json import os from collections import OrderedDict from typing import Dict, Optional, Union # Build the list of all feature extractors from ...configuration_utils import PretrainedConfig from ...dynamic_module_utils import get_class_from_dynamic_module, resolve_trust_remote_code from ...f...
32
from typing import TYPE_CHECKING from ...utils import OptionalDependencyNotAvailable, _LazyModule, is_tf_available, is_torch_available UpperCAmelCase_ = { "configuration_xlm": ["XLM_PRETRAINED_CONFIG_ARCHIVE_MAP", "XLMConfig", "XLMOnnxConfig"], "tokenization_xlm": ["XLMTokenizer"], } try: ...
32
1
from __future__ import annotations def A__ ( SCREAMING_SNAKE_CASE_ : list , SCREAMING_SNAKE_CASE_ : int , SCREAMING_SNAKE_CASE_ : int , SCREAMING_SNAKE_CASE_ : int ) -> list: """simple docstring""" _UpperCAmelCase = [] _Up...
32
from ...configuration_utils import PretrainedConfig from ...utils import logging UpperCAmelCase_ = logging.get_logger(__name__) UpperCAmelCase_ = { "microsoft/biogpt": "https://huggingface.co/microsoft/biogpt/resolve/main/config.json", # See all BioGPT models at https://huggingface....
32
1
import unittest from transformers.testing_utils import require_bsa from transformers.utils import is_bsa_available from ...test_feature_extraction_common import FeatureExtractionSavingTestMixin if is_bsa_available(): from transformers import MarkupLMFeatureExtractor class __UpperCamelCase ( ...
32
from typing import List from .keymap import KEYMAP, get_character def A__ ( SCREAMING_SNAKE_CASE_ : str ) -> List[str]: """simple docstring""" def decorator(SCREAMING_SNAKE_CASE_ : List[Any] ): _UpperCAmelCase = getattr(SCREAMING_SNAKE_...
32
1
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 A__ ( SCREAMING_SNAKE_CASE_ : Dict , SCREAMING_SNAKE_CASE_ : ...
32
import unittest from transformers import LiltConfig, 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, ...
32
1
import argparse import requests import torch # pip3 install salesforce-lavis # I'm actually installing a slightly modified version: pip3 install git+https://github.com/nielsrogge/LAVIS.git@fix_lavis_float32 (there's also the fix_lavis branch) # also note: to convert Vicuna checkpoints, we had to include /home/n...
32
from ...configuration_utils import PretrainedConfig from ...utils import logging UpperCAmelCase_ = logging.get_logger(__name__) UpperCAmelCase_ = { "RWKV/rwkv-4-169m-pile": "https://huggingface.co/RWKV/rwkv-4-169m-pile/resolve/main/config.json", "RWKV/rwkv-4-430m-pile": "https://hug...
32
1
from typing import List, Optional, Tuple, Union import torch from ...models import UNetaDModel from ...schedulers import ScoreSdeVeScheduler from ...utils import randn_tensor from ..pipeline_utils import DiffusionPipeline, ImagePipelineOutput class __UpperCamelCase ( A__ ): __A : UNetaD...
32
def A__ ( SCREAMING_SNAKE_CASE_ : int , SCREAMING_SNAKE_CASE_ : int ) -> str: """simple docstring""" if a < 0 or b < 0: raise ValueError('''the value of both inputs must be positive''' ) _UpperCAmelCase = str(bin(SCREAMING_SNAKE_C...
32
1
UpperCAmelCase_ = "\n# Transformers installation\n! pip install transformers datasets\n# To install from source instead of the last release, comment the command above and uncomment the following one.\n# ! pip install git+https://github.com/huggingface/transformers.git\n" UpperCAmelCase_ = [{"...
32
from ...configuration_utils import PretrainedConfig from ...utils import logging UpperCAmelCase_ = logging.get_logger(__name__) UpperCAmelCase_ = { "tiiuae/falcon-40b": "https://huggingface.co/tiiuae/falcon-40b/resolve/main/config.json", "tiiuae/falcon-7b": "https://huggingface.co/t...
32
1
from __future__ import annotations def A__ ( SCREAMING_SNAKE_CASE_ : list[int] , SCREAMING_SNAKE_CASE_ : int ) -> list[int]: """simple docstring""" _UpperCAmelCase = 0 _UpperCAmelCase = len(SCREAMING_SNAKE_CASE_ ) - 1 whi...
32
from math import sqrt def A__ ( SCREAMING_SNAKE_CASE_ : int ) -> bool: """simple docstring""" if 1 < number < 4: # 2 and 3 are primes return True elif number < 2 or number % 2 == 0 or number % 3 == 0: # Negatives, 0, 1, all even numbers, all mult...
32
1
from collections import OrderedDict from ...utils import logging from .auto_factory import _BaseAutoModelClass, _LazyAutoMapping, auto_class_update from .configuration_auto import CONFIG_MAPPING_NAMES UpperCAmelCase_ = logging.get_logger(__name__) UpperCAmelCase_ = OrderedDict( [ ...
32
def A__ ( SCREAMING_SNAKE_CASE_ : int ) -> bool: """simple docstring""" if not isinstance(SCREAMING_SNAKE_CASE_ , SCREAMING_SNAKE_CASE_ ): _UpperCAmelCase = F'''Input value of [number={number}] must be an integer''' raise TypeError(SCR...
32
1
import numpy as np def A__ ( SCREAMING_SNAKE_CASE_ : np.ndarray , SCREAMING_SNAKE_CASE_ : float ) -> np.ndarray: """simple docstring""" return np.where(vector > 0 , SCREAMING_SNAKE_CASE_ , (alpha * (np.exp(SCREAMING_SNAKE_CASE_ ) - 1)) ) i...
32
from dataclasses import dataclass, field from typing import ClassVar, Dict from ..features import Features, Value from .base import TaskTemplate @dataclass(frozen=A__ ) class __UpperCamelCase ( A__ ): __A : str = field(default="""language-modeling""" , metadata={"""include_i...
32
1
import argparse from transformers import TaConfig, TaForConditionalGeneration, load_tf_weights_in_ta from transformers.utils import logging logging.set_verbosity_info() def A__ ( SCREAMING_SNAKE_CASE_ : Optional[Any] , SCREAMING_SNAKE_CASE_ : List[str] , SCREAMING_SNAKE_CASE_ ...
32
import os import re import warnings from shutil import copyfile from typing import TYPE_CHECKING, Any, Dict, List, Optional, Tuple import sentencepiece as spm from ...tokenization_utils import PreTrainedTokenizer if TYPE_CHECKING: from ...tokenization_utils_base import TextInput from ...utils import loggin...
32
1
import argparse import shlex import runhouse as rh if __name__ == "__main__": # Refer to https://runhouse-docs.readthedocs-hosted.com/en/latest/api/python/cluster.html#hardware-setup for cloud access # setup instructions, if using on-demand hardware # If user passes --user <user> --host <host> --key_...
32
from __future__ import annotations def A__ ( SCREAMING_SNAKE_CASE_ : int ) -> bool: """simple docstring""" _UpperCAmelCase = str(SCREAMING_SNAKE_CASE_ ) return len(SCREAMING_SNAKE_CASE_ ) == 9 and set(SCREAMING_SNAKE_CASE_ ) == set('''12...
32
1
class __UpperCamelCase : def __init__( self , _UpperCamelCase , _UpperCamelCase , _UpperCamelCase ): _UpperCAmelCase = None _UpperCAmelCase = None _UpperCAmelCase = graph self._normalize_graph(_...
32
import numpy as np def A__ ( SCREAMING_SNAKE_CASE_ : np.ndarray , SCREAMING_SNAKE_CASE_ : float ) -> np.ndarray: """simple docstring""" return np.where(vector > 0 , SCREAMING_SNAKE_CASE_ , (alpha * (np.exp(SCREAMING_SNAKE_CASE_ ) - 1)) ) i...
32
1
import copy import os import cva import numpy as np from matplotlib import pyplot as plt class __UpperCamelCase : def __init__( self ): _UpperCAmelCase = '''''' _UpperCAmelCase = '''''' _UpperCAmelCase = [] _UpperCAme...
32
UpperCAmelCase_ = { "A": ".-", "B": "-...", "C": "-.-.", "D": "-..", "E": ".", "F": "..-.", "G": "--.", "H": "....", "I": "..", "J": ".---", "K": "-.-", "L": ".-..", "M": "--", "N": "-.", "O": "---", "P": ".--.", "Q": "--.-", "R": ".-.", "S": "...", "T": "-", "U": "..-", "V": "...-", "W"...
32
1
import argparse from pathlib import Path import torch from packaging import version from torch.onnx import export from diffusers import AutoencoderKL UpperCAmelCase_ = version.parse(version.parse(torch.__version__).base_version) < version.parse("1.11") def A__ ( SCREAMING_SNAKE_CASE_ ...
32
import gc import unittest import numpy as np import torch from diffusers import DanceDiffusionPipeline, IPNDMScheduler, UNetaDModel from diffusers.utils import slow, torch_device from diffusers.utils.testing_utils import enable_full_determinism, require_torch_gpu, skip_mps from ..pipeline_params import UNCONDI...
32
1
import logging import os from typing import List, Tuple import numpy as np import psutil import torch import torch.distributed as dist from transformers import RagRetriever UpperCAmelCase_ = logging.getLogger(__name__) class __UpperCamelCase ( A__ ): def __init__( se...
32
from collections import OrderedDict from ...utils import logging from .auto_factory import _BaseAutoModelClass, _LazyAutoMapping, auto_class_update from .configuration_auto import CONFIG_MAPPING_NAMES UpperCAmelCase_ = logging.get_logger(__name__) UpperCAmelCase_ = OrderedDict( [ ...
32
1
import warnings from ...utils import logging from .image_processing_glpn import GLPNImageProcessor UpperCAmelCase_ = logging.get_logger(__name__) class __UpperCamelCase ( A__ ): def __init__( self , *_UpperCamelCase , **_UpperCamelCase ): ...
32
import baseaa def A__ ( SCREAMING_SNAKE_CASE_ : str ) -> bytes: """simple docstring""" return baseaa.baaencode(string.encode('''utf-8''' ) ) def A__ ( SCREAMING_SNAKE_CASE_ : bytes ) -> str: """simple docstring""" ...
32
1
from typing import TYPE_CHECKING from ...utils import OptionalDependencyNotAvailable, _LazyModule, is_tokenizers_available, is_torch_available UpperCAmelCase_ = { "configuration_altclip": [ "ALTCLIP_PRETRAINED_CONFIG_ARCHIVE_MAP", "AltCLIPConfig", "AltCLIPTextConfig", ...
32
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_format, ) ...
32
1
UpperCAmelCase_ = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/" def A__ ( SCREAMING_SNAKE_CASE_ : bytes ) -> bytes: """simple docstring""" if not isinstance(SCREAMING_SNAKE_CASE_ , SCREAMING_SNAKE_CASE_ ): _UpperCAmelCase ...
32
from ..utils import DummyObject, requires_backends class __UpperCamelCase ( metaclass=A__ ): __A : str = ["""torch""", """scipy"""] def __init__( self , *_UpperCamelCase , **_UpperCamelCase ): requires_backends(self , ['''torc...
32
1
import unittest from transformers import is_torch_available from transformers.testing_utils import require_torch if is_torch_available(): import torch from transformers.generation import DisjunctiveConstraint @require_torch class __UpperCamelCase ( unittest.TestCase ): def ...
32
def A__ ( SCREAMING_SNAKE_CASE_ : int = 2_00_00_00 ) -> int: """simple docstring""" _UpperCAmelCase = [0 for i in range(n + 1 )] _UpperCAmelCase = 1 _UpperCAmelCase = 1 for i in range(2 , int(n**0.5 ) + 1 ...
32
1
from typing import TYPE_CHECKING from ....utils import _LazyModule UpperCAmelCase_ = {"tokenization_tapex": ["TapexTokenizer"]} if TYPE_CHECKING: from .tokenization_tapex import TapexTokenizer else: import sys UpperCAmelCase_ = _LazyModule(__name__, globals()["__file__"], _imp...
32
import warnings from ...utils import logging from .image_processing_glpn import GLPNImageProcessor UpperCAmelCase_ = logging.get_logger(__name__) class __UpperCamelCase ( A__ ): def __init__( self , *_UpperCamelCase , **_UpperCamelCase ): ...
32
1
from __future__ import annotations import math import random from collections.abc import Collection from typing import overload class __UpperCamelCase : def __init__( self , _UpperCamelCase = None ): if components is None: _UpperCAmelCase = [] ...
32
from typing import List, Optional, Union from ...processing_utils import ProcessorMixin from ...tokenization_utils_base import BatchEncoding, PaddingStrategy, PreTokenizedInput, TextInput, TruncationStrategy from ...utils import TensorType class __UpperCamelCase ( A__ ): __A : Dict ...
32
1
import shutil import tempfile import unittest import numpy as np import pytest from transformers.testing_utils import require_vision from transformers.utils import is_vision_available if is_vision_available(): from PIL import Image from transformers import AutoProcessor, BertTokenizer, BlipImageProcess...
32
from typing import TYPE_CHECKING from ...utils import OptionalDependencyNotAvailable, _LazyModule, is_tf_available, is_torch_available UpperCAmelCase_ = { "configuration_xlm": ["XLM_PRETRAINED_CONFIG_ARCHIVE_MAP", "XLMConfig", "XLMOnnxConfig"], "tokenization_xlm": ["XLMTokenizer"], } try: ...
32
1
import shutil import tempfile import unittest from transformers import SPIECE_UNDERLINE, BatchEncoding, MBartaaTokenizer, MBartaaTokenizerFast, is_torch_available from transformers.testing_utils import ( get_tests_dir, nested_simplify, require_sentencepiece, require_tokenizers, require_torch,...
32
from ...configuration_utils import PretrainedConfig from ...utils import logging UpperCAmelCase_ = logging.get_logger(__name__) UpperCAmelCase_ = { "microsoft/biogpt": "https://huggingface.co/microsoft/biogpt/resolve/main/config.json", # See all BioGPT models at https://huggingface....
32
1
import sys from collections import defaultdict class __UpperCamelCase : def __init__( self ): _UpperCAmelCase = [] def UpperCamelCase( self , _UpperCamelCase ): return self.node_position[vertex] def UpperCamelCase( ...
32
from typing import List from .keymap import KEYMAP, get_character def A__ ( SCREAMING_SNAKE_CASE_ : str ) -> List[str]: """simple docstring""" def decorator(SCREAMING_SNAKE_CASE_ : List[Any] ): _UpperCAmelCase = getattr(SCREAMING_SNAKE_...
32
1
from __future__ import annotations def A__ ( SCREAMING_SNAKE_CASE_ : float , SCREAMING_SNAKE_CASE_ : float , SCREAMING_SNAKE_CASE_ : float ) -> float: """simple docstring""" if days_between_payments <= 0: raise ValueError('''days_between_pay...
32
import unittest from transformers import LiltConfig, 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, ...
32
1
UpperCAmelCase_ = {"a": ["c", "b"], "b": ["d", "e"], "c": [], "d": [], "e": []} UpperCAmelCase_ = ["a", "b", "c", "d", "e"] def A__ ( SCREAMING_SNAKE_CASE_ : List[str] , SCREAMING_SNAKE_CASE_ : str , SCREAMING_SNAKE_CASE_ : str ) -> Any: ...
32
from ...configuration_utils import PretrainedConfig from ...utils import logging UpperCAmelCase_ = logging.get_logger(__name__) UpperCAmelCase_ = { "RWKV/rwkv-4-169m-pile": "https://huggingface.co/RWKV/rwkv-4-169m-pile/resolve/main/config.json", "RWKV/rwkv-4-430m-pile": "https://hug...
32
1
def A__ ( SCREAMING_SNAKE_CASE_ : str , SCREAMING_SNAKE_CASE_ : Tuple ) -> List[Any]: """simple docstring""" _UpperCAmelCase = [0 for i in range(r + 1 )] # nc0 = 1 _UpperCAmelCase = 1 for i in range(1 , n + 1 ):...
32
def A__ ( SCREAMING_SNAKE_CASE_ : int , SCREAMING_SNAKE_CASE_ : int ) -> str: """simple docstring""" if a < 0 or b < 0: raise ValueError('''the value of both inputs must be positive''' ) _UpperCAmelCase = str(bin(SCREAMING_SNAKE_C...
32
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 UpperCAmelCase_ = logging.get_logger(__name__) def A__ ( SCREAMING_SNAKE_CASE_ : int ) -> int: """simple docst...
32
from ...configuration_utils import PretrainedConfig from ...utils import logging UpperCAmelCase_ = logging.get_logger(__name__) UpperCAmelCase_ = { "tiiuae/falcon-40b": "https://huggingface.co/tiiuae/falcon-40b/resolve/main/config.json", "tiiuae/falcon-7b": "https://huggingface.co/t...
32
1
import argparse import torch from torch import nn from transformers import MaMaaaConfig, MaMaaaForConditionalGeneration def A__ ( SCREAMING_SNAKE_CASE_ : Dict ) -> Optional[int]: """simple docstring""" _UpperCAmelCase = [ '''encoder.version''', ...
32
from math import sqrt def A__ ( SCREAMING_SNAKE_CASE_ : int ) -> bool: """simple docstring""" if 1 < number < 4: # 2 and 3 are primes return True elif number < 2 or number % 2 == 0 or number % 3 == 0: # Negatives, 0, 1, all even numbers, all mult...
32
1
import functools import operator from ...configuration_utils import PretrainedConfig from ...utils import logging UpperCAmelCase_ = logging.get_logger(__name__) UpperCAmelCase_ = { "microsoft/wavlm-base": "https://huggingface.co/microsoft/wavlm-base/resolve/main/config.json", # See...
32
def A__ ( SCREAMING_SNAKE_CASE_ : int ) -> bool: """simple docstring""" if not isinstance(SCREAMING_SNAKE_CASE_ , SCREAMING_SNAKE_CASE_ ): _UpperCAmelCase = F'''Input value of [number={number}] must be an integer''' raise TypeError(SCR...
32
1
import re import string import numpy as np import datasets UpperCAmelCase_ = "\nReturns the rate at which the input predicted strings exactly match their references, ignoring any strings input as part of the regexes_to_ignore list.\n" UpperCAmelCase_ = "\nArgs:\n predictions: List of p...
32
from dataclasses import dataclass, field from typing import ClassVar, Dict from ..features import Features, Value from .base import TaskTemplate @dataclass(frozen=A__ ) class __UpperCamelCase ( A__ ): __A : str = field(default="""language-modeling""" , metadata={"""include_i...
32
1
import os from pathlib import Path from unittest.mock import patch import pytest import zstandard as zstd from datasets.download.download_config import DownloadConfig from datasets.utils.file_utils import ( OfflineModeIsEnabled, cached_path, fsspec_get, fsspec_head, ftp_get, ftp_head, ...
32
import os import re import warnings from shutil import copyfile from typing import TYPE_CHECKING, Any, Dict, List, Optional, Tuple import sentencepiece as spm from ...tokenization_utils import PreTrainedTokenizer if TYPE_CHECKING: from ...tokenization_utils_base import TextInput from ...utils import loggin...
32
1
from collections import defaultdict from pathlib import Path import pandas as pd from rouge_cli import calculate_rouge_path from utils import calculate_rouge UpperCAmelCase_ = [ "Prosecutor: \"No videos were used in the crash investigation\" German papers say they saw a cell phone video of the" ...
32
from __future__ import annotations def A__ ( SCREAMING_SNAKE_CASE_ : int ) -> bool: """simple docstring""" _UpperCAmelCase = str(SCREAMING_SNAKE_CASE_ ) return len(SCREAMING_SNAKE_CASE_ ) == 9 and set(SCREAMING_SNAKE_CASE_ ) == set('''12...
32
1
import argparse import json from typing import List from ltp import LTP from transformers.models.bert.tokenization_bert import BertTokenizer def A__ ( SCREAMING_SNAKE_CASE_ : Dict ) -> Any: """simple docstring""" if ( (cp >= 0x4_e00 and cp <= 0x9_fff) ...
32
import numpy as np def A__ ( SCREAMING_SNAKE_CASE_ : np.ndarray , SCREAMING_SNAKE_CASE_ : float ) -> np.ndarray: """simple docstring""" return np.where(vector > 0 , SCREAMING_SNAKE_CASE_ , (alpha * (np.exp(SCREAMING_SNAKE_CASE_ ) - 1)) ) i...
32
1
from manim import * class __UpperCamelCase ( A__ ): def UpperCamelCase( self ): _UpperCAmelCase = Rectangle(height=0.5 , width=0.5 ) _UpperCAmelCase = Rectangle(height=0.46 , width=0.46 ).set_stroke(width=0 ...
32
UpperCAmelCase_ = { "A": ".-", "B": "-...", "C": "-.-.", "D": "-..", "E": ".", "F": "..-.", "G": "--.", "H": "....", "I": "..", "J": ".---", "K": "-.-", "L": ".-..", "M": "--", "N": "-.", "O": "---", "P": ".--.", "Q": "--.-", "R": ".-.", "S": "...", "T": "-", "U": "..-", "V": "...-", "W"...
32
1
from __future__ import annotations from collections.abc import Iterable, Iterator from dataclasses import dataclass UpperCAmelCase_ = (3, 9, -11, 0, 7, 5, 1, -1) UpperCAmelCase_ = (4, 6, 2, 0, 8, 10, 3, -2) @dataclass class __UpperCamelCase : __A : int __A : Node | None...
32
import gc import unittest import numpy as np import torch from diffusers import DanceDiffusionPipeline, IPNDMScheduler, UNetaDModel from diffusers.utils import slow, torch_device from diffusers.utils.testing_utils import enable_full_determinism, require_torch_gpu, skip_mps from ..pipeline_params import UNCONDI...
32
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, to_channel_...
32
from collections import OrderedDict from ...utils import logging from .auto_factory import _BaseAutoModelClass, _LazyAutoMapping, auto_class_update from .configuration_auto import CONFIG_MAPPING_NAMES UpperCAmelCase_ = logging.get_logger(__name__) UpperCAmelCase_ = OrderedDict( [ ...
32
1
import re import tempfile from pathlib import Path import pytest import yaml from datasets.utils.readme import ReadMe # @pytest.fixture # def example_yaml_structure(): UpperCAmelCase_ = yaml.safe_load( "\\nname: \"\"\nallow_empty: false\nallow_empty_text: true\nsubsections:\n - name: \"Dataset...
32
import baseaa def A__ ( SCREAMING_SNAKE_CASE_ : str ) -> bytes: """simple docstring""" return baseaa.baaencode(string.encode('''utf-8''' ) ) def A__ ( SCREAMING_SNAKE_CASE_ : bytes ) -> str: """simple docstring""" ...
32
1
def A__ ( SCREAMING_SNAKE_CASE_ : float , SCREAMING_SNAKE_CASE_ : int ) -> float: """simple docstring""" if digit_amount > 0: return round(number - int(SCREAMING_SNAKE_CASE_ ) , SCREAMING_SNAKE_CASE_ ) return number - int(SCREAMING_SNA...
32
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_format, ) ...
32
1
import argparse import torch from safetensors.torch import load_file from diffusers import StableDiffusionPipeline def A__ ( SCREAMING_SNAKE_CASE_ : Optional[int] , SCREAMING_SNAKE_CASE_ : Any , SCREAMING_SNAKE_CASE_ : List[Any] , SCREAMING_SNAKE_CASE_ : Union[...
32
from ..utils import DummyObject, requires_backends class __UpperCamelCase ( metaclass=A__ ): __A : str = ["""torch""", """scipy"""] def __init__( self , *_UpperCamelCase , **_UpperCamelCase ): requires_backends(self , ['''torc...
32
1
from datetime import datetime import matplotlib.pyplot as plt import torch def A__ ( SCREAMING_SNAKE_CASE_ : Any ) -> List[Any]: """simple docstring""" for param in module.parameters(): _UpperCAmelCase = False def A__ ( ) -> Tuple: ...
32
def A__ ( SCREAMING_SNAKE_CASE_ : int = 2_00_00_00 ) -> int: """simple docstring""" _UpperCAmelCase = [0 for i in range(n + 1 )] _UpperCAmelCase = 1 _UpperCAmelCase = 1 for i in range(2 , int(n**0.5 ) + 1 ...
32
1
from typing import List, Optional, Tuple from ...tokenization_utils_fast import PreTrainedTokenizerFast from ...utils import logging from .tokenization_herbert import HerbertTokenizer UpperCAmelCase_ = logging.get_logger(__name__) UpperCAmelCase_ = {"vocab_file": "vocab.json", "merges_file...
32
import warnings from ...utils import logging from .image_processing_glpn import GLPNImageProcessor UpperCAmelCase_ = logging.get_logger(__name__) class __UpperCamelCase ( A__ ): def __init__( self , *_UpperCamelCase , **_UpperCamelCase ): ...
32
1
import copy import inspect import unittest import numpy as np from huggingface_hub import hf_hub_download from transformers import TimesformerConfig from transformers.models.auto import get_values from transformers.testing_utils import require_torch, require_vision, slow, torch_device from transformers.utils im...
32
from typing import List, Optional, Union from ...processing_utils import ProcessorMixin from ...tokenization_utils_base import BatchEncoding, PaddingStrategy, PreTokenizedInput, TextInput, TruncationStrategy from ...utils import TensorType class __UpperCamelCase ( A__ ): __A : Dict ...
32
1
from typing import TYPE_CHECKING from ...utils import OptionalDependencyNotAvailable, _LazyModule, is_torch_available, is_vision_available UpperCAmelCase_ = { "configuration_chinese_clip": [ "CHINESE_CLIP_PRETRAINED_CONFIG_ARCHIVE_MAP", "ChineseCLIPConfig", "ChineseCLIPOnn...
32
from typing import TYPE_CHECKING from ...utils import OptionalDependencyNotAvailable, _LazyModule, is_tf_available, is_torch_available UpperCAmelCase_ = { "configuration_xlm": ["XLM_PRETRAINED_CONFIG_ARCHIVE_MAP", "XLMConfig", "XLMOnnxConfig"], "tokenization_xlm": ["XLMTokenizer"], } try: ...
32
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, get_resize_output_image_size, normalize, rescale, resize, to_channel_dimension_format, ) ...
32
from ...configuration_utils import PretrainedConfig from ...utils import logging UpperCAmelCase_ = logging.get_logger(__name__) UpperCAmelCase_ = { "microsoft/biogpt": "https://huggingface.co/microsoft/biogpt/resolve/main/config.json", # See all BioGPT models at https://huggingface....
32
1
from ...configuration_utils import PretrainedConfig from ...utils import logging UpperCAmelCase_ = logging.get_logger(__name__) UpperCAmelCase_ = { "weiweishi/roc-bert-base-zh": "https://huggingface.co/weiweishi/roc-bert-base-zh/resolve/main/config.json", } class __UpperCamelCase...
32
from typing import List from .keymap import KEYMAP, get_character def A__ ( SCREAMING_SNAKE_CASE_ : str ) -> List[str]: """simple docstring""" def decorator(SCREAMING_SNAKE_CASE_ : List[Any] ): _UpperCAmelCase = getattr(SCREAMING_SNAKE_...
32
1
def A__ ( SCREAMING_SNAKE_CASE_ : int = 2_00_00_00 ) -> int: """simple docstring""" _UpperCAmelCase = [0 for i in range(n + 1 )] _UpperCAmelCase = 1 _UpperCAmelCase = 1 for i in range(2 , int(n**0.5 ) + 1 ...
32
import unittest from transformers import LiltConfig, 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, ...
32
1
import os import tempfile import unittest from transformers.models.marian.convert_marian_tatoeba_to_pytorch import DEFAULT_REPO, TatoebaConverter from transformers.testing_utils import slow from transformers.utils import cached_property @unittest.skipUnless(os.path.exists(A__ ) , """Tatoeba directory does...
32
from ...configuration_utils import PretrainedConfig from ...utils import logging UpperCAmelCase_ = logging.get_logger(__name__) UpperCAmelCase_ = { "RWKV/rwkv-4-169m-pile": "https://huggingface.co/RWKV/rwkv-4-169m-pile/resolve/main/config.json", "RWKV/rwkv-4-430m-pile": "https://hug...
32
1
import bza import gzip import lzma import os import shutil import struct import tarfile import warnings import zipfile from abc import ABC, abstractmethod from pathlib import Path from typing import Dict, List, Optional, Type, Union from .. import config from .filelock import FileLock from .logging import get_lo...
32
def A__ ( SCREAMING_SNAKE_CASE_ : int , SCREAMING_SNAKE_CASE_ : int ) -> str: """simple docstring""" if a < 0 or b < 0: raise ValueError('''the value of both inputs must be positive''' ) _UpperCAmelCase = str(bin(SCREAMING_SNAKE_C...
32
1
import sys UpperCAmelCase_ = ( "73167176531330624919225119674426574742355349194934" "96983520312774506326239578318016984801869478851843" "85861560789112949495459501737958331952853208805511" "12540698747158523863050715693290963295227443043557" "668966489504452445231617318564030987111...
32
from ...configuration_utils import PretrainedConfig from ...utils import logging UpperCAmelCase_ = logging.get_logger(__name__) UpperCAmelCase_ = { "tiiuae/falcon-40b": "https://huggingface.co/tiiuae/falcon-40b/resolve/main/config.json", "tiiuae/falcon-7b": "https://huggingface.co/t...
32
1
def A__ ( SCREAMING_SNAKE_CASE_ : Union[str, Any] ) -> Optional[Any]: """simple docstring""" if not head: return True # split the list to two parts _UpperCAmelCase , _UpperCAmelCase = head.next, head while fast and fast.next: ...
32
from math import sqrt def A__ ( SCREAMING_SNAKE_CASE_ : int ) -> bool: """simple docstring""" if 1 < number < 4: # 2 and 3 are primes return True elif number < 2 or number % 2 == 0 or number % 3 == 0: # Negatives, 0, 1, all even numbers, all mult...
32
1
print((lambda quine: quine % quine)("print((lambda quine: quine %% quine)(%r))"))
32
def A__ ( SCREAMING_SNAKE_CASE_ : int ) -> bool: """simple docstring""" if not isinstance(SCREAMING_SNAKE_CASE_ , SCREAMING_SNAKE_CASE_ ): _UpperCAmelCase = F'''Input value of [number={number}] must be an integer''' raise TypeError(SCR...
32
1
import numpy as np import pandas as pd from sklearn.preprocessing import Normalizer from sklearn.svm import SVR from statsmodels.tsa.statespace.sarimax import SARIMAX def A__ ( SCREAMING_SNAKE_CASE_ : list , SCREAMING_SNAKE_CASE_ : list , SCREAMING_SNAKE_CASE_ : list , ...
32
from dataclasses import dataclass, field from typing import ClassVar, Dict from ..features import Features, Value from .base import TaskTemplate @dataclass(frozen=A__ ) class __UpperCamelCase ( A__ ): __A : str = field(default="""language-modeling""" , metadata={"""include_i...
32
1
import os import random import sys from . import cryptomath_module as cryptoMath # noqa: N812 from . import rabin_miller as rabinMiller # noqa: N812 def A__ ( ) -> None: """simple docstring""" print('''Making key files...''' ) make_key_files('''rsa''' , 10_24 ...
32
import os import re import warnings from shutil import copyfile from typing import TYPE_CHECKING, Any, Dict, List, Optional, Tuple import sentencepiece as spm from ...tokenization_utils import PreTrainedTokenizer if TYPE_CHECKING: from ...tokenization_utils_base import TextInput from ...utils import loggin...
32
1
import flax.linen as nn import jax import jax.numpy as jnp class __UpperCamelCase ( nn.Module ): __A : int __A : jnp.dtype = jnp.floataa def UpperCamelCase( self ): _UpperCAmelCase = nn.Conv( self.out_channels , ...
32
from __future__ import annotations def A__ ( SCREAMING_SNAKE_CASE_ : int ) -> bool: """simple docstring""" _UpperCAmelCase = str(SCREAMING_SNAKE_CASE_ ) return len(SCREAMING_SNAKE_CASE_ ) == 9 and set(SCREAMING_SNAKE_CASE_ ) == set('''12...
32
1
def A__ ( SCREAMING_SNAKE_CASE_ : int = 10_00 ) -> int: """simple docstring""" _UpperCAmelCase = 3 _UpperCAmelCase = 0 while a < n: if a % 3 == 0 or a % 5 == 0: result += a elif a % 15 == 0: result -= a ...
32
import numpy as np def A__ ( SCREAMING_SNAKE_CASE_ : np.ndarray , SCREAMING_SNAKE_CASE_ : float ) -> np.ndarray: """simple docstring""" return np.where(vector > 0 , SCREAMING_SNAKE_CASE_ , (alpha * (np.exp(SCREAMING_SNAKE_CASE_ ) - 1)) ) i...
32
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, ImageClassifierOutp...
32
UpperCAmelCase_ = { "A": ".-", "B": "-...", "C": "-.-.", "D": "-..", "E": ".", "F": "..-.", "G": "--.", "H": "....", "I": "..", "J": ".---", "K": "-.-", "L": ".-..", "M": "--", "N": "-.", "O": "---", "P": ".--.", "Q": "--.-", "R": ".-.", "S": "...", "T": "-", "U": "..-", "V": "...-", "W"...
32
1
from __future__ import annotations def A__ ( SCREAMING_SNAKE_CASE_ : int ) -> bool: """simple docstring""" _UpperCAmelCase = str(SCREAMING_SNAKE_CASE_ ) return len(SCREAMING_SNAKE_CASE_ ) == 9 and set(SCREAMING_SNAKE_CASE_ ) == set('''12...
32
import gc import unittest import numpy as np import torch from diffusers import DanceDiffusionPipeline, IPNDMScheduler, UNetaDModel from diffusers.utils import slow, torch_device from diffusers.utils.testing_utils import enable_full_determinism, require_torch_gpu, skip_mps from ..pipeline_params import UNCONDI...
32
1
import re from pathlib import Path from unittest import TestCase import pytest @pytest.mark.integration class __UpperCamelCase ( A__ ): def UpperCamelCase( self , _UpperCamelCase ): with open(_UpperCamelCase , encoding='''utf-8''' ) as input_f...
32
from collections import OrderedDict from ...utils import logging from .auto_factory import _BaseAutoModelClass, _LazyAutoMapping, auto_class_update from .configuration_auto import CONFIG_MAPPING_NAMES UpperCAmelCase_ = logging.get_logger(__name__) UpperCAmelCase_ = OrderedDict( [ ...
32
1
from math import ceil from typing import List, Optional, Union import numpy as np from ...audio_utils import mel_filter_bank, spectrogram, window_function from ...feature_extraction_sequence_utils import BatchFeature, SequenceFeatureExtractor from ...utils import TensorType, logging UpperCAmelCase_ ...
32
import baseaa def A__ ( SCREAMING_SNAKE_CASE_ : str ) -> bytes: """simple docstring""" return baseaa.baaencode(string.encode('''utf-8''' ) ) def A__ ( SCREAMING_SNAKE_CASE_ : bytes ) -> str: """simple docstring""" ...
32
1
import inspect import os import unittest from pathlib import Path import torch import accelerate from accelerate.test_utils import execute_subprocess_async from accelerate.test_utils.testing import run_command class __UpperCamelCase ( unittest.TestCase ): __A : List[Any] = ins...
32
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_format, ) ...
32
1
def A__ ( SCREAMING_SNAKE_CASE_ : str ) -> str: """simple docstring""" if not all(char in '''01''' for char in bin_string ): raise ValueError('''Non-binary value was passed to the function''' ) if not bin_string: raise ValueError('''Empty str...
32
from ..utils import DummyObject, requires_backends class __UpperCamelCase ( metaclass=A__ ): __A : str = ["""torch""", """scipy"""] def __init__( self , *_UpperCamelCase , **_UpperCamelCase ): requires_backends(self , ['''torc...
32
1
import json import sys import tempfile import unittest from pathlib import Path import transformers from transformers import ( CONFIG_MAPPING, FEATURE_EXTRACTOR_MAPPING, AutoConfig, AutoFeatureExtractor, WavaVecaConfig, WavaVecaFeatureExtractor, ) from transformers.testing_utils import DU...
32
def A__ ( SCREAMING_SNAKE_CASE_ : int = 2_00_00_00 ) -> int: """simple docstring""" _UpperCAmelCase = [0 for i in range(n + 1 )] _UpperCAmelCase = 1 _UpperCAmelCase = 1 for i in range(2 , int(n**0.5 ) + 1 ...
32
1
UpperCAmelCase_ = { "A": ".-", "B": "-...", "C": "-.-.", "D": "-..", "E": ".", "F": "..-.", "G": "--.", "H": "....", "I": "..", "J": ".---", "K": "-.-", "L": ".-..", "M": "--", "N": "-.", "O": "---", "P": ".--.", "Q": "--.-", "R": ".-.", "S": "...", "T": "-", "U": "..-", "V": "...-", "W"...
32
import warnings from ...utils import logging from .image_processing_glpn import GLPNImageProcessor UpperCAmelCase_ = logging.get_logger(__name__) class __UpperCamelCase ( A__ ): def __init__( self , *_UpperCamelCase , **_UpperCamelCase ): ...
32
1
def A__ ( SCREAMING_SNAKE_CASE_ : int ) -> bool: """simple docstring""" if not isinstance(SCREAMING_SNAKE_CASE_ , SCREAMING_SNAKE_CASE_ ): _UpperCAmelCase = F'''Input value of [number={number}] must be an integer''' raise TypeError(SCR...
32
from typing import List, Optional, Union from ...processing_utils import ProcessorMixin from ...tokenization_utils_base import BatchEncoding, PaddingStrategy, PreTokenizedInput, TextInput, TruncationStrategy from ...utils import TensorType class __UpperCamelCase ( A__ ): __A : Dict ...
32
1
import argparse import torch from transformers import ( WavaVecaConfig, WavaVecaFeatureExtractor, WavaVecaForAudioFrameClassification, WavaVecaForSequenceClassification, WavaVecaForXVector, logging, ) logging.set_verbosity_info() UpperCAmelCase_ = logging.get_logger(__name__)...
32
from typing import TYPE_CHECKING from ...utils import OptionalDependencyNotAvailable, _LazyModule, is_tf_available, is_torch_available UpperCAmelCase_ = { "configuration_xlm": ["XLM_PRETRAINED_CONFIG_ARCHIVE_MAP", "XLMConfig", "XLMOnnxConfig"], "tokenization_xlm": ["XLMTokenizer"], } try: ...
32
1
from __future__ import annotations def A__ ( SCREAMING_SNAKE_CASE_ : list[int] , SCREAMING_SNAKE_CASE_ : list[int] , SCREAMING_SNAKE_CASE_ : int ) -> tuple[float, list[float]]: """simple docstring""" _UpperCAmelCase = list(range(len(SC...
32
from ...configuration_utils import PretrainedConfig from ...utils import logging UpperCAmelCase_ = logging.get_logger(__name__) UpperCAmelCase_ = { "microsoft/biogpt": "https://huggingface.co/microsoft/biogpt/resolve/main/config.json", # See all BioGPT models at https://huggingface....
32
1
def A__ ( SCREAMING_SNAKE_CASE_ : bytes ) -> str: """simple docstring""" return "".join([hex(SCREAMING_SNAKE_CASE_ )[2:].zfill(2 ).upper() for byte in list(SCREAMING_SNAKE_CASE_ )] ) def A__ ( SCREAMING_SNAKE_CASE_ : str ...
32
from typing import List from .keymap import KEYMAP, get_character def A__ ( SCREAMING_SNAKE_CASE_ : str ) -> List[str]: """simple docstring""" def decorator(SCREAMING_SNAKE_CASE_ : List[Any] ): _UpperCAmelCase = getattr(SCREAMING_SNAKE_...
32
1