code
stringlengths
82
54.1k
code_codestyle
int64
0
699
style_context
stringlengths
111
35.6k
style_context_codestyle
int64
0
699
label
int64
0
1
import warnings 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 lowerCam...
0
'''simple docstring''' def snake_case_ ( _lowerCAmelCase : Any , _lowerCAmelCase : Optional[Any] , _lowerCAmelCase : Any , _lowerCAmelCase : Union[str, Any] ) -> Dict: # Return True if there is node that has not iterated. UpperCAmelCase : List[Any...
127
0
def _A ( _lowercase ) -> int: """simple docstring""" if not isinstance(_lowercase , _lowercase ): raise TypeError('only integers accepted as input' ) else: __UpperCamelCase = str(abs(_lowercase ) ) __UpperCamelCase = [list(_lowercase ) fo...
1
'''simple docstring''' from dataclasses import asdict, dataclass from typing import Optional from ...configuration_utils import PretrainedConfig from ...utils import logging UpperCamelCase__: int = logging.get_logger(__name__) # TODO Update this UpperCamelCase__: Any ...
127
0
# XXX: we want transformers master here - in the absense of conftest manipulating sys.path: # hack it in for now: import sys from pathlib import Path UpperCAmelCase_ = Path(__file__).resolve().parents[3] / """src""" sys.path.insert(1, str(git_repo_path)) import dataclasses # noqa import io ...
2
'''simple docstring''' from ...configuration_utils import PretrainedConfig from ...utils import logging UpperCamelCase__: List[Any] = logging.get_logger(__name__) UpperCamelCase__: str = { "unc-nlp/lxmert-base-uncased": "https://huggingface.co/unc-nlp/lxmer...
127
0
'''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_m...
3
'''simple docstring''' import math from numpy import inf from scipy.integrate import quad def snake_case_ ( _lowerCAmelCase : float ) -> float: if num <= 0: raise ValueError('''math domain error''' ) return quad(_lowerCAmelCase , 0 , _lo...
127
0
"""simple docstring""" import tempfile import unittest from transformers import TaConfig, is_torch_available from transformers.testing_utils import ( require_sentencepiece, require_tokenizers, require_torch, slow, torch_device, ) from ...generation.test_utils import GenerationTesterMixin fro...
4
'''simple docstring''' import json import os import unittest from transformers import BatchEncoding, LEDTokenizer, LEDTokenizerFast from transformers.models.led.tokenization_led import VOCAB_FILES_NAMES from transformers.testing_utils import require_tokenizers, require_torch from transforme...
127
0
'''simple docstring''' import os from typing import Any, Callable, Dict, List, Optional, Tuple, Union import torch from torch import nn from ...models.controlnet import ControlNetModel, ControlNetOutput from ...models.modeling_utils import ModelMixin from ...utils import logging _lowercase = loggi...
5
'''simple docstring''' from typing import Optional import numpy as np import torch from torch import nn from transformers import GPTaConfig, GPTaLMHeadModel from transformers.modeling_utils import ModuleUtilsMixin from ...configuration_utils import ConfigMixin, register_to_config from .....
127
0
class UpperCamelCase_ : def __init__( self :Tuple ) -> Union[str, Any]: """simple docstring""" SCREAMING_SNAKE_CASE__ = 0 SCREAMING_SNAKE_CASE__ = 0 SCREAMING_SNAKE_CASE__ = {} def _snake_case ( self :Di...
6
'''simple docstring''' import math from typing import Dict, Iterable, List, Optional, Tuple, Union import numpy as np from ...image_processing_utils import BaseImageProcessor, BatchFeature, get_size_dict from ...image_transforms import normalize, rescale, resize, to_channel_dimension_format...
127
0
"""simple docstring""" import absl # noqa: F401 # Here to have a nice missing dependency error message early on import nltk # noqa: F401 # Here to have a nice missing dependency error message early on import numpy # noqa: F401 # Here to have a nice missing dependency error message early on import six # noqa: ...
7
'''simple docstring''' def snake_case_ ( _lowerCAmelCase : str , _lowerCAmelCase : str ) -> int: if len(_lowerCAmelCase ) != len(_lowerCAmelCase ): raise ValueError('''String lengths must match!''' ) UpperCAmelCase : List[str] ...
127
0
'''simple docstring''' import re from flax.core.frozen_dict import freeze from flax.traverse_util import flatten_dict, unflatten_dict from jax.experimental import PartitionSpec as P # Sentinels lowercase__ : List[str] = object() # For specifying empty leaf dict `{}...
8
'''simple docstring''' from __future__ import annotations def snake_case_ ( _lowerCAmelCase : list[int] ) -> int: if not nums: return 0 UpperCAmelCase : Tuple = nums[0] UpperCAmelCase : List[str] = 0 ...
127
0
from math import factorial SCREAMING_SNAKE_CASE__ = {str(digit): factorial(digit) for digit in range(1_0)} def A ( __UpperCamelCase ) -> int: if not isinstance(__UpperCamelCase , __UpperCamelCase ): raise TypeError('Parameter number must be int' ) if num...
9
'''simple docstring''' import re def snake_case_ ( _lowerCAmelCase : str ) -> str: if len(re.findall('''[ATCG]''' , _lowerCAmelCase ) ) != len(_lowerCAmelCase ): raise ValueError('''Invalid Strand''' ) return dna.translate(dna.make...
127
0
import os from tempfile import TemporaryDirectory from unittest import TestCase import pytest from absl.testing import parameterized from datasets import config from datasets.arrow_reader import HF_GCP_BASE_URL from datasets.builder import DatasetBuilder from datasets.dataset_dict import IterableDatasetDict from data...
10
'''simple docstring''' import unittest import numpy as np from transformers.testing_utils import require_torch, require_vision from transformers.utils import is_torch_available, is_vision_available from ...test_image_processing_common import ImageProcessingSavingTestMixin if is_torch...
127
0
'''simple docstring''' import os import re from shutil import copyfile from typing import List, Optional, Tuple from ...tokenization_utils import PreTrainedTokenizer from ...utils import logging lowercase_ = logging.get_logger(__name__) lowercase_ = { "vocab_file": "vocab.txt", ...
11
'''simple docstring''' def snake_case_ ( _lowerCAmelCase : str ) -> int: if not head: return True # split the list to two parts UpperCAmelCase , UpperCAmelCase : str = head.next, head while fast and fast.next: ...
127
0
import os lowerCamelCase__ : int = {"""I""": 1, """V""": 5, """X""": 1_0, """L""": 5_0, """C""": 1_0_0, """D""": 5_0_0, """M""": 1_0_0_0} def UpperCamelCase ( lowercase_ ) -> int: '''simple docstring''' lowercase__ : Optional[Any] = 0 lowercase__ : L...
12
'''simple docstring''' def snake_case_ ( _lowerCAmelCase : int , _lowerCAmelCase : Dict , _lowerCAmelCase : List[str] , _lowerCAmelCase : str , _lowerCAmelCase : Optional[int] , _lowerCAmelCase : List[Any] ) -> Union[str, Any]: if index == r: ...
127
0
'''simple docstring''' import unittest from transformers import DebertaVaConfig, is_torch_available from transformers.testing_utils import require_sentencepiece, require_tokenizers, require_torch, slow, torch_device from ...test_configuration_common import ConfigTester from ...test_modeling_common import ModelT...
13
'''simple docstring''' import os from bleurt import score # From: git+https://github.com/google-research/bleurt.git import datasets UpperCamelCase__: Any = datasets.logging.get_logger(__name__) UpperCamelCase__: Union[str, Any] = "\\n@inproceedings{bleur...
127
0
import argparse import os import re import numpy as np import PIL import torch from timm import create_model from torch.optim.lr_scheduler import OneCycleLR from torch.utils.data import DataLoader, Dataset from torchvision.transforms import Compose, RandomResizedCrop, Resize, ToTensor from accelerate ...
14
'''simple docstring''' import unittest from diffusers.pipelines.pipeline_utils import is_safetensors_compatible class SCREAMING_SNAKE_CASE( unittest.TestCase ): """simple docstring""" def A ( self : Tuple ) -> Optional[Any]:...
127
0
import math from typing import Dict, Iterable, List, Optional, Tuple, Union import numpy as np from ...image_processing_utils import BaseImageProcessor, BatchFeature, get_size_dict from ...image_transforms import normalize, rescale, resize, to_channel_dimension_format from ...image_utils import ( IM...
15
'''simple docstring''' import json import os from functools import lru_cache from typing import List, Optional, Tuple import regex as re from ...tokenization_utils import AddedToken, PreTrainedTokenizer from ...utils import logging UpperCamelCase__: str = logging.get_lo...
127
0
# Copyright 2021 The HuggingFace Team. All rights reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required ...
16
'''simple docstring''' import argparse import hashlib # hashlib is only used inside the Test class import struct class SCREAMING_SNAKE_CASE: """simple docstring""" def __init__( self : List[str] , __snake_case : Any ) -> Lis...
127
0
import argparse import torch from diffusers.pipelines.stable_diffusion.convert_from_ckpt import download_from_original_stable_diffusion_ckpt if __name__ == "__main__": UpperCAmelCase_ : str = argparse.ArgumentParser() parser.add_argument( '''--checkpoint_path''', default=None, type=str...
17
'''simple docstring''' def snake_case_ ( _lowerCAmelCase : int ) -> list: UpperCAmelCase : Union[str, Any] = int(_lowerCAmelCase ) if n_element < 1: UpperCAmelCase : int = ValueError('''a should be a positive num...
127
0
'''simple docstring''' import json import sys import tempfile import unittest from pathlib import Path import transformers from transformers import ( CONFIG_MAPPING, FEATURE_EXTRACTOR_MAPPING, AutoConfig, AutoFeatureExtractor, WavaVecaConfig, WavaVecaFeatureExtractor, ) from transformer...
18
'''simple docstring''' import numpy as np from scipy.spatial.distance import cdist from sklearn.metrics import fa_score import datasets UpperCamelCase__: str = "\\n @inproceedings{kakwani2020indicnlpsuite,\n title={{IndicNLPSuite: Monolingual Corpora, Evaluation Benchm...
127
0
"""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/licens...
19
'''simple docstring''' from __future__ import annotations UpperCamelCase__: Tuple = 1.60_21E-19 # units = C def snake_case_ ( _lowerCAmelCase : float , _lowerCAmelCase : float , _lowerCAmelCase : float , ) -> tuple[str, float]: if (conductivity,...
127
0
from typing import TYPE_CHECKING from ...utils import ( OptionalDependencyNotAvailable, _LazyModule, is_flax_available, is_tf_available, is_tokenizers_available, is_torch_available, ) _lowerCAmelCase: Optional[int] = { 'configuration_blenderbot': [ 'BLENDERBOT_...
20
'''simple docstring''' import shutil import tempfile import unittest import numpy as np import pytest from transformers.testing_utils import require_vision from transformers.utils import is_vision_available if is_vision_available(): from PIL import Image from transfor...
127
0
from __future__ import annotations def lowerCAmelCase_ ( lowerCamelCase , lowerCamelCase , lowerCamelCase , lowerCamelCase ): __magic_name__ : str =[] __magic_name__ , __magic_name__ : str =input_list[low:mid], input_list[...
21
'''simple docstring''' import flax.linen as nn import jax.numpy as jnp from .attention_flax import FlaxTransformeraDModel from .resnet_flax import FlaxDownsampleaD, FlaxResnetBlockaD, FlaxUpsampleaD class SCREAMING_SNAKE_CASE( nn.Module ): """simple docstring""...
127
0
'''simple docstring''' import random import unittest import numpy as np from diffusers import ( DPMSolverMultistepScheduler, EulerAncestralDiscreteScheduler, EulerDiscreteScheduler, LMSDiscreteScheduler, OnnxStableDiffusionImgaImgPipeline, PNDMScheduler, ) from diff...
22
'''simple docstring''' def snake_case_ ( _lowerCAmelCase : Any , _lowerCAmelCase : Optional[Any] , _lowerCAmelCase : Any , _lowerCAmelCase : Union[str, Any] ) -> Dict: # Return True if there is node that has not iterated. UpperCAmelCase : List[Any...
127
0
import datasets from .evaluate import evaluate snake_case__ : int = """\ @article{hendrycks2021cuad, title={CUAD: An Expert-Annotated NLP Dataset for Legal Contract Review}, author={Dan Hendrycks and Collin Burns and Anya Chen and Spencer Ball}, journal={arXi...
23
'''simple docstring''' from dataclasses import asdict, dataclass from typing import Optional from ...configuration_utils import PretrainedConfig from ...utils import logging UpperCamelCase__: int = logging.get_logger(__name__) # TODO Update this UpperCamelCase__: Any ...
127
0
'''simple docstring''' import unittest import numpy as np from transformers.testing_utils import is_flaky, 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...
24
'''simple docstring''' from ...configuration_utils import PretrainedConfig from ...utils import logging UpperCamelCase__: List[Any] = logging.get_logger(__name__) UpperCamelCase__: str = { "unc-nlp/lxmert-base-uncased": "https://huggingface.co/unc-nlp/lxmer...
127
0
import argparse import pathlib import fairseq import torch from fairseq.models.roberta import RobertaModel as FairseqRobertaModel from fairseq.modules import TransformerSentenceEncoderLayer from packaging import version from transformers import XLMRobertaConfig, XLMRobertaXLForMaskedLM, XLMRobertaXLForSequenceClass...
25
'''simple docstring''' import math from numpy import inf from scipy.integrate import quad def snake_case_ ( _lowerCAmelCase : float ) -> float: if num <= 0: raise ValueError('''math domain error''' ) return quad(_lowerCAmelCase , 0 , _lo...
127
0
'''simple docstring''' def _a ( _lowerCamelCase = 400_0000 ) -> int: """simple docstring""" __snake_case : str = [0, 1] __snake_case : Optional[int] = 0 while fib[i] <= n: fib.append(fib[i] + f...
26
'''simple docstring''' import json import os import unittest from transformers import BatchEncoding, LEDTokenizer, LEDTokenizerFast from transformers.models.led.tokenization_led import VOCAB_FILES_NAMES from transformers.testing_utils import require_tokenizers, require_torch from transforme...
127
0
from typing import Dict, List, Optional, Union import numpy as np from ...image_processing_utils import BaseImageProcessor, BatchFeature, get_size_dict from ...image_transforms import ( center_crop, convert_to_rgb, get_resize_output_image_size, normalize, rescale, resize...
27
'''simple docstring''' from typing import Optional import numpy as np import torch from torch import nn from transformers import GPTaConfig, GPTaLMHeadModel from transformers.modeling_utils import ModuleUtilsMixin from ...configuration_utils import ConfigMixin, register_to_config from .....
127
0
'''simple docstring''' from typing import TYPE_CHECKING from ...utils import OptionalDependencyNotAvailable, _LazyModule, is_tf_available, is_torch_available UpperCamelCase_ = { "configuration_groupvit": [ "GROUPVIT_PRETRAINED_CONFIG_ARCHIVE_MAP", "GroupViTConfig",...
28
'''simple docstring''' import math from typing import Dict, Iterable, List, Optional, Tuple, Union import numpy as np from ...image_processing_utils import BaseImageProcessor, BatchFeature, get_size_dict from ...image_transforms import normalize, rescale, resize, to_channel_dimension_format...
127
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 from .....
29
'''simple docstring''' def snake_case_ ( _lowerCAmelCase : str , _lowerCAmelCase : str ) -> int: if len(_lowerCAmelCase ) != len(_lowerCAmelCase ): raise ValueError('''String lengths must match!''' ) UpperCAmelCase : List[str] ...
127
0
from ...configuration_utils import PretrainedConfig from ...utils import logging __a = logging.get_logger(__name__) __a = { 'facebook/xglm-564M': 'https://huggingface.co/facebook/xglm-564M/resolve/main/config.json', # See all XGLM models at https://huggingface.co/models?fil...
30
'''simple docstring''' from __future__ import annotations def snake_case_ ( _lowerCAmelCase : list[int] ) -> int: if not nums: return 0 UpperCAmelCase : Tuple = nums[0] UpperCAmelCase : List[str] = 0 ...
127
0
import unittest import numpy as np from transformers import is_flax_available from transformers.testing_utils import require_flax from ..test_modeling_flax_common import ids_tensor if is_flax_available(): import jax import jax.numpy as jnp from transformers.generation import ( FlaxForcedBOSTo...
31
'''simple docstring''' import re def snake_case_ ( _lowerCAmelCase : str ) -> str: if len(re.findall('''[ATCG]''' , _lowerCAmelCase ) ) != len(_lowerCAmelCase ): raise ValueError('''Invalid Strand''' ) return dna.translate(dna.make...
127
0
import tempfile import torch from diffusers import ( DEISMultistepScheduler, DPMSolverMultistepScheduler, DPMSolverSinglestepScheduler, UniPCMultistepScheduler, ) from .test_schedulers import SchedulerCommonTest class __UpperCamelCase ( A__ ): __A : List[str] = ...
32
'''simple docstring''' import unittest import numpy as np from transformers.testing_utils import require_torch, require_vision from transformers.utils import is_torch_available, is_vision_available from ...test_image_processing_common import ImageProcessingSavingTestMixin if is_torch...
127
0
def SCREAMING_SNAKE_CASE ( __lowerCAmelCase ) -> int: snake_case__ = [1] snake_case__ , snake_case__ , snake_case__ = 0, 0, 0 snake_case__ = ugly_nums[ia] * 2 snake_case__ = ugly_nums[ia] * 3 snake_case__ = ugly_nums[ia] * 5 for _ in range(1 ...
33
'''simple docstring''' def snake_case_ ( _lowerCAmelCase : str ) -> int: if not head: return True # split the list to two parts UpperCAmelCase , UpperCAmelCase : str = head.next, head while fast and fast.next: ...
127
0
"""simple docstring""" import collections import os from typing import List, Optional, Tuple from transformers.utils import is_jieba_available, requires_backends if is_jieba_available(): import jieba from ...tokenization_utils import PreTrainedTokenizer from ...utils import logging SCREAMING_SNAKE_C...
34
'''simple docstring''' def snake_case_ ( _lowerCAmelCase : int , _lowerCAmelCase : Dict , _lowerCAmelCase : List[str] , _lowerCAmelCase : str , _lowerCAmelCase : Optional[int] , _lowerCAmelCase : List[Any] ) -> Union[str, Any]: if index == r: ...
127
0
from ...utils import ( OptionalDependencyNotAvailable, is_torch_available, is_transformers_available, is_transformers_version, ) try: if not (is_transformers_available() and is_torch_available() and is_transformers_version('>=', '4.25.0')): raise OptionalDependencyNotAvailable() except ...
35
'''simple docstring''' import os from bleurt import score # From: git+https://github.com/google-research/bleurt.git import datasets UpperCamelCase__: Any = datasets.logging.get_logger(__name__) UpperCamelCase__: Union[str, Any] = "\\n@inproceedings{bleur...
127
0
def lowercase ( __A : list ) -> list: '''simple docstring''' if len(__A ) <= 1: return lst snake_case : List[Any] = 1 while i < len(__A ): if lst[i - 1] <= lst[i]: i += 1 else: snake_case , snake_case...
36
'''simple docstring''' import unittest from diffusers.pipelines.pipeline_utils import is_safetensors_compatible class SCREAMING_SNAKE_CASE( unittest.TestCase ): """simple docstring""" def A ( self : Tuple ) -> Optional[Any]:...
127
0
import argparse import shutil import time from json import JSONDecodeError from logging import getLogger from pathlib import Path from typing import Dict, List import torch from torch.utils.data import DataLoader from tqdm import tqdm from transformers import AutoModelForSeqaSeqLM, AutoTokenizer from utils import ...
37
'''simple docstring''' import json import os from functools import lru_cache from typing import List, Optional, Tuple import regex as re from ...tokenization_utils import AddedToken, PreTrainedTokenizer from ...utils import logging UpperCamelCase__: str = logging.get_lo...
127
0
'''simple docstring''' from __future__ import annotations import math def UpperCamelCase__ ( __magic_name__ : float , __magic_name__ : int ) -> float: '''simple docstring''' snake_case__ : Dict = u for i in range(1 , __magic_name__ ): ...
38
'''simple docstring''' import argparse import hashlib # hashlib is only used inside the Test class import struct class SCREAMING_SNAKE_CASE: """simple docstring""" def __init__( self : List[str] , __snake_case : Any ) -> Lis...
127
0
from __future__ import annotations from collections import deque from collections.abc import Sequence from dataclasses import dataclass from typing import Any @dataclass class snake_case_ : '''simple docstring''' SCREAMING_SNAKE_CASE : int SCREAMING_SNAKE_CASE :...
39
'''simple docstring''' def snake_case_ ( _lowerCAmelCase : int ) -> list: UpperCAmelCase : Union[str, Any] = int(_lowerCAmelCase ) if n_element < 1: UpperCAmelCase : int = ValueError('''a should be a positive num...
127
0
import argparse import os import shutil import torch from emmental.modules import MagnitudeBinarizer, ThresholdBinarizer, TopKBinarizer def UpperCamelCase ( snake_case__ : List[Any] ) -> List[Any]: UpperCamelCase : str = args.pruning_method UpperCamelCase ...
40
'''simple docstring''' import numpy as np from scipy.spatial.distance import cdist from sklearn.metrics import fa_score import datasets UpperCamelCase__: str = "\\n @inproceedings{kakwani2020indicnlpsuite,\n title={{IndicNLPSuite: Monolingual Corpora, Evaluation Benchm...
127
0
'''simple docstring''' import unittest from queue import Empty from threading import Thread from transformers import AutoTokenizer, TextIteratorStreamer, TextStreamer, is_torch_available from transformers.testing_utils import CaptureStdout, require_torch, torch_device from ..test_modeling_common import ids_te...
41
'''simple docstring''' from __future__ import annotations UpperCamelCase__: Tuple = 1.60_21E-19 # units = C def snake_case_ ( _lowerCAmelCase : float , _lowerCAmelCase : float , _lowerCAmelCase : float , ) -> tuple[str, float]: if (conductivity,...
127
0
'''simple docstring''' A_ = { "Pillow": "Pillow<10.0.0", "accelerate": "accelerate>=0.20.3", "av": "av==9.2.0", "beautifulsoup4": "beautifulsoup4", "black": "black~=23.1", "codecarbon": "codecarbon==1.2.0", "cookiecutter": "cookiecutter==1.7.3", "dataclasses": "dataclasses", "...
42
'''simple docstring''' import shutil import tempfile import unittest import numpy as np import pytest from transformers.testing_utils import require_vision from transformers.utils import is_vision_available if is_vision_available(): from PIL import Image from transfor...
127
0
def _a ( SCREAMING_SNAKE_CASE , SCREAMING_SNAKE_CASE ): """simple docstring""" _enforce_args(SCREAMING_SNAKE_CASE , SCREAMING_SNAKE_CASE ) if n == 0: return 0 lowercase__ = float('''-inf''' ) for i in range(1 , n + 1 ): lowercase__ = max( ...
43
'''simple docstring''' import flax.linen as nn import jax.numpy as jnp from .attention_flax import FlaxTransformeraDModel from .resnet_flax import FlaxDownsampleaD, FlaxResnetBlockaD, FlaxUpsampleaD class SCREAMING_SNAKE_CASE( nn.Module ): """simple docstring""...
127
0
'''simple docstring''' from manim import * class UpperCAmelCase__ ( A ): def lowerCamelCase_ ( self : Any ): _lowerCamelCase : Optional[int] = Rectangle(height=0.5,width=0.5 ) _lowerCamelCase : Tuple = Rectangle(height=0.46,width=0.46 )...
44
'''simple docstring''' def snake_case_ ( _lowerCAmelCase : Any , _lowerCAmelCase : Optional[Any] , _lowerCAmelCase : Any , _lowerCAmelCase : Union[str, Any] ) -> Dict: # Return True if there is node that has not iterated. UpperCAmelCase : List[Any...
127
0
import logging import os from logging import ( CRITICAL, # NOQA DEBUG, # NOQA ERROR, # NOQA FATAL, # NOQA INFO, # NOQA NOTSET, # NOQA WARN, # NOQA WARNING, # NOQA ) from typing import Optional from tqdm import auto as tqdm_lib UpperCamelCase = { "debug": l...
45
'''simple docstring''' from dataclasses import asdict, dataclass from typing import Optional from ...configuration_utils import PretrainedConfig from ...utils import logging UpperCamelCase__: int = logging.get_logger(__name__) # TODO Update this UpperCamelCase__: Any ...
127
0
"""simple docstring""" import argparse import os.path as osp import re import torch from safetensors.torch import load_file, save_file # =================# # UNet Conversion # # =================# _lowerCAmelCase : str = [ # (stable-diffusion, HF Diffusers) ('''time_embed.0.weight''...
46
'''simple docstring''' from ...configuration_utils import PretrainedConfig from ...utils import logging UpperCamelCase__: List[Any] = logging.get_logger(__name__) UpperCamelCase__: str = { "unc-nlp/lxmert-base-uncased": "https://huggingface.co/unc-nlp/lxmer...
127
0
import glob import os import random from string import ascii_lowercase, digits import cva import numpy as np # Parrameters SCREAMING_SNAKE_CASE__ = (720, 1280) # Height, Width SCREAMING_SNAKE_CASE__ = (0.4, 0.6) # if height or width lower than this scale, drop it. SCREAM...
47
'''simple docstring''' import math from numpy import inf from scipy.integrate import quad def snake_case_ ( _lowerCAmelCase : float ) -> float: if num <= 0: raise ValueError('''math domain error''' ) return quad(_lowerCAmelCase , 0 , _lo...
127
0
'''simple docstring''' from dataclasses import dataclass from typing import List, Optional, Union import numpy as np import PIL import torch from transformers import CLIPImageProcessor, CLIPVisionModel from ...models import PriorTransformer from ...pipelines import DiffusionPipeline from ...schedulers import HeunDi...
48
'''simple docstring''' import json import os import unittest from transformers import BatchEncoding, LEDTokenizer, LEDTokenizerFast from transformers.models.led.tokenization_led import VOCAB_FILES_NAMES from transformers.testing_utils import require_tokenizers, require_torch from transforme...
127
0
"""simple docstring""" from typing import TYPE_CHECKING from ...utils import OptionalDependencyNotAvailable, _LazyModule, is_torch_available, is_vision_available _lowercase : Any = { 'configuration_poolformer': [ 'POOLFORMER_PRETRAINED_CONFIG_ARCHIVE_MAP', '...
49
'''simple docstring''' from typing import Optional import numpy as np import torch from torch import nn from transformers import GPTaConfig, GPTaLMHeadModel from transformers.modeling_utils import ModuleUtilsMixin from ...configuration_utils import ConfigMixin, register_to_config from .....
127
0
'''simple docstring''' from math import factorial def A__ ( __lowerCAmelCase : int = 20 ): lowerCamelCase__ = 2 * n # middle entry of odd rows starting at row 3 is the solution for n = 1, # 2, 3,... lowerCamelCase__ = n // 2 return int(factoria...
50
'''simple docstring''' import math from typing import Dict, Iterable, List, Optional, Tuple, Union import numpy as np from ...image_processing_utils import BaseImageProcessor, BatchFeature, get_size_dict from ...image_transforms import normalize, rescale, resize, to_channel_dimension_format...
127
0
'''simple docstring''' from __future__ import annotations from typing import TypedDict class lowerCAmelCase__ ( UpperCAmelCase_ ): '''simple docstring''' _lowerCamelCase =42 _lowerCamelCase =42 def __snake_case ( SCREAMING_SNAKE_CASE_ : str ) ...
51
'''simple docstring''' def snake_case_ ( _lowerCAmelCase : str , _lowerCAmelCase : str ) -> int: if len(_lowerCAmelCase ) != len(_lowerCAmelCase ): raise ValueError('''String lengths must match!''' ) UpperCAmelCase : List[str] ...
127
0
"""simple docstring""" import os from shutil import copyfile from typing import Any, Dict, List, Optional, Tuple import sentencepiece as spm from ...tokenization_utils import AddedToken, BatchEncoding, PreTrainedTokenizer from ...utils import logging A = logging.get_logger...
52
'''simple docstring''' from __future__ import annotations def snake_case_ ( _lowerCAmelCase : list[int] ) -> int: if not nums: return 0 UpperCAmelCase : Tuple = nums[0] UpperCAmelCase : List[str] = 0 ...
127
0
import importlib import inspect import json import os import re import shutil import sys from pathlib import Path from typing import Dict, Optional, Union from urllib import request from huggingface_hub import HfFolder, cached_download, hf_hub_download, model_info from packaging import version from .. import __...
53
'''simple docstring''' import re def snake_case_ ( _lowerCAmelCase : str ) -> str: if len(re.findall('''[ATCG]''' , _lowerCAmelCase ) ) != len(_lowerCAmelCase ): raise ValueError('''Invalid Strand''' ) return dna.translate(dna.make...
127
0
import inspect import unittest from datasets import load_dataset from packaging import version from transformers import BeitConfig from transformers.models.auto import get_values from transformers.testing_utils import require_torch, require_torch_multi_gpu, require_vision, slow, torch_device from...
54
'''simple docstring''' import unittest import numpy as np from transformers.testing_utils import require_torch, require_vision from transformers.utils import is_torch_available, is_vision_available from ...test_image_processing_common import ImageProcessingSavingTestMixin if is_torch...
127
0
import re from flax.core.frozen_dict import freeze from flax.traverse_util import flatten_dict, unflatten_dict from jax.experimental import PartitionSpec as P # Sentinels SCREAMING_SNAKE_CASE :Union[str, Any] = object() # For specifying empty leaf dict `{}` SCREAMING_SNAKE_CASE :List[str] ...
55
'''simple docstring''' def snake_case_ ( _lowerCAmelCase : str ) -> int: if not head: return True # split the list to two parts UpperCAmelCase , UpperCAmelCase : str = head.next, head while fast and fast.next: ...
127
0
'''simple docstring''' from __future__ import annotations import time from collections.abc import Sequence from random import randint from matplotlib import pyplot as plt def _a (lowercase__ : Sequence[float] , lowercase__ : int , lowercase__ : int ) -> tuple[int | ...
56
'''simple docstring''' def snake_case_ ( _lowerCAmelCase : int , _lowerCAmelCase : Dict , _lowerCAmelCase : List[str] , _lowerCAmelCase : str , _lowerCAmelCase : Optional[int] , _lowerCAmelCase : List[Any] ) -> Union[str, Any]: if index == r: ...
127
0
import os import sys import tempfile import unittest import unittest.mock as mock from pathlib import Path from huggingface_hub import HfFolder, delete_repo from huggingface_hub.file_download import http_get from requests.exceptions import HTTPError from transformers import ( AlbertToken...
57
'''simple docstring''' import os from bleurt import score # From: git+https://github.com/google-research/bleurt.git import datasets UpperCamelCase__: Any = datasets.logging.get_logger(__name__) UpperCamelCase__: Union[str, Any] = "\\n@inproceedings{bleur...
127
0
"""simple docstring""" def __lowerCAmelCase ( __UpperCamelCase : int ): '''simple docstring''' assert isinstance(__UpperCamelCase , __UpperCamelCase ), F'The input value of [n={number}] is not an integer' if number == 1: ...
58
'''simple docstring''' import unittest from diffusers.pipelines.pipeline_utils import is_safetensors_compatible class SCREAMING_SNAKE_CASE( unittest.TestCase ): """simple docstring""" def A ( self : Tuple ) -> Optional[Any]:...
127
0
from maths.prime_check import is_prime def lowerCAmelCase_ ( __a ) -> int: """simple docstring""" if not isinstance(__a , __a ): lowerCamelCase__: Any =F"""Input value of [number={number}] must be an integer""" raise TypeError(__a ) if i...
59
'''simple docstring''' import json import os from functools import lru_cache from typing import List, Optional, Tuple import regex as re from ...tokenization_utils import AddedToken, PreTrainedTokenizer from ...utils import logging UpperCamelCase__: str = logging.get_lo...
127
0
import importlib import json import os from collections import OrderedDict from typing import Dict, Optional, Union # Build the list of all feature extractors from ...configuration_utils import PretrainedConfig from ...dynamic_module_utils import get_class_from_dynamic_module, resolve_trust_remote_code from ...f...
60
'''simple docstring''' import argparse import hashlib # hashlib is only used inside the Test class import struct class SCREAMING_SNAKE_CASE: """simple docstring""" def __init__( self : List[str] , __snake_case : Any ) -> Lis...
127
0
import fire from utils import calculate_rouge, save_json def _A ( lowerCAmelCase_ : List[Any] , lowerCAmelCase_ : Optional[Any] , lowerCAmelCase_ : int=None , **lowerCAmelCase_ : Dict ): """simple docstring""" lowerCAmelCase__ = [x....
61
'''simple docstring''' def snake_case_ ( _lowerCAmelCase : int ) -> list: UpperCAmelCase : Union[str, Any] = int(_lowerCAmelCase ) if n_element < 1: UpperCAmelCase : int = ValueError('''a should be a positive num...
127
0
from __future__ import annotations def lowerCamelCase__ ( lowercase , lowercase , lowercase , lowercase ): # noqa: E741 """simple docstring""" while r - l > 1: SCREAMING_SNAKE_CASE : List[str] = (l + r) // 2 if v[m] >= key: SCREAMING_SNAKE_C...
62
'''simple docstring''' import numpy as np from scipy.spatial.distance import cdist from sklearn.metrics import fa_score import datasets UpperCamelCase__: str = "\\n @inproceedings{kakwani2020indicnlpsuite,\n title={{IndicNLPSuite: Monolingual Corpora, Evaluation Benchm...
127
0
import warnings from ...processing_utils import ProcessorMixin from ...tokenization_utils_base import BatchEncoding class a ( lowercase__ ): """simple docstring""" a : Optional[Any] = ['image_processor', 'tokenizer'] a : int ...
63
'''simple docstring''' from __future__ import annotations UpperCamelCase__: Tuple = 1.60_21E-19 # units = C def snake_case_ ( _lowerCAmelCase : float , _lowerCAmelCase : float , _lowerCAmelCase : float , ) -> tuple[str, float]: if (conductivity,...
127
0
from typing import TYPE_CHECKING from ...utils import OptionalDependencyNotAvailable, _LazyModule, is_torch_available, is_vision_available lowercase_ : Optional[int] = {'configuration_glpn': ['GLPN_PRETRAINED_CONFIG_ARCHIVE_MAP', 'GLPNConfig']} try: if not is_vision_available(): raise ...
64
'''simple docstring''' import shutil import tempfile import unittest import numpy as np import pytest from transformers.testing_utils import require_vision from transformers.utils import is_vision_available if is_vision_available(): from PIL import Image from transfor...
127
0
"""simple docstring""" import os import unicodedata from shutil import copyfile from typing import Any, Dict, List, Optional, Tuple import sentencepiece as spm from ...tokenization_utils import AddedToken, PreTrainedTokenizer from ...utils import SPIECE_UNDERLINE, logging __UpperCAmelCase ...
65
'''simple docstring''' import flax.linen as nn import jax.numpy as jnp from .attention_flax import FlaxTransformeraDModel from .resnet_flax import FlaxDownsampleaD, FlaxResnetBlockaD, FlaxUpsampleaD class SCREAMING_SNAKE_CASE( nn.Module ): """simple docstring""...
127
0
from ..utils import DummyObject, requires_backends class lowerCAmelCase_ ( metaclass=__snake_case ): _UpperCamelCase : Dict = ["torch", "scipy"] def __init__( self , *_lowerCAmelCase , **_lowerCAmelCase ): requires_backends(self , ['torc...
66
'''simple docstring''' def snake_case_ ( _lowerCAmelCase : Any , _lowerCAmelCase : Optional[Any] , _lowerCAmelCase : Any , _lowerCAmelCase : Union[str, Any] ) -> Dict: # Return True if there is node that has not iterated. UpperCAmelCase : List[Any...
127
0
import os import tempfile import unittest import numpy as np from diffusers.utils import is_flax_available from diffusers.utils.testing_utils import require_flax, slow if is_flax_available(): import jax import jax.numpy as jnp from flax.jax_utils import replicate fr...
67
'''simple docstring''' from dataclasses import asdict, dataclass from typing import Optional from ...configuration_utils import PretrainedConfig from ...utils import logging UpperCamelCase__: int = logging.get_logger(__name__) # TODO Update this UpperCamelCase__: Any ...
127
0
from json import JSONDecodeError # Workaround for requests.exceptions.JSONDecodeError import requests def lowercase__ ( A_: str = "isbn/0140328726" ) -> dict: """simple docstring""" __UpperCAmelCase =olid.strip().strip("""/""" ) # Remove leading/tr...
68
'''simple docstring''' from ...configuration_utils import PretrainedConfig from ...utils import logging UpperCamelCase__: List[Any] = logging.get_logger(__name__) UpperCamelCase__: str = { "unc-nlp/lxmert-base-uncased": "https://huggingface.co/unc-nlp/lxmer...
127
0
'''simple docstring''' from __future__ import annotations from random import random from typing import Generic, TypeVar a : Any = TypeVar('''KT''') a : Optional[int] = TypeVar('''VT''') class SCREAMING_SNAKE_CASE__ ( Generic[KT, VT] ): ...
69
'''simple docstring''' import math from numpy import inf from scipy.integrate import quad def snake_case_ ( _lowerCAmelCase : float ) -> float: if num <= 0: raise ValueError('''math domain error''' ) return quad(_lowerCAmelCase , 0 , _lo...
127
0
import unittest from transformers import is_torch_available from transformers.testing_utils import require_torch if is_torch_available(): import torch from transformers.activations import gelu_new, gelu_python, get_activation @require_torch class A( unittest.TestCase ): ...
70
'''simple docstring''' import json import os import unittest from transformers import BatchEncoding, LEDTokenizer, LEDTokenizerFast from transformers.models.led.tokenization_led import VOCAB_FILES_NAMES from transformers.testing_utils import require_tokenizers, require_torch from transforme...
127
0
'''simple docstring''' import copy from collections import OrderedDict from typing import Mapping from packaging import version from ...configuration_utils import PretrainedConfig from ...onnx import OnnxConfig from ...utils import logging from ..auto import CONFIG_MAPPING _lowerCamelCase ...
71
'''simple docstring''' from typing import Optional import numpy as np import torch from torch import nn from transformers import GPTaConfig, GPTaLMHeadModel from transformers.modeling_utils import ModuleUtilsMixin from ...configuration_utils import ConfigMixin, register_to_config from .....
127
0
'''simple docstring''' from ....utils import logging _UpperCAmelCase : List[str] = logging.get_logger(__name__) class __magic_name__ ( __SCREAMING_SNAKE_CASE ): def __init__( self , snake_case_ , snake_case_=None , snake_case_=20_48 ): lowercase =config.__dict__ l...
72
'''simple docstring''' import math from typing import Dict, Iterable, List, Optional, Tuple, Union import numpy as np from ...image_processing_utils import BaseImageProcessor, BatchFeature, get_size_dict from ...image_transforms import normalize, rescale, resize, to_channel_dimension_format...
127
0
import inspect from typing import List, Optional, Tuple, Union import torch from ...models import UNetaDModel, VQModel from ...schedulers import DDIMScheduler from ...utils import randn_tensor from ..pipeline_utils import DiffusionPipeline, ImagePipelineOutput class _snake_case ( A__ ): def _...
73
'''simple docstring''' def snake_case_ ( _lowerCAmelCase : str , _lowerCAmelCase : str ) -> int: if len(_lowerCAmelCase ) != len(_lowerCAmelCase ): raise ValueError('''String lengths must match!''' ) UpperCAmelCase : List[str] ...
127
0
def a__ ( snake_case ): """simple docstring""" __SCREAMING_SNAKE_CASE : str = [0] * len(snake_case ) for i in range(1 , len(snake_case ) ): # use last results for better performance - dynamic programming __SCREAMING_SNAKE_CASE : str ...
74
'''simple docstring''' from __future__ import annotations def snake_case_ ( _lowerCAmelCase : list[int] ) -> int: if not nums: return 0 UpperCAmelCase : Tuple = nums[0] UpperCAmelCase : List[str] = 0 ...
127
0
'''simple docstring''' from ...configuration_utils import PretrainedConfig from ...utils import logging UpperCamelCase__ = logging.get_logger(__name__) UpperCamelCase__ = {} class lowerCamelCase_ ( __a ): lowerCAmelCase__ = 'llama' lowerCAmelCase...
75
'''simple docstring''' import re def snake_case_ ( _lowerCAmelCase : str ) -> str: if len(re.findall('''[ATCG]''' , _lowerCAmelCase ) ) != len(_lowerCAmelCase ): raise ValueError('''Invalid Strand''' ) return dna.translate(dna.make...
127
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 a_ = logging.getLogger(__name__) if...
76
'''simple docstring''' import unittest import numpy as np from transformers.testing_utils import require_torch, require_vision from transformers.utils import is_torch_available, is_vision_available from ...test_image_processing_common import ImageProcessingSavingTestMixin if is_torch...
127
0
"""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, ) A = { """i...
77
'''simple docstring''' def snake_case_ ( _lowerCAmelCase : str ) -> int: if not head: return True # split the list to two parts UpperCAmelCase , UpperCAmelCase : str = head.next, head while fast and fast.next: ...
127
0
'''simple docstring''' from torch import nn class __A ( nn.Module ): def __init__(self : Optional[int] , __a : List[Any] , __a : int ): super().__init__() UpperCAmelCase_ = class_size UpperCAmelCase_ ...
78
'''simple docstring''' def snake_case_ ( _lowerCAmelCase : int , _lowerCAmelCase : Dict , _lowerCAmelCase : List[str] , _lowerCAmelCase : str , _lowerCAmelCase : Optional[int] , _lowerCAmelCase : List[Any] ) -> Union[str, Any]: if index == r: ...
127
0
import argparse import logging import os from pathlib import Path from typing import Any, Dict import pytorch_lightning as pl from pytorch_lightning.utilities import rank_zero_info from transformers import ( AdamW, AutoConfig, AutoModel, AutoModelForPreTraining, AutoMod...
79
'''simple docstring''' import os from bleurt import score # From: git+https://github.com/google-research/bleurt.git import datasets UpperCamelCase__: Any = datasets.logging.get_logger(__name__) UpperCamelCase__: Union[str, Any] = "\\n@inproceedings{bleur...
127
0
import json from typing import List, Optional, Tuple from tokenizers import normalizers from ...tokenization_utils_fast import PreTrainedTokenizerFast from .tokenization_electra import ElectraTokenizer __UpperCamelCase : Union[str, Any] = {"""vocab_file""": """vocab.txt""", """tokenizer_file""": ...
80
'''simple docstring''' import unittest from diffusers.pipelines.pipeline_utils import is_safetensors_compatible class SCREAMING_SNAKE_CASE( unittest.TestCase ): """simple docstring""" def A ( self : Tuple ) -> Optional[Any]:...
127
0
from typing import TYPE_CHECKING from ...utils import ( OptionalDependencyNotAvailable, _LazyModule, is_flax_available, is_tf_available, is_tokenizers_available, is_torch_available, is_vision_available, ) _snake_case : Union[str, Any] = { "configuration_owlvit": ...
81
'''simple docstring''' import json import os from functools import lru_cache from typing import List, Optional, Tuple import regex as re from ...tokenization_utils import AddedToken, PreTrainedTokenizer from ...utils import logging UpperCamelCase__: str = logging.get_lo...
127
0
"""simple docstring""" import argparse import torch from transformers import BertConfig, BertForPreTraining, load_tf_weights_in_bert from transformers.utils import logging logging.set_verbosity_info() def a__ ( lowerCAmelCase__ , lowerCAmelCase__ , lowerCAmelCase...
82
'''simple docstring''' import argparse import hashlib # hashlib is only used inside the Test class import struct class SCREAMING_SNAKE_CASE: """simple docstring""" def __init__( self : List[str] , __snake_case : Any ) -> Lis...
127
0
"""simple docstring""" from __future__ import annotations lowerCAmelCase__ = [-10, -5, 0, 5, 5.1, 11, 13, 21, 3, 4, -21, -10, -5, -1, 0] lowerCAmelCase__ = [-5, 0, 5, 5.1, 11, 13, 21, -1, 4, -1, -10, -5, -1, 0, -1] def snake_case_ ( A_ : list[float] )...
83
'''simple docstring''' def snake_case_ ( _lowerCAmelCase : int ) -> list: UpperCAmelCase : Union[str, Any] = int(_lowerCAmelCase ) if n_element < 1: UpperCAmelCase : int = ValueError('''a should be a positive num...
127
0
def UpperCAmelCase_ ( __SCREAMING_SNAKE_CASE , __SCREAMING_SNAKE_CASE ): return number | (1 << position) def UpperCAmelCase_ ( __SCREAMING_SNAKE_CASE , __SCREAMING_SNAKE_CASE ): return number & ~(1 << position) def UpperCAmelCase_ ( __SCREAMING_SNAK...
84
'''simple docstring''' import numpy as np from scipy.spatial.distance import cdist from sklearn.metrics import fa_score import datasets UpperCamelCase__: str = "\\n @inproceedings{kakwani2020indicnlpsuite,\n title={{IndicNLPSuite: Monolingual Corpora, Evaluation Benchm...
127
0
import qiskit def _a ( lowercase__ : int = 2 ): '''simple docstring''' SCREAMING_SNAKE_CASE__ : Optional[int] = qubits # Using Aer's simulator SCREAMING_SNAKE_CASE__ : Optional[Any] = qiskit.Aer.get_backend('aer_simulator' ) # Cr...
85
'''simple docstring''' from __future__ import annotations UpperCamelCase__: Tuple = 1.60_21E-19 # units = C def snake_case_ ( _lowerCAmelCase : float , _lowerCAmelCase : float , _lowerCAmelCase : float , ) -> tuple[str, float]: if (conductivity,...
127
0
def __snake_case ( __UpperCamelCase : int = 10**9 ): """simple docstring""" A_ = 1 A_ = 2 A_ = 0 A_ = 0 A_ = 0 while perimeter <= max_perimeter: perimeters_sum += perimeter ...
86
'''simple docstring''' import shutil import tempfile import unittest import numpy as np import pytest from transformers.testing_utils import require_vision from transformers.utils import is_vision_available if is_vision_available(): from PIL import Image from transfor...
127
0
# Copyright 2022 The HuggingFace Team and The OpenBMB Team. All rights reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Un...
87
'''simple docstring''' import flax.linen as nn import jax.numpy as jnp from .attention_flax import FlaxTransformeraDModel from .resnet_flax import FlaxDownsampleaD, FlaxResnetBlockaD, FlaxUpsampleaD class SCREAMING_SNAKE_CASE( nn.Module ): """simple docstring""...
127
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__ ( A_ ):...
88
'''simple docstring''' def snake_case_ ( _lowerCAmelCase : Any , _lowerCAmelCase : Optional[Any] , _lowerCAmelCase : Any , _lowerCAmelCase : Union[str, Any] ) -> Dict: # Return True if there is node that has not iterated. UpperCAmelCase : List[Any...
127
0
def UpperCamelCase_( lowerCamelCase_ ) -> list: _lowercase : Optional[Any] = len(lowerCamelCase_ ) for i in range(1 , lowerCamelCase_ ): _lowercase : Tuple = collection[i] _lowercase : str = 0 _lowercase ...
89
'''simple docstring''' from dataclasses import asdict, dataclass from typing import Optional from ...configuration_utils import PretrainedConfig from ...utils import logging UpperCamelCase__: int = logging.get_logger(__name__) # TODO Update this UpperCamelCase__: Any ...
127
0
'''simple docstring''' import unittest import numpy as np from transformers.testing_utils import require_torch, require_vision from transformers.utils import is_torch_available, is_vision_available from ...test_image_processing_common import ImageProcessingSavingTestMixin, prepare_image_inp...
90
'''simple docstring''' from ...configuration_utils import PretrainedConfig from ...utils import logging UpperCamelCase__: List[Any] = logging.get_logger(__name__) UpperCamelCase__: str = { "unc-nlp/lxmert-base-uncased": "https://huggingface.co/unc-nlp/lxmer...
127
0
"""simple docstring""" from __future__ import annotations def _snake_case ( snake_case__ : list ): if len(snake_case__ ) == 0: return [] A , A = min(snake_case__ ), max(snake_case__ ) A = int(max_value - min_value ) + 1 A = [[] for _ in range(snake_case__ )] for i in my_lis...
91
'''simple docstring''' import math from numpy import inf from scipy.integrate import quad def snake_case_ ( _lowerCAmelCase : float ) -> float: if num <= 0: raise ValueError('''math domain error''' ) return quad(_lowerCAmelCase , 0 , _lo...
127
0
'''simple docstring''' import json from typing import Dict, List, Optional, Tuple, Union from tokenizers import pre_tokenizers, processors from ...tokenization_utils_base import AddedToken, BatchEncoding, EncodedInput from ...tokenization_utils_fast import PreTrainedTokenizerFast from ...utils import PaddingSt...
92
'''simple docstring''' import json import os import unittest from transformers import BatchEncoding, LEDTokenizer, LEDTokenizerFast from transformers.models.led.tokenization_led import VOCAB_FILES_NAMES from transformers.testing_utils import require_tokenizers, require_torch from transforme...
127
0
"""simple docstring""" import gc import unittest import torch from transformers import CLIPTextConfig, CLIPTextModel, CLIPTextModelWithProjection, CLIPTokenizer from diffusers import ( AutoencoderKL, DDIMScheduler, DDPMScheduler, PriorTransformer, StableUnCLIPPipeline, UNetaDConditi...
93
'''simple docstring''' from typing import Optional import numpy as np import torch from torch import nn from transformers import GPTaConfig, GPTaLMHeadModel from transformers.modeling_utils import ModuleUtilsMixin from ...configuration_utils import ConfigMixin, register_to_config from .....
127
0
'''simple docstring''' from queue import PriorityQueue from typing import Any import numpy as np def lowercase_ ( __A : dict , __A : str , __A : set , __A : set , __A : dict , __A : dict , __A : ...
94
'''simple docstring''' import math from typing import Dict, Iterable, List, Optional, Tuple, Union import numpy as np from ...image_processing_utils import BaseImageProcessor, BatchFeature, get_size_dict from ...image_transforms import normalize, rescale, resize, to_channel_dimension_format...
127
0
"""simple docstring""" import gc import unittest import numpy as np import torch from torch.backends.cuda import sdp_kernel from diffusers import ( CMStochasticIterativeScheduler, ConsistencyModelPipeline, UNetaDModel, ) from diffusers.utils import randn_tensor, slow, torch_device from diffusers.ut...
95
'''simple docstring''' def snake_case_ ( _lowerCAmelCase : str , _lowerCAmelCase : str ) -> int: if len(_lowerCAmelCase ) != len(_lowerCAmelCase ): raise ValueError('''String lengths must match!''' ) UpperCAmelCase : List[str] ...
127
0
"""simple docstring""" from typing import Any, Dict, List, Union from ..utils import add_end_docstrings, is_torch_available, is_vision_available, logging, requires_backends from .base import PIPELINE_INIT_ARGS, Pipeline if is_vision_available(): from ..image_utils import load_i...
96
'''simple docstring''' from __future__ import annotations def snake_case_ ( _lowerCAmelCase : list[int] ) -> int: if not nums: return 0 UpperCAmelCase : Tuple = nums[0] UpperCAmelCase : List[str] = 0 ...
127
0
from typing import TYPE_CHECKING from ...utils import OptionalDependencyNotAvailable, _LazyModule, is_torch_available __a = {'configuration_ibert': ['IBERT_PRETRAINED_CONFIG_ARCHIVE_MAP', 'IBertConfig', 'IBertOnnxConfig']} try: if not is_torch_available(): raise OptionalDepend...
97
'''simple docstring''' import re def snake_case_ ( _lowerCAmelCase : str ) -> str: if len(re.findall('''[ATCG]''' , _lowerCAmelCase ) ) != len(_lowerCAmelCase ): raise ValueError('''Invalid Strand''' ) return dna.translate(dna.make...
127
0
'''simple docstring''' from __future__ import annotations from typing import Generic, TypeVar lowercase__ : Any = TypeVar('T') class __lowerCAmelCase ( Generic[T] ): """simple docstring""" def __init__( self : int , lowerCAmelCase__ : ...
98
'''simple docstring''' import unittest import numpy as np from transformers.testing_utils import require_torch, require_vision from transformers.utils import is_torch_available, is_vision_available from ...test_image_processing_common import ImageProcessingSavingTestMixin if is_torch...
127
0
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 SCREAMING_SNAKE_CASE = logging.get_logger(__name...
99
'''simple docstring''' def snake_case_ ( _lowerCAmelCase : str ) -> int: if not head: return True # split the list to two parts UpperCAmelCase , UpperCAmelCase : str = head.next, head while fast and fast.next: ...
127
0