code
stringlengths
81
54k
code_codestyle
int64
0
721
style_context
stringlengths
91
41.9k
style_context_codestyle
int64
0
699
label
int64
0
1
'''simple docstring''' import re def __lowerCamelCase ( _lowercase ) -> list: return [char.split() for char in re.split(R"""[^ a-z A-Z 0-9 \s]""" , str_ )] def __lowerCamelCase ( _lowercase ) -> str: UpperCAmelCase : Optional[int] = split_...
672
'''simple docstring''' import math def __lowerCamelCase ( _lowercase ) -> bool: assert isinstance(_lowercase , _lowercase ) and ( number >= 0 ), "'number' must been an int and positive" if 1 < number < 4: # 2 and 3 are primes ...
672
1
'''simple docstring''' import copy import os from typing import Union from ...configuration_utils import PretrainedConfig from ...models.auto.modeling_auto import MODEL_FOR_CAUSAL_LM_MAPPING_NAMES from ...utils import logging from ..auto import CONFIG_MAPPING a : List[Any] = logging.get...
672
'''simple docstring''' def __lowerCamelCase ( _lowercase = "The quick brown fox jumps over the lazy dog" , ) -> bool: UpperCAmelCase : Union[str, Any] = set() # Replace all the whitespace in our sentence UpperCAmelCase : List[str] = input_str.rep...
672
1
'''simple docstring''' import unittest import numpy as np import torch from diffusers import VersatileDiffusionImageVariationPipeline from diffusers.utils.testing_utils import load_image, require_torch_gpu, slow, torch_device a : Tuple = False class UpperCamelCase_ ( unit...
672
'''simple docstring''' from sklearn.metrics import mean_squared_error import datasets a : Union[str, Any] = """\ @article{scikit-learn, title={Scikit-learn: Machine Learning in {P}ython}, author={Pedregosa, F. and Varoquaux, G. and Gramfort, A. and Michel, V. and Thirion, B. ...
672
1
'''simple docstring''' from abc import ABC, abstractmethod from argparse import ArgumentParser class UpperCamelCase_ ( __magic_name__ ): @staticmethod @abstractmethod def _lowercase( A ) -> List[Any]: raise NotImplementedError() @abstractmethod def ...
672
'''simple docstring''' from ...configuration_utils import PretrainedConfig from ...utils import logging a : str = logging.get_logger(__name__) a : Any = { """google/fnet-base""": """https://huggingface.co/google/fnet-base/resolve/main/config.json""", """goo...
672
1
'''simple docstring''' import doctest import logging import os import unittest from pathlib import Path from typing import List, Union import transformers from transformers.testing_utils import require_tf, require_torch, slow a : List[Any] = logging.getLogger() @unittest.skip('Temporar...
672
'''simple docstring''' a : List[Any] = """Alexander Joslin""" import operator as op from .stack import Stack def __lowerCamelCase ( _lowercase ) -> int: UpperCAmelCase : Dict = {"""*""": op.mul, """/""": op.truediv, """+""": op.add, """-""": op.sub} ...
672
1
'''simple docstring''' import numpy as np def __lowerCamelCase ( _lowercase ) -> np.array: return (2 / (1 + np.exp(-2 * vector ))) - 1 if __name__ == "__main__": import doctest doctest.testmod()
672
'''simple docstring''' import argparse import json from collections import OrderedDict from pathlib import Path import requests import torch from huggingface_hub import hf_hub_download from PIL import Image from transformers import ( ConditionalDetrConfig, ConditionalDetrForObjectDetection, Condit...
672
1
'''simple docstring''' import math from typing import Optional import numpy as np from ...configuration_utils import PretrainedConfig from ...utils import logging a : int = logging.get_logger(__name__) a : Union[str, Any] = { """facebook/encodec_24khz""": """...
672
'''simple docstring''' from ...utils import is_torch_available, is_transformers_available if is_transformers_available() and is_torch_available(): from .pipeline_vq_diffusion import LearnedClassifierFreeSamplingEmbeddings, VQDiffusionPipeline
672
1
'''simple docstring''' from collections import deque def __lowerCamelCase ( _lowercase ) -> Optional[Any]: UpperCAmelCase : Any = len(_lowercase ) UpperCAmelCase : List[Any] = deque() UpperCAmelCase : Tuple = [False for _ in range(_lowercase )...
672
'''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(): fr...
672
1
'''simple docstring''' from math import isqrt, loga def __lowerCamelCase ( _lowercase ) -> list[int]: UpperCAmelCase : Optional[int] = [True] * max_number for i in range(2 , isqrt(max_number - 1 ) + 1 ): if is_prime[i]: for j...
672
'''simple docstring''' from collections.abc import Callable import numpy as np def __lowerCamelCase ( _lowercase , _lowercase , _lowercase , _lowercase , _lowercase ) -> np.array: UpperCAmelCase : Optional[Any] = int(np.ceil((x_end - xa) / st...
672
1
'''simple docstring''' class UpperCamelCase_ : def __init__( self ) -> Union[str, Any]: UpperCAmelCase : Optional[int] = 0 UpperCAmelCase : int = 0 UpperCAmelCase : Dict = {} def _lowercase( self , A ) -> Tup...
672
'''simple docstring''' from typing import List, Union import numpy as np from ..tokenization_utils import TruncationStrategy from ..utils import add_end_docstrings, logging from .base import PIPELINE_INIT_ARGS, ArgumentHandler, ChunkPipeline a : List[str] = logging.get_logger(__name__)...
672
1
'''simple docstring''' import jax.numpy as jnp from ...utils import logging from ..ta.modeling_flax_ta import FlaxTaEncoderModel, FlaxTaForConditionalGeneration, FlaxTaModel from .configuration_mta import MTaConfig a : List[Any] = logging.get_logger(__name__) a : str ...
672
'''simple docstring''' 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 Tok...
672
1
'''simple docstring''' import json import os import subprocess import unittest from ast import literal_eval import pytest from parameterized import parameterized_class from . import is_sagemaker_available if is_sagemaker_available(): from sagemaker import Session, TrainingJobAnalytics from sag...
672
'''simple docstring''' import inspect import unittest from transformers import ConvNextVaConfig from transformers.models.auto import get_values from transformers.models.auto.modeling_auto import MODEL_FOR_BACKBONE_MAPPING_NAMES, MODEL_MAPPING_NAMES from transformers.testing_utils import require_torch, require_...
672
1
'''simple docstring''' from typing import List, Optional, Union import numpy as np from ...feature_extraction_sequence_utils import SequenceFeatureExtractor from ...feature_extraction_utils import BatchFeature from ...utils import PaddingStrategy, TensorType, logging a : Optional[Any] = ...
672
'''simple docstring''' from scipy.stats import pearsonr import datasets a : str = """ Pearson correlation coefficient and p-value for testing non-correlation. The Pearson correlation coefficient measures the linear relationship between two datasets. The calculation of the p-value relies...
672
1
'''simple docstring''' def __lowerCamelCase ( _lowercase = 1_0_0_0 ) -> int: return sum(2 * a * ((a - 1) // 2) for a in range(3 , n + 1 ) ) if __name__ == "__main__": print(solution())
672
'''simple docstring''' from __future__ import annotations from collections.abc import Sequence from typing import Literal def __lowerCamelCase ( _lowercase , _lowercase ) -> str | Literal[False]: UpperCAmelCase : Optional[int] = list(_lowercase ) UpperCAmelCa...
672
1
'''simple docstring''' import argparse import hashlib # hashlib is only used inside the Test class import struct class UpperCamelCase_ : def __init__( self , A ) -> Optional[Any]: UpperCAmelCase : Any = data UpperCAmelCase : Dict = [0X67452301, 0Xe...
672
'''simple docstring''' a : Tuple = [sum(int(c, 1_0) ** 2 for c in i.__str__()) for i in range(1_0_0_0_0_0)] def __lowerCamelCase ( _lowercase ) -> int: UpperCAmelCase : str = 0 while number: # Increased Speed Slightly by checking ev...
672
1
'''simple docstring''' from copy import deepcopy from typing import Optional, Union import numpy as np from ...processing_utils import ProcessorMixin from ...tokenization_utils_base import BatchEncoding from ...utils import TensorType, is_tf_available, is_torch_available if is_torch_available(): impo...
672
'''simple docstring''' from typing import TYPE_CHECKING from ...utils import ( OptionalDependencyNotAvailable, _LazyModule, is_flax_available, is_tensorflow_text_available, is_tf_available, is_tokenizers_available, is_torch_available, ) a : Optional[Any] = { ...
672
1
'''simple docstring''' import unittest from transformers import BertGenerationConfig, is_torch_available from transformers.testing_utils import require_torch, slow, torch_device from ...generation.test_utils import GenerationTesterMixin from ...test_configuration_common import ConfigTester from ...test_modeli...
672
'''simple docstring''' import math import random from typing import Any from .hill_climbing import SearchProblem def __lowerCamelCase ( _lowercase , _lowercase = True , _lowercase = math.inf , _lowercase = -math.inf , _lowercase = math.inf , _lowercase = ...
672
1
'''simple docstring''' import copy from dataclasses import dataclass from pathlib import Path from typing import Dict, Optional, Union @dataclass class UpperCamelCase_ : lowercase = None lowercase = False lowercase = False lowercase = False lowercase = None lowercase ...
672
'''simple docstring''' from typing import TYPE_CHECKING from ...utils import OptionalDependencyNotAvailable, _LazyModule, is_tokenizers_available, is_torch_available a : Any = { """configuration_nezha""": ["""NEZHA_PRETRAINED_CONFIG_ARCHIVE_MAP""", """NezhaConfig"""], } try: ...
672
1
'''simple docstring''' from queue import Queue from typing import TYPE_CHECKING, Optional if TYPE_CHECKING: from ..models.auto import AutoTokenizer class UpperCamelCase_ : def _lowercase( self , A ) -> Optional[int]: raise NotImplementedError() def _l...
672
'''simple docstring''' import unittest import numpy as np import torch from diffusers import VersatileDiffusionImageVariationPipeline from diffusers.utils.testing_utils import load_image, require_torch_gpu, slow, torch_device a : Tuple = False class UpperCamelCase_ ( unit...
672
1
'''simple docstring''' import math def __lowerCamelCase ( ) -> None: UpperCAmelCase : str = input("""Enter message: """ ) UpperCAmelCase : Union[str, Any] = int(input(F'''Enter key [2-{len(_lowercase ) - 1}]: ''' ) ) UpperCAmelCase : Dict = in...
672
'''simple docstring''' # Lint as: python3 import sys from collections.abc import Mapping from typing import TYPE_CHECKING, Dict, Optional import numpy as np import pyarrow as pa from .. import config from ..utils.logging import get_logger from ..utils.py_utils import map_nested from .formatting import TensorF...
672
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 : Optional[int] = logging.get_logger(__name__) a : Any = ...
672
'''simple docstring''' from datetime import datetime as dt import os from github import Github a : int = [ """good first issue""", """good second issue""", """good difficult issue""", """feature request""", """new model""", """wip""", ] def __lowerCamelCase...
672
1
'''simple docstring''' import inspect import unittest from transformers import ConvNextVaConfig from transformers.models.auto import get_values from transformers.models.auto.modeling_auto import MODEL_FOR_BACKBONE_MAPPING_NAMES, MODEL_MAPPING_NAMES from transformers.testing_utils import require_torch, require_...
672
'''simple docstring''' import unittest from parameterized import parameterized from transformers import OpenLlamaConfig, is_torch_available, set_seed from transformers.testing_utils import require_torch, torch_device from ...generation.test_utils import GenerationTesterMixin from ...test_configuration_common...
672
1
'''simple docstring''' from collections import deque class UpperCamelCase_ : def __init__( self , A , A , A ) -> None: UpperCAmelCase : str = process_name # process name UpperCAmelCase : List[Any] = arrival_time # arrival time of the process ...
672
'''simple docstring''' import math def __lowerCamelCase ( _lowercase ) -> bool: assert isinstance(_lowercase , _lowercase ) and ( number >= 0 ), "'number' must been an int and positive" if 1 < number < 4: # 2 and 3 are primes ...
672
1
'''simple docstring''' a : List[str] = [4, 1, 7, 4, 2, 6, 4, 1, 5, 3, 7, 5] a : str = [3, 7, 7, 4, 2, 6, 4, 1, 5, 3, 7, 5] a : int = { 0: """Sunday""", 1: """Monday""", 2: """Tuesday""", 3: """Wednesday""", 4: """Thursday""", ...
672
'''simple docstring''' def __lowerCamelCase ( _lowercase = "The quick brown fox jumps over the lazy dog" , ) -> bool: UpperCAmelCase : Union[str, Any] = set() # Replace all the whitespace in our sentence UpperCAmelCase : List[str] = input_str.rep...
672
1
'''simple docstring''' import gc import unittest import numpy as np import torch from transformers import CLIPTextConfig, CLIPTextModel, CLIPTokenizer from diffusers import ( AutoencoderKL, DDIMScheduler, StableDiffusionSAGPipeline, UNetaDConditionModel, ) from diffusers.utils import slow, tor...
672
'''simple docstring''' from sklearn.metrics import mean_squared_error import datasets a : Union[str, Any] = """\ @article{scikit-learn, title={Scikit-learn: Machine Learning in {P}ython}, author={Pedregosa, F. and Varoquaux, G. and Gramfort, A. and Michel, V. and Thirion, B. ...
672
1
'''simple docstring''' import argparse import gc import json import os import re import torch from huggingface_hub import hf_hub_download from transformers import AutoModelForCausalLM, AutoTokenizer, PreTrainedTokenizerFast, RwkvConfig from transformers.modeling_utils import WEIGHTS_INDEX_NAME, shard_checkpoi...
672
'''simple docstring''' from ...configuration_utils import PretrainedConfig from ...utils import logging a : str = logging.get_logger(__name__) a : Any = { """google/fnet-base""": """https://huggingface.co/google/fnet-base/resolve/main/config.json""", """goo...
672
1
'''simple docstring''' import pprint import requests a : Optional[Any] = """https://zenquotes.io/api""" def __lowerCamelCase ( ) -> list: return requests.get(API_ENDPOINT_URL + """/today""" ).json() def __lowerCamelCase ( ) -> list: ...
672
'''simple docstring''' a : List[Any] = """Alexander Joslin""" import operator as op from .stack import Stack def __lowerCamelCase ( _lowercase ) -> int: UpperCAmelCase : Dict = {"""*""": op.mul, """/""": op.truediv, """+""": op.add, """-""": op.sub} ...
672
1
'''simple docstring''' import os import re import warnings from shutil import copyfile from typing import TYPE_CHECKING, Any, Dict, List, Optional, Tuple import sentencepiece as spm from ...tokenization_utils import PreTrainedTokenizer if TYPE_CHECKING: from ...tokenization_utils_base import TextInpu...
672
'''simple docstring''' import argparse import json from collections import OrderedDict from pathlib import Path import requests import torch from huggingface_hub import hf_hub_download from PIL import Image from transformers import ( ConditionalDetrConfig, ConditionalDetrForObjectDetection, Condit...
672
1
'''simple docstring''' import contextlib import csv import json import os import sqlitea import tarfile import textwrap import zipfile import pyarrow as pa import pyarrow.parquet as pq import pytest import datasets import datasets.config @pytest.fixture(scope="""session""" ) def __lowerCamelCase ( ...
672
'''simple docstring''' from ...utils import is_torch_available, is_transformers_available if is_transformers_available() and is_torch_available(): from .pipeline_vq_diffusion import LearnedClassifierFreeSamplingEmbeddings, VQDiffusionPipeline
672
1
'''simple docstring''' import warnings from ...utils import logging from .image_processing_donut import DonutImageProcessor a : int = logging.get_logger(__name__) class UpperCamelCase_ ( __magic_name__ ): def __init__( self , *A , **A ) -> None: ...
672
'''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(): fr...
672
1
'''simple docstring''' from transformers import DistilBertTokenizer, DistilBertTokenizerFast from transformers.testing_utils import require_tokenizers, slow from ..bert.test_tokenization_bert import BertTokenizationTest @require_tokenizers class UpperCamelCase_ ( __magic_name__ ): lowercase ...
672
'''simple docstring''' from collections.abc import Callable import numpy as np def __lowerCamelCase ( _lowercase , _lowercase , _lowercase , _lowercase , _lowercase ) -> np.array: UpperCAmelCase : Optional[Any] = int(np.ceil((x_end - xa) / st...
672
1
'''simple docstring''' import unittest from transformers import is_torch_available from transformers.testing_utils import require_torch if is_torch_available(): import torch from transformers.generation import DisjunctiveConstraint @require_torch class UpperCamelCase_ ( unittest....
672
'''simple docstring''' from typing import List, Union import numpy as np from ..tokenization_utils import TruncationStrategy from ..utils import add_end_docstrings, logging from .base import PIPELINE_INIT_ARGS, ArgumentHandler, ChunkPipeline a : List[str] = logging.get_logger(__name__)...
672
1
'''simple docstring''' import argparse import pytorch_lightning as pl import torch from torch import nn from transformers import LongformerForQuestionAnswering, LongformerModel class UpperCamelCase_ ( pl.LightningModule ): def __init__( self , A ) -> Dict: super()...
672
'''simple docstring''' 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 Tok...
672
1
'''simple docstring''' import math from typing import Callable, List, Optional, Union import numpy as np import PIL import torch from PIL import Image from transformers import CLIPTextModel, CLIPTokenizer from diffusers.models import AutoencoderKL, UNetaDConditionModel from diffusers.pipelines.stable_diffusio...
672
'''simple docstring''' import inspect import unittest from transformers import ConvNextVaConfig from transformers.models.auto import get_values from transformers.models.auto.modeling_auto import MODEL_FOR_BACKBONE_MAPPING_NAMES, MODEL_MAPPING_NAMES from transformers.testing_utils import require_torch, require_...
672
1
'''simple docstring''' import json import os import shutil import tempfile from unittest import TestCase from transformers import BartTokenizer, BartTokenizerFast, DPRQuestionEncoderTokenizer, DPRQuestionEncoderTokenizerFast from transformers.models.bart.configuration_bart import BartConfig from transformers.m...
672
'''simple docstring''' from scipy.stats import pearsonr import datasets a : str = """ Pearson correlation coefficient and p-value for testing non-correlation. The Pearson correlation coefficient measures the linear relationship between two datasets. The calculation of the p-value relies...
672
1
'''simple docstring''' a : int = tuple[float, float, float] a : Optional[int] = tuple[float, float, float] def __lowerCamelCase ( _lowercase , _lowercase ) -> Vectorad: UpperCAmelCase : Any = end_pointa[0] - end_pointa[0] ...
672
'''simple docstring''' from __future__ import annotations from collections.abc import Sequence from typing import Literal def __lowerCamelCase ( _lowercase , _lowercase ) -> str | Literal[False]: UpperCAmelCase : Optional[int] = list(_lowercase ) UpperCAmelCa...
672
1
'''simple docstring''' import unittest import numpy as np import torch from diffusers import ScoreSdeVePipeline, ScoreSdeVeScheduler, UNetaDModel from diffusers.utils.testing_utils import enable_full_determinism, require_torch, slow, torch_device enable_full_determinism() class UpperCamelCase_ ( ...
672
'''simple docstring''' a : Tuple = [sum(int(c, 1_0) ** 2 for c in i.__str__()) for i in range(1_0_0_0_0_0)] def __lowerCamelCase ( _lowercase ) -> int: UpperCAmelCase : str = 0 while number: # Increased Speed Slightly by checking ev...
672
1
'''simple docstring''' import logging import os import sys from dataclasses import dataclass, field from typing import Optional import torch from datasets import load_dataset from torchvision.transforms import Compose, Lambda, Normalize, RandomHorizontalFlip, RandomResizedCrop, ToTensor from torchvision.transf...
672
'''simple docstring''' from typing import TYPE_CHECKING from ...utils import ( OptionalDependencyNotAvailable, _LazyModule, is_flax_available, is_tensorflow_text_available, is_tf_available, is_tokenizers_available, is_torch_available, ) a : Optional[Any] = { ...
672
1
'''simple docstring''' 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_c...
672
'''simple docstring''' import math import random from typing import Any from .hill_climbing import SearchProblem def __lowerCamelCase ( _lowercase , _lowercase = True , _lowercase = math.inf , _lowercase = -math.inf , _lowercase = math.inf , _lowercase = ...
672
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...
672
'''simple docstring''' from typing import TYPE_CHECKING from ...utils import OptionalDependencyNotAvailable, _LazyModule, is_tokenizers_available, is_torch_available a : Any = { """configuration_nezha""": ["""NEZHA_PRETRAINED_CONFIG_ARCHIVE_MAP""", """NezhaConfig"""], } try: ...
672
1
'''simple docstring''' from ...configuration_utils import PretrainedConfig from ...utils import logging a : str = logging.get_logger(__name__) a : Any = { """google/fnet-base""": """https://huggingface.co/google/fnet-base/resolve/main/config.json""", """goo...
672
'''simple docstring''' import unittest import numpy as np import torch from diffusers import VersatileDiffusionImageVariationPipeline from diffusers.utils.testing_utils import load_image, require_torch_gpu, slow, torch_device a : Tuple = False class UpperCamelCase_ ( unit...
672
1
'''simple docstring''' from itertools import product def __lowerCamelCase ( _lowercase , _lowercase ) -> list[int]: UpperCAmelCase : Any = sides_number UpperCAmelCase : List[Any] = max_face_number * dice_number UpperCAmelCase : int = [...
672
'''simple docstring''' # Lint as: python3 import sys from collections.abc import Mapping from typing import TYPE_CHECKING, Dict, Optional import numpy as np import pyarrow as pa from .. import config from ..utils.logging import get_logger from ..utils.py_utils import map_nested from .formatting import TensorF...
672
1
'''simple docstring''' import math import random from typing import Any from .hill_climbing import SearchProblem def __lowerCamelCase ( _lowercase , _lowercase = True , _lowercase = math.inf , _lowercase = -math.inf , _lowercase = math.inf , _lowercase = ...
672
'''simple docstring''' from datetime import datetime as dt import os from github import Github a : int = [ """good first issue""", """good second issue""", """good difficult issue""", """feature request""", """new model""", """wip""", ] def __lowerCamelCase...
672
1
'''simple docstring''' import cmath import math def __lowerCamelCase ( _lowercase , _lowercase , _lowercase , _lowercase ) -> complex: UpperCAmelCase : List[Any] = math.radians(_lowercase ) UpperCAmelCase : Union[str, Any] = math.radia...
672
'''simple docstring''' import unittest from parameterized import parameterized from transformers import OpenLlamaConfig, is_torch_available, set_seed from transformers.testing_utils import require_torch, torch_device from ...generation.test_utils import GenerationTesterMixin from ...test_configuration_common...
672
1
'''simple docstring''' import inspect import unittest from transformers import ViTHybridConfig from transformers.testing_utils import require_accelerate, require_torch, require_vision, slow, torch_device from transformers.utils import cached_property, is_torch_available, is_vision_available from ...test_confi...
672
'''simple docstring''' import math def __lowerCamelCase ( _lowercase ) -> bool: assert isinstance(_lowercase , _lowercase ) and ( number >= 0 ), "'number' must been an int and positive" if 1 < number < 4: # 2 and 3 are primes ...
672
1
'''simple docstring''' import os import tempfile import unittest from transformers import is_torch_available from transformers.testing_utils import require_torch if is_torch_available(): import torch from torch import nn from transformers import ( Adafactor, AdamW,...
672
'''simple docstring''' def __lowerCamelCase ( _lowercase = "The quick brown fox jumps over the lazy dog" , ) -> bool: UpperCAmelCase : Union[str, Any] = set() # Replace all the whitespace in our sentence UpperCAmelCase : List[str] = input_str.rep...
672
1
'''simple docstring''' import os from glob import glob import imageio import torch import torchvision import wandb from img_processing import custom_to_pil, loop_post_process, preprocess, preprocess_vqgan from loaders import load_vqgan from PIL import Image from torch import nn from transformers import CLIPMo...
672
'''simple docstring''' from sklearn.metrics import mean_squared_error import datasets a : Union[str, Any] = """\ @article{scikit-learn, title={Scikit-learn: Machine Learning in {P}ython}, author={Pedregosa, F. and Varoquaux, G. and Gramfort, A. and Michel, V. and Thirion, B. ...
672
1
'''simple docstring''' from math import pow def __lowerCamelCase ( _lowercase , _lowercase , _lowercase , _lowercase , _lowercase , ) -> tuple[int, int]: if current_sum == needed_sum: # If the sum of the powers is equal to needed_...
672
'''simple docstring''' from ...configuration_utils import PretrainedConfig from ...utils import logging a : str = logging.get_logger(__name__) a : Any = { """google/fnet-base""": """https://huggingface.co/google/fnet-base/resolve/main/config.json""", """goo...
672
1
'''simple docstring''' import re from pathlib import Path from unittest import TestCase import pytest @pytest.mark.integration class UpperCamelCase_ ( __magic_name__ ): def _lowercase( self , A ) -> Optional[int]: with open(A , encoding="""utf-8""" ) as in...
672
'''simple docstring''' a : List[Any] = """Alexander Joslin""" import operator as op from .stack import Stack def __lowerCamelCase ( _lowercase ) -> int: UpperCAmelCase : Dict = {"""*""": op.mul, """/""": op.truediv, """+""": op.add, """-""": op.sub} ...
672
1
'''simple docstring''' from __future__ import annotations from decimal import Decimal from numpy import array def __lowerCamelCase ( _lowercase ) -> list[list[float]]: UpperCAmelCase : Dict = Decimal # Check if the provided matrix has 2 rows and 2 columns # ...
672
'''simple docstring''' import argparse import json from collections import OrderedDict from pathlib import Path import requests import torch from huggingface_hub import hf_hub_download from PIL import Image from transformers import ( ConditionalDetrConfig, ConditionalDetrForObjectDetection, Condit...
672
1
'''simple docstring''' from sklearn.metrics import fa_score, matthews_corrcoef import datasets from .record_evaluation import evaluate as evaluate_record a : Union[str, Any] = """\ @article{wang2019superglue, title={SuperGLUE: A Stickier Benchmark for General-Purpose Language Underst...
672
'''simple docstring''' from ...utils import is_torch_available, is_transformers_available if is_transformers_available() and is_torch_available(): from .pipeline_vq_diffusion import LearnedClassifierFreeSamplingEmbeddings, VQDiffusionPipeline
672
1
'''simple docstring''' import unittest import torch from torch import nn from accelerate.test_utils import require_cuda from accelerate.utils.memory import find_executable_batch_size, release_memory def __lowerCamelCase ( ) -> str: raise RuntimeError("""CUDA out of memory.""" ) cl...
672
'''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(): fr...
672
1
'''simple docstring''' from typing import TYPE_CHECKING from ...utils import ( OptionalDependencyNotAvailable, _LazyModule, is_flax_available, is_tensorflow_text_available, is_tf_available, is_tokenizers_available, is_torch_available, ) a : Optional[Any] = { ...
672
'''simple docstring''' from collections.abc import Callable import numpy as np def __lowerCamelCase ( _lowercase , _lowercase , _lowercase , _lowercase , _lowercase ) -> np.array: UpperCAmelCase : Optional[Any] = int(np.ceil((x_end - xa) / st...
672
1
'''simple docstring''' from typing import Dict, Iterable, Optional, Union import numpy as np from ...image_processing_utils import BaseImageProcessor, BatchFeature, get_size_dict from ...image_transforms import normalize, rescale, resize, to_channel_dimension_format, to_pil_image from ...image_utils import ( ...
672
'''simple docstring''' from typing import List, Union import numpy as np from ..tokenization_utils import TruncationStrategy from ..utils import add_end_docstrings, logging from .base import PIPELINE_INIT_ARGS, ArgumentHandler, ChunkPipeline a : List[str] = logging.get_logger(__name__)...
672
1
'''simple docstring''' from scipy.stats import pearsonr import datasets a : str = """ Pearson correlation coefficient and p-value for testing non-correlation. The Pearson correlation coefficient measures the linear relationship between two datasets. The calculation of the p-value relies...
672
'''simple docstring''' 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 Tok...
672
1
'''simple docstring''' from ...utils import is_torch_available, is_transformers_available if is_transformers_available() and is_torch_available(): from .pipeline_vq_diffusion import LearnedClassifierFreeSamplingEmbeddings, VQDiffusionPipeline
672
'''simple docstring''' import inspect import unittest from transformers import ConvNextVaConfig from transformers.models.auto import get_values from transformers.models.auto.modeling_auto import MODEL_FOR_BACKBONE_MAPPING_NAMES, MODEL_MAPPING_NAMES from transformers.testing_utils import require_torch, require_...
672
1
'''simple docstring''' import unittest from transformers import AlbertTokenizer, AlbertTokenizerFast from transformers.testing_utils import get_tests_dir, require_sentencepiece, require_tokenizers, slow from ...test_tokenization_common import TokenizerTesterMixin a : int = get_tests_di...
672
'''simple docstring''' from scipy.stats import pearsonr import datasets a : str = """ Pearson correlation coefficient and p-value for testing non-correlation. The Pearson correlation coefficient measures the linear relationship between two datasets. The calculation of the p-value relies...
672
1
'''simple docstring''' import numpy as np def __lowerCamelCase ( _lowercase ) -> np.array: return 1 / (1 + np.exp(-vector )) def __lowerCamelCase ( _lowercase ) -> np.array: return vector * sigmoid(1.702 * vector ) if __name__ == "__main__": impor...
672
'''simple docstring''' from __future__ import annotations from collections.abc import Sequence from typing import Literal def __lowerCamelCase ( _lowercase , _lowercase ) -> str | Literal[False]: UpperCAmelCase : Optional[int] = list(_lowercase ) UpperCAmelCa...
672
1
'''simple docstring''' 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.""" )
672
'''simple docstring''' a : Tuple = [sum(int(c, 1_0) ** 2 for c in i.__str__()) for i in range(1_0_0_0_0_0)] def __lowerCamelCase ( _lowercase ) -> int: UpperCAmelCase : str = 0 while number: # Increased Speed Slightly by checking ev...
672
1
'''simple docstring''' import argparse from transformers import CLIPImageProcessor, CLIPVisionModelWithProjection from diffusers import UnCLIPImageVariationPipeline, UnCLIPPipeline if __name__ == "__main__": a : Tuple = argparse.ArgumentParser() parser.add_argument("""--...
672
'''simple docstring''' from typing import TYPE_CHECKING from ...utils import ( OptionalDependencyNotAvailable, _LazyModule, is_flax_available, is_tensorflow_text_available, is_tf_available, is_tokenizers_available, is_torch_available, ) a : Optional[Any] = { ...
672
1
'''simple docstring''' import qiskit def __lowerCamelCase ( _lowercase , _lowercase ) -> qiskit.result.counts.Counts: UpperCAmelCase : int = qiskit.Aer.get_backend("""aer_simulator""" ) # Create a Quantum Circuit acting on the q register UpperCAmelCase...
672
'''simple docstring''' import math import random from typing import Any from .hill_climbing import SearchProblem def __lowerCamelCase ( _lowercase , _lowercase = True , _lowercase = math.inf , _lowercase = -math.inf , _lowercase = math.inf , _lowercase = ...
672
1
'''simple docstring''' a : Optional[Any] = """ # Transformers installation ! pip install transformers datasets # To install from source instead of the last release, comment the command above and uncomment the following one. # ! pip install git+https://github.com/huggingface/transformers.gi...
672
'''simple docstring''' from typing import TYPE_CHECKING from ...utils import OptionalDependencyNotAvailable, _LazyModule, is_tokenizers_available, is_torch_available a : Any = { """configuration_nezha""": ["""NEZHA_PRETRAINED_CONFIG_ARCHIVE_MAP""", """NezhaConfig"""], } try: ...
672
1
'''simple docstring''' from typing import List, Union import numpy as np from ..tokenization_utils import TruncationStrategy from ..utils import add_end_docstrings, logging from .base import PIPELINE_INIT_ARGS, ArgumentHandler, ChunkPipeline a : List[str] = logging.get_logger(__name__)...
672
'''simple docstring''' import unittest import numpy as np import torch from diffusers import VersatileDiffusionImageVariationPipeline from diffusers.utils.testing_utils import load_image, require_torch_gpu, slow, torch_device a : Tuple = False class UpperCamelCase_ ( unit...
672
1
'''simple docstring''' import string def __lowerCamelCase ( _lowercase ) -> str: UpperCAmelCase : Any = """""" for i in sequence: UpperCAmelCase : str = ord(_lowercase ) if 6_5 <= extract <= 9_0: output += chr(...
672
'''simple docstring''' # Lint as: python3 import sys from collections.abc import Mapping from typing import TYPE_CHECKING, Dict, Optional import numpy as np import pyarrow as pa from .. import config from ..utils.logging import get_logger from ..utils.py_utils import map_nested from .formatting import TensorF...
672
1
'''simple docstring''' import random import unittest import numpy as np import torch from diffusers import ( DPMSolverMultistepScheduler, EulerAncestralDiscreteScheduler, EulerDiscreteScheduler, LMSDiscreteScheduler, OnnxStableDiffusionUpscalePipeline, PNDMScheduler, ) from diffusers.u...
672
'''simple docstring''' from datetime import datetime as dt import os from github import Github a : int = [ """good first issue""", """good second issue""", """good difficult issue""", """feature request""", """new model""", """wip""", ] def __lowerCamelCase...
672
1
'''simple docstring''' import argparse import json from typing import List from ltp import LTP from transformers import BertTokenizer def __lowerCamelCase ( _lowercase ) -> Any: # This defines a "chinese character" as anything in the CJK Unicode block: # https://en.wikiped...
672
'''simple docstring''' import unittest from parameterized import parameterized from transformers import OpenLlamaConfig, is_torch_available, set_seed from transformers.testing_utils import require_torch, torch_device from ...generation.test_utils import GenerationTesterMixin from ...test_configuration_common...
672
1
'''simple docstring''' import unittest from parameterized import parameterized from transformers import OpenLlamaConfig, is_torch_available, set_seed from transformers.testing_utils import require_torch, torch_device from ...generation.test_utils import GenerationTesterMixin from ...test_configuration_common...
672
'''simple docstring''' import math def __lowerCamelCase ( _lowercase ) -> bool: assert isinstance(_lowercase , _lowercase ) and ( number >= 0 ), "'number' must been an int and positive" if 1 < number < 4: # 2 and 3 are primes ...
672
1
'''simple docstring''' def __lowerCamelCase ( _lowercase ) -> bool: return credit_card_number.startswith(("""34""", """35""", """37""", """4""", """5""", """6""") ) def __lowerCamelCase ( _lowercase ) -> bool: UpperCAmelCase : List[str] = credit_card...
672
'''simple docstring''' def __lowerCamelCase ( _lowercase = "The quick brown fox jumps over the lazy dog" , ) -> bool: UpperCAmelCase : Union[str, Any] = set() # Replace all the whitespace in our sentence UpperCAmelCase : List[str] = input_str.rep...
672
1
'''simple docstring''' import itertools import random import unittest import numpy as np from transformers import WAV_2_VEC_2_PRETRAINED_MODEL_ARCHIVE_LIST, WavaVecaConfig, WavaVecaFeatureExtractor from transformers.testing_utils import require_torch, slow from ...test_sequence_feature_extraction_common impo...
672
'''simple docstring''' from sklearn.metrics import mean_squared_error import datasets a : Union[str, Any] = """\ @article{scikit-learn, title={Scikit-learn: Machine Learning in {P}ython}, author={Pedregosa, F. and Varoquaux, G. and Gramfort, A. and Michel, V. and Thirion, B. ...
672
1
'''simple docstring''' import logging from transformers.configuration_utils import PretrainedConfig a : Tuple = logging.getLogger(__name__) class UpperCamelCase_ ( __magic_name__ ): lowercase = 'masked_bert' def __init__( self , A=30522 , A=768 , A=12 ...
672
'''simple docstring''' from ...configuration_utils import PretrainedConfig from ...utils import logging a : str = logging.get_logger(__name__) a : Any = { """google/fnet-base""": """https://huggingface.co/google/fnet-base/resolve/main/config.json""", """goo...
672
1
'''simple docstring''' a : List[Any] = """Alexander Joslin""" import operator as op from .stack import Stack def __lowerCamelCase ( _lowercase ) -> int: UpperCAmelCase : Dict = {"""*""": op.mul, """/""": op.truediv, """+""": op.add, """-""": op.sub} ...
672
'''simple docstring''' a : List[Any] = """Alexander Joslin""" import operator as op from .stack import Stack def __lowerCamelCase ( _lowercase ) -> int: UpperCAmelCase : Dict = {"""*""": op.mul, """/""": op.truediv, """+""": op.add, """-""": op.sub} ...
672
1
'''simple docstring''' import argparse import gc import json import os import shutil import warnings import torch from transformers import LlamaConfig, LlamaForCausalLM, LlamaTokenizer try: from transformers import LlamaTokenizerFast except ImportError as e: warnings.warn(e) warnings.wa...
672
'''simple docstring''' import argparse import json from collections import OrderedDict from pathlib import Path import requests import torch from huggingface_hub import hf_hub_download from PIL import Image from transformers import ( ConditionalDetrConfig, ConditionalDetrForObjectDetection, Condit...
672
1
'''simple docstring''' from __future__ import annotations from collections.abc import Sequence from typing import Literal def __lowerCamelCase ( _lowercase , _lowercase ) -> str | Literal[False]: UpperCAmelCase : Optional[int] = list(_lowercase ) UpperCAmelCa...
672
'''simple docstring''' from ...utils import is_torch_available, is_transformers_available if is_transformers_available() and is_torch_available(): from .pipeline_vq_diffusion import LearnedClassifierFreeSamplingEmbeddings, VQDiffusionPipeline
672
1
'''simple docstring''' import unittest import numpy as np import torch from .utils_summarization import build_mask, compute_token_type_ids, process_story, truncate_or_pad class UpperCamelCase_ ( unittest.TestCase ): def _lowercase( self ) -> int: UpperCAmelCas...
672
'''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(): fr...
672
1
'''simple docstring''' import unittest import numpy as np import timeout_decorator # noqa from transformers import BlenderbotConfig, is_flax_available from transformers.testing_utils import jax_device, require_flax, slow from ...generation.test_flax_utils import FlaxGenerationTesterMixin from ...test_modeli...
672
'''simple docstring''' from collections.abc import Callable import numpy as np def __lowerCamelCase ( _lowercase , _lowercase , _lowercase , _lowercase , _lowercase ) -> np.array: UpperCAmelCase : Optional[Any] = int(np.ceil((x_end - xa) / st...
672
1
'''simple docstring''' from __future__ import annotations import unittest from transformers import is_tf_available from transformers.testing_utils import require_sentencepiece, require_tf, require_tokenizers, slow if is_tf_available(): import numpy as np import tensorflow as tf from tr...
672
'''simple docstring''' from typing import List, Union import numpy as np from ..tokenization_utils import TruncationStrategy from ..utils import add_end_docstrings, logging from .base import PIPELINE_INIT_ARGS, ArgumentHandler, ChunkPipeline a : List[str] = logging.get_logger(__name__)...
672
1
'''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...
672
'''simple docstring''' 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 Tok...
672
1
'''simple docstring''' import argparse import json from pathlib import Path import requests import timm import torch from huggingface_hub import hf_hub_download from PIL import Image from transformers import DeiTConfig, DeiTForImageClassificationWithTeacher, DeiTImageProcessor from transformers.utils import l...
672
'''simple docstring''' import inspect import unittest from transformers import ConvNextVaConfig from transformers.models.auto import get_values from transformers.models.auto.modeling_auto import MODEL_FOR_BACKBONE_MAPPING_NAMES, MODEL_MAPPING_NAMES from transformers.testing_utils import require_torch, require_...
672
1
'''simple docstring''' import argparse import json from pathlib import Path import requests import torch from huggingface_hub import hf_hub_download from PIL import Image from transformers import ViTConfig, ViTForImageClassification, ViTImageProcessor, ViTModel from transformers.utils import logging logging...
672
'''simple docstring''' from scipy.stats import pearsonr import datasets a : str = """ Pearson correlation coefficient and p-value for testing non-correlation. The Pearson correlation coefficient measures the linear relationship between two datasets. The calculation of the p-value relies...
672
1
'''simple docstring''' from collections import defaultdict def __lowerCamelCase ( _lowercase , _lowercase ) -> bool: UpperCAmelCase : Dict = first_str.lower().strip() UpperCAmelCase : Union[str, Any] = second_str.lower().strip() # Remove white...
672
'''simple docstring''' from __future__ import annotations from collections.abc import Sequence from typing import Literal def __lowerCamelCase ( _lowercase , _lowercase ) -> str | Literal[False]: UpperCAmelCase : Optional[int] = list(_lowercase ) UpperCAmelCa...
672
1
'''simple docstring''' import unittest from transformers import PegasusConfig, PegasusTokenizer, is_flax_available from transformers.testing_utils import require_flax, slow from ...test_configuration_common import ConfigTester from ...test_modeling_flax_common import FlaxModelTesterMixin, ids_tensor if is_f...
672
'''simple docstring''' a : Tuple = [sum(int(c, 1_0) ** 2 for c in i.__str__()) for i in range(1_0_0_0_0_0)] def __lowerCamelCase ( _lowercase ) -> int: UpperCAmelCase : str = 0 while number: # Increased Speed Slightly by checking ev...
672
1
'''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(): fr...
672
'''simple docstring''' from typing import TYPE_CHECKING from ...utils import ( OptionalDependencyNotAvailable, _LazyModule, is_flax_available, is_tensorflow_text_available, is_tf_available, is_tokenizers_available, is_torch_available, ) a : Optional[Any] = { ...
672
1
'''simple docstring''' import qiskit def __lowerCamelCase ( _lowercase , _lowercase ) -> qiskit.result.counts.Counts: UpperCAmelCase : Any = qiskit.Aer.get_backend("""aer_simulator""" ) # Create a Quantum Circuit acting on the q register UpperCAmelCase...
672
'''simple docstring''' import math import random from typing import Any from .hill_climbing import SearchProblem def __lowerCamelCase ( _lowercase , _lowercase = True , _lowercase = math.inf , _lowercase = -math.inf , _lowercase = math.inf , _lowercase = ...
672
1
'''simple docstring''' import colorsys from PIL import Image # type: ignore def __lowerCamelCase ( _lowercase , _lowercase , _lowercase ) -> float: UpperCAmelCase : List[Any] = x UpperCAmelCase : List[str] = y for step in range(_lower...
672
'''simple docstring''' from typing import TYPE_CHECKING from ...utils import OptionalDependencyNotAvailable, _LazyModule, is_tokenizers_available, is_torch_available a : Any = { """configuration_nezha""": ["""NEZHA_PRETRAINED_CONFIG_ARCHIVE_MAP""", """NezhaConfig"""], } try: ...
672
1
'''simple docstring''' import random import unittest import numpy as np import torch from transformers import CLIPTextConfig, CLIPTextModel, CLIPTokenizer from diffusers import ( AutoencoderKL, DDIMScheduler, UNetaDConditionModel, VideoToVideoSDPipeline, ) from diffusers.utils import floats_te...
672
'''simple docstring''' import unittest import numpy as np import torch from diffusers import VersatileDiffusionImageVariationPipeline from diffusers.utils.testing_utils import load_image, require_torch_gpu, slow, torch_device a : Tuple = False class UpperCamelCase_ ( unit...
672
1
'''simple docstring''' import unittest import numpy as np from transformers.testing_utils import require_torch, require_vision from transformers.utils import is_torch_available, is_vision_available from ...test_image_processing_common import ImageProcessingSavingTestMixin, prepare_image_inputs if is_torch_...
672
'''simple docstring''' # Lint as: python3 import sys from collections.abc import Mapping from typing import TYPE_CHECKING, Dict, Optional import numpy as np import pyarrow as pa from .. import config from ..utils.logging import get_logger from ..utils.py_utils import map_nested from .formatting import TensorF...
672
1
'''simple docstring''' import json import os import tempfile import transformers import datasets from utils import generate_example_dataset, get_duration a : Dict = 5_0_0_0_0_0 a , a : Optional[Any] = os.path.split(__file__) a : Optional[Any] ...
672
'''simple docstring''' from datetime import datetime as dt import os from github import Github a : int = [ """good first issue""", """good second issue""", """good difficult issue""", """feature request""", """new model""", """wip""", ] def __lowerCamelCase...
672
1
'''simple docstring''' def __lowerCamelCase ( _lowercase , _lowercase ) -> float: return base * power(_lowercase , (exponent - 1) ) if exponent else 1 if __name__ == "__main__": print("""Raise base to the power of exponent using recursion...""") a : ...
672
'''simple docstring''' import unittest from parameterized import parameterized from transformers import OpenLlamaConfig, is_torch_available, set_seed from transformers.testing_utils import require_torch, torch_device from ...generation.test_utils import GenerationTesterMixin from ...test_configuration_common...
672
1
'''simple docstring''' 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 imp...
700
'''simple docstring''' import math def __lowerCamelCase ( _lowercase ) -> bool: assert isinstance(_lowercase , _lowercase ) and ( number >= 0 ), "'number' must been an int and positive" if 1 < number < 4: # 2 and 3 are primes ...
672
0
'''simple docstring''' import numpy # List of input, output pairs a : Optional[int] = ( ((5, 2, 3), 1_5), ((6, 5, 9), 2_5), ((1_1, 1_2, 1_3), 4_1), ((1, 1, 1), 8), ((1_1, 1_2, 1_3), 4_1), ) a : Optional[int] = (((5_1_5, 2_2, 1_3...
701
'''simple docstring''' def __lowerCamelCase ( _lowercase = "The quick brown fox jumps over the lazy dog" , ) -> bool: UpperCAmelCase : Union[str, Any] = set() # Replace all the whitespace in our sentence UpperCAmelCase : List[str] = input_str.rep...
672
0
'''simple docstring''' import warnings from typing import Any, Dict, List, Optional, Union import numpy as np from ...audio_utils import mel_filter_bank, optimal_fft_length, spectrogram, window_function from ...feature_extraction_sequence_utils import SequenceFeatureExtractor from ...feature_extraction_utils ...
702
'''simple docstring''' from sklearn.metrics import mean_squared_error import datasets a : Union[str, Any] = """\ @article{scikit-learn, title={Scikit-learn: Machine Learning in {P}ython}, author={Pedregosa, F. and Varoquaux, G. and Gramfort, A. and Michel, V. and Thirion, B. ...
672
0
from typing import Any def __lowerCamelCase ( _lowercase ) -> list[Any]: if not input_list: return [] UpperCAmelCase : Any = [input_list.count(_lowercase ) for value in input_list] UpperCAmelCase : int = max(_lowercase ) # Gets the maximum ...
703
'''simple docstring''' from ...configuration_utils import PretrainedConfig from ...utils import logging a : str = logging.get_logger(__name__) a : Any = { """google/fnet-base""": """https://huggingface.co/google/fnet-base/resolve/main/config.json""", """goo...
672
0
import os from collections.abc import Iterator def __lowerCamelCase ( _lowercase = "." ) -> Iterator[str]: for dir_path, dir_names, filenames in os.walk(_lowercase ): UpperCAmelCase : Optional[int] = [d for d in dir_names if d != 'scripts' and d[0] not in '._'] ...
704
'''simple docstring''' a : List[Any] = """Alexander Joslin""" import operator as op from .stack import Stack def __lowerCamelCase ( _lowercase ) -> int: UpperCAmelCase : Dict = {"""*""": op.mul, """/""": op.truediv, """+""": op.add, """-""": op.sub} ...
672
0
'''simple docstring''' from collections import OrderedDict from typing import Mapping from ...configuration_utils import PretrainedConfig from ...onnx import OnnxConfig from ...utils import logging a : Union[str, Any] = logging.get_logger(__name__) a : Dict ...
705
'''simple docstring''' import argparse import json from collections import OrderedDict from pathlib import Path import requests import torch from huggingface_hub import hf_hub_download from PIL import Image from transformers import ( ConditionalDetrConfig, ConditionalDetrForObjectDetection, Condit...
672
0
import argparse import torch from transformers import BertConfig, BertForPreTraining, load_tf_weights_in_bert from transformers.utils import logging logging.set_verbosity_info() def __lowerCamelCase ( _lowercase , _lowercase , _lowercase ) -> str: # Initialise PyTorch...
706
'''simple docstring''' from ...utils import is_torch_available, is_transformers_available if is_transformers_available() and is_torch_available(): from .pipeline_vq_diffusion import LearnedClassifierFreeSamplingEmbeddings, VQDiffusionPipeline
672
0
'''simple docstring''' from typing import List, Union import numpy as np from ..tokenization_utils import TruncationStrategy from ..utils import add_end_docstrings, logging from .base import PIPELINE_INIT_ARGS, ArgumentHandler, ChunkPipeline a : Dict = logging.get_logger(__name__) cla...
707
'''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(): fr...
672
0
'''simple docstring''' from ...configuration_utils import PretrainedConfig from ...utils import logging a : List[str] = logging.get_logger(__name__) a : Tuple = { """SCUT-DLVCLab/lilt-roberta-en-base""": ( """https://huggingface.co/SCUT-DLVCLab/lilt-rob...
708
'''simple docstring''' from collections.abc import Callable import numpy as np def __lowerCamelCase ( _lowercase , _lowercase , _lowercase , _lowercase , _lowercase ) -> np.array: UpperCAmelCase : Optional[Any] = int(np.ceil((x_end - xa) / st...
672
0
'''simple docstring''' from dataclasses import dataclass from typing import Optional, Tuple, Union import flax import jax.numpy as jnp from jax import random from ..configuration_utils import ConfigMixin, register_to_config from ..utils import BaseOutput from .scheduling_utils_flax import FlaxSchedulerMixin ...
709
'''simple docstring''' from typing import List, Union import numpy as np from ..tokenization_utils import TruncationStrategy from ..utils import add_end_docstrings, logging from .base import PIPELINE_INIT_ARGS, ArgumentHandler, ChunkPipeline a : List[str] = logging.get_logger(__name__)...
672
0
'''simple docstring''' def __lowerCamelCase ( _lowercase , _lowercase ) -> int: while a != 0: UpperCAmelCase : Optional[Any] = b % a, a return b def __lowerCamelCase ( _lowercase , _lowercase ) -> int: if gcd(...
710
'''simple docstring''' 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 Tok...
672
0
'''simple docstring''' def __lowerCamelCase ( _lowercase = 6_0_0_8_5_1_4_7_5_1_4_3 ) -> Optional[int]: try: UpperCAmelCase : int = int(_lowerCAmelCase ) except (TypeError, ValueError): raise TypeError("""Parameter n must be int or castabl...
711
'''simple docstring''' import inspect import unittest from transformers import ConvNextVaConfig from transformers.models.auto import get_values from transformers.models.auto.modeling_auto import MODEL_FOR_BACKBONE_MAPPING_NAMES, MODEL_MAPPING_NAMES from transformers.testing_utils import require_torch, require_...
672
0