code
stringlengths
81
54k
code_codestyle
int64
0
721
style_context
stringlengths
91
41.9k
style_context_codestyle
int64
0
699
label
int64
0
1
"""simple docstring""" def _SCREAMING_SNAKE_CASE ( _lowercase : list , _lowercase : list ) ->float: '''simple docstring''' _validate_point(_lowercase ) _validate_point(_lowercase ) if len(_lowercase ) != len(_lowercase ): ...
709
"""simple docstring""" import flax.linen as nn import jax import jax.numpy as jnp class __UpperCamelCase ( nn.Module ): lowerCamelCase : int lowerCamelCase : jnp.dtype =jnp.floataa def __a ( self ) -> ...
31
0
"""simple docstring""" import warnings from ...utils import logging from .image_processing_layoutlmva import LayoutLMvaImageProcessor a : Tuple = logging.get_logger(__name__) class __UpperCamelCase ( a__ ): def __init__( self , *lower...
710
"""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/lic...
31
0
"""simple docstring""" a : Tuple = { '''Pillow''': '''Pillow''', '''accelerate''': '''accelerate>=0.11.0''', '''compel''': '''compel==0.1.8''', '''black''': '''black~=23.1''', '''datasets''': '''datasets''', '''filelock''': '''filelock''', '''flax''': '...
711
"""simple docstring""" a : str = 8.314_4598 def _SCREAMING_SNAKE_CASE ( _lowercase : float , _lowercase : float ) ->float: '''simple docstring''' if temperature < 0: raise Exception("Temperature cannot be less than 0 ...
31
0
"""simple docstring""" import math def _SCREAMING_SNAKE_CASE ( ) ->None: '''simple docstring''' a : Tuple = input("Enter message: " ) a : List[Any] = int(input(F"""Enter key [2-{len(_lowercase ) - 1}]: """ ) ...
712
"""simple docstring""" import time import unittest from transformers import is_torch_available from transformers.testing_utils import require_torch, torch_device from ..test_modeling_common import ids_tensor if is_torch_available(): import torch from transformers.generation imp...
31
0
"""simple docstring""" from typing import TYPE_CHECKING from ...utils import ( OptionalDependencyNotAvailable, _LazyModule, is_flax_available, is_sentencepiece_available, is_tf_available, is_tokenizers_available, is_torch_available, ) a : Tuple = ...
713
"""simple docstring""" def _SCREAMING_SNAKE_CASE ( _lowercase : int = 200 ) ->int: '''simple docstring''' a : Dict = [1, 2, 5, 10, 20, 50, 100, 200] a : Optional[Any] = [0] * (pence + 1) a : List[Any] = 1 # base case: ...
31
0
"""simple docstring""" import cva import numpy as np class __UpperCamelCase : def __init__( self , lowerCAmelCase__ , lowerCAmelCase__ ) -> Tuple: if k in (0.04, 0.06): a : int = k a : Dict = ...
714
"""simple docstring""" from ..utils import DummyObject, requires_backends class __UpperCamelCase ( metaclass=a__ ): lowerCamelCase : Optional[Any] =["""transformers""", """torch""", """note_seq"""] def __init__( self , *lowerCAme...
31
0
"""simple docstring""" from ...configuration_utils import PretrainedConfig from ...utils import logging a : Optional[Any] = logging.get_logger(__name__) a : List[Any] = { '''tanreinama/GPTSAN-2.8B-spout_is_uniform''': ( '''https://huggingface.co/tanreina...
715
"""simple docstring""" import qiskit def _SCREAMING_SNAKE_CASE ( _lowercase : int , _lowercase : int ) ->qiskit.result.counts.Counts: '''simple docstring''' a : Union[str, Any] = qiskit.Aer.get_backend("aer_simulator" ...
31
0
"""simple docstring""" from typing import Dict, List, Optional, Union import numpy as np from ...image_processing_utils import BaseImageProcessor, BatchFeature, get_size_dict from ...image_transforms import ( center_crop, convert_to_rgb, get_resize_output_image_size, norm...
716
"""simple docstring""" from random import randint from tempfile import TemporaryFile import numpy as np def _SCREAMING_SNAKE_CASE ( _lowercase : Optional[int] , _lowercase : Optional[Any] , _lowercase : Union[str, Any] ) ->Dict: '''...
31
0
"""simple docstring""" def _SCREAMING_SNAKE_CASE ( _lowercase : list , _lowercase : int , _lowercase : int = 0 , _lowercase : int = 0 ) ->int: '''simple docstring''' a : int = right or len(_lowercase ) - 1 if ...
717
"""simple docstring""" import baseaa def _SCREAMING_SNAKE_CASE ( _lowercase : str ) ->bytes: '''simple docstring''' return baseaa.aaaencode(string.encode("utf-8" ) ) def _SCREAMING_SNAKE_CASE ( _lowercase : ...
31
0
"""simple docstring""" import os import unittest from transformers.models.phobert.tokenization_phobert import VOCAB_FILES_NAMES, PhobertTokenizer from ...test_tokenization_common import TokenizerTesterMixin class __UpperCamelCase ( a__ , unittest.TestCase ): lowerCamelCase ...
718
"""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_...
31
0
import argparse import os from accelerate.test_utils import execute_subprocess_async def _SCREAMING_SNAKE_CASE ( _lowercase : str=None ) ->Optional[Any]: '''simple docstring''' if subparsers is not None: a : Dict = subparsers.add_pa...
719
"""simple docstring""" import itertools import random import unittest import numpy as np from transformers import BatchFeature, SpeechTaFeatureExtractor from transformers.testing_utils import require_torch from transformers.utils.import_utils import is_torch_available from ...test_sequ...
31
0
from scipy.stats import pearsonr import datasets a : Union[str, Any] = ''' Pearson correlation coefficient and p-value for testing non-correlation. The Pearson correlation coefficient measures the linear relationship between two datasets. The calculation of the p-value relies on the assum...
720
"""simple docstring""" import multiprocessing import time from arguments import PretokenizationArguments from datasets import load_dataset from transformers import AutoTokenizer, HfArgumentParser def _SCREAMING_SNAKE_CASE ( _lowercase : List[str] ) ->int: ...
31
0
"""simple docstring""" from __future__ import annotations import unittest from transformers import BlenderbotConfig, BlenderbotTokenizer, is_tf_available from transformers.testing_utils import require_tf, require_tokenizers, slow from transformers.utils import cached_property from ...tes...
721
"""simple docstring""" from typing import TYPE_CHECKING from ...utils import ( OptionalDependencyNotAvailable, _LazyModule, is_flax_available, is_sentencepiece_available, is_tf_available, is_tokenizers_available, is_torch_available, ) if is_sentencepiece_...
31
0
"""simple docstring""" a : str = 8.31_4462 # Unit - J mol-1 K-1 def _SCREAMING_SNAKE_CASE ( _lowercase : float , _lowercase : float , _lowercase : float ) ->float: '''simple docstring''' if moles < 0 or kelvin...
700
"""simple docstring""" def _SCREAMING_SNAKE_CASE ( _lowercase : int = 10 , _lowercase : int = 1000 , _lowercase : bool = True ) ->int: '''simple docstring''' assert ( isinstance(_lowercase , _lowercase ) and isinst...
31
0
"""simple docstring""" def _SCREAMING_SNAKE_CASE ( _lowercase : list[list[int | float]] ) ->int: '''simple docstring''' a : List[Any] = len(_lowercase ) a : Dict = len(matrix[0] ) a : List[str] = min(_lowercase ...
701
"""simple docstring""" import os import shutil from pathlib import Path from typing import Optional, Union import numpy as np from huggingface_hub import hf_hub_download from ..utils import ONNX_EXTERNAL_WEIGHTS_NAME, ONNX_WEIGHTS_NAME, is_onnx_available, logging if is_onnx_available...
31
0
"""simple docstring""" from typing import TYPE_CHECKING from ...utils import OptionalDependencyNotAvailable, _LazyModule, is_tokenizers_available, is_torch_available a : Optional[int] = { '''configuration_graphormer''': ['''GRAPHORMER_PRETRAINED_CONFIG_ARCHIVE_MAP''', '''Gra...
702
"""simple docstring""" import argparse import os from io import BytesIO from pathlib import Path import requests from clip_retrieval.clip_client import ClipClient from PIL import Image from tqdm import tqdm def _SCREAMING_SNAKE_CASE ( _lowercase : Optional[Any] ,...
31
0
"""simple docstring""" def _SCREAMING_SNAKE_CASE ( _lowercase : int ) ->int: '''simple docstring''' assert isinstance(_lowercase , _lowercase ), F"""The input value of [n={number}] is not an integer""" if number == 1: return 2 elif num...
703
"""simple docstring""" # Copyright 2022 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/lic...
31
0
"""simple docstring""" from __future__ import annotations def _SCREAMING_SNAKE_CASE ( _lowercase : list[int] , _lowercase : int , _lowercase : int , _lowercase : int ) ->None: '''simple docstring''' if (direction...
704
"""simple docstring""" import os from shutil import copyfile from typing import List, Optional, Tuple from tokenizers import processors from ...tokenization_utils import AddedToken, BatchEncoding from ...tokenization_utils_fast import PreTrainedTokenizerFast from ...utils import is_senten...
31
0
"""simple docstring""" def _SCREAMING_SNAKE_CASE ( _lowercase : int , _lowercase : int ) ->int: '''simple docstring''' return number | (1 << position) def _SCREAMING_SNAKE_CASE ( _lowercase : int , _lowercase : i...
705
"""simple docstring""" from dataclasses import dataclass from typing import Optional, Tuple, Union import numpy as np import torch from ..configuration_utils import ConfigMixin, register_to_config from ..utils import BaseOutput, randn_tensor from .scheduling_utils import SchedulerMixin ...
31
0
"""simple docstring""" import copy import os from typing import Union from ...configuration_utils import PretrainedConfig from ...utils import logging a : str = logging.get_logger(__name__) a : Dict = { '''microsoft/git-base''': '''https://huggingface.co/mic...
706
"""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 datase...
31
0
import unittest from transformers import load_tool from transformers.utils import is_torch_available if is_torch_available(): import torch from transformers.testing_utils import require_torch from .test_tools_common import ToolTesterMixin @require_torch class __UpperCamelCase ...
707
"""simple docstring""" import gc import random import unittest import torch from diffusers import ( IFImgaImgPipeline, IFImgaImgSuperResolutionPipeline, IFInpaintingPipeline, IFInpaintingSuperResolutionPipeline, IFPipeline, IFSuperResolutionPipeline, ) from d...
31
0
"""simple docstring""" from pickle import UnpicklingError import jax import jax.numpy as jnp import numpy as np from flax.serialization import from_bytes from flax.traverse_util import flatten_dict from ..utils import logging a : Any = logging.get_logger(__name__) ...
708
"""simple docstring""" import unittest from diffusers.pipelines.pipeline_utils import is_safetensors_compatible class __UpperCamelCase ( unittest.TestCase ): def __a ( self ) -> Optional[Any]: a : Optional[int] = [ ...
31
0
"""simple docstring""" import multiprocessing import time from arguments import PretokenizationArguments from datasets import load_dataset from transformers import AutoTokenizer, HfArgumentParser def _SCREAMING_SNAKE_CASE ( _lowercase : List[str] ) ->int: ...
709
"""simple docstring""" import flax.linen as nn import jax import jax.numpy as jnp class __UpperCamelCase ( nn.Module ): lowerCamelCase : int lowerCamelCase : jnp.dtype =jnp.floataa def __a ( self ) -> ...
31
0
"""simple docstring""" import math import qiskit def _SCREAMING_SNAKE_CASE ( _lowercase : int = 1 , _lowercase : int = 1 , _lowercase : int = 1 ) ->qiskit.result.counts.Counts: '''simple docstring''' if ( isinstan...
710
"""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/lic...
31
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 fro...
711
"""simple docstring""" a : str = 8.314_4598 def _SCREAMING_SNAKE_CASE ( _lowercase : float , _lowercase : float ) ->float: '''simple docstring''' if temperature < 0: raise Exception("Temperature cannot be less than 0 ...
31
0
"""simple docstring""" import operator as op def _SCREAMING_SNAKE_CASE ( _lowercase : Union[str, Any] ) ->Any: '''simple docstring''' a : str = [] a : List[str] = lambda _lowercase , _lowercase : int(x / y ...
712
"""simple docstring""" import time import unittest from transformers import is_torch_available from transformers.testing_utils import require_torch, torch_device from ..test_modeling_common import ids_tensor if is_torch_available(): import torch from transformers.generation imp...
31
0
"""simple docstring""" from __future__ import annotations def _SCREAMING_SNAKE_CASE ( _lowercase : list[int] ): '''simple docstring''' a : Union[str, Any] = len(_lowercase ) // 2 # choose the middle 3 elements a : int ...
713
"""simple docstring""" def _SCREAMING_SNAKE_CASE ( _lowercase : int = 200 ) ->int: '''simple docstring''' a : Dict = [1, 2, 5, 10, 20, 50, 100, 200] a : Optional[Any] = [0] * (pence + 1) a : List[Any] = 1 # base case: ...
31
0
"""simple docstring""" def _SCREAMING_SNAKE_CASE ( _lowercase : Any ) ->Tuple: '''simple docstring''' a : Optional[int] = len(_lowercase ) for i in range(length - 1 ): a : Tuple = i for k in range(i + 1 , _lower...
714
"""simple docstring""" from ..utils import DummyObject, requires_backends class __UpperCamelCase ( metaclass=a__ ): lowerCamelCase : Optional[Any] =["""transformers""", """torch""", """note_seq"""] def __init__( self , *lowerCAme...
31
0
"""simple docstring""" import os import pickle import unittest from transformers import AutoTokenizer from transformers.models.bert.tokenization_bert import BertTokenizer from transformers.models.bert_japanese.tokenization_bert_japanese import ( VOCAB_FILES_NAMES, BertJapaneseToken...
715
"""simple docstring""" import qiskit def _SCREAMING_SNAKE_CASE ( _lowercase : int , _lowercase : int ) ->qiskit.result.counts.Counts: '''simple docstring''' a : Union[str, Any] = qiskit.Aer.get_backend("aer_simulator" ...
31
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 a : Any = { # 1536-bit 5: { ...
716
"""simple docstring""" from random import randint from tempfile import TemporaryFile import numpy as np def _SCREAMING_SNAKE_CASE ( _lowercase : Optional[int] , _lowercase : Optional[Any] , _lowercase : Union[str, Any] ) ->Dict: '''...
31
0
"""simple docstring""" import tempfile import unittest from pathlib import Path from shutil import copyfile from transformers import BatchEncoding, MarianTokenizer from transformers.testing_utils import get_tests_dir, require_sentencepiece, slow from transformers.utils import is_sentencepie...
717
"""simple docstring""" import baseaa def _SCREAMING_SNAKE_CASE ( _lowercase : str ) ->bytes: '''simple docstring''' return baseaa.aaaencode(string.encode("utf-8" ) ) def _SCREAMING_SNAKE_CASE ( _lowercase : ...
31
0
"""simple docstring""" import os import shutil from pathlib import Path from typing import Optional, Union import numpy as np from huggingface_hub import hf_hub_download from ..utils import ONNX_EXTERNAL_WEIGHTS_NAME, ONNX_WEIGHTS_NAME, is_onnx_available, logging if is_onnx_available(): i...
718
"""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_...
31
0
import unittest import numpy as np from transformers import AlbertConfig, is_flax_available from transformers.testing_utils import require_flax, slow from ...test_modeling_flax_common import FlaxModelTesterMixin, ids_tensor, random_attention_mask if is_flax_available(): import jax.numpy as...
719
"""simple docstring""" import itertools import random import unittest import numpy as np from transformers import BatchFeature, SpeechTaFeatureExtractor from transformers.testing_utils import require_torch from transformers.utils.import_utils import is_torch_available from ...test_sequ...
31
0
from ..utils import DummyObject, requires_backends class __UpperCamelCase ( metaclass=a__ ): lowerCamelCase : Optional[Any] =["""transformers""", """torch""", """note_seq"""] def __init__( self , *lowerCAmelCase__ , **lowerCAmelCas...
720
"""simple docstring""" import multiprocessing import time from arguments import PretokenizationArguments from datasets import load_dataset from transformers import AutoTokenizer, HfArgumentParser def _SCREAMING_SNAKE_CASE ( _lowercase : List[str] ) ->int: ...
31
0
"""simple docstring""" from __future__ import annotations import inspect import unittest from math import floor import numpy as np from transformers import CvtConfig from transformers.testing_utils import require_tf, require_vision, slow from transformers.utils import cached_property, ...
721
"""simple docstring""" from typing import TYPE_CHECKING from ...utils import ( OptionalDependencyNotAvailable, _LazyModule, is_flax_available, is_sentencepiece_available, is_tf_available, is_tokenizers_available, is_torch_available, ) if is_sentencepiece_...
31
0
"""simple docstring""" import unittest from diffusers.models.unet_ad_blocks import * # noqa F403 from diffusers.utils import torch_device from .test_unet_blocks_common import UNetBlockTesterMixin class __UpperCamelCase ( a__ , unittest.TestCase ): lowerCamelCase : ...
700
"""simple docstring""" def _SCREAMING_SNAKE_CASE ( _lowercase : int = 10 , _lowercase : int = 1000 , _lowercase : bool = True ) ->int: '''simple docstring''' assert ( isinstance(_lowercase , _lowercase ) and isinst...
31
0
"""simple docstring""" from typing import Dict from transformers import EvalPrediction, HfArgumentParser, TrainingArguments, is_torch_available from transformers.testing_utils import ( TestCasePlus, execute_subprocess_async, get_torch_dist_unique_port, require_torch_multi_gpu, ...
701
"""simple docstring""" import os import shutil from pathlib import Path from typing import Optional, Union import numpy as np from huggingface_hub import hf_hub_download from ..utils import ONNX_EXTERNAL_WEIGHTS_NAME, ONNX_WEIGHTS_NAME, is_onnx_available, logging if is_onnx_available...
31
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 datase...
702
"""simple docstring""" import argparse import os from io import BytesIO from pathlib import Path import requests from clip_retrieval.clip_client import ClipClient from PIL import Image from tqdm import tqdm def _SCREAMING_SNAKE_CASE ( _lowercase : Optional[Any] ,...
31
0
"""simple docstring""" import warnings from ...configuration_utils import PretrainedConfig from ...utils import logging a : List[str] = logging.get_logger(__name__) a : Union[str, Any] = { '''xlnet-base-cased''': '''https://huggingface.co/xlnet-base-cased/resolve/ma...
703
"""simple docstring""" # Copyright 2022 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/lic...
31
0
"""simple docstring""" def _SCREAMING_SNAKE_CASE ( _lowercase : int = 50 ) ->int: '''simple docstring''' a : Dict = [1] * (length + 1) for row_length in range(length + 1 ): for tile_length in range(2 , 5 ): for tile...
704
"""simple docstring""" import os from shutil import copyfile from typing import List, Optional, Tuple from tokenizers import processors from ...tokenization_utils import AddedToken, BatchEncoding from ...tokenization_utils_fast import PreTrainedTokenizerFast from ...utils import is_senten...
31
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 a : Optional[int] = '''src/t...
705
"""simple docstring""" from dataclasses import dataclass from typing import Optional, Tuple, Union import numpy as np import torch from ..configuration_utils import ConfigMixin, register_to_config from ..utils import BaseOutput, randn_tensor from .scheduling_utils import SchedulerMixin ...
31
0
"""simple docstring""" import unittest from transformers import is_torch_available from transformers.testing_utils import require_sentencepiece, require_tokenizers, require_torch, slow if is_torch_available(): import torch from transformers import XLMRobertaModel @require_sent...
706
"""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 datase...
31
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, AutoTokeniz...
707
"""simple docstring""" import gc import random import unittest import torch from diffusers import ( IFImgaImgPipeline, IFImgaImgSuperResolutionPipeline, IFInpaintingPipeline, IFInpaintingSuperResolutionPipeline, IFPipeline, IFSuperResolutionPipeline, ) from d...
31
0
"""simple docstring""" import numpy as np from cva import destroyAllWindows, imread, imshow, waitKey class __UpperCamelCase : def __init__( self , lowerCAmelCase__ , lowerCAmelCase__ , lowerCAmelCase__ ) -> List[Any]: if dst_...
708
"""simple docstring""" import unittest from diffusers.pipelines.pipeline_utils import is_safetensors_compatible class __UpperCamelCase ( unittest.TestCase ): def __a ( self ) -> Optional[Any]: a : Optional[int] = [ ...
31
0
"""simple docstring""" import flax.linen as nn import jax import jax.numpy as jnp class __UpperCamelCase ( nn.Module ): lowerCamelCase : int lowerCamelCase : jnp.dtype =jnp.floataa def __a ( self ) -> Tupl...
709
"""simple docstring""" import flax.linen as nn import jax import jax.numpy as jnp class __UpperCamelCase ( nn.Module ): lowerCamelCase : int lowerCamelCase : jnp.dtype =jnp.floataa def __a ( self ) -> ...
31
0
"""simple docstring""" import unittest from transformers import DebertaVaTokenizer, DebertaVaTokenizerFast from transformers.testing_utils import get_tests_dir, require_sentencepiece, require_tokenizers, slow from ...test_tokenization_common import TokenizerTesterMixin a : List[Any]...
710
"""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/lic...
31
0
"""simple docstring""" import tempfile import unittest from transformers import SPIECE_UNDERLINE, BatchEncoding, PLBartTokenizer, is_torch_available from transformers.testing_utils import ( get_tests_dir, nested_simplify, require_sentencepiece, require_tokenizers, requ...
711
"""simple docstring""" a : str = 8.314_4598 def _SCREAMING_SNAKE_CASE ( _lowercase : float , _lowercase : float ) ->float: '''simple docstring''' if temperature < 0: raise Exception("Temperature cannot be less than 0 ...
31
0
"""simple docstring""" import warnings from ...utils import logging from .image_processing_mobilevit import MobileViTImageProcessor a : Union[str, Any] = logging.get_logger(__name__) class __UpperCamelCase ( a__ ): def __init__( self , ...
712
"""simple docstring""" import time import unittest from transformers import is_torch_available from transformers.testing_utils import require_torch, torch_device from ..test_modeling_common import ids_tensor if is_torch_available(): import torch from transformers.generation imp...
31
0
"""simple docstring""" import os def _SCREAMING_SNAKE_CASE ( _lowercase : List[Any] ): '''simple docstring''' a : List[str] = len(grid[0] ) a : Union[str, Any] = len(_lowercase ) a : str = 0 a ...
713
"""simple docstring""" def _SCREAMING_SNAKE_CASE ( _lowercase : int = 200 ) ->int: '''simple docstring''' a : Dict = [1, 2, 5, 10, 20, 50, 100, 200] a : Optional[Any] = [0] * (pence + 1) a : List[Any] = 1 # base case: ...
31
0
"""simple docstring""" import random def _SCREAMING_SNAKE_CASE ( _lowercase : list , _lowercase : Optional[Any] ) ->tuple: '''simple docstring''' a : List[Any] = [], [], [] for element in data: if element < pivot: ...
714
"""simple docstring""" from ..utils import DummyObject, requires_backends class __UpperCamelCase ( metaclass=a__ ): lowerCamelCase : Optional[Any] =["""transformers""", """torch""", """note_seq"""] def __init__( self , *lowerCAme...
31
0
"""simple docstring""" from __future__ import annotations import unittest from transformers import is_tf_available from transformers.testing_utils import require_sentencepiece, require_tf, require_tokenizers, slow if is_tf_available(): import numpy as np import tensorflow as tf ...
715
"""simple docstring""" import qiskit def _SCREAMING_SNAKE_CASE ( _lowercase : int , _lowercase : int ) ->qiskit.result.counts.Counts: '''simple docstring''' a : Union[str, Any] = qiskit.Aer.get_backend("aer_simulator" ...
31
0
"""simple docstring""" import io import os import unicodedata from typing import Any, Dict, List, Optional, Tuple import sentencepiece as spm from ...tokenization_utils import PreTrainedTokenizer from ...utils import logging a : Dict = logging.get_logger(__name__) a : ...
716
"""simple docstring""" from random import randint from tempfile import TemporaryFile import numpy as np def _SCREAMING_SNAKE_CASE ( _lowercase : Optional[int] , _lowercase : Optional[Any] , _lowercase : Union[str, Any] ) ->Dict: '''...
31
0
"""simple docstring""" import json import os import tempfile from transformers.testing_utils import check_json_file_has_correct_format class __UpperCamelCase : lowerCamelCase : Tuple =None def __a ( self ) -> Dict: ...
717
"""simple docstring""" import baseaa def _SCREAMING_SNAKE_CASE ( _lowercase : str ) ->bytes: '''simple docstring''' return baseaa.aaaencode(string.encode("utf-8" ) ) def _SCREAMING_SNAKE_CASE ( _lowercase : ...
31
0
"""simple docstring""" import math def _SCREAMING_SNAKE_CASE ( _lowercase : float , _lowercase : float ) ->float: '''simple docstring''' if initial_intensity < 0: raise ValueError("The value of intensity cannot be negative" ) # ...
718
"""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_...
31
0
def _SCREAMING_SNAKE_CASE ( _lowercase : Union[str, Any] , _lowercase : List[str] , _lowercase : Union[str, Any] , _lowercase : List[str] , _lowercase : Union[str, Any] , _lowercase : Union[str, Any] ) ->int: '''simple docstring'''...
719
"""simple docstring""" import itertools import random import unittest import numpy as np from transformers import BatchFeature, SpeechTaFeatureExtractor from transformers.testing_utils import require_torch from transformers.utils.import_utils import is_torch_available from ...test_sequ...
31
0
import html from ...feature_extraction_utils import BatchFeature, FeatureExtractionMixin from ...utils import is_bsa_available, logging, requires_backends if is_bsa_available(): import bsa from bsa import BeautifulSoup a : Union[str, Any] = logging.get_logger(__name__) cl...
720
"""simple docstring""" import multiprocessing import time from arguments import PretokenizationArguments from datasets import load_dataset from transformers import AutoTokenizer, HfArgumentParser def _SCREAMING_SNAKE_CASE ( _lowercase : List[str] ) ->int: ...
31
0
"""simple docstring""" import os import tempfile from functools import partial from unittest import TestCase from unittest.mock import patch import datasets import datasets.config from .utils import require_beam class __UpperCamelCase ( datasets.BeamBasedBuilder ): ...
721
"""simple docstring""" from typing import TYPE_CHECKING from ...utils import ( OptionalDependencyNotAvailable, _LazyModule, is_flax_available, is_sentencepiece_available, is_tf_available, is_tokenizers_available, is_torch_available, ) if is_sentencepiece_...
31
0
"""simple docstring""" from collections import OrderedDict from typing import List, Mapping from packaging import version from ...configuration_utils import PretrainedConfig from ...onnx import OnnxConfig from ...utils import logging a : Union[str, Any] = logging.get_logge...
700
"""simple docstring""" def _SCREAMING_SNAKE_CASE ( _lowercase : int = 10 , _lowercase : int = 1000 , _lowercase : bool = True ) ->int: '''simple docstring''' assert ( isinstance(_lowercase , _lowercase ) and isinst...
31
0
"""simple docstring""" import argparse import os.path as osp import re import torch from safetensors.torch import load_file, save_file # =================# # UNet Conversion # # =================# a : Tuple = [ # (stable-diffusion, HF Diffusers) ('''time_embed.0.weigh...
701
"""simple docstring""" import os import shutil from pathlib import Path from typing import Optional, Union import numpy as np from huggingface_hub import hf_hub_download from ..utils import ONNX_EXTERNAL_WEIGHTS_NAME, ONNX_WEIGHTS_NAME, is_onnx_available, logging if is_onnx_available...
31
0
"""simple docstring""" import warnings from ...processing_utils import ProcessorMixin from ...tokenization_utils_base import BatchEncoding class __UpperCamelCase ( a__ ): lowerCamelCase : List[Any] =["""image_processor""", """tokenizer"""] lowerCam...
702
"""simple docstring""" import argparse import os from io import BytesIO from pathlib import Path import requests from clip_retrieval.clip_client import ClipClient from PIL import Image from tqdm import tqdm def _SCREAMING_SNAKE_CASE ( _lowercase : Optional[Any] ,...
31
0
"""simple docstring""" import unittest import numpy as np from transformers.testing_utils import require_pytesseract, require_torch from transformers.utils import is_pytesseract_available, is_torch_available from ...test_image_processing_common import ImageProcessingSavingTestMixin, prepa...
703
"""simple docstring""" # Copyright 2022 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/lic...
31
0
"""simple docstring""" a : List[str] = tuple[float, float, float] a : Union[str, Any] = tuple[float, float, float] def _SCREAMING_SNAKE_CASE ( _lowercase : Pointad , _lowercase : Pointad ) ->Vectorad: '''simple docstring'...
704
"""simple docstring""" import os from shutil import copyfile from typing import List, Optional, Tuple from tokenizers import processors from ...tokenization_utils import AddedToken, BatchEncoding from ...tokenization_utils_fast import PreTrainedTokenizerFast from ...utils import is_senten...
31
0
"""simple docstring""" import logging import os import sys from dataclasses import dataclass, field from typing import Optional import evaluate import numpy as np import torch from datasets import load_dataset from PIL import Image from torchvision.transforms import ( CenterCrop, ...
705
"""simple docstring""" from dataclasses import dataclass from typing import Optional, Tuple, Union import numpy as np import torch from ..configuration_utils import ConfigMixin, register_to_config from ..utils import BaseOutput, randn_tensor from .scheduling_utils import SchedulerMixin ...
31
0
"""simple docstring""" from __future__ import annotations from math import ceil, floor, sqrt def _SCREAMING_SNAKE_CASE ( _lowercase : int = 200_0000 ) ->int: '''simple docstring''' a : list[int] = [0] a : int for id...
706
"""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 datase...
31
0
def _SCREAMING_SNAKE_CASE ( _lowercase : Tuple , _lowercase : int , _lowercase : Optional[Any] , _lowercase : Tuple ) ->Optional[Any]: '''simple docstring''' if height >= 1: move_tower(height - 1 , _lowercase , _lowercase ...
707
"""simple docstring""" import gc import random import unittest import torch from diffusers import ( IFImgaImgPipeline, IFImgaImgSuperResolutionPipeline, IFInpaintingPipeline, IFInpaintingSuperResolutionPipeline, IFPipeline, IFSuperResolutionPipeline, ) from d...
31
0
"""simple docstring""" from typing import TYPE_CHECKING from ...utils import OptionalDependencyNotAvailable, _LazyModule, is_sentencepiece_available a : Optional[int] = {} try: if not is_sentencepiece_available(): raise OptionalDependencyNotAvailable() except OptionalDep...
708
"""simple docstring""" import unittest from diffusers.pipelines.pipeline_utils import is_safetensors_compatible class __UpperCamelCase ( unittest.TestCase ): def __a ( self ) -> Optional[Any]: a : Optional[int] = [ ...
31
0
"""simple docstring""" from ...configuration_utils import PretrainedConfig from ...utils import logging a : Optional[int] = logging.get_logger(__name__) a : Any = {'''openai-gpt''': '''https://huggingface.co/openai-gpt/resolve/main/config.json'''} class __UpperCamel...
709
"""simple docstring""" import flax.linen as nn import jax import jax.numpy as jnp class __UpperCamelCase ( nn.Module ): lowerCamelCase : int lowerCamelCase : jnp.dtype =jnp.floataa def __a ( self ) -> ...
31
0
"""simple docstring""" import gc import random import unittest import torch from diffusers import ( IFImgaImgPipeline, IFImgaImgSuperResolutionPipeline, IFInpaintingPipeline, IFInpaintingSuperResolutionPipeline, IFPipeline, IFSuperResolutionPipeline, ) from d...
710
"""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/lic...
31
0
"""simple docstring""" from pathlib import Path import fire def _SCREAMING_SNAKE_CASE ( _lowercase : str , _lowercase : str , _lowercase : int ) ->List[str]: '''simple docstring''' a : List[Any] = Path(_lowerc...
711
"""simple docstring""" a : str = 8.314_4598 def _SCREAMING_SNAKE_CASE ( _lowercase : float , _lowercase : float ) ->float: '''simple docstring''' if temperature < 0: raise Exception("Temperature cannot be less than 0 ...
31
0
"""simple docstring""" import inspect import unittest from transformers import ViTConfig from transformers.testing_utils import ( require_accelerate, require_torch, require_torch_gpu, require_vision, slow, torch_device, ) from transformers.utils import cached_pr...
712
"""simple docstring""" import time import unittest from transformers import is_torch_available from transformers.testing_utils import require_torch, torch_device from ..test_modeling_common import ids_tensor if is_torch_available(): import torch from transformers.generation imp...
31
0
"""simple docstring""" import inspect import unittest import numpy as np from tests.test_modeling_common import floats_tensor from transformers import MaskaFormerConfig, is_torch_available, is_vision_available from transformers.testing_utils import require_torch, require_torch_multi_gpu, r...
713
"""simple docstring""" def _SCREAMING_SNAKE_CASE ( _lowercase : int = 200 ) ->int: '''simple docstring''' a : Dict = [1, 2, 5, 10, 20, 50, 100, 200] a : Optional[Any] = [0] * (pence + 1) a : List[Any] = 1 # base case: ...
31
0
"""simple docstring""" import torch from transformers import PreTrainedModel, XLMRobertaConfig, XLMRobertaModel class __UpperCamelCase ( a__ ): lowerCamelCase : int ="""M-CLIP""" def __init__( self , lowerCAmelCase__=1024 , ...
714
"""simple docstring""" from ..utils import DummyObject, requires_backends class __UpperCamelCase ( metaclass=a__ ): lowerCamelCase : Optional[Any] =["""transformers""", """torch""", """note_seq"""] def __init__( self , *lowerCAme...
31
0
"""simple docstring""" import torch from diffusers import KDPMaDiscreteScheduler from diffusers.utils import torch_device from .test_schedulers import SchedulerCommonTest class __UpperCamelCase ( a__ ): lowerCamelCase : Tuple =(KDPMaDiscreteScheduler,) ...
715
"""simple docstring""" import qiskit def _SCREAMING_SNAKE_CASE ( _lowercase : int , _lowercase : int ) ->qiskit.result.counts.Counts: '''simple docstring''' a : Union[str, Any] = qiskit.Aer.get_backend("aer_simulator" ...
31
0
"""simple docstring""" from typing import TYPE_CHECKING from ....utils import OptionalDependencyNotAvailable, _LazyModule, is_torch_available a : List[Any] = {'''configuration_mmbt''': ['''MMBTConfig''']} try: if not is_torch_available(): raise OptionalDependencyNotAva...
716
"""simple docstring""" from random import randint from tempfile import TemporaryFile import numpy as np def _SCREAMING_SNAKE_CASE ( _lowercase : Optional[int] , _lowercase : Optional[Any] , _lowercase : Union[str, Any] ) ->Dict: '''...
31
0
"""simple docstring""" import numpy as np def _SCREAMING_SNAKE_CASE ( _lowercase : np.array ) ->np.array: '''simple docstring''' return 1 / (1 + np.exp(-vector )) if __name__ == "__main__": import doctest doctest.tes...
717
"""simple docstring""" import baseaa def _SCREAMING_SNAKE_CASE ( _lowercase : str ) ->bytes: '''simple docstring''' return baseaa.aaaencode(string.encode("utf-8" ) ) def _SCREAMING_SNAKE_CASE ( _lowercase : ...
31
0
"""simple docstring""" import baseaa def _SCREAMING_SNAKE_CASE ( _lowercase : str ) ->bytes: '''simple docstring''' return baseaa.aaaencode(string.encode("utf-8" ) ) def _SCREAMING_SNAKE_CASE ( _lowercase : bytes ...
718
"""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_...
31
0
from collections.abc import Sequence from queue import Queue class __UpperCamelCase : def __init__( self , lowerCAmelCase__ , lowerCAmelCase__ , lowerCAmelCase__ , lowerCAmelCase__=None , lowerCAmelCase__=None ) -> Optional[int]:...
719
"""simple docstring""" import itertools import random import unittest import numpy as np from transformers import BatchFeature, SpeechTaFeatureExtractor from transformers.testing_utils import require_torch from transformers.utils.import_utils import is_torch_available from ...test_sequ...
31
0
import numpy as np import torch from torch.utils.data import DataLoader from accelerate.utils.dataclasses import DistributedType class __UpperCamelCase : def __init__( self , lowerCAmelCase__=2 , lowerCAmelCase__=3 , lowerCAmelCase__=64 , ...
720
"""simple docstring""" import multiprocessing import time from arguments import PretokenizationArguments from datasets import load_dataset from transformers import AutoTokenizer, HfArgumentParser def _SCREAMING_SNAKE_CASE ( _lowercase : List[str] ) ->int: ...
31
0
"""simple docstring""" import itertools import random import unittest import numpy as np from transformers import BatchFeature, SpeechTaFeatureExtractor from transformers.testing_utils import require_torch from transformers.utils.import_utils import is_torch_available from ...test_sequ...
721
"""simple docstring""" from typing import TYPE_CHECKING from ...utils import ( OptionalDependencyNotAvailable, _LazyModule, is_flax_available, is_sentencepiece_available, is_tf_available, is_tokenizers_available, is_torch_available, ) if is_sentencepiece_...
31
0
from packaging import version from .import_utils import is_accelerate_available if is_accelerate_available(): import accelerate def UpperCAmelCase__ ( UpperCAmelCase__ :List[Any] ): '''simple docstring''' if not is_accelerate_available(): return method a ...
32
import os import tempfile import unittest from transformers.models.marian.convert_marian_tatoeba_to_pytorch import DEFAULT_REPO, TatoebaConverter from transformers.testing_utils import slow from transformers.utils import cached_property @unittest.skipUnless(os.path.exists(UpperCAmelCase__ ), '''...
32
1
import heapq import sys import numpy as np A_ : List[str] = tuple[int, int] class _lowercase : def __init__( self : Any ) -> Tuple: """simple docstring""" a = [] a = set() def A ( sel...
32
from ...configuration_utils import PretrainedConfig from ...utils import logging A_ : Any = logging.get_logger(__name__) A_ : Optional[int] = { '''SCUT-DLVCLab/lilt-roberta-en-base''': ( '''https://huggingface.co/SCUT-DLVCLab/lilt-roberta-en-base/resolve/ma...
32
1
import logging import os import sys from dataclasses import dataclass, field from typing import Optional from seqaseq_trainer import SeqaSeqTrainer from seqaseq_training_args import SeqaSeqTrainingArguments import transformers from transformers import ( AutoConfig, AutoModelForSeqaSeqLM, ...
32
import argparse from transformers import TaConfig, TaForConditionalGeneration, load_tf_weights_in_ta from transformers.utils import logging logging.set_verbosity_info() def UpperCAmelCase__ ( UpperCAmelCase__ :Optional[int] , UpperCAmelCase__ :List[str] , UpperCAmelCase__ :Any ...
32
1
import os from typing import Dict, List, Tuple, TypeVar, Union A_ : List[Any] = TypeVar('''T''') A_ : int = Union[List[T], Tuple[T, ...]] A_ : Tuple = Union[T, List[T], Dict[str, T]] A_ : int = Union[str, bytes, os.PathLike]
32
def UpperCAmelCase__ ( UpperCAmelCase__ :int , UpperCAmelCase__ :int ): '''simple docstring''' if a < 0 or b < 0: raise ValueError("the value of both inputs must be positive" ) a = str(bin(UpperCAmelCase__ ) )[2:] # remove the leading "0b" a ...
32
1
import torch from diffusers import EulerDiscreteScheduler from diffusers.utils import torch_device from .test_schedulers import SchedulerCommonTest class _lowercase ( UpperCAmelCase__ ): _UpperCAmelCase = (EulerDiscreteScheduler,) _UpperCAmelCase = 10 def A ...
32
from __future__ import annotations from collections.abc import Iterable, Iterator from dataclasses import dataclass A_ : List[str] = (3, 9, -11, 0, 7, 5, 1, -1) A_ : Optional[int] = (4, 6, 2, 0, 8, 10, 3, -2) @dataclass class _lowercase : _UpperCAmelCase ...
32
1
from collections import OrderedDict from typing import Mapping from ...configuration_utils import PretrainedConfig from ...onnx import OnnxConfig from ...utils import logging A_ : Tuple = logging.get_logger(__name__) A_ : str = { '''bert-base-uncased''': '''htt...
32
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 OptionalDepend...
32
1
import gc import unittest from diffusers import FlaxDPMSolverMultistepScheduler, FlaxStableDiffusionPipeline from diffusers.utils import is_flax_available, slow from diffusers.utils.testing_utils import require_flax if is_flax_available(): import jax import jax.numpy as jnp from fla...
32
from ...configuration_utils import PretrainedConfig from ...utils import logging from ...utils.backbone_utils import BackboneConfigMixin, get_aligned_output_features_output_indices A_ : int = logging.get_logger(__name__) A_ : str = { '''microsoft/focalnet-tiny''': ...
32
1
import unittest from transformers import BarthezTokenizer, BarthezTokenizerFast, BatchEncoding from transformers.testing_utils import require_sentencepiece, require_tokenizers, require_torch, slow from ...test_tokenization_common import TokenizerTesterMixin @require_tokenizers @require_sentencepi...
32
def UpperCAmelCase__ ( UpperCAmelCase__ :Any ): '''simple docstring''' if not head: return True # split the list to two parts a , a = head.next, head while fast and fast.next: a = fast.next.next a = slow.next a = slow.next a = N...
32
1
from ...configuration_utils import PretrainedConfig from ...utils import logging A_ : Any = logging.get_logger(__name__) A_ : Dict = { '''studio-ousia/luke-base''': '''https://huggingface.co/studio-ousia/luke-base/resolve/main/config.json''', '''studio-ousia/lu...
32
import unittest from transformers import MobileBertConfig, is_torch_available from transformers.models.auto import get_values from transformers.testing_utils import require_sentencepiece, require_tokenizers, require_torch, slow, torch_device from ...test_configuration_common import ConfigTester from .....
32
1
import numpy as np from matplotlib import pyplot as plt from sklearn.datasets import load_iris from sklearn.metrics import ConfusionMatrixDisplay from sklearn.model_selection import train_test_split from xgboost import XGBClassifier def UpperCAmelCase__ ( UpperCAmelCase__ :dict ): ...
32
import re from pathlib import Path from unittest import TestCase import pytest @pytest.mark.integration class _lowercase ( UpperCAmelCase__ ): def A ( self : Optional[int] , __lowerCAmelCase : str ) -> Union[str, Any]: """s...
32
1
from __future__ import annotations from math import pow, sqrt def UpperCAmelCase__ ( UpperCAmelCase__ :float , UpperCAmelCase__ :float , UpperCAmelCase__ :float ): '''simple docstring''' if (resistance, reactance, impedance).count(0 ) != 1: raise ValueErro...
32
from typing import TYPE_CHECKING from ...utils import OptionalDependencyNotAvailable, _LazyModule, is_torch_available A_ : Optional[int] = { '''configuration_instructblip''': [ '''INSTRUCTBLIP_PRETRAINED_CONFIG_ARCHIVE_MAP''', '''InstructBlipConfig''', '''...
32
1
def UpperCAmelCase__ ( UpperCAmelCase__ :list ): '''simple docstring''' a = len(UpperCAmelCase__ ) for i in range(1 , UpperCAmelCase__ ): a = collection[i] a = 0 a = i - 1 while low <= high: a = (low + high) // 2 ...
32
import tempfile import torch from diffusers import ( DEISMultistepScheduler, DPMSolverMultistepScheduler, DPMSolverSinglestepScheduler, UniPCMultistepScheduler, ) from .test_schedulers import SchedulerCommonTest class _lowercase ( UpperCAmelCase__ ): _UpperCAmel...
32
1
from ...configuration_utils import PretrainedConfig from ...utils import logging A_ : str = logging.get_logger(__name__) A_ : List[Any] = { '''RWKV/rwkv-4-169m-pile''': '''https://huggingface.co/RWKV/rwkv-4-169m-pile/resolve/main/config.json''', '''RWKV/rwkv-4-...
32
import inspect import unittest from transformers import ConvNextVaConfig from transformers.models.auto import get_values from transformers.models.auto.modeling_auto import MODEL_FOR_BACKBONE_MAPPING_NAMES, MODEL_MAPPING_NAMES from transformers.testing_utils import require_torch, require_vision, slow, tor...
32
1
import inspect import unittest from transformers import ViTHybridConfig from transformers.testing_utils import require_accelerate, require_torch, require_vision, slow, torch_device from transformers.utils import cached_property, is_torch_available, is_vision_available from ...test_configuration_common ...
32
import copy import os import cva import numpy as np from matplotlib import pyplot as plt class _lowercase : def __init__( self : List[str] ) -> List[str]: """simple docstring""" a = "" a = "" a = [] a ...
32
1
import argparse import os import re A_ : Tuple = '''src/diffusers''' # Pattern that looks at the indentation in a line. A_ : List[Any] = re.compile(r'''^(\s*)\S''') # Pattern that matches `"key":" and puts `key` in group 0. A_ : str = re.compile(r'''^...
32
from typing import List, Optional, Tuple, Union import torch from ...models import UNetaDModel from ...schedulers import ScoreSdeVeScheduler from ...utils import randn_tensor from ..pipeline_utils import DiffusionPipeline, ImagePipelineOutput class _lowercase ( UpperCAmelCase__ ): _...
32
1
import unittest import numpy as np from transformers import RobertaConfig, is_flax_available from transformers.testing_utils import require_flax, slow from ...test_modeling_flax_common import FlaxModelTesterMixin, floats_tensor, ids_tensor, random_attention_mask if is_flax_available(): from...
32
A_ : Any = [4, 1, 7, 4, 2, 6, 4, 1, 5, 3, 7, 5] A_ : Tuple = [3, 7, 7, 4, 2, 6, 4, 1, 5, 3, 7, 5] A_ : Optional[int] = { 0: '''Sunday''', 1: '''Monday''', 2: '''Tuesday''', 3: '''Wednesday''', 4: '''Thursday''', 5: '''Friday''', ...
32
1
def UpperCAmelCase__ ( UpperCAmelCase__ :int ): '''simple docstring''' if not isinstance(UpperCAmelCase__ , UpperCAmelCase__ ): raise TypeError("only integers accepted as input" ) else: a = str(abs(UpperCAmelCase__ ) ) a = [list(UpperCA...
32
import logging import os import sys from dataclasses import dataclass, field from importlib import import_module from typing import Dict, List, Optional, Tuple import numpy as np from seqeval.metrics import accuracy_score, fa_score, precision_score, recall_score from torch import nn from utils_ner im...
32
1
from ...configuration_utils import PretrainedConfig from ...utils import logging A_ : Dict = logging.get_logger(__name__) A_ : Optional[int] = {'''openai-gpt''': '''https://huggingface.co/openai-gpt/resolve/main/config.json'''} class _lowercase ( UpperCAm...
32
from ...configuration_utils import PretrainedConfig from ...utils import logging A_ : str = logging.get_logger(__name__) A_ : List[Any] = { '''RWKV/rwkv-4-169m-pile''': '''https://huggingface.co/RWKV/rwkv-4-169m-pile/resolve/main/config.json''', '''RWKV/rwkv-4-...
32
1
from numpy import exp, pi, sqrt def UpperCAmelCase__ ( UpperCAmelCase__ :str , UpperCAmelCase__ :float = 0.0 , UpperCAmelCase__ :float = 1.0 ): '''simple docstring''' return 1 / sqrt(2 * pi * sigma**2 ) * exp(-((x - mu) ** 2) / (2 * sigma**2) ) if __nam...
32
from math import ceil from typing import List, Optional, Union import numpy as np from ...audio_utils import mel_filter_bank, spectrogram, window_function from ...feature_extraction_sequence_utils import BatchFeature, SequenceFeatureExtractor from ...utils import TensorType, logging A_ : List...
32
1
import copy from dataclasses import dataclass, field from typing import ClassVar, Dict from ..features import Audio, Features, Value from .base import TaskTemplate @dataclass(frozen=UpperCAmelCase__ ) class _lowercase ( UpperCAmelCase__ ): _UpperCAmelCase = field(default='''aut...
32
import inspect import unittest import numpy as np from tests.test_modeling_common import floats_tensor from transformers import DetrConfig, MaskFormerConfig, SwinConfig, is_torch_available, is_vision_available from transformers.testing_utils import require_torch, require_torch_multi_gpu, require_vision...
32
1
A_ : List[Any] = [ (10_00, '''M'''), (9_00, '''CM'''), (5_00, '''D'''), (4_00, '''CD'''), (1_00, '''C'''), (90, '''XC'''), (50, '''L'''), (40, '''XL'''), (10, '''X'''), (9, '''IX'''), (5, '''V'''), (4, '''IV'''), (1, '''I'''), ] ...
32
import unittest from transformers import is_torch_available from transformers.testing_utils import require_torch if is_torch_available(): import torch from transformers.generation import DisjunctiveConstraint @require_torch class _lowercase ( unittest.TestCase ): de...
32
1