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
"""simple docstring""" from math import isqrt def SCREAMING_SNAKE_CASE_ ( snake_case : int )-> bool: return all(number % divisor != 0 for divisor in range(2 , isqrt(snake_case ) + 1 ) ) def SCREAMING_SNAKE_CASE_ ( snake_case : int = 10**6 )-> i...
650
"""simple docstring""" # Imports import numpy as np class __a : def __init__( self , a__=None , a__=None , a__=None , a__=None , a__=None ): self.set_matricies(red=a__ , green=a__ , blue=a__ , red_edge=a__ , nir=a__ ) def snake_case_ ( self...
650
1
"""simple docstring""" A_ : Union[str, Any] ={ """meter""": """m""", """kilometer""": """km""", """megametre""": """Mm""", """gigametre""": """Gm""", """terametre""": """Tm""", """petametre""": """Pm""", """exametre""": """Em""", """zettametre""": """Zm""", """yottam...
650
"""simple docstring""" import functools import operator from ...configuration_utils import PretrainedConfig from ...utils import logging A_ : Union[str, Any] =logging.get_logger(__name__) A_ : Optional[Any] ={ """microsoft/unispeech-large-1500h-cv""": ( """https://huggingface.c...
650
1
"""simple docstring""" import collections import gzip import os import urllib import numpy from tensorflow.python.framework import dtypes, random_seed from tensorflow.python.platform import gfile from tensorflow.python.util.deprecation import deprecated A_ : List[str] =collections.namedtuple("""_Data...
650
"""simple docstring""" import copy import json import os import tempfile from transformers import is_torch_available from .test_configuration_utils import config_common_kwargs class __a ( lowerCAmelCase__ ): def __init__( self , a__ , a__=None , a__=True , a__=None , ...
650
1
"""simple docstring""" import copy from ...configuration_utils import PretrainedConfig from ...utils import logging from ..bit import BitConfig A_ : int =logging.get_logger(__name__) A_ : Optional[Any] ={ """Intel/dpt-large""": """https://huggingface.co/Intel/dpt-large/resolve/main/con...
650
"""simple docstring""" from ..utils import DummyObject, requires_backends class __a ( metaclass=lowerCAmelCase__ ): SCREAMING_SNAKE_CASE__ : List[str] = ["flax"] def __init__( self , *a__ , **a__ ): requires_backends(self , ['flax'] ) ...
650
1
"""simple docstring""" import os import unittest from transformers.models.transfo_xl.tokenization_transfo_xl import VOCAB_FILES_NAMES, TransfoXLTokenizer from ...test_tokenization_common import TokenizerTesterMixin class __a ( lowerCAmelCase__ , unittest.TestCase ): SCREAMING_...
650
"""simple docstring""" def SCREAMING_SNAKE_CASE_ ( snake_case : int )-> bool: if p < 2: raise ValueError('p should not be less than 2!' ) elif p == 2: return True _lowerCamelCase = 4 _lowerCamelCase = (1 <...
650
1
"""simple docstring""" # coding=utf-8 # Copyright 2023 The HuggingFace Inc. team. # # 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 # ...
650
"""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/licenses/LICENSE-2.0 #...
650
1
"""simple docstring""" import os import re import warnings from shutil import copyfile from typing import List, Optional, Tuple from ...tokenization_utils_fast import PreTrainedTokenizerFast from ...utils import is_sentencepiece_available, logging if is_sentencepiece_available(): from .tokenization_ta ...
650
"""simple docstring""" import json import os import re import shutil import tempfile import unittest from typing import Tuple from transformers import AddedToken, BatchEncoding, ByTaTokenizer from transformers.utils import cached_property, is_tf_available, is_torch_available from ...test_tokenization_common i...
650
1
"""simple docstring""" import numpy as np def SCREAMING_SNAKE_CASE_ ( snake_case : np.ndarray , snake_case : float )-> np.ndarray: return np.where(vector > 0 , snake_case , (alpha * (np.exp(snake_case ) - 1)) ) if __name__ == "__main__": import doctes...
650
"""simple docstring""" import numpy as np import skfuzzy as fuzz if __name__ == "__main__": # Create universe of discourse in Python using linspace () A_ : int =np.linspace(start=0, stop=7_5, num=7_5, endpoint=True, retstep=False) # Create two fuzzy sets by defining any membership f...
650
1
"""simple docstring""" from typing import List, Optional, Tuple, Union import torch from torch import nn from torch.nn import CrossEntropyLoss from ... import AutoBackbone from ...modeling_outputs import SemanticSegmenterOutput from ...modeling_utils import PreTrainedModel from ...utils import add_start_docst...
650
"""simple docstring""" import argparse import json import os from pathlib import Path import requests import torch from transformers import JukeboxConfig, JukeboxModel from transformers.utils import logging logging.set_verbosity_info() A_ : str =logging.get_logger(__name__) A_ : Any ="""...
650
1
"""simple docstring""" import inspect import unittest import warnings from transformers import DeiTConfig from transformers.models.auto import get_values from transformers.testing_utils import ( require_accelerate, require_torch, require_torch_gpu, require_vision, slow, torch_device, ) ...
650
"""simple docstring""" import argparse import torch from transformers import ( WavaVecaConfig, WavaVecaFeatureExtractor, WavaVecaForAudioFrameClassification, WavaVecaForSequenceClassification, WavaVecaForXVector, logging, ) logging.set_verbosity_info() A_ : int =logging.get_...
650
1
"""simple docstring""" import copy import random from transformers import CLIPTokenizer class __a ( lowerCAmelCase__ ): def __init__( self , *a__ , **a__ ): super().__init__(*a__ , **a__ ) _lowerCamelCase = {} def snake_cas...
650
"""simple docstring""" from ...configuration_utils import PretrainedConfig from ...utils import logging A_ : List[str] =logging.get_logger(__name__) A_ : List[str] ={ """microsoft/biogpt""": """https://huggingface.co/microsoft/biogpt/resolve/main/config.json""", # See all BioGPT mod...
650
1
"""simple docstring""" from string import ascii_uppercase A_ : str ={char: i for i, char in enumerate(ascii_uppercase)} A_ : List[str] =dict(enumerate(ascii_uppercase)) def SCREAMING_SNAKE_CASE_ ( snake_case : str , snake_case : str )-> str: _lowerCamelCase ...
650
"""simple docstring""" def SCREAMING_SNAKE_CASE_ ( )-> Union[str, Any]: _lowerCamelCase = [31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31] _lowerCamelCase = 6 _lowerCamelCase = 1 _lowerCamelCase = 1_901 _lowerCa...
650
1
"""simple docstring""" A_ : Dict ="""ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/""" def SCREAMING_SNAKE_CASE_ ( snake_case : bytes )-> bytes: # Make sure the supplied data is a bytes-like object if not isinstance(snake_case , snake_case )...
650
"""simple docstring""" import json import os import re import sys import urllib.request import requests from bsa import BeautifulSoup A_ : Union[str, Any] ={ """User-Agent""": """Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36""" """ (KHTML, like Gecko) Chrome/70.0.3538.102 Safar...
650
1
"""simple docstring""" from ...configuration_utils import PretrainedConfig from ...utils import logging A_ : List[str] =logging.get_logger(__name__) A_ : Any ={ """google/fnet-base""": """https://huggingface.co/google/fnet-base/resolve/main/config.json""", """google/fnet-large""": "...
650
"""simple docstring""" from typing import TYPE_CHECKING from ...utils import ( OptionalDependencyNotAvailable, _LazyModule, is_sentencepiece_available, is_tf_available, is_tokenizers_available, is_torch_available, ) A_ : Union[str, Any] ={"""configuration_xlnet""": ["""XLNET_...
650
1
"""simple docstring""" import socket def SCREAMING_SNAKE_CASE_ ( )-> Optional[int]: _lowerCamelCase = socket.socket(socket.AF_INET , socket.SOCK_STREAM ) _lowerCamelCase = socket.gethostname() _lowerCamelCase = 12_312 s...
650
"""simple docstring""" def SCREAMING_SNAKE_CASE_ ( snake_case : int )-> int: if divisor % 5 == 0 or divisor % 2 == 0: return 0 _lowerCamelCase = 1 _lowerCamelCase = 1 while repunit: _lowerCamelCase = ...
650
1
"""simple docstring""" from __future__ import annotations A_ : int =[True] * 1_0_0_0_0_0_1 A_ : Dict =2 while i * i <= 1_0_0_0_0_0_0: if seive[i]: for j in range(i * i, 1_0_0_0_0_0_1, i): A_ : Dict =False i += 1 def SCREAMING_SNAKE_CASE_...
650
"""simple docstring""" from __future__ import annotations from fractions import Fraction def SCREAMING_SNAKE_CASE_ ( snake_case : int , snake_case : int )-> bool: return ( num != den and num % 10 == den // 10 and (num // 10) / (den % 10) == num / den ) ...
650
1
"""simple docstring""" from typing import TYPE_CHECKING from ...utils import ( OptionalDependencyNotAvailable, _LazyModule, is_flax_available, is_tf_available, is_tokenizers_available, is_torch_available, ) A_ : List[str] ={ """configuration_distilbert""": [ """DI...
650
"""simple docstring""" from typing import Union from ..utils import add_end_docstrings, is_torch_available, is_vision_available, logging from .base import PIPELINE_INIT_ARGS, Pipeline if is_vision_available(): from PIL import Image from ..image_utils import load_image if is_torch_available(): ...
650
1
"""simple docstring""" def SCREAMING_SNAKE_CASE_ ( snake_case : int )-> list[int]: if length <= 0 or not isinstance(snake_case , snake_case ): raise ValueError('Length must be a positive integer.' ) return [n * (2 * n - 1) for n in range(snake_case ...
650
"""simple docstring""" from math import ceil, sqrt def SCREAMING_SNAKE_CASE_ ( snake_case : int = 1_000_000 )-> int: _lowerCamelCase = 0 for outer_width in range(3 , (limit // 4) + 2 ): if outer_width**2 > limit: _lowe...
650
1
"""simple docstring""" from math import acos, sin from typing import List, Tuple, Union import numpy as np import torch from PIL import Image from ...models import AutoencoderKL, UNetaDConditionModel from ...schedulers import DDIMScheduler, DDPMScheduler from ...utils import randn_tensor from ..pipeline_utils...
650
"""simple docstring""" def SCREAMING_SNAKE_CASE_ ( snake_case : int , snake_case : Tuple )-> Dict: _lowerCamelCase = [1] for i in range(2 , snake_case ): factorials.append(factorials[-1] * i ) assert 0 <= k < factorials[-1] * ...
650
1
"""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_ : Union[str, Any] =logging.get_logger(__name_...
650
"""simple docstring""" from typing import List, Optional, Tuple, Union import torch from torch import nn from torch.nn import CrossEntropyLoss from ... import AutoBackbone from ...modeling_outputs import SemanticSegmenterOutput from ...modeling_utils import PreTrainedModel from ...utils import add_start_docst...
650
1
"""simple docstring""" from typing import Optional, Union import numpy as np from ...image_processing_utils import BaseImageProcessor, BatchFeature from ...image_transforms import get_image_size, pad, rescale, to_channel_dimension_format from ...image_utils import ChannelDimension, ImageInput, make_list_of_im...
650
"""simple docstring""" import json from typing import List, Optional, Tuple from tokenizers import normalizers from ...tokenization_utils_fast import PreTrainedTokenizerFast from ...utils import logging from .tokenization_convbert import ConvBertTokenizer A_ : Optional[int] =logging.get_logger(__na...
650
1
"""simple docstring""" import argparse import torch from transformers import ( WavaVecaConfig, WavaVecaFeatureExtractor, WavaVecaForAudioFrameClassification, WavaVecaForSequenceClassification, WavaVecaForXVector, logging, ) logging.set_verbosity_info() A_ : int =logging.get_...
650
"""simple docstring""" def SCREAMING_SNAKE_CASE_ ( snake_case : float , snake_case : float )-> float: if density <= 0: raise ValueError('Impossible fluid density' ) if bulk_modulus <= 0: raise ValueError('Impossible bulk modulus' ) ...
650
1
"""simple docstring""" import copy import inspect import unittest from transformers import PretrainedConfig, SwiftFormerConfig from transformers.testing_utils import ( require_torch, require_vision, slow, torch_device, ) from transformers.utils import cached_property, is_torch_available, is_vis...
650
"""simple docstring""" # Imports import numpy as np class __a : def __init__( self , a__=None , a__=None , a__=None , a__=None , a__=None ): self.set_matricies(red=a__ , green=a__ , blue=a__ , red_edge=a__ , nir=a__ ) def snake_case_ ( self...
650
1
"""simple docstring""" import argparse import json import os import re import torch from transformers import BloomConfig, BloomModel from transformers.file_utils import CONFIG_NAME, WEIGHTS_NAME from transformers.utils import logging logging.set_verbosity_info() A_ : List[Any] =[ """word_embed...
650
"""simple docstring""" import functools import operator from ...configuration_utils import PretrainedConfig from ...utils import logging A_ : Union[str, Any] =logging.get_logger(__name__) A_ : Optional[Any] ={ """microsoft/unispeech-large-1500h-cv""": ( """https://huggingface.c...
650
1
"""simple docstring""" import pandas as pd from matplotlib import pyplot as plt from sklearn.linear_model import LinearRegression # Splitting the dataset into the Training set and Test set from sklearn.model_selection import train_test_split # Fitting Polynomial Regression to the dataset from sklearn.preproce...
650
"""simple docstring""" import copy import json import os import tempfile from transformers import is_torch_available from .test_configuration_utils import config_common_kwargs class __a ( lowerCAmelCase__ ): def __init__( self , a__ , a__=None , a__=True , a__=None , ...
650
1
"""simple docstring""" from math import ceil, sqrt def SCREAMING_SNAKE_CASE_ ( snake_case : int = 1_000_000 )-> int: _lowerCamelCase = 0 for outer_width in range(3 , (limit // 4) + 2 ): if outer_width**2 > limit: _lowe...
650
"""simple docstring""" from ..utils import DummyObject, requires_backends class __a ( metaclass=lowerCAmelCase__ ): SCREAMING_SNAKE_CASE__ : List[str] = ["flax"] def __init__( self , *a__ , **a__ ): requires_backends(self , ['flax'] ) ...
650
1
"""simple docstring""" import math import sys def SCREAMING_SNAKE_CASE_ ( snake_case : int )-> int: if number != int(snake_case ): raise ValueError('the value of input must be a natural number' ) if number < 0: raise ValueError('the value ...
650
"""simple docstring""" def SCREAMING_SNAKE_CASE_ ( snake_case : int )-> bool: if p < 2: raise ValueError('p should not be less than 2!' ) elif p == 2: return True _lowerCamelCase = 4 _lowerCamelCase = (1 <...
650
1
"""simple docstring""" from math import factorial A_ : dict[str, int] ={str(digit): factorial(digit) for digit in range(1_0)} def SCREAMING_SNAKE_CASE_ ( snake_case : int )-> int: if not isinstance(snake_case , snake_case ): raise TypeError('Parameter...
650
"""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/licenses/LICENSE-2.0 #...
650
1
"""simple docstring""" import tempfile import unittest import numpy as np from huggingface_hub import HfFolder, delete_repo from requests.exceptions import HTTPError from transformers import BertConfig, is_flax_available from transformers.testing_utils import TOKEN, USER, is_staging_test, require_flax if is...
650
"""simple docstring""" import json import os import re import shutil import tempfile import unittest from typing import Tuple from transformers import AddedToken, BatchEncoding, ByTaTokenizer from transformers.utils import cached_property, is_tf_available, is_torch_available from ...test_tokenization_common i...
650
1
"""simple docstring""" from dataclasses import dataclass from typing import List, Optional, Union import numpy as np import PIL from ...utils import BaseOutput, OptionalDependencyNotAvailable, is_torch_available, is_transformers_available from .timesteps import ( fastaa_timesteps, smartaa_timesteps, ...
650
"""simple docstring""" import numpy as np import skfuzzy as fuzz if __name__ == "__main__": # Create universe of discourse in Python using linspace () A_ : int =np.linspace(start=0, stop=7_5, num=7_5, endpoint=True, retstep=False) # Create two fuzzy sets by defining any membership f...
650
1
"""simple docstring""" import unittest import numpy as np from diffusers import OnnxStableDiffusionInpaintPipelineLegacy from diffusers.utils.testing_utils import ( is_onnx_available, load_image, load_numpy, nightly, require_onnxruntime, require_torch_gpu, ) if is_onnx_available(): ...
650
"""simple docstring""" import argparse import json import os from pathlib import Path import requests import torch from transformers import JukeboxConfig, JukeboxModel from transformers.utils import logging logging.set_verbosity_info() A_ : str =logging.get_logger(__name__) A_ : Any ="""...
650
1
"""simple docstring""" import copy import json import os import tempfile from transformers import is_torch_available from .test_configuration_utils import config_common_kwargs class __a ( lowerCAmelCase__ ): def __init__( self , a__ , a__=None , a__=True , a__=None , ...
650
"""simple docstring""" import argparse import torch from transformers import ( WavaVecaConfig, WavaVecaFeatureExtractor, WavaVecaForAudioFrameClassification, WavaVecaForSequenceClassification, WavaVecaForXVector, logging, ) logging.set_verbosity_info() A_ : int =logging.get_...
650
1
"""simple docstring""" from collections.abc import Sequence def SCREAMING_SNAKE_CASE_ ( snake_case : Sequence[int] | None = None )-> int: if nums is None or not nums: raise ValueError('Input sequence should not be empty' ) _lowerCamelCase = nu...
650
"""simple docstring""" from ...configuration_utils import PretrainedConfig from ...utils import logging A_ : List[str] =logging.get_logger(__name__) A_ : List[str] ={ """microsoft/biogpt""": """https://huggingface.co/microsoft/biogpt/resolve/main/config.json""", # See all BioGPT mod...
650
1
"""simple docstring""" from __future__ import annotations import unittest from transformers import AutoTokenizer, PegasusConfig, is_tf_available from transformers.testing_utils import require_sentencepiece, require_tf, require_tokenizers, slow from transformers.utils import cached_property from ...test_confi...
650
"""simple docstring""" def SCREAMING_SNAKE_CASE_ ( )-> Union[str, Any]: _lowerCamelCase = [31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31] _lowerCamelCase = 6 _lowerCamelCase = 1 _lowerCamelCase = 1_901 _lowerCa...
650
1
"""simple docstring""" from collections import OrderedDict from typing import TYPE_CHECKING, Any, List, Mapping, Optional, Union from ...configuration_utils import PretrainedConfig from ...onnx import OnnxConfig from ...utils import TensorType, logging if TYPE_CHECKING: from ...onnx.config import Patch...
650
"""simple docstring""" import json import os import re import sys import urllib.request import requests from bsa import BeautifulSoup A_ : Union[str, Any] ={ """User-Agent""": """Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36""" """ (KHTML, like Gecko) Chrome/70.0.3538.102 Safar...
650
1
"""simple docstring""" from __future__ import annotations def SCREAMING_SNAKE_CASE_ ( snake_case : list[float] )-> float: _lowerCamelCase = 0.0_0 _lowerCamelCase = 0 for resistor in resistors: if resistor <= 0: ...
650
"""simple docstring""" from typing import TYPE_CHECKING from ...utils import ( OptionalDependencyNotAvailable, _LazyModule, is_sentencepiece_available, is_tf_available, is_tokenizers_available, is_torch_available, ) A_ : Union[str, Any] ={"""configuration_xlnet""": ["""XLNET_...
650
1
"""simple docstring""" from collections.abc import Iterable from typing import Generic, TypeVar A_ : Union[str, Any] =TypeVar("""_T""") class __a ( Generic[_T] ): def __init__( self , a__ = None ): _lowerCamelCase = list(iterable or [] ) ...
650
"""simple docstring""" def SCREAMING_SNAKE_CASE_ ( snake_case : int )-> int: if divisor % 5 == 0 or divisor % 2 == 0: return 0 _lowerCamelCase = 1 _lowerCamelCase = 1 while repunit: _lowerCamelCase = ...
650
1
"""simple docstring""" import PIL.Image import PIL.ImageOps from packaging import version from PIL import Image if version.parse(version.parse(PIL.__version__).base_version) >= version.parse("""9.1.0"""): A_ : Dict ={ """linear""": PIL.Image.Resampling.BILINEAR, """bilinear"...
650
"""simple docstring""" from __future__ import annotations from fractions import Fraction def SCREAMING_SNAKE_CASE_ ( snake_case : int , snake_case : int )-> bool: return ( num != den and num % 10 == den // 10 and (num // 10) / (den % 10) == num / den ) ...
650
1
"""simple docstring""" A_ : List[Any] =8.31_4462 # Unit - J mol-1 K-1 def SCREAMING_SNAKE_CASE_ ( snake_case : float , snake_case : float , snake_case : float )-> float: if moles < 0 or kelvin < 0 or volume < 0: raise ValueError('Invalid inputs. ...
650
"""simple docstring""" from typing import Union from ..utils import add_end_docstrings, is_torch_available, is_vision_available, logging from .base import PIPELINE_INIT_ARGS, Pipeline if is_vision_available(): from PIL import Image from ..image_utils import load_image if is_torch_available(): ...
650
1
"""simple docstring""" import io import math from typing import Dict, Optional, Union import numpy as np from huggingface_hub import hf_hub_download from ...image_processing_utils import BaseImageProcessor, BatchFeature from ...image_transforms import convert_to_rgb, normalize, to_channel_dimension_format, to...
650
"""simple docstring""" from math import ceil, sqrt def SCREAMING_SNAKE_CASE_ ( snake_case : int = 1_000_000 )-> int: _lowerCamelCase = 0 for outer_width in range(3 , (limit // 4) + 2 ): if outer_width**2 > limit: _lowe...
650
1
"""simple docstring""" import warnings 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 __a ( low...
650
"""simple docstring""" def SCREAMING_SNAKE_CASE_ ( snake_case : int , snake_case : Tuple )-> Dict: _lowerCamelCase = [1] for i in range(2 , snake_case ): factorials.append(factorials[-1] * i ) assert 0 <= k < factorials[-1] * ...
650
1
"""simple docstring""" from typing import Union from ..utils import add_end_docstrings, is_torch_available, is_vision_available, logging from .base import PIPELINE_INIT_ARGS, Pipeline if is_vision_available(): from PIL import Image from ..image_utils import load_image if is_torch_available(): ...
650
"""simple docstring""" from typing import List, Optional, Tuple, Union import torch from torch import nn from torch.nn import CrossEntropyLoss from ... import AutoBackbone from ...modeling_outputs import SemanticSegmenterOutput from ...modeling_utils import PreTrainedModel from ...utils import add_start_docst...
650
1
"""simple docstring""" import copy from typing import TYPE_CHECKING, Any, Mapping, Optional, OrderedDict from packaging import version from ...configuration_utils import PretrainedConfig from ...onnx import OnnxConfig from ...utils import logging from ..auto.configuration_auto import AutoConfig if TYPE_CHEC...
650
"""simple docstring""" import json from typing import List, Optional, Tuple from tokenizers import normalizers from ...tokenization_utils_fast import PreTrainedTokenizerFast from ...utils import logging from .tokenization_convbert import ConvBertTokenizer A_ : Optional[int] =logging.get_logger(__na...
650
1
"""simple docstring""" from typing import Dict, List from nltk.translate import gleu_score import datasets from datasets import MetricInfo A_ : str ="""\ @misc{wu2016googles, title={Google's Neural Machine Translation System: Bridging the Gap between Human and Machine Translation}, auth...
650
"""simple docstring""" def SCREAMING_SNAKE_CASE_ ( snake_case : float , snake_case : float )-> float: if density <= 0: raise ValueError('Impossible fluid density' ) if bulk_modulus <= 0: raise ValueError('Impossible bulk modulus' ) ...
650
1
"""simple docstring""" import gc import unittest import numpy as np import torch from transformers import CLIPTextConfig, CLIPTextModel, CLIPTokenizer from diffusers import ( AutoencoderKL, DDIMScheduler, StableDiffusionSAGPipeline, UNetaDConditionModel, ) from diffusers.utils import slow, tor...
650
"""simple docstring""" # Imports import numpy as np class __a : def __init__( self , a__=None , a__=None , a__=None , a__=None , a__=None ): self.set_matricies(red=a__ , green=a__ , blue=a__ , red_edge=a__ , nir=a__ ) def snake_case_ ( self...
650
1
"""simple docstring""" import unittest from parameterized import parameterized from transformers import OpenLlamaConfig, is_torch_available, set_seed from transformers.testing_utils import require_torch, torch_device from ...generation.test_utils import GenerationTesterMixin from ...test_configuration_common...
650
"""simple docstring""" import functools import operator from ...configuration_utils import PretrainedConfig from ...utils import logging A_ : Union[str, Any] =logging.get_logger(__name__) A_ : Optional[Any] ={ """microsoft/unispeech-large-1500h-cv""": ( """https://huggingface.c...
650
1
"""simple docstring""" import pickle import shutil import tempfile import unittest from transformers import SPIECE_UNDERLINE, XGLMTokenizer, XGLMTokenizerFast from transformers.testing_utils import get_tests_dir, require_sentencepiece, require_tokenizers, slow from transformers.utils import cached_property fr...
650
"""simple docstring""" import copy import json import os import tempfile from transformers import is_torch_available from .test_configuration_utils import config_common_kwargs class __a ( lowerCAmelCase__ ): def __init__( self , a__ , a__=None , a__=True , a__=None , ...
650
1
"""simple docstring""" import math def SCREAMING_SNAKE_CASE_ ( snake_case : int )-> list: _lowerCamelCase = [True] * n _lowerCamelCase = False _lowerCamelCase = False _lowerCamelCase = True for i in ...
650
"""simple docstring""" from ..utils import DummyObject, requires_backends class __a ( metaclass=lowerCAmelCase__ ): SCREAMING_SNAKE_CASE__ : List[str] = ["flax"] def __init__( self , *a__ , **a__ ): requires_backends(self , ['flax'] ) ...
650
1
"""simple docstring""" from __future__ import annotations import os import tempfile import unittest import numpy as np from huggingface_hub import hf_hub_download from transformers import is_tensorflow_text_available, is_tf_available from transformers.testing_utils import require_tensorflow_text, require_tf,...
650
"""simple docstring""" def SCREAMING_SNAKE_CASE_ ( snake_case : int )-> bool: if p < 2: raise ValueError('p should not be less than 2!' ) elif p == 2: return True _lowerCamelCase = 4 _lowerCamelCase = (1 <...
650
1
"""simple docstring""" import gc import importlib.metadata import tempfile import unittest from packaging import version from transformers import ( AutoModel, AutoModelForCausalLM, AutoModelForSeqaSeqLM, AutoModelForSequenceClassification, AutoTokenizer, BitsAndBytesConfig, pipelin...
650
"""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/licenses/LICENSE-2.0 #...
650
1
"""simple docstring""" # this script reports modified .py files under the desired list of top-level sub-dirs passed as a list of arguments, e.g.: # python ./utils/get_modified_files.py utils src tests examples # # it uses git to find the forking point and which files were modified - i.e. files not under git w...
650
"""simple docstring""" import json import os import re import shutil import tempfile import unittest from typing import Tuple from transformers import AddedToken, BatchEncoding, ByTaTokenizer from transformers.utils import cached_property, is_tf_available, is_torch_available from ...test_tokenization_common i...
650
1
"""simple docstring""" import gc import unittest import numpy as np import torch from transformers import CLIPTextConfig, CLIPTextModel, CLIPTokenizer from diffusers import ( AutoencoderKL, DDIMScheduler, StableDiffusionAttendAndExcitePipeline, UNetaDConditionModel, ) from diffusers.utils impo...
650
"""simple docstring""" import numpy as np import skfuzzy as fuzz if __name__ == "__main__": # Create universe of discourse in Python using linspace () A_ : int =np.linspace(start=0, stop=7_5, num=7_5, endpoint=True, retstep=False) # Create two fuzzy sets by defining any membership f...
650
1
"""simple docstring""" from __future__ import annotations def SCREAMING_SNAKE_CASE_ ( snake_case : int )-> list[int]: _lowerCamelCase = 2 _lowerCamelCase = [] while i * i <= n: if n % i: i += 1 ...
650
"""simple docstring""" import argparse import json import os from pathlib import Path import requests import torch from transformers import JukeboxConfig, JukeboxModel from transformers.utils import logging logging.set_verbosity_info() A_ : str =logging.get_logger(__name__) A_ : Any ="""...
650
1
"""simple docstring""" import copy from typing import Dict, Optional from ...configuration_utils import PretrainedConfig from ...utils import logging from ..auto import CONFIG_MAPPING from ..detr import DetrConfig from ..swin import SwinConfig A_ : List[str] ={ """facebook/maskformer-swin-base-a...
650
"""simple docstring""" import argparse import torch from transformers import ( WavaVecaConfig, WavaVecaFeatureExtractor, WavaVecaForAudioFrameClassification, WavaVecaForSequenceClassification, WavaVecaForXVector, logging, ) logging.set_verbosity_info() A_ : int =logging.get_...
650
1
"""simple docstring""" from typing import Any, Callable, Dict, List, Optional, Union import torch from transformers import CLIPImageProcessor, CLIPTextModel, CLIPTokenizer from diffusers import ( AutoencoderKL, DDIMScheduler, DiffusionPipeline, LMSDiscreteScheduler, PNDMScheduler, Stab...
650
"""simple docstring""" from ...configuration_utils import PretrainedConfig from ...utils import logging A_ : List[str] =logging.get_logger(__name__) A_ : List[str] ={ """microsoft/biogpt""": """https://huggingface.co/microsoft/biogpt/resolve/main/config.json""", # See all BioGPT mod...
650
1
"""simple docstring""" def SCREAMING_SNAKE_CASE_ ( snake_case : str )-> str: return " ".join( ''.join(word[::-1] ) if len(snake_case ) > 4 else word for word in sentence.split() ) if __name__ == "__main__": import doctest doctest.testmod() pr...
650
"""simple docstring""" def SCREAMING_SNAKE_CASE_ ( )-> Union[str, Any]: _lowerCamelCase = [31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31] _lowerCamelCase = 6 _lowerCamelCase = 1 _lowerCamelCase = 1_901 _lowerCa...
650
1
"""simple docstring""" import logging import os import sys from dataclasses import dataclass, field from typing import Optional import numpy as np import torch from datasets import load_dataset from torchvision.transforms import Compose, Lambda, Normalize, RandomHorizontalFlip, RandomResizedCrop, ToTensor imp...
650
"""simple docstring""" import json import os import re import sys import urllib.request import requests from bsa import BeautifulSoup A_ : Union[str, Any] ={ """User-Agent""": """Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36""" """ (KHTML, like Gecko) Chrome/70.0.3538.102 Safar...
650
1
"""simple docstring""" import os import tempfile import unittest from transformers import NezhaConfig, is_torch_available from transformers.models.auto import get_values from transformers.testing_utils import require_torch, require_torch_gpu, slow, torch_device from ...generation.test_utils import GenerationT...
650
"""simple docstring""" from typing import TYPE_CHECKING from ...utils import ( OptionalDependencyNotAvailable, _LazyModule, is_sentencepiece_available, is_tf_available, is_tokenizers_available, is_torch_available, ) A_ : Union[str, Any] ={"""configuration_xlnet""": ["""XLNET_...
650
1
"""simple docstring""" from typing import TYPE_CHECKING from ...utils import OptionalDependencyNotAvailable, _LazyModule, is_tensorflow_text_available, is_torch_available A_ : Union[str, Any] ={ """configuration_ernie""": ["""ERNIE_PRETRAINED_CONFIG_ARCHIVE_MAP""", """ErnieConfig""", """ErnieOnn...
650
"""simple docstring""" def SCREAMING_SNAKE_CASE_ ( snake_case : int )-> int: if divisor % 5 == 0 or divisor % 2 == 0: return 0 _lowerCamelCase = 1 _lowerCamelCase = 1 while repunit: _lowerCamelCase = ...
650
1
"""simple docstring""" def SCREAMING_SNAKE_CASE_ ( snake_case : str , snake_case : str )-> bool: _lowerCamelCase = len(snake_case ) + 1 _lowerCamelCase = len(snake_case ) + 1 # dp is a 2d matrix where dp[i][j] denotes whether pre...
650
"""simple docstring""" from __future__ import annotations from fractions import Fraction def SCREAMING_SNAKE_CASE_ ( snake_case : int , snake_case : int )-> bool: return ( num != den and num % 10 == den // 10 and (num // 10) / (den % 10) == num / den ) ...
650
1
"""simple docstring""" from collections import OrderedDict from typing import TYPE_CHECKING, Any, List, Mapping, Optional from packaging import version if TYPE_CHECKING: from ... import PreTrainedTokenizer, TensorType from ...configuration_utils import PretrainedConfig from ...onnx import OnnxConfigWi...
650
"""simple docstring""" from typing import Union from ..utils import add_end_docstrings, is_torch_available, is_vision_available, logging from .base import PIPELINE_INIT_ARGS, Pipeline if is_vision_available(): from PIL import Image from ..image_utils import load_image if is_torch_available(): ...
650
1
"""simple docstring""" import functools import operator from ...configuration_utils import PretrainedConfig from ...utils import logging A_ : Union[str, Any] =logging.get_logger(__name__) A_ : Optional[Any] ={ """microsoft/unispeech-large-1500h-cv""": ( """https://huggingface.c...
650
"""simple docstring""" from math import ceil, sqrt def SCREAMING_SNAKE_CASE_ ( snake_case : int = 1_000_000 )-> int: _lowerCamelCase = 0 for outer_width in range(3 , (limit // 4) + 2 ): if outer_width**2 > limit: _lowe...
650
1
"""simple docstring""" import copy import unittest from transformers.models.auto import get_values from transformers.testing_utils import require_torch, slow, torch_device from transformers.utils import cached_property, is_torch_available, is_vision_available from ...test_configuration_common import ConfigTes...
650
"""simple docstring""" def SCREAMING_SNAKE_CASE_ ( snake_case : int , snake_case : Tuple )-> Dict: _lowerCamelCase = [1] for i in range(2 , snake_case ): factorials.append(factorials[-1] * i ) assert 0 <= k < factorials[-1] * ...
650
1
"""simple docstring""" def SCREAMING_SNAKE_CASE_ ( snake_case : str )-> list: return [ txt[:a] + txt[a].upper() + txt[a + 1 :] for a in range(len(snake_case ) ) if txt[a].isalpha() ] if __name__ == "__main__": __import__("""doctest...
650
"""simple docstring""" from typing import List, Optional, Tuple, Union import torch from torch import nn from torch.nn import CrossEntropyLoss from ... import AutoBackbone from ...modeling_outputs import SemanticSegmenterOutput from ...modeling_utils import PreTrainedModel from ...utils import add_start_docst...
650
1
"""simple docstring""" import warnings from collections import OrderedDict from typing import Mapping from packaging import version from ...configuration_utils import PretrainedConfig from ...onnx import OnnxConfig from ...utils import logging A_ : Union[str, Any] =logging.get_logger(__name__) A_ ...
650
"""simple docstring""" import json from typing import List, Optional, Tuple from tokenizers import normalizers from ...tokenization_utils_fast import PreTrainedTokenizerFast from ...utils import logging from .tokenization_convbert import ConvBertTokenizer A_ : Optional[int] =logging.get_logger(__na...
650
1
"""simple docstring""" def SCREAMING_SNAKE_CASE_ ( snake_case : list )-> bool: if not isinstance(snake_case , snake_case ): raise ValueError('Input series is not valid, valid series - [2, 4, 6]' ) if len(snake_case ) == 0: raise ValueE...
650
"""simple docstring""" def SCREAMING_SNAKE_CASE_ ( snake_case : float , snake_case : float )-> float: if density <= 0: raise ValueError('Impossible fluid density' ) if bulk_modulus <= 0: raise ValueError('Impossible bulk modulus' ) ...
650
1
"""simple docstring""" import argparse from typing import Dict import tensorflow as tf import torch from tqdm import tqdm from transformers import BigBirdPegasusConfig, BigBirdPegasusForConditionalGeneration A_ : List[str] =[ # tf -> hf ("""/""", """."""), ("""layer_""", """layers."""),...
650
"""simple docstring""" # Imports import numpy as np class __a : def __init__( self , a__=None , a__=None , a__=None , a__=None , a__=None ): self.set_matricies(red=a__ , green=a__ , blue=a__ , red_edge=a__ , nir=a__ ) def snake_case_ ( self...
650
1
"""simple docstring""" import torch from diffusers import UnCLIPScheduler from .test_schedulers import SchedulerCommonTest class __a ( lowerCAmelCase__ ): SCREAMING_SNAKE_CASE__ : Union[str, Any] = (UnCLIPScheduler,) def snake_case_ ( self , **a__ ...
650
"""simple docstring""" import functools import operator from ...configuration_utils import PretrainedConfig from ...utils import logging A_ : Union[str, Any] =logging.get_logger(__name__) A_ : Optional[Any] ={ """microsoft/unispeech-large-1500h-cv""": ( """https://huggingface.c...
650
1
"""simple docstring""" import math import os from copy import deepcopy import datasets import evaluate import torch import transformers from datasets import load_dataset from torch.utils.data import DataLoader from transformers import AutoModelForSequenceClassification, AutoTokenizer from accelerate import Ac...
650
"""simple docstring""" import copy import json import os import tempfile from transformers import is_torch_available from .test_configuration_utils import config_common_kwargs class __a ( lowerCAmelCase__ ): def __init__( self , a__ , a__=None , a__=True , a__=None , ...
650
1
"""simple docstring""" import os import sys from contextlib import contextmanager # Windows only if os.name == "nt": import ctypes import msvcrt # noqa class __a ( ctypes.Structure ): # _fields is a specific attr expected by ctypes SCREAMING_SNAKE...
650
"""simple docstring""" from ..utils import DummyObject, requires_backends class __a ( metaclass=lowerCAmelCase__ ): SCREAMING_SNAKE_CASE__ : List[str] = ["flax"] def __init__( self , *a__ , **a__ ): requires_backends(self , ['flax'] ) ...
650
1
"""simple docstring""" from typing import TYPE_CHECKING from ...utils import ( OptionalDependencyNotAvailable, _LazyModule, is_flax_available, is_tf_available, is_torch_available, ) A_ : List[Any] ={"""configuration_encoder_decoder""": ["""EncoderDecoderConfig"""]} try: if...
650
"""simple docstring""" def SCREAMING_SNAKE_CASE_ ( snake_case : int )-> bool: if p < 2: raise ValueError('p should not be less than 2!' ) elif p == 2: return True _lowerCamelCase = 4 _lowerCamelCase = (1 <...
650
1
"""simple docstring""" class __a : def __init__( self , a__ ): _lowerCamelCase = set_counts _lowerCamelCase = max(a__ ) _lowerCamelCase = len(a__ ) _lowerCamelCase = [1] * num_sets ...
650
"""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/licenses/LICENSE-2.0 #...
650
1
"""simple docstring""" import gc import unittest import numpy as np import torch import torch.nn.functional as F from transformers import ( ClapTextConfig, ClapTextModelWithProjection, RobertaTokenizer, SpeechTaHifiGan, SpeechTaHifiGanConfig, ) from diffusers import ( AudioLDMPipeline,...
650
"""simple docstring""" import json import os import re import shutil import tempfile import unittest from typing import Tuple from transformers import AddedToken, BatchEncoding, ByTaTokenizer from transformers.utils import cached_property, is_tf_available, is_torch_available from ...test_tokenization_common i...
650
1
"""simple docstring""" def SCREAMING_SNAKE_CASE_ ( snake_case : int )-> int: if n == 1 or not isinstance(snake_case , snake_case ): return 0 elif n == 2: return 1 else: _lowerCamelCase = [0, 1] fo...
650
"""simple docstring""" import numpy as np import skfuzzy as fuzz if __name__ == "__main__": # Create universe of discourse in Python using linspace () A_ : int =np.linspace(start=0, stop=7_5, num=7_5, endpoint=True, retstep=False) # Create two fuzzy sets by defining any membership f...
650
1
"""simple docstring""" import math def SCREAMING_SNAKE_CASE_ ( snake_case : Optional[Any] , snake_case : int )-> List[Any]: if 0 not in (x, y): # We use the relation x^y = y*log10(x), where 10 is the base. return y * math.logaa(snake_case ) ...
650
"""simple docstring""" import argparse import json import os from pathlib import Path import requests import torch from transformers import JukeboxConfig, JukeboxModel from transformers.utils import logging logging.set_verbosity_info() A_ : str =logging.get_logger(__name__) A_ : Any ="""...
650
1
"""simple docstring""" import argparse import os import shutil import torch from emmental.modules import MagnitudeBinarizer, ThresholdBinarizer, TopKBinarizer def SCREAMING_SNAKE_CASE_ ( snake_case : List[str] )-> int: _lowerCamelCase = args.pruning_method _lowe...
650
"""simple docstring""" import argparse import torch from transformers import ( WavaVecaConfig, WavaVecaFeatureExtractor, WavaVecaForAudioFrameClassification, WavaVecaForSequenceClassification, WavaVecaForXVector, logging, ) logging.set_verbosity_info() A_ : int =logging.get_...
650
1
"""simple docstring""" import unittest import numpy as np from transformers.testing_utils import require_torch, require_vision from transformers.utils import is_torch_available, is_vision_available from ...test_image_processing_common import ImageProcessingSavingTestMixin, prepare_image_inputs if is_torch_...
650
"""simple docstring""" from ...configuration_utils import PretrainedConfig from ...utils import logging A_ : List[str] =logging.get_logger(__name__) A_ : List[str] ={ """microsoft/biogpt""": """https://huggingface.co/microsoft/biogpt/resolve/main/config.json""", # See all BioGPT mod...
650
1
"""simple docstring""" import warnings from diffusers import StableDiffusionInpaintPipeline as StableDiffusionInpaintPipeline # noqa F401 warnings.warn( """The `inpainting.py` script is outdated. Please use directly `from diffusers import""" """ StableDiffusionInpaintPipeline` instead.""" )
650
"""simple docstring""" def SCREAMING_SNAKE_CASE_ ( )-> Union[str, Any]: _lowerCamelCase = [31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31] _lowerCamelCase = 6 _lowerCamelCase = 1 _lowerCamelCase = 1_901 _lowerCa...
650
1
"""simple docstring""" def SCREAMING_SNAKE_CASE_ ( snake_case : float )-> float: if edge <= 0 or not isinstance(snake_case , snake_case ): raise ValueError('Length must be a positive.' ) return 3 * ((25 + 10 * (5 ** (1 / 2))) ** (1 / 2)) * (edge**2) ...
650
"""simple docstring""" import json import os import re import sys import urllib.request import requests from bsa import BeautifulSoup A_ : Union[str, Any] ={ """User-Agent""": """Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36""" """ (KHTML, like Gecko) Chrome/70.0.3538.102 Safar...
650
1
"""simple docstring""" from typing import TYPE_CHECKING from ...utils import ( OptionalDependencyNotAvailable, _LazyModule, is_flax_available, is_tf_available, is_tokenizers_available, is_torch_available, ) A_ : Dict ={ """configuration_electra""": ["""ELECTRA_PRETRAINED_...
650
"""simple docstring""" from typing import TYPE_CHECKING from ...utils import ( OptionalDependencyNotAvailable, _LazyModule, is_sentencepiece_available, is_tf_available, is_tokenizers_available, is_torch_available, ) A_ : Union[str, Any] ={"""configuration_xlnet""": ["""XLNET_...
650
1
"""simple docstring""" import unittest from transformers import DonutProcessor A_ : Union[str, Any] ="""naver-clova-ix/donut-base""" class __a ( unittest.TestCase ): def snake_case_ ( self ): _lowerCamelCase = DonutProcessor.from_pretr...
650
"""simple docstring""" def SCREAMING_SNAKE_CASE_ ( snake_case : int )-> int: if divisor % 5 == 0 or divisor % 2 == 0: return 0 _lowerCamelCase = 1 _lowerCamelCase = 1 while repunit: _lowerCamelCase = ...
650
1
"""simple docstring""" from __future__ import annotations # This is the precision for this function which can be altered. # It is recommended for users to keep this number greater than or equal to 10. A_ : str =1_0 def SCREAMING_SNAKE_CASE_ ( snake_case : int , snake_case : int , ...
650
"""simple docstring""" from __future__ import annotations from fractions import Fraction def SCREAMING_SNAKE_CASE_ ( snake_case : int , snake_case : int )-> bool: return ( num != den and num % 10 == den // 10 and (num // 10) / (den % 10) == num / den ) ...
650
1
"""simple docstring""" from ...utils import ( OptionalDependencyNotAvailable, is_flax_available, is_torch_available, is_transformers_available, ) try: if not (is_transformers_available() and is_torch_available()): raise OptionalDependencyNotAvailable() except OptionalDependen...
650
"""simple docstring""" from typing import Union from ..utils import add_end_docstrings, is_torch_available, is_vision_available, logging from .base import PIPELINE_INIT_ARGS, Pipeline if is_vision_available(): from PIL import Image from ..image_utils import load_image if is_torch_available(): ...
650
1
"""simple docstring""" import copy import os from typing import Union from ...configuration_utils import PretrainedConfig from ...utils import logging A_ : Tuple =logging.get_logger(__name__) A_ : int ={ """Salesforce/blip-vqa-base""": """https://huggingface.co/Salesforce/blip-vqa-base...
650
"""simple docstring""" from math import ceil, sqrt def SCREAMING_SNAKE_CASE_ ( snake_case : int = 1_000_000 )-> int: _lowerCamelCase = 0 for outer_width in range(3 , (limit // 4) + 2 ): if outer_width**2 > limit: _lowe...
650
1
"""simple docstring""" import importlib import os import fsspec import pytest from fsspec import register_implementation from fsspec.registry import _registry as _fsspec_registry from datasets.filesystems import COMPRESSION_FILESYSTEMS, HfFileSystem, extract_path_from_uri, is_remote_filesystem from .utils im...
650
"""simple docstring""" def SCREAMING_SNAKE_CASE_ ( snake_case : int , snake_case : Tuple )-> Dict: _lowerCamelCase = [1] for i in range(2 , snake_case ): factorials.append(factorials[-1] * i ) assert 0 <= k < factorials[-1] * ...
650
1
"""simple docstring""" import platform from argparse import ArgumentParser import huggingface_hub from .. import __version__ as version from ..utils import is_accelerate_available, is_torch_available, is_transformers_available, is_xformers_available from . import BaseDiffusersCLICommand def SCREAMING_SNA...
650
"""simple docstring""" from typing import List, Optional, Tuple, Union import torch from torch import nn from torch.nn import CrossEntropyLoss from ... import AutoBackbone from ...modeling_outputs import SemanticSegmenterOutput from ...modeling_utils import PreTrainedModel from ...utils import add_start_docst...
650
1
"""simple docstring""" # Algorithm for the pigeonhole sorting def SCREAMING_SNAKE_CASE_ ( snake_case : Union[str, Any] )-> List[Any]: _lowerCamelCase = min(snake_case ) # min() finds the minimum value _lowerCamelCase = max(snake_case ) ...
650
"""simple docstring""" import json from typing import List, Optional, Tuple from tokenizers import normalizers from ...tokenization_utils_fast import PreTrainedTokenizerFast from ...utils import logging from .tokenization_convbert import ConvBertTokenizer A_ : Optional[int] =logging.get_logger(__na...
650
1
"""simple docstring""" import gc import random import unittest import numpy as np import torch from PIL import Image from transformers import CLIPTextConfig, CLIPTextModel, CLIPTokenizer from diffusers import AutoencoderKL, PNDMScheduler, StableDiffusionInpaintPipeline, UNetaDConditionModel from diffusers.uti...
650
"""simple docstring""" def SCREAMING_SNAKE_CASE_ ( snake_case : float , snake_case : float )-> float: if density <= 0: raise ValueError('Impossible fluid density' ) if bulk_modulus <= 0: raise ValueError('Impossible bulk modulus' ) ...
650
1
"""simple docstring""" import gc import threading import time import psutil import torch class __a : def __init__( self ): _lowerCamelCase = psutil.Process() _lowerCamelCase = False def snake_case_ ( self ): ...
650
"""simple docstring""" # Imports import numpy as np class __a : def __init__( self , a__=None , a__=None , a__=None , a__=None , a__=None ): self.set_matricies(red=a__ , green=a__ , blue=a__ , red_edge=a__ , nir=a__ ) def snake_case_ ( self...
650
1
"""simple docstring""" from ...configuration_utils import PretrainedConfig from ...utils import logging from ...utils.backbone_utils import BackboneConfigMixin, get_aligned_output_features_output_indices A_ : List[Any] =logging.get_logger(__name__) class __a ( lowerCAmelCase__ ,...
650
"""simple docstring""" import functools import operator from ...configuration_utils import PretrainedConfig from ...utils import logging A_ : Union[str, Any] =logging.get_logger(__name__) A_ : Optional[Any] ={ """microsoft/unispeech-large-1500h-cv""": ( """https://huggingface.c...
650
1
"""simple docstring""" from typing import TYPE_CHECKING from ...utils import OptionalDependencyNotAvailable, _LazyModule, is_torch_available, is_vision_available A_ : Any ={ """configuration_mask2former""": [ """MASK2FORMER_PRETRAINED_CONFIG_ARCHIVE_MAP""", """Mask2FormerConfig""...
650
"""simple docstring""" import copy import json import os import tempfile from transformers import is_torch_available from .test_configuration_utils import config_common_kwargs class __a ( lowerCAmelCase__ ): def __init__( self , a__ , a__=None , a__=True , a__=None , ...
650
1
"""simple docstring""" import secrets from random import shuffle from string import ascii_letters, ascii_lowercase, ascii_uppercase, digits, punctuation def SCREAMING_SNAKE_CASE_ ( snake_case : int = 8 )-> str: _lowerCamelCase = ascii_letters + digits + punctuation ...
650
"""simple docstring""" from ..utils import DummyObject, requires_backends class __a ( metaclass=lowerCAmelCase__ ): SCREAMING_SNAKE_CASE__ : List[str] = ["flax"] def __init__( self , *a__ , **a__ ): requires_backends(self , ['flax'] ) ...
650
1
"""simple docstring""" def SCREAMING_SNAKE_CASE_ ( snake_case : str )-> str: return " ".join(input_str.split()[::-1] ) if __name__ == "__main__": import doctest doctest.testmod()
650
"""simple docstring""" def SCREAMING_SNAKE_CASE_ ( snake_case : int )-> bool: if p < 2: raise ValueError('p should not be less than 2!' ) elif p == 2: return True _lowerCamelCase = 4 _lowerCamelCase = (1 <...
650
1
"""simple docstring""" import numpy as np import datasets A_ : List[str] =""" Compute the Mahalanobis Distance Mahalonobis distance is the distance between a point and a distribution. And not between two distinct points. It is effectively a multivariate equivalent of the Euclidean distance. It was ...
650
"""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/licenses/LICENSE-2.0 #...
650
1
"""simple docstring""" # Author: OMKAR PATHAK, Nwachukwu Chidiebere # Use a Python dictionary to construct the graph. from __future__ import annotations from pprint import pformat from typing import Generic, TypeVar A_ : str =TypeVar("""T""") class __a ( Generic[T] ): d...
650
"""simple docstring""" import json import os import re import shutil import tempfile import unittest from typing import Tuple from transformers import AddedToken, BatchEncoding, ByTaTokenizer from transformers.utils import cached_property, is_tf_available, is_torch_available from ...test_tokenization_common i...
650
1
"""simple docstring""" def SCREAMING_SNAKE_CASE_ ( snake_case : List[Any] )-> Optional[int]: _lowerCamelCase = [] _lowerCamelCase = [] _lowerCamelCase = { '^': 3, '*': 2, '/': 2, '%': 2, ...
650
"""simple docstring""" import numpy as np import skfuzzy as fuzz if __name__ == "__main__": # Create universe of discourse in Python using linspace () A_ : int =np.linspace(start=0, stop=7_5, num=7_5, endpoint=True, retstep=False) # Create two fuzzy sets by defining any membership f...
650
1
"""simple docstring""" import argparse import re from pathlib import Path import requests import torch from PIL import Image from torchvision.transforms import CenterCrop, Compose, Normalize, Resize, ToTensor from transformers import ( EfficientFormerConfig, EfficientFormerForImageClassificationWithTe...
650
"""simple docstring""" import argparse import json import os from pathlib import Path import requests import torch from transformers import JukeboxConfig, JukeboxModel from transformers.utils import logging logging.set_verbosity_info() A_ : str =logging.get_logger(__name__) A_ : Any ="""...
650
1
"""simple docstring""" import unittest from transformers import is_torch_available from transformers.testing_utils import require_torch if is_torch_available(): import torch from transformers.activations import gelu_new, gelu_python, get_activation @require_torch class __a ( uni...
650
"""simple docstring""" import argparse import torch from transformers import ( WavaVecaConfig, WavaVecaFeatureExtractor, WavaVecaForAudioFrameClassification, WavaVecaForSequenceClassification, WavaVecaForXVector, logging, ) logging.set_verbosity_info() A_ : int =logging.get_...
650
1
"""simple docstring""" import inspect from typing import Callable, List, Optional, Union import torch from transformers import ( CLIPImageProcessor, CLIPTextModel, CLIPTokenizer, WhisperForConditionalGeneration, WhisperProcessor, ) from diffusers import ( AutoencoderKL, DDIMSchedul...
650
"""simple docstring""" from ...configuration_utils import PretrainedConfig from ...utils import logging A_ : List[str] =logging.get_logger(__name__) A_ : List[str] ={ """microsoft/biogpt""": """https://huggingface.co/microsoft/biogpt/resolve/main/config.json""", # See all BioGPT mod...
650
1
"""simple docstring""" from __future__ import annotations import time import numpy as np A_ : int =[8, 5, 9, 7] A_ : str =[ [2, 0, 1, 1], [0, 1, 2, 1], [4, 0, 0, 3], [0, 2, 1, 0], [1, 0, 3, 0], ] A_ : List[str] =[ [3, 2, 1, 4], [0, 2, 5, 2], [5, 1, 0...
650
"""simple docstring""" def SCREAMING_SNAKE_CASE_ ( )-> Union[str, Any]: _lowerCamelCase = [31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31] _lowerCamelCase = 6 _lowerCamelCase = 1 _lowerCamelCase = 1_901 _lowerCa...
650
1