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 math def __UpperCAmelCase ( lowerCamelCase_ , lowerCamelCase_) -> int: UpperCamelCase__ : List[str] = len(lowerCamelCase_) UpperCamelCase__ : Optional[int] = int(math.floor(math.sqrt(lo...
6
'''simple docstring''' import unittest from transformers import is_torch_available, is_vision_available from transformers.testing_utils import require_torch, require_vision, slow, torch_device if is_torch_available(): import torch from transformers import AutoModelForImageClassif...
6
1
'''simple docstring''' from __future__ import annotations from collections.abc import Iterator from typing import Generic, TypeVar lowerCAmelCase__ = TypeVar('T') class __lowercase (Generic[T] ): def __init__( self : Union[str, Any]...
6
'''simple docstring''' import argparse import struct import unittest class __lowercase : def __init__( self : Tuple , UpperCAmelCase_ : bytes): UpperCamelCase__ : Dict = data # Initialize hash values UpperCamelCas...
6
1
'''simple docstring''' from __future__ import annotations def __UpperCAmelCase ( lowerCamelCase_) -> None: create_state_space_tree(lowerCamelCase_ , [] , 0 , [0 for i in range(len(lowerCamelCase_))]) def __Upp...
6
'''simple docstring''' from math import log from scipy.constants import Boltzmann, physical_constants lowerCAmelCase__ = 300 # TEMPERATURE (unit = K) def __UpperCAmelCase ( lowerCamelCase_ , lowerCamelCase_ , lowerCamelCase_ , ...
6
1
'''simple docstring''' def __UpperCAmelCase ( lowerCamelCase_ = 600_851_475_143) -> int: try: UpperCamelCase__ : Dict = int(lowerCamelCase_) except (TypeError, ValueError): raise TypeError('Parameter n must be int or castable to int.') if ...
6
'''simple docstring''' import logging import math from functools import partial from typing import Any, Callable, Dict, Iterable, List, Optional, Sequence, Tuple, Union import torch from .tensor_utils import tensor_tree_map, tree_map def __UpperCAmelCase ( lowe...
6
1
'''simple docstring''' import gc import random import tempfile import unittest import numpy as np import torch from transformers import CLIPTextConfig, CLIPTextModel, CLIPTokenizer from diffusers import AutoencoderKL, DDIMScheduler, LMSDiscreteScheduler, PNDMScheduler, UNetaDConditionM...
6
'''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_uti...
6
1
'''simple docstring''' from dataclasses import dataclass from typing import Optional, Tuple, Union import torch import torch.nn as nn from ..configuration_utils import ConfigMixin, register_to_config from ..utils import BaseOutput, apply_forward_hook from .modeling_utils import ModelMix...
6
'''simple docstring''' from typing import Union import fire import torch from tqdm import tqdm def __UpperCAmelCase ( lowerCamelCase_ , lowerCamelCase_ = "cpu" , lowerCamelCase_ = None) -> None: UpperCamelCase__ : List[Any] ...
6
1
'''simple docstring''' from typing import Any def __UpperCAmelCase ( lowerCamelCase_) -> list[Any]: if not input_list: return [] UpperCamelCase__ : Dict = [input_list.count(lowerCamelCase_) for value in input_list] UpperCamelCase__...
6
'''simple docstring''' import warnings 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 lowerCAmelCase__ = loggi...
6
1
'''simple docstring''' def __UpperCAmelCase ( lowerCamelCase_ , lowerCamelCase_ , lowerCamelCase_ , lowerCamelCase_) -> Optional[int]: global f # a global dp table for knapsack if f[i][j] < 0: if j < wt[i - 1]: UpperCamelCase__ ...
6
'''simple docstring''' def __UpperCAmelCase ( lowerCamelCase_ , lowerCamelCase_) -> list[str]: return [sentence[i : i + ngram_size] for i in range(len(lowerCamelCase_) - ngram_size + 1)] if __name__ == "__main__": from doctest import testmod testmod(...
6
1
'''simple docstring''' import json import os from pathlib import Path from shutil import copyfile from typing import Any, Dict, List, Optional, Tuple, Union import sentencepiece from ...tokenization_utils import PreTrainedTokenizer from ...utils import logging lowerCAmelCase__ ...
6
'''simple docstring''' import numpy as np from numpy import ndarray from scipy.optimize import Bounds, LinearConstraint, minimize def __UpperCAmelCase ( lowerCamelCase_) -> float: return np.dot(lowerCamelCase_ , lowerCamelCase_) cl...
6
1
'''simple docstring''' import unittest from diffusers.pipelines.pipeline_utils import is_safetensors_compatible class __lowercase (unittest.TestCase ): def __UpperCamelCase ( self : Any): UpperCamelCase__ : Any = [ ...
6
'''simple docstring''' import argparse import json from pathlib import Path import requests import torch from huggingface_hub import cached_download, hf_hub_url from PIL import Image from transformers import DPTConfig, DPTForDepthEstimation, DPTForSemanticSegmentation, DPTImageProcesso...
6
1
'''simple docstring''' import argparse import torch from datasets import load_dataset from donut import DonutModel from transformers import ( DonutImageProcessor, DonutProcessor, DonutSwinConfig, DonutSwinModel, MBartConfig, MBartForCausalLM, VisionEncod...
6
'''simple docstring''' import inspect import math import tempfile import unittest import numpy as np from transformers import ViTMAEConfig from transformers.testing_utils import require_torch, require_vision, slow, torch_device from transformers.utils import cached_property, is_torch_a...
6
1
'''simple docstring''' lowerCAmelCase__ = [ [0, 16, 13, 0, 0, 0], [0, 0, 10, 12, 0, 0], [0, 4, 0, 0, 14, 0], [0, 0, 9, 0, 0, 20], [0, 0, 0, 7, 0, 4], [0, 0, 0, 0, 0, 0], ] def __UpperCAmelCase ( lowerCamelCase_ , low...
6
'''simple docstring''' from ..utils import DummyObject, requires_backends class __lowercase (metaclass=__lowerCamelCase ): _lowerCamelCase = ['''torch''', '''scipy'''] def __init__( self : List[Any] , *UpperCAmelCase_ : Any ...
6
1
'''simple docstring''' import argparse import json import os import pickle import shutil import numpy as np import torch from distiller import Distiller from lm_seqs_dataset import LmSeqsDataset from transformers import ( BertConfig, BertForMaskedLM, BertTokenizer, ...
6
'''simple docstring''' class __lowercase : def __init__( self : List[str] , UpperCAmelCase_ : str = "" , UpperCAmelCase_ : bool = False): # Mapping from the first character of the prefix of the node UpperCamelCase__ : dict[str, Radi...
6
1
'''simple docstring''' import argparse from torch import nn # transformers_old should correspond to branch `save_old_prophetnet_model_structure` here # original prophetnet_checkpoints are saved under `patrickvonplaten/..._old` respectively from transformers_old.modeling_prophetnet import ...
6
'''simple docstring''' import gc import unittest import numpy as np import torch from transformers import CLIPTextConfig, CLIPTextModel, CLIPTokenizer from diffusers import TransformeraDModel, VQDiffusionPipeline, VQDiffusionScheduler, VQModel from diffusers.pipelines.vq_diffusion.pipel...
6
1
'''simple docstring''' def __UpperCAmelCase ( lowerCamelCase_ , lowerCamelCase_) -> bool: UpperCamelCase__ : Dict = len(lowerCamelCase_) UpperCamelCase__ : Dict = len(lowerCamelCase_) UpperCamelCase__ : Dict = [[...
6
'''simple docstring''' import numpy as np from PIL import Image def __UpperCAmelCase ( lowerCamelCase_ , lowerCamelCase_ , lowerCamelCase_) -> np.ndarray: UpperCamelCase__ : List[Any] = np.array(lowerCamelCase_) if arr.s...
6
1
'''simple docstring''' import os from typing import List, Optional, Union from ...image_processing_utils import BatchFeature from ...image_utils import ImageInput from ...processing_utils import ProcessorMixin from ...tokenization_utils_base import PaddingStrategy, PreTokenizedInput, TextI...
6
'''simple docstring''' from __future__ import annotations class __lowercase : def __init__( self : Union[str, Any] , UpperCAmelCase_ : list[list[int]]): UpperCamelCase__ : int = TypeError( 'Matrices must be formed fro...
6
1
'''simple docstring''' def __UpperCAmelCase ( lowerCamelCase_) -> set: UpperCamelCase__ : List[str] = set() # edges = list of graph's edges UpperCamelCase__ : Optional[int] = get_edges(lowerCamelCase_) # While there are still eleme...
6
'''simple docstring''' import tempfile import numpy as np import torch from transformers import AutoTokenizer, TaEncoderModel from diffusers import DDPMScheduler, UNetaDConditionModel from diffusers.models.attention_processor import AttnAddedKVProcessor from diffusers.pipelines.deepfloy...
6
1
'''simple docstring''' import argparse import logging import pickle from collections import Counter logging.basicConfig( format='%(asctime)s - %(levelname)s - %(name)s - %(message)s', datefmt='%m/%d/%Y %H:%M:%S', level=logging.INFO ) lowerCAmelCase__ = logging.getLogg...
6
'''simple docstring''' import os import random import sys from . import cryptomath_module as cryptomath from . import rabin_miller lowerCAmelCase__ = 3 def __UpperCAmelCase ( lowerCamelCase_) -> int: print('Generating primitive root o...
6
1
'''simple docstring''' import json from typing import TYPE_CHECKING, List, Optional, Tuple from tokenizers import pre_tokenizers from ...tokenization_utils_base import BatchEncoding from ...tokenization_utils_fast import PreTrainedTokenizerFast from ...utils import logging if TYPE_C...
6
'''simple docstring''' import argparse import json import os import fairseq import torch from fairseq.data import Dictionary from transformers import ( UniSpeechConfig, UniSpeechForCTC, UniSpeechForPreTraining, WavaVecaFeatureExtractor, WavaVecaPhonemeCTCTokeniz...
6
1
'''simple docstring''' # Copyright 2021 The HuggingFace Team. All rights reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/l...
6
'''simple docstring''' import gc import random import tempfile import unittest import numpy as np import torch from transformers import CLIPTextConfig, CLIPTextModel, CLIPTokenizer from diffusers import AutoencoderKL, DDIMScheduler, LMSDiscreteScheduler, PNDMScheduler, UNetaDConditionM...
6
1
'''simple docstring''' import os try: from .build_directory_md import good_file_paths except ImportError: from build_directory_md import good_file_paths # type: ignore lowerCAmelCase__ = list(good_file_paths()) assert filepaths, "good_file_paths() failed!" lowerCAm...
6
'''simple docstring''' import json import os from functools import lru_cache from typing import TYPE_CHECKING, List, Optional, Tuple import regex as re from ...tokenization_utils import AddedToken, PreTrainedTokenizer from ...utils import logging if TYPE_CHECKING: from transform...
6
1
'''simple docstring''' class __lowercase : def __init__( self : str): UpperCamelCase__ : Union[str, Any] = 0 UpperCamelCase__ : Any = 0 UpperCamelCase__ : int = {} def __UpperCamelCase ( self ...
6
'''simple docstring''' import requests from bsa import BeautifulSoup def __UpperCAmelCase ( lowerCamelCase_ = "AAPL") -> str: UpperCamelCase__ : str = f'https://in.finance.yahoo.com/quote/{symbol}?s={symbol}' UpperCamelCase__ : Opt...
6
1
'''simple docstring''' import json import os import shutil import sys import tempfile import unittest import unittest.mock as mock from pathlib import Path from huggingface_hub import HfFolder, delete_repo from requests.exceptions import HTTPError from transformers import AutoConfig...
6
'''simple docstring''' import unittest from transformers import is_torch_available, is_vision_available from transformers.testing_utils import require_torch, require_vision, slow, torch_device if is_torch_available(): import torch from transformers import AutoModelForImageClassif...
6
1
'''simple docstring''' from typing import Dict, Optional import numpy as np import datasets lowerCAmelCase__ = '\nIoU is the area of overlap between the predicted segmentation and the ground truth divided by the area of union\nbetween the predicted segmentation and the gr...
6
'''simple docstring''' import argparse import struct import unittest class __lowercase : def __init__( self : Tuple , UpperCAmelCase_ : bytes): UpperCamelCase__ : Dict = data # Initialize hash values UpperCamelCas...
6
1
'''simple docstring''' import logging import os from dataclasses import dataclass, field from functools import partial from pathlib import Path from tempfile import TemporaryDirectory from typing import List, Optional import faiss import torch from datasets import Features, Sequence, V...
6
'''simple docstring''' from math import log from scipy.constants import Boltzmann, physical_constants lowerCAmelCase__ = 300 # TEMPERATURE (unit = K) def __UpperCAmelCase ( lowerCamelCase_ , lowerCamelCase_ , lowerCamelCase_ , ...
6
1
'''simple docstring''' from scipy.stats import pearsonr import datasets lowerCAmelCase__ = '\nPearson correlation coefficient and p-value for testing non-correlation.\nThe Pearson correlation coefficient measures the linear relationship between two datasets. The calculation ...
6
'''simple docstring''' import logging import math from functools import partial from typing import Any, Callable, Dict, Iterable, List, Optional, Sequence, Tuple, Union import torch from .tensor_utils import tensor_tree_map, tree_map def __UpperCAmelCase ( lowe...
6
1
'''simple docstring''' from ...configuration_utils import PretrainedConfig from ...utils import logging lowerCAmelCase__ = logging.get_logger(__name__) lowerCAmelCase__ = { 'facebook/dpr-ctx_encoder-single-nq-base': ( 'https://huggingface.co/face...
6
'''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_uti...
6
1
'''simple docstring''' import copy import inspect import unittest from transformers import PretrainedConfig, SwiftFormerConfig from transformers.testing_utils import ( require_torch, require_vision, slow, torch_device, ) from transformers.utils import cached_property, ...
6
'''simple docstring''' from typing import Union import fire import torch from tqdm import tqdm def __UpperCAmelCase ( lowerCamelCase_ , lowerCamelCase_ = "cpu" , lowerCamelCase_ = None) -> None: UpperCamelCase__ : List[Any] ...
6
1
'''simple docstring''' import sys import turtle def __UpperCAmelCase ( lowerCamelCase_ , lowerCamelCase_) -> tuple[float, float]: return (pa[0] + pa[0]) / 2, (pa[1] + pa[1]) / 2 def __UpperCAmelCase ( lowerCamelCase_ ...
6
'''simple docstring''' import warnings 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 lowerCAmelCase__ = loggi...
6
1
'''simple docstring''' import shutil import tempfile import unittest import numpy as np import pytest from transformers import is_speech_available, is_vision_available from transformers.testing_utils import require_torch if is_vision_available(): from transformers import TvltIma...
6
'''simple docstring''' def __UpperCAmelCase ( lowerCamelCase_ , lowerCamelCase_) -> list[str]: return [sentence[i : i + ngram_size] for i in range(len(lowerCamelCase_) - ngram_size + 1)] if __name__ == "__main__": from doctest import testmod testmod(...
6
1
'''simple docstring''' import numpy as np import torch from torch.utils.data import Dataset from utils import logger class __lowercase (__lowerCamelCase ): def __init__( self : Dict , UpperCAmelCase_ : List[str] , UpperCAmelCase_ ...
6
'''simple docstring''' import numpy as np from numpy import ndarray from scipy.optimize import Bounds, LinearConstraint, minimize def __UpperCAmelCase ( lowerCamelCase_) -> float: return np.dot(lowerCamelCase_ , lowerCamelCase_) cl...
6
1
'''simple docstring''' def __UpperCAmelCase ( lowerCamelCase_ , lowerCamelCase_) -> List[str]: UpperCamelCase__ : Dict = 0 while b > 0: if b & 1: res += a a += a b >>= 1 return res def __UpperCAm...
6
'''simple docstring''' import argparse import json from pathlib import Path import requests import torch from huggingface_hub import cached_download, hf_hub_url from PIL import Image from transformers import DPTConfig, DPTForDepthEstimation, DPTForSemanticSegmentation, DPTImageProcesso...
6
1
'''simple docstring''' import requests from bsa import BeautifulSoup def __UpperCAmelCase ( lowerCamelCase_ = "https://www.worldometers.info/coronavirus") -> dict: UpperCamelCase__ : List[str] = BeautifulSoup(requests.get(lowerCamelCase_).te...
6
'''simple docstring''' import inspect import math import tempfile import unittest import numpy as np from transformers import ViTMAEConfig from transformers.testing_utils import require_torch, require_vision, slow, torch_device from transformers.utils import cached_property, is_torch_a...
6
1
'''simple docstring''' import shutil import tempfile import unittest import numpy as np from transformers.testing_utils import ( is_pt_tf_cross_test, require_tf, require_torch, require_torchvision, require_vision, ) from transformers.utils import is_tf_available...
6
'''simple docstring''' from ..utils import DummyObject, requires_backends class __lowercase (metaclass=__lowerCamelCase ): _lowerCamelCase = ['''torch''', '''scipy'''] def __init__( self : List[Any] , *UpperCAmelCase_ : Any ...
6
1
'''simple docstring''' import inspect import tempfile from collections import OrderedDict, UserDict from collections.abc import MutableMapping from contextlib import ExitStack, contextmanager from dataclasses import fields from enum import Enum from typing import Any, ContextManager, List,...
6
'''simple docstring''' class __lowercase : def __init__( self : List[str] , UpperCAmelCase_ : str = "" , UpperCAmelCase_ : bool = False): # Mapping from the first character of the prefix of the node UpperCamelCase__ : dict[str, Radi...
6
1
'''simple docstring''' import os import random import sys from . import cryptomath_module as cryptomath from . import rabin_miller lowerCAmelCase__ = 3 def __UpperCAmelCase ( lowerCamelCase_) -> int: print('Generating primitive root o...
6
'''simple docstring''' import gc import unittest import numpy as np import torch from transformers import CLIPTextConfig, CLIPTextModel, CLIPTokenizer from diffusers import TransformeraDModel, VQDiffusionPipeline, VQDiffusionScheduler, VQModel from diffusers.pipelines.vq_diffusion.pipel...
6
1
'''simple docstring''' from collections import OrderedDict from typing import TYPE_CHECKING, Any, Mapping, Optional from ...configuration_utils import PretrainedConfig from ...onnx import OnnxConfig from ...utils import logging if TYPE_CHECKING: from ... import FeatureExtractionMixi...
6
'''simple docstring''' import numpy as np from PIL import Image def __UpperCAmelCase ( lowerCamelCase_ , lowerCamelCase_ , lowerCamelCase_) -> np.ndarray: UpperCamelCase__ : List[Any] = np.array(lowerCamelCase_) if arr.s...
6
1
'''simple docstring''' import json import os from dataclasses import dataclass from functools import partial from typing import Callable import flax.linen as nn import jax import jax.numpy as jnp import joblib import optax import wandb from flax import jax_utils, struct, traverse_uti...
6
'''simple docstring''' from __future__ import annotations class __lowercase : def __init__( self : Union[str, Any] , UpperCAmelCase_ : list[list[int]]): UpperCamelCase__ : int = TypeError( 'Matrices must be formed fro...
6
1
'''simple docstring''' # Lint as: python3 # pylint: enable=line-too-long # pylint: disable=g-import-not-at-top,g-bad-import-order,wrong-import-position lowerCAmelCase__ = '2.13.1' import platform import pyarrow from packaging import version if version.parse(platform...
6
'''simple docstring''' import tempfile import numpy as np import torch from transformers import AutoTokenizer, TaEncoderModel from diffusers import DDPMScheduler, UNetaDConditionModel from diffusers.models.attention_processor import AttnAddedKVProcessor from diffusers.pipelines.deepfloy...
6
1
'''simple docstring''' import re from pathlib import Path from unittest import TestCase import pytest @pytest.mark.integration class __lowercase (__lowerCamelCase ): def __UpperCamelCase ( self : int , UpperCAmelCase_ : str)...
6
'''simple docstring''' import os import random import sys from . import cryptomath_module as cryptomath from . import rabin_miller lowerCAmelCase__ = 3 def __UpperCAmelCase ( lowerCamelCase_) -> int: print('Generating primitive root o...
6
1
'''simple docstring''' import argparse import torch from transformers import FunnelBaseModel, FunnelConfig, FunnelModel, load_tf_weights_in_funnel from transformers.utils import logging logging.set_verbosity_info() def __UpperCAmelCase ( lowerCamelCase_ ...
6
'''simple docstring''' import argparse import json import os import fairseq import torch from fairseq.data import Dictionary from transformers import ( UniSpeechConfig, UniSpeechForCTC, UniSpeechForPreTraining, WavaVecaFeatureExtractor, WavaVecaPhonemeCTCTokeniz...
6
1
'''simple docstring''' import warnings from diffusers import StableDiffusionImgaImgPipeline # noqa F401 warnings.warn( 'The `image_to_image.py` script is outdated. Please use directly `from diffusers import' ' StableDiffusionImg2ImgPipeline` instead.' )
6
'''simple docstring''' import gc import random import tempfile import unittest import numpy as np import torch from transformers import CLIPTextConfig, CLIPTextModel, CLIPTokenizer from diffusers import AutoencoderKL, DDIMScheduler, LMSDiscreteScheduler, PNDMScheduler, UNetaDConditionM...
6
1
'''simple docstring''' import logging import os import random import sys from dataclasses import dataclass, field from typing import Optional import datasets import evaluate import numpy as np from datasets import load_dataset import transformers from transformers import ( Aut...
6
'''simple docstring''' import json import os from functools import lru_cache from typing import TYPE_CHECKING, List, Optional, Tuple import regex as re from ...tokenization_utils import AddedToken, PreTrainedTokenizer from ...utils import logging if TYPE_CHECKING: from transform...
6
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_sentencepiec...
6
'''simple docstring''' import requests from bsa import BeautifulSoup def __UpperCAmelCase ( lowerCamelCase_ = "AAPL") -> str: UpperCamelCase__ : str = f'https://in.finance.yahoo.com/quote/{symbol}?s={symbol}' UpperCamelCase__ : Opt...
6
1
'''simple docstring''' from dataclasses import dataclass from typing import Optional import numpy as np import torch import torch.nn as nn from ..utils import BaseOutput, is_torch_version, randn_tensor from .attention_processor import SpatialNorm from .unet_ad_blocks import UNetMidBloc...
6
'''simple docstring''' import unittest from transformers import is_torch_available, is_vision_available from transformers.testing_utils import require_torch, require_vision, slow, torch_device if is_torch_available(): import torch from transformers import AutoModelForImageClassif...
6
1
'''simple docstring''' import math from enum import Enum from typing import Optional, Union from torch.optim import Optimizer from torch.optim.lr_scheduler import LambdaLR from .utils import logging lowerCAmelCase__ = logging.get_logger(__name__) class ...
6
'''simple docstring''' import argparse import struct import unittest class __lowercase : def __init__( self : Tuple , UpperCAmelCase_ : bytes): UpperCamelCase__ : Dict = data # Initialize hash values UpperCamelCas...
6
1
'''simple docstring''' import os def __UpperCAmelCase ( lowerCamelCase_ = "input.txt") -> int: with open(os.path.join(os.path.dirname(lowerCamelCase_) , lowerCamelCase_)) as input_file: UpperCamelCase__ : Tuple = [ [i...
6
'''simple docstring''' from math import log from scipy.constants import Boltzmann, physical_constants lowerCAmelCase__ = 300 # TEMPERATURE (unit = K) def __UpperCAmelCase ( lowerCamelCase_ , lowerCamelCase_ , lowerCamelCase_ , ...
6
1
'''simple docstring''' def __UpperCAmelCase ( lowerCamelCase_ , lowerCamelCase_ , lowerCamelCase_) -> list: UpperCamelCase__ : Tuple = len(lowerCamelCase_) UpperCamelCase__ : int = [[0] * n for i in range(lowerCamelCase_)...
6
'''simple docstring''' import logging import math from functools import partial from typing import Any, Callable, Dict, Iterable, List, Optional, Sequence, Tuple, Union import torch from .tensor_utils import tensor_tree_map, tree_map def __UpperCAmelCase ( lowe...
6
1
'''simple docstring''' from ...configuration_utils import PretrainedConfig lowerCAmelCase__ = { 'google/tapas-base-finetuned-sqa': ( 'https://huggingface.co/google/tapas-base-finetuned-sqa/resolve/main/config.json' ), 'google/tapas-base-finetuned-wtq': (...
6
'''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_uti...
6
1
'''simple docstring''' from __future__ import annotations from collections import deque from collections.abc import Iterator from dataclasses import dataclass @dataclass class __lowercase : _lowerCamelCase = 42 _lowerCamelCase = 42 ...
6
'''simple docstring''' from typing import Union import fire import torch from tqdm import tqdm def __UpperCAmelCase ( lowerCamelCase_ , lowerCamelCase_ = "cpu" , lowerCamelCase_ = None) -> None: UpperCamelCase__ : List[Any] ...
6
1
'''simple docstring''' import warnings 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 lowerCAmelCase__ = loggi...
6
'''simple docstring''' import warnings 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 lowerCAmelCase__ = loggi...
6
1
'''simple docstring''' import unittest from pathlib import Path from tempfile import TemporaryDirectory from transformers import AutoConfig, TFGPTaLMHeadModel, is_keras_nlp_available, is_tf_available from transformers.models.gpta.tokenization_gpta import GPTaTokenizer from transformers.tes...
6
'''simple docstring''' def __UpperCAmelCase ( lowerCamelCase_ , lowerCamelCase_) -> list[str]: return [sentence[i : i + ngram_size] for i in range(len(lowerCamelCase_) - ngram_size + 1)] if __name__ == "__main__": from doctest import testmod testmod(...
6
1
'''simple docstring''' from math import log from scipy.constants import Boltzmann, physical_constants lowerCAmelCase__ = 300 # TEMPERATURE (unit = K) def __UpperCAmelCase ( lowerCamelCase_ , lowerCamelCase_ , lowerCamelCase_ , ...
6
'''simple docstring''' import numpy as np from numpy import ndarray from scipy.optimize import Bounds, LinearConstraint, minimize def __UpperCAmelCase ( lowerCamelCase_) -> float: return np.dot(lowerCamelCase_ , lowerCamelCase_) cl...
6
1
'''simple docstring''' import functools def __UpperCAmelCase ( lowerCamelCase_ , lowerCamelCase_) -> int: # Validation if not isinstance(lowerCamelCase_ , lowerCamelCase_) or not all(isinstance(lowerCamelCase_ , lowerCamelCas...
6
'''simple docstring''' import argparse import json from pathlib import Path import requests import torch from huggingface_hub import cached_download, hf_hub_url from PIL import Image from transformers import DPTConfig, DPTForDepthEstimation, DPTForSemanticSegmentation, DPTImageProcesso...
6
1
'''simple docstring''' from __future__ import annotations lowerCAmelCase__ = 10 def __UpperCAmelCase ( lowerCamelCase_) -> list[int]: UpperCamelCase__ : Optional[int] = 1 UpperCamelCase__ : Any = max(lowerCa...
6
'''simple docstring''' import inspect import math import tempfile import unittest import numpy as np from transformers import ViTMAEConfig from transformers.testing_utils import require_torch, require_vision, slow, torch_device from transformers.utils import cached_property, is_torch_a...
6
1
'''simple docstring''' import argparse import json from pathlib import Path import requests import torch from huggingface_hub import cached_download, hf_hub_url from PIL import Image from transformers import DPTConfig, DPTForDepthEstimation, DPTForSemanticSegmentation, DPTImageProcesso...
6
'''simple docstring''' from ..utils import DummyObject, requires_backends class __lowercase (metaclass=__lowerCamelCase ): _lowerCamelCase = ['''torch''', '''scipy'''] def __init__( self : List[Any] , *UpperCAmelCase_ : Any ...
6
1
'''simple docstring''' def __UpperCAmelCase ( lowerCamelCase_ = 10 , lowerCamelCase_ = 1_000 , lowerCamelCase_ = True) -> int: assert ( isinstance(lowerCamelCase_ , lowerCamelCase_) and isinstance(lowerCamelCase_ , lowerCa...
6
'''simple docstring''' class __lowercase : def __init__( self : List[str] , UpperCAmelCase_ : str = "" , UpperCAmelCase_ : bool = False): # Mapping from the first character of the prefix of the node UpperCamelCase__ : dict[str, Radi...
6
1
'''simple docstring''' import numpy as np from sklearn.datasets import fetch_california_housing from sklearn.metrics import mean_absolute_error, mean_squared_error from sklearn.model_selection import train_test_split from xgboost import XGBRegressor def __UpperCAmelCase ...
6
'''simple docstring''' import gc import unittest import numpy as np import torch from transformers import CLIPTextConfig, CLIPTextModel, CLIPTokenizer from diffusers import TransformeraDModel, VQDiffusionPipeline, VQDiffusionScheduler, VQModel from diffusers.pipelines.vq_diffusion.pipel...
6
1
'''simple docstring''' # This script creates a super tiny model that is useful inside tests, when we just want to test that # the machinery works, without needing to the check the quality of the outcomes. # # This version creates a tiny vocab first, and then a tiny model - so the outcome is tr...
6
'''simple docstring''' import numpy as np from PIL import Image def __UpperCAmelCase ( lowerCamelCase_ , lowerCamelCase_ , lowerCamelCase_) -> np.ndarray: UpperCamelCase__ : List[Any] = np.array(lowerCamelCase_) if arr.s...
6
1
'''simple docstring''' import argparse import re import numpy as np import requests import torch from huggingface_hub import hf_hub_download from PIL import Image from transformers import ( SamConfig, SamImageProcessor, SamModel, SamProcessor, SamVisionConfig, ...
6
'''simple docstring''' from __future__ import annotations class __lowercase : def __init__( self : Union[str, Any] , UpperCAmelCase_ : list[list[int]]): UpperCamelCase__ : int = TypeError( 'Matrices must be formed fro...
6
1
'''simple docstring''' import os import numpy import onnx def __UpperCAmelCase ( lowerCamelCase_ , lowerCamelCase_) -> Optional[int]: UpperCamelCase__ : Optional[Any] = a.name UpperCamelCase__ : Dict = b.name ...
6
'''simple docstring''' import tempfile import numpy as np import torch from transformers import AutoTokenizer, TaEncoderModel from diffusers import DDPMScheduler, UNetaDConditionModel from diffusers.models.attention_processor import AttnAddedKVProcessor from diffusers.pipelines.deepfloy...
6
1
'''simple docstring''' from __future__ import annotations import math class __lowercase : def __init__( self : Dict , UpperCAmelCase_ : int): UpperCamelCase__ : Dict = size # approximate the overall size of segment tre...
6
'''simple docstring''' import os import random import sys from . import cryptomath_module as cryptomath from . import rabin_miller lowerCAmelCase__ = 3 def __UpperCAmelCase ( lowerCamelCase_) -> int: print('Generating primitive root o...
6
1
'''simple docstring''' import json from typing import List, Optional, Tuple from tokenizers import pre_tokenizers, processors from ...tokenization_utils_base import AddedToken, BatchEncoding from ...tokenization_utils_fast import PreTrainedTokenizerFast from ...utils import logging from...
6
'''simple docstring''' import argparse import json import os import fairseq import torch from fairseq.data import Dictionary from transformers import ( UniSpeechConfig, UniSpeechForCTC, UniSpeechForPreTraining, WavaVecaFeatureExtractor, WavaVecaPhonemeCTCTokeniz...
6
1
'''simple docstring''' class __lowercase : def __init__( self : Dict , UpperCAmelCase_ : int): UpperCamelCase__ : str = n UpperCamelCase__ : List[str] = [None] * self.n UpperCamelCase__ : Optional[int] = ...
6
'''simple docstring''' import gc import random import tempfile import unittest import numpy as np import torch from transformers import CLIPTextConfig, CLIPTextModel, CLIPTokenizer from diffusers import AutoencoderKL, DDIMScheduler, LMSDiscreteScheduler, PNDMScheduler, UNetaDConditionM...
6
1
'''simple docstring''' def __UpperCAmelCase ( lowerCamelCase_ , lowerCamelCase_) -> tuple[float, float]: # Check if the input is valid if not len(lowerCamelCase_) == len(lowerCamelCase_) == 3: raise ValueError('Please enter a valid equation.') if equ...
6
'''simple docstring''' import json import os from functools import lru_cache from typing import TYPE_CHECKING, List, Optional, Tuple import regex as re from ...tokenization_utils import AddedToken, PreTrainedTokenizer from ...utils import logging if TYPE_CHECKING: from transform...
6
1
'''simple docstring''' # Copyright 2023 The HuggingFace Team. All rights reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/l...
6
'''simple docstring''' import requests from bsa import BeautifulSoup def __UpperCAmelCase ( lowerCamelCase_ = "AAPL") -> str: UpperCamelCase__ : str = f'https://in.finance.yahoo.com/quote/{symbol}?s={symbol}' UpperCamelCase__ : Opt...
6
1
'''simple docstring''' from typing import TYPE_CHECKING from ...utils import OptionalDependencyNotAvailable, _LazyModule, is_tokenizers_available, is_torch_available lowerCAmelCase__ = { 'configuration_canine': ['CANINE_PRETRAINED_CONFIG_ARCHIVE_MAP', 'CanineConfig'], ...
6
'''simple docstring''' import unittest from transformers import is_torch_available, is_vision_available from transformers.testing_utils import require_torch, require_vision, slow, torch_device if is_torch_available(): import torch from transformers import AutoModelForImageClassif...
6
1
'''simple docstring''' class __lowercase : def __init__( self : List[str] , UpperCAmelCase_ : str = "" , UpperCAmelCase_ : bool = False): # Mapping from the first character of the prefix of the node UpperCamelCase__ : dict[str, Radi...
6
'''simple docstring''' import argparse import struct import unittest class __lowercase : def __init__( self : Tuple , UpperCAmelCase_ : bytes): UpperCamelCase__ : Dict = data # Initialize hash values UpperCamelCas...
6
1
'''simple docstring''' # 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....
6
'''simple docstring''' from math import log from scipy.constants import Boltzmann, physical_constants lowerCAmelCase__ = 300 # TEMPERATURE (unit = K) def __UpperCAmelCase ( lowerCamelCase_ , lowerCamelCase_ , lowerCamelCase_ , ...
6
1
'''simple docstring''' from ...configuration_utils import PretrainedConfig from ...utils import logging lowerCAmelCase__ = logging.get_logger(__name__) lowerCAmelCase__ = { 's-JoL/Open-Llama-V1': 'https://huggingface.co/s-JoL/Open-Llama-V1/blob/main/confi...
6
'''simple docstring''' import logging import math from functools import partial from typing import Any, Callable, Dict, Iterable, List, Optional, Sequence, Tuple, Union import torch from .tensor_utils import tensor_tree_map, tree_map def __UpperCAmelCase ( lowe...
6
1
'''simple docstring''' import warnings from ...processing_utils import ProcessorMixin from ...tokenization_utils_base import BatchEncoding class __lowercase (__lowerCamelCase ): _lowerCamelCase = ['''image_processor''', '''tokenizer'''] _lowerCame...
6
'''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_uti...
6
1
'''simple docstring''' def __UpperCAmelCase ( lowerCamelCase_ , lowerCamelCase_) -> str: if a < 0 or b < 0: raise ValueError('the value of both inputs must be positive') UpperCamelCase__ : Tuple = str(bin(lowerCamelCase_))[2:] # remove the...
6
'''simple docstring''' from typing import Union import fire import torch from tqdm import tqdm def __UpperCAmelCase ( lowerCamelCase_ , lowerCamelCase_ = "cpu" , lowerCamelCase_ = None) -> None: UpperCamelCase__ : List[Any] ...
6
1
'''simple docstring''' import functools from typing import Any def __UpperCAmelCase ( lowerCamelCase_ , lowerCamelCase_) -> bool: # Validation if not isinstance(lowerCamelCase_ , lowerCamelCase_) or len(lowerCamelCase_) == 0: ra...
6
'''simple docstring''' import warnings 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 lowerCAmelCase__ = loggi...
6
1
'''simple docstring''' from copy import deepcopy import torch import torch.nn.functional as F from torch.optim import AdamW from torch.optim.lr_scheduler import LambdaLR from torch.utils.data import DataLoader from accelerate.accelerator import Accelerator from accelerate.state import ...
6
'''simple docstring''' def __UpperCAmelCase ( lowerCamelCase_ , lowerCamelCase_) -> list[str]: return [sentence[i : i + ngram_size] for i in range(len(lowerCamelCase_) - ngram_size + 1)] if __name__ == "__main__": from doctest import testmod testmod(...
6
1
'''simple docstring''' from collections import Counter from pathlib import Path from typing import Optional, Tuple import yaml class __lowercase (yaml.SafeLoader ): def __UpperCamelCase ( self : List[str] , UpperCAmelCase_ : ...
6
'''simple docstring''' import numpy as np from numpy import ndarray from scipy.optimize import Bounds, LinearConstraint, minimize def __UpperCAmelCase ( lowerCamelCase_) -> float: return np.dot(lowerCamelCase_ , lowerCamelCase_) cl...
6
1
'''simple docstring''' from collections import OrderedDict from typing import Mapping from ...configuration_utils import PretrainedConfig from ...onnx import OnnxConfig from ...utils import logging lowerCAmelCase__ = logging.get_logger(__name__) lowerCAmelCase__ ...
6
'''simple docstring''' import argparse import json from pathlib import Path import requests import torch from huggingface_hub import cached_download, hf_hub_url from PIL import Image from transformers import DPTConfig, DPTForDepthEstimation, DPTForSemanticSegmentation, DPTImageProcesso...
6
1
'''simple docstring''' from __future__ import annotations from typing import Any def __UpperCAmelCase ( lowerCamelCase_) -> None: create_state_space_tree(lowerCamelCase_ , [] , 0) def __UpperCAmelCase ( lowerC...
6
'''simple docstring''' import inspect import math import tempfile import unittest import numpy as np from transformers import ViTMAEConfig from transformers.testing_utils import require_torch, require_vision, slow, torch_device from transformers.utils import cached_property, is_torch_a...
6
1
'''simple docstring''' from typing import Dict, List, Optional from ...tokenization_utils import AddedToken, PreTrainedTokenizer from ...utils import logging lowerCAmelCase__ = logging.get_logger(__name__) lowerCAmelCase__ = { 'nielsr/canine-s': 2048...
6
'''simple docstring''' from ..utils import DummyObject, requires_backends class __lowercase (metaclass=__lowerCamelCase ): _lowerCamelCase = ['''torch''', '''scipy'''] def __init__( self : List[Any] , *UpperCAmelCase_ : Any ...
6
1
'''simple docstring''' 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() lowerCAmelCase__ ...
6
'''simple docstring''' class __lowercase : def __init__( self : List[str] , UpperCAmelCase_ : str = "" , UpperCAmelCase_ : bool = False): # Mapping from the first character of the prefix of the node UpperCamelCase__ : dict[str, Radi...
6
1
'''simple docstring''' import math import os import unittest from transformers import MegatronBertConfig, is_torch_available from transformers.models.auto import get_values from transformers.testing_utils import require_sentencepiece, require_tokenizers, require_torch, slow, torch_device ...
6
'''simple docstring''' import gc import unittest import numpy as np import torch from transformers import CLIPTextConfig, CLIPTextModel, CLIPTokenizer from diffusers import TransformeraDModel, VQDiffusionPipeline, VQDiffusionScheduler, VQModel from diffusers.pipelines.vq_diffusion.pipel...
6
1
'''simple docstring''' import requests from bsa import BeautifulSoup def __UpperCAmelCase ( lowerCamelCase_ = "AAPL") -> str: UpperCamelCase__ : str = f'https://in.finance.yahoo.com/quote/{symbol}?s={symbol}' UpperCamelCase__ : Opt...
6
'''simple docstring''' import numpy as np from PIL import Image def __UpperCAmelCase ( lowerCamelCase_ , lowerCamelCase_ , lowerCamelCase_) -> np.ndarray: UpperCamelCase__ : List[Any] = np.array(lowerCamelCase_) if arr.s...
6
1
'''simple docstring''' import argparse import torch from transformers import BlenderbotConfig, BlenderbotForConditionalGeneration from transformers.utils import logging logging.set_verbosity_info() lowerCAmelCase__ = logging.get_logger(__name__) lowerCAmelCase__ ...
6
'''simple docstring''' from __future__ import annotations class __lowercase : def __init__( self : Union[str, Any] , UpperCAmelCase_ : list[list[int]]): UpperCamelCase__ : int = TypeError( 'Matrices must be formed fro...
6
1
'''simple docstring''' import torch from diffusers import DDIMParallelScheduler from .test_schedulers import SchedulerCommonTest class __lowercase (__lowerCamelCase ): _lowerCamelCase = (DDIMParallelScheduler,) _lowerCamelCase = ((...
6
'''simple docstring''' import tempfile import numpy as np import torch from transformers import AutoTokenizer, TaEncoderModel from diffusers import DDPMScheduler, UNetaDConditionModel from diffusers.models.attention_processor import AttnAddedKVProcessor from diffusers.pipelines.deepfloy...
6
1
'''simple docstring''' import argparse import json import math import os import time import traceback import zipfile from collections import Counter import requests def __UpperCAmelCase ( lowerCamelCase_ , lowerCamelCase_=None) -> Tuple: ...
6
'''simple docstring''' import os import random import sys from . import cryptomath_module as cryptomath from . import rabin_miller lowerCAmelCase__ = 3 def __UpperCAmelCase ( lowerCamelCase_) -> int: print('Generating primitive root o...
6
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 t...
6
'''simple docstring''' import argparse import json import os import fairseq import torch from fairseq.data import Dictionary from transformers import ( UniSpeechConfig, UniSpeechForCTC, UniSpeechForPreTraining, WavaVecaFeatureExtractor, WavaVecaPhonemeCTCTokeniz...
6
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_uti...
6
'''simple docstring''' import gc import random import tempfile import unittest import numpy as np import torch from transformers import CLIPTextConfig, CLIPTextModel, CLIPTokenizer from diffusers import AutoencoderKL, DDIMScheduler, LMSDiscreteScheduler, PNDMScheduler, UNetaDConditionM...
6
1
'''simple docstring''' from ...configuration_utils import PretrainedConfig from ...utils import logging from ...utils.backbone_utils import BackboneConfigMixin, get_aligned_output_features_output_indices lowerCAmelCase__ = logging.get_logger(__name__) lowerCAmelCase__ ...
6
'''simple docstring''' import json import os from functools import lru_cache from typing import TYPE_CHECKING, List, Optional, Tuple import regex as re from ...tokenization_utils import AddedToken, PreTrainedTokenizer from ...utils import logging if TYPE_CHECKING: from transform...
6
1
'''simple docstring''' from __future__ import annotations class __lowercase : def __init__( self : Union[str, Any] , UpperCAmelCase_ : list[list[int]]): UpperCamelCase__ : int = TypeError( 'Matrices must be formed fro...
6
'''simple docstring''' import requests from bsa import BeautifulSoup def __UpperCAmelCase ( lowerCamelCase_ = "AAPL") -> str: UpperCamelCase__ : str = f'https://in.finance.yahoo.com/quote/{symbol}?s={symbol}' UpperCamelCase__ : Opt...
6
1
'''simple docstring''' import numpy as np from PIL import Image def __UpperCAmelCase ( lowerCamelCase_ , lowerCamelCase_ , lowerCamelCase_) -> np.ndarray: UpperCamelCase__ : List[Any] = np.array(lowerCamelCase_) if arr.s...
6
'''simple docstring''' import unittest from transformers import is_torch_available, is_vision_available from transformers.testing_utils import require_torch, require_vision, slow, torch_device if is_torch_available(): import torch from transformers import AutoModelForImageClassif...
6
1
'''simple docstring''' import inspect import unittest from transformers import DecisionTransformerConfig, is_torch_available from transformers.testing_utils import require_torch, slow, torch_device from ...generation.test_utils import GenerationTesterMixin from ...test_configuration_comm...
6
'''simple docstring''' import argparse import struct import unittest class __lowercase : def __init__( self : Tuple , UpperCAmelCase_ : bytes): UpperCamelCase__ : Dict = data # Initialize hash values UpperCamelCas...
6
1
'''simple docstring''' def __UpperCAmelCase ( lowerCamelCase_) -> int: UpperCamelCase__ : Optional[int] = [] UpperCamelCase__ : Tuple = set({'(', '[', '{'}) UpperCamelCase__ : Dict = set({')', ']', '}'}) UpperCamelCase...
6
'''simple docstring''' from math import log from scipy.constants import Boltzmann, physical_constants lowerCAmelCase__ = 300 # TEMPERATURE (unit = K) def __UpperCAmelCase ( lowerCamelCase_ , lowerCamelCase_ , lowerCamelCase_ , ...
6
1
'''simple docstring''' # Logistic Regression from scratch # In[62]: # In[63]: # importing all the required libraries import numpy as np from matplotlib import pyplot as plt from sklearn import datasets def __UpperCAmelCase ( lowerCamelCase_) -> O...
6
'''simple docstring''' import logging import math from functools import partial from typing import Any, Callable, Dict, Iterable, List, Optional, Sequence, Tuple, Union import torch from .tensor_utils import tensor_tree_map, tree_map def __UpperCAmelCase ( lowe...
6
1
'''simple docstring''' import os from argparse import ArgumentParser from typing import List import torch.utils.data from datasets import Dataset, IterableDataset from datasets.distributed import split_dataset_by_node lowerCAmelCase__ = 4 lowerCAmelCase__ = ...
6
'''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_uti...
6
1
'''simple docstring''' import argparse import datetime def __UpperCAmelCase ( lowerCamelCase_) -> str: UpperCamelCase__ : int = { '0': 'Sunday', '1': 'Monday', '2': 'Tuesday', '3': 'Wednesday', '4': 'Thursd...
6
'''simple docstring''' from typing import Union import fire import torch from tqdm import tqdm def __UpperCAmelCase ( lowerCamelCase_ , lowerCamelCase_ = "cpu" , lowerCamelCase_ = None) -> None: UpperCamelCase__ : List[Any] ...
6
1
'''simple docstring''' import copy from ...configuration_utils import PretrainedConfig from ...utils import logging lowerCAmelCase__ = logging.get_logger(__name__) class __lowercase (__lowerCamelCase ): _lowerCamelCase = '''encode...
6
'''simple docstring''' import warnings 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 lowerCAmelCase__ = loggi...
6
1
'''simple docstring''' import warnings from typing import List import numpy as np from ...processing_utils import ProcessorMixin from ...tokenization_utils_base import BatchEncoding from ...utils import is_flax_available, is_tf_available, is_torch_available class __l...
6
'''simple docstring''' def __UpperCAmelCase ( lowerCamelCase_ , lowerCamelCase_) -> list[str]: return [sentence[i : i + ngram_size] for i in range(len(lowerCamelCase_) - ngram_size + 1)] if __name__ == "__main__": from doctest import testmod testmod(...
6
1
'''simple docstring''' import gc import random import unittest import numpy as np import torch from transformers import ( CLIPImageProcessor, CLIPTextConfig, CLIPTextModelWithProjection, CLIPTokenizer, CLIPVisionConfig, CLIPVisionModelWithProjection, ) fro...
6
'''simple docstring''' import numpy as np from numpy import ndarray from scipy.optimize import Bounds, LinearConstraint, minimize def __UpperCAmelCase ( lowerCamelCase_) -> float: return np.dot(lowerCamelCase_ , lowerCamelCase_) cl...
6
1
'''simple docstring''' import itertools import random import unittest import numpy as np from transformers import is_speech_available from transformers.testing_utils import require_torch, require_torchaudio from ...test_sequence_feature_extraction_common import SequenceFeatureExtracti...
6
'''simple docstring''' import argparse import json from pathlib import Path import requests import torch from huggingface_hub import cached_download, hf_hub_url from PIL import Image from transformers import DPTConfig, DPTForDepthEstimation, DPTForSemanticSegmentation, DPTImageProcesso...
6
1
'''simple docstring''' def __UpperCAmelCase ( ) -> list[list[int]]: return [list(range(1_000 - i , -1_000 - i , -1)) for i in range(1_000)] lowerCAmelCase__ = generate_large_matrix() lowerCAmelCase__ = ( [[4, 3, 2, ...
6
'''simple docstring''' import inspect import math import tempfile import unittest import numpy as np from transformers import ViTMAEConfig from transformers.testing_utils import require_torch, require_vision, slow, torch_device from transformers.utils import cached_property, is_torch_a...
6
1
'''simple docstring''' from collections import OrderedDict from ...utils import logging from .auto_factory import _BaseAutoModelClass, _LazyAutoMapping, auto_class_update from .configuration_auto import CONFIG_MAPPING_NAMES lowerCAmelCase__ = logging.get_logger(__name__) ...
6
'''simple docstring''' from ..utils import DummyObject, requires_backends class __lowercase (metaclass=__lowerCamelCase ): _lowerCamelCase = ['''torch''', '''scipy'''] def __init__( self : List[Any] , *UpperCAmelCase_ : Any ...
6
1