code stringlengths 82 54.1k | code_codestyle int64 0 699 | style_context stringlengths 111 35.6k | style_context_codestyle int64 0 699 | label int64 0 1 |
|---|---|---|---|---|
import 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, slow, ... | 80 |
"""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 | 0 |
import copy
import os
from typing import TYPE_CHECKING, List, Union
if TYPE_CHECKING:
pass
from ...configuration_utils import PretrainedConfig
from ...utils import logging
_snake_case : str = logging.get_logger(__name__)
_snake_case : Tuple = {
"kakaobrain/align-bas... | 81 |
"""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 | 0 |
"""simple docstring"""
def a__ ( lowerCAmelCase__ ):
assert (
isinstance(lowerCAmelCase__ , lowerCAmelCase__ ) and number_of_steps > 0
), f"""number_of_steps needs to be positive integer, your input {number_of_steps}"""
if number_of_steps == 1:
... | 82 |
"""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 | 0 |
"""simple docstring"""
import os
import time
import warnings
from dataclasses import dataclass, field
from enum import Enum
from typing import List, Optional, Union
import torch
from filelock import FileLock
from torch.utils.data import Dataset
from ...tokenization_utils_base import PreTrainedTokenizerBase
... | 83 |
"""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 | 0 |
import os
import numpy
import onnx
def UpperCAmelCase_ ( __SCREAMING_SNAKE_CASE , __SCREAMING_SNAKE_CASE ):
lowercase = a.name
lowercase = b.name
lowercase = ''
lowercase = ''
lowercase = a == b
lowercase = name_a
lowerc... | 84 |
"""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 | 0 |
from typing import Any, Dict, List, Union
from ..utils import add_end_docstrings, is_torch_available, is_vision_available, logging, requires_backends
from .base import PIPELINE_INIT_ARGS, ChunkPipeline
if is_vision_available():
from PIL import Image
from ..image_utils import load_image
if is_torch_avai... | 85 |
"""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 | 0 |
from typing import List
import numpy as np
def __snake_case ( __UpperCamelCase : dict ):
"""simple docstring"""
A_ = {key: len(__UpperCamelCase ) for key, value in gen_kwargs.items() if isinstance(__UpperCamelCase ,__UpperCamelCase )}
if len(set(li... | 86 |
"""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 | 0 |
class UpperCamelCase_ :
'''simple docstring'''
def __init__( self : Dict , UpperCAmelCase__ : Dict , UpperCAmelCase__ : Optional[Any] , UpperCAmelCase__ : Union[str, Any]) ->str:
'''simple docstring'''
A__ = ... | 87 |
"""simple docstring"""
import argparse
import torch
from transformers import (
WavaVecaConfig,
WavaVecaFeatureExtractor,
WavaVecaForAudioFrameClassification,
WavaVecaForSequenceClassification,
WavaVecaForXVector,
logging,
)
logging.set_verbosity_info()
A_ : int =logging.get_... | 650 | 0 |
"""simple docstring"""
import os
from dataclasses import dataclass, field
from io import BytesIO
from typing import TYPE_CHECKING, Any, ClassVar, Dict, Optional, Union
import numpy as np
import pyarrow as pa
from .. import config
from ..download.streaming_download_manager import xopen, xsplitext
from... | 88 |
"""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 | 0 |
import copy
from ...configuration_utils import PretrainedConfig
from ...utils import logging
from ..auto import CONFIG_MAPPING
SCREAMING_SNAKE_CASE : Any = logging.get_logger(__name__)
SCREAMING_SNAKE_CASE : Union[str, Any] = {
"SenseTime/deformable-detr": "https://huggingface.co/sens... | 89 |
"""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 | 0 |
'''simple docstring'''
def _snake_case ( A = 50 ) -> int:
lowerCAmelCase__ = [1] * (length + 1)
for row_length in range(3 , length + 1 ):
for block_length in range(3 , row_length + 1 ):
for block_star... | 90 |
"""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 | 0 |
"""simple docstring"""
from typing import Callable, Optional
from .. import Features
from ..packaged_modules.generator.generator import Generator
from .abc import AbstractDatasetInputStream
class lowerCAmelCase_ ( _lowercase ):
'''simple docstring'''
def __init__( self : ... | 91 |
"""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 | 0 |
'''simple docstring'''
import tempfile
import unittest
from transformers import TaConfig, is_torch_available
from transformers.testing_utils import (
require_sentencepiece,
require_tokenizers,
require_torch,
slow,
torch_device,
)
from ...generation.test_utils import GenerationTesterMixin
fr... | 92 |
"""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 | 0 |
"""simple docstring"""
import json
from typing import List, Optional, Tuple
from tokenizers import pre_tokenizers, processors
from ...tokenization_utils_base import AddedToken, BatchEncoding
from ...tokenization_utils_fast import PreTrainedTokenizerFast
from ...utils import logging
from .tokenization_rober... | 93 |
"""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 | 0 |
'''simple docstring'''
def lowercase_ ( __A : list ) -> list:
"""simple docstring"""
for i in range(len(__A ) - 1 , 0 , -1 ):
lowercase : List[str] =False
for j in range(__A , 0 , -1 ):
if unsorted[j] <... | 94 |
"""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 | 0 |
"""simple docstring"""
import os
import pytest
import yaml
from datasets.features.features import Features, Value
from datasets.info import DatasetInfo, DatasetInfosDict
@pytest.mark.parametrize(
"files" ,[
["full:README.md", "dataset_infos.json"],
["empty:README.md", "dataset_infos.j... | 95 |
"""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 | 0 |
"""simple docstring"""
import unittest
from transformers import EsmConfig, is_torch_available
from transformers.testing_utils import TestCasePlus, require_torch, slow, torch_device
from ...test_configuration_common import ConfigTester
from ...test_modeling_common import ModelTesterMixin... | 96 |
"""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 | 0 |
from typing import TYPE_CHECKING
from ...utils import (
OptionalDependencyNotAvailable,
_LazyModule,
is_tf_available,
is_torch_available,
is_vision_available,
)
__a = {
'configuration_blip': [
'BLIP_PRETRAINED_CONFIG_ARCHIVE_MAP',
'BlipConfig',
... | 97 |
"""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 | 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_sequence_feature_extraction_... | 98 |
"""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 | 0 |
def a (lowerCAmelCase__ = 4_000_000 ):
__a = []
__a , __a = 0, 1
while b <= n:
if b % 2 == 0:
even_fibs.append(lowerCAmelCase__ )
__a , __a = b, a + b
return sum(lowerCAmelCase__ )
if __name__ == "__main__":
print(f'''{solution() = }'''... | 99 |
"""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 | 0 |
from ... import PretrainedConfig
_A : Any = {
"""sijunhe/nezha-cn-base""": """https://huggingface.co/sijunhe/nezha-cn-base/resolve/main/config.json""",
}
class __snake_case ( __SCREAMING_SNAKE_CASE ):
'''simple docstring'''
lowerCamelCase__ : str = NEZHA_PRETR... | 100 |
"""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 | 0 |
from __future__ import annotations
lowerCAmelCase__ : Union[str, Any] =[
[-1, 0], # left
[0, -1], # down
[1, 0], # right
[0, 1], # up
]
def a__ ( A__, A__, A__, A__, A__, ):
SCREAMING_SNAKE_CASE_ : List[Any] = ... | 101 |
"""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 | 0 |
"""simple docstring"""
import unittest
from transformers import MPNetConfig, is_torch_available
from transformers.testing_utils import require_torch, slow, torch_device
from ...test_configuration_common import ConfigTester
from ...test_modeling_common import ModelTesterMixin, ids_tensor, random... | 102 |
"""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 | 0 |
"""simple docstring"""
from collections.abc import Callable
import numpy as np
def snake_case ( lowerCAmelCase_ , lowerCAmelCase_ , lowerCAmelCase_ , lowerCAmelCase_ , lowerCAmelCase_ ) -> np.array:
_snake_case = int(np.ceil((x_end - xa) /... | 103 |
"""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 | 0 |
"""simple docstring"""
import argparse
import glob
import logging
import os
import time
from argparse import Namespace
import numpy as np
import torch
from lightning_base import BaseTransformer, add_generic_args, generic_train
from torch.utils.data import DataLoader, TensorDataset
f... | 104 |
"""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 | 0 |
import argparse
import math
import os
import torch
from neural_compressor.utils.pytorch import load
from PIL import Image
from transformers import CLIPTextModel, CLIPTokenizer
from diffusers import AutoencoderKL, StableDiffusionPipeline, UNetaDConditionModel
def __UpperCAmelCase ( ) ... | 105 |
"""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 | 0 |
import json
import os
from functools import lru_cache
from typing import List, Optional, Tuple
import regex as re
from ...tokenization_utils import AddedToken, PreTrainedTokenizer
from ...utils import logging
__snake_case :Tuple =logging.get_logger(__name__)
__snake_case :Dict ={'voc... | 106 |
"""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 | 0 |
'''simple docstring'''
def _SCREAMING_SNAKE_CASE ( __snake_case : List[Any] , __snake_case : List[str] ):
print('\nThe shortest path matrix using Floyd Warshall algorithm\n' )
for i in range(__snake_case ):
for j in range(__snake_case ):
if ... | 107 |
"""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 | 0 |
from __future__ import annotations
import unittest
from transformers import RoFormerConfig, is_tf_available
from transformers.testing_utils import require_tf, slow
from ...test_configuration_common import ConfigTester
from ...test_modeling_tf_common import TFModelTesterMixin, ids_tensor, random_attention_mask... | 108 |
"""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 | 0 |
'''simple docstring'''
import unittest
from pathlib import Path
from tempfile import TemporaryDirectory
from transformers import AutoConfig, TFAutoModel, is_tensorflow_text_available, is_tf_available
from transformers.models.bert.tokenization_bert import BertTokenizer
from transformers.testing_utils import requ... | 109 |
"""simple docstring"""
import argparse
import torch
from transformers import (
WavaVecaConfig,
WavaVecaFeatureExtractor,
WavaVecaForAudioFrameClassification,
WavaVecaForSequenceClassification,
WavaVecaForXVector,
logging,
)
logging.set_verbosity_info()
A_ : int =logging.get_... | 650 | 0 |
'''simple docstring'''
from sklearn.metrics import recall_score
import datasets
__lowerCamelCase = """
Recall is the fraction of the positive examples that were correctly labeled by the model as positive. It can be computed with the equation:
Recall = TP / (TP + FN)
Where TP is the true posit... | 467 |
"""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 | 0 |
"""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,
DDIMScheduler,... | 353 |
"""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 | 0 |
import os
import tempfile
import unittest
from pathlib import Path
from transformers import AutoConfig, is_tf_available
from transformers.testing_utils import require_tf
if is_tf_available():
import tensorflow as tf
from transformers import TensorFlowBenchmark, TensorFlowBenchmarkArguments
@require_tf
cl... | 175 |
"""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 | 0 |
from typing import TYPE_CHECKING
from ...utils import OptionalDependencyNotAvailable, _LazyModule, is_tokenizers_available, is_torch_available
_lowerCamelCase : Optional[Any] = {
"""configuration_m2m_100""": ["""M2M_100_PRETRAINED_CONFIG_ARCHIVE_MAP""", """M2M100Config""", """M2M10... | 121 |
"""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 | 0 |
'''simple docstring'''
import os
from pickle import UnpicklingError
from typing import Dict, Tuple
import jax
import jax.numpy as jnp
import numpy as np
from flax.serialization import from_bytes
from flax.traverse_util import flatten_dict, unflatten_dict
import transformers
from .utils import logging
l... | 525 |
"""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 | 0 |
import copy
from ...configuration_utils import PretrainedConfig
from ...utils import logging
from ..bit import BitConfig
__lowerCamelCase : int = logging.get_logger(__name__)
__lowerCamelCase : Optional[Any] = {
"""Intel/dpt-large""": """https://huggingface.co/Intel/dpt-large/resolve/main... | 297 |
"""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 | 0 |
'''simple docstring'''
def _UpperCamelCase ( SCREAMING_SNAKE_CASE__ : int , SCREAMING_SNAKE_CASE__ : int ):
'''simple docstring'''
return base * power(SCREAMING_SNAKE_CASE__ , (exponent - 1) ) if exponent else 1
if __name__ == "__main__":
print('R... | 603 |
"""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 | 0 |
def _lowerCamelCase ( __lowerCamelCase ) -> list:
'''simple docstring'''
return [
txt[:a] + txt[a].upper() + txt[a + 1 :]
for a in range(len(__lowerCamelCase ) )
if txt[a].isalpha()
]
if __name__ == "__main__":
__... | 79 |
"""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 | 0 |
import unittest
import numpy as np
from transformers.testing_utils import require_torch, require_vision
from transformers.utils import is_torch_available, is_vision_available
from ...test_image_processing_common import ImageProcessingSavingTestMixin, prepare_image_inputs
if is_torch_available():
import to... | 108 |
"""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 | 0 |
'''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.TestCas... | 653 |
"""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 | 0 |
"""simple docstring"""
import gc
import importlib.metadata
import tempfile
import unittest
from packaging import version
from transformers import (
AutoModel,
AutoModelForCausalLM,
AutoModelForSeqaSeqLM,
AutoModelForSequenceClassification,
AutoTokenizer,
BitsAndBytesConfig,... | 564 |
"""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 | 0 |
'''simple docstring'''
import os
from itertools import chain
from random import randrange, shuffle
import pytest
from .sola import PokerHand
__lowerCamelCase = (
"""4S 3H 2C 7S 5H""",
"""9D 8H 2C 6S 7H""",
"""2D 6D 9D TH 7D""",
"""TC 8C 2S JH 6C""",
"""JH 8S TH AH QH""",
... | 467 |
"""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 | 0 |
"""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 __magic_name__ ( lowerCAmel... | 353 |
"""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 | 0 |
from multiprocessing import Lock, Pipe, Process
# lock used to ensure that two processes do not access a pipe at the same time
a_ = Lock()
def a__ ( _UpperCamelCase : List[str] ,_UpperCamelCase : int ,_UpperCamelCase : str ,_UpperCamelCase : int ,_Upper... | 175 |
"""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 | 0 |
from string import ascii_uppercase
_lowerCamelCase : str = {char: i for i, char in enumerate(ascii_uppercase)}
_lowerCamelCase : List[str] = dict(enumerate(ascii_uppercase))
def _lowerCAmelCase ( __magic_name__ :str , __magic_name__ :str )... | 121 |
"""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 | 0 |
'''simple docstring'''
from __future__ import annotations
import sys
from collections import deque
from typing import Generic, TypeVar
lowerCAmelCase = TypeVar("""T""")
class lowerCamelCase ( Generic[T] ):
snake_case_ = 42 # Cache store of keys
snake_case_ = 42 # References of ... | 525 |
"""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 | 0 |
import copy
import json
import os
import tempfile
from transformers import is_torch_available
from .test_configuration_utils import config_common_kwargs
class SCREAMING_SNAKE_CASE__ ( lowerCAmelCase__ ):
"""simple docstring"""
def __init__( self : List[Any] , __... | 297 |
"""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 | 0 |
'''simple docstring'''
import argparse
from typing import Dict
import tensorflow as tf
import torch
from tqdm import tqdm
from transformers import BigBirdPegasusConfig, BigBirdPegasusForConditionalGeneration
UpperCAmelCase_ = [
# tf -> hf
("""/""", """."""),
("""layer_""", """layer... | 603 |
"""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 | 0 |
from typing import Any
import numpy as np
def _lowerCamelCase ( __lowerCamelCase ) -> bool:
'''simple docstring'''
return np.array_equal(__lowerCamelCase , matrix.conjugate().T )
def _lowerCamelCase ( __lowerCamelCase , ... | 79 |
"""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 | 0 |
__a: Any = """
# Installazione di Transformers
! pip install transformers datasets
# Per installare dalla fonte invece dell'ultima versione rilasciata, commenta il comando sopra e
# rimuovi la modalità commento al comando seguente.
# ! pip install git+https://github.com/huggingface/transformers.gi... | 108 |
"""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 | 0 |
'''simple docstring'''
import unittest
from transformers import DonutProcessor
__lowerCamelCase : Union[str, Any] = """naver-clova-ix/donut-base"""
class A_ (unittest.TestCase ):
"""simple docstring"""
def _A ( self... | 653 |
"""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 | 0 |
"""simple docstring"""
import copy
import os
from typing import Union
from ...configuration_utils import PretrainedConfig
from ...utils import logging
__lowercase : Tuple = logging.get_logger(__name__)
__lowercase : int = {
"""Salesforce/blip-vqa-base""": """https://hug... | 564 |
"""simple docstring"""
import argparse
import torch
from transformers import (
WavaVecaConfig,
WavaVecaFeatureExtractor,
WavaVecaForAudioFrameClassification,
WavaVecaForSequenceClassification,
WavaVecaForXVector,
logging,
)
logging.set_verbosity_info()
A_ : int =logging.get_... | 650 | 0 |
'''simple docstring'''
def a__ ( UpperCamelCase_ : int ):
if divisor % 5 == 0 or divisor % 2 == 0:
return 0
UpperCAmelCase__ :Tuple = 1
UpperCAmelCase__ :Union[str, Any] = 1
while repunit:
UpperCAmelCase__ :str = (10 * repunit +... | 467 |
"""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 | 0 |
"""simple docstring"""
import copy
import random
from transformers import CLIPTokenizer
class __magic_name__ ( lowerCAmelCase__ ):
def __init__( self , *A_ , **A_ ) -> int:
"""simple docstring"""
super().__init__(*a__ , **a__ ... | 353 |
"""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 | 0 |
from __future__ import annotations
import csv
import requests
from bsa import BeautifulSoup
def a__ ( _UpperCamelCase : str = "" ):
__lowerCamelCase = url or '''https://www.imdb.com/chart/top/?ref_=nv_mv_250'''
__lowerCamelCase = BeautifulSoup(requests.get(_Upper... | 175 |
"""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 | 0 |
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.
_lowerCamelCase : str = 10
def _lowerCAmelCase ( __magic_name__ :int , __magic... | 121 |
"""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 | 0 |
'''simple docstring'''
from ...configuration_utils import PretrainedConfig
from ...utils import logging
lowerCAmelCase = logging.get_logger(__name__)
lowerCAmelCase = {
"""RWKV/rwkv-4-169m-pile""": """https://huggingface.co/RWKV/rwkv-4-169m-pile/resolve/main/config.json""",
""... | 525 |
"""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 | 0 |
__lowerCamelCase : Dict = """ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/"""
def SCREAMING_SNAKE_CASE ( snake_case_ : bytes ):
# Make sure the supplied data is a bytes-like object
if not isinstance(snake_case_ , snake_case_ ):
snake_case__ : int = ... | 297 |
"""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 | 0 |
'''simple docstring'''
from typing import TYPE_CHECKING
from ...utils import OptionalDependencyNotAvailable, _LazyModule, is_tensorflow_text_available, is_torch_available
UpperCAmelCase_ = {
"""configuration_ernie""": ["""ERNIE_PRETRAINED_CONFIG_ARCHIVE_MAP""", """ErnieConfig""", """ErnieOn... | 603 |
"""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 | 0 |
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."""
)
| 79 |
"""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 | 0 |
import argparse
import json
from collections import OrderedDict
from functools import partial
from pathlib import Path
import timm
import torch
from huggingface_hub import hf_hub_download
from transformers import LevitConfig, LevitForImageClassificationWithTeacher, LevitImageProcessor
from transformers.utils i... | 108 |
"""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 | 0 |
'''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()
__lowerCamelCas... | 653 |
"""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 | 0 |
"""simple docstring"""
import math
import unittest
def SCREAMING_SNAKE_CASE ( snake_case):
assert isinstance(snake_case, snake_case) and (
number >= 0
), "'number' must been an int and positive"
if 1 < number < 4:
# 2 and 3 are primes
retu... | 564 |
"""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 | 0 |
'''simple docstring'''
import os
import unittest
from huggingface_hub.utils import are_progress_bars_disabled
import transformers.models.bart.tokenization_bart
from transformers import logging
from transformers.testing_utils import CaptureLogger, mockenv, mockenv_context
from transformers.utils.logging import... | 467 |
"""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 | 0 |
"""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,
... | 353 |
"""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 | 0 |
def a__ ( _UpperCamelCase : int ):
if length <= 0 or not isinstance(_UpperCamelCase ,_UpperCamelCase ):
raise ValueError('''Length must be a positive integer.''' )
return [n * (2 * n - 1) for n in range(_UpperCamelCase )]
if __name__ == "__main__":
print(hexagonal_numbe... | 175 |
"""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 | 0 |
from collections.abc import Iterable
from typing import Generic, TypeVar
_lowerCamelCase : Union[str, Any] = TypeVar('_T')
class snake_case__ ( Generic[_T] ):
'''simple docstring'''
def __init__( self : Tuple , lowerC... | 121 |
"""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 | 0 |
'''simple docstring'''
import itertools
import os
import random
import tempfile
import unittest
import numpy as np
from datasets import load_dataset
from transformers import is_speech_available
from transformers.testing_utils import check_json_file_has_correct_format, require_torch, require_torchaudio
fro... | 525 |
"""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 | 0 |
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 SCREAMING_SNAKE_CASE__ ( lowerCAmelC... | 297 |
"""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 | 0 |
'''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
f... | 603 |
"""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 | 0 |
from typing import TYPE_CHECKING
# rely on isort to merge the imports
from ...utils import OptionalDependencyNotAvailable, _LazyModule, is_torch_available
SCREAMING_SNAKE_CASE__ : Dict = {"""configuration_focalnet""": ["""FOCALNET_PRETRAINED_CONFIG_ARCHIVE_MAP""", """FocalNetConfig"... | 79 |
"""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 | 0 |
import sys
from collections.abc import Mapping
from typing import TYPE_CHECKING, Dict, Optional
import numpy as np
import pyarrow as pa
from .. import config
from ..utils.logging import get_logger
from ..utils.py_utils import map_nested
from .formatting import TensorFormatter
if TYPE_CHECKING:
import jax
... | 108 |
"""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 | 0 |
'''simple docstring'''
import unittest
import numpy as np
from transformers.testing_utils import require_flax, require_tf, require_torch
from transformers.utils import (
expand_dims,
flatten_dict,
is_flax_available,
is_tf_available,
is_torch_available,
reshape... | 653 |
"""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 | 0 |
"""simple docstring"""
class _A :
"""simple docstring"""
def __init__( self : List[str] , A_ : List[Any] ) -> Tuple:
__snake_case = set_counts
__snake_case = max(a__ )
__snake_case = len(a__ )
... | 564 |
"""simple docstring"""
import argparse
import torch
from transformers import (
WavaVecaConfig,
WavaVecaFeatureExtractor,
WavaVecaForAudioFrameClassification,
WavaVecaForSequenceClassification,
WavaVecaForXVector,
logging,
)
logging.set_verbosity_info()
A_ : int =logging.get_... | 650 | 0 |
'''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... | 467 |
"""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 | 0 |
"""simple docstring"""
from __future__ import annotations
def _lowerCAmelCase ( _UpperCamelCase ):
"""simple docstring"""
_lowercase: str = 2
_lowercase: Union[str, Any] = []
while i * i <= n:
if n % i:
i += 1
else:
n //= i
factors.append... | 353 |
"""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 | 0 |
from tempfile import TemporaryDirectory
from unittest import TestCase
from unittest.mock import MagicMock, patch
from transformers import AutoModel, TFAutoModel
from transformers.onnx import FeaturesManager
from transformers.testing_utils import SMALL_MODEL_IDENTIFIER, require_tf, require_torch
@require_torch
@... | 175 |
"""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 | 0 |
from typing import TYPE_CHECKING
from ...utils import OptionalDependencyNotAvailable, _LazyModule, is_torch_available
_lowerCamelCase : List[Any] = {
"""configuration_upernet""": ["""UperNetConfig"""],
}
try:
if not is_torch_available():
raise OptionalDependenc... | 121 |
"""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 | 0 |
'''simple docstring'''
from math import isqrt
def __A ( a_ : int ):
return all(number % divisor != 0 for divisor in range(2 ,isqrt(a_ ) + 1 ) )
def __A ( a_ : int = 1_0**6 ):
lowerCAmelCase : List[Any] = 0
lowerCAmelCase : ... | 525 |
"""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 | 0 |
from __future__ import annotations
import time
from math import sqrt
# 1 for manhattan, 0 for euclidean
__lowerCamelCase : Any = 0
__lowerCamelCase : Optional[Any] = [
[0, 0, 0, 0, 0, 0, 0],
[0, 1, 0, 0, 0, 0, 0], # 0 are free path whereas 1's are obstacles
[0, 0, 0, 0, 0, 0, 0],
... | 297 |
"""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 | 0 |
'''simple docstring'''
from dataclasses import dataclass, field
from typing import Tuple
from ..utils import cached_property, is_torch_available, is_torch_tpu_available, logging, requires_backends
from .benchmark_args_utils import BenchmarkArguments
if is_torch_available():
import torch
if is_torch_tpu... | 603 |
"""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 | 0 |
import re
from typing import Callable, List, Optional, Union
import tensorflow as tf
try:
from tensorflow.keras.optimizers.legacy import Adam
except ImportError:
from tensorflow.keras.optimizers import Adam
class UpperCAmelCase_ ( tf.keras.optimizers.schedules.... | 79 |
"""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 | 0 |
from collections import OrderedDict
from typing import Any, Mapping, Optional, Union
from ...configuration_utils import PretrainedConfig
from ...feature_extraction_utils import FeatureExtractionMixin
from ...onnx import OnnxConfig
from ...onnx.utils import compute_effective_axis_dimension
from ...tokenization_u... | 108 |
"""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 | 0 |
'''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 ...util... | 653 |
"""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 | 0 |
"""simple docstring"""
import gc
import math
import unittest
import torch
from diffusers import UNetaDModel
from diffusers.utils import floats_tensor, logging, slow, torch_all_close, torch_device
from diffusers.utils.testing_utils import enable_full_determinism
from .test_modeling_common import Mode... | 564 |
"""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 | 0 |
'''simple docstring'''
import secrets
from random import shuffle
from string import ascii_letters, ascii_lowercase, ascii_uppercase, digits, punctuation
def a__ ( UpperCamelCase_ : int = 8 ):
UpperCAmelCase__ :str = ascii_letters + digits + punctuation
return "".j... | 467 |
"""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 | 0 |
"""simple docstring"""
def _lowerCAmelCase ( _UpperCamelCase ):
"""simple docstring"""
if edge <= 0 or not isinstance(_UpperCamelCase , _UpperCamelCase ):
raise ValueError('''Length must be a positive.''' )
return 3 * ((25 + 10 * (5 ** (1 / 2))) ** (1 / 2)) * (edge**2)
de... | 353 |
"""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 | 0 |
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,
)
from transformers.utils imp... | 175 |
"""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 | 0 |
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
_lowerCamelCase : List[str] = {
"""facebook/maskformer-s... | 121 |
"""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 | 0 |
'''simple docstring'''
def __A ( a_ : str ,a_ : str ):
lowerCAmelCase : Optional[int] = len(a_ ) + 1
lowerCAmelCase : int = len(a_ ) + 1
# dp is a 2d matrix where dp[i][j] denotes whether prefix string of
# length i of input_string ma... | 525 |
"""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 | 0 |
import gc
import random
import tempfile
import unittest
import numpy as np
import torch
from PIL import Image
from transformers import CLIPTextConfig, CLIPTextModel, CLIPTokenizer
from diffusers import (
AutoencoderKL,
DDIMInverseScheduler,
DDIMScheduler,
DPMSolverMultistepInverseScheduler,
... | 297 |
"""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 | 0 |
'''simple docstring'''
from math import sqrt
def _UpperCamelCase ( SCREAMING_SNAKE_CASE__ : int ):
'''simple docstring'''
assert isinstance(SCREAMING_SNAKE_CASE__ , SCREAMING_SNAKE_CASE__ ) and (
number >= 0
), "'number' must been an int and positive"
UpperCAm... | 603 |
"""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 | 0 |
def _lowerCamelCase ( __lowerCamelCase ) -> str:
'''simple docstring'''
return " ".join(input_str.split()[::-1] )
if __name__ == "__main__":
import doctest
doctest.testmod()
| 79 |
"""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 | 0 |
import time
import warnings
from abc import ABC
from copy import deepcopy
from typing import Optional
import torch
from ..utils import add_start_docstrings, logging
__a: str = logging.get_logger(__name__)
__a: Union[str, Any] = R"""
Args:
input_ids (`torch.LongTens... | 108 |
"""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 | 0 |
'''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, ... | 653 |
"""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 | 0 |
"""simple docstring"""
from typing import Dict, List
from nltk.translate import gleu_score
import datasets
from datasets import MetricInfo
__lowercase : str = """\
@misc{wu2016googles,
title={Google's Neural Machine Translation System: Bridging the Gap between Human and Machine Tran... | 564 |
"""simple docstring"""
import argparse
import torch
from transformers import (
WavaVecaConfig,
WavaVecaFeatureExtractor,
WavaVecaForAudioFrameClassification,
WavaVecaForSequenceClassification,
WavaVecaForXVector,
logging,
)
logging.set_verbosity_info()
A_ : int =logging.get_... | 650 | 0 |
'''simple docstring'''
import numpy as np
def a__ ( UpperCamelCase_ : np.array ):
return (2 / (1 + np.exp(-2 * vector ))) - 1
if __name__ == "__main__":
import doctest
doctest.testmod()
| 467 |
"""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 | 0 |
"""simple docstring"""
import argparse
import os
import re
A__ : Optional[int] = """src/diffusers"""
# Pattern that looks at the indentation in a line.
A__ : Optional[Any] = re.compile(r'^(\s*)\S')
# Pattern that matches `"key":" and puts `key` in group 0.
A__ : Tuple = re.compile(r'^... | 353 |
"""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 | 0 |
import os
from shutil import copyfile
from typing import Any, Dict, List, Optional, Tuple
import sentencepiece as spm
from ...tokenization_utils import AddedToken, BatchEncoding, PreTrainedTokenizer
from ...utils import logging
a_ = logging.get_logger(__name__)
a_ = """▁"""
a_ ... | 175 |
"""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 | 0 |
import doctest
from collections import deque
import numpy as np
class snake_case__ :
'''simple docstring'''
def __init__( self : Any ) -> Any:
UpperCAmelCase_ = [2, 1, 2, -1]
UpperCAmelCase_ = [1, 2, 3, 4... | 121 |
"""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 | 0 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.