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 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
from ...test_tokenization_com... | 562 |
'''simple docstring'''
import warnings
from ...configuration_utils import PretrainedConfig
from ...utils import logging
A = logging.get_logger(__name__)
A = {
'''RUCAIBox/mvp''': '''https://huggingface.co/RUCAIBox/mvp/resolve/main/config.json''',
}
class __SCREAMING_SNA... | 125 | 0 |
'''simple docstring'''
import mpmath # for roots of unity
import numpy as np
class _lowercase:
"""simple docstring"""
def __init__( self: str ,a: List[Any]=None ,a: Union[str, Any]=None ):
# Input as list
__UpperCAmelCase = list(poly_a or [0] ... | 396 |
'''simple docstring'''
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
fr... | 125 | 0 |
__A = 'Alexander Joslin'
import operator as op
from .stack import Stack
def __A ( _lowercase ):
'''simple docstring'''
_A = {'*': op.mul, '/': op.truediv, '+': op.add, '-': op.sub}
_A = Stack()
_A = Stack()
for i in equa... | 484 |
'''simple docstring'''
import tempfile
import torch
from diffusers import PNDMScheduler
from .test_schedulers import SchedulerCommonTest
class __SCREAMING_SNAKE_CASE ( lowerCAmelCase__ ):
'''simple docstring'''
lowerCAmelCase__ : Dict = (PNDMScheduler,)
... | 125 | 0 |
"""simple docstring"""
from __future__ import annotations
def lowerCamelCase__ ( UpperCAmelCase_ , UpperCAmelCase_ )-> set[str]:
"""simple docstring"""
UpperCamelCase = set(lowerCAmelCase__ ), [start]
while stack:
... | 554 |
'''simple docstring'''
from typing import Any
import numpy as np
def SCREAMING_SNAKE_CASE ( lowerCAmelCase__ : np.ndarray) -> bool:
'''simple docstring'''
return np.array_equal(lowerCAmelCase__ , matrix.conjugate().T)
def SCREAMING_SNAKE_CASE ( lowe... | 125 | 0 |
"""simple docstring"""
import warnings
warnings.warn(
"""memory_utils has been reorganized to utils.memory. Import `find_executable_batchsize` from the main `__init__`: """
"""`from accelerate import find_executable_batch_size` to avoid this warning.""",
FutureWarning,
)
| 420 |
'''simple docstring'''
from ....configuration_utils import PretrainedConfig
from ....utils import logging
A = logging.get_logger(__name__)
# TODO: upload to AWS
A = {
'''yjernite/retribert-base-uncased''': (
'''https://huggingface.co/yjernite/retribert-base-uncased/reso... | 125 | 0 |
"""simple docstring"""
import argparse
import json
from pathlib import Path
import requests
import torch
from huggingface_hub import hf_hub_download
from PIL import Image
from transformers import DetrConfig, DetrForObjectDetection, DetrForSegmentation, DetrImageProcessor, ResNetConfig
from tran... | 607 |
'''simple docstring'''
A = 9.80_665
def SCREAMING_SNAKE_CASE ( lowerCAmelCase__ : float , lowerCAmelCase__ : float , lowerCAmelCase__ : float = g) -> float:
'''simple docstring'''
if fluid_density <= 0:
raise ValueError('I... | 125 | 0 |
'''simple docstring'''
import argparse
import json
import os
import torch
from transformers import LukeConfig, LukeModel, LukeTokenizer, RobertaTokenizer
from transformers.tokenization_utils_base import AddedToken
@torch.no_grad()
def a ( UpperCamelCase_ : List[Any] , UpperCamelCase... | 538 |
'''simple docstring'''
from collections import OrderedDict
from typing import Any, List, Mapping, Optional
from ... import PreTrainedTokenizer, TensorType, is_torch_available
from ...configuration_utils import PretrainedConfig
from ...onnx import OnnxConfigWithPast, PatchingSpec
from ...utils import loggi... | 125 | 0 |
'''simple docstring'''
from typing import TYPE_CHECKING
from ...utils import (
OptionalDependencyNotAvailable,
_LazyModule,
is_flax_available,
is_tf_available,
is_torch_available,
)
__SCREAMING_SNAKE_CASE :Tuple = {
'''configuration_vision_encoder_decoder''': ['''VisionEnc... | 236 |
'''simple docstring'''
# Copyright 2021 The HuggingFace Team. All rights reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-... | 125 | 0 |
import json
import os
import unittest
from transformers.models.xlm.tokenization_xlm import VOCAB_FILES_NAMES, XLMTokenizer
from transformers.testing_utils import slow
from ...test_tokenization_common import TokenizerTesterMixin
class _A ( lowerCAmelCase__ , unittest.TestCase ):
'''simple docst... | 402 |
'''simple docstring'''
import math_equivalence # From: git+https://github.com/hendrycks/math.git
import datasets
A = '''\
@article{hendrycksmath2021,
title={Measuring Mathematical Problem Solving With the MATH Dataset},
author={Dan Hendrycks
and Collin Burns
and Saurav Kadavath
... | 125 | 0 |
import re
from flax.core.frozen_dict import freeze
from flax.traverse_util import flatten_dict, unflatten_dict
from jax.experimental import PartitionSpec as P
# Sentinels
_a: int = object()
# For specifying empty leaf dict `{}`
_a: Any = object()
def __lowerCAmelCase ( A ... | 162 |
'''simple docstring'''
import json
import os
import tempfile
import unittest
import unittest.mock as mock
from pathlib import Path
from requests.exceptions import HTTPError
from transformers.utils import (
CONFIG_NAME,
FLAX_WEIGHTS_NAME,
TF2_WEIGHTS_NAME,
TRANSFORMERS_CACHE,
WEIGHTS_N... | 125 | 0 |
from typing import List, Optional, Tuple, Union
import torch
from ...models import UNetaDModel
from ...schedulers import ScoreSdeVeScheduler
from ...utils import randn_tensor
from ..pipeline_utils import DiffusionPipeline, ImagePipelineOutput
class a ( lowerCAmelCase__ ):
'''... | 144 |
'''simple docstring'''
import os
import zipfile
import requests
from get_ci_error_statistics import download_artifact, get_artifacts_links
def SCREAMING_SNAKE_CASE ( lowerCAmelCase__ : int , lowerCAmelCase__ : Optional[int]=7) -> Any:
'''simple docstring'''
... | 125 | 0 |
from itertools import product
from cva import COLOR_BGR2GRAY, cvtColor, imread, imshow, waitKey
from numpy import dot, exp, mgrid, pi, ravel, square, uinta, zeros
def SCREAMING_SNAKE_CASE ( _UpperCAmelCase , _UpperCAmelCase ) -> Tuple:
_a = k_size // 2
_a = ... | 562 |
'''simple docstring'''
import json
import unittest
import numpy as np
from huggingface_hub import hf_hub_download
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 ImageP... | 125 | 0 |
'''simple docstring'''
from ...configuration_utils import PretrainedConfig
from ...utils import logging
_UpperCamelCase : Tuple = logging.get_logger(__name__)
_UpperCamelCase : Dict = {
'bigcode/gpt_bigcode-santacoder': 'https://huggingface.co/bigcode/gpt_bigcode-santacode... | 396 |
'''simple docstring'''
import argparse
import json
import os
import fairseq
import torch
from fairseq.data import Dictionary
from transformers import (
HubertConfig,
HubertForCTC,
HubertModel,
WavaVecaCTCTokenizer,
WavaVecaFeatureExtractor,
WavaVecaProcessor,
logging,
)
logg... | 125 | 0 |
import sys
from typing import Tuple
import numpy as np
import torch
from PIL import Image
from torch import nn
from transformers.image_utils import PILImageResampling
from utils import img_tensorize
class SCREAMING_SNAKE_CASE :
"""simple docstring"""
def __init__( self: Dict ,... | 484 |
'''simple docstring'''
import math
A = 10
A = 7
A = BALLS_PER_COLOUR * NUM_COLOURS
def SCREAMING_SNAKE_CASE ( lowerCAmelCase__ : int = 20) -> str:
'''simple docstring'''
_lowercase : Union[str, Any] = math.comb(lowerCAmel... | 125 | 0 |
"""simple docstring"""
import json
import os
import unittest
from transformers import MgpstrTokenizer
from transformers.models.mgp_str.tokenization_mgp_str import VOCAB_FILES_NAMES
from transformers.testing_utils import require_tokenizers
from ...test_tokenization_common import TokenizerTesterMixin
... | 554 |
'''simple docstring'''
from dataclasses import asdict, dataclass
from typing import Optional
from ...configuration_utils import PretrainedConfig
from ...utils import logging
A = logging.get_logger(__name__)
# TODO Update this
A = {
'''facebook/esm-1b''': '''https://huggingface... | 125 | 0 |
"""simple docstring"""
from collections import OrderedDict
from typing import Mapping
from packaging import version
from ...configuration_utils import PretrainedConfig
from ...onnx import OnnxConfig
from ...utils import logging
UpperCAmelCase = logging.get_logger(__name__)
UpperCAmelCase = {
"""... | 420 |
'''simple docstring'''
from typing import List, Optional, Tuple, Union
import torch
from ...utils import logging, randn_tensor
from ..pipeline_utils import AudioPipelineOutput, DiffusionPipeline
A = logging.get_logger(__name__) # pylint: disable=invalid-name
class __SCREAMING_SNAKE_C... | 125 | 0 |
"""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
lowerCAmelCase: Union[str, Any] ... | 607 |
'''simple docstring'''
import itertools
import json
import os
import unittest
from transformers import AddedToken, RobertaTokenizer, RobertaTokenizerFast
from transformers.models.roberta.tokenization_roberta import VOCAB_FILES_NAMES
from transformers.testing_utils import require_tokenizers, slow
from ...... | 125 | 0 |
'''simple docstring'''
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_mo... | 538 |
'''simple docstring'''
from dataclasses import dataclass
from typing import Optional, Tuple, Union
import torch
import torch.nn as nn
from ..configuration_utils import ConfigMixin, register_to_config
from ..utils import BaseOutput, apply_forward_hook
from .modeling_utils import ModelMixin
from .vae impor... | 125 | 0 |
'''simple docstring'''
import unittest
import numpy as np
import torch
from transformers import CLIPTextConfig, CLIPTextModel
from diffusers import DDIMScheduler, LDMPipeline, UNetaDModel, VQModel
from diffusers.utils.testing_utils import enable_full_determinism, require_torch, slow, torch_device
enable_f... | 236 |
'''simple docstring'''
import json
import os
from functools import lru_cache
from typing import TYPE_CHECKING, List, Optional, Tuple
import regex as re
from ...tokenization_utils import AddedToken, PreTrainedTokenizer
from ...utils import logging
if TYPE_CHECKING:
from transformers.pipelines.conver... | 125 | 0 |
import unittest
from transformers import (
MODEL_FOR_SEQ_TO_SEQ_CAUSAL_LM_MAPPING,
TF_MODEL_FOR_SEQ_TO_SEQ_CAUSAL_LM_MAPPING,
TextaTextGenerationPipeline,
pipeline,
)
from transformers.testing_utils import is_pipeline_test, require_tf, require_torch
from transformers.utils import is_torch_available... | 402 |
'''simple docstring'''
import math
import os
from copy import deepcopy
import datasets
import evaluate
import torch
import transformers
from datasets import load_dataset
from torch.utils.data import DataLoader
from transformers import AutoModelForSequenceClassification, AutoTokenizer
from accelerate impo... | 125 | 0 |
from ..utils import DummyObject, requires_backends
class __UpperCamelCase ( metaclass=lowerCAmelCase__ ):
SCREAMING_SNAKE_CASE__ = ["torch"]
def __init__( self : Tuple , *lowerCAmelCase : List[Any] , **lowerCAmelCase : int ):
'''simple docs... | 162 |
'''simple docstring'''
def SCREAMING_SNAKE_CASE ( lowerCAmelCase__ : int , lowerCAmelCase__ : int) -> int:
'''simple docstring'''
return int((input_a, input_a).count(0) != 0)
def SCREAMING_SNAKE_CASE ( ) -> None:
'''simple docstrin... | 125 | 0 |
import uuid
from typing import Any, Dict, List, Optional, Union
from ..utils import add_end_docstrings, is_tf_available, is_torch_available, logging
from .base import PIPELINE_INIT_ARGS, Pipeline
if is_tf_available():
import tensorflow as tf
if is_torch_available():
import torch
_lowerCa... | 144 |
'''simple docstring'''
import gc
import random
import unittest
import numpy as np
import torch
from transformers import CLIPTextConfig, CLIPTextModel, CLIPTextModelWithProjection, CLIPTokenizer
from diffusers import (
AutoencoderKL,
DiffusionPipeline,
EulerDiscreteScheduler,
StableDiffusi... | 125 | 0 |
def SCREAMING_SNAKE_CASE ( _UpperCAmelCase ) -> Dict:
_a = [], []
while len(lowerCAmelCase__ ) > 1:
_a = min(lowerCAmelCase__ ), max(lowerCAmelCase__ )
start.append(lowerCAmelCase__ )
end.append(lowerCAmelCase__... | 562 |
'''simple docstring'''
import warnings
from ...configuration_utils import PretrainedConfig
from ...utils import logging
A = logging.get_logger(__name__)
A = {
'''RUCAIBox/mvp''': '''https://huggingface.co/RUCAIBox/mvp/resolve/main/config.json''',
}
class __SCREAMING_SNA... | 125 | 0 |
'''simple docstring'''
from typing import TYPE_CHECKING
# rely on isort to merge the imports
from ...utils import OptionalDependencyNotAvailable, _LazyModule, is_torch_available
_UpperCamelCase : str = {
'configuration_informer': [
'INFORMER_PRETRAINED_CONFIG_ARCHIVE_MAP',
'... | 396 |
'''simple docstring'''
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
fr... | 125 | 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 ( lowerCAmelCa... | 484 |
'''simple docstring'''
import tempfile
import torch
from diffusers import PNDMScheduler
from .test_schedulers import SchedulerCommonTest
class __SCREAMING_SNAKE_CASE ( lowerCAmelCase__ ):
'''simple docstring'''
lowerCAmelCase__ : Dict = (PNDMScheduler,)
... | 125 | 0 |
"""simple docstring"""
import numpy as np
def lowerCamelCase__ ( UpperCAmelCase_ )-> np.array:
"""simple docstring"""
return 1 / (1 + np.exp(-vector ))
if __name__ == "__main__":
import doctest
doctest.testmod()
| 554 |
'''simple docstring'''
from typing import Any
import numpy as np
def SCREAMING_SNAKE_CASE ( lowerCAmelCase__ : np.ndarray) -> bool:
'''simple docstring'''
return np.array_equal(lowerCAmelCase__ , matrix.conjugate().T)
def SCREAMING_SNAKE_CASE ( lowe... | 125 | 0 |
"""simple docstring"""
import argparse
from collections import OrderedDict
from pathlib import Path
import torch
from transformers import (
VisualBertConfig,
VisualBertForMultipleChoice,
VisualBertForPreTraining,
VisualBertForQuestionAnswering,
VisualBertForVisualReasoning,
)
from transformers.ut... | 420 |
'''simple docstring'''
from ....configuration_utils import PretrainedConfig
from ....utils import logging
A = logging.get_logger(__name__)
# TODO: upload to AWS
A = {
'''yjernite/retribert-base-uncased''': (
'''https://huggingface.co/yjernite/retribert-base-uncased/reso... | 125 | 0 |
"""simple docstring"""
def __snake_case ( __A ) -> int:
if not isinstance(lowerCAmelCase__ ,lowerCAmelCase__ ):
raise TypeError("""only integers accepted as input""" )
else:
lowercase : int = str(abs(lowerCAmelCase__ ) )
... | 607 |
'''simple docstring'''
A = 9.80_665
def SCREAMING_SNAKE_CASE ( lowerCAmelCase__ : float , lowerCAmelCase__ : float , lowerCAmelCase__ : float = g) -> float:
'''simple docstring'''
if fluid_density <= 0:
raise ValueError('I... | 125 | 0 |
'''simple docstring'''
from packaging import version
from .. import __version__
from .constants import IMAGENET_DEFAULT_MEAN, IMAGENET_DEFAULT_STD, IMAGENET_STANDARD_MEAN, IMAGENET_STANDARD_STD
from .doc import (
add_code_sample_docstrings,
add_end_docstrings,
add_start_docstrings,
add_start_docst... | 538 |
'''simple docstring'''
from collections import OrderedDict
from typing import Any, List, Mapping, Optional
from ... import PreTrainedTokenizer, TensorType, is_torch_available
from ...configuration_utils import PretrainedConfig
from ...onnx import OnnxConfigWithPast, PatchingSpec
from ...utils import loggi... | 125 | 0 |
'''simple docstring'''
from __future__ import annotations
from typing import Any
class A_ :
def __init__( self : int , snake_case_ : int , snake_case_ : int , snake_case_ : float = 0 ):
_UpperCAmelCase = row, c... | 236 |
'''simple docstring'''
# Copyright 2021 The HuggingFace Team. All rights reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-... | 125 | 0 |
from pathlib import Path
import torch
from ...utils import is_npu_available, is_xpu_available
from .config_args import ClusterConfig, default_json_config_file
from .config_utils import SubcommandHelpFormatter
snake_case__ : Optional[int] = """Create a default config file for Accelerate with only a ... | 402 |
'''simple docstring'''
import math_equivalence # From: git+https://github.com/hendrycks/math.git
import datasets
A = '''\
@article{hendrycksmath2021,
title={Measuring Mathematical Problem Solving With the MATH Dataset},
author={Dan Hendrycks
and Collin Burns
and Saurav Kadavath
... | 125 | 0 |
from ...utils import (
OptionalDependencyNotAvailable,
is_torch_available,
is_transformers_available,
is_transformers_version,
)
try:
if not (is_transformers_available() and is_torch_available()):
raise OptionalDependencyNotAvailable()
except OptionalDependencyNotAvailable:
from ...u... | 162 |
'''simple docstring'''
import json
import os
import tempfile
import unittest
import unittest.mock as mock
from pathlib import Path
from requests.exceptions import HTTPError
from transformers.utils import (
CONFIG_NAME,
FLAX_WEIGHTS_NAME,
TF2_WEIGHTS_NAME,
TRANSFORMERS_CACHE,
WEIGHTS_N... | 125 | 0 |
from __future__ import annotations
def SCREAMING_SNAKE_CASE ( __UpperCamelCase : list[int | str] ) -> None:
create_state_space_tree(lowerCAmelCase__ , [] , 0 , [0 for i in range(len(lowerCAmelCase__ ) )] )
def SCREAMING_SNAKE_CASE ( __UpperCamelCase ... | 144 |
'''simple docstring'''
import os
import zipfile
import requests
from get_ci_error_statistics import download_artifact, get_artifacts_links
def SCREAMING_SNAKE_CASE ( lowerCAmelCase__ : int , lowerCAmelCase__ : Optional[int]=7) -> Any:
'''simple docstring'''
... | 125 | 0 |
import os
import zipfile
import requests
from get_ci_error_statistics import download_artifact, get_artifacts_links
def SCREAMING_SNAKE_CASE ( _UpperCAmelCase , _UpperCAmelCase=7 ) -> Any:
_a = None
if token is not None:
_a = {'Accept': 'applic... | 562 |
'''simple docstring'''
import json
import unittest
import numpy as np
from huggingface_hub import hf_hub_download
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 ImageP... | 125 | 0 |
'''simple docstring'''
from collections.abc import Sequence
def __snake_case ( lowerCAmelCase : Sequence[float] , lowerCAmelCase : bool = False ):
if not arr:
return 0
__UpperCAmelCase = 0 if allow_empty_subarrays else float('-inf' )
__UpperCAmelCase ... | 396 |
'''simple docstring'''
import argparse
import json
import os
import fairseq
import torch
from fairseq.data import Dictionary
from transformers import (
HubertConfig,
HubertForCTC,
HubertModel,
WavaVecaCTCTokenizer,
WavaVecaFeatureExtractor,
WavaVecaProcessor,
logging,
)
logg... | 125 | 0 |
from typing import TYPE_CHECKING
from ...utils import OptionalDependencyNotAvailable, _LazyModule, is_sentencepiece_available
__A = {}
try:
if not is_sentencepiece_available():
raise OptionalDependencyNotAvailable()
except OptionalDependencyNotAvailable:
pass
else:
__A = [... | 484 |
'''simple docstring'''
import math
A = 10
A = 7
A = BALLS_PER_COLOUR * NUM_COLOURS
def SCREAMING_SNAKE_CASE ( lowerCAmelCase__ : int = 20) -> str:
'''simple docstring'''
_lowercase : Union[str, Any] = math.comb(lowerCAmel... | 125 | 0 |
"""simple docstring"""
import json
import os
import tempfile
import unittest
import unittest.mock as mock
from pathlib import Path
from requests.exceptions import HTTPError
from transformers.utils import (
CONFIG_NAME,
FLAX_WEIGHTS_NAME,
TF2_WEIGHTS_NAME,
TRANSFORMERS_CACHE,
W... | 554 |
'''simple docstring'''
from dataclasses import asdict, dataclass
from typing import Optional
from ...configuration_utils import PretrainedConfig
from ...utils import logging
A = logging.get_logger(__name__)
# TODO Update this
A = {
'''facebook/esm-1b''': '''https://huggingface... | 125 | 0 |
"""simple docstring"""
from collections import namedtuple
import requests
from lxml import html # type: ignore
UpperCAmelCase = namedtuple("""covid_data""", """cases deaths recovered""")
def lowercase ( a__ : str = "https://www.worldometers.info/coronavirus/" ) -> covid_data:
_U... | 420 |
'''simple docstring'''
from typing import List, Optional, Tuple, Union
import torch
from ...utils import logging, randn_tensor
from ..pipeline_utils import AudioPipelineOutput, DiffusionPipeline
A = logging.get_logger(__name__) # pylint: disable=invalid-name
class __SCREAMING_SNAKE_C... | 125 | 0 |
"""simple docstring"""
import json
import re
from typing import TYPE_CHECKING, List, Optional, Tuple, Union
import numpy as np
from ...utils import is_tf_available, is_torch_available, logging
if TYPE_CHECKING:
if is_torch_available():
import torch
if is_tf_available():
i... | 607 |
'''simple docstring'''
import itertools
import json
import os
import unittest
from transformers import AddedToken, RobertaTokenizer, RobertaTokenizerFast
from transformers.models.roberta.tokenization_roberta import VOCAB_FILES_NAMES
from transformers.testing_utils import require_tokenizers, slow
from ...... | 125 | 0 |
'''simple docstring'''
import warnings
from ...utils import logging
from .image_processing_yolos import YolosImageProcessor
SCREAMING_SNAKE_CASE__ : Tuple = logging.get_logger(__name__)
class a__( lowerCAmelCase__ ):
def __init__( self , *_UpperCAmelCase , **_Upper... | 538 |
'''simple docstring'''
from dataclasses import dataclass
from typing import Optional, Tuple, Union
import torch
import torch.nn as nn
from ..configuration_utils import ConfigMixin, register_to_config
from ..utils import BaseOutput, apply_forward_hook
from .modeling_utils import ModelMixin
from .vae impor... | 125 | 0 |
'''simple docstring'''
import argparse
import json
import logging
import os
import sys
from unittest.mock import patch
from transformers.testing_utils import TestCasePlus, get_gpu_count, slow
_A: List[Any] = [
os.path.join(os.path.dirname(__file__), dirname)
for dirname in [
... | 126 |
'''simple docstring'''
def _lowerCAmelCase ( _lowerCAmelCase , _lowerCAmelCase , _lowerCAmelCase )-> bool:
return not any(
neighbour == 1 and colored_vertices[i] == color
for i, neighbour in enumerate(_lowerCAmelCase ) )
def _lowerCAmelCase ( _lowerCAme... | 126 | 1 |
'''simple docstring'''
import numpy as np
from transformers import BatchFeature
from transformers.testing_utils import require_tf, require_torch
from .test_feature_extraction_common import FeatureExtractionSavingTestMixin
class UpperCAmelCase ( UpperCAmelCase_ ):
# to overwrite at feature e... | 126 |
'''simple docstring'''
def _lowerCAmelCase ( _lowerCAmelCase , _lowerCAmelCase = " " )-> list:
__UpperCAmelCase = []
__UpperCAmelCase = 0
for index, char in enumerate(_lowerCAmelCase ):
if char == separator:
split_words.append(string[last_index:index] )
__Uppe... | 126 | 1 |
'''simple docstring'''
def _lowerCAmelCase ( _lowerCAmelCase , _lowerCAmelCase )-> str:
if a < 0 or b < 0:
raise ValueError('the value of both inputs must be positive' )
__UpperCAmelCase = str(bin(_lowerCAmelCase ) )[2:] # remove the leading "0b"
__UpperCAmelCase ... | 126 |
'''simple docstring'''
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, ... | 126 | 1 |
'''simple docstring'''
import unittest
import numpy as np
from transformers.testing_utils import require_torch, require_vision
from transformers.utils import is_torch_available, is_vision_available
from ...test_image_processing_common import ImageProcessingSavingTestMixin
if is_torch_available():
imp... | 126 |
'''simple docstring'''
from __future__ import annotations
_A: Tuple = list[list[int]]
# assigning initial values to the grid
_A: Matrix = [
[3, 0, 6, 5, 0, 8, 4, 0, 0],
[5, 2, 0, 0, 0, 0, 0, 0, 0],
[0, 8, 7, 0, 0, 0, 0, 3, 1],
[0, 0, 3, 0, 1, 0, 0, 8, 0]... | 126 | 1 |
'''simple docstring'''
from typing import TYPE_CHECKING
from ...utils import (
OptionalDependencyNotAvailable,
_LazyModule,
is_tf_available,
is_tokenizers_available,
is_torch_available,
is_vision_available,
)
_A: Optional[int] = {
"""configuration_layoutlmv3""... | 126 |
'''simple docstring'''
import warnings
from ...utils import logging
from .image_processing_videomae import VideoMAEImageProcessor
_A: Any = logging.get_logger(__name__)
class UpperCAmelCase ( UpperCAmelCase_ ):
def __init__( self , *__A , **__A ):
... | 126 | 1 |
'''simple docstring'''
from typing import Callable, List, Optional, Tuple, Union
import torch
from transformers import CLIPTextModel, CLIPTokenizer
from ...configuration_utils import ConfigMixin, register_to_config
from ...models import ModelMixin, TransformeraDModel, VQModel
from ...schedulers import VQDif... | 126 |
'''simple docstring'''
import json
import os
import shutil
import tempfile
import unittest
import numpy as np
import pytest
from transformers import CLIPTokenizer, CLIPTokenizerFast
from transformers.models.clip.tokenization_clip import VOCAB_FILES_NAMES
from transformers.testing_utils import require_vision... | 126 | 1 |
'''simple docstring'''
from collections import UserDict
from typing import List, Union
from ..utils import (
add_end_docstrings,
is_tf_available,
is_torch_available,
is_vision_available,
logging,
requires_backends,
)
from .base import PIPELINE_INIT_ARGS, Pipeline
if is_vision_availa... | 126 |
'''simple docstring'''
from __future__ import annotations
def _lowerCAmelCase ( _lowerCAmelCase )-> bool:
__UpperCAmelCase = len(_lowerCAmelCase )
# We need to create solution object to save path.
__UpperCAmelCase = [[0 for _ in range(_lowerCAmelCase )] for _ in range(_lo... | 126 | 1 |
'''simple docstring'''
import torch
from diffusers import KDPMaDiscreteScheduler
from diffusers.utils import torch_device
from .test_schedulers import SchedulerCommonTest
class UpperCAmelCase ( UpperCAmelCase_ ):
_A : int = (KDPMaDiscreteScheduler,)
_A : Dict ... | 126 |
'''simple docstring'''
import copy
import os
from typing import Union
from ...configuration_utils import PretrainedConfig
from ...models.auto.modeling_auto import MODEL_FOR_CAUSAL_LM_MAPPING_NAMES
from ...utils import logging
from ..auto import CONFIG_MAPPING
_A: List[str] = logging.get_... | 126 | 1 |
'''simple docstring'''
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, requ... | 126 |
'''simple docstring'''
import string
# frequency taken from https://en.wikipedia.org/wiki/Letter_frequency
_A: Optional[Any] = {
"""E""": 12.70,
"""T""": 9.06,
"""A""": 8.17,
"""O""": 7.51,
"""I""": 6.97,
"""N""": 6.75,
"""S""": 6.33,
"""H""": 6.09,
"""R... | 126 | 1 |
'''simple docstring'''
from typing import Any, Callable, Dict, List, Optional, Union
import torch
from transformers import CLIPImageProcessor, CLIPTextModel, CLIPTokenizer
from diffusers import (
AutoencoderKL,
DDIMScheduler,
DiffusionPipeline,
LMSDiscreteScheduler,
PNDMScheduler,
St... | 126 |
'''simple docstring'''
from transformers import BertTokenizerFast
from .custom_tokenization import CustomTokenizer
class UpperCAmelCase ( UpperCAmelCase_ ):
_A : Optional[int] = CustomTokenizer
pass
| 126 | 1 |
'''simple docstring'''
import enum
import warnings
from ..tokenization_utils import TruncationStrategy
from ..utils import add_end_docstrings, is_tf_available, is_torch_available, logging
from .base import PIPELINE_INIT_ARGS, Pipeline
if is_tf_available():
import tensorflow as tf
from ..models.aut... | 126 |
'''simple docstring'''
import re
from filelock import FileLock
try:
import nltk
_A: Optional[int] = True
except (ImportError, ModuleNotFoundError):
_A: Dict = False
if NLTK_AVAILABLE:
with FileLock(""".lock""") as lock:
nltk.download("""punkt"... | 126 | 1 |
'''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 Tok... | 126 |
'''simple docstring'''
def _lowerCAmelCase ( _lowerCAmelCase = 10_00 )-> int:
__UpperCAmelCase = 2**power
__UpperCAmelCase = 0
while n:
__UpperCAmelCase , __UpperCAmelCase = r + n % 10, n // 10
return r
if __name__ == "__main__":
print(solution(int(str(input()).... | 126 | 1 |
'''simple docstring'''
import collections
from typing import List, Optional, Union
from ...tokenization_utils_base import BatchEncoding
from ...utils import TensorType, add_end_docstrings, add_start_docstrings, logging
from ..bert.tokenization_bert import BertTokenizer
_A: Tuple = loggin... | 126 |
'''simple docstring'''
from typing import Any
import numpy as np
def _lowerCAmelCase ( _lowerCAmelCase )-> bool:
return np.array_equal(_lowerCAmelCase , matrix.conjugate().T )
def _lowerCAmelCase ( _lowerCAmelCase , _lowerCAmelCase )-> Any:
__UpperCAmel... | 126 | 1 |
'''simple docstring'''
from collections import defaultdict
from typing import Optional
from ..image_utils import load_image
from ..utils import (
add_end_docstrings,
is_torch_available,
logging,
requires_backends,
)
from .base import PIPELINE_INIT_ARGS, ChunkPipeline
if is_torch_available()... | 126 |
'''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... | 126 | 1 |
'''simple docstring'''
from .glue import GlueDataset, GlueDataTrainingArguments
from .language_modeling import (
LineByLineTextDataset,
LineByLineWithRefDataset,
LineByLineWithSOPTextDataset,
TextDataset,
TextDatasetForNextSentencePrediction,
)
from .squad import SquadDataset, SquadDataTra... | 126 |
'''simple docstring'''
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 UpperCAmelCase ( UpperCAmelCase_ ... | 126 | 1 |
'''simple docstring'''
import string
def _lowerCAmelCase ( _lowerCAmelCase )-> None:
for key in range(len(string.ascii_uppercase ) ):
__UpperCAmelCase = ''
for symbol in message:
if symbol in string.ascii_uppercase:
__UpperCAmelCase = string.ascii_uppercase.find(... | 126 |
'''simple docstring'''
from collections import Counter
import numpy as np
from sklearn import datasets
from sklearn.model_selection import train_test_split
_A: List[Any] = datasets.load_iris()
_A: Union[str, Any] = np.array(data["""data"""])
_A: Union[str, Any] ... | 126 | 1 |
'''simple docstring'''
import math
from datetime import datetime, timedelta
def _lowerCAmelCase ( _lowerCAmelCase )-> datetime:
__UpperCAmelCase = year % 19
__UpperCAmelCase = year % 4
__UpperCAmelCase = year % 7
__UpperCAmelCase = math.floor(year / 1_00 )
__Upp... | 126 |
'''simple docstring'''
from pathlib import Path
import fire
from tqdm import tqdm
def _lowerCAmelCase ( _lowerCAmelCase="ro" , _lowerCAmelCase="en" , _lowerCAmelCase="wmt16" , _lowerCAmelCase=None )-> None:
try:
import datasets
except (ModuleNotFoundError, Imp... | 126 | 1 |
'''simple docstring'''
from typing import TYPE_CHECKING
from ...utils import (
OptionalDependencyNotAvailable,
_LazyModule,
is_flax_available,
is_tf_available,
is_torch_available,
is_vision_available,
)
_A: str = {"""configuration_vit""": ["""VIT_PRETRAINED_CONFIG... | 126 |
'''simple docstring'''
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_... | 126 | 1 |
'''simple docstring'''
import gc
import random
import unittest
import numpy as np
import torch
from diffusers import DDIMScheduler, KandinskyVaaPipeline, KandinskyVaaPriorPipeline, UNetaDConditionModel, VQModel
from diffusers.utils import floats_tensor, load_numpy, slow, torch_device
from diffusers.utils.te... | 126 |
'''simple docstring'''
from __future__ import annotations
import unittest
from transformers import AutoTokenizer, MBartConfig, is_tf_available
from transformers.testing_utils import require_sentencepiece, require_tf, require_tokenizers, slow
from transformers.utils import cached_property
from ...test_confi... | 126 | 1 |
'''simple docstring'''
from collections import Counter
import numpy as np
from sklearn import datasets
from sklearn.model_selection import train_test_split
_A: List[Any] = datasets.load_iris()
_A: Union[str, Any] = np.array(data["""data"""])
_A: Union[str, Any] ... | 126 |
'''simple docstring'''
from typing import TYPE_CHECKING
from ...utils import OptionalDependencyNotAvailable, _LazyModule, is_torch_available
_A: Optional[int] = {
"""configuration_lilt""": ["""LILT_PRETRAINED_CONFIG_ARCHIVE_MAP""", """LiltConfig"""],
}
try:
if not is_torch_avail... | 126 | 1 |
'''simple docstring'''
from __future__ import annotations
from typing import Any
class UpperCAmelCase :
def __init__( self , __A = 6 ):
__UpperCAmelCase = None
__UpperCAmelCase = None
self.create_linked_list(__A )
def __lowerCamelCase... | 126 |
'''simple docstring'''
import os
from datetime import datetime as dt
from github import Github
_A: Any = [
"""good first issue""",
"""feature request""",
"""wip""",
]
def _lowerCAmelCase ( )-> Optional[int]:
__UpperCAmelCase = Github(os.environ['GITHUB_TOKEN... | 126 | 1 |
'''simple docstring'''
from __future__ import annotations
def _lowerCAmelCase ( _lowerCAmelCase , _lowerCAmelCase , _lowerCAmelCase )-> int | float:
if len(_lowerCAmelCase ) == 0:
raise ValueError('find_max() arg is an empty sequence' )
if (
left >= len(_low... | 126 |
'''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():
... | 126 | 1 |
'''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, ids_tensor, random_... | 126 |
'''simple docstring'''
def _lowerCAmelCase ( _lowerCAmelCase , _lowerCAmelCase , _lowerCAmelCase )-> bool:
return not any(
neighbour == 1 and colored_vertices[i] == color
for i, neighbour in enumerate(_lowerCAmelCase ) )
def _lowerCAmelCase ( _lowerCAme... | 126 | 1 |
'''simple docstring'''
import os
import warnings
from typing import List, Optional
from ...tokenization_utils_base import BatchEncoding
from ...utils import logging
from .configuration_rag import RagConfig
_A: int = logging.get_logger(__name__)
class UpperCAmelCase :
def ... | 126 |
'''simple docstring'''
def _lowerCAmelCase ( _lowerCAmelCase , _lowerCAmelCase = " " )-> list:
__UpperCAmelCase = []
__UpperCAmelCase = 0
for index, char in enumerate(_lowerCAmelCase ):
if char == separator:
split_words.append(string[last_index:index] )
__Uppe... | 126 | 1 |
'''simple docstring'''
import multiprocessing
import os
from typing import BinaryIO, Optional, Union
import fsspec
from .. import Dataset, Features, NamedSplit, config
from ..formatting import query_table
from ..packaged_modules.json.json import Json
from ..utils import logging
from ..utils.typing import Ne... | 126 |
'''simple docstring'''
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, ... | 126 | 1 |
'''simple docstring'''
from pathlib import Path
import fire
from tqdm import tqdm
def _lowerCAmelCase ( _lowerCAmelCase="ro" , _lowerCAmelCase="en" , _lowerCAmelCase="wmt16" , _lowerCAmelCase=None )-> None:
try:
import datasets
except (ModuleNotFoundError, Imp... | 126 |
'''simple docstring'''
from __future__ import annotations
_A: Tuple = list[list[int]]
# assigning initial values to the grid
_A: Matrix = [
[3, 0, 6, 5, 0, 8, 4, 0, 0],
[5, 2, 0, 0, 0, 0, 0, 0, 0],
[0, 8, 7, 0, 0, 0, 0, 3, 1],
[0, 0, 3, 0, 1, 0, 0, 8, 0]... | 126 | 1 |
'''simple docstring'''
import math
def _lowerCAmelCase ( _lowerCAmelCase , _lowerCAmelCase )-> str:
if 0 not in (x, y):
# We use the relation x^y = y*log10(x), where 10 is the base.
return y * math.logaa(_lowerCAmelCase )
else:
if x == 0: # 0 raised to any number is 0
... | 126 |
'''simple docstring'''
import warnings
from ...utils import logging
from .image_processing_videomae import VideoMAEImageProcessor
_A: Any = logging.get_logger(__name__)
class UpperCAmelCase ( UpperCAmelCase_ ):
def __init__( self , *__A , **__A ):
... | 126 | 1 |
'''simple docstring'''
from typing import TYPE_CHECKING
from ...utils import OptionalDependencyNotAvailable, _LazyModule, is_flax_available, is_torch_available
_A: Dict = {"""configuration_speech_encoder_decoder""": ["""SpeechEncoderDecoderConfig"""]}
try:
if not is_torch_available(... | 126 |
'''simple docstring'''
import json
import os
import shutil
import tempfile
import unittest
import numpy as np
import pytest
from transformers import CLIPTokenizer, CLIPTokenizerFast
from transformers.models.clip.tokenization_clip import VOCAB_FILES_NAMES
from transformers.testing_utils import require_vision... | 126 | 1 |
'''simple docstring'''
# Copyright 2023 The HuggingFace Inc. team. All rights reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENS... | 126 |
'''simple docstring'''
from __future__ import annotations
def _lowerCAmelCase ( _lowerCAmelCase )-> bool:
__UpperCAmelCase = len(_lowerCAmelCase )
# We need to create solution object to save path.
__UpperCAmelCase = [[0 for _ in range(_lowerCAmelCase )] for _ in range(_lo... | 126 | 1 |
'''simple docstring'''
_A: List[str] = """0.21.0"""
from .accelerator import Accelerator
from .big_modeling import (
cpu_offload,
cpu_offload_with_hook,
disk_offload,
dispatch_model,
init_empty_weights,
init_on_device,
load_checkpoint_and_dispatch,
)
from .data_... | 126 |
'''simple docstring'''
import copy
import os
from typing import Union
from ...configuration_utils import PretrainedConfig
from ...models.auto.modeling_auto import MODEL_FOR_CAUSAL_LM_MAPPING_NAMES
from ...utils import logging
from ..auto import CONFIG_MAPPING
_A: List[str] = logging.get_... | 126 | 1 |
'''simple docstring'''
import os
from typing import Dict, List, Union
import tensorflow as tf
from keras_nlp.tokenizers import BytePairTokenizer
from tensorflow_text import pad_model_inputs
from .tokenization_gpta import GPTaTokenizer
class UpperCAmelCase ( tf.keras.layers.Layer ):
def _... | 126 |
'''simple docstring'''
import string
# frequency taken from https://en.wikipedia.org/wiki/Letter_frequency
_A: Optional[Any] = {
"""E""": 12.70,
"""T""": 9.06,
"""A""": 8.17,
"""O""": 7.51,
"""I""": 6.97,
"""N""": 6.75,
"""S""": 6.33,
"""H""": 6.09,
"""R... | 126 | 1 |
'''simple docstring'''
import json
import os
from functools import lru_cache
from typing import List, Optional, Tuple
import regex as re
from ...tokenization_utils import AddedToken, PreTrainedTokenizer
from ...utils import logging
_A: str = logging.get_logger(__name__)
_A: Dict... | 126 |
'''simple docstring'''
from transformers import BertTokenizerFast
from .custom_tokenization import CustomTokenizer
class UpperCAmelCase ( UpperCAmelCase_ ):
_A : Optional[int] = CustomTokenizer
pass
| 126 | 1 |
'''simple docstring'''
from argparse import ArgumentParser
from .env import EnvironmentCommand
def _lowerCAmelCase ( )-> Optional[Any]:
__UpperCAmelCase = ArgumentParser('Diffusers CLI tool' , usage='diffusers-cli <command> [<args>]' )
__UpperCAmelCase = parser.add_subp... | 126 |
'''simple docstring'''
import re
from filelock import FileLock
try:
import nltk
_A: Optional[int] = True
except (ImportError, ModuleNotFoundError):
_A: Dict = False
if NLTK_AVAILABLE:
with FileLock(""".lock""") as lock:
nltk.download("""punkt"... | 126 | 1 |
'''simple docstring'''
import re
def _lowerCAmelCase ( _lowerCAmelCase )-> list:
return [char.split() for char in re.split(r'[^ a-z A-Z 0-9 \s]' , str_ )]
def _lowerCAmelCase ( _lowerCAmelCase )-> str:
__UpperCAmelCase = split_input(str_ )
return "".joi... | 126 |
'''simple docstring'''
def _lowerCAmelCase ( _lowerCAmelCase = 10_00 )-> int:
__UpperCAmelCase = 2**power
__UpperCAmelCase = 0
while n:
__UpperCAmelCase , __UpperCAmelCase = r + n % 10, n // 10
return r
if __name__ == "__main__":
print(solution(int(str(input()).... | 126 | 1 |
'''simple docstring'''
import inspect
import unittest
from huggingface_hub import hf_hub_download
from transformers import ASTConfig
from transformers.testing_utils import require_torch, require_torchaudio, slow, torch_device
from transformers.utils import cached_property, is_torch_available, is_torchaudio_... | 126 |
'''simple docstring'''
from typing import Any
import numpy as np
def _lowerCAmelCase ( _lowerCAmelCase )-> bool:
return np.array_equal(_lowerCAmelCase , matrix.conjugate().T )
def _lowerCAmelCase ( _lowerCAmelCase , _lowerCAmelCase )-> Any:
__UpperCAmel... | 126 | 1 |
'''simple docstring'''
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 _lowerCAmelCase ( _lowerCAmelCase )-... | 126 |
'''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... | 126 | 1 |
'''simple docstring'''
from __future__ import annotations
from math import pi
from typing import Protocol
import matplotlib.pyplot as plt
import numpy as np
class UpperCAmelCase ( UpperCAmelCase_ ):
def __lowerCamelCase ( self , __A ):
return 0.0
def _lo... | 126 |
'''simple docstring'''
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 UpperCAmelCase ( UpperCAmelCase_ ... | 126 | 1 |
'''simple docstring'''
import importlib
import torch
import yaml
from omegaconf import OmegaConf
from taming.models.vqgan import VQModel
def _lowerCAmelCase ( _lowerCAmelCase , _lowerCAmelCase=False )-> Union[str, Any]:
__UpperCAmelCase = OmegaConf.load(_lowerCAmelCase )
... | 126 |
'''simple docstring'''
from collections import Counter
import numpy as np
from sklearn import datasets
from sklearn.model_selection import train_test_split
_A: List[Any] = datasets.load_iris()
_A: Union[str, Any] = np.array(data["""data"""])
_A: Union[str, Any] ... | 126 | 1 |
'''simple docstring'''
def _lowerCAmelCase ( _lowerCAmelCase , _lowerCAmelCase , _lowerCAmelCase )-> bool:
return not any(
neighbour == 1 and colored_vertices[i] == color
for i, neighbour in enumerate(_lowerCAmelCase ) )
def _lowerCAmelCase ( _lowerCAme... | 126 |
'''simple docstring'''
from pathlib import Path
import fire
from tqdm import tqdm
def _lowerCAmelCase ( _lowerCAmelCase="ro" , _lowerCAmelCase="en" , _lowerCAmelCase="wmt16" , _lowerCAmelCase=None )-> None:
try:
import datasets
except (ModuleNotFoundError, Imp... | 126 | 1 |
'''simple docstring'''
import copy
import os
from typing import Union
from ...configuration_utils import PretrainedConfig
from ...models.auto.modeling_auto import MODEL_FOR_CAUSAL_LM_MAPPING_NAMES
from ...utils import logging
from ..auto import CONFIG_MAPPING
_A: List[str] = logging.get_... | 126 |
'''simple docstring'''
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_... | 126 | 1 |
'''simple docstring'''
from __future__ import annotations
from cmath import sqrt
def _lowerCAmelCase ( _lowerCAmelCase , _lowerCAmelCase , _lowerCAmelCase )-> tuple[complex, complex]:
if a == 0:
raise ValueError('Coefficient \'a\' must not be zero.' )
__UpperCAmelC... | 126 |
'''simple docstring'''
from __future__ import annotations
import unittest
from transformers import AutoTokenizer, MBartConfig, is_tf_available
from transformers.testing_utils import require_sentencepiece, require_tf, require_tokenizers, slow
from transformers.utils import cached_property
from ...test_confi... | 126 | 1 |
'''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... | 126 |
'''simple docstring'''
from typing import TYPE_CHECKING
from ...utils import OptionalDependencyNotAvailable, _LazyModule, is_torch_available
_A: Optional[int] = {
"""configuration_lilt""": ["""LILT_PRETRAINED_CONFIG_ARCHIVE_MAP""", """LiltConfig"""],
}
try:
if not is_torch_avail... | 126 | 1 |
'''simple docstring'''
import os
def _lowerCAmelCase ( )-> Optional[int]:
__UpperCAmelCase = os.path.join(os.path.dirname(_lowerCAmelCase ) , 'num.txt' )
with open(_lowerCAmelCase ) as file_hand:
return str(sum(int(_lowerCAmelCase ) for line in file_hand ) ... | 126 |
'''simple docstring'''
import os
from datetime import datetime as dt
from github import Github
_A: Any = [
"""good first issue""",
"""feature request""",
"""wip""",
]
def _lowerCAmelCase ( )-> Optional[int]:
__UpperCAmelCase = Github(os.environ['GITHUB_TOKEN... | 126 | 1 |
'''simple docstring'''
from typing import TYPE_CHECKING
from ...utils import (
OptionalDependencyNotAvailable,
_LazyModule,
is_tf_available,
is_torch_available,
is_vision_available,
)
_A: str = {
"""configuration_blip""": [
"""BLIP_PRETRAINED_CONFIG_ARCHIV... | 126 |
'''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():
... | 126 | 1 |
'''simple docstring'''
def _lowerCAmelCase ( _lowerCAmelCase )-> list:
if len(_lowerCAmelCase ) <= 1:
return lst
__UpperCAmelCase = 1
while i < len(_lowerCAmelCase ):
if lst[i - 1] <= lst[i]:
i += 1
else:
__UpperCAmelCase , __UpperCAmelCase = lst[i], lst[... | 126 |
'''simple docstring'''
def _lowerCAmelCase ( _lowerCAmelCase , _lowerCAmelCase , _lowerCAmelCase )-> bool:
return not any(
neighbour == 1 and colored_vertices[i] == color
for i, neighbour in enumerate(_lowerCAmelCase ) )
def _lowerCAmelCase ( _lowerCAme... | 126 | 1 |
'''simple docstring'''
import warnings
from diffusers import StableDiffusionImgaImgPipeline # noqa F401
warnings.warn(
"""The `image_to_image.py` script is outdated. Please use directly `from diffusers import"""
""" StableDiffusionImg2ImgPipeline` instead."""
)
| 126 |
'''simple docstring'''
def _lowerCAmelCase ( _lowerCAmelCase , _lowerCAmelCase = " " )-> list:
__UpperCAmelCase = []
__UpperCAmelCase = 0
for index, char in enumerate(_lowerCAmelCase ):
if char == separator:
split_words.append(string[last_index:index] )
__Uppe... | 126 | 1 |
'''simple docstring'''
import heapq as hq
import math
from collections.abc import Iterator
class UpperCAmelCase :
def __init__( self , __A ):
__UpperCAmelCase = str(id_ )
__UpperCAmelCase = None
__UpperCAmelCase = None
__UpperCAmelCase ... | 126 |
'''simple docstring'''
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, ... | 126 | 1 |
'''simple docstring'''
import argparse
import requests
import torch
# pip3 install salesforce-lavis
# I'm actually installing a slightly modified version: pip3 install git+https://github.com/nielsrogge/LAVIS.git@fix_lavis_float32 (there's also the fix_lavis branch)
# also note: to convert Vicuna checkpoints... | 126 |
'''simple docstring'''
from __future__ import annotations
_A: Tuple = list[list[int]]
# assigning initial values to the grid
_A: Matrix = [
[3, 0, 6, 5, 0, 8, 4, 0, 0],
[5, 2, 0, 0, 0, 0, 0, 0, 0],
[0, 8, 7, 0, 0, 0, 0, 3, 1],
[0, 0, 3, 0, 1, 0, 0, 8, 0]... | 126 | 1 |
'''simple docstring'''
import shutil
import tempfile
import unittest
from transformers import SPIECE_UNDERLINE, BatchEncoding, MBartaaTokenizer, MBartaaTokenizerFast, is_torch_available
from transformers.testing_utils import (
get_tests_dir,
nested_simplify,
require_sentencepiece,
require_tok... | 126 |
'''simple docstring'''
import warnings
from ...utils import logging
from .image_processing_videomae import VideoMAEImageProcessor
_A: Any = logging.get_logger(__name__)
class UpperCAmelCase ( UpperCAmelCase_ ):
def __init__( self , *__A , **__A ):
... | 126 | 1 |
'''simple docstring'''
_A: Dict = """Tobias Carryer"""
from time import time
class UpperCAmelCase :
def __init__( self , __A , __A , __A , __A=int(time() ) ): # noqa: B008
__UpperCAmelCase = multiplier
__UpperCAmelCase ... | 126 |
'''simple docstring'''
import json
import os
import shutil
import tempfile
import unittest
import numpy as np
import pytest
from transformers import CLIPTokenizer, CLIPTokenizerFast
from transformers.models.clip.tokenization_clip import VOCAB_FILES_NAMES
from transformers.testing_utils import require_vision... | 126 | 1 |
'''simple docstring'''
import warnings
from ...utils import logging
from .image_processing_videomae import VideoMAEImageProcessor
_A: Any = logging.get_logger(__name__)
class UpperCAmelCase ( UpperCAmelCase_ ):
def __init__( self , *__A , **__A ):
... | 126 |
'''simple docstring'''
from __future__ import annotations
def _lowerCAmelCase ( _lowerCAmelCase )-> bool:
__UpperCAmelCase = len(_lowerCAmelCase )
# We need to create solution object to save path.
__UpperCAmelCase = [[0 for _ in range(_lowerCAmelCase )] for _ in range(_lo... | 126 | 1 |
'''simple docstring'''
import os
import unicodedata
from shutil import copyfile
from typing import Any, Dict, List, Optional, Tuple
import sentencepiece as spm
from ...tokenization_utils import AddedToken, PreTrainedTokenizer
from ...utils import logging
_A: Dict = logging.get_logger(__... | 126 |
'''simple docstring'''
import copy
import os
from typing import Union
from ...configuration_utils import PretrainedConfig
from ...models.auto.modeling_auto import MODEL_FOR_CAUSAL_LM_MAPPING_NAMES
from ...utils import logging
from ..auto import CONFIG_MAPPING
_A: List[str] = logging.get_... | 126 | 1 |
'''simple docstring'''
from transformers import BertTokenizerFast
from .custom_tokenization import CustomTokenizer
class UpperCAmelCase ( UpperCAmelCase_ ):
_A : Optional[int] = CustomTokenizer
pass
| 126 |
'''simple docstring'''
import string
# frequency taken from https://en.wikipedia.org/wiki/Letter_frequency
_A: Optional[Any] = {
"""E""": 12.70,
"""T""": 9.06,
"""A""": 8.17,
"""O""": 7.51,
"""I""": 6.97,
"""N""": 6.75,
"""S""": 6.33,
"""H""": 6.09,
"""R... | 126 | 1 |
'''simple docstring'''
import pytest
from datasets.parallel import ParallelBackendConfig, parallel_backend
from datasets.utils.py_utils import map_nested
from .utils import require_dill_gt_0_3_2, require_joblibspark, require_not_windows
def _lowerCAmelCase ( _lowerCAmelCase )-> Dict: # pickl... | 126 |
'''simple docstring'''
from transformers import BertTokenizerFast
from .custom_tokenization import CustomTokenizer
class UpperCAmelCase ( UpperCAmelCase_ ):
_A : Optional[int] = CustomTokenizer
pass
| 126 | 1 |
'''simple docstring'''
from collections.abc import Sequence
from queue import Queue
class UpperCAmelCase :
def __init__( self , __A , __A , __A , __A=None , __A=None ):
__UpperCAmelCase = start
__UpperCAmelCase = end
__UpperCAmelCa... | 126 |
'''simple docstring'''
import re
from filelock import FileLock
try:
import nltk
_A: Optional[int] = True
except (ImportError, ModuleNotFoundError):
_A: Dict = False
if NLTK_AVAILABLE:
with FileLock(""".lock""") as lock:
nltk.download("""punkt"... | 126 | 1 |
'''simple docstring'''
import itertools
import random
import unittest
import numpy as np
from transformers import is_speech_available
from transformers.testing_utils import require_torch, require_torchaudio
from ...test_sequence_feature_extraction_common import SequenceFeatureExtractionTestMixin
if is_sp... | 126 |
'''simple docstring'''
def _lowerCAmelCase ( _lowerCAmelCase = 10_00 )-> int:
__UpperCAmelCase = 2**power
__UpperCAmelCase = 0
while n:
__UpperCAmelCase , __UpperCAmelCase = r + n % 10, n // 10
return r
if __name__ == "__main__":
print(solution(int(str(input()).... | 126 | 1 |
'''simple docstring'''
import qiskit
def _lowerCAmelCase ( _lowerCAmelCase , _lowerCAmelCase )-> qiskit.result.counts.Counts:
__UpperCAmelCase = qiskit.Aer.get_backend('aer_simulator' )
__UpperCAmelCase = qiskit.QuantumCircuit(4 , 2 )
# encode inputs ... | 126 |
'''simple docstring'''
from typing import Any
import numpy as np
def _lowerCAmelCase ( _lowerCAmelCase )-> bool:
return np.array_equal(_lowerCAmelCase , matrix.conjugate().T )
def _lowerCAmelCase ( _lowerCAmelCase , _lowerCAmelCase )-> Any:
__UpperCAmel... | 126 | 1 |
'''simple docstring'''
import random
import torch
from huggingface_hub import HfApi
from diffusers import UNetaDModel
_A: Union[str, Any] = HfApi()
_A: Any = {}
# fmt: off
_A: int = torch.tensor([
-0.75_15, -1.68_83, 0.24_20, 0.03_00, 0.63_47, ... | 126 |
'''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... | 126 | 1 |
'''simple docstring'''
def _lowerCAmelCase ( _lowerCAmelCase )-> int:
assert column_title.isupper()
__UpperCAmelCase = 0
__UpperCAmelCase = len(_lowerCAmelCase ) - 1
__UpperCAmelCase = 0
while index >= 0:
__UpperCAmelCase = (ord(column_title[index] ) - 64) * pow... | 126 |
'''simple docstring'''
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 UpperCAmelCase ( UpperCAmelCase_ ... | 126 | 1 |
'''simple docstring'''
from collections import OrderedDict
from typing import Mapping
from ...configuration_utils import PretrainedConfig
from ...onnx import OnnxConfig
_A: str = {
"""albert-base-v1""": """https://huggingface.co/albert-base-v1/resolve/main/config.json""",
"""albe... | 126 |
'''simple docstring'''
from collections import Counter
import numpy as np
from sklearn import datasets
from sklearn.model_selection import train_test_split
_A: List[Any] = datasets.load_iris()
_A: Union[str, Any] = np.array(data["""data"""])
_A: Union[str, Any] ... | 126 | 1 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.