code
stringlengths
86
54.5k
code_codestyle
int64
0
371
style_context
stringlengths
87
49.2k
style_context_codestyle
int64
0
349
label
int64
0
1
"""simple docstring""" import argparse import os import torch from transformers import FlavaImageCodebook, FlavaImageCodebookConfig def SCREAMING_SNAKE_CASE_ ( snake_case : List[Any] , snake_case : List[str] , snake_case : Union[str, Any] , snake_case : Uni...
80
"""simple docstring""" from math import factorial def SCREAMING_SNAKE_CASE_ ( snake_case : int = 20 )-> int: _lowerCamelCase = 2 * n # middle entry of odd rows starting at row 3 is the solution for n = 1, # 2, 3,... _lowerCamelCase = n // 2 return i...
80
1
"""simple docstring""" import math_equivalence # From: git+https://github.com/hendrycks/math.git import datasets A_ : Dict ="""\ @article{hendrycksmath2021, title={Measuring Mathematical Problem Solving With the MATH Dataset}, author={Dan Hendrycks and Collin Burns and Saurav K...
80
"""simple docstring""" import mpmath # for roots of unity import numpy as np class __a : def __init__( self , a__=None , a__=None ): # Input as list _lowerCamelCase = list(poly_a or [0] )[:] _lowerCamelCase = list(p...
80
1
"""simple docstring""" def SCREAMING_SNAKE_CASE_ ( snake_case : str )-> str: _lowerCamelCase = '' for ch in key: if ch == " " or ch not in key_no_dups and ch.isalpha(): key_no_dups += ch return key_no_dups def SCREAMING_SNAKE_CASE...
80
"""simple docstring""" def SCREAMING_SNAKE_CASE_ ( snake_case : int )-> list[int]: if num <= 0: raise ValueError('Input must be a positive integer' ) _lowerCamelCase = [True] * (num + 1) _lowerCamelCase = 2 while p * p <= num: ...
80
1
"""simple docstring""" import sys A_ : Union[str, Any] =( """73167176531330624919225119674426574742355349194934""" """96983520312774506326239578318016984801869478851843""" """85861560789112949495459501737958331952853208805511""" """125406987471585238630507156932909632952274430...
80
"""simple docstring""" from __future__ import annotations A_ : List[Any] =list[tuple[int, int]] A_ : Tuple =[ [0, 0, 0, 0, 0, 0, 0], [0, 1, 0, 0, 0, 0, 0], # 0 are free path whereas 1's are obstacles [0, 0, 0, 0, 0, 0, 0], [0, 0, 1, 0, 0, 0, 0], [1, 0, ...
80
1
"""simple docstring""" 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, ...
80
"""simple docstring""" # Copyright 2021 The HuggingFace Team. All rights reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 #...
80
1
"""simple docstring""" import argparse import torch from transformers import ( UniSpeechSatConfig, UniSpeechSatForAudioFrameClassification, UniSpeechSatForSequenceClassification, UniSpeechSatForXVector, WavaVecaFeatureExtractor, logging, ) logging.set_verbosity_info() A_ : Lis...
80
"""simple docstring""" import argparse import torch from diffusers.pipelines.stable_diffusion.convert_from_ckpt import download_from_original_stable_diffusion_ckpt if __name__ == "__main__": A_ : List[Any] =argparse.ArgumentParser() parser.add_argument( """--checkpoi...
80
1
"""simple docstring""" 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 rescale, resize, to_channel_dimension_format from ...image_utils import ( ChannelDimension, Ima...
80
"""simple docstring""" from dataclasses import dataclass from typing import Dict, Optional, Tuple, Union import torch import torch.nn as nn from ..configuration_utils import ConfigMixin, register_to_config from ..utils import BaseOutput, apply_forward_hook from .attention_processor import AttentionProcessor, ...
80
1
"""simple docstring""" from typing import TYPE_CHECKING from ...utils import OptionalDependencyNotAvailable, _LazyModule, is_flax_available, is_torch_available A_ : List[str] ={"""configuration_speech_encoder_decoder""": ["""SpeechEncoderDecoderConfig"""]} try: if not is_torch_availa...
80
"""simple docstring""" from math import factorial, pi def SCREAMING_SNAKE_CASE_ ( snake_case : float , snake_case : int = 30 )-> float: if not isinstance(snake_case , (int, float) ): raise ValueError('maclaurin_sin() requires either an int or float for...
80
1
"""simple docstring""" import enum import warnings from .. import MODEL_FOR_CAUSAL_LM_MAPPING, TF_MODEL_FOR_CAUSAL_LM_MAPPING from ..utils import add_end_docstrings, is_tf_available from .base import PIPELINE_INIT_ARGS, Pipeline if is_tf_available(): import tensorflow as tf class __a ...
80
"""simple docstring""" 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_availa...
80
1
"""simple docstring""" def SCREAMING_SNAKE_CASE_ ( snake_case : int )-> bool: return sum(i for i in range(1 , number // 2 + 1 ) if number % i == 0 ) == number if __name__ == "__main__": print("""Program to check whether a number is a Perfect number or not...""") A_ ...
80
"""simple docstring""" from datasets.utils.patching import _PatchedModuleObj, patch_submodule from . import _test_patching def SCREAMING_SNAKE_CASE_ ( )-> Any: import os as original_os from os import path as original_path from os import rename as original_rename from os....
80
1
"""simple docstring""" import json import sys def SCREAMING_SNAKE_CASE_ ( snake_case : str , snake_case : Dict )-> List[str]: with open(snake_case , encoding='utf-8' ) as f: _lowerCamelCase = json.load(snake_case ) _lowerCamelCase ...
80
"""simple docstring""" import numpy as np def SCREAMING_SNAKE_CASE_ ( snake_case : np.ndarray )-> np.ndarray: return 1 / (1 + np.exp(-vector )) def SCREAMING_SNAKE_CASE_ ( snake_case : np.ndarray )-> np.ndarray: return vector * sigmoid(snake_case ) if __na...
80
1
"""simple docstring""" class __a : def __init__( self , a__ , a__ , a__ ): _lowerCamelCase = None _lowerCamelCase = None _lowerCamelCase = graph self._normalize_graph(a__ , a__ ) _low...
80
"""simple docstring""" from collections import defaultdict from math import gcd def SCREAMING_SNAKE_CASE_ ( snake_case : int = 1_500_000 )-> int: _lowerCamelCase = defaultdict(snake_case ) _lowerCamelCase = 2 while 2 * euclid_m * (euclid_m + 1) <= limit: ...
80
1
"""simple docstring""" # limitations under the License. from typing import Optional, Tuple, Union import torch from diffusers import DiffusionPipeline, ImagePipelineOutput class __a ( lowerCAmelCase__ ): def __init__( self , a__ , a__ ): super().__init__...
80
"""simple docstring""" import json from typing import List, Optional, Tuple from tokenizers import normalizers from tokenizers.pre_tokenizers import BertPreTokenizer, PreTokenizer from ...tokenization_utils_fast import PreTrainedTokenizerFast from ...utils import logging from .tokenization_roformer import RoF...
80
1
"""simple docstring""" from __future__ import annotations import inspect import unittest from math import floor import numpy as np from transformers import CvtConfig from transformers.testing_utils import require_tf, require_vision, slow from transformers.utils import cached_property, is_tf_available, is_vis...
80
"""simple docstring""" import copy from ...configuration_utils import PretrainedConfig from ...utils import logging from ..auto import CONFIG_MAPPING A_ : int =logging.get_logger(__name__) A_ : Tuple ={ """ut/deta""": """https://huggingface.co/ut/deta/resolve/main/con...
80
1
"""simple docstring""" def SCREAMING_SNAKE_CASE_ ( snake_case : Optional[int] , snake_case : Dict , snake_case : Union[str, Any] )-> List[str]: if n == 0: return 1 elif n % 2 == 1: return (binary_exponentiation(snake_case , n...
80
"""simple docstring""" import gc import unittest from diffusers import FlaxControlNetModel, FlaxStableDiffusionControlNetPipeline from diffusers.utils import is_flax_available, load_image, slow from diffusers.utils.testing_utils import require_flax if is_flax_available(): import jax import jax.nu...
80
1
"""simple docstring""" import json from typing import List, Optional, Tuple from tokenizers import normalizers from ...tokenization_utils_fast import PreTrainedTokenizerFast from ...utils import logging from .tokenization_mobilebert import MobileBertTokenizer A_ : Dict =logging.get_logger(...
80
"""simple docstring""" def SCREAMING_SNAKE_CASE_ ( snake_case : list )-> list: def merge(snake_case : list , snake_case : list ) -> list: def _merge(): while left and right: yield (left if left[0] <= right[0...
80
1
"""simple docstring""" import os import socket from contextlib import contextmanager import torch from ..commands.config.default import write_basic_config # noqa: F401 from ..state import PartialState from .dataclasses import DistributedType from .imports import is_deepspeed_available, is_tpu_available from ...
80
"""simple docstring""" import warnings from ...utils import logging from .image_processing_dpt import DPTImageProcessor A_ : Union[str, Any] =logging.get_logger(__name__) class __a ( lowerCAmelCase__ ): def __init__( self , *a__ , **a__ ): ...
80
1
"""simple docstring""" import numpy as np def SCREAMING_SNAKE_CASE_ ( snake_case : np.ndarray )-> np.ndarray: return 1 / (1 + np.exp(-vector )) def SCREAMING_SNAKE_CASE_ ( snake_case : np.ndarray )-> np.ndarray: return vector * sigmoid(snake_case ) if __na...
80
"""simple docstring""" import os from shutil import copyfile from typing import List, Optional, Tuple from ...tokenization_utils import AddedToken from ...tokenization_utils_fast import PreTrainedTokenizerFast from ...utils import is_sentencepiece_available, logging if is_sentencepiece_available(): fro...
80
1
"""simple docstring""" def SCREAMING_SNAKE_CASE_ ( snake_case : str , snake_case : str )-> bool: _lowerCamelCase = len(snake_case ) _lowerCamelCase = len(snake_case ) _lowerCamelCase = [[False for _ in range(m + 1 )] for _ in range(n + 1 )]...
80
"""simple docstring""" import copy from typing import TYPE_CHECKING, Any, Mapping, Optional, OrderedDict from packaging import version from ...configuration_utils import PretrainedConfig from ...onnx import OnnxConfig from ...utils import logging from ..auto.configuration_auto import AutoConfig if TYPE_CHEC...
80
1
"""simple docstring""" import argparse import json import subprocess def SCREAMING_SNAKE_CASE_ ( snake_case : List[Any] , snake_case : Tuple )-> Optional[Any]: _lowerCamelCase = [] _lowerCamelCase = ( f'curl -H "Accept: application/vnd.githu...
80
"""simple docstring""" from typing import TYPE_CHECKING from ...utils import OptionalDependencyNotAvailable, _LazyModule, is_torch_available A_ : Any ={ """configuration_table_transformer""": [ """TABLE_TRANSFORMER_PRETRAINED_CONFIG_ARCHIVE_MAP""", """TableTransformerCon...
80
1
"""simple docstring""" import copy import os from typing import Union from ...configuration_utils import PretrainedConfig from ...utils import logging A_ : int =logging.get_logger(__name__) A_ : Optional[int] ={ """BAAI/AltCLIP""": """https://huggingface.co/BAAI/AltCL...
80
"""simple docstring""" import importlib import json import os from collections import OrderedDict from typing import Dict, Optional, Union # Build the list of all image processors from ...configuration_utils import PretrainedConfig from ...dynamic_module_utils import get_class_from_dynamic_module, resolve_trus...
80
1
"""simple docstring""" 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_ : Any =logging.get_logger(__name__) A_ : Any ...
80
"""simple docstring""" from typing import TYPE_CHECKING from ...utils import OptionalDependencyNotAvailable, _LazyModule, is_flax_available, is_torch_available A_ : List[str] ={"""configuration_speech_encoder_decoder""": ["""SpeechEncoderDecoderConfig"""]} try: if not is_torch_availa...
80
1
"""simple docstring""" from typing import TYPE_CHECKING from ...utils import OptionalDependencyNotAvailable, _LazyModule, is_torch_available A_ : Any ={ """configuration_table_transformer""": [ """TABLE_TRANSFORMER_PRETRAINED_CONFIG_ARCHIVE_MAP""", """TableTransformerCon...
80
"""simple docstring""" from math import factorial def SCREAMING_SNAKE_CASE_ ( snake_case : int = 20 )-> int: _lowerCamelCase = 2 * n # middle entry of odd rows starting at row 3 is the solution for n = 1, # 2, 3,... _lowerCamelCase = n // 2 return i...
80
1
"""simple docstring""" from typing import TYPE_CHECKING from ...utils import OptionalDependencyNotAvailable, _LazyModule, is_torch_available, is_vision_available A_ : Optional[Any] ={ """configuration_maskformer""": ["""MASKFORMER_PRETRAINED_CONFIG_ARCHIVE_MAP""", """MaskFormerConfig"""...
80
"""simple docstring""" import mpmath # for roots of unity import numpy as np class __a : def __init__( self , a__=None , a__=None ): # Input as list _lowerCamelCase = list(poly_a or [0] )[:] _lowerCamelCase = list(p...
80
1
"""simple docstring""" import logging from transformers.configuration_utils import PretrainedConfig A_ : Any =logging.getLogger(__name__) class __a ( lowerCAmelCase__ ): SCREAMING_SNAKE_CASE__ : List[Any] = "masked_bert" def __init__( self , ...
80
"""simple docstring""" def SCREAMING_SNAKE_CASE_ ( snake_case : int )-> list[int]: if num <= 0: raise ValueError('Input must be a positive integer' ) _lowerCamelCase = [True] * (num + 1) _lowerCamelCase = 2 while p * p <= num: ...
80
1
"""simple docstring""" from ...configuration_utils import PretrainedConfig from ...utils import logging A_ : Optional[Any] =logging.get_logger(__name__) A_ : Tuple ={ """MIT/ast-finetuned-audioset-10-10-0.4593""": ( """https://huggingface.co/MIT/ast-finetuned-a...
80
"""simple docstring""" from __future__ import annotations A_ : List[Any] =list[tuple[int, int]] A_ : Tuple =[ [0, 0, 0, 0, 0, 0, 0], [0, 1, 0, 0, 0, 0, 0], # 0 are free path whereas 1's are obstacles [0, 0, 0, 0, 0, 0, 0], [0, 0, 1, 0, 0, 0, 0], [1, 0, ...
80
1
"""simple docstring""" from __future__ import annotations import math def SCREAMING_SNAKE_CASE_ ( snake_case : list , snake_case : list )-> list: if len(snake_case ) != 2 or len(a[0] ) != 2 or len(snake_case ) != 2 or len(b[0] ) != 2: raise Exception('Mat...
80
"""simple docstring""" # Copyright 2021 The HuggingFace Team. All rights reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 #...
80
1
"""simple docstring""" import fire from torch.utils.data import DataLoader from tqdm import tqdm from transformers import AutoTokenizer from utils import SeqaSeqDataset, pickle_save def SCREAMING_SNAKE_CASE_ ( snake_case : Optional[Any] , snake_case : Optional[Any] , snake_ca...
80
"""simple docstring""" import argparse import torch from diffusers.pipelines.stable_diffusion.convert_from_ckpt import download_from_original_stable_diffusion_ckpt if __name__ == "__main__": A_ : List[Any] =argparse.ArgumentParser() parser.add_argument( """--checkpoi...
80
1
"""simple docstring""" from datetime import datetime import matplotlib.pyplot as plt import torch def SCREAMING_SNAKE_CASE_ ( snake_case : Tuple )-> Optional[Any]: for param in module.parameters(): _lowerCamelCase = False def SCREAMING_SNAKE_CASE_ ( )->...
80
"""simple docstring""" from dataclasses import dataclass from typing import Dict, Optional, Tuple, Union import torch import torch.nn as nn from ..configuration_utils import ConfigMixin, register_to_config from ..utils import BaseOutput, apply_forward_hook from .attention_processor import AttentionProcessor, ...
80
1
"""simple docstring""" import ast import os import re import shutil import tempfile import unittest from unittest import mock import torch from accelerate.test_utils.examples import compare_against_test from accelerate.test_utils.testing import TempDirTestCase, require_trackers, run_command, slow from acceler...
80
"""simple docstring""" from math import factorial, pi def SCREAMING_SNAKE_CASE_ ( snake_case : float , snake_case : int = 30 )-> float: if not isinstance(snake_case , (int, float) ): raise ValueError('maclaurin_sin() requires either an int or float for...
80
1
"""simple docstring""" import mpmath # for roots of unity import numpy as np class __a : def __init__( self , a__=None , a__=None ): # Input as list _lowerCamelCase = list(poly_a or [0] )[:] _lowerCamelCase = list(p...
80
"""simple docstring""" 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_availa...
80
1
"""simple docstring""" import argparse from collections import OrderedDict from pathlib import Path import torch from huggingface_hub import hf_hub_download from PIL import Image from torchvision.transforms import functional as F from transformers import DetrImageProcessor, TableTransformerConfig, TableTransf...
80
"""simple docstring""" from datasets.utils.patching import _PatchedModuleObj, patch_submodule from . import _test_patching def SCREAMING_SNAKE_CASE_ ( )-> Any: import os as original_os from os import path as original_path from os import rename as original_rename from os....
80
1
"""simple docstring""" from string import ascii_uppercase A_ : Union[str, Any] ={char: i for i, char in enumerate(ascii_uppercase)} A_ : List[Any] =dict(enumerate(ascii_uppercase)) def SCREAMING_SNAKE_CASE_ ( snake_case : str , snake_case : str ...
80
"""simple docstring""" import numpy as np def SCREAMING_SNAKE_CASE_ ( snake_case : np.ndarray )-> np.ndarray: return 1 / (1 + np.exp(-vector )) def SCREAMING_SNAKE_CASE_ ( snake_case : np.ndarray )-> np.ndarray: return vector * sigmoid(snake_case ) if __na...
80
1
"""simple docstring""" from typing import TYPE_CHECKING from ...utils import OptionalDependencyNotAvailable, _LazyModule, is_torch_available A_ : Union[str, Any] ={ """configuration_time_series_transformer""": [ """TIME_SERIES_TRANSFORMER_PRETRAINED_CONFIG_ARCHIVE_MAP""", ...
80
"""simple docstring""" from collections import defaultdict from math import gcd def SCREAMING_SNAKE_CASE_ ( snake_case : int = 1_500_000 )-> int: _lowerCamelCase = defaultdict(snake_case ) _lowerCamelCase = 2 while 2 * euclid_m * (euclid_m + 1) <= limit: ...
80
1
"""simple docstring""" from typing import TYPE_CHECKING from ...utils import _LazyModule A_ : Optional[Any] ={"""tokenization_wav2vec2_phoneme""": ["""Wav2Vec2PhonemeCTCTokenizer"""]} if TYPE_CHECKING: from .tokenization_wavaveca_phoneme import WavaVecaPhonemeCTCTokenizer else: ...
80
"""simple docstring""" import json from typing import List, Optional, Tuple from tokenizers import normalizers from tokenizers.pre_tokenizers import BertPreTokenizer, PreTokenizer from ...tokenization_utils_fast import PreTrainedTokenizerFast from ...utils import logging from .tokenization_roformer import RoF...
80
1
"""simple docstring""" from typing import TYPE_CHECKING from ...utils import ( OptionalDependencyNotAvailable, _LazyModule, is_tf_available, is_torch_available, is_vision_available, ) A_ : List[Any] ={ """configuration_convnext""": ["""CONVNEXT_PRETRAINED_CONFIG_ARCH...
80
"""simple docstring""" import copy from ...configuration_utils import PretrainedConfig from ...utils import logging from ..auto import CONFIG_MAPPING A_ : int =logging.get_logger(__name__) A_ : Tuple ={ """ut/deta""": """https://huggingface.co/ut/deta/resolve/main/con...
80
1
"""simple docstring""" from __future__ import annotations from decimal import Decimal from numpy import array def SCREAMING_SNAKE_CASE_ ( snake_case : list[list[float]] )-> list[list[float]]: _lowerCamelCase = Decimal # Check if the provided matrix has 2 rows and 2 col...
80
"""simple docstring""" import gc import unittest from diffusers import FlaxControlNetModel, FlaxStableDiffusionControlNetPipeline from diffusers.utils import is_flax_available, load_image, slow from diffusers.utils.testing_utils import require_flax if is_flax_available(): import jax import jax.nu...
80
1
"""simple docstring""" def SCREAMING_SNAKE_CASE_ ( snake_case : int , snake_case : int , snake_case : Tuple=False )-> List[Any]: if isinstance(snake_case , snake_case ) and isinstance(snake_case , snake_case ): _lowerCamelCase = le...
80
"""simple docstring""" def SCREAMING_SNAKE_CASE_ ( snake_case : list )-> list: def merge(snake_case : list , snake_case : list ) -> list: def _merge(): while left and right: yield (left if left[0] <= right[0...
80
1
"""simple docstring""" from math import log from scipy.constants import Boltzmann, physical_constants A_ : Tuple =3_0_0 # TEMPERATURE (unit = K) def SCREAMING_SNAKE_CASE_ ( snake_case : float , snake_case : float , snake_case : float , )-> flo...
80
"""simple docstring""" import warnings from ...utils import logging from .image_processing_dpt import DPTImageProcessor A_ : Union[str, Any] =logging.get_logger(__name__) class __a ( lowerCAmelCase__ ): def __init__( self , *a__ , **a__ ): ...
80
1
"""simple docstring""" A_ : Union[str, Any] =""" # Installazione di Transformers ! pip install transformers datasets # Per installare dalla fonte invece dell'ultima versione rilasciata, commenta il comando sopra e # rimuovi la modalità commento al comando seguente. # ! pip install git+https://...
80
"""simple docstring""" import os from shutil import copyfile from typing import List, Optional, Tuple from ...tokenization_utils import AddedToken from ...tokenization_utils_fast import PreTrainedTokenizerFast from ...utils import is_sentencepiece_available, logging if is_sentencepiece_available(): fro...
80
1
"""simple docstring""" from ...configuration_utils import PretrainedConfig from ...utils import logging A_ : Any =logging.get_logger(__name__) A_ : Optional[int] ={ """facebook/s2t-wav2vec2-large-en-de""": ( """https://huggingface.co/facebook/s2t-wav2vec2-large...
80
"""simple docstring""" import copy from typing import TYPE_CHECKING, Any, Mapping, Optional, OrderedDict from packaging import version from ...configuration_utils import PretrainedConfig from ...onnx import OnnxConfig from ...utils import logging from ..auto.configuration_auto import AutoConfig if TYPE_CHEC...
80
1
"""simple docstring""" # Copyright 2021 The HuggingFace Team. All rights reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 #...
80
"""simple docstring""" from typing import TYPE_CHECKING from ...utils import OptionalDependencyNotAvailable, _LazyModule, is_torch_available A_ : Any ={ """configuration_table_transformer""": [ """TABLE_TRANSFORMER_PRETRAINED_CONFIG_ARCHIVE_MAP""", """TableTransformerCon...
80
1
"""simple docstring""" from math import factorial, pi def SCREAMING_SNAKE_CASE_ ( snake_case : float , snake_case : int = 30 )-> float: if not isinstance(snake_case , (int, float) ): raise ValueError('maclaurin_sin() requires either an int or float for...
80
"""simple docstring""" import importlib import json import os from collections import OrderedDict from typing import Dict, Optional, Union # Build the list of all image processors from ...configuration_utils import PretrainedConfig from ...dynamic_module_utils import get_class_from_dynamic_module, resolve_trus...
80
1
"""simple docstring""" import json import pathlib import unittest import numpy as np from transformers.testing_utils import require_torch, require_vision, slow from transformers.utils import is_torch_available, is_vision_available from ...test_image_processing_common import ImageProcessingSavingTestMixin, pr...
80
"""simple docstring""" from typing import TYPE_CHECKING from ...utils import OptionalDependencyNotAvailable, _LazyModule, is_flax_available, is_torch_available A_ : List[str] ={"""configuration_speech_encoder_decoder""": ["""SpeechEncoderDecoderConfig"""]} try: if not is_torch_availa...
80
1
"""simple docstring""" from __future__ import annotations import unittest from transformers import DebertaVaConfig, is_tf_available from transformers.testing_utils import require_tf, slow from ...test_configuration_common import ConfigTester from ...test_modeling_tf_common import TFModelTesterMixin, ids_tens...
80
"""simple docstring""" from math import factorial def SCREAMING_SNAKE_CASE_ ( snake_case : int = 20 )-> int: _lowerCamelCase = 2 * n # middle entry of odd rows starting at row 3 is the solution for n = 1, # 2, 3,... _lowerCamelCase = n // 2 return i...
80
1
"""simple docstring""" import warnings from ...utils import logging from .image_processing_dpt import DPTImageProcessor A_ : Union[str, Any] =logging.get_logger(__name__) class __a ( lowerCAmelCase__ ): def __init__( self , *a__ , **a__ ): ...
80
"""simple docstring""" import mpmath # for roots of unity import numpy as np class __a : def __init__( self , a__=None , a__=None ): # Input as list _lowerCamelCase = list(poly_a or [0] )[:] _lowerCamelCase = list(p...
80
1
"""simple docstring""" import argparse import os import evaluate import torch from datasets import load_dataset from torch.optim import AdamW from torch.utils.data import DataLoader from transformers import AutoModelForSequenceClassification, AutoTokenizer, get_linear_schedule_with_warmup, set_seed from accel...
80
"""simple docstring""" def SCREAMING_SNAKE_CASE_ ( snake_case : int )-> list[int]: if num <= 0: raise ValueError('Input must be a positive integer' ) _lowerCamelCase = [True] * (num + 1) _lowerCamelCase = 2 while p * p <= num: ...
80
1
"""simple docstring""" import json from typing import List, Optional, Tuple from tokenizers import normalizers from ...tokenization_utils_fast import PreTrainedTokenizerFast from ...utils import logging from .tokenization_convbert import ConvBertTokenizer A_ : Union[str, Any] =logging.get_...
80
"""simple docstring""" from __future__ import annotations A_ : List[Any] =list[tuple[int, int]] A_ : Tuple =[ [0, 0, 0, 0, 0, 0, 0], [0, 1, 0, 0, 0, 0, 0], # 0 are free path whereas 1's are obstacles [0, 0, 0, 0, 0, 0, 0], [0, 0, 1, 0, 0, 0, 0], [1, 0, ...
80
1
"""simple docstring""" from abc import ABC, abstractmethod from argparse import ArgumentParser class __a ( lowerCAmelCase__ ): @staticmethod @abstractmethod def snake_case_ ( a__ ): raise NotImplementedError() @abstractmethod def ...
80
"""simple docstring""" # Copyright 2021 The HuggingFace Team. All rights reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 #...
80
1
"""simple docstring""" from math import factorial A_ : dict[str, int] ={str(digit): factorial(digit) for digit in range(1_0)} def SCREAMING_SNAKE_CASE_ ( snake_case : int )-> int: if not isinstance(snake_case , snake_case ): raise TypeError('Para...
80
"""simple docstring""" import argparse import torch from diffusers.pipelines.stable_diffusion.convert_from_ckpt import download_from_original_stable_diffusion_ckpt if __name__ == "__main__": A_ : List[Any] =argparse.ArgumentParser() parser.add_argument( """--checkpoi...
80
1
"""simple docstring""" import copy import os from typing import Union from ...configuration_utils import PretrainedConfig from ...utils import logging A_ : Tuple =logging.get_logger(__name__) A_ : List[str] ={ """Salesforce/blip-vqa-base""": """https://huggingface.co/...
80
"""simple docstring""" from dataclasses import dataclass from typing import Dict, Optional, Tuple, Union import torch import torch.nn as nn from ..configuration_utils import ConfigMixin, register_to_config from ..utils import BaseOutput, apply_forward_hook from .attention_processor import AttentionProcessor, ...
80
1
"""simple docstring""" from __future__ import annotations def SCREAMING_SNAKE_CASE_ ( snake_case : float , snake_case : float , snake_case : float )-> dict[str, float]: if (voltage, current, resistance).count(0 ) != 1: raise ValueError('One and on...
80
"""simple docstring""" from math import factorial, pi def SCREAMING_SNAKE_CASE_ ( snake_case : float , snake_case : int = 30 )-> float: if not isinstance(snake_case , (int, float) ): raise ValueError('maclaurin_sin() requires either an int or float for...
80
1
"""simple docstring""" import os from typing import List, Optional, Union from ...tokenization_utils import PreTrainedTokenizer from ...tokenization_utils_base import AddedToken from ...utils import logging A_ : Any =logging.get_logger(__name__) A_ : Dict ={"""vocab_file"...
80
"""simple docstring""" 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_availa...
80
1
"""simple docstring""" # Copyright 2021 The HuggingFace Team. All rights reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 #...
80
"""simple docstring""" from datasets.utils.patching import _PatchedModuleObj, patch_submodule from . import _test_patching def SCREAMING_SNAKE_CASE_ ( )-> Any: import os as original_os from os import path as original_path from os import rename as original_rename from os....
80
1
"""simple docstring""" import re from pathlib import Path from unittest import TestCase import pytest @pytest.mark.integration class __a ( lowerCAmelCase__ ): def snake_case_ ( self , a__ ): with open(a__ , encoding='utf-8' ) as input_file...
80
"""simple docstring""" import numpy as np def SCREAMING_SNAKE_CASE_ ( snake_case : np.ndarray )-> np.ndarray: return 1 / (1 + np.exp(-vector )) def SCREAMING_SNAKE_CASE_ ( snake_case : np.ndarray )-> np.ndarray: return vector * sigmoid(snake_case ) if __na...
80
1
"""simple docstring""" 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_unord...
80
"""simple docstring""" from collections import defaultdict from math import gcd def SCREAMING_SNAKE_CASE_ ( snake_case : int = 1_500_000 )-> int: _lowerCamelCase = defaultdict(snake_case ) _lowerCamelCase = 2 while 2 * euclid_m * (euclid_m + 1) <= limit: ...
80
1
"""simple docstring""" from __future__ import annotations import unittest from transformers import is_tf_available, is_torch_available from transformers.testing_utils import DUMMY_UNKNOWN_IDENTIFIER, SMALL_MODEL_IDENTIFIER, is_pt_tf_cross_test, slow if is_tf_available(): from transformers import ( ...
80
"""simple docstring""" import json from typing import List, Optional, Tuple from tokenizers import normalizers from tokenizers.pre_tokenizers import BertPreTokenizer, PreTokenizer from ...tokenization_utils_fast import PreTrainedTokenizerFast from ...utils import logging from .tokenization_roformer import RoF...
80
1
"""simple docstring""" import inspect import re from transformers.utils import direct_transformers_import # All paths are set with the intent you should run this script from the root of the repo with the command # python utils/check_config_docstrings.py A_ : Dict ="""src/transformers""" #...
80
"""simple docstring""" import copy from ...configuration_utils import PretrainedConfig from ...utils import logging from ..auto import CONFIG_MAPPING A_ : int =logging.get_logger(__name__) A_ : Tuple ={ """ut/deta""": """https://huggingface.co/ut/deta/resolve/main/con...
80
1
"""simple docstring""" def SCREAMING_SNAKE_CASE_ ( snake_case : list )-> list: def merge(snake_case : list , snake_case : list ) -> list: def _merge(): while left and right: yield (left if left[0] <= right[0...
80
"""simple docstring""" import gc import unittest from diffusers import FlaxControlNetModel, FlaxStableDiffusionControlNetPipeline from diffusers.utils import is_flax_available, load_image, slow from diffusers.utils.testing_utils import require_flax if is_flax_available(): import jax import jax.nu...
80
1
"""simple docstring""" import gc import unittest from diffusers import FlaxControlNetModel, FlaxStableDiffusionControlNetPipeline from diffusers.utils import is_flax_available, load_image, slow from diffusers.utils.testing_utils import require_flax if is_flax_available(): import jax import jax.nu...
80
"""simple docstring""" def SCREAMING_SNAKE_CASE_ ( snake_case : list )-> list: def merge(snake_case : list , snake_case : list ) -> list: def _merge(): while left and right: yield (left if left[0] <= right[0...
80
1
"""simple docstring""" import os import unittest from transformers.models.cpmant.tokenization_cpmant import VOCAB_FILES_NAMES, CpmAntTokenizer from transformers.testing_utils import require_jieba, tooslow from ...test_tokenization_common import TokenizerTesterMixin @require_jieba class __a (...
80
"""simple docstring""" import warnings from ...utils import logging from .image_processing_dpt import DPTImageProcessor A_ : Union[str, Any] =logging.get_logger(__name__) class __a ( lowerCAmelCase__ ): def __init__( self , *a__ , **a__ ): ...
80
1
"""simple docstring""" def SCREAMING_SNAKE_CASE_ ( snake_case : int = 10 , snake_case : int = 22 )-> int: _lowerCamelCase = range(1 , snake_case ) _lowerCamelCase = range(1 , snake_case ) return sum( 1 for power in powers for ...
80
"""simple docstring""" import os from shutil import copyfile from typing import List, Optional, Tuple from ...tokenization_utils import AddedToken from ...tokenization_utils_fast import PreTrainedTokenizerFast from ...utils import is_sentencepiece_available, logging if is_sentencepiece_available(): fro...
80
1
"""simple docstring""" import argparse import os import jax as jnp import numpy as onp import torch import torch.nn as nn from music_spectrogram_diffusion import inference from tax import checkpoints from diffusers import DDPMScheduler, OnnxRuntimeModel, SpectrogramDiffusionPipeline from diffusers.pipelines.s...
80
"""simple docstring""" import copy from typing import TYPE_CHECKING, Any, Mapping, Optional, OrderedDict from packaging import version from ...configuration_utils import PretrainedConfig from ...onnx import OnnxConfig from ...utils import logging from ..auto.configuration_auto import AutoConfig if TYPE_CHEC...
80
1
"""simple docstring""" def SCREAMING_SNAKE_CASE_ ( snake_case : list[list[int]] , snake_case : int , snake_case : int , snake_case : list[int] )-> bool: # 1. Validate that path exists between current and next vertices if graph[path[curr_ind - 1]][...
80
"""simple docstring""" from typing import TYPE_CHECKING from ...utils import OptionalDependencyNotAvailable, _LazyModule, is_torch_available A_ : Any ={ """configuration_table_transformer""": [ """TABLE_TRANSFORMER_PRETRAINED_CONFIG_ARCHIVE_MAP""", """TableTransformerCon...
80
1
"""simple docstring""" import argparse import pytorch_lightning as pl import torch from torch import nn from transformers import LongformerForQuestionAnswering, LongformerModel class __a ( pl.LightningModule ): def __init__( self , a__ ): super().__init__() ...
80
"""simple docstring""" import importlib import json import os from collections import OrderedDict from typing import Dict, Optional, Union # Build the list of all image processors from ...configuration_utils import PretrainedConfig from ...dynamic_module_utils import get_class_from_dynamic_module, resolve_trus...
80
1
"""simple docstring""" import warnings from ...utils import logging from .image_processing_deformable_detr import DeformableDetrImageProcessor A_ : Any =logging.get_logger(__name__) class __a ( lowerCAmelCase__ ): def __init__( self , *a__ , **a__ )...
80
"""simple docstring""" from typing import TYPE_CHECKING from ...utils import OptionalDependencyNotAvailable, _LazyModule, is_flax_available, is_torch_available A_ : List[str] ={"""configuration_speech_encoder_decoder""": ["""SpeechEncoderDecoderConfig"""]} try: if not is_torch_availa...
80
1
"""simple docstring""" from sklearn.metrics import matthews_corrcoef import datasets A_ : Optional[Any] =""" Compute the Matthews correlation coefficient (MCC) The Matthews correlation coefficient is used in machine learning as a measure of the quality of binary and multiclass classificati...
80
"""simple docstring""" from math import factorial def SCREAMING_SNAKE_CASE_ ( snake_case : int = 20 )-> int: _lowerCamelCase = 2 * n # middle entry of odd rows starting at row 3 is the solution for n = 1, # 2, 3,... _lowerCamelCase = n // 2 return i...
80
1
"""simple docstring""" from typing import TYPE_CHECKING from ...utils import ( OptionalDependencyNotAvailable, _LazyModule, is_flax_available, is_sentencepiece_available, is_tf_available, is_tokenizers_available, is_torch_available, ) if is_sentencepiece_available(): from .....
80
"""simple docstring""" import mpmath # for roots of unity import numpy as np class __a : def __init__( self , a__=None , a__=None ): # Input as list _lowerCamelCase = list(poly_a or [0] )[:] _lowerCamelCase = list(p...
80
1
"""simple docstring""" import json import os import unittest from transformers import OpenAIGPTTokenizer, OpenAIGPTTokenizerFast from transformers.models.openai.tokenization_openai import VOCAB_FILES_NAMES from transformers.testing_utils import require_ftfy, require_spacy, require_tokenizers from ...test_toke...
80
"""simple docstring""" def SCREAMING_SNAKE_CASE_ ( snake_case : int )-> list[int]: if num <= 0: raise ValueError('Input must be a positive integer' ) _lowerCamelCase = [True] * (num + 1) _lowerCamelCase = 2 while p * p <= num: ...
80
1
"""simple docstring""" def SCREAMING_SNAKE_CASE_ ( snake_case : int )-> list[int]: if num <= 0: raise ValueError('Input must be a positive integer' ) _lowerCamelCase = [True] * (num + 1) _lowerCamelCase = 2 while p * p <= num: ...
80
"""simple docstring""" from __future__ import annotations A_ : List[Any] =list[tuple[int, int]] A_ : Tuple =[ [0, 0, 0, 0, 0, 0, 0], [0, 1, 0, 0, 0, 0, 0], # 0 are free path whereas 1's are obstacles [0, 0, 0, 0, 0, 0, 0], [0, 0, 1, 0, 0, 0, 0], [1, 0, ...
80
1
"""simple docstring""" import inspect import tempfile from collections import OrderedDict, UserDict from collections.abc import MutableMapping from contextlib import ExitStack, contextmanager from dataclasses import fields from enum import Enum from typing import Any, ContextManager, List, Tuple import numpy a...
80
"""simple docstring""" # Copyright 2021 The HuggingFace Team. All rights reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 #...
80
1
"""simple docstring""" import random def SCREAMING_SNAKE_CASE_ ( snake_case : Optional[Any] , snake_case : Optional[int] , snake_case : str )-> Union[str, Any]: _lowerCamelCase = a[left_index] _lowerCamelCase = left_index + 1 for j in...
80
"""simple docstring""" import argparse import torch from diffusers.pipelines.stable_diffusion.convert_from_ckpt import download_from_original_stable_diffusion_ckpt if __name__ == "__main__": A_ : List[Any] =argparse.ArgumentParser() parser.add_argument( """--checkpoi...
80
1
"""simple docstring""" from __future__ import annotations class __a : def __init__( self , a__=None ): _lowerCamelCase = data _lowerCamelCase = None def __repr__( self ): _lowerCamelCase = [] _...
80
"""simple docstring""" from dataclasses import dataclass from typing import Dict, Optional, Tuple, Union import torch import torch.nn as nn from ..configuration_utils import ConfigMixin, register_to_config from ..utils import BaseOutput, apply_forward_hook from .attention_processor import AttentionProcessor, ...
80
1
"""simple docstring""" import json import os from pathlib import Path from shutil import copyfile from typing import Any, Dict, List, Optional, Tuple, Union import sentencepiece from ...tokenization_utils import PreTrainedTokenizer from ...utils import logging A_ : Any =logging.get_logger(...
80
"""simple docstring""" from math import factorial, pi def SCREAMING_SNAKE_CASE_ ( snake_case : float , snake_case : int = 30 )-> float: if not isinstance(snake_case , (int, float) ): raise ValueError('maclaurin_sin() requires either an int or float for...
80
1
"""simple docstring""" from typing import TYPE_CHECKING from ...utils import ( OptionalDependencyNotAvailable, _LazyModule, is_sentencepiece_available, is_tf_available, is_tokenizers_available, is_torch_available, ) A_ : str ={ """configuration_rembert""": ["""RE...
80
"""simple docstring""" 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_availa...
80
1
"""simple docstring""" from __future__ import annotations def SCREAMING_SNAKE_CASE_ ( snake_case : int | str )-> bool: _lowerCamelCase = str(snake_case ) return n == n[::-1] def SCREAMING_SNAKE_CASE_ ( snake_case : int = 1_000_000 )-> Dict: _low...
80
"""simple docstring""" from datasets.utils.patching import _PatchedModuleObj, patch_submodule from . import _test_patching def SCREAMING_SNAKE_CASE_ ( )-> Any: import os as original_os from os import path as original_path from os import rename as original_rename from os....
80
1
"""simple docstring""" A_ : Any =[sum(int(c, 1_0) ** 2 for c in i.__str__()) for i in range(1_0_0_0_0_0)] def SCREAMING_SNAKE_CASE_ ( snake_case : int )-> int: _lowerCamelCase = 0 while number: # Increased Speed Slightly by checking every 5...
80
"""simple docstring""" import numpy as np def SCREAMING_SNAKE_CASE_ ( snake_case : np.ndarray )-> np.ndarray: return 1 / (1 + np.exp(-vector )) def SCREAMING_SNAKE_CASE_ ( snake_case : np.ndarray )-> np.ndarray: return vector * sigmoid(snake_case ) if __na...
80
1
"""simple docstring""" import json import os import unittest from transformers import CLIPTokenizer, CLIPTokenizerFast from transformers.models.clip.tokenization_clip import VOCAB_FILES_NAMES from transformers.testing_utils import require_ftfy, require_tokenizers from ...test_tokenization_common import Tokeni...
80
"""simple docstring""" from collections import defaultdict from math import gcd def SCREAMING_SNAKE_CASE_ ( snake_case : int = 1_500_000 )-> int: _lowerCamelCase = defaultdict(snake_case ) _lowerCamelCase = 2 while 2 * euclid_m * (euclid_m + 1) <= limit: ...
80
1
"""simple docstring""" from decimal import Decimal, getcontext from math import ceil, factorial def SCREAMING_SNAKE_CASE_ ( snake_case : int )-> str: if not isinstance(snake_case , snake_case ): raise TypeError('Undefined for non-integers' ) elif precision...
80
"""simple docstring""" import json from typing import List, Optional, Tuple from tokenizers import normalizers from tokenizers.pre_tokenizers import BertPreTokenizer, PreTokenizer from ...tokenization_utils_fast import PreTrainedTokenizerFast from ...utils import logging from .tokenization_roformer import RoF...
80
1
"""simple docstring""" from ...configuration_utils import PretrainedConfig from ...utils import logging A_ : Optional[int] =logging.get_logger(__name__) A_ : Union[str, Any] ={ """SCUT-DLVCLab/lilt-roberta-en-base""": ( """https://huggingface.co/SCUT-DLVCLab/li...
80
"""simple docstring""" import copy from ...configuration_utils import PretrainedConfig from ...utils import logging from ..auto import CONFIG_MAPPING A_ : int =logging.get_logger(__name__) A_ : Tuple ={ """ut/deta""": """https://huggingface.co/ut/deta/resolve/main/con...
80
1
"""simple docstring""" import json import os import re import shutil import tempfile import unittest from typing import Tuple from transformers import AddedToken, BatchEncoding, ByTaTokenizer from transformers.utils import cached_property, is_tf_available, is_torch_available from ...test_tokenization_common i...
80
"""simple docstring""" import gc import unittest from diffusers import FlaxControlNetModel, FlaxStableDiffusionControlNetPipeline from diffusers.utils import is_flax_available, load_image, slow from diffusers.utils.testing_utils import require_flax if is_flax_available(): import jax import jax.nu...
80
1
"""simple docstring""" import tempfile import unittest from make_student import create_student_by_copying_alternating_layers from transformers import AutoConfig from transformers.file_utils import cached_property from transformers.testing_utils import require_torch A_ : Dict ="""sshleifer/...
80
"""simple docstring""" def SCREAMING_SNAKE_CASE_ ( snake_case : list )-> list: def merge(snake_case : list , snake_case : list ) -> list: def _merge(): while left and right: yield (left if left[0] <= right[0...
80
1
"""simple docstring""" import random def SCREAMING_SNAKE_CASE_ ( snake_case : int , snake_case : float , snake_case : bool = False )-> dict: _lowerCamelCase = {i: [] for i in range(snake_case )} # if probability is greater or equal than 1, then g...
80
"""simple docstring""" import warnings from ...utils import logging from .image_processing_dpt import DPTImageProcessor A_ : Union[str, Any] =logging.get_logger(__name__) class __a ( lowerCAmelCase__ ): def __init__( self , *a__ , **a__ ): ...
80
1
"""simple docstring""" import argparse import collections import os import re import tempfile import pandas as pd from datasets import Dataset from huggingface_hub import hf_hub_download, upload_folder from transformers.utils import direct_transformers_import # All paths are set with the intent you should r...
80
"""simple docstring""" import os from shutil import copyfile from typing import List, Optional, Tuple from ...tokenization_utils import AddedToken from ...tokenization_utils_fast import PreTrainedTokenizerFast from ...utils import is_sentencepiece_available, logging if is_sentencepiece_available(): fro...
80
1
"""simple docstring""" from graphs.minimum_spanning_tree_kruskal import kruskal def SCREAMING_SNAKE_CASE_ ( )-> List[Any]: _lowerCamelCase = 9 _lowerCamelCase = [ [0, 1, 4], [0, 7, 8], [1, 2, 8], [7, 8, 7], [7, 6, 1],...
80
"""simple docstring""" import copy from typing import TYPE_CHECKING, Any, Mapping, Optional, OrderedDict from packaging import version from ...configuration_utils import PretrainedConfig from ...onnx import OnnxConfig from ...utils import logging from ..auto.configuration_auto import AutoConfig if TYPE_CHEC...
80
1
"""simple docstring""" from ....utils import logging A_ : List[str] =logging.get_logger(__name__) class __a ( lowerCAmelCase__ ): def __init__( self , a__ , a__=None , a__=20_48 ): _lowerCamelCase = config.__dict__ ...
80
"""simple docstring""" from typing import TYPE_CHECKING from ...utils import OptionalDependencyNotAvailable, _LazyModule, is_torch_available A_ : Any ={ """configuration_table_transformer""": [ """TABLE_TRANSFORMER_PRETRAINED_CONFIG_ARCHIVE_MAP""", """TableTransformerCon...
80
1
"""simple docstring""" import multiprocessing from typing import TYPE_CHECKING, Optional, Union from .. import Dataset, Features, config from ..formatting import query_table from ..packaged_modules.sql.sql import Sql from ..utils import logging from .abc import AbstractDatasetInputStream if TYPE_CHECKING: ...
80
"""simple docstring""" import importlib import json import os from collections import OrderedDict from typing import Dict, Optional, Union # Build the list of all image processors from ...configuration_utils import PretrainedConfig from ...dynamic_module_utils import get_class_from_dynamic_module, resolve_trus...
80
1
"""simple docstring""" import os import pickle import unittest from transformers import AutoTokenizer from transformers.models.bert.tokenization_bert import BertTokenizer from transformers.models.bert_japanese.tokenization_bert_japanese import ( VOCAB_FILES_NAMES, BertJapaneseTokenizer, CharacterTo...
80
"""simple docstring""" from typing import TYPE_CHECKING from ...utils import OptionalDependencyNotAvailable, _LazyModule, is_flax_available, is_torch_available A_ : List[str] ={"""configuration_speech_encoder_decoder""": ["""SpeechEncoderDecoderConfig"""]} try: if not is_torch_availa...
80
1
"""simple docstring""" import importlib import sys from argparse import REMAINDER, ArgumentParser from pathlib import Path import torch_xla.distributed.xla_multiprocessing as xmp def SCREAMING_SNAKE_CASE_ ( )-> List[str]: _lowerCamelCase = ArgumentParser( description=( ...
80
"""simple docstring""" from math import factorial def SCREAMING_SNAKE_CASE_ ( snake_case : int = 20 )-> int: _lowerCamelCase = 2 * n # middle entry of odd rows starting at row 3 is the solution for n = 1, # 2, 3,... _lowerCamelCase = n // 2 return i...
80
1
"""simple docstring""" from collections import OrderedDict from typing import Mapping from packaging import version from ...configuration_utils import PretrainedConfig from ...onnx import OnnxConfig from ...utils import logging from ..auto import CONFIG_MAPPING A_ : List[Any] =logging.get_...
80
"""simple docstring""" import mpmath # for roots of unity import numpy as np class __a : def __init__( self , a__=None , a__=None ): # Input as list _lowerCamelCase = list(poly_a or [0] )[:] _lowerCamelCase = list(p...
80
1
"""simple docstring""" import argparse import torch from transformers import FunnelBaseModel, FunnelConfig, FunnelModel, load_tf_weights_in_funnel from transformers.utils import logging logging.set_verbosity_info() def SCREAMING_SNAKE_CASE_ ( snake_case : Any , snake_case : str ...
80
"""simple docstring""" def SCREAMING_SNAKE_CASE_ ( snake_case : int )-> list[int]: if num <= 0: raise ValueError('Input must be a positive integer' ) _lowerCamelCase = [True] * (num + 1) _lowerCamelCase = 2 while p * p <= num: ...
80
1
"""simple docstring""" 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_ ...
80
"""simple docstring""" from __future__ import annotations A_ : List[Any] =list[tuple[int, int]] A_ : Tuple =[ [0, 0, 0, 0, 0, 0, 0], [0, 1, 0, 0, 0, 0, 0], # 0 are free path whereas 1's are obstacles [0, 0, 0, 0, 0, 0, 0], [0, 0, 1, 0, 0, 0, 0], [1, 0, ...
80
1
"""simple docstring""" def SCREAMING_SNAKE_CASE_ ( snake_case : list[int] , snake_case : list[int] , snake_case : int )-> bool: return not any( neighbour == 1 and colored_vertices[i] == color for i, neighbour in enumerate(snake_case ) ) d...
80
"""simple docstring""" # Copyright 2021 The HuggingFace Team. All rights reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 #...
80
1
"""simple docstring""" from math import factorial def SCREAMING_SNAKE_CASE_ ( snake_case : int = 20 )-> int: _lowerCamelCase = 2 * n # middle entry of odd rows starting at row 3 is the solution for n = 1, # 2, 3,... _lowerCamelCase = n // 2 return i...
80
"""simple docstring""" import argparse import torch from diffusers.pipelines.stable_diffusion.convert_from_ckpt import download_from_original_stable_diffusion_ckpt if __name__ == "__main__": A_ : List[Any] =argparse.ArgumentParser() parser.add_argument( """--checkpoi...
80
1
"""simple docstring""" from dataclasses import dataclass from typing import Dict, Optional, Tuple, Union import torch import torch.nn as nn from ..configuration_utils import ConfigMixin, register_to_config from ..utils import BaseOutput, apply_forward_hook from .attention_processor import AttentionProcessor, ...
80
"""simple docstring""" from dataclasses import dataclass from typing import Dict, Optional, Tuple, Union import torch import torch.nn as nn from ..configuration_utils import ConfigMixin, register_to_config from ..utils import BaseOutput, apply_forward_hook from .attention_processor import AttentionProcessor, ...
80
1
"""simple docstring""" from __future__ import annotations from typing import Any def SCREAMING_SNAKE_CASE_ ( snake_case : list[Any] )-> None: create_state_space_tree(snake_case , [] , 0 ) def SCREAMING_SNAKE_CASE_ ( snake_case : list[Any] , snake_ca...
80
"""simple docstring""" from math import factorial, pi def SCREAMING_SNAKE_CASE_ ( snake_case : float , snake_case : int = 30 )-> float: if not isinstance(snake_case , (int, float) ): raise ValueError('maclaurin_sin() requires either an int or float for...
80
1
"""simple docstring""" from collections import OrderedDict from typing import Mapping from packaging import version from ...configuration_utils import PretrainedConfig from ...onnx import OnnxConfig from ...utils import logging from ...utils.backbone_utils import BackboneConfigMixin, get_aligned_output_featur...
80
"""simple docstring""" 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_availa...
80
1
"""simple docstring""" import json import os from datetime import date from pathlib import Path from tabulate import DataRow, TableFormat, tabulate A_ : int =TableFormat( lineabove=None, linebelowheader=None, linebetweenrows=None, linebelow=None, headerrow=DataRow(""""""...
80
"""simple docstring""" from datasets.utils.patching import _PatchedModuleObj, patch_submodule from . import _test_patching def SCREAMING_SNAKE_CASE_ ( )-> Any: import os as original_os from os import path as original_path from os import rename as original_rename from os....
80
1
"""simple docstring""" import os import shutil import sys import tempfile import unittest from pathlib import Path import pytest import transformers from transformers import ( BERT_PRETRAINED_CONFIG_ARCHIVE_MAP, GPT2_PRETRAINED_CONFIG_ARCHIVE_MAP, AutoTokenizer, BertConfig, BertTokenizer, ...
80
"""simple docstring""" import numpy as np def SCREAMING_SNAKE_CASE_ ( snake_case : np.ndarray )-> np.ndarray: return 1 / (1 + np.exp(-vector )) def SCREAMING_SNAKE_CASE_ ( snake_case : np.ndarray )-> np.ndarray: return vector * sigmoid(snake_case ) if __na...
80
1
"""simple docstring""" from __future__ import annotations from math import pow, sqrt def SCREAMING_SNAKE_CASE_ ( snake_case : float , snake_case : float , snake_case : float )-> dict[str, float]: if (resistance, reactance, impedance).count(0 ) != 1: ...
80
"""simple docstring""" from collections import defaultdict from math import gcd def SCREAMING_SNAKE_CASE_ ( snake_case : int = 1_500_000 )-> int: _lowerCamelCase = defaultdict(snake_case ) _lowerCamelCase = 2 while 2 * euclid_m * (euclid_m + 1) <= limit: ...
80
1