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 |
|---|---|---|---|---|
from __future__ import annotations
import collections
import tempfile
import unittest
import numpy as np
from transformers.testing_utils import require_tf, require_vision, slow
from transformers.utils import is_tf_available, is_vision_available
from ...test_modeling_tf_common import floats_te... | 598 |
"""simple docstring"""
import warnings
from typing import List, Optional, Union
from ...image_utils import ImageInput
from ...processing_utils import ProcessorMixin
from ...tokenization_utils_base import BatchEncoding, PaddingStrategy, PreTokenizedInput, TextInput, TruncationStrategy
from ...utils import Tenso... | 610 | 0 |
from __future__ import annotations
import pandas as pd
def _SCREAMING_SNAKE_CASE ( lowerCAmelCase__ ,lowerCAmelCase__ ,lowerCAmelCase__ ):
lowerCamelCase_ : Dict = [0] * no_of_processes
lowerCamelCase_ : List[str] = [0] * no_of_processes
... | 364 |
"""simple docstring"""
import unittest
import numpy as np
import torch
from .utils_summarization import build_mask, compute_token_type_ids, process_story, truncate_or_pad
class __lowerCamelCase ( unittest.TestCase ):
'''simple docstring'''
def lowerCamelCase ( self ... | 610 | 0 |
import json
from typing import List, Optional, Tuple
from tokenizers import normalizers
from ...tokenization_utils_fast import PreTrainedTokenizerFast
from ...utils import logging
from .tokenization_funnel import FunnelTokenizer
UpperCAmelCase__ = logging.get_logger(__name__)
UpperCAmelCase__ ... | 351 |
"""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 OptionalDependencyN... | 610 | 0 |
import heapq as hq
import math
from collections.abc import Iterator
class __A :
def __init__( self : Union[str, Any] , UpperCAmelCase_ : List[Any] ):
lowerCAmelCase : Optional[Any] = str(id_ )
lowerCAmelCase : Li... | 343 |
"""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 __lowerCamelCase ... | 610 | 0 |
'''simple docstring'''
import argparse
import json
import gdown
import numpy as np
import torch
from huggingface_hub import hf_hub_download
from transformers import (
VideoMAEConfig,
VideoMAEForPreTraining,
VideoMAEForVideoClassification,
VideoMAEImageProcessor,
)
def UpperCamelCase_ ( ... | 244 |
"""simple docstring"""
# Lint as: python3
import itertools
import os
import re
lowercase__ = re.compile(r"""([A-Z]+)([A-Z][a-z])""")
lowercase__ = re.compile(r"""([a-z\d])([A-Z])""")
lowercase__ = re.compile(r"""(?<!_)_(?!_)""")
lowercase__ = re.compile(r"""(_{2,})""")
lowerc... | 610 | 0 |
'''simple docstring'''
from __future__ import annotations
def lowercase_ ( _lowercase , _lowercase ) -> list[str]:
'''simple docstring'''
if nth_term == "":
return [""]
lowerCamelCase_ : str = int(__UpperCamelCase )
lowerCamelCase_ : Op... | 422 |
"""simple docstring"""
import torch
from torch import nn
from ...configuration_utils import ConfigMixin, register_to_config
from ...models import ModelMixin
class __lowerCamelCase ( A__ , A__ ):
'''simple docstring'''
@register_to_config
def __init__( self : ... | 610 | 0 |
import sys
def UpperCamelCase_( snake_case__: Dict ) -> Union[str, Any]:
UpperCAmelCase__ = len(__UpperCamelCase )
UpperCAmelCase__ = [[0 for x in range(__UpperCamelCase )] for x in range(__UpperCamelCase )]
UpperCAmelCase__ = [[0 for x in... | 146 |
"""simple docstring"""
def __lowerCamelCase ( __UpperCamelCase ) -> str:
"""simple docstring"""
return "".join([hex(__UpperCamelCase )[2:].zfill(2 ).upper() for byte in list(__UpperCamelCase )] )
def __lowerCamelCase ( __UpperCamelCase ) -> byte... | 610 | 0 |
import json
import os
import re
import sys
import urllib.request
import requests
from bsa import BeautifulSoup
UpperCamelCase_ = {
"User-Agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36"
" (KHTML, like Gecko) Chrome/70.0.3538.102 Safari/537.36 Edge/18.19582"
}
def _Upp... | 611 |
"""simple docstring"""
import torch
from torch import nn
from torch.nn import CrossEntropyLoss, MSELoss
from transformers.file_utils import add_start_docstrings, add_start_docstrings_to_model_forward
from transformers.models.bert.modeling_bert import (
BERT_INPUTS_DOCSTRING,
BERT_START_DOCSTRING,
B... | 610 | 0 |
'''simple docstring'''
from __future__ import annotations
def a ( lowerCamelCase__ ):
'''simple docstring'''
A_ : Any = [True] * limit
A_ : Optional[Any] = False
A_ : Any = False
A_ : Optional[Any] = True
for i in range(3... | 667 |
"""simple docstring"""
from __future__ import annotations
import json
import requests
from bsa import BeautifulSoup
from fake_useragent import UserAgent
lowercase__ = {"""UserAgent""": UserAgent().random}
def __lowerCamelCase ( __UpperCamelCase ) -> dict:
"""simple docstrin... | 610 | 0 |
'''simple docstring'''
import argparse
import json
import os
from collections import OrderedDict
import numpy as np
import tensorflow as tf
import torch
def UpperCamelCase_( snake_case : Any ):
'''simple docstring'''
snake_case_ = os.path.join(args.tf_model_dir , ... | 400 |
"""simple docstring"""
import json
import os
import unittest
from transformers import AutoTokenizer, GPTaTokenizer, GPTaTokenizerFast
from transformers.models.gpta.tokenization_gpta import VOCAB_FILES_NAMES
from transformers.testing_utils import require_tokenizers
from ...test_tokenization_common import Token... | 610 | 0 |
from scipy.stats import pearsonr
import datasets
__A ='''
Pearson correlation coefficient and p-value for testing non-correlation.
The Pearson correlation coefficient measures the linear relationship between two datasets. The calculation of the p-value relies on the assumption that each dataset is normally di... | 463 |
"""simple docstring"""
from .dependency_versions_table import deps
from .utils.versions import require_version, require_version_core
# define which module versions we always want to check at run time
# (usually the ones defined in `install_requires` in setup.py)
#
# order specific notes:
# - tqdm must be chec... | 610 | 0 |
import logging
import os
from typing import List, Tuple
import numpy as np
import psutil
import torch
import torch.distributed as dist
from transformers import RagRetriever
_a : List[Any] = logging.getLogger(__name__)
class a_ ( A__ ):
def __init__( self... | 598 |
"""simple docstring"""
def __lowerCamelCase ( __UpperCamelCase , __UpperCamelCase , __UpperCamelCase ) -> float:
"""simple docstring"""
return round(float(moles / volume ) * nfactor )
def __lowerCamelCase ( __UpperCamelCase , __UpperCamelCase , __Upp... | 610 | 0 |
from __future__ import annotations
import json
import requests
from bsa import BeautifulSoup
from fake_useragent import UserAgent
_lowercase : Tuple ={"""UserAgent""": UserAgent().random}
def _SCREAMING_SNAKE_CASE ( lowerCAmelCase__ ):
lowerCamelCase_ : Union[str... | 364 |
"""simple docstring"""
import copy
from typing import Any, Dict, List, Optional, Union
import numpy as np
from ...audio_utils import mel_filter_bank, spectrogram, window_function
from ...feature_extraction_sequence_utils import SequenceFeatureExtractor
from ...feature_extraction_utils import BatchFeature
from... | 610 | 0 |
from typing import TYPE_CHECKING
from ...utils import OptionalDependencyNotAvailable, _LazyModule, is_sentencepiece_available
UpperCAmelCase__ = {}
try:
if not is_sentencepiece_available():
raise OptionalDependencyNotAvailable()
except OptionalDependencyNotAvailable:
pass
else:
U... | 351 |
"""simple docstring"""
from typing import Any
def __lowerCamelCase ( __UpperCamelCase ) -> list[Any]:
"""simple docstring"""
if not input_list:
return []
lowerCAmelCase_ : Any = [input_list.count(__UpperCamelCase ) for value in input_list]
lowerCAme... | 610 | 0 |
import torch
from torch import nn
from torch.nn import CrossEntropyLoss, MSELoss
from transformers.file_utils import add_start_docstrings, add_start_docstrings_to_model_forward
from transformers.models.bert.modeling_bert import (
BERT_INPUTS_DOCSTRING,
BERT_START_DOCSTRING,
BertEmbeddings,
BertLayer,... | 343 |
"""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... | 610 | 0 |
'''simple docstring'''
from collections import OrderedDict
from typing import TYPE_CHECKING, Any, Mapping, Optional, Union
from ...configuration_utils import PretrainedConfig
from ...onnx import OnnxConfig, OnnxSeqaSeqConfigWithPast
from ...utils import logging
if TYPE_CHECKING:
from ...feature_extraction_util... | 244 |
"""simple docstring"""
from typing import TYPE_CHECKING
from ...utils import (
OptionalDependencyNotAvailable,
_LazyModule,
is_flax_available,
is_tensorflow_text_available,
is_tf_available,
is_tokenizers_available,
is_torch_available,
)
lowercase__ = {
"""configuration... | 610 | 0 |
'''simple docstring'''
import pickle
import shutil
import tempfile
import unittest
from transformers import SPIECE_UNDERLINE, XLMRobertaTokenizer, XLMRobertaTokenizerFast
from transformers.testing_utils import get_tests_dir, require_sentencepiece, require_tokenizers, slow
from transformers.utils import cached_prope... | 422 |
"""simple docstring"""
lowercase__ = """
# Transformers 설치 방법
! pip install transformers datasets
# 마지막 릴리스 대신 소스에서 설치하려면, 위 명령을 주석으로 바꾸고 아래 명령을 해제하세요.
# ! pip install git+https://github.com/huggingface/transformers.git
"""
lowercase__ = [{"""type""": """code""", """content""": INSTALL_CONTENT}... | 610 | 0 |
from ...configuration_utils import PretrainedConfig
from ...utils import logging
_UpperCamelCase = logging.get_logger(__name__)
_UpperCamelCase = {
'''microsoft/markuplm-base''': '''https://huggingface.co/microsoft/markuplm-base/resolve/main/config.json''',
'''microsoft/mark... | 146 |
"""simple docstring"""
import json
import os
import unittest
from transformers import DebertaTokenizer, DebertaTokenizerFast
from transformers.models.deberta.tokenization_deberta import VOCAB_FILES_NAMES
from transformers.testing_utils import slow
from ...test_tokenization_common import TokenizerTesterMixin
... | 610 | 0 |
from typing import TYPE_CHECKING
from ...utils import OptionalDependencyNotAvailable, _LazyModule, is_flax_available, is_torch_available
UpperCamelCase_ = {
"configuration_gpt_neo": ["GPT_NEO_PRETRAINED_CONFIG_ARCHIVE_MAP", "GPTNeoConfig", "GPTNeoOnnxConfig"],
}
try:
if not is_torch_available()... | 611 |
"""simple docstring"""
def __lowerCamelCase ( __UpperCamelCase ) -> tuple[int, int]:
"""simple docstring"""
try:
lowerCAmelCase_ : Tuple = float(__UpperCamelCase )
except ValueError:
raise ValueError("Please enter a valid number" )
lowerCAmelCa... | 610 | 0 |
'''simple docstring'''
import unittest
import numpy as np
from transformers.testing_utils import require_pytesseract, require_torch
from transformers.utils import is_pytesseract_available, is_torch_available
from ...test_image_processing_common import ImageProcessingSavingTestMixin, prepare_image_inputs
if... | 667 |
"""simple docstring"""
def __lowerCamelCase ( __UpperCamelCase , __UpperCamelCase ) -> int:
"""simple docstring"""
return 1 if input_a == input_a else 0
def __lowerCamelCase ( ) -> None:
"""simple docstring"""
assert xnor_gate(0 , 0 ) ==... | 610 | 0 |
'''simple docstring'''
import itertools
import json
import os
import unittest
from transformers import AddedToken, LongformerTokenizer, LongformerTokenizerFast
from transformers.models.longformer.tokenization_longformer import VOCAB_FILES_NAMES
from transformers.testing_utils import require_tokenizers, slow
... | 400 |
"""simple docstring"""
from typing import Optional, Tuple, Union
import tensorflow as tf
from ...activations_tf import ACTaFN
from ...file_utils import add_code_sample_docstrings, add_start_docstrings, add_start_docstrings_to_model_forward
from ...modeling_tf_outputs import (
TFBaseModelOutputWithNoAttent... | 610 | 0 |
def lowerCamelCase_ ( lowerCamelCase__ = "The quick brown fox jumps over the lazy dog" , ):
lowerCamelCase_ = set()
# Replace all the whitespace in our sentence
lowerCamelCase_ = input_str.replace(" " , "" )
for alpha in input_str:
... | 463 |
"""simple docstring"""
import math
def __lowerCamelCase ( __UpperCamelCase ) -> int:
"""simple docstring"""
if not isinstance(__UpperCamelCase , __UpperCamelCase ):
lowerCAmelCase_ : Any = f'''Input value of [number={number}] must be an integer'''
... | 610 | 0 |
import itertools
import os
import re
_a : int = re.compile(R'([A-Z]+)([A-Z][a-z])')
_a : str = re.compile(R'([a-z\d])([A-Z])')
_a : Any = re.compile(R'(?<!_)_(?!_)')
_a : Any = re.compile(R'(_{2,})')
_a : O... | 598 |
"""simple docstring"""
import warnings
from typing import List, Optional, Union
from ...image_utils import ImageInput
from ...processing_utils import ProcessorMixin
from ...tokenization_utils_base import BatchEncoding, PaddingStrategy, PreTokenizedInput, TextInput, TruncationStrategy
from ...utils import Tenso... | 610 | 0 |
import tempfile
import unittest
import numpy as np
import transformers
from transformers import GPTaTokenizer, GPTJConfig, is_flax_available, is_torch_available
from transformers.testing_utils import is_pt_flax_cross_test, require_flax, tooslow
from ...generation.test_flax_utils import FlaxGener... | 364 |
"""simple docstring"""
import unittest
import numpy as np
import torch
from .utils_summarization import build_mask, compute_token_type_ids, process_story, truncate_or_pad
class __lowerCamelCase ( unittest.TestCase ):
'''simple docstring'''
def lowerCamelCase ( self ... | 610 | 0 |
def a_ (__A ) -> List[str]:
"""simple docstring"""
__a : int = min(__UpperCamelCase ) # min() finds the minimum value
__a : int = max(__UpperCamelCase ) # max() finds the maximum value
__a : Optional[int] = ... | 351 |
"""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 OptionalDependencyN... | 610 | 0 |
import os
from typing import List, Optional, Union
from ...tokenization_utils import PreTrainedTokenizer
from ...tokenization_utils_base import AddedToken
from ...utils import logging
__A : Union[str, Any] = logging.get_logger(__name__)
__A : Dict = {'''vocab_file''': '''vocab.txt'''}
__A : ... | 343 |
"""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 __lowerCamelCase ... | 610 | 0 |
'''simple docstring'''
import unittest
from transformers.testing_utils import CaptureStdout
from transformers.tools.python_interpreter import evaluate
def UpperCamelCase_ ( _UpperCAmelCase : Any ) -> str:
"""simple docstring"""
return x + 2
class lowe... | 244 |
"""simple docstring"""
# Lint as: python3
import itertools
import os
import re
lowercase__ = re.compile(r"""([A-Z]+)([A-Z][a-z])""")
lowercase__ = re.compile(r"""([a-z\d])([A-Z])""")
lowercase__ = re.compile(r"""(?<!_)_(?!_)""")
lowercase__ = re.compile(r"""(_{2,})""")
lowerc... | 610 | 0 |
'''simple docstring'''
import unittest
from transformers import (
MODEL_FOR_SEQUENCE_CLASSIFICATION_MAPPING,
TF_MODEL_FOR_SEQUENCE_CLASSIFICATION_MAPPING,
Pipeline,
ZeroShotClassificationPipeline,
pipeline,
)
from transformers.testing_utils import is_pipeline_test, nested_simplify, require_tf, r... | 422 |
"""simple docstring"""
import torch
from torch import nn
from ...configuration_utils import ConfigMixin, register_to_config
from ...models import ModelMixin
class __lowerCamelCase ( A__ , A__ ):
'''simple docstring'''
@register_to_config
def __init__( self : ... | 610 | 0 |
import importlib
import os
import sys
# This is required to make the module import works (when the python process is running from the root of the repo)
sys.path.append('''.''')
def UpperCamelCase_( snake_case__: Optional[int] ) -> List[str]:
UpperCAmelCase__ = test_file.s... | 146 |
"""simple docstring"""
def __lowerCamelCase ( __UpperCamelCase ) -> str:
"""simple docstring"""
return "".join([hex(__UpperCamelCase )[2:].zfill(2 ).upper() for byte in list(__UpperCamelCase )] )
def __lowerCamelCase ( __UpperCamelCase ) -> byte... | 610 | 0 |
import numpy as np
from matplotlib import pyplot as plt
from sklearn.datasets import load_iris
from sklearn.metrics import ConfusionMatrixDisplay
from sklearn.model_selection import train_test_split
from xgboost import XGBClassifier
def _UpperCAmelCase ( UpperCamelCase: Optional[int] ):
"""simple ... | 611 |
"""simple docstring"""
import torch
from torch import nn
from torch.nn import CrossEntropyLoss, MSELoss
from transformers.file_utils import add_start_docstrings, add_start_docstrings_to_model_forward
from transformers.models.bert.modeling_bert import (
BERT_INPUTS_DOCSTRING,
BERT_START_DOCSTRING,
B... | 610 | 0 |
'''simple docstring'''
def a ( lowerCamelCase__ ):
'''simple docstring'''
A_ : Tuple = 0
for ch in input_str:
A_ : Union[str, Any] = ord(__UpperCamelCase )
A_ : List[str] = pow(2 , __UpperCamelCase )
# If we alrea... | 667 |
"""simple docstring"""
from __future__ import annotations
import json
import requests
from bsa import BeautifulSoup
from fake_useragent import UserAgent
lowercase__ = {"""UserAgent""": UserAgent().random}
def __lowerCamelCase ( __UpperCamelCase ) -> dict:
"""simple docstrin... | 610 | 0 |
'''simple docstring'''
def UpperCamelCase_( snake_case : Optional[int] , snake_case : int ):
'''simple docstring'''
return int((input_a, input_a).count(1 ) != 0 )
def UpperCamelCase_( ):
'''simple docstring'''
assert or_gate(0 , ... | 400 |
"""simple docstring"""
import json
import os
import unittest
from transformers import AutoTokenizer, GPTaTokenizer, GPTaTokenizerFast
from transformers.models.gpta.tokenization_gpta import VOCAB_FILES_NAMES
from transformers.testing_utils import require_tokenizers
from ...test_tokenization_common import Token... | 610 | 0 |
import argparse
from pathlib import Path
from typing import Dict, OrderedDict, Tuple
import torch
from audiocraft.models import MusicGen
from transformers import (
AutoFeatureExtractor,
AutoTokenizer,
EncodecModel,
MusicgenDecoderConfig,
MusicgenForConditionalGeneration,
MusicgenProcessor,
... | 463 |
"""simple docstring"""
from .dependency_versions_table import deps
from .utils.versions import require_version, require_version_core
# define which module versions we always want to check at run time
# (usually the ones defined in `install_requires` in setup.py)
#
# order specific notes:
# - tqdm must be chec... | 610 | 0 |
import torch
from torch import nn
from ...configuration_utils import ConfigMixin, register_to_config
from ...models import ModelMixin
class a_ ( A__ , A__ ):
@register_to_config
def __init__( self : List[Any] , *,
UpperCAmelCase__ : int = 4 , UpperCAme... | 598 |
"""simple docstring"""
def __lowerCamelCase ( __UpperCamelCase , __UpperCamelCase , __UpperCamelCase ) -> float:
"""simple docstring"""
return round(float(moles / volume ) * nfactor )
def __lowerCamelCase ( __UpperCamelCase , __UpperCamelCase , __Upp... | 610 | 0 |
import os
def _SCREAMING_SNAKE_CASE ( ):
lowerCamelCase_ : Tuple = os.path.join(os.path.dirname(__UpperCamelCase ) ,'num.txt' )
with open(__UpperCamelCase ) as file_hand:
return str(sum(int(__UpperCamelCase ) for line in file_hand ) )[... | 364 |
"""simple docstring"""
import copy
from typing import Any, Dict, List, Optional, Union
import numpy as np
from ...audio_utils import mel_filter_bank, spectrogram, window_function
from ...feature_extraction_sequence_utils import SequenceFeatureExtractor
from ...feature_extraction_utils import BatchFeature
from... | 610 | 0 |
import torch
from diffusers import DiffusionPipeline
class snake_case_ ( A__ ):
"""simple docstring"""
def __init__(self: List[str] , __UpperCAmelCase: Optional[Any] , __UpperCAmelCase: Dict ) -> Tuple:
'''simple docstring'''
... | 351 |
"""simple docstring"""
from typing import Any
def __lowerCamelCase ( __UpperCamelCase ) -> list[Any]:
"""simple docstring"""
if not input_list:
return []
lowerCAmelCase_ : Any = [input_list.count(__UpperCamelCase ) for value in input_list]
lowerCAme... | 610 | 0 |
import argparse
from typing import List
import evaluate
import numpy as np
import torch
from datasets import DatasetDict, load_dataset
# New Code #
# We'll be using StratifiedKFold for this example
from sklearn.model_selection import StratifiedKFold
from torch.optim import AdamW
from torch.utils.data import DataLoa... | 343 |
"""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... | 610 | 0 |
'''simple docstring'''
from typing import Union
import fire
import torch
from tqdm import tqdm
def UpperCamelCase_ ( _UpperCAmelCase : Tuple , _UpperCAmelCase : Tuple = "cpu" , _UpperCAmelCase : Optional[int] = None ) -> None:
"""simple docstring"""... | 244 |
"""simple docstring"""
from typing import TYPE_CHECKING
from ...utils import (
OptionalDependencyNotAvailable,
_LazyModule,
is_flax_available,
is_tensorflow_text_available,
is_tf_available,
is_tokenizers_available,
is_torch_available,
)
lowercase__ = {
"""configuration... | 610 | 0 |
'''simple docstring'''
def lowercase_ ( ) -> int:
'''simple docstring'''
for n in range(1 , 1_000_000 ):
yield n * (n + 1) // 2
def lowercase_ ( _lowercase ) -> int:
'''simple docstring'''
lowerCamelCase_ : str = 1
lowerCamelCase... | 422 |
"""simple docstring"""
lowercase__ = """
# Transformers 설치 방법
! pip install transformers datasets
# 마지막 릴리스 대신 소스에서 설치하려면, 위 명령을 주석으로 바꾸고 아래 명령을 해제하세요.
# ! pip install git+https://github.com/huggingface/transformers.git
"""
lowercase__ = [{"""type""": """code""", """content""": INSTALL_CONTENT}... | 610 | 0 |
import operator
def UpperCamelCase_( snake_case__: Union[str, Any] , snake_case__: str = False , snake_case__: Any = None ) -> list:
UpperCAmelCase__ = operator.lt if reverse else operator.gt
UpperCAmelCase__ = solution or []
if not ... | 146 |
"""simple docstring"""
import json
import os
import unittest
from transformers import DebertaTokenizer, DebertaTokenizerFast
from transformers.models.deberta.tokenization_deberta import VOCAB_FILES_NAMES
from transformers.testing_utils import slow
from ...test_tokenization_common import TokenizerTesterMixin
... | 610 | 0 |
import os
import pytest
from datasets import (
get_dataset_config_info,
get_dataset_config_names,
get_dataset_infos,
get_dataset_split_names,
inspect_dataset,
inspect_metric,
)
UpperCamelCase_ = pytest.mark.integration
@pytest.mark.parametrize("path" , ["paws", "csv... | 611 |
def _UpperCAmelCase ( UpperCamelCase: list[int] , UpperCamelCase: int ):
"""simple docstring"""
__lowerCAmelCase = len(UpperCamelCase )
__lowerCAmelCase = [[False] * (required_sum + 1) for _ in range(arr_len + 1 )]
# for each arr value, a sum of zero(0) can be formed by not ta... | 611 | 1 |
from collections import OrderedDict
from typing import Mapping
from ...configuration_utils import PretrainedConfig
from ...onnx import OnnxConfig
from ...utils import logging
UpperCamelCase_ = logging.get_logger(__name__)
UpperCamelCase_ = {
"andreasmadsen/efficient_mlm_m0.40": (
... | 611 |
import argparse
import json
from collections import OrderedDict
from pathlib import Path
import requests
import torch
from huggingface_hub import hf_hub_download
from PIL import Image
from transformers import (
SegformerConfig,
SegformerForImageClassification,
SegformerForSemanticSegmentation,
Segfor... | 611 | 1 |
import warnings
from typing import Dict
import numpy as np
from ..utils import ExplicitEnum, add_end_docstrings, is_tf_available, is_torch_available
from .base import PIPELINE_INIT_ARGS, GenericTensor, Pipeline
if is_tf_available():
from ..models.auto.modeling_tf_auto import TF_MODEL_FOR_SEQUENCE_CLASSIFICATI... | 611 |
from maths.prime_check import is_prime
def _UpperCAmelCase ( UpperCamelCase: int ):
"""simple docstring"""
if not isinstance(UpperCamelCase , UpperCamelCase ):
__lowerCAmelCase = F"Input value of [number={number}] must be an integer"
raise TypeError(UpperCamelCase )
if is_pri... | 611 | 1 |
def _UpperCAmelCase ( ):
"""simple docstring"""
return [
a * b * (1_0_0_0 - a - b)
for a in range(1 , 9_9_9 )
for b in range(UpperCamelCase , 9_9_9 )
if (a * a + b * b == (1_0_0_0 - a - b) ** 2)
][0]
if __name__ == "__main__":
print(f'''{solution() = }''')
... | 611 |
import argparse
import numpy as np
import torch
from transformers import SpeechTaHifiGan, SpeechTaHifiGanConfig, logging
logging.set_verbosity_info()
UpperCamelCase_ = logging.get_logger("transformers.models.speecht5")
def _UpperCAmelCase ( UpperCamelCase: Optional[int] , UpperCame... | 611 | 1 |
import pytest
from datasets.splits import SplitDict, SplitInfo
from datasets.utils.py_utils import asdict
@pytest.mark.parametrize(
"split_dict" , [
SplitDict(),
SplitDict({"train": SplitInfo(name="train" , num_bytes=1_3_3_7 , num_examples=4_2 , dataset_name="... | 611 |
def _UpperCAmelCase ( UpperCamelCase: int ):
"""simple docstring"""
if a < 0:
raise ValueError("Input value must be a positive integer" )
elif isinstance(UpperCamelCase , UpperCamelCase ):
raise TypeError("Input value must be a 'int' type" )
return bin(UpperCamelCase ).count("1" )
if ... | 611 | 1 |
import argparse
import gc
import json
import os
import shutil
import warnings
import torch
from transformers import LlamaConfig, LlamaForCausalLM, LlamaTokenizer
try:
from transformers import LlamaTokenizerFast
except ImportError as e:
warnings.warn(e)
warnings.warn(
"The converted tokenize... | 611 |
def _UpperCAmelCase ( UpperCamelCase: int , UpperCamelCase: int , UpperCamelCase: int ):
"""simple docstring"""
if exponent == 1:
return base
if exponent % 2 == 0:
__lowerCAmelCase = _modexpt(UpperCamelCase , exponent // 2 , UpperCamelCase ) % modulo_value... | 611 | 1 |
UpperCamelCase_ = tuple[float, float, float]
UpperCamelCase_ = tuple[float, float, float]
def _UpperCAmelCase ( UpperCamelCase: Pointad , UpperCamelCase: Pointad ):
"""simple docstring"""
__lowerCAmelCase = end_pointa[0] - end_pointa[0]
__lowerCAmelCase ... | 611 |
import json
import os
import unittest
from transformers.models.blenderbot_small.tokenization_blenderbot_small import (
VOCAB_FILES_NAMES,
BlenderbotSmallTokenizer,
)
from ...test_tokenization_common import TokenizerTesterMixin
class a ( __UpperCAmelCase , unittest.TestCase ):
lowerca... | 611 | 1 |
import warnings
from ...utils import logging
from .image_processing_dpt import DPTImageProcessor
UpperCamelCase_ = logging.get_logger(__name__)
class a ( __UpperCAmelCase ):
def __init__( self : Union[str, Any] , *snake_case__ : List[str] , **snake_case__ : Tuple ... | 611 |
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 import... | 611 | 1 |
def _UpperCAmelCase ( UpperCamelCase: int = 1_0 , UpperCamelCase: int = 1_0_0_0 , UpperCamelCase: bool = True ):
"""simple docstring"""
assert (
isinstance(UpperCamelCase , UpperCamelCase )
and isinstance(UpperCamelCase , UpperCamelCase )
and isinstanc... | 611 |
from typing import TYPE_CHECKING
from ...utils import OptionalDependencyNotAvailable, _LazyModule, is_tokenizers_available, is_torch_available
UpperCamelCase_ = {
"configuration_altclip": [
"ALTCLIP_PRETRAINED_CONFIG_ARCHIVE_MAP",
"AltCLIPConfig",
"AltCLIPTextConfig",
... | 611 | 1 |
from typing import TYPE_CHECKING
from ...utils import (
OptionalDependencyNotAvailable,
_LazyModule,
is_flax_available,
is_tf_available,
is_tokenizers_available,
is_torch_available,
)
UpperCamelCase_ = {
"configuration_roberta": ["ROBERTA_PRETRAINED_CONFIG_ARCHIVE_MAP", "Rober... | 611 |
from sklearn.metrics import recall_score
import datasets
UpperCamelCase_ = "\nRecall is the fraction of the positive examples that were correctly labeled by the model as positive. It can be computed with the equation:\nRecall = TP / (TP + FN)\nWhere TP is the true positives and FN is the false negatives.... | 611 | 1 |
from typing import TYPE_CHECKING
from ...utils import (
OptionalDependencyNotAvailable,
_LazyModule,
is_sentencepiece_available,
is_tokenizers_available,
is_torch_available,
)
UpperCamelCase_ = {"configuration_reformer": ["REFORMER_PRETRAINED_CONFIG_ARCHIVE_MAP", "ReformerConfig"]}
t... | 611 |
import unittest
from transformers import load_tool
from transformers.utils import is_torch_available
if is_torch_available():
import torch
from transformers.testing_utils import require_torch
from .test_tools_common import ToolTesterMixin
@require_torch
class a ( unittest.TestCase , __UpperCAmelC... | 611 | 1 |
def _UpperCAmelCase ( UpperCamelCase: int ):
"""simple docstring"""
if a < 0:
raise ValueError("Input value must be a positive integer" )
elif isinstance(UpperCamelCase , UpperCamelCase ):
raise TypeError("Input value must be a 'int' type" )
return bin(UpperCamelCase ).count("1" )
if ... | 611 |
import copy
import os
import cva
import numpy as np
from matplotlib import pyplot as plt
class a :
def __init__( self : str ):
"""simple docstring"""
__lowerCAmelCase = ""
__lowerCAmelCase = ""
__lowerCAmelCase = []
__lowerCAmelC... | 611 | 1 |
import os
from shutil import copyfile
from typing import List, Optional, Tuple
import sentencepiece as spm
from ...tokenization_utils import PreTrainedTokenizer
from ...utils import logging
UpperCamelCase_ = logging.get_logger(__name__)
UpperCamelCase_ = {"vocab_file": "sentencepiece.model"}... | 611 |
import argparse
import os
from io import BytesIO
from pathlib import Path
import requests
from clip_retrieval.clip_client import ClipClient
from PIL import Image
from tqdm import tqdm
def _UpperCAmelCase ( UpperCamelCase: Tuple , UpperCamelCase: Optional[int] , UpperCamelCase: Tuple ):... | 611 | 1 |
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 ( __UpperCAmelCase ):
lowercase_ : str = ['i... | 611 |
from collections import OrderedDict
from typing import TYPE_CHECKING, Any, Mapping, Optional
from packaging import version
from ...configuration_utils import PretrainedConfig
from ...onnx import OnnxConfig
from ...onnx.utils import compute_effective_axis_dimension
from ...utils import logging
if TYPE_CHECKING:
... | 611 | 1 |
import warnings
from typing import List
import numpy as np
from ...processing_utils import ProcessorMixin
from ...tokenization_utils_base import BatchEncoding
from ...utils import is_flax_available, is_tf_available, is_torch_available
class a ( __UpperCAmelCase ):
lowercase_ : List[str] = [... | 611 |
import importlib
import json
import os
from collections import OrderedDict
from typing import Dict, Optional, Union
# Build the list of all image processors
from ...configuration_utils import PretrainedConfig
from ...dynamic_module_utils import get_class_from_dynamic_module, resolve_trust_remote_code
from ...image_pr... | 611 | 1 |
def _UpperCAmelCase ( UpperCamelCase: List[Any] ):
"""simple docstring"""
if not head:
return True
# split the list to two parts
__lowerCAmelCase , __lowerCAmelCase = head.next, head
while fast and fast.next:
__lowerCAmelCase = fast.next.next
__lowerCAmelCase = slow.next... | 611 |
class a :
def __init__( self : Union[str, Any] , snake_case__ : str ):
"""simple docstring"""
__lowerCAmelCase = arr.split("," )
def UpperCAmelCase__ ( self : str ):
"""simple docstring"""
__lowerCAmelCase ... | 611 | 1 |
UpperCamelCase_ = [
(1_0_0_0, "M"),
(9_0_0, "CM"),
(5_0_0, "D"),
(4_0_0, "CD"),
(1_0_0, "C"),
(9_0, "XC"),
(5_0, "L"),
(4_0, "XL"),
(1_0, "X"),
(9, "IX"),
(5, "V"),
(4, "IV"),
(1, "I"),
]
def _UpperCAmelCase ( UpperCamelCase: str ):
""... | 611 |
import functools
import operator
from ...configuration_utils import PretrainedConfig
from ...utils import logging
UpperCamelCase_ = logging.get_logger(__name__)
UpperCamelCase_ = {
"microsoft/wavlm-base": "https://huggingface.co/microsoft/wavlm-base/resolve/main/config.json",
# See al... | 611 | 1 |
import importlib
import os
from dataclasses import dataclass
from enum import Enum
from typing import Any, Dict, Optional, Union
import torch
from ..utils import BaseOutput
UpperCamelCase_ = "scheduler_config.json"
class a ( __UpperCAmelCase ):
lowercase_ : List[Any] = 1
... | 611 |
from decimal import Decimal, getcontext
from math import ceil, factorial
def _UpperCAmelCase ( UpperCamelCase: int ):
"""simple docstring"""
if not isinstance(UpperCamelCase , UpperCamelCase ):
raise TypeError("Undefined for non-integers" )
elif precision < 1:
raise ValueError("Und... | 611 | 1 |
import math
import os
import unittest
from transformers import MegatronBertConfig, is_torch_available
from transformers.models.auto import get_values
from transformers.testing_utils import require_sentencepiece, require_tokenizers, require_torch, slow, torch_device
from ...test_configuration_common import ConfigTest... | 611 |
from collections import OrderedDict
from typing import Mapping
from ...configuration_utils import PretrainedConfig
from ...onnx import OnnxConfig
from ...utils import logging
UpperCamelCase_ = logging.get_logger(__name__)
UpperCamelCase_ = {
"andreasmadsen/efficient_mlm_m0.40": (
... | 611 | 1 |
import shutil
import tempfile
import unittest
import numpy as np
import pytest
from transformers import is_speech_available, is_vision_available
from transformers.testing_utils import require_torch
if is_vision_available():
from transformers import TvltImageProcessor
if is_speech_available():
from trans... | 611 |
import json
import os
from typing import Optional, Tuple
import regex as re
from ...tokenization_utils import PreTrainedTokenizer
from ...utils import logging
UpperCamelCase_ = logging.get_logger(__name__)
UpperCamelCase_ = {
"vocab_file": "vocab.json",
"merges_file": "merges.txt",
}... | 611 | 1 |
UpperCamelCase_ = {
"meter": "m",
"kilometer": "km",
"megametre": "Mm",
"gigametre": "Gm",
"terametre": "Tm",
"petametre": "Pm",
"exametre": "Em",
"zettametre": "Zm",
"yottametre": "Ym",
}
# Exponent of the factor(meter)
UpperCamelCase_ = {
"m": 0,
"km"... | 611 |
import json
import os
import re
import unicodedata
from json.encoder import INFINITY
from typing import Any, Dict, List, Optional, Tuple, Union
import numpy as np
import regex
from ...tokenization_utils import AddedToken, PreTrainedTokenizer
from ...tokenization_utils_base import BatchEncoding
from ...utils import T... | 611 | 1 |
import unittest
from transformers import AutoTokenizer, FalconConfig, is_torch_available
from transformers.testing_utils import require_torch, slow, torch_device
from ...generation.test_utils import GenerationTesterMixin
from ...test_configuration_common import ConfigTester
from ...test_modeling_common import ModelT... | 611 |
import gc
import unittest
from parameterized import parameterized
from diffusers import FlaxUNetaDConditionModel
from diffusers.utils import is_flax_available
from diffusers.utils.testing_utils import load_hf_numpy, require_flax, slow
if is_flax_available():
import jax
import jax.numpy as jnp
@slow
@req... | 611 | 1 |
import gc
import unittest
import numpy as np
import torch
from transformers import CLIPTextConfig, CLIPTextModel, CLIPTokenizer
from diffusers import AutoencoderKL, DDIMScheduler, LDMTextToImagePipeline, UNetaDConditionModel
from diffusers.utils.testing_utils import (
enable_full_determinism,
load_numpy,
... | 611 |
def _UpperCAmelCase ( UpperCamelCase: list[int] , UpperCamelCase: int ):
"""simple docstring"""
__lowerCAmelCase = len(UpperCamelCase )
__lowerCAmelCase = [[False] * (required_sum + 1) for _ in range(arr_len + 1 )]
# for each arr value, a sum of zero(0) can be formed by not ta... | 611 | 1 |
from __future__ import annotations
def _UpperCAmelCase ( UpperCamelCase: list[int | str] ):
"""simple docstring"""
create_state_space_tree(UpperCamelCase , [] , 0 , [0 for i in range(len(UpperCamelCase ) )] )
def _UpperCAmelCase ( UpperCamelCase: list[int |... | 611 |
import argparse
import json
from collections import OrderedDict
from pathlib import Path
import requests
import torch
from huggingface_hub import hf_hub_download
from PIL import Image
from transformers import (
SegformerConfig,
SegformerForImageClassification,
SegformerForSemanticSegmentation,
Segfor... | 611 | 1 |
import argparse
import json
import os
import fairseq
import torch
from fairseq.data import Dictionary
from transformers import (
WavaVecaConformerConfig,
WavaVecaConformerForCTC,
WavaVecaConformerForPreTraining,
WavaVecaCTCTokenizer,
WavaVecaFeatureExtractor,
WavaVecaProcessor,
logging,
)... | 611 |
from maths.prime_check import is_prime
def _UpperCAmelCase ( UpperCamelCase: int ):
"""simple docstring"""
if not isinstance(UpperCamelCase , UpperCamelCase ):
__lowerCAmelCase = F"Input value of [number={number}] must be an integer"
raise TypeError(UpperCamelCase )
if is_pri... | 611 | 1 |
import os
import pickle
import unittest
from transformers import AutoTokenizer
from transformers.models.bert.tokenization_bert import BertTokenizer
from transformers.models.bert_japanese.tokenization_bert_japanese import (
VOCAB_FILES_NAMES,
BertJapaneseTokenizer,
CharacterTokenizer,
JumanppTokenizer,... | 611 |
import argparse
import numpy as np
import torch
from transformers import SpeechTaHifiGan, SpeechTaHifiGanConfig, logging
logging.set_verbosity_info()
UpperCamelCase_ = logging.get_logger("transformers.models.speecht5")
def _UpperCAmelCase ( UpperCamelCase: Optional[int] , UpperCame... | 611 | 1 |
from typing import List, Union
import numpy as np
from ..utils import add_end_docstrings, is_torch_available, is_vision_available, logging, requires_backends
from .base import PIPELINE_INIT_ARGS, Pipeline
if is_vision_available():
from PIL import Image
from ..image_utils import load_image
if is_torch_a... | 611 |
def _UpperCAmelCase ( UpperCamelCase: int ):
"""simple docstring"""
if a < 0:
raise ValueError("Input value must be a positive integer" )
elif isinstance(UpperCamelCase , UpperCamelCase ):
raise TypeError("Input value must be a 'int' type" )
return bin(UpperCamelCase ).count("1" )
if ... | 611 | 1 |
import logging
import os
import sys
import warnings
from dataclasses import dataclass, field
from random import randint
from typing import Optional
import datasets
import evaluate
import numpy as np
from datasets import DatasetDict, load_dataset
import transformers
from transformers import (
AutoConfig,
Auto... | 611 |
def _UpperCAmelCase ( UpperCamelCase: int , UpperCamelCase: int , UpperCamelCase: int ):
"""simple docstring"""
if exponent == 1:
return base
if exponent % 2 == 0:
__lowerCAmelCase = _modexpt(UpperCamelCase , exponent // 2 , UpperCamelCase ) % modulo_value... | 611 | 1 |
import argparse
import json
from pathlib import Path
import requests
import torch
from huggingface_hub import hf_hub_download
from PIL import Image
from timm import create_model
from timm.data import resolve_data_config
from timm.data.transforms_factory import create_transform
from transformers import BitConfig, Bit... | 611 |
import json
import os
import unittest
from transformers.models.blenderbot_small.tokenization_blenderbot_small import (
VOCAB_FILES_NAMES,
BlenderbotSmallTokenizer,
)
from ...test_tokenization_common import TokenizerTesterMixin
class a ( __UpperCAmelCase , unittest.TestCase ):
lowerca... | 611 | 1 |
import numpy as np
def _UpperCAmelCase ( UpperCamelCase: Optional[Any] , UpperCamelCase: List[Any] , UpperCamelCase: Dict , UpperCamelCase: Union[str, Any] , UpperCamelCase: List[str] ):
"""simple docstring"""
__lowerCAmelCase = int(np.ceil((x_end - xa)... | 611 |
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 import... | 611 | 1 |
from __future__ import annotations
def _UpperCAmelCase ( UpperCamelCase: list , UpperCamelCase: int , UpperCamelCase: int , UpperCamelCase: int ):
"""simple docstring"""
__lowerCAmelCase = []
__lowerCAmelCase , __lowerCAmelCase = input_list[low:mid], i... | 611 |
from typing import TYPE_CHECKING
from ...utils import OptionalDependencyNotAvailable, _LazyModule, is_tokenizers_available, is_torch_available
UpperCamelCase_ = {
"configuration_altclip": [
"ALTCLIP_PRETRAINED_CONFIG_ARCHIVE_MAP",
"AltCLIPConfig",
"AltCLIPTextConfig",
... | 611 | 1 |
import json
import pathlib
import unittest
import numpy as np
from transformers.testing_utils import require_torch, require_vision, slow
from transformers.utils import is_torch_available, is_vision_available
from ...test_image_processing_common import ImageProcessingSavingTestMixin, prepare_image_inputs
if is_tor... | 611 |
from sklearn.metrics import recall_score
import datasets
UpperCamelCase_ = "\nRecall is the fraction of the positive examples that were correctly labeled by the model as positive. It can be computed with the equation:\nRecall = TP / (TP + FN)\nWhere TP is the true positives and FN is the false negatives.... | 611 | 1 |
UpperCamelCase_ = {"a": ["c", "b"], "b": ["d", "e"], "c": [], "d": [], "e": []}
UpperCamelCase_ = ["a", "b", "c", "d", "e"]
def _UpperCAmelCase ( UpperCamelCase: Optional[int] , UpperCamelCase: List[str] , UpperCamelCase: Dict ):
"""simple docstring"""
__... | 611 |
import unittest
from transformers import load_tool
from transformers.utils import is_torch_available
if is_torch_available():
import torch
from transformers.testing_utils import require_torch
from .test_tools_common import ToolTesterMixin
@require_torch
class a ( unittest.TestCase , __UpperCAmelC... | 611 | 1 |
def _UpperCAmelCase ( UpperCamelCase: int , UpperCamelCase: int ):
"""simple docstring"""
return int((input_a, input_a).count(0 ) == 0 )
def _UpperCAmelCase ( ):
"""simple docstring"""
assert and_gate(0 , 0 ) == 0
assert and_gate(0 , 1 ) == 0
assert a... | 611 |
import copy
import os
import cva
import numpy as np
from matplotlib import pyplot as plt
class a :
def __init__( self : str ):
"""simple docstring"""
__lowerCAmelCase = ""
__lowerCAmelCase = ""
__lowerCAmelCase = []
__lowerCAmelC... | 611 | 1 |
from typing import TYPE_CHECKING
from ...utils import OptionalDependencyNotAvailable, _LazyModule, is_sentencepiece_available
UpperCamelCase_ = {}
try:
if not is_sentencepiece_available():
raise OptionalDependencyNotAvailable()
except OptionalDependencyNotAvailable:
pass
else:
... | 611 |
import argparse
import os
from io import BytesIO
from pathlib import Path
import requests
from clip_retrieval.clip_client import ClipClient
from PIL import Image
from tqdm import tqdm
def _UpperCAmelCase ( UpperCamelCase: Tuple , UpperCamelCase: Optional[int] , UpperCamelCase: Tuple ):... | 611 | 1 |
import copy
import os
import cva
import numpy as np
from matplotlib import pyplot as plt
class a :
def __init__( self : str ):
"""simple docstring"""
__lowerCAmelCase = ""
__lowerCAmelCase = ""
__lowerCAmelCase = []
__lowerCAmelC... | 611 |
from collections import OrderedDict
from typing import TYPE_CHECKING, Any, Mapping, Optional
from packaging import version
from ...configuration_utils import PretrainedConfig
from ...onnx import OnnxConfig
from ...onnx.utils import compute_effective_axis_dimension
from ...utils import logging
if TYPE_CHECKING:
... | 611 | 1 |
UpperCamelCase_ = "\n# Transformers installation\n! pip install transformers datasets\n# To install from source instead of the last release, comment the command above and uncomment the following one.\n# ! pip install git+https://github.com/huggingface/transformers.git\n"
UpperCamelCase_ = [{"typ... | 611 |
import importlib
import json
import os
from collections import OrderedDict
from typing import Dict, Optional, Union
# Build the list of all image processors
from ...configuration_utils import PretrainedConfig
from ...dynamic_module_utils import get_class_from_dynamic_module, resolve_trust_remote_code
from ...image_pr... | 611 | 1 |
def _UpperCAmelCase ( UpperCamelCase: list[int] , UpperCamelCase: list[int] ):
"""simple docstring"""
if not len(UpperCamelCase ) == len(UpperCamelCase ) == 3:
raise ValueError("Please enter a valid equation." )
if equationa[0] == equationa[1] == equationa[0] == equationa[1] == 0:
raise... | 611 |
class a :
def __init__( self : Union[str, Any] , snake_case__ : str ):
"""simple docstring"""
__lowerCAmelCase = arr.split("," )
def UpperCAmelCase__ ( self : str ):
"""simple docstring"""
__lowerCAmelCase ... | 611 | 1 |
from google.protobuf import descriptor as _descriptor
from google.protobuf import descriptor_pool as _descriptor_pool
from google.protobuf import symbol_database as _symbol_database
from google.protobuf.internal import builder as _builder
# @@protoc_insertion_point(imports)
UpperCamelCase_ = _symbol_data... | 611 |
import functools
import operator
from ...configuration_utils import PretrainedConfig
from ...utils import logging
UpperCamelCase_ = logging.get_logger(__name__)
UpperCamelCase_ = {
"microsoft/wavlm-base": "https://huggingface.co/microsoft/wavlm-base/resolve/main/config.json",
# See al... | 611 | 1 |
import argparse
import os
from io import BytesIO
from pathlib import Path
import requests
from clip_retrieval.clip_client import ClipClient
from PIL import Image
from tqdm import tqdm
def _UpperCAmelCase ( UpperCamelCase: Tuple , UpperCamelCase: Optional[int] , UpperCamelCase: Tuple ):... | 611 |
from decimal import Decimal, getcontext
from math import ceil, factorial
def _UpperCAmelCase ( UpperCamelCase: int ):
"""simple docstring"""
if not isinstance(UpperCamelCase , UpperCamelCase ):
raise TypeError("Undefined for non-integers" )
elif precision < 1:
raise ValueError("Und... | 611 | 1 |
import pytest
import datasets
# Import fixture modules as plugins
UpperCamelCase_ = ["tests.fixtures.files", "tests.fixtures.hub", "tests.fixtures.fsspec"]
def _UpperCAmelCase ( UpperCamelCase: Dict , UpperCamelCase: int ):
"""simple docstring"""
for item in items:
if a... | 611 |
from collections import OrderedDict
from typing import Mapping
from ...configuration_utils import PretrainedConfig
from ...onnx import OnnxConfig
from ...utils import logging
UpperCamelCase_ = logging.get_logger(__name__)
UpperCamelCase_ = {
"andreasmadsen/efficient_mlm_m0.40": (
... | 611 | 1 |
def _UpperCAmelCase ( UpperCamelCase: int ):
"""simple docstring"""
__lowerCAmelCase = int(UpperCamelCase )
if decimal in (0, 1): # Exit cases for the recursion
return str(UpperCamelCase )
__lowerCAmelCase , __lowerCAmelCase = divmod(UpperCamelCase , 2 )
return binary_rec... | 611 |
import json
import os
from typing import Optional, Tuple
import regex as re
from ...tokenization_utils import PreTrainedTokenizer
from ...utils import logging
UpperCamelCase_ = logging.get_logger(__name__)
UpperCamelCase_ = {
"vocab_file": "vocab.json",
"merges_file": "merges.txt",
}... | 611 | 1 |
from __future__ import annotations
class a :
def __init__( self : int , snake_case__ : list[list[int]] ):
"""simple docstring"""
__lowerCAmelCase = TypeError(
"Matrices must be formed from a list of zero or more lists containing at "
"l... | 611 |
import json
import os
import re
import unicodedata
from json.encoder import INFINITY
from typing import Any, Dict, List, Optional, Tuple, Union
import numpy as np
import regex
from ...tokenization_utils import AddedToken, PreTrainedTokenizer
from ...tokenization_utils_base import BatchEncoding
from ...utils import T... | 611 | 1 |
import contextlib
import copy
import random
from typing import Any, Dict, Iterable, Optional, Union
import numpy as np
import torch
from .utils import deprecate, is_transformers_available
if is_transformers_available():
import transformers
def _UpperCAmelCase ( UpperCamelCase: int ):
"""s... | 611 |
import gc
import unittest
from parameterized import parameterized
from diffusers import FlaxUNetaDConditionModel
from diffusers.utils import is_flax_available
from diffusers.utils.testing_utils import load_hf_numpy, require_flax, slow
if is_flax_available():
import jax
import jax.numpy as jnp
@slow
@req... | 611 | 1 |
import unittest
import numpy as np
from transformers import RoFormerConfig, is_flax_available
from transformers.testing_utils import require_flax, slow
from ...test_modeling_flax_common import FlaxModelTesterMixin, ids_tensor, random_attention_mask
if is_flax_available():
import jax.numpy as jnp
from t... | 611 |
def _UpperCAmelCase ( UpperCamelCase: list[int] , UpperCamelCase: int ):
"""simple docstring"""
__lowerCAmelCase = len(UpperCamelCase )
__lowerCAmelCase = [[False] * (required_sum + 1) for _ in range(arr_len + 1 )]
# for each arr value, a sum of zero(0) can be formed by not ta... | 611 | 1 |
from typing import TYPE_CHECKING
from ...utils import OptionalDependencyNotAvailable, _LazyModule, is_tokenizers_available, is_torch_available
UpperCamelCase_ = {
"configuration_altclip": [
"ALTCLIP_PRETRAINED_CONFIG_ARCHIVE_MAP",
"AltCLIPConfig",
"AltCLIPTextConfig",
... | 611 |
import argparse
import json
from collections import OrderedDict
from pathlib import Path
import requests
import torch
from huggingface_hub import hf_hub_download
from PIL import Image
from transformers import (
SegformerConfig,
SegformerForImageClassification,
SegformerForSemanticSegmentation,
Segfor... | 611 | 1 |
from typing import Optional, Union
import torch
from torch import nn
from torch.nn import BCEWithLogitsLoss, CrossEntropyLoss, MSELoss
from ...activations import ACTaFN
from ...modeling_outputs import BaseModelOutputWithPoolingAndNoAttention, ImageClassifierOutputWithNoAttention
from ...modeling_utils import PreTrai... | 611 |
from maths.prime_check import is_prime
def _UpperCAmelCase ( UpperCamelCase: int ):
"""simple docstring"""
if not isinstance(UpperCamelCase , UpperCamelCase ):
__lowerCAmelCase = F"Input value of [number={number}] must be an integer"
raise TypeError(UpperCamelCase )
if is_pri... | 611 | 1 |
def _UpperCAmelCase ( UpperCamelCase: Optional[int] ):
"""simple docstring"""
return [
{
0: [1, 2],
1: [0, 2],
2: [0, 1, 3, 5],
3: [2, 4],
4: [3],
5: [2, 6, 8],
6: [5, 7],
7: [6, 8],
8: [5, 7],
},
{
... | 611 |
import argparse
import numpy as np
import torch
from transformers import SpeechTaHifiGan, SpeechTaHifiGanConfig, logging
logging.set_verbosity_info()
UpperCamelCase_ = logging.get_logger("transformers.models.speecht5")
def _UpperCAmelCase ( UpperCamelCase: Optional[int] , UpperCame... | 611 | 1 |
from typing import TYPE_CHECKING
from ...utils import (
OptionalDependencyNotAvailable,
_LazyModule,
is_torch_available,
)
UpperCamelCase_ = {
"configuration_encodec": [
"ENCODEC_PRETRAINED_CONFIG_ARCHIVE_MAP",
"EncodecConfig",
],
"feature_extraction_encodec": ["En... | 611 |
def _UpperCAmelCase ( UpperCamelCase: int ):
"""simple docstring"""
if a < 0:
raise ValueError("Input value must be a positive integer" )
elif isinstance(UpperCamelCase , UpperCamelCase ):
raise TypeError("Input value must be a 'int' type" )
return bin(UpperCamelCase ).count("1" )
if ... | 611 | 1 |
def _UpperCAmelCase ( UpperCamelCase: str ):
"""simple docstring"""
return " ".join(input_str.split()[::-1] )
if __name__ == "__main__":
import doctest
doctest.testmod()
| 611 |
def _UpperCAmelCase ( UpperCamelCase: int , UpperCamelCase: int , UpperCamelCase: int ):
"""simple docstring"""
if exponent == 1:
return base
if exponent % 2 == 0:
__lowerCAmelCase = _modexpt(UpperCamelCase , exponent // 2 , UpperCamelCase ) % modulo_value... | 611 | 1 |
import random
import unittest
import torch
from diffusers import IFInpaintingSuperResolutionPipeline
from diffusers.utils import floats_tensor
from diffusers.utils.import_utils import is_xformers_available
from diffusers.utils.testing_utils import skip_mps, torch_device
from ..pipeline_params import (
TEXT_GUID... | 611 |
import json
import os
import unittest
from transformers.models.blenderbot_small.tokenization_blenderbot_small import (
VOCAB_FILES_NAMES,
BlenderbotSmallTokenizer,
)
from ...test_tokenization_common import TokenizerTesterMixin
class a ( __UpperCAmelCase , unittest.TestCase ):
lowerca... | 611 | 1 |
from abc import ABC, abstractmethod
from typing import List, Optional
class a ( __UpperCAmelCase ):
def __init__( self : str ):
"""simple docstring"""
self.test()
def UpperCAmelCase__ ( self : Optional[int] ):
"""simple docstring"... | 611 |
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 import... | 611 | 1 |
from typing import List, Optional, Union
import torch
from ...models import UNetaDConditionModel, VQModel
from ...pipelines import DiffusionPipeline
from ...pipelines.pipeline_utils import ImagePipelineOutput
from ...schedulers import DDPMScheduler
from ...utils import (
is_accelerate_available,
is_accelerat... | 611 |
from typing import TYPE_CHECKING
from ...utils import OptionalDependencyNotAvailable, _LazyModule, is_tokenizers_available, is_torch_available
UpperCamelCase_ = {
"configuration_altclip": [
"ALTCLIP_PRETRAINED_CONFIG_ARCHIVE_MAP",
"AltCLIPConfig",
"AltCLIPTextConfig",
... | 611 | 1 |
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, ids_tensor, random_attention_mask
from ...test_pipe... | 611 |
from sklearn.metrics import recall_score
import datasets
UpperCamelCase_ = "\nRecall is the fraction of the positive examples that were correctly labeled by the model as positive. It can be computed with the equation:\nRecall = TP / (TP + FN)\nWhere TP is the true positives and FN is the false negatives.... | 611 | 1 |
import numpy as np
from matplotlib import pyplot as plt
from sklearn.datasets import load_iris
from sklearn.metrics import ConfusionMatrixDisplay
from sklearn.model_selection import train_test_split
from xgboost import XGBClassifier
def _UpperCAmelCase ( UpperCamelCase: dict ):
"""simple docstring... | 611 |
import unittest
from transformers import load_tool
from transformers.utils import is_torch_available
if is_torch_available():
import torch
from transformers.testing_utils import require_torch
from .test_tools_common import ToolTesterMixin
@require_torch
class a ( unittest.TestCase , __UpperCAmelC... | 611 | 1 |
import argparse
import os
import re
import packaging.version
UpperCamelCase_ = "examples/"
UpperCamelCase_ = {
"examples": (re.compile(R"^check_min_version\(\"[^\"]+\"\)\s*$", re.MULTILINE), "check_min_version(\"VERSION\")\n"),
"init": (re.compile(R"^__version__\s+=\s+\"([^\"]+)\"\s*$"... | 611 |
import copy
import os
import cva
import numpy as np
from matplotlib import pyplot as plt
class a :
def __init__( self : str ):
"""simple docstring"""
__lowerCAmelCase = ""
__lowerCAmelCase = ""
__lowerCAmelCase = []
__lowerCAmelC... | 611 | 1 |
import argparse
from collections import OrderedDict
from pathlib import Path
import torch
from transformers import (
VisualBertConfig,
VisualBertForMultipleChoice,
VisualBertForPreTraining,
VisualBertForQuestionAnswering,
VisualBertForVisualReasoning,
)
from transformers.utils import logging
lo... | 611 |
import argparse
import os
from io import BytesIO
from pathlib import Path
import requests
from clip_retrieval.clip_client import ClipClient
from PIL import Image
from tqdm import tqdm
def _UpperCAmelCase ( UpperCamelCase: Tuple , UpperCamelCase: Optional[int] , UpperCamelCase: Tuple ):... | 611 | 1 |
import json
import os
from typing import Optional, Tuple
import regex as re
from ...tokenization_utils import PreTrainedTokenizer
from ...utils import logging
UpperCamelCase_ = logging.get_logger(__name__)
UpperCamelCase_ = {
"vocab_file": "vocab.json",
"merges_file": "merges.txt",
}... | 611 |
from collections import OrderedDict
from typing import TYPE_CHECKING, Any, Mapping, Optional
from packaging import version
from ...configuration_utils import PretrainedConfig
from ...onnx import OnnxConfig
from ...onnx.utils import compute_effective_axis_dimension
from ...utils import logging
if TYPE_CHECKING:
... | 611 | 1 |
class a :
def __init__( self : Tuple , snake_case__ : int , snake_case__ : Optional[Any]=None , snake_case__ : Any=None ):
"""simple docstring"""
__lowerCAmelCase = data
__lowerCAmelCase = previous
__lowerCAmelCase = next... | 611 |
import importlib
import json
import os
from collections import OrderedDict
from typing import Dict, Optional, Union
# Build the list of all image processors
from ...configuration_utils import PretrainedConfig
from ...dynamic_module_utils import get_class_from_dynamic_module, resolve_trust_remote_code
from ...image_pr... | 611 | 1 |
import unittest
from transformers import GPTSwaTokenizer
from transformers.testing_utils import get_tests_dir, require_sentencepiece, require_tokenizers, slow
from ...test_tokenization_common import TokenizerTesterMixin
UpperCamelCase_ = get_tests_dir("fixtures/test_sentencepiece_with_bytefallback.model... | 611 |
class a :
def __init__( self : Union[str, Any] , snake_case__ : str ):
"""simple docstring"""
__lowerCAmelCase = arr.split("," )
def UpperCAmelCase__ ( self : str ):
"""simple docstring"""
__lowerCAmelCase ... | 611 | 1 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.