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
import pyarrow.parquet as pq import pytest from datasets import Audio, Dataset, DatasetDict, Features, NamedSplit, Sequence, Value, config from datasets.features.image import Image from datasets.io.parquet import ParquetDatasetReader, ParquetDatasetWriter, get_writer_batch_size from ..utils import assert...
605
from dataclasses import dataclass, field from typing import ClassVar, Dict from ..features import Features, Sequence, Value from .base import TaskTemplate @dataclass(frozen=UpperCamelCase ) class __lowercase ( UpperCamelCase ): """simple docstring""" SCREAMING_SNAKE...
605
1
import argparse import collections import numpy as np import torch from flax import traverse_util from tax import checkpoints from transformers import MTaConfig, UMTaEncoderModel, UMTaForConditionalGeneration from transformers.utils import logging logging.set_verbosity_info() def SCREAMI...
605
def SCREAMING_SNAKE_CASE ( UpperCAmelCase__ ): """simple docstring""" def merge(UpperCAmelCase__ ,UpperCAmelCase__ ) -> list: def _merge(): while left and right: yield (left if left[0] <= right[0] else right).pop(0 ) yi...
605
1
import argparse import shutil import time from json import JSONDecodeError from logging import getLogger from pathlib import Path from typing import Dict, List import torch from torch.utils.data import DataLoader from tqdm import tqdm from transformers import AutoModelForSeqaSeqLM, AutoTokenizer fr...
605
from __future__ import annotations def SCREAMING_SNAKE_CASE ( UpperCAmelCase__ ): """simple docstring""" _SCREAMING_SNAKE_CASE = 2 _SCREAMING_SNAKE_CASE = [] while i * i <= n: if n % i: i += 1 else: n //= i ...
605
1
from transformers import HfArgumentParser, TensorFlowBenchmark, TensorFlowBenchmarkArguments def SCREAMING_SNAKE_CASE ( ): """simple docstring""" _SCREAMING_SNAKE_CASE = HfArgumentParser(UpperCAmelCase__ ) _SCREAMING_SNAKE_CASE = parser.parse_args_into_dataclas...
605
from typing import TYPE_CHECKING from ....utils import OptionalDependencyNotAvailable, _LazyModule, is_torch_available, is_vision_available snake_case : int = {'configuration_van': ['VAN_PRETRAINED_CONFIG_ARCHIVE_MAP', 'VanConfig']} try: if not is_torch_available(): ...
605
1
import gc import random import unittest import numpy as np import torch from PIL import Image from diffusers import ( DDIMScheduler, KandinskyVaaControlnetImgaImgPipeline, KandinskyVaaPriorEmbaEmbPipeline, UNetaDConditionModel, VQModel, ) from diffusers.utils import floats_ten...
605
def SCREAMING_SNAKE_CASE ( UpperCAmelCase__ = 1000 ): """simple docstring""" return sum(2 * a * ((a - 1) // 2) for a in range(3 ,n + 1 ) ) if __name__ == "__main__": print(solution())
605
1
def SCREAMING_SNAKE_CASE ( UpperCAmelCase__ ): """simple docstring""" if a < 0: raise ValueError('Input value must be a positive integer' ) elif isinstance(UpperCAmelCase__ ,UpperCAmelCase__ ): raise TypeError('Input value must be a \'int\' type' ...
605
from typing import TYPE_CHECKING from ...utils import ( OptionalDependencyNotAvailable, _LazyModule, is_flax_available, is_tf_available, is_torch_available, ) snake_case : List[str] = { 'configuration_roberta_prelayernorm': [ 'ROBERTA_PRELAYERNORM_PRETR...
605
1
import argparse import logging from collections import namedtuple import torch from model_bertabs import BertAbsSummarizer from models.model_builder import AbsSummarizer # The authors' implementation from transformers import BertTokenizer logging.basicConfig(level=logging.INFO) snake_case : ...
605
import gc import unittest from transformers import MODEL_FOR_MASKED_LM_MAPPING, TF_MODEL_FOR_MASKED_LM_MAPPING, FillMaskPipeline, pipeline from transformers.pipelines import PipelineException from transformers.testing_utils import ( is_pipeline_test, is_torch_available, nested_simplify, ...
605
1
def SCREAMING_SNAKE_CASE ( UpperCAmelCase__ ): """simple docstring""" _SCREAMING_SNAKE_CASE = [0] * len(UpperCAmelCase__ ) for i in range(1 ,len(UpperCAmelCase__ ) ): # use last results for better performance - dynamic programming _SCREAMING...
605
import glob import os import random from string import ascii_lowercase, digits import cva import numpy as np # Parrameters snake_case : Tuple = (7_20, 12_80) # Height, Width snake_case : List[Any] = (0.4, 0.6) # if height or width lower than this scale, drop it. snake_case...
605
1
import json import os import tempfile from transformers.testing_utils import check_json_file_has_correct_format class __lowercase : """simple docstring""" SCREAMING_SNAKE_CASE : Optional[int] = None def __magic_name__ ( self )-> ...
605
from dataclasses import dataclass from typing import List, Optional, Union import numpy as np import torch from ...utils import BaseOutput, OptionalDependencyNotAvailable, is_torch_available, is_transformers_available @dataclass class __lowercase ( UpperCamelCase ): """simple d...
605
1
import argparse import torch from huggingface_hub import hf_hub_download from transformers import AutoTokenizer, RobertaPreLayerNormConfig, RobertaPreLayerNormForMaskedLM from transformers.utils import logging logging.set_verbosity_info() snake_case : str = logging.get_logger(__name__) ...
605
import unittest from transformers import SPIECE_UNDERLINE from transformers.models.speechta import SpeechTaTokenizer from transformers.testing_utils import get_tests_dir, require_sentencepiece, require_tokenizers, slow from transformers.tokenization_utils import AddedToken from ...test_tokenization_commo...
605
1
import unittest from transformers import DebertaConfig, is_torch_available from transformers.testing_utils import require_sentencepiece, require_tokenizers, require_torch, slow, torch_device from ...test_configuration_common import ConfigTester from ...test_modeling_common import ModelTesterMixin, ids_ten...
605
from __future__ import annotations from typing import Any def SCREAMING_SNAKE_CASE ( UpperCAmelCase__ ): """simple docstring""" if not postfix_notation: return 0 _SCREAMING_SNAKE_CASE = {'+', '-', '*', '/'} _SCREAMING_SNAKE_CASE = [] f...
605
1
def SCREAMING_SNAKE_CASE ( UpperCAmelCase__ ,UpperCAmelCase__ ,UpperCAmelCase__ ): """simple docstring""" _SCREAMING_SNAKE_CASE = (num_of_terms / 2) * (2 * first_term + (num_of_terms - 1) * common_diff) # formula for sum of series return total def SCREAMI...
605
from __future__ import annotations class __lowercase : """simple docstring""" def __init__( self , A_ )-> None: _SCREAMING_SNAKE_CASE = data _SCREAMING_SNAKE_CASE = None _SCREAMING_SNAKE_CASE = None de...
605
1
snake_case : Optional[Any] = '0.18.2' from .configuration_utils import ConfigMixin from .utils import ( OptionalDependencyNotAvailable, is_flax_available, is_inflect_available, is_invisible_watermark_available, is_k_diffusion_available, is_k_diffusion_version, i...
605
import unittest from pathlib import Path from tempfile import NamedTemporaryFile, TemporaryDirectory from transformers import BertConfig, BertTokenizerFast, FeatureExtractionPipeline from transformers.convert_graph_to_onnx import ( convert, ensure_valid_input, generate_identified_filename, ...
605
1
# Lint as: python3 # pylint: enable=line-too-long # pylint: disable=g-import-not-at-top,g-bad-import-order,wrong-import-position snake_case : Dict = '2.13.1' import platform import pyarrow from packaging import version if version.parse(platform.python_version()) < version.parse('3.7'...
605
import os from shutil import copyfile from typing import Any, Dict, List, Optional, Tuple import sentencepiece as spm from ...tokenization_utils import AddedToken, BatchEncoding, PreTrainedTokenizer from ...utils import logging snake_case : Optional[Any] = logging.get_logger(__name__) ...
605
1
import os from shutil import copyfile from typing import Any, Dict, List, Optional, Tuple import sentencepiece as spm from ...tokenization_utils import AddedToken, BatchEncoding, PreTrainedTokenizer from ...utils import logging snake_case : Optional[Any] = logging.get_logger(__name__) ...
605
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_features_output_indices...
605
1
import argparse import json from collections import OrderedDict import torch from huggingface_hub import cached_download, hf_hub_url from transformers import AutoImageProcessor, CvtConfig, CvtForImageClassification def SCREAMING_SNAKE_CASE ( UpperCAmelCase__ ): """simple docstring"...
605
# tests directory-specific settings - this file is run automatically # by pytest before any tests are run import sys import warnings from os.path import abspath, dirname, join # allow having multiple repository checkouts and not needing to remember to rerun # 'pip install -e .[dev]' when switching bet...
605
1
from typing import TYPE_CHECKING from ...utils import OptionalDependencyNotAvailable, _LazyModule, is_tokenizers_available, is_torch_available snake_case : str = { 'configuration_nezha': ['NEZHA_PRETRAINED_CONFIG_ARCHIVE_MAP', 'NezhaConfig'], } try: if not is_torch_available(...
605
import argparse import torch from transformers import BertConfig, BertForPreTraining, load_tf_weights_in_bert from transformers.utils import logging logging.set_verbosity_info() def SCREAMING_SNAKE_CASE ( UpperCAmelCase__ ,UpperCAmelCase__ ,UpperCAmelCase__ ): """simple docstrin...
605
1
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 ( UpperCAmelCase__ ,UpperCAmelCase__ ,UpperCAmelCase__=1024 ,UpperCAmelCase__=1024 ,UpperCAmelCase__=False ,**U...
605
from __future__ import annotations def SCREAMING_SNAKE_CASE ( UpperCAmelCase__ ): """simple docstring""" if len(UpperCAmelCase__ ) == 0: return array _SCREAMING_SNAKE_CASE , _SCREAMING_SNAKE_CASE = min(UpperCAmelCase__ ), max(UpperCAmelCase__ ...
605
1
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 accelerate import Ac...
605
# Lint as: python3 # pylint: enable=line-too-long # pylint: disable=g-import-not-at-top,g-bad-import-order,wrong-import-position snake_case : Dict = '2.13.1' import platform import pyarrow from packaging import version if version.parse(platform.python_version()) < version.parse('3.7'...
605
1
# tests directory-specific settings - this file is run automatically # by pytest before any tests are run import sys import warnings from os.path import abspath, dirname, join # allow having multiple repository checkouts and not needing to remember to rerun # 'pip install -e .[dev]' when switching bet...
605
from transformers import HfArgumentParser, TensorFlowBenchmark, TensorFlowBenchmarkArguments def SCREAMING_SNAKE_CASE ( ): """simple docstring""" _SCREAMING_SNAKE_CASE = HfArgumentParser(UpperCAmelCase__ ) _SCREAMING_SNAKE_CASE = parser.parse_args_into_dataclas...
605
1
import numpy as np from PIL import Image def SCREAMING_SNAKE_CASE ( UpperCAmelCase__ ,UpperCAmelCase__ ,UpperCAmelCase__ ): """simple docstring""" _SCREAMING_SNAKE_CASE = np.array(UpperCAmelCase__ ) if arr.shape[0] != arr.shape[1]: raise ValueError('Th...
605
def SCREAMING_SNAKE_CASE ( UpperCAmelCase__ ,UpperCAmelCase__ ,UpperCAmelCase__ ): """simple docstring""" if principal <= 0: raise Exception('Principal borrowed must be > 0' ) if rate_per_annum < 0: raise Exception('Rate of interest must be >= 0' ) ...
605
1
class __lowercase : """simple docstring""" def __init__( self , A_ )-> None: _SCREAMING_SNAKE_CASE = len(A_ ) _SCREAMING_SNAKE_CASE = [0] * len_array if len_array > 0: _SCREAMING_SNAKE_CASE = array[0]...
605
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 SCREAMING_SNAKE_CASE ( UpperCAmelCase__ ,UpperCAmelCase__ ,UpperCAmelCase__ ,UpperCAmelCase__ ,UpperCAmelCase__ ): "...
605
1
import os import unittest from huggingface_hub.utils import are_progress_bars_disabled import transformers.models.bart.tokenization_bart from transformers import logging from transformers.testing_utils import CaptureLogger, mockenv, mockenv_context from transformers.utils.logging import disable_progress...
605
from dataclasses import dataclass, field from typing import ClassVar, Dict from ..features import Features, Sequence, Value from .base import TaskTemplate @dataclass(frozen=UpperCamelCase ) class __lowercase ( UpperCamelCase ): """simple docstring""" SCREAMING_SNAKE...
605
1
import random import unittest import numpy as np import torch from diffusers import ( DPMSolverMultistepScheduler, EulerAncestralDiscreteScheduler, EulerDiscreteScheduler, LMSDiscreteScheduler, OnnxStableDiffusionUpscalePipeline, PNDMScheduler, ) from diffusers.utils import...
605
def SCREAMING_SNAKE_CASE ( UpperCAmelCase__ ): """simple docstring""" def merge(UpperCAmelCase__ ,UpperCAmelCase__ ) -> list: def _merge(): while left and right: yield (left if left[0] <= right[0] else right).pop(0 ) yi...
605
1
from collections import deque class __lowercase : """simple docstring""" def __init__( self , A_ , A_ , A_ )-> None: _SCREAMING_SNAKE_CASE = process_name # process name _SCREAMING_SNAKE_CASE = arrival_time # arrival ti...
605
from __future__ import annotations def SCREAMING_SNAKE_CASE ( UpperCAmelCase__ ): """simple docstring""" _SCREAMING_SNAKE_CASE = 2 _SCREAMING_SNAKE_CASE = [] while i * i <= n: if n % i: i += 1 else: n //= i ...
605
1
from __future__ import annotations def SCREAMING_SNAKE_CASE ( UpperCAmelCase__ ,UpperCAmelCase__ ,UpperCAmelCase__ ,UpperCAmelCase__ ,UpperCAmelCase__ ,): """simple docstring""" _SCREAMING_SNAKE_CASE = len(UpperCAmelCase__ ) # If row is equal to the size of the b...
605
from typing import TYPE_CHECKING from ....utils import OptionalDependencyNotAvailable, _LazyModule, is_torch_available, is_vision_available snake_case : int = {'configuration_van': ['VAN_PRETRAINED_CONFIG_ARCHIVE_MAP', 'VanConfig']} try: if not is_torch_available(): ...
605
1
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_features_output_indices...
605
def SCREAMING_SNAKE_CASE ( UpperCAmelCase__ = 1000 ): """simple docstring""" return sum(2 * a * ((a - 1) // 2) for a in range(3 ,n + 1 ) ) if __name__ == "__main__": print(solution())
605
1
from datetime import datetime import matplotlib.pyplot as plt import torch def SCREAMING_SNAKE_CASE ( UpperCAmelCase__ ): """simple docstring""" for param in module.parameters(): _SCREAMING_SNAKE_CASE = False def SCREAMING_SNAKE_CASE ( ): ...
605
from typing import TYPE_CHECKING from ...utils import ( OptionalDependencyNotAvailable, _LazyModule, is_flax_available, is_tf_available, is_torch_available, ) snake_case : List[str] = { 'configuration_roberta_prelayernorm': [ 'ROBERTA_PRELAYERNORM_PRETR...
605
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 SCREAMING_SNAKE_CASE ( UpperCAmelCase__ ,UpperCAmelCase__ ,UpperCA...
605
import gc import unittest from transformers import MODEL_FOR_MASKED_LM_MAPPING, TF_MODEL_FOR_MASKED_LM_MAPPING, FillMaskPipeline, pipeline from transformers.pipelines import PipelineException from transformers.testing_utils import ( is_pipeline_test, is_torch_available, nested_simplify, ...
605
1
import gc import threading import time import psutil import torch class __lowercase : """simple docstring""" def __init__( self )-> Union[str, Any]: _SCREAMING_SNAKE_CASE = psutil.Process() _SCREAMING_SNAKE_CASE = False ...
605
import glob import os import random from string import ascii_lowercase, digits import cva import numpy as np # Parrameters snake_case : Tuple = (7_20, 12_80) # Height, Width snake_case : List[Any] = (0.4, 0.6) # if height or width lower than this scale, drop it. snake_case...
605
1
from collections.abc import Generator from math import sin def SCREAMING_SNAKE_CASE ( UpperCAmelCase__ ): """simple docstring""" if len(UpperCAmelCase__ ) != 32: raise ValueError('Input must be of length 32' ) _SCREAMING_SNAKE_CASE = B'' for ...
605
from dataclasses import dataclass from typing import List, Optional, Union import numpy as np import torch from ...utils import BaseOutput, OptionalDependencyNotAvailable, is_torch_available, is_transformers_available @dataclass class __lowercase ( UpperCamelCase ): """simple d...
605
1
import os from shutil import copyfile from typing import Any, Dict, List, Optional, Tuple import sentencepiece as spm from ...tokenization_utils import AddedToken, PreTrainedTokenizer from ...utils import logging snake_case : Optional[Any] = logging.get_logger(__name__) snake_case ...
605
import unittest from transformers import SPIECE_UNDERLINE from transformers.models.speechta import SpeechTaTokenizer from transformers.testing_utils import get_tests_dir, require_sentencepiece, require_tokenizers, slow from transformers.tokenization_utils import AddedToken from ...test_tokenization_commo...
605
1
from datetime import datetime as dt import os from github import Github snake_case : Union[str, Any] = [ 'good first issue', 'good second issue', 'good difficult issue', 'feature request', 'new model', 'wip', ] def SCREAMING_SNAKE_CASE ( ): ...
605
from __future__ import annotations from typing import Any def SCREAMING_SNAKE_CASE ( UpperCAmelCase__ ): """simple docstring""" if not postfix_notation: return 0 _SCREAMING_SNAKE_CASE = {'+', '-', '*', '/'} _SCREAMING_SNAKE_CASE = [] f...
605
1
import glob import os import random from string import ascii_lowercase, digits import cva import numpy as np # Parrameters snake_case : Tuple = (7_20, 12_80) # Height, Width snake_case : List[Any] = (0.4, 0.6) # if height or width lower than this scale, drop it. snake_case...
605
from __future__ import annotations class __lowercase : """simple docstring""" def __init__( self , A_ )-> None: _SCREAMING_SNAKE_CASE = data _SCREAMING_SNAKE_CASE = None _SCREAMING_SNAKE_CASE = None de...
605
1
import os from datetime import datetime as dt from github import Github snake_case : str = [ 'good first issue', 'feature request', 'wip', ] def SCREAMING_SNAKE_CASE ( ): """simple docstring""" _SCREAMING_SNAKE_CASE = Github(os.environ...
605
import unittest from pathlib import Path from tempfile import NamedTemporaryFile, TemporaryDirectory from transformers import BertConfig, BertTokenizerFast, FeatureExtractionPipeline from transformers.convert_graph_to_onnx import ( convert, ensure_valid_input, generate_identified_filename, ...
605
1
from ....configuration_utils import PretrainedConfig from ....utils import logging snake_case : str = logging.get_logger(__name__) # TODO: upload to AWS snake_case : List[str] = { 'yjernite/retribert-base-uncased': ( 'https://huggingface.co/yjernite/retribert-base...
605
import os from shutil import copyfile from typing import Any, Dict, List, Optional, Tuple import sentencepiece as spm from ...tokenization_utils import AddedToken, BatchEncoding, PreTrainedTokenizer from ...utils import logging snake_case : Optional[Any] = logging.get_logger(__name__) ...
605
1
def SCREAMING_SNAKE_CASE ( UpperCAmelCase__ ,UpperCAmelCase__ ,UpperCAmelCase__ ,UpperCAmelCase__ ,UpperCAmelCase__ ,UpperCAmelCase__ ): """simple docstring""" if index == r: for j in range(UpperCAmelCase__ ): print(data[j] ,end=' ' ) print('...
605
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_features_output_indices...
605
1
import warnings from ...utils import logging from .image_processing_owlvit import OwlViTImageProcessor snake_case : int = logging.get_logger(__name__) class __lowercase ( UpperCamelCase ): """simple docstring""" def __init__( self , *A_ , ...
605
# tests directory-specific settings - this file is run automatically # by pytest before any tests are run import sys import warnings from os.path import abspath, dirname, join # allow having multiple repository checkouts and not needing to remember to rerun # 'pip install -e .[dev]' when switching bet...
605
1
from typing import TYPE_CHECKING from ...utils import ( OptionalDependencyNotAvailable, _LazyModule, is_flax_available, is_tf_available, is_torch_available, ) snake_case : str = { 'configuration_vision_text_dual_encoder': ['VisionTextDualEncoderConfig'], 'p...
605
import argparse import torch from transformers import BertConfig, BertForPreTraining, load_tf_weights_in_bert from transformers.utils import logging logging.set_verbosity_info() def SCREAMING_SNAKE_CASE ( UpperCAmelCase__ ,UpperCAmelCase__ ,UpperCAmelCase__ ): """simple docstrin...
605
1
import warnings from ...processing_utils import ProcessorMixin from ...tokenization_utils_base import BatchEncoding class __lowercase ( UpperCamelCase ): """simple docstring""" SCREAMING_SNAKE_CASE : List[Any] = ["image_processor", "tokenizer"] SCREAM...
605
from __future__ import annotations def SCREAMING_SNAKE_CASE ( UpperCAmelCase__ ): """simple docstring""" if len(UpperCAmelCase__ ) == 0: return array _SCREAMING_SNAKE_CASE , _SCREAMING_SNAKE_CASE = min(UpperCAmelCase__ ), max(UpperCAmelCase__ ...
605
1
def SCREAMING_SNAKE_CASE ( UpperCAmelCase__ ,UpperCAmelCase__ ): """simple docstring""" return (pointa[0] - pointa[0]) ** 2 + (pointa[1] - pointa[1]) ** 2 def SCREAMING_SNAKE_CASE ( UpperCAmelCase__ ,UpperCAmelCase__=0 ): """simple docstring""" ...
605
# Lint as: python3 # pylint: enable=line-too-long # pylint: disable=g-import-not-at-top,g-bad-import-order,wrong-import-position snake_case : Dict = '2.13.1' import platform import pyarrow from packaging import version if version.parse(platform.python_version()) < version.parse('3.7'...
605
1
import math from numpy import inf from scipy.integrate import quad def SCREAMING_SNAKE_CASE ( UpperCAmelCase__ ): """simple docstring""" if num <= 0: raise ValueError('math domain error' ) return quad(UpperCAmelCase__ ,0 ,UpperCAmelCase__ ,args=(Upper...
605
from transformers import HfArgumentParser, TensorFlowBenchmark, TensorFlowBenchmarkArguments def SCREAMING_SNAKE_CASE ( ): """simple docstring""" _SCREAMING_SNAKE_CASE = HfArgumentParser(UpperCAmelCase__ ) _SCREAMING_SNAKE_CASE = parser.parse_args_into_dataclas...
605
1
import os from distutils.util import strtobool def SCREAMING_SNAKE_CASE ( UpperCAmelCase__ ,UpperCAmelCase__ ): """simple docstring""" for e in env_keys: _SCREAMING_SNAKE_CASE = int(os.environ.get(UpperCAmelCase__ ,-1 ) ) if val >= 0: ...
605
def SCREAMING_SNAKE_CASE ( UpperCAmelCase__ ,UpperCAmelCase__ ,UpperCAmelCase__ ): """simple docstring""" if principal <= 0: raise Exception('Principal borrowed must be > 0' ) if rate_per_annum < 0: raise Exception('Rate of interest must be >= 0' ) ...
605
1
import inspect import unittest from transformers import RegNetConfig, is_flax_available from transformers.testing_utils import require_flax, slow from transformers.utils import cached_property, is_vision_available from ...test_configuration_common import ConfigTester from ...test_modeling_flax_common im...
605
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 SCREAMING_SNAKE_CASE ( UpperCAmelCase__ ,UpperCAmelCase__ ,UpperCAmelCase__ ,UpperCAmelCase__ ,UpperCAmelCase__ ): "...
605
1
from __future__ import annotations from collections.abc import Callable snake_case : Optional[Any] = list[list[float | int]] def SCREAMING_SNAKE_CASE ( UpperCAmelCase__ ,UpperCAmelCase__ ): """simple docstring""" _SCREAMING_SNAKE_CASE = len(UpperCAmel...
605
from dataclasses import dataclass, field from typing import ClassVar, Dict from ..features import Features, Sequence, Value from .base import TaskTemplate @dataclass(frozen=UpperCamelCase ) class __lowercase ( UpperCamelCase ): """simple docstring""" SCREAMING_SNAKE...
605
1
from graphs.minimum_spanning_tree_kruskal import kruskal def SCREAMING_SNAKE_CASE ( ): """simple docstring""" _SCREAMING_SNAKE_CASE = 9 _SCREAMING_SNAKE_CASE = [ [0, 1, 4], [0, 7, 8], [1, 2, 8], [7, 8, 7], [7, 6, 1], ...
605
def SCREAMING_SNAKE_CASE ( UpperCAmelCase__ ): """simple docstring""" def merge(UpperCAmelCase__ ,UpperCAmelCase__ ) -> list: def _merge(): while left and right: yield (left if left[0] <= right[0] else right).pop(0 ) yi...
605
1
import copy import json import os import tempfile from transformers import is_torch_available from .test_configuration_utils import config_common_kwargs class __lowercase ( UpperCamelCase ): """simple docstring""" def __init__( self , A_ , A_=None ...
605
from __future__ import annotations def SCREAMING_SNAKE_CASE ( UpperCAmelCase__ ): """simple docstring""" _SCREAMING_SNAKE_CASE = 2 _SCREAMING_SNAKE_CASE = [] while i * i <= n: if n % i: i += 1 else: n //= i ...
605
1
def SCREAMING_SNAKE_CASE ( UpperCAmelCase__ ,UpperCAmelCase__ ): """simple docstring""" if density <= 0: raise ValueError('Impossible fluid density' ) if bulk_modulus <= 0: raise ValueError('Impossible bulk modulus' ) return (bulk_modulus / de...
605
from typing import TYPE_CHECKING from ....utils import OptionalDependencyNotAvailable, _LazyModule, is_torch_available, is_vision_available snake_case : int = {'configuration_van': ['VAN_PRETRAINED_CONFIG_ARCHIVE_MAP', 'VanConfig']} try: if not is_torch_available(): ...
605
1
import argparse import os import torch from transformers.utils import WEIGHTS_NAME snake_case : Tuple = ['small', 'medium', 'large'] snake_case : Optional[int] = 'lm_head.decoder.weight' snake_case : Optional[Any] = 'lm_head.weight' def SCREAMING_SN...
605
def SCREAMING_SNAKE_CASE ( UpperCAmelCase__ = 1000 ): """simple docstring""" return sum(2 * a * ((a - 1) // 2) for a in range(3 ,n + 1 ) ) if __name__ == "__main__": print(solution())
605
1
from dataclasses import dataclass from typing import Dict, Optional, Union import torch import torch.nn.functional as F from torch import nn from ..configuration_utils import ConfigMixin, register_to_config from ..utils import BaseOutput from .attention import BasicTransformerBlock from .attention_pro...
605
from typing import TYPE_CHECKING from ...utils import ( OptionalDependencyNotAvailable, _LazyModule, is_flax_available, is_tf_available, is_torch_available, ) snake_case : List[str] = { 'configuration_roberta_prelayernorm': [ 'ROBERTA_PRELAYERNORM_PRETR...
605
1
import math from collections import defaultdict from typing import List, Optional, Tuple, Union import numpy as np import torch from ..configuration_utils import ConfigMixin, register_to_config from .scheduling_utils import KarrasDiffusionSchedulers, SchedulerMixin, SchedulerOutput def SCREAMI...
605
import gc import unittest from transformers import MODEL_FOR_MASKED_LM_MAPPING, TF_MODEL_FOR_MASKED_LM_MAPPING, FillMaskPipeline, pipeline from transformers.pipelines import PipelineException from transformers.testing_utils import ( is_pipeline_test, is_torch_available, nested_simplify, ...
605
1
from .data_collator import ( DataCollatorForLanguageModeling, DataCollatorForPermutationLanguageModeling, DataCollatorForSeqaSeq, DataCollatorForSOP, DataCollatorForTokenClassification, DataCollatorForWholeWordMask, DataCollatorWithPadding, DefaultDataCollator, default...
605
import glob import os import random from string import ascii_lowercase, digits import cva import numpy as np # Parrameters snake_case : Tuple = (7_20, 12_80) # Height, Width snake_case : List[Any] = (0.4, 0.6) # if height or width lower than this scale, drop it. snake_case...
605
1
import argparse import glob import logging import os import time from argparse import Namespace import numpy as np import torch from lightning_base import BaseTransformer, add_generic_args, generic_train from torch.utils.data import DataLoader, TensorDataset from transformers import glue_compute_met...
605
from dataclasses import dataclass from typing import List, Optional, Union import numpy as np import torch from ...utils import BaseOutput, OptionalDependencyNotAvailable, is_torch_available, is_transformers_available @dataclass class __lowercase ( UpperCamelCase ): """simple d...
605
1
import os import re import sys import traceback import warnings from pathlib import Path from typing import Dict, Optional, Union from uuid import uuida from huggingface_hub import HfFolder, ModelCard, ModelCardData, hf_hub_download, whoami from huggingface_hub.file_download import REGEX_COMMIT_HASH f...
605
import unittest from transformers import SPIECE_UNDERLINE from transformers.models.speechta import SpeechTaTokenizer from transformers.testing_utils import get_tests_dir, require_sentencepiece, require_tokenizers, slow from transformers.tokenization_utils import AddedToken from ...test_tokenization_commo...
605
1
from math import ceil def SCREAMING_SNAKE_CASE ( UpperCAmelCase__ ,UpperCAmelCase__ ): """simple docstring""" _SCREAMING_SNAKE_CASE = list(range(0 ,UpperCAmelCase__ ) ) _SCREAMING_SNAKE_CASE = [item for sublist in list(device_map.values() ) for item ...
605
from __future__ import annotations from typing import Any def SCREAMING_SNAKE_CASE ( UpperCAmelCase__ ): """simple docstring""" if not postfix_notation: return 0 _SCREAMING_SNAKE_CASE = {'+', '-', '*', '/'} _SCREAMING_SNAKE_CASE = [] f...
605
1
import importlib.util import os import platform from argparse import ArgumentParser import huggingface_hub from .. import __version__ as version from ..utils import ( is_accelerate_available, is_flax_available, is_safetensors_available, is_tf_available, is_torch_available, ) f...
605
from __future__ import annotations class __lowercase : """simple docstring""" def __init__( self , A_ )-> None: _SCREAMING_SNAKE_CASE = data _SCREAMING_SNAKE_CASE = None _SCREAMING_SNAKE_CASE = None de...
605
1
from PIL import Image def SCREAMING_SNAKE_CASE ( UpperCAmelCase__ ,UpperCAmelCase__ ): """simple docstring""" def brightness(UpperCAmelCase__ ) -> float: return 128 + level + (c - 128) if not -2_5_5.0 <= level <= 2_5_5.0: raise ValueError('level ...
605
import unittest from pathlib import Path from tempfile import NamedTemporaryFile, TemporaryDirectory from transformers import BertConfig, BertTokenizerFast, FeatureExtractionPipeline from transformers.convert_graph_to_onnx import ( convert, ensure_valid_input, generate_identified_filename, ...
605
1
import unittest from pathlib import Path from tempfile import NamedTemporaryFile, TemporaryDirectory from transformers import BertConfig, BertTokenizerFast, FeatureExtractionPipeline from transformers.convert_graph_to_onnx import ( convert, ensure_valid_input, generate_identified_filename, ...
605
import os from shutil import copyfile from typing import Any, Dict, List, Optional, Tuple import sentencepiece as spm from ...tokenization_utils import AddedToken, BatchEncoding, PreTrainedTokenizer from ...utils import logging snake_case : Optional[Any] = logging.get_logger(__name__) ...
605
1
# Copyright 2023 The HuggingFace Inc. team. All rights reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless re...
605
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_features_output_indices...
605
1
from ...configuration_utils import PretrainedConfig from ...utils import logging snake_case : str = logging.get_logger(__name__) snake_case : Tuple = { 'microsoft/cvt-13': 'https://huggingface.co/microsoft/cvt-13/resolve/main/config.json', # See all Cvt models at https...
605
# tests directory-specific settings - this file is run automatically # by pytest before any tests are run import sys import warnings from os.path import abspath, dirname, join # allow having multiple repository checkouts and not needing to remember to rerun # 'pip install -e .[dev]' when switching bet...
605
1
import unittest from transformers import PegasusTokenizer, PegasusTokenizerFast from transformers.testing_utils import get_tests_dir, require_sentencepiece, require_tokenizers, require_torch, slow from transformers.utils import cached_property from ...test_tokenization_common import TokenizerTesterMixin ...
605
import argparse import torch from transformers import BertConfig, BertForPreTraining, load_tf_weights_in_bert from transformers.utils import logging logging.set_verbosity_info() def SCREAMING_SNAKE_CASE ( UpperCAmelCase__ ,UpperCAmelCase__ ,UpperCAmelCase__ ): """simple docstrin...
605
1
from dataclasses import dataclass from typing import List, Optional, Union import numpy as np import PIL from PIL import Image from ...utils import ( BaseOutput, OptionalDependencyNotAvailable, is_flax_available, is_k_diffusion_available, is_k_diffusion_version, is_onnx_avai...
605
from __future__ import annotations def SCREAMING_SNAKE_CASE ( UpperCAmelCase__ ): """simple docstring""" if len(UpperCAmelCase__ ) == 0: return array _SCREAMING_SNAKE_CASE , _SCREAMING_SNAKE_CASE = min(UpperCAmelCase__ ), max(UpperCAmelCase__ ...
605
1
def SCREAMING_SNAKE_CASE ( UpperCAmelCase__ ): """simple docstring""" _SCREAMING_SNAKE_CASE = 1 _SCREAMING_SNAKE_CASE = 2 while i * i <= n: _SCREAMING_SNAKE_CASE = 0 while n % i == 0: n //= i multiplicity += 1 ...
605
# Lint as: python3 # pylint: enable=line-too-long # pylint: disable=g-import-not-at-top,g-bad-import-order,wrong-import-position snake_case : Dict = '2.13.1' import platform import pyarrow from packaging import version if version.parse(platform.python_version()) < version.parse('3.7'...
605
1
from ....configuration_utils import PretrainedConfig from ....utils import logging snake_case : List[str] = logging.get_logger(__name__) snake_case : str = { 'speechbrain/m-ctc-t-large': 'https://huggingface.co/speechbrain/m-ctc-t-large/resolve/main/config.json', # See...
605
from transformers import HfArgumentParser, TensorFlowBenchmark, TensorFlowBenchmarkArguments def SCREAMING_SNAKE_CASE ( ): """simple docstring""" _SCREAMING_SNAKE_CASE = HfArgumentParser(UpperCAmelCase__ ) _SCREAMING_SNAKE_CASE = parser.parse_args_into_dataclas...
605
1
from __future__ import annotations import collections import pprint from pathlib import Path def SCREAMING_SNAKE_CASE ( UpperCAmelCase__ ): """simple docstring""" return "".join(sorted(UpperCAmelCase__ ) ) def SCREAMING_SNAKE_CASE ( UpperCAmelCase__ ...
605
def SCREAMING_SNAKE_CASE ( UpperCAmelCase__ ,UpperCAmelCase__ ,UpperCAmelCase__ ): """simple docstring""" if principal <= 0: raise Exception('Principal borrowed must be > 0' ) if rate_per_annum < 0: raise Exception('Rate of interest must be >= 0' ) ...
605
1
class __lowercase : """simple docstring""" def __init__( self , A_ )-> Any: # we need a list not a string, so do something to change the type _SCREAMING_SNAKE_CASE = arr.split(',' ) def __magic_name__ ( self ...
605
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 SCREAMING_SNAKE_CASE ( UpperCAmelCase__ ,UpperCAmelCase__ ,UpperCAmelCase__ ,UpperCAmelCase__ ,UpperCAmelCase__ ): "...
605
1
import math from collections import defaultdict from typing import List, Optional, Tuple, Union import numpy as np import torch from ..configuration_utils import ConfigMixin, register_to_config from .scheduling_utils import KarrasDiffusionSchedulers, SchedulerMixin, SchedulerOutput def SCREAMI...
605
from dataclasses import dataclass, field from typing import ClassVar, Dict from ..features import Features, Sequence, Value from .base import TaskTemplate @dataclass(frozen=UpperCamelCase ) class __lowercase ( UpperCamelCase ): """simple docstring""" SCREAMING_SNAKE...
605
1
import json import os from functools import lru_cache from typing import List, Optional, Tuple import regex as re from ...tokenization_utils import AddedToken, PreTrainedTokenizer from ...utils import logging snake_case : Any = logging.get_logger(__name__) snake_case : Opti...
605
def SCREAMING_SNAKE_CASE ( UpperCAmelCase__ ): """simple docstring""" def merge(UpperCAmelCase__ ,UpperCAmelCase__ ) -> list: def _merge(): while left and right: yield (left if left[0] <= right[0] else right).pop(0 ) yi...
605
1
class __lowercase : """simple docstring""" def __init__( self )-> Optional[int]: _SCREAMING_SNAKE_CASE = {} def __magic_name__ ( self )-> None: print(self.vertex ) for i in self.vertex: ...
605
from __future__ import annotations def SCREAMING_SNAKE_CASE ( UpperCAmelCase__ ): """simple docstring""" _SCREAMING_SNAKE_CASE = 2 _SCREAMING_SNAKE_CASE = [] while i * i <= n: if n % i: i += 1 else: n //= i ...
605
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 ...modeling_outputs import ( BackboneOutput, BaseModelOutputWithNoAttention, BaseMod...
605
from typing import TYPE_CHECKING from ....utils import OptionalDependencyNotAvailable, _LazyModule, is_torch_available, is_vision_available snake_case : int = {'configuration_van': ['VAN_PRETRAINED_CONFIG_ARCHIVE_MAP', 'VanConfig']} try: if not is_torch_available(): ...
605
1
# tests directory-specific settings - this file is run automatically # by pytest before any tests are run import sys import warnings from os.path import abspath, dirname, join # allow having multiple repository checkouts and not needing to remember to rerun # 'pip install -e .[dev]' when switching bet...
605
def SCREAMING_SNAKE_CASE ( UpperCAmelCase__ = 1000 ): """simple docstring""" return sum(2 * a * ((a - 1) // 2) for a in range(3 ,n + 1 ) ) if __name__ == "__main__": print(solution())
605
1
import dataclasses import json import sys import types from argparse import ArgumentDefaultsHelpFormatter, ArgumentParser, ArgumentTypeError from copy import copy from enum import Enum from inspect import isclass from pathlib import Path from typing import Any, Callable, Dict, Iterable, List, Literal, Ne...
605
from typing import TYPE_CHECKING from ...utils import ( OptionalDependencyNotAvailable, _LazyModule, is_flax_available, is_tf_available, is_torch_available, ) snake_case : List[str] = { 'configuration_roberta_prelayernorm': [ 'ROBERTA_PRELAYERNORM_PRETR...
605
1
import collections from typing import List, Optional, Union from ...tokenization_utils_base import BatchEncoding from ...utils import TensorType, add_end_docstrings, add_start_docstrings, logging from ..bert.tokenization_bert import BertTokenizer snake_case : int = logging.get_logger(__nam...
605
import gc import unittest from transformers import MODEL_FOR_MASKED_LM_MAPPING, TF_MODEL_FOR_MASKED_LM_MAPPING, FillMaskPipeline, pipeline from transformers.pipelines import PipelineException from transformers.testing_utils import ( is_pipeline_test, is_torch_available, nested_simplify, ...
605
1
from typing import TYPE_CHECKING from ...utils import ( OptionalDependencyNotAvailable, _LazyModule, is_torch_available, ) snake_case : List[str] = { 'configuration_falcon': ['FALCON_PRETRAINED_CONFIG_ARCHIVE_MAP', 'FalconConfig'], } try: if not is_torch_avail...
605
import glob import os import random from string import ascii_lowercase, digits import cva import numpy as np # Parrameters snake_case : Tuple = (7_20, 12_80) # Height, Width snake_case : List[Any] = (0.4, 0.6) # if height or width lower than this scale, drop it. snake_case...
605
1
import logging import os import random import sys from dataclasses import dataclass, field from typing import Optional import datasets import numpy as np import pandas as pd from datasets import load_dataset import transformers from transformers import ( AutoConfig, BartForSequenceClassif...
605
from dataclasses import dataclass from typing import List, Optional, Union import numpy as np import torch from ...utils import BaseOutput, OptionalDependencyNotAvailable, is_torch_available, is_transformers_available @dataclass class __lowercase ( UpperCamelCase ): """simple d...
605
1
from __future__ import annotations class __lowercase : """simple docstring""" def __init__( self , A_ )-> None: _SCREAMING_SNAKE_CASE = data _SCREAMING_SNAKE_CASE = None _SCREAMING_SNAKE_CASE = None de...
605
import unittest from transformers import SPIECE_UNDERLINE from transformers.models.speechta import SpeechTaTokenizer from transformers.testing_utils import get_tests_dir, require_sentencepiece, require_tokenizers, slow from transformers.tokenization_utils import AddedToken from ...test_tokenization_commo...
605
1
import comet # From: unbabel-comet import torch import datasets snake_case : Any = datasets.logging.get_logger(__name__) snake_case : Tuple = '\\n@inproceedings{rei-EtAl:2020:WMT,\n author = {Rei, Ricardo and Stewart, Craig and Farinha, Ana C and Lavie, Alon},\n ...
605
from __future__ import annotations from typing import Any def SCREAMING_SNAKE_CASE ( UpperCAmelCase__ ): """simple docstring""" if not postfix_notation: return 0 _SCREAMING_SNAKE_CASE = {'+', '-', '*', '/'} _SCREAMING_SNAKE_CASE = [] f...
605
1
import json import os import shutil import tempfile import unittest import numpy as np import pytest from transformers import CLIPTokenizer, CLIPTokenizerFast from transformers.models.clip.tokenization_clip import VOCAB_FILES_NAMES from transformers.testing_utils import require_vision from transform...
605
from __future__ import annotations class __lowercase : """simple docstring""" def __init__( self , A_ )-> None: _SCREAMING_SNAKE_CASE = data _SCREAMING_SNAKE_CASE = None _SCREAMING_SNAKE_CASE = None de...
605
1
from typing import Dict from transformers import EvalPrediction, HfArgumentParser, TrainingArguments, is_torch_available from transformers.testing_utils import ( TestCasePlus, execute_subprocess_async, get_torch_dist_unique_port, require_torch_multi_gpu, require_torch_neuroncore, ) ...
605
import unittest from pathlib import Path from tempfile import NamedTemporaryFile, TemporaryDirectory from transformers import BertConfig, BertTokenizerFast, FeatureExtractionPipeline from transformers.convert_graph_to_onnx import ( convert, ensure_valid_input, generate_identified_filename, ...
605
1
def SCREAMING_SNAKE_CASE ( ): """simple docstring""" _SCREAMING_SNAKE_CASE = 0 for i in range(1 ,1001 ): total += i**i return str(UpperCAmelCase__ )[-10:] if __name__ == "__main__": print(solution())
605
import os from shutil import copyfile from typing import Any, Dict, List, Optional, Tuple import sentencepiece as spm from ...tokenization_utils import AddedToken, BatchEncoding, PreTrainedTokenizer from ...utils import logging snake_case : Optional[Any] = logging.get_logger(__name__) ...
605
1
import os from typing import Any, Callable, Dict, List, Optional, Tuple, Union import torch from torch import nn from ...models.controlnet import ControlNetModel, ControlNetOutput from ...models.modeling_utils import ModelMixin from ...utils import logging snake_case : Union[str, Any] ...
605
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_features_output_indices...
605
1
from numpy import exp, pi, sqrt def SCREAMING_SNAKE_CASE ( UpperCAmelCase__ ,UpperCAmelCase__ = 0.0 ,UpperCAmelCase__ = 1.0 ): """simple docstring""" return 1 / sqrt(2 * pi * sigma**2 ) * exp(-((x - mu) ** 2) / (2 * sigma**2) ) if __name__ == "__main__": ...
605
# tests directory-specific settings - this file is run automatically # by pytest before any tests are run import sys import warnings from os.path import abspath, dirname, join # allow having multiple repository checkouts and not needing to remember to rerun # 'pip install -e .[dev]' when switching bet...
605
1
from __future__ import annotations import math def SCREAMING_SNAKE_CASE ( UpperCAmelCase__ ): """simple docstring""" if num <= 0: _SCREAMING_SNAKE_CASE = f'''{num}: Invalid input, please enter a positive integer.''' raise ValueError(UpperCAmelCase__...
605
import argparse import torch from transformers import BertConfig, BertForPreTraining, load_tf_weights_in_bert from transformers.utils import logging logging.set_verbosity_info() def SCREAMING_SNAKE_CASE ( UpperCAmelCase__ ,UpperCAmelCase__ ,UpperCAmelCase__ ): """simple docstrin...
605
1
import math import time from typing import Dict, List, Optional from torch.utils.data import Dataset from transformers import SeqaSeqTrainer, is_torch_tpu_available from transformers.trainer_utils import PredictionOutput, speed_metrics if is_torch_tpu_available(check_device=False): import to...
605
from __future__ import annotations def SCREAMING_SNAKE_CASE ( UpperCAmelCase__ ): """simple docstring""" if len(UpperCAmelCase__ ) == 0: return array _SCREAMING_SNAKE_CASE , _SCREAMING_SNAKE_CASE = min(UpperCAmelCase__ ), max(UpperCAmelCase__ ...
605
1
from __future__ import annotations from math import pi from typing import Protocol import matplotlib.pyplot as plt import numpy as np class __lowercase ( UpperCamelCase ): """simple docstring""" def __magic_name__ ( self , A_ )-> float: ...
605
# Lint as: python3 # pylint: enable=line-too-long # pylint: disable=g-import-not-at-top,g-bad-import-order,wrong-import-position snake_case : Dict = '2.13.1' import platform import pyarrow from packaging import version if version.parse(platform.python_version()) < version.parse('3.7'...
605
1
import warnings from diffusers import StableDiffusionInpaintPipeline as StableDiffusionInpaintPipeline # noqa F401 warnings.warn( 'The `inpainting.py` script is outdated. Please use directly `from diffusers import' ' StableDiffusionInpaintPipeline` instead.' )
605
from transformers import HfArgumentParser, TensorFlowBenchmark, TensorFlowBenchmarkArguments def SCREAMING_SNAKE_CASE ( ): """simple docstring""" _SCREAMING_SNAKE_CASE = HfArgumentParser(UpperCAmelCase__ ) _SCREAMING_SNAKE_CASE = parser.parse_args_into_dataclas...
605
1
import logging import random import ray from transformers import RagConfig, RagRetriever, RagTokenizer from transformers.models.rag.retrieval_rag import CustomHFIndex snake_case : List[Any] = logging.getLogger(__name__) class __lowercase : """simple docstring""" ...
605
def SCREAMING_SNAKE_CASE ( UpperCAmelCase__ ,UpperCAmelCase__ ,UpperCAmelCase__ ): """simple docstring""" if principal <= 0: raise Exception('Principal borrowed must be > 0' ) if rate_per_annum < 0: raise Exception('Rate of interest must be >= 0' ) ...
605
1
def SCREAMING_SNAKE_CASE ( UpperCAmelCase__ ): """simple docstring""" if not nums: # Makes sure that the list is not empty raise ValueError('List is empty' ) _SCREAMING_SNAKE_CASE = sum(UpperCAmelCase__ ) / len(UpperCAmelCase__ ) # Calculate the av...
605
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 SCREAMING_SNAKE_CASE ( UpperCAmelCase__ ,UpperCAmelCase__ ,UpperCAmelCase__ ,UpperCAmelCase__ ,UpperCAmelCase__ ): "...
605
1
from unittest import TestCase from datasets import Dataset from minhash_deduplication import deduplicate_dataset, make_duplicate_clusters def SCREAMING_SNAKE_CASE ( ): """simple docstring""" _SCREAMING_SNAKE_CASE = { 'repo_name': ['test_repo1', 'test_repo2', '...
605
from dataclasses import dataclass, field from typing import ClassVar, Dict from ..features import Features, Sequence, Value from .base import TaskTemplate @dataclass(frozen=UpperCamelCase ) class __lowercase ( UpperCamelCase ): """simple docstring""" SCREAMING_SNAKE...
605
1
import argparse import torch from transformers import BertConfig, BertForPreTraining, load_tf_weights_in_bert from transformers.utils import logging logging.set_verbosity_info() def SCREAMING_SNAKE_CASE ( UpperCAmelCase__ ,UpperCAmelCase__ ,UpperCAmelCase__ ): """simple docstrin...
605
def SCREAMING_SNAKE_CASE ( UpperCAmelCase__ ): """simple docstring""" def merge(UpperCAmelCase__ ,UpperCAmelCase__ ) -> list: def _merge(): while left and right: yield (left if left[0] <= right[0] else right).pop(0 ) yi...
605
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 __lowercase ( unittest.TestCase ): """simple docstring""" ...
605
from __future__ import annotations def SCREAMING_SNAKE_CASE ( UpperCAmelCase__ ): """simple docstring""" _SCREAMING_SNAKE_CASE = 2 _SCREAMING_SNAKE_CASE = [] while i * i <= n: if n % i: i += 1 else: n //= i ...
605
1
import colorsys from PIL import Image # type: ignore def SCREAMING_SNAKE_CASE ( UpperCAmelCase__ ,UpperCAmelCase__ ,UpperCAmelCase__ ): """simple docstring""" _SCREAMING_SNAKE_CASE = x _SCREAMING_SNAKE_CASE = y for step in range(UpperCAmelCase__ ): ...
605
from typing import TYPE_CHECKING from ....utils import OptionalDependencyNotAvailable, _LazyModule, is_torch_available, is_vision_available snake_case : int = {'configuration_van': ['VAN_PRETRAINED_CONFIG_ARCHIVE_MAP', 'VanConfig']} try: if not is_torch_available(): ...
605
1
import json import os import re import unicodedata from json.encoder import INFINITY from typing import Any, Dict, List, Optional, Tuple, Union import numpy as np import regex from ...tokenization_utils import AddedToken, PreTrainedTokenizer from ...tokenization_utils_base import BatchEncoding from ...
605
def SCREAMING_SNAKE_CASE ( UpperCAmelCase__ = 1000 ): """simple docstring""" return sum(2 * a * ((a - 1) // 2) for a in range(3 ,n + 1 ) ) if __name__ == "__main__": print(solution())
605
1
from typing import List, Union import numpy as np from ..utils import add_end_docstrings, is_torch_available, is_vision_available, logging, requires_backends from .base import PIPELINE_INIT_ARGS, Pipeline if is_vision_available(): from PIL import Image from ..image_utils import load_...
605
from typing import TYPE_CHECKING from ...utils import ( OptionalDependencyNotAvailable, _LazyModule, is_flax_available, is_tf_available, is_torch_available, ) snake_case : List[str] = { 'configuration_roberta_prelayernorm': [ 'ROBERTA_PRELAYERNORM_PRETR...
605
1
from collections import OrderedDict from typing import TYPE_CHECKING, Any, List, Mapping, Optional from packaging import version if TYPE_CHECKING: from ... import PreTrainedTokenizer, TensorType from ...configuration_utils import PretrainedConfig from ...onnx import OnnxConfigWithPast, Patchi...
605
import gc import unittest from transformers import MODEL_FOR_MASKED_LM_MAPPING, TF_MODEL_FOR_MASKED_LM_MAPPING, FillMaskPipeline, pipeline from transformers.pipelines import PipelineException from transformers.testing_utils import ( is_pipeline_test, is_torch_available, nested_simplify, ...
605
1
from __future__ import annotations from typing import Dict from ...configuration_utils import PretrainedConfig snake_case : str = { 'susnato/ernie-m-base_pytorch': 'https://huggingface.co/susnato/ernie-m-base_pytorch/blob/main/config.json', 'susnato/ernie-m-large_pytorch': 'https...
605
import glob import os import random from string import ascii_lowercase, digits import cva import numpy as np # Parrameters snake_case : Tuple = (7_20, 12_80) # Height, Width snake_case : List[Any] = (0.4, 0.6) # if height or width lower than this scale, drop it. snake_case...
605
1
import argparse import glob import logging import os import sys import time from collections import defaultdict from pathlib import Path from typing import Dict, List, Tuple import numpy as np import pytorch_lightning as pl import torch from callbacks import SeqaSeqLoggingCallback, get_checkpoint_ca...
605
from dataclasses import dataclass from typing import List, Optional, Union import numpy as np import torch from ...utils import BaseOutput, OptionalDependencyNotAvailable, is_torch_available, is_transformers_available @dataclass class __lowercase ( UpperCamelCase ): """simple d...
605
1
from typing import TYPE_CHECKING from ...utils import OptionalDependencyNotAvailable, _LazyModule, is_tensorflow_text_available, is_torch_available snake_case : Optional[Any] = { 'configuration_ernie': ['ERNIE_PRETRAINED_CONFIG_ARCHIVE_MAP', 'ErnieConfig', 'ErnieOnnxConfig'], } try: ...
605
import unittest from transformers import SPIECE_UNDERLINE from transformers.models.speechta import SpeechTaTokenizer from transformers.testing_utils import get_tests_dir, require_sentencepiece, require_tokenizers, slow from transformers.tokenization_utils import AddedToken from ...test_tokenization_commo...
605
1
import tempfile import unittest from transformers import TaConfig, is_torch_available from transformers.testing_utils import ( require_sentencepiece, require_tokenizers, require_torch, slow, torch_device, ) from ...generation.test_utils import GenerationTesterMixin from ...test_...
605
from __future__ import annotations from typing import Any def SCREAMING_SNAKE_CASE ( UpperCAmelCase__ ): """simple docstring""" if not postfix_notation: return 0 _SCREAMING_SNAKE_CASE = {'+', '-', '*', '/'} _SCREAMING_SNAKE_CASE = [] f...
605
1
from __future__ import annotations import time snake_case : List[str] = list[tuple[int, int]] snake_case : int = [ [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...
605
from __future__ import annotations class __lowercase : """simple docstring""" def __init__( self , A_ )-> None: _SCREAMING_SNAKE_CASE = data _SCREAMING_SNAKE_CASE = None _SCREAMING_SNAKE_CASE = None de...
605
1