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
from __future__ import annotations def lowerCAmelCase ( UpperCamelCase_: list[int] , UpperCamelCase_: int ) -> Optional[int]: '''simple docstring''' if len(_lowerCAmelCase ) == 0: return False _a = len(_lowerCAmelCase ) // 2 ...
711
"""simple docstring""" # Copyright 2021 The HuggingFace Team. All rights reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2....
612
0
"""simple docstring""" from ...processing_utils import ProcessorMixin from ...tokenization_utils_base import BatchEncoding class lowercase_ (UpperCamelCase_ ): A__ : Union[str, Any] = ["""image_processor""", """tokenizer"""] A__ : List[str] ...
712
"""simple docstring""" import math def lowerCAmelCase ( UpperCamelCase_: int ) -> list: '''simple docstring''' _a = [True] * n _a = False _a = False _a = True for i in range(3 , int(n**0.5 + 1 ) , 2 ): ...
612
0
"""simple docstring""" import argparse import math import os import torch from neural_compressor.utils.pytorch import load from PIL import Image from transformers import CLIPTextModel, CLIPTokenizer from diffusers import AutoencoderKL, StableDiffusionPipeline, UNetaDConditionModel def lowerCAm...
713
"""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 sage...
612
0
"""simple docstring""" import inspect import os import torch from transformers import AutoModel from transformers.testing_utils import mockenv_context from transformers.trainer_utils import set_seed import accelerate from accelerate.accelerator import Accelerator from accelerate.state import AcceleratorSta...
714
"""simple docstring""" import tempfile import torch from diffusers import PNDMScheduler from .test_schedulers import SchedulerCommonTest class lowercase_ (_UpperCAmelCase ): A__ : Union[str, Any] = (PNDMScheduler,) A__ : Optional[int] = (('''num_inferenc...
612
0
"""simple docstring""" import math from collections.abc import Callable def lowerCAmelCase ( UpperCamelCase_: List[Any] , UpperCamelCase_: Dict , UpperCamelCase_: Tuple ) -> Union[str, Any]: '''simple docstring''' _a = xa _...
715
"""simple docstring""" from __future__ import annotations from collections.abc import Callable from typing import Generic, TypeVar UpperCamelCase = TypeVar("""T""") UpperCamelCase = TypeVar("""U""") class lowercase_ (Generic[T, U] ): def __init__( ...
612
0
"""simple docstring""" import json import os import shutil import tempfile import unittest from transformers import BatchEncoding, CanineTokenizer from transformers.testing_utils import require_tokenizers, require_torch from transformers.tokenization_utils import AddedToken from transformers.utils import ca...
716
"""simple docstring""" import inspect from typing import Callable, List, Optional, Union import torch from transformers import ( CLIPImageProcessor, CLIPTextModel, CLIPTokenizer, WhisperForConditionalGeneration, WhisperProcessor, ) from diffusers import ( AutoencoderKL, DDIMSche...
612
0
def lowerCAmelCase ( UpperCamelCase_: Tuple , UpperCamelCase_: Optional[Any] ) -> str: '''simple docstring''' assert x is not None assert y is not None _a = len(_lowerCamelCase ) _a = len(_lowerCamelCase ) # declaring the...
717
"""simple docstring""" import json import os import re import shutil import tempfile import unittest from typing import Tuple from transformers import AddedToken, BatchEncoding, ByTaTokenizer from transformers.utils import cached_property, is_tf_available, is_torch_available from ...test_tokenization_commo...
612
0
"""simple docstring""" from binascii import hexlify from hashlib import shaaaa from os import urandom # RFC 3526 - More Modular Exponential (MODP) Diffie-Hellman groups for # Internet Key Exchange (IKE) https://tools.ietf.org/html/rfc3526 UpperCamelCase = { # 1536-bit 5: { "...
718
"""simple docstring""" from ..utils import DummyObject, requires_backends class lowercase_ (metaclass=_UpperCAmelCase ): A__ : Any = ['''torch''', '''torchsde'''] def __init__( self , *a_ , **a_ ) ->Optional[int]: '''simple docstr...
612
0
"""simple docstring""" import collections import json import math import os import re import time from fnmatch import fnmatch from typing import Dict import requests from slack_sdk import WebClient UpperCamelCase = WebClient(token=os.environ["""CI_SLACK_BOT_TOKEN"""]) def lowerC...
719
"""simple docstring""" import numpy as np from numpy import ndarray from scipy.optimize import Bounds, LinearConstraint, minimize def lowerCAmelCase ( UpperCamelCase_: ndarray ) -> float: '''simple docstring''' return np.dot(UpperCamelCase_ , Uppe...
612
0
"""simple docstring""" from maths.prime_factors import prime_factors def lowerCAmelCase ( UpperCamelCase_: int ) -> int: '''simple docstring''' if not isinstance(UpperCamelCase_ , UpperCamelCase_ ): _a = f'''Input value of [number={n...
720
"""simple docstring""" from typing import TYPE_CHECKING from ...utils import ( OptionalDependencyNotAvailable, _LazyModule, is_sentencepiece_available, is_tokenizers_available, is_torch_available, ) UpperCamelCase = {"""configuration_fnet""": ["""FNET_PRETRAINED_CONFIG_...
612
0
"""simple docstring""" from math import cos, sin, sqrt, tau from audio_filters.iir_filter import IIRFilter def lowerCAmelCase ( UpperCamelCase_: int , UpperCamelCase_: int , UpperCamelCase_: float = 1 / sqrt(2 ) ) -> List[str]: '''simp...
721
"""simple docstring""" import argparse import json import os from collections import OrderedDict import numpy as np import tensorflow as tf import torch def lowerCAmelCase ( UpperCamelCase_: Dict ) -> Any: '''simple docstring''' _a = os.path.jo...
612
0
"""simple docstring""" import requests def lowerCAmelCase ( UpperCamelCase_: str , UpperCamelCase_: str ) -> Union[str, Any]: '''simple docstring''' _a = {"Content-Type": "application/json"} _a = requests.post(snake_case__ ...
700
"""simple docstring""" import os import time from dataclasses import dataclass, field from enum import Enum from typing import Dict, List, Optional, Union import torch from filelock import FileLock from torch.utils.data import Dataset from ...models.auto.modeling_auto import MODEL_FOR_QUESTION_ANSWERING_MA...
612
0
from typing import TYPE_CHECKING from ...utils import OptionalDependencyNotAvailable, _LazyModule, is_torch_available UpperCamelCase = { """configuration_megatron_bert""": ["""MEGATRON_BERT_PRETRAINED_CONFIG_ARCHIVE_MAP""", """MegatronBertConfig"""], } try: if not is_torch_available(...
701
"""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.org/licenses/LICEN...
612
0
"""simple docstring""" def lowerCAmelCase ( UpperCamelCase_: list[int] ) -> Optional[Any]: '''simple docstring''' _a = [] if len(UpperCamelCase_ ) == 1: return [nums.copy()] for _ in range(len(UpperCamelCase_ ) ): _a = nu...
702
"""simple docstring""" import importlib import json import os from collections import OrderedDict from typing import Dict, Optional, Union # Build the list of all image processors from ...configuration_utils import PretrainedConfig from ...dynamic_module_utils import get_class_from_dynamic_module, resolve_t...
612
0
"""simple docstring""" import inspect import unittest import numpy as np from transformers import ViTConfig, is_flax_available from transformers.testing_utils import require_flax, slow from ...test_configuration_common import ConfigTester from ...test_modeling_flax_common import FlaxModelTesterMixin, floa...
703
"""simple docstring""" import warnings from ...utils import logging from .image_processing_yolos import YolosImageProcessor UpperCamelCase = logging.get_logger(__name__) class lowercase_ (_UpperCAmelCase ): def __init__( self , *a_ , **a_ ) ->No...
612
0
import warnings from ...utils import logging from .image_processing_poolformer import PoolFormerImageProcessor UpperCamelCase = logging.get_logger(__name__) class lowercase_ (lowercase__ ): def __init__( self , *a_ , **a_ ) ->None: ''...
704
"""simple docstring""" import argparse import json import os import numpy as np import PIL import requests import tensorflow.keras.applications.efficientnet as efficientnet import torch from huggingface_hub import hf_hub_download from PIL import Image from tensorflow.keras.preprocessing import image from t...
612
0
"""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 logg...
705
"""simple docstring""" from typing import TYPE_CHECKING from ...utils import OptionalDependencyNotAvailable, _LazyModule, is_tf_available, is_torch_available UpperCamelCase = { """configuration_transfo_xl""": ["""TRANSFO_XL_PRETRAINED_CONFIG_ARCHIVE_MAP""", """TransfoXLConfig"""], ...
612
0
"""simple docstring""" import argparse import torch from transformers import OpenAIGPTConfig, OpenAIGPTModel, load_tf_weights_in_openai_gpt from transformers.utils import CONFIG_NAME, WEIGHTS_NAME, logging logging.set_verbosity_info() def lowerCAmelCase ( UpperCamelCase_: Union[st...
706
"""simple docstring""" import argparse import json import os import fairseq import torch from fairseq.data import Dictionary from transformers import ( WavaVecaConfig, WavaVecaCTCTokenizer, WavaVecaFeatureExtractor, WavaVecaForCTC, WavaVecaForPreTraining, WavaVecaProcessor, logg...
612
0
from typing import TYPE_CHECKING from ...utils import ( OptionalDependencyNotAvailable, _LazyModule, is_tf_available, is_tokenizers_available, is_torch_available, ) UpperCamelCase = { """configuration_funnel""": ["""FUNNEL_PRETRAINED_CONFIG_ARCHIVE_MAP""", """FunnelConf...
707
"""simple docstring""" import copy import fnmatch import json import os import pickle as pkl import shutil import sys import tarfile import tempfile from collections import OrderedDict from contextlib import contextmanager from functools import partial from hashlib import shaaaa from io import BytesIO from p...
612
0
"""simple docstring""" import json import multiprocessing import os import re from collections import defaultdict import torch from accelerate import Accelerator from accelerate.utils import set_seed from arguments import HumanEvalArguments from datasets import load_dataset, load_metric from torch.utils.dat...
708
"""simple docstring""" def lowerCAmelCase ( UpperCamelCase_: Optional[int] , UpperCamelCase_: str ) -> List[Any]: '''simple docstring''' _a = (boundary[1] - boundary[0]) / steps _a = boundary[0] _a = boundary[1] _a = ...
612
0
"""simple docstring""" import os import time import numpy as np import onnxruntime as ort UpperCamelCase = '''1''' UpperCamelCase = '''0''' UpperCamelCase = '''1''' UpperCamelCase = ort.SessionOptions() UpperCamelCase = ort.G...
709
"""simple docstring""" import os from typing import BinaryIO, Optional, Union import numpy as np import pyarrow.parquet as pq from .. import Audio, Dataset, Features, Image, NamedSplit, Value, config from ..features.features import FeatureType, _visit from ..formatting import query_table from ..packaged_mo...
612
0
from packaging import version from .import_utils import is_accelerate_available if is_accelerate_available(): import accelerate def lowerCAmelCase ( UpperCamelCase_: List[Any] ) -> str: '''simple docstring''' if not is_accelerate_available(): ...
710
"""simple docstring""" import torch from diffusers import KDPMaDiscreteScheduler from diffusers.utils import torch_device from .test_schedulers import SchedulerCommonTest class lowercase_ (_UpperCAmelCase ): A__ : Tuple = (KDPMaDiscreteScheduler,) A__ : Tuple ...
612
0
from typing import List, Optional, Union from ...image_utils import ImageInput from ...processing_utils import ProcessorMixin from ...tokenization_utils_base import BatchEncoding, PaddingStrategy, PreTokenizedInput, TextInput, TruncationStrategy from ...utils import TensorType class lowercase_ (__Uppe...
711
"""simple docstring""" # Copyright 2021 The HuggingFace Team. All rights reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2....
612
0
"""simple docstring""" def lowerCAmelCase ( ) -> Optional[Any]: '''simple docstring''' _a = 0 for i in range(1 , 1001 ): total += i**i return str(_lowercase )[-10:] if __name__ == "__main__": print(s...
712
"""simple docstring""" import math def lowerCAmelCase ( UpperCamelCase_: int ) -> list: '''simple docstring''' _a = [True] * n _a = False _a = False _a = True for i in range(3 , int(n**0.5 + 1 ) , 2 ): ...
612
0
"""simple docstring""" import inspect import unittest from transformers import MobileNetVaConfig from transformers.testing_utils import require_torch, require_vision, slow, torch_device from transformers.utils import cached_property, is_torch_available, is_vision_available from ...test_configuration_common...
713
"""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 sage...
612
0
"""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, Value, load_dataset fr...
714
"""simple docstring""" import tempfile import torch from diffusers import PNDMScheduler from .test_schedulers import SchedulerCommonTest class lowercase_ (_UpperCAmelCase ): A__ : Union[str, Any] = (PNDMScheduler,) A__ : Optional[int] = (('''num_inferenc...
612
0
"""simple docstring""" import random import unittest import numpy as np import torch from diffusers import ( DPMSolverMultistepScheduler, EulerAncestralDiscreteScheduler, EulerDiscreteScheduler, LMSDiscreteScheduler, OnnxStableDiffusionUpscalePipeline, PNDMScheduler, ) from diffuser...
715
"""simple docstring""" from __future__ import annotations from collections.abc import Callable from typing import Generic, TypeVar UpperCamelCase = TypeVar("""T""") UpperCamelCase = TypeVar("""U""") class lowercase_ (Generic[T, U] ): def __init__( ...
612
0
"""simple docstring""" from dataclasses import dataclass, field from typing import Optional @dataclass class lowercase_ : A__ : Optional[str] = field( default='''codeparrot/codeparrot''', metadata={'''help''': '''Model name or path of model to be trained.'''} ) ...
716
"""simple docstring""" import inspect from typing import Callable, List, Optional, Union import torch from transformers import ( CLIPImageProcessor, CLIPTextModel, CLIPTokenizer, WhisperForConditionalGeneration, WhisperProcessor, ) from diffusers import ( AutoencoderKL, DDIMSche...
612
0
from math import cos, sin, sqrt, tau from audio_filters.iir_filter import IIRFilter def lowerCAmelCase ( UpperCamelCase_: int , UpperCamelCase_: int , UpperCamelCase_: float = 1 / sqrt(2 ) ) -> List[Any]: '''simple docstring''' _a...
717
"""simple docstring""" import json import os import re import shutil import tempfile import unittest from typing import Tuple from transformers import AddedToken, BatchEncoding, ByTaTokenizer from transformers.utils import cached_property, is_tf_available, is_torch_available from ...test_tokenization_commo...
612
0
"""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 AutoImageProcessor, SwinvaConfig, SwinvaForImageClassification def lowerCAmelCase ( ...
718
"""simple docstring""" from ..utils import DummyObject, requires_backends class lowercase_ (metaclass=_UpperCAmelCase ): A__ : Any = ['''torch''', '''torchsde'''] def __init__( self , *a_ , **a_ ) ->Optional[int]: '''simple docstr...
612
0
"""simple docstring""" from typing import TYPE_CHECKING from ...utils import ( OptionalDependencyNotAvailable, _LazyModule, is_flax_available, is_tf_available, is_torch_available, ) UpperCamelCase = { """configuration_vision_encoder_decoder""": ["""VisionEncoderDecode...
719
"""simple docstring""" import numpy as np from numpy import ndarray from scipy.optimize import Bounds, LinearConstraint, minimize def lowerCAmelCase ( UpperCamelCase_: ndarray ) -> float: '''simple docstring''' return np.dot(UpperCamelCase_ , Uppe...
612
0
"""simple docstring""" UpperCamelCase = { 'A': '.-', 'B': '-...', 'C': '-.-.', 'D': '-..', 'E': '.', 'F': '..-.', 'G': '--.', 'H': '....', 'I': '..', 'J': '.---', 'K': '-.-', 'L': '.-..', 'M': '--', 'N': '-.', 'O': '---', 'P': '.--.', 'Q': '--.-', 'R': '.-.', 'S': '...', 'T': '-',...
720
"""simple docstring""" from typing import TYPE_CHECKING from ...utils import ( OptionalDependencyNotAvailable, _LazyModule, is_sentencepiece_available, is_tokenizers_available, is_torch_available, ) UpperCamelCase = {"""configuration_fnet""": ["""FNET_PRETRAINED_CONFIG_...
612
0
"""simple docstring""" import logging import os import quant_trainer import torch from torch.utils.data import DataLoader from transformers import Trainer, is_torch_tpu_available from transformers.trainer_utils import PredictionOutput UpperCamelCase = logging.getLogger(__name__) if is_to...
721
"""simple docstring""" import argparse import json import os from collections import OrderedDict import numpy as np import tensorflow as tf import torch def lowerCAmelCase ( UpperCamelCase_: Dict ) -> Any: '''simple docstring''' _a = os.path.jo...
612
0
"""simple docstring""" import unittest from transformers import XLMConfig, is_torch_available from transformers.testing_utils import require_torch, slow, torch_device from ...generation.test_utils import GenerationTesterMixin from ...test_configuration_common import ConfigTester from ...test_modeling_commo...
700
"""simple docstring""" import os import time from dataclasses import dataclass, field from enum import Enum from typing import Dict, List, Optional, Union import torch from filelock import FileLock from torch.utils.data import Dataset from ...models.auto.modeling_auto import MODEL_FOR_QUESTION_ANSWERING_MA...
612
0
import os from dataclasses import dataclass, field from io import BytesIO from typing import TYPE_CHECKING, Any, ClassVar, Dict, Optional, Union import numpy as np import pyarrow as pa from .. import config from ..download.streaming_download_manager import xopen, xsplitext from ..table import array_cast from ....
701
"""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.org/licenses/LICEN...
612
0
"""simple docstring""" import argparse import torch from transformers import LxmertConfig, LxmertForPreTraining, load_tf_weights_in_lxmert from transformers.utils import logging logging.set_verbosity_info() def lowerCAmelCase ( UpperCamelCase_: Optional[Any] , UpperCamelCase_:...
702
"""simple docstring""" import importlib import json import os from collections import OrderedDict from typing import Dict, Optional, Union # Build the list of all image processors from ...configuration_utils import PretrainedConfig from ...dynamic_module_utils import get_class_from_dynamic_module, resolve_t...
612
0
"""simple docstring""" import unittest import numpy as np import torch from torch import nn from transformers import ( CLIPImageProcessor, CLIPTextConfig, CLIPTextModelWithProjection, CLIPTokenizer, CLIPVisionConfig, CLIPVisionModelWithProjection, ) from diffusers import KandinskyVa...
703
"""simple docstring""" import warnings from ...utils import logging from .image_processing_yolos import YolosImageProcessor UpperCamelCase = logging.get_logger(__name__) class lowercase_ (_UpperCAmelCase ): def __init__( self , *a_ , **a_ ) ->No...
612
0
import copy import random from transformers import CLIPTokenizer class lowercase_ (_UpperCAmelCase ): def __init__( self , *a_ , **a_ ) ->List[Any]: '''simple docstring''' super().__init__(*lowercase__ , **lowercase__ ) _a ...
704
"""simple docstring""" import argparse import json import os import numpy as np import PIL import requests import tensorflow.keras.applications.efficientnet as efficientnet import torch from huggingface_hub import hf_hub_download from PIL import Image from tensorflow.keras.preprocessing import image from t...
612
0
"""simple docstring""" from typing import TYPE_CHECKING from ...utils import OptionalDependencyNotAvailable, _LazyModule, is_torch_available UpperCamelCase = { """configuration_nllb_moe""": [ """NLLB_MOE_PRETRAINED_CONFIG_ARCHIVE_MAP""", """NllbMoeConfig""", ] } tr...
705
"""simple docstring""" from typing import TYPE_CHECKING from ...utils import OptionalDependencyNotAvailable, _LazyModule, is_tf_available, is_torch_available UpperCamelCase = { """configuration_transfo_xl""": ["""TRANSFO_XL_PRETRAINED_CONFIG_ARCHIVE_MAP""", """TransfoXLConfig"""], ...
612
0
"""simple docstring""" def lowerCAmelCase ( UpperCamelCase_: int ) -> Tuple: '''simple docstring''' if divisor % 5 == 0 or divisor % 2 == 0: return 0 _a = 1 _a = 1 while repunit: _a = (10 * repunit + 1) % divisor repunit_...
706
"""simple docstring""" import argparse import json import os import fairseq import torch from fairseq.data import Dictionary from transformers import ( WavaVecaConfig, WavaVecaCTCTokenizer, WavaVecaFeatureExtractor, WavaVecaForCTC, WavaVecaForPreTraining, WavaVecaProcessor, logg...
612
0
def lowerCAmelCase ( UpperCamelCase_: List[str] , UpperCamelCase_: List[str] ) -> List[str]: '''simple docstring''' _a = (boundary[1] - boundary[0]) / steps _a = boundary[0] _a = boundary[1] _a = make_points(lowercase_ ...
707
"""simple docstring""" import copy import fnmatch import json import os import pickle as pkl import shutil import sys import tarfile import tempfile from collections import OrderedDict from contextlib import contextmanager from functools import partial from hashlib import shaaaa from io import BytesIO from p...
612
0
"""simple docstring""" from __future__ import annotations def lowerCAmelCase ( UpperCamelCase_: Tuple ) -> list[int]: '''simple docstring''' return [ord(__UpperCamelCase ) - 96 for elem in plain] def lowerCAmelCase ( UpperCamelCa...
708
"""simple docstring""" def lowerCAmelCase ( UpperCamelCase_: Optional[int] , UpperCamelCase_: str ) -> List[Any]: '''simple docstring''' _a = (boundary[1] - boundary[0]) / steps _a = boundary[0] _a = boundary[1] _a = ...
612
0
"""simple docstring""" from typing import TYPE_CHECKING from ...utils import ( OptionalDependencyNotAvailable, _LazyModule, is_torch_available, ) UpperCamelCase = { """configuration_mega""": ["""MEGA_PRETRAINED_CONFIG_ARCHIVE_MAP""", """MegaConfig""", """MegaOnnxConfig"""],...
709
"""simple docstring""" import os from typing import BinaryIO, Optional, Union import numpy as np import pyarrow.parquet as pq from .. import Audio, Dataset, Features, Image, NamedSplit, Value, config from ..features.features import FeatureType, _visit from ..formatting import query_table from ..packaged_mo...
612
0
from typing import Optional from torch import nn from .transformer_ad import TransformeraDModel, TransformeraDModelOutput class lowercase_ (nn.Module ): def __init__( self , a_ = 1_6 , a_ = 8_8 , a_ = None , a_ = 1 , a_ = 0.0 , a_ = 3...
710
"""simple docstring""" import torch from diffusers import KDPMaDiscreteScheduler from diffusers.utils import torch_device from .test_schedulers import SchedulerCommonTest class lowercase_ (_UpperCAmelCase ): A__ : Tuple = (KDPMaDiscreteScheduler,) A__ : Tuple ...
612
0
import unittest from transformers import AutoConfig, AutoTokenizer, BertConfig, TensorType, is_flax_available from transformers.testing_utils import DUMMY_UNKNOWN_IDENTIFIER, require_flax, slow if is_flax_available(): import jax from transformers.models.auto.modeling_flax_auto import FlaxAutoModel ...
711
"""simple docstring""" # Copyright 2021 The HuggingFace Team. All rights reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2....
612
0
"""simple docstring""" def lowerCAmelCase ( UpperCamelCase_: str , UpperCamelCase_: bool = False ) -> str: '''simple docstring''' if not isinstance(lowerCamelCase_ , lowerCamelCase_ ): _a = f'''Expect...
712
"""simple docstring""" import math def lowerCAmelCase ( UpperCamelCase_: int ) -> list: '''simple docstring''' _a = [True] * n _a = False _a = False _a = True for i in range(3 , int(n**0.5 + 1 ) , 2 ): ...
612
0
"""simple docstring""" from statistics import mean import numpy as np def lowerCAmelCase ( UpperCamelCase_: list , UpperCamelCase_: list , UpperCamelCase_: list , UpperCamelCase_: int ) -> list: '''simple docstring''' _a...
713
"""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 sage...
612
0
"""simple docstring""" from random import shuffle import tensorflow as tf from numpy import array def lowerCAmelCase ( UpperCamelCase_: int , UpperCamelCase_: Dict ) -> Dict: '''simple docstring''' _a = int(a__ ) assert noofclus...
714
"""simple docstring""" import tempfile import torch from diffusers import PNDMScheduler from .test_schedulers import SchedulerCommonTest class lowercase_ (_UpperCAmelCase ): A__ : Union[str, Any] = (PNDMScheduler,) A__ : Optional[int] = (('''num_inferenc...
612
0
"""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 CLI...
715
"""simple docstring""" from __future__ import annotations from collections.abc import Callable from typing import Generic, TypeVar UpperCamelCase = TypeVar("""T""") UpperCamelCase = TypeVar("""U""") class lowercase_ (Generic[T, U] ): def __init__( ...
612
0
"""simple docstring""" from __future__ import annotations def lowerCAmelCase ( UpperCamelCase_: Optional[int] , UpperCamelCase_: int , UpperCamelCase_: List[str] , UpperCamelCase_: List[str] , UpperCamelCase_: Optional[int] , ) -> ...
716
"""simple docstring""" import inspect from typing import Callable, List, Optional, Union import torch from transformers import ( CLIPImageProcessor, CLIPTextModel, CLIPTokenizer, WhisperForConditionalGeneration, WhisperProcessor, ) from diffusers import ( AutoencoderKL, DDIMSche...
612
0
def lowerCAmelCase ( UpperCamelCase_: float , UpperCamelCase_: list[float] ) -> float: '''simple docstring''' if discount_rate < 0: raise ValueError("Discount rate cannot be negative" ) if not cash_flows: raise ValueError("Cash flows lis...
717
"""simple docstring""" import json import os import re import shutil import tempfile import unittest from typing import Tuple from transformers import AddedToken, BatchEncoding, ByTaTokenizer from transformers.utils import cached_property, is_tf_available, is_torch_available from ...test_tokenization_commo...
612
0
"""simple docstring""" import math def lowerCAmelCase ( UpperCamelCase_: List[str] ) -> Tuple: '''simple docstring''' _a = [] _a = 2 _a = int(math.sqrt(_lowercase ) ) # Size of every segment _a = [True] * (end + 1) _a ...
718
"""simple docstring""" from ..utils import DummyObject, requires_backends class lowercase_ (metaclass=_UpperCAmelCase ): A__ : Any = ['''torch''', '''torchsde'''] def __init__( self , *a_ , **a_ ) ->Optional[int]: '''simple docstr...
612
0
"""simple docstring""" from typing import TYPE_CHECKING from ...utils import OptionalDependencyNotAvailable, _LazyModule, is_sentencepiece_available UpperCamelCase = {} try: if not is_sentencepiece_available(): raise OptionalDependencyNotAvailable() except OptionalDependencyN...
719
"""simple docstring""" import numpy as np from numpy import ndarray from scipy.optimize import Bounds, LinearConstraint, minimize def lowerCAmelCase ( UpperCamelCase_: ndarray ) -> float: '''simple docstring''' return np.dot(UpperCamelCase_ , Uppe...
612
0
"""simple docstring""" import itertools from dataclasses import dataclass from typing import Any, Callable, Dict, List, Optional, Union import pandas as pd import pyarrow as pa import datasets import datasets.config from datasets.features.features import require_storage_cast from datasets.table import tabl...
720
"""simple docstring""" from typing import TYPE_CHECKING from ...utils import ( OptionalDependencyNotAvailable, _LazyModule, is_sentencepiece_available, is_tokenizers_available, is_torch_available, ) UpperCamelCase = {"""configuration_fnet""": ["""FNET_PRETRAINED_CONFIG_...
612
0
"""simple docstring""" from __future__ import annotations def lowerCAmelCase ( UpperCamelCase_: float , UpperCamelCase_: float , UpperCamelCase_: float , ) -> tuple[str, float]: '''simple docstring''' if (stress, tangential_force, ...
721
"""simple docstring""" import argparse import json import os from collections import OrderedDict import numpy as np import tensorflow as tf import torch def lowerCAmelCase ( UpperCamelCase_: Dict ) -> Any: '''simple docstring''' _a = os.path.jo...
612
0
"""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 GradientState from ac...
700
"""simple docstring""" import os import time from dataclasses import dataclass, field from enum import Enum from typing import Dict, List, Optional, Union import torch from filelock import FileLock from torch.utils.data import Dataset from ...models.auto.modeling_auto import MODEL_FOR_QUESTION_ANSWERING_MA...
612
0
from dataclasses import dataclass from typing import Tuple import numpy as np import torch @dataclass class lowercase_ : A__ : torch.Tensor # [batch_size x 3] A__ : torch.Tensor # [batch_size x 3] A__ : torch.Tensor # [batch_size x 3] A__ : torch.Tensor # [batch_size x ...
701
"""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.org/licenses/LICEN...
612
0
"""simple docstring""" import unittest from diffusers import FlaxAutoencoderKL from diffusers.utils import is_flax_available from diffusers.utils.testing_utils import require_flax from .test_modeling_common_flax import FlaxModelTesterMixin if is_flax_available(): import jax @require_flax class ...
702
"""simple docstring""" import importlib import json import os from collections import OrderedDict from typing import Dict, Optional, Union # Build the list of all image processors from ...configuration_utils import PretrainedConfig from ...dynamic_module_utils import get_class_from_dynamic_module, resolve_t...
612
0
"""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_common import ConfigTes...
703
"""simple docstring""" import warnings from ...utils import logging from .image_processing_yolos import YolosImageProcessor UpperCamelCase = logging.get_logger(__name__) class lowercase_ (_UpperCAmelCase ): def __init__( self , *a_ , **a_ ) ->No...
612
0
import argparse import json import subprocess def lowerCAmelCase ( UpperCamelCase_: List[Any] , UpperCamelCase_: int ) -> Union[str, Any]: '''simple docstring''' _a = [] _a = ( f'''curl -H "Accept: application/vnd.github+jso...
704
"""simple docstring""" import argparse import json import os import numpy as np import PIL import requests import tensorflow.keras.applications.efficientnet as efficientnet import torch from huggingface_hub import hf_hub_download from PIL import Image from tensorflow.keras.preprocessing import image from t...
612
0
"""simple docstring""" def lowerCAmelCase ( UpperCamelCase_: str , UpperCamelCase_: Dict , UpperCamelCase_: str ) -> Optional[int]: '''simple docstring''' if n == 0: return 1 elif n % 2 == 1: return (binary_exponentiation(__sn...
705
"""simple docstring""" from typing import TYPE_CHECKING from ...utils import OptionalDependencyNotAvailable, _LazyModule, is_tf_available, is_torch_available UpperCamelCase = { """configuration_transfo_xl""": ["""TRANSFO_XL_PRETRAINED_CONFIG_ARCHIVE_MAP""", """TransfoXLConfig"""], ...
612
0
"""simple docstring""" from typing import TYPE_CHECKING from ...utils import OptionalDependencyNotAvailable, _LazyModule, is_torch_available UpperCamelCase = { '''configuration_bigbird_pegasus''': [ '''BIGBIRD_PEGASUS_PRETRAINED_CONFIG_ARCHIVE_MAP''', '''BigBirdPegasusC...
706
"""simple docstring""" import argparse import json import os import fairseq import torch from fairseq.data import Dictionary from transformers import ( WavaVecaConfig, WavaVecaCTCTokenizer, WavaVecaFeatureExtractor, WavaVecaForCTC, WavaVecaForPreTraining, WavaVecaProcessor, logg...
612
0
from typing import TYPE_CHECKING from ...utils import ( OptionalDependencyNotAvailable, _LazyModule, is_flax_available, is_tf_available, is_torch_available, ) UpperCamelCase = { """configuration_wav2vec2""": ["""WAV_2_VEC_2_PRETRAINED_CONFIG_ARCHIVE_MAP""", """Wav2Vec2C...
707
"""simple docstring""" import copy import fnmatch import json import os import pickle as pkl import shutil import sys import tarfile import tempfile from collections import OrderedDict from contextlib import contextmanager from functools import partial from hashlib import shaaaa from io import BytesIO from p...
612
0
"""simple docstring""" from typing import List import datasets from datasets.tasks import AudioClassification from ..folder_based_builder import folder_based_builder UpperCamelCase = datasets.utils.logging.get_logger(__name__) class lowercase_ (folder_based_builder.FolderBasedBu...
708
"""simple docstring""" def lowerCAmelCase ( UpperCamelCase_: Optional[int] , UpperCamelCase_: str ) -> List[Any]: '''simple docstring''' _a = (boundary[1] - boundary[0]) / steps _a = boundary[0] _a = boundary[1] _a = ...
612
0
"""simple docstring""" UpperCamelCase = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/' def lowerCAmelCase ( UpperCamelCase_: bytes ) -> bytes: '''simple docstring''' if not isinstance(_A , _A ): _a ...
709
"""simple docstring""" import os from typing import BinaryIO, Optional, Union import numpy as np import pyarrow.parquet as pq from .. import Audio, Dataset, Features, Image, NamedSplit, Value, config from ..features.features import FeatureType, _visit from ..formatting import query_table from ..packaged_mo...
612
0
def lowerCAmelCase ( ) -> List[Any]: '''simple docstring''' _a = [] _a = 1 while len(A_ ) < 1E6: constant.append(str(A_ ) ) i += 1 _a = "".join(A_ ) return ( int(constant[0] ) * int(constant[9] ) ...
710
"""simple docstring""" import torch from diffusers import KDPMaDiscreteScheduler from diffusers.utils import torch_device from .test_schedulers import SchedulerCommonTest class lowercase_ (_UpperCAmelCase ): A__ : Tuple = (KDPMaDiscreteScheduler,) A__ : Tuple ...
612
0
from ...configuration_utils import PretrainedConfig from ...utils import logging from ...utils.backbone_utils import BackboneConfigMixin, get_aligned_output_features_output_indices UpperCamelCase = logging.get_logger(__name__) class lowercase_ (snake_case__, snake_case__ ): ...
711
"""simple docstring""" # Copyright 2021 The HuggingFace Team. All rights reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2....
612
0
"""simple docstring""" from abc import ABC, abstractmethod from typing import Optional, Union from .. import Dataset, DatasetDict, Features, IterableDataset, IterableDatasetDict, NamedSplit from ..utils.typing import NestedDataStructureLike, PathLike class lowercase_ (_UpperCA...
712
"""simple docstring""" import math def lowerCAmelCase ( UpperCamelCase_: int ) -> list: '''simple docstring''' _a = [True] * n _a = False _a = False _a = True for i in range(3 , int(n**0.5 + 1 ) , 2 ): ...
612
0
"""simple docstring""" import dataclasses import json import warnings from dataclasses import dataclass, field from time import time from typing import List from ..utils import logging UpperCamelCase = logging.get_logger(__name__) def lowerCAmelCase ( UpperCamelCase_: ...
713
"""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 sage...
612
0
"""simple docstring""" from collections.abc import Generator from math import sin def lowerCAmelCase ( UpperCamelCase_: bytes ) -> str: '''simple docstring''' if len(A__ ) != 32: raise ValueError("Input must be of length 32" ) _a ...
714
"""simple docstring""" import tempfile import torch from diffusers import PNDMScheduler from .test_schedulers import SchedulerCommonTest class lowercase_ (_UpperCAmelCase ): A__ : Union[str, Any] = (PNDMScheduler,) A__ : Optional[int] = (('''num_inferenc...
612
0
"""simple docstring""" import unittest from transformers import is_flax_available from transformers.testing_utils import require_flax, require_sentencepiece, require_tokenizers, require_torch, slow if is_flax_available(): import optax from flax.training.common_utils import onehot from tran...
715
"""simple docstring""" from __future__ import annotations from collections.abc import Callable from typing import Generic, TypeVar UpperCamelCase = TypeVar("""T""") UpperCamelCase = TypeVar("""U""") class lowercase_ (Generic[T, U] ): def __init__( ...
612
0
"""simple docstring""" from typing import Callable, Dict, Optional, Tuple import torch from torch import nn from torch.distributions import ( AffineTransform, Distribution, Independent, NegativeBinomial, Normal, StudentT, TransformedDistribution, ) class lowercase_ (_Up...
716
"""simple docstring""" import inspect from typing import Callable, List, Optional, Union import torch from transformers import ( CLIPImageProcessor, CLIPTextModel, CLIPTokenizer, WhisperForConditionalGeneration, WhisperProcessor, ) from diffusers import ( AutoencoderKL, DDIMSche...
612
0
from __future__ import annotations def lowerCAmelCase ( UpperCamelCase_: list , UpperCamelCase_: int , UpperCamelCase_: int , UpperCamelCase_: int ) -> list: '''simple docstring''' _a = [] _a , _a = input_list...
717
"""simple docstring""" import json import os import re import shutil import tempfile import unittest from typing import Tuple from transformers import AddedToken, BatchEncoding, ByTaTokenizer from transformers.utils import cached_property, is_tf_available, is_torch_available from ...test_tokenization_commo...
612
0
"""simple docstring""" def lowerCAmelCase ( UpperCamelCase_: Any ) -> Any: '''simple docstring''' _a = [0] * len(UpperCamelCase_ ) _a = [] _a = [1] * len(UpperCamelCase_ ) for values in graph.values(): for i in values: indegre...
718
"""simple docstring""" from ..utils import DummyObject, requires_backends class lowercase_ (metaclass=_UpperCAmelCase ): A__ : Any = ['''torch''', '''torchsde'''] def __init__( self , *a_ , **a_ ) ->Optional[int]: '''simple docstr...
612
0
"""simple docstring""" import glob import os import random from string import ascii_lowercase, digits import cva UpperCamelCase = """""" UpperCamelCase = """""" UpperCamelCase = """""" UpperCamelCase = 1 # (0 is vertical, 1 is horizontal) def ...
719
"""simple docstring""" import numpy as np from numpy import ndarray from scipy.optimize import Bounds, LinearConstraint, minimize def lowerCAmelCase ( UpperCamelCase_: ndarray ) -> float: '''simple docstring''' return np.dot(UpperCamelCase_ , Uppe...
612
0
"""simple docstring""" from collections import OrderedDict from typing import Mapping from packaging import version from ...configuration_utils import PretrainedConfig from ...onnx import OnnxConfig from ...utils import logging UpperCamelCase = logging.get_logger(__name__) UpperCamelCase...
720
"""simple docstring""" from typing import TYPE_CHECKING from ...utils import ( OptionalDependencyNotAvailable, _LazyModule, is_sentencepiece_available, is_tokenizers_available, is_torch_available, ) UpperCamelCase = {"""configuration_fnet""": ["""FNET_PRETRAINED_CONFIG_...
612
0
"""simple docstring""" import argparse import os from transformers.utils import direct_transformers_import # All paths are set with the intent you should run this script from the root of the repo with the command # python utils/check_task_guides.py UpperCamelCase = """src/transformers""" U...
721
"""simple docstring""" import argparse import json import os from collections import OrderedDict import numpy as np import tensorflow as tf import torch def lowerCAmelCase ( UpperCamelCase_: Dict ) -> Any: '''simple docstring''' _a = os.path.jo...
612
0
"""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 UpperCamelCase = logging.get_logger(__name__) UpperCamelCase ...
700
"""simple docstring""" import os import time from dataclasses import dataclass, field from enum import Enum from typing import Dict, List, Optional, Union import torch from filelock import FileLock from torch.utils.data import Dataset from ...models.auto.modeling_auto import MODEL_FOR_QUESTION_ANSWERING_MA...
612
0
def lowerCAmelCase ( UpperCamelCase_: Tuple ) -> Optional[Any]: '''simple docstring''' assert column_title.isupper() _a = 0 _a = len(_lowerCAmelCase ) - 1 _a = 0 while index >= 0: _a = (ord(column_title[index] ) - 64...
701
"""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.org/licenses/LICEN...
612
0
"""simple docstring""" import unittest from transformers import XLMConfig, is_torch_available from transformers.testing_utils import require_torch, slow, torch_device from ...generation.test_utils import GenerationTesterMixin from ...test_configuration_common import ConfigTester from ...test_modeling_commo...
702
"""simple docstring""" import importlib import json import os from collections import OrderedDict from typing import Dict, Optional, Union # Build the list of all image processors from ...configuration_utils import PretrainedConfig from ...dynamic_module_utils import get_class_from_dynamic_module, resolve_t...
612
0
"""simple docstring""" from __future__ import annotations import math class lowercase_ : def __init__( self , a_ ) ->List[Any]: '''simple docstring''' _a = size # approximate the overall size of segment tree with given value _a ...
703
"""simple docstring""" import warnings from ...utils import logging from .image_processing_yolos import YolosImageProcessor UpperCamelCase = logging.get_logger(__name__) class lowercase_ (_UpperCAmelCase ): def __init__( self , *a_ , **a_ ) ->No...
612
0
from typing import TYPE_CHECKING from ...utils import OptionalDependencyNotAvailable, _LazyModule, is_tokenizers_available, is_torch_available UpperCamelCase = { """configuration_biogpt""": ["""BIOGPT_PRETRAINED_CONFIG_ARCHIVE_MAP""", """BioGptConfig"""], """tokenization_biogpt""": [""...
704
"""simple docstring""" import argparse import json import os import numpy as np import PIL import requests import tensorflow.keras.applications.efficientnet as efficientnet import torch from huggingface_hub import hf_hub_download from PIL import Image from tensorflow.keras.preprocessing import image from t...
612
0
"""simple docstring""" import collections import inspect import unittest from typing import Dict, List, Tuple from transformers import MaskFormerSwinConfig from transformers.testing_utils import require_torch, require_torch_multi_gpu, torch_device from transformers.utils import is_torch_available from ...t...
705
"""simple docstring""" from typing import TYPE_CHECKING from ...utils import OptionalDependencyNotAvailable, _LazyModule, is_tf_available, is_torch_available UpperCamelCase = { """configuration_transfo_xl""": ["""TRANSFO_XL_PRETRAINED_CONFIG_ARCHIVE_MAP""", """TransfoXLConfig"""], ...
612
0
"""simple docstring""" import logging import re import pytorch_quantization import pytorch_quantization.nn as quant_nn import torch from pytorch_quantization import calib from pytorch_quantization.tensor_quant import QuantDescriptor UpperCamelCase = logging.getLogger(__name__) UpperCamelC...
706
"""simple docstring""" import argparse import json import os import fairseq import torch from fairseq.data import Dictionary from transformers import ( WavaVecaConfig, WavaVecaCTCTokenizer, WavaVecaFeatureExtractor, WavaVecaForCTC, WavaVecaForPreTraining, WavaVecaProcessor, logg...
612
0
import json import sys import tempfile import unittest from pathlib import Path import transformers from transformers import ( CONFIG_MAPPING, IMAGE_PROCESSOR_MAPPING, AutoConfig, AutoImageProcessor, CLIPConfig, CLIPImageProcessor, ) from transformers.testing_utils import DUMMY_UNKNOWN_I...
707
"""simple docstring""" import copy import fnmatch import json import os import pickle as pkl import shutil import sys import tarfile import tempfile from collections import OrderedDict from contextlib import contextmanager from functools import partial from hashlib import shaaaa from io import BytesIO from p...
612
0
"""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 UpperCamelCase = logging.get_l...
708
"""simple docstring""" def lowerCAmelCase ( UpperCamelCase_: Optional[int] , UpperCamelCase_: str ) -> List[Any]: '''simple docstring''' _a = (boundary[1] - boundary[0]) / steps _a = boundary[0] _a = boundary[1] _a = ...
612
0
"""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(): f...
709
"""simple docstring""" import os from typing import BinaryIO, Optional, Union import numpy as np import pyarrow.parquet as pq from .. import Audio, Dataset, Features, Image, NamedSplit, Value, config from ..features.features import FeatureType, _visit from ..formatting import query_table from ..packaged_mo...
612
0
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_available(): import...
710
"""simple docstring""" import torch from diffusers import KDPMaDiscreteScheduler from diffusers.utils import torch_device from .test_schedulers import SchedulerCommonTest class lowercase_ (_UpperCAmelCase ): A__ : Tuple = (KDPMaDiscreteScheduler,) A__ : Tuple ...
612
0
def lowerCAmelCase ( UpperCamelCase_: int = 1000 ) -> Optional[int]: '''simple docstring''' _a = 3 _a = 0 while a < n: if a % 3 == 0 or a % 5 == 0: result += a elif a % 15 == 0: result -= a a += 1 return result if __n...
711
"""simple docstring""" # Copyright 2021 The HuggingFace Team. All rights reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2....
612
0
"""simple docstring""" from typing import List, Optional, Union from ...processing_utils import ProcessorMixin from ...tokenization_utils_base import BatchEncoding, PaddingStrategy, PreTokenizedInput, TextInput, TruncationStrategy from ...utils import TensorType class lowercase_ ...
712
"""simple docstring""" import math def lowerCAmelCase ( UpperCamelCase_: int ) -> list: '''simple docstring''' _a = [True] * n _a = False _a = False _a = True for i in range(3 , int(n**0.5 + 1 ) , 2 ): ...
612
0
"""simple docstring""" import json import os import shutil import tempfile import unittest import numpy as np import pytest from transformers import BertTokenizer, BertTokenizerFast from transformers.models.bert.tokenization_bert import VOCAB_FILES_NAMES from transformers.testing_utils import require_visio...
713
"""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 sage...
612
0
"""simple docstring""" from diffusers.utils.testing_utils import require_onnxruntime @require_onnxruntime class lowercase_ : pass
714
"""simple docstring""" import tempfile import torch from diffusers import PNDMScheduler from .test_schedulers import SchedulerCommonTest class lowercase_ (_UpperCAmelCase ): A__ : Union[str, Any] = (PNDMScheduler,) A__ : Optional[int] = (('''num_inferenc...
612
0
"""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_available, is_vision_a...
715
"""simple docstring""" from __future__ import annotations from collections.abc import Callable from typing import Generic, TypeVar UpperCamelCase = TypeVar("""T""") UpperCamelCase = TypeVar("""U""") class lowercase_ (Generic[T, U] ): def __init__( ...
612
0
"""simple docstring""" from typing import TYPE_CHECKING from ...utils import _LazyModule UpperCamelCase = {"""processing_wav2vec2_with_lm""": ["""Wav2Vec2ProcessorWithLM"""]} if TYPE_CHECKING: from .processing_wavaveca_with_lm import WavaVecaProcessorWithLM else: import sys ...
716
"""simple docstring""" import inspect from typing import Callable, List, Optional, Union import torch from transformers import ( CLIPImageProcessor, CLIPTextModel, CLIPTokenizer, WhisperForConditionalGeneration, WhisperProcessor, ) from diffusers import ( AutoencoderKL, DDIMSche...
612
0
from __future__ import annotations def lowerCAmelCase ( UpperCamelCase_: Union[str, Any] , UpperCamelCase_: List[str] ) -> List[Any]: '''simple docstring''' print(f'''Vertex\tShortest Distance from vertex {src}''' ) for i, d in enumerate(U...
717
"""simple docstring""" import json import os import re import shutil import tempfile import unittest from typing import Tuple from transformers import AddedToken, BatchEncoding, ByTaTokenizer from transformers.utils import cached_property, is_tf_available, is_torch_available from ...test_tokenization_commo...
612
0
"""simple docstring""" from collections.abc import Callable import numpy as np def lowerCAmelCase ( UpperCamelCase_: Callable , UpperCamelCase_: float , UpperCamelCase_: float , UpperCamelCase_: float , UpperCamelCase_: float ) -> T...
718
"""simple docstring""" from ..utils import DummyObject, requires_backends class lowercase_ (metaclass=_UpperCAmelCase ): A__ : Any = ['''torch''', '''torchsde'''] def __init__( self , *a_ , **a_ ) ->Optional[int]: '''simple docstr...
612
0
"""simple docstring""" import argparse import os.path as osp import re import torch from safetensors.torch import load_file, save_file # =================# # UNet Conversion # # =================# UpperCamelCase = [ # (stable-diffusion, HF Diffusers) ('time_embed.0.weight', 'time_em...
719
"""simple docstring""" import numpy as np from numpy import ndarray from scipy.optimize import Bounds, LinearConstraint, minimize def lowerCAmelCase ( UpperCamelCase_: ndarray ) -> float: '''simple docstring''' return np.dot(UpperCamelCase_ , Uppe...
612
0
"""simple docstring""" def lowerCAmelCase ( UpperCamelCase_: Tuple ) -> str: '''simple docstring''' if not isinstance(UpperCamelCase__ , UpperCamelCase__ ): raise ValueError("Input must be an integer" ) if input_num <= 0: raise ValueEr...
720
"""simple docstring""" from typing import TYPE_CHECKING from ...utils import ( OptionalDependencyNotAvailable, _LazyModule, is_sentencepiece_available, is_tokenizers_available, is_torch_available, ) UpperCamelCase = {"""configuration_fnet""": ["""FNET_PRETRAINED_CONFIG_...
612
0
"""simple docstring""" import os import time import warnings from dataclasses import dataclass, field from enum import Enum from typing import List, Optional, Union import torch from filelock import FileLock from torch.utils.data import Dataset from ...tokenization_utils_base import PreTrainedTokenizerBase...
721
"""simple docstring""" import argparse import json import os from collections import OrderedDict import numpy as np import tensorflow as tf import torch def lowerCAmelCase ( UpperCamelCase_: Dict ) -> Any: '''simple docstring''' _a = os.path.jo...
612
0
"""simple docstring""" from math import pi, sqrt, tan def lowerCAmelCase ( UpperCamelCase_: float ) -> float: '''simple docstring''' if side_length < 0: raise ValueError("surface_area_cube() only accepts non-negative values" ) return 6 * sid...
700
"""simple docstring""" import os import time from dataclasses import dataclass, field from enum import Enum from typing import Dict, List, Optional, Union import torch from filelock import FileLock from torch.utils.data import Dataset from ...models.auto.modeling_auto import MODEL_FOR_QUESTION_ANSWERING_MA...
612
0