code
stringlengths
81
54k
code_codestyle
int64
0
721
style_context
stringlengths
91
41.9k
style_context_codestyle
int64
0
699
label
int64
0
1
'''simple docstring''' import os def _lowerCAmelCase ( ): with open(os.path.dirname(A__ ) + '/p022_names.txt' ) as file: lowercase__ = str(file.readlines()[0] ) lowercase__ = names.replace('"' , '' ).split(',' ) names.sort() lowercase__ ...
702
import unittest from transformers import load_tool from .test_tools_common import ToolTesterMixin class UpperCAmelCase__( unittest.TestCase , lowerCamelCase ): '''simple docstring''' def UpperCAmelCase ( self : List[str]) -> Any: """simple docstring"...
642
0
from __future__ import annotations a__ : Tuple = [True] * 1_00_00_01 a__ : Tuple = 2 while i * i <= 1_00_00_00: if seive[i]: for j in range(i * i, 1_00_00_01, i): a__ : Optional[int] = False i += 1 def _lowerCAmelCase ...
703
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__( lowerCamelCase ): '''simple docstring''' A : List[Any] ...
642
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__ : int = logging.get_logger(__name__) a__ : Tuple = {"vocab_file": "vocab.txt"} a__ : int...
704
from maths.is_square_free import is_square_free from maths.prime_factors import prime_factors def _lowerCAmelCase ( A__ ): lowercase__ = prime_factors(A__ ) if is_square_free(A__ ): return -1 if len(A__ ) % 2 else 1 return 0 if __name__ == "__main__": import doc...
642
0
import math def _lowerCAmelCase ( A__ ): return math.sqrt(A__ ) * math.sqrt(A__ ) == num def _lowerCAmelCase ( A__ ): lowercase__ = 0 lowercase__ = n while left <= right: lowercase__ = (left + right) // 2 if mid**2 == n: ...
705
from ...configuration_utils import PretrainedConfig from ...utils import logging from ...utils.backbone_utils import BackboneConfigMixin, get_aligned_output_features_output_indices a__ : List[str] = logging.get_logger(__name__) a__ : List[Any] = { "microsoft/focalnet-tiny": "https:/...
642
0
from typing import TYPE_CHECKING from ...utils import OptionalDependencyNotAvailable, _LazyModule, is_torch_available a__ : Any = { "configuration_lilt": ["LILT_PRETRAINED_CONFIG_ARCHIVE_MAP", "LiltConfig"], } try: if not is_torch_available(): raise OptionalDependencyNotAva...
706
import json import os from typing import Dict, List, Optional, Tuple import regex as re from ...tokenization_utils import PreTrainedTokenizer from ...utils import logging a__ : Optional[int] = logging.get_logger(__name__) a__ : Dict = { "vocab_file": "vocab.json", "merges_fil...
642
0
import argparse import json import requests import torch from huggingface_hub import hf_hub_download from PIL import Image from transformers import SegformerImageProcessor, SwinConfig, UperNetConfig, UperNetForSemanticSegmentation def _lowerCAmelCase ( A__ ): lowercase__ = 384 lowercase...
707
from typing import TYPE_CHECKING from ...utils import ( OptionalDependencyNotAvailable, _LazyModule, is_flax_available, is_tf_available, is_tokenizers_available, is_torch_available, ) a__ : Optional[int] = { "configuration_blenderbot": [ "BLENDERBOT_PRETRAINED_CON...
642
0
import datetime import platform import subprocess from typing import Optional, Tuple, Union import numpy as np def _lowerCAmelCase ( A__ , A__ ): lowercase__ = F'''{sampling_rate}''' lowercase__ = '1' lowercase__ = 'f32le' lowercase__ = [ 'ffmpe...
708
import heapq import sys import numpy as np a__ : Dict = tuple[int, int] class UpperCAmelCase__: '''simple docstring''' def __init__( self : List[str]) -> Any: """simple docstring""" lowercase__ = [] lowercase__ = set() def ...
642
0
import pytest from datasets.utils.sharding import _distribute_shards, _number_of_shards_in_gen_kwargs, _split_gen_kwargs @pytest.mark.parametrize( 'kwargs, expected' , [ ({'num_shards': 0, 'max_num_jobs': 1}, []), ({'num_shards': 10, 'max_num_jobs': 1}, [range(10 )]), ({'num_shar...
709
import math import sys def _lowerCAmelCase ( A__ ): lowercase__ = '' try: with open(A__ , 'rb' ) as binary_file: lowercase__ = binary_file.read() for dat in data: lowercase__ = F'''{dat:08b}''' r...
642
0
from typing import Callable, Optional, Union from ...configuration_utils import PretrainedConfig from ...utils import logging a__ : Union[str, Any] = logging.get_logger(__name__) a__ : Union[str, Any] = { "microsoft/xprophetnet-large-wiki100-cased": ( "https://huggingface.c...
710
import os from typing import List, Optional, Union from ...tokenization_utils import PreTrainedTokenizer from ...tokenization_utils_base import AddedToken from ...utils import logging a__ : int = logging.get_logger(__name__) a__ : Tuple = {"vocab_file": "vocab.txt"} a__ : int ...
642
0
'''simple docstring''' import argparse import os import evaluate import torch from datasets import load_dataset from torch.optim import AdamW from torch.utils.data import DataLoader from transformers import AutoModelForSequenceClassification, AutoTokenizer, get_linear_schedule_with_warmup, set_seed from acce...
711
from typing import Dict, List from nltk.translate import gleu_score import datasets from datasets import MetricInfo a__ : int = "\\n@misc{wu2016googles,\n title={Google's Neural Machine Translation System: Bridging the Gap between Human and Machine Translation},\n author={Yonghui Wu and M...
642
0
# Imports import numpy as np class UpperCAmelCase__: '''simple docstring''' def __init__( self : Any , lowerCAmelCase : Dict=None , lowerCAmelCase : List[Any]=None , lowerCAmelCase : List[Any]=None , lowerCAmelCase : List[str]=None , lowerCAmelCase :...
712
from __future__ import annotations import unittest from transformers import FunnelConfig, is_tf_available from transformers.testing_utils import require_tf from ...test_configuration_common import ConfigTester from ...test_modeling_tf_common import TFModelTesterMixin, ids_tensor, random_attention_mask from ...te...
642
0
import torch from diffusers import DDIMParallelScheduler from .test_schedulers import SchedulerCommonTest class UpperCAmelCase__( lowerCamelCase ): '''simple docstring''' A : str = (DDIMParallelScheduler,) A : Any = (("eta", 0.0), ("num_inference_step...
713
def _lowerCAmelCase ( A__ , A__ , A__ ): if principal <= 0: raise Exception('Principal borrowed must be > 0' ) if rate_per_annum < 0: raise Exception('Rate of interest must be >= 0' ) if years_to_repay <= 0 or not isinstance(A__ , A__ ): ...
642
0
from __future__ import annotations import unittest from transformers import is_tf_available from transformers.testing_utils import require_sentencepiece, require_tf, require_tokenizers, slow if is_tf_available(): import numpy as np import tensorflow as tf from transformers import TFCamembe...
714
from __future__ import annotations def _lowerCAmelCase ( A__ , A__ ): if b == 0: return (1, 0) ((lowercase__), (lowercase__)) = extended_euclid(A__ , a % b ) lowercase__ = a // b return (y, x - k * y) def _lowerCAmelCase ( A__ , A__...
642
0
import argparse import math import traceback import dateutil.parser as date_parser import requests def _lowerCAmelCase ( A__ ): lowercase__ = {} lowercase__ = job['started_at'] lowercase__ = job['completed_at'] lowercase__ = date_parser.parse(A__ ) lowe...
715
from typing import Mapping from ...configuration_utils import PretrainedConfig from ...onnx import OnnxSeqaSeqConfigWithPast from ...utils import logging a__ : Union[str, Any] = logging.get_logger(__name__) a__ : Optional[Any] = { "google/umt5-small": "https://huggingface.co/google...
642
0
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 UpperCAmelCase__( lowerCamelCase ): '''simple docs...
716
import pickle import shutil import tempfile import unittest from transformers import SPIECE_UNDERLINE, XGLMTokenizer, XGLMTokenizerFast from transformers.testing_utils import get_tests_dir, require_sentencepiece, require_tokenizers, slow from transformers.utils import cached_property from ...test_tokenization_com...
642
0
from __future__ import annotations def _lowerCAmelCase ( A__ , A__ ): if partitions <= 0: raise ValueError('partitions must be a positive number!' ) if partitions > number_of_bytes: raise ValueError('partitions can not > number_of_bytes!' ) lowercase__ =...
717
import argparse import hashlib # hashlib is only used inside the Test class import struct class UpperCAmelCase__: '''simple docstring''' def __init__( self : Optional[Any] , lowerCAmelCase : str) -> Optional[int]: """simple docstring""" lowercase__ ...
642
0
def _lowerCAmelCase ( A__ , A__ , A__ , A__ ): if height >= 1: move_tower(height - 1 , A__ , A__ , A__ ) move_disk(A__ , A__ ) move_tower(height - 1 , A__ , A__ , A__ ) def _lowerCAmelCase ( A...
718
import json from typing import List, Optional, Tuple from tokenizers import pre_tokenizers, processors from ...tokenization_utils_base import AddedToken, BatchEncoding from ...tokenization_utils_fast import PreTrainedTokenizerFast from ...utils import logging from .tokenization_bart import BartTokenizer a__ ...
642
0
from pathlib import Path import fire def _lowerCAmelCase ( A__ , A__ , A__ ): lowercase__ = Path(A__ ) lowercase__ = Path(A__ ) dest_dir.mkdir(exist_ok=A__ ) for path in src_dir.iterdir(): lowercase__ = [x.rstrip() for x in list(path.open().r...
719
import torch from diffusers import DDIMParallelScheduler from .test_schedulers import SchedulerCommonTest class UpperCAmelCase__( lowerCamelCase ): '''simple docstring''' A : str = (DDIMParallelScheduler,) A : Any = (("eta", 0.0), ("num_inference_step...
642
0
import json import os import sys import tempfile import unittest from pathlib import Path from shutil import copyfile from huggingface_hub import HfFolder, Repository, create_repo, delete_repo from requests.exceptions import HTTPError import transformers from transformers import ( CONFIG_MAPPING, FEATURE_...
720
import cva import numpy as np class UpperCAmelCase__: '''simple docstring''' def __init__( self : Union[str, Any] , lowerCAmelCase : float , lowerCAmelCase : int) -> Dict: """simple docstring""" if k in (0.04, 0.06): lowercase__ ...
642
0
from typing import TYPE_CHECKING from ...utils import ( OptionalDependencyNotAvailable, _LazyModule, is_tf_available, is_tokenizers_available, is_torch_available, ) a__ : List[str] = { "configuration_funnel": ["FUNNEL_PRETRAINED_CONFIG_ARCHIVE_MAP", "FunnelConfig"], "conv...
721
from ...configuration_utils import PretrainedConfig from ...utils import logging a__ : Dict = logging.get_logger(__name__) a__ : List[Any] = { "facebook/s2t-small-librispeech-asr": ( "https://huggingface.co/facebook/s2t-small-librispeech-asr/resolve/main/config.json" ), ...
642
0
def _lowerCAmelCase ( A__ ): if not isinstance(A__ , A__ ) or number < 0: raise ValueError('Input must be a non-negative integer' ) lowercase__ = 0 while number: # This way we arrive at next set bit (next 1) instead of looping # through e...
700
from typing import TYPE_CHECKING from ...utils import ( OptionalDependencyNotAvailable, _LazyModule, is_sentencepiece_available, is_tokenizers_available, is_torch_available, ) a__ : Any = {"configuration_reformer": ["REFORMER_PRETRAINED_CONFIG_ARCHIVE_MAP", "ReformerConfig"]} tr...
642
0
import json from typing import List, Optional, Tuple from tokenizers import pre_tokenizers, processors from ...tokenization_utils_base import AddedToken, BatchEncoding from ...tokenization_utils_fast import PreTrainedTokenizerFast from ...utils import logging from .tokenization_bart import BartTokenizer a__ ...
701
# Imports import numpy as np class UpperCAmelCase__: '''simple docstring''' def __init__( self : Any , lowerCAmelCase : Dict=None , lowerCAmelCase : List[Any]=None , lowerCAmelCase : List[Any]=None , lowerCAmelCase : List[str]=None , lowerCAmelCase :...
642
0
'''simple docstring''' 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 Option...
702
import unittest from transformers import load_tool from .test_tools_common import ToolTesterMixin class UpperCAmelCase__( unittest.TestCase , lowerCamelCase ): '''simple docstring''' def UpperCAmelCase ( self : List[str]) -> Any: """simple docstring"...
642
0
import argparse import struct import unittest class UpperCAmelCase__: '''simple docstring''' def __init__( self : Optional[Any] , lowerCAmelCase : bytes) -> None: """simple docstring""" lowercase__ = data # Initialize hash values ...
703
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__( lowerCamelCase ): '''simple docstring''' A : List[Any] ...
642
0
import unittest from transformers import is_flax_available from transformers.testing_utils import require_flax, require_sentencepiece, require_tokenizers, require_torch, slow if is_flax_available(): import optax from flax.training.common_utils import onehot from transformers import AutoTok...
704
from maths.is_square_free import is_square_free from maths.prime_factors import prime_factors def _lowerCAmelCase ( A__ ): lowercase__ = prime_factors(A__ ) if is_square_free(A__ ): return -1 if len(A__ ) % 2 else 1 return 0 if __name__ == "__main__": import doc...
642
0
import os import socket from contextlib import contextmanager import torch from ..commands.config.default import write_basic_config # noqa: F401 from ..state import PartialState from .dataclasses import DistributedType from .imports import is_deepspeed_available, is_tpu_available from .transformer_engine import ...
705
from ...configuration_utils import PretrainedConfig from ...utils import logging from ...utils.backbone_utils import BackboneConfigMixin, get_aligned_output_features_output_indices a__ : List[str] = logging.get_logger(__name__) a__ : List[Any] = { "microsoft/focalnet-tiny": "https:/...
642
0
import functools def _lowerCAmelCase ( A__ , A__ ): lowercase__ = len(A__ ) lowercase__ = len(A__ ) @functools.cache def min_distance(A__ , A__ ) -> int: # if first word index is overflow - delete all from the second word if indexa >= ...
706
import json import os from typing import Dict, List, Optional, Tuple import regex as re from ...tokenization_utils import PreTrainedTokenizer from ...utils import logging a__ : Optional[int] = logging.get_logger(__name__) a__ : Dict = { "vocab_file": "vocab.json", "merges_fil...
642
0
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 _lowerCAmelCase ( A__ , A__ , A__ ): lowercase__ = 1.5 lowercase__ = int(factor * n...
707
from typing import TYPE_CHECKING from ...utils import ( OptionalDependencyNotAvailable, _LazyModule, is_flax_available, is_tf_available, is_tokenizers_available, is_torch_available, ) a__ : Optional[int] = { "configuration_blenderbot": [ "BLENDERBOT_PRETRAINED_CON...
642
0
import unittest from transformers import is_vision_available from transformers.pipelines import pipeline from transformers.testing_utils import ( is_pipeline_test, nested_simplify, require_tf, require_torch, require_vision, slow, ) from .test_pipelines_common import ANY if is_vision_avai...
708
import heapq import sys import numpy as np a__ : Dict = tuple[int, int] class UpperCAmelCase__: '''simple docstring''' def __init__( self : List[str]) -> Any: """simple docstring""" lowercase__ = [] lowercase__ = set() def ...
642
0
from __future__ import annotations import math def _lowerCAmelCase ( A__ ): if 1 < number < 4: # 2 and 3 are primes return True elif number < 2 or number % 2 == 0 or number % 3 == 0: # Negatives, 0, 1, all even numbers, all multiples of 3 are not primes ...
709
import math import sys def _lowerCAmelCase ( A__ ): lowercase__ = '' try: with open(A__ , 'rb' ) as binary_file: lowercase__ = binary_file.read() for dat in data: lowercase__ = F'''{dat:08b}''' r...
642
0
import json import logging import os import re import sys from dataclasses import dataclass, field from typing import Any, Dict, List, Optional, Union import datasets import numpy as np import torch import torchaudio from packaging import version from torch import nn import transformers from transformers import (...
710
import os from typing import List, Optional, Union from ...tokenization_utils import PreTrainedTokenizer from ...tokenization_utils_base import AddedToken from ...utils import logging a__ : int = logging.get_logger(__name__) a__ : Tuple = {"vocab_file": "vocab.txt"} a__ : int ...
642
0
'''simple docstring''' from typing import TYPE_CHECKING from ...utils import ( OptionalDependencyNotAvailable, _LazyModule, is_flax_available, is_tf_available, is_torch_available, ) a__ : Union[str, Any] = { "configuration_vision_encoder_decoder": ["VisionEncoderDecoderC...
711
from typing import Dict, List from nltk.translate import gleu_score import datasets from datasets import MetricInfo a__ : int = "\\n@misc{wu2016googles,\n title={Google's Neural Machine Translation System: Bridging the Gap between Human and Machine Translation},\n author={Yonghui Wu and M...
642
0
from typing import TYPE_CHECKING from ...utils import ( OptionalDependencyNotAvailable, _LazyModule, is_sentencepiece_available, is_tokenizers_available, is_torch_available, ) a__ : int = { "configuration_llama": ["LLAMA_PRETRAINED_CONFIG_ARCHIVE_MAP", "LlamaConfig"], } try:...
712
from __future__ import annotations import unittest from transformers import FunnelConfig, is_tf_available from transformers.testing_utils import require_tf from ...test_configuration_common import ConfigTester from ...test_modeling_tf_common import TFModelTesterMixin, ids_tensor, random_attention_mask from ...te...
642
0
def _lowerCAmelCase ( A__ ): lowercase__ = set() # To detect a back edge, keep track of vertices currently in the recursion stack lowercase__ = set() return any( node not in visited and depth_first_search(A__ , A__ , A__ , A__ ) for no...
713
def _lowerCAmelCase ( A__ , A__ , A__ ): if principal <= 0: raise Exception('Principal borrowed must be > 0' ) if rate_per_annum < 0: raise Exception('Rate of interest must be >= 0' ) if years_to_repay <= 0 or not isinstance(A__ , A__ ): ...
642
0
from __future__ import annotations def _lowerCAmelCase ( A__ ): lowercase__ = [True] * limit lowercase__ = False lowercase__ = False lowercase__ = True for i in range(3 , int(limit**0.5 + 1 ) , 2 ): lowercase__ = i * 2 ...
714
from __future__ import annotations def _lowerCAmelCase ( A__ , A__ ): if b == 0: return (1, 0) ((lowercase__), (lowercase__)) = extended_euclid(A__ , a % b ) lowercase__ = a // b return (y, x - k * y) def _lowerCAmelCase ( A__ , A__...
642
0
import os import tempfile import unittest import uuid from pathlib import Path from transformers.testing_utils import get_tests_dir, require_soundfile, require_torch, require_vision from transformers.tools.agent_types import AgentAudio, AgentImage, AgentText from transformers.utils import is_soundfile_availble, is...
715
from typing import Mapping from ...configuration_utils import PretrainedConfig from ...onnx import OnnxSeqaSeqConfigWithPast from ...utils import logging a__ : Union[str, Any] = logging.get_logger(__name__) a__ : Optional[Any] = { "google/umt5-small": "https://huggingface.co/google...
642
0
import unittest from typing import Tuple import torch from diffusers.utils import floats_tensor, randn_tensor, torch_all_close, torch_device from diffusers.utils.testing_utils import require_torch @require_torch class UpperCAmelCase__: '''simple docstring''' @property def UpperCAmelCase ...
716
import pickle import shutil import tempfile import unittest from transformers import SPIECE_UNDERLINE, XGLMTokenizer, XGLMTokenizerFast from transformers.testing_utils import get_tests_dir, require_sentencepiece, require_tokenizers, slow from transformers.utils import cached_property from ...test_tokenization_com...
642
0
from collections import OrderedDict from typing import Mapping from packaging import version from ...configuration_utils import PretrainedConfig from ...onnx import OnnxConfig from ...utils import logging a__ : int = logging.get_logger(__name__) a__ : Tuple = { "google/mobilenet_v...
717
import argparse import hashlib # hashlib is only used inside the Test class import struct class UpperCAmelCase__: '''simple docstring''' def __init__( self : Optional[Any] , lowerCAmelCase : str) -> Optional[int]: """simple docstring""" lowercase__ ...
642
0
# limitations under the License. # NOTE: This file is deprecated and will be removed in a future version. # It only exists so that temporarely `from diffusers.pipelines import DiffusionPipeline` works from .pipelines import DiffusionPipeline, ImagePipelineOutput # noqa: F401 from .utils import deprecate dep...
718
import json from typing import List, Optional, Tuple from tokenizers import pre_tokenizers, processors from ...tokenization_utils_base import AddedToken, BatchEncoding from ...tokenization_utils_fast import PreTrainedTokenizerFast from ...utils import logging from .tokenization_bart import BartTokenizer a__ ...
642
0
from ...configuration_utils import PretrainedConfig from ...utils import logging from ...utils.backbone_utils import BackboneConfigMixin, get_aligned_output_features_output_indices a__ : List[str] = logging.get_logger(__name__) a__ : List[Any] = { "microsoft/focalnet-tiny": "https:/...
719
import torch from diffusers import DDIMParallelScheduler from .test_schedulers import SchedulerCommonTest class UpperCAmelCase__( lowerCamelCase ): '''simple docstring''' A : str = (DDIMParallelScheduler,) A : Any = (("eta", 0.0), ("num_inference_step...
642
0
def _lowerCAmelCase ( A__ , A__ ): while second != 0: lowercase__ = first & second first ^= second lowercase__ = c << 1 return first if __name__ == "__main__": import doctest doctest.testmod() a__ : int = ...
720
import cva import numpy as np class UpperCAmelCase__: '''simple docstring''' def __init__( self : Union[str, Any] , lowerCAmelCase : float , lowerCAmelCase : int) -> Dict: """simple docstring""" if k in (0.04, 0.06): lowercase__ ...
642
0
import argparse import torch from transformers import RemBertConfig, RemBertModel, load_tf_weights_in_rembert from transformers.utils import logging logging.set_verbosity_info() def _lowerCAmelCase ( A__ , A__ , A__ ): # Initialise PyTorch model lowercase__ = RemBertConfig...
721
from ...configuration_utils import PretrainedConfig from ...utils import logging a__ : Dict = logging.get_logger(__name__) a__ : List[Any] = { "facebook/s2t-small-librispeech-asr": ( "https://huggingface.co/facebook/s2t-small-librispeech-asr/resolve/main/config.json" ), ...
642
0
import tempfile import unittest from transformers import SPIECE_UNDERLINE, BatchEncoding, PLBartTokenizer, is_torch_available from transformers.testing_utils import ( get_tests_dir, nested_simplify, require_sentencepiece, require_tokenizers, require_torch, ) from ...test_tokenization_common...
700
from typing import TYPE_CHECKING from ...utils import ( OptionalDependencyNotAvailable, _LazyModule, is_sentencepiece_available, is_tokenizers_available, is_torch_available, ) a__ : Any = {"configuration_reformer": ["REFORMER_PRETRAINED_CONFIG_ARCHIVE_MAP", "ReformerConfig"]} tr...
642
0
import logging import os from dataclasses import dataclass, field from functools import partial from pathlib import Path from tempfile import TemporaryDirectory from typing import List, Optional import faiss import torch from datasets import Features, Sequence, Value, load_dataset from transformers import DPRCont...
701
# Imports import numpy as np class UpperCAmelCase__: '''simple docstring''' def __init__( self : Any , lowerCAmelCase : Dict=None , lowerCAmelCase : List[Any]=None , lowerCAmelCase : List[Any]=None , lowerCAmelCase : List[str]=None , lowerCAmelCase :...
642
0
'''simple docstring''' import csv import tweepy # Twitter API credentials a__ : Optional[int] = "" a__ : Union[str, Any] = "" a__ : str = "" a__ : Optional[Any] = "" def _lowerCAmelCase ( A__ ): # authorize twitter, initialize tweepy l...
702
import unittest from transformers import load_tool from .test_tools_common import ToolTesterMixin class UpperCAmelCase__( unittest.TestCase , lowerCamelCase ): '''simple docstring''' def UpperCAmelCase ( self : List[str]) -> Any: """simple docstring"...
642
0
def _lowerCAmelCase ( A__ ): lowercase__ = hex_num.strip() if not hex_num: raise ValueError('No value was passed to the function' ) lowercase__ = hex_num[0] == '-' if is_negative: lowercase__ = hex_num[1:] try: lowercase__ ...
703
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__( lowerCamelCase ): '''simple docstring''' A : List[Any] ...
642
0
import os import unittest from transformers import BatchEncoding from transformers.models.bert.tokenization_bert import ( BasicTokenizer, WordpieceTokenizer, _is_control, _is_punctuation, _is_whitespace, ) from transformers.models.prophetnet.tokenization_prophetnet import VOCAB_FILES_NAMES, Pr...
704
from maths.is_square_free import is_square_free from maths.prime_factors import prime_factors def _lowerCAmelCase ( A__ ): lowercase__ = prime_factors(A__ ) if is_square_free(A__ ): return -1 if len(A__ ) % 2 else 1 return 0 if __name__ == "__main__": import doc...
642
0
def _lowerCAmelCase ( A__ , A__ , A__ ): if principal <= 0: raise Exception('Principal borrowed must be > 0' ) if rate_per_annum < 0: raise Exception('Rate of interest must be >= 0' ) if years_to_repay <= 0 or not isinstance(A__ , A__ ): ...
705
from ...configuration_utils import PretrainedConfig from ...utils import logging from ...utils.backbone_utils import BackboneConfigMixin, get_aligned_output_features_output_indices a__ : List[str] = logging.get_logger(__name__) a__ : List[Any] = { "microsoft/focalnet-tiny": "https:/...
642
0
import tempfile import unittest import numpy as np from diffusers import ( DDIMScheduler, DPMSolverMultistepScheduler, EulerAncestralDiscreteScheduler, EulerDiscreteScheduler, LMSDiscreteScheduler, OnnxStableDiffusionPipeline, PNDMScheduler, ) from diffusers.utils.testing_utils import ...
706
import json import os from typing import Dict, List, Optional, Tuple import regex as re from ...tokenization_utils import PreTrainedTokenizer from ...utils import logging a__ : Optional[int] = logging.get_logger(__name__) a__ : Dict = { "vocab_file": "vocab.json", "merges_fil...
642
0
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__( lowerCamelCase ): '''simple docstring''' A : List[Any] ...
707
from typing import TYPE_CHECKING from ...utils import ( OptionalDependencyNotAvailable, _LazyModule, is_flax_available, is_tf_available, is_tokenizers_available, is_torch_available, ) a__ : Optional[int] = { "configuration_blenderbot": [ "BLENDERBOT_PRETRAINED_CON...
642
0
from datetime import datetime import requests from bsa import BeautifulSoup if __name__ == "__main__": a__ : str = input("Enter image url: ").strip() print(F'''Downloading image from {url} ...''') a__ : Tuple = BeautifulSoup(requests.get(url).content, "html.parser") ...
708
import heapq import sys import numpy as np a__ : Dict = tuple[int, int] class UpperCAmelCase__: '''simple docstring''' def __init__( self : List[str]) -> Any: """simple docstring""" lowercase__ = [] lowercase__ = set() def ...
642
0
import argparse from pathlib import Path import torch from packaging import version from torch.onnx import export from diffusers import AutoencoderKL a__ : List[str] = version.parse(version.parse(torch.__version__).base_version) < version.parse("1.11") def _lowerCAmelCase ( A__ , A_...
709
import math import sys def _lowerCAmelCase ( A__ ): lowercase__ = '' try: with open(A__ , 'rb' ) as binary_file: lowercase__ = binary_file.read() for dat in data: lowercase__ = F'''{dat:08b}''' r...
642
0
import argparse import json import torch from diffusers import DDPMScheduler, LDMPipeline, UNetaDModel, VQModel def _lowerCAmelCase ( A__ , A__=1 ): if n_shave_prefix_segments >= 0: return ".".join(path.split('.' )[n_shave_prefix_segments:] ) else: return ".".jo...
710
import os from typing import List, Optional, Union from ...tokenization_utils import PreTrainedTokenizer from ...tokenization_utils_base import AddedToken from ...utils import logging a__ : int = logging.get_logger(__name__) a__ : Tuple = {"vocab_file": "vocab.txt"} a__ : int ...
642
0
'''simple docstring''' from ...configuration_utils import PretrainedConfig from ...utils import logging a__ : Dict = logging.get_logger(__name__) a__ : List[Any] = { "facebook/s2t-small-librispeech-asr": ( "https://huggingface.co/facebook/s2t-small-librispeech-asr/resol...
711
from typing import Dict, List from nltk.translate import gleu_score import datasets from datasets import MetricInfo a__ : int = "\\n@misc{wu2016googles,\n title={Google's Neural Machine Translation System: Bridging the Gap between Human and Machine Translation},\n author={Yonghui Wu and M...
642
0
import pickle import shutil import tempfile import unittest from transformers import SPIECE_UNDERLINE, XGLMTokenizer, XGLMTokenizerFast from transformers.testing_utils import get_tests_dir, require_sentencepiece, require_tokenizers, slow from transformers.utils import cached_property from ...test_tokenization_com...
712
from __future__ import annotations import unittest from transformers import FunnelConfig, is_tf_available from transformers.testing_utils import require_tf from ...test_configuration_common import ConfigTester from ...test_modeling_tf_common import TFModelTesterMixin, ids_tensor, random_attention_mask from ...te...
642
0
# 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/LICENSE-2.0 # # Unless required by ...
713
def _lowerCAmelCase ( A__ , A__ , A__ ): if principal <= 0: raise Exception('Principal borrowed must be > 0' ) if rate_per_annum < 0: raise Exception('Rate of interest must be >= 0' ) if years_to_repay <= 0 or not isinstance(A__ , A__ ): ...
642
0
import gc import importlib.metadata import tempfile import unittest from packaging import version from transformers import ( AutoModel, AutoModelForCausalLM, AutoModelForSeqaSeqLM, AutoModelForSequenceClassification, AutoTokenizer, BitsAndBytesConfig, pipeline, ) from transformers.test...
714
from __future__ import annotations def _lowerCAmelCase ( A__ , A__ ): if b == 0: return (1, 0) ((lowercase__), (lowercase__)) = extended_euclid(A__ , a % b ) lowercase__ = a // b return (y, x - k * y) def _lowerCAmelCase ( A__ , A__...
642
0
import heapq import sys import numpy as np a__ = tuple[int, int] class UpperCAmelCase__: '''simple docstring''' def __init__( self : List[str]) -> Any: """simple docstring""" lowercase__ = [] lowercase__ = set() def UpperCAmelCa...
715
from typing import Mapping from ...configuration_utils import PretrainedConfig from ...onnx import OnnxSeqaSeqConfigWithPast from ...utils import logging a__ : Union[str, Any] = logging.get_logger(__name__) a__ : Optional[Any] = { "google/umt5-small": "https://huggingface.co/google...
642
0
def _lowerCAmelCase ( A__ ): if isinstance(A__ , A__ ): raise TypeError('\'float\' object cannot be interpreted as an integer' ) if isinstance(A__ , A__ ): raise TypeError('\'str\' object cannot be interpreted as an integer' ) if num == 0: ...
716
import pickle import shutil import tempfile import unittest from transformers import SPIECE_UNDERLINE, XGLMTokenizer, XGLMTokenizerFast from transformers.testing_utils import get_tests_dir, require_sentencepiece, require_tokenizers, slow from transformers.utils import cached_property from ...test_tokenization_com...
642
0
import unittest from parameterized import parameterized from transformers import OpenLlamaConfig, is_torch_available, set_seed from transformers.testing_utils import require_torch, torch_device from ...generation.test_utils import GenerationTesterMixin from ...test_configuration_common import ConfigTester from ....
717
import argparse import hashlib # hashlib is only used inside the Test class import struct class UpperCAmelCase__: '''simple docstring''' def __init__( self : Optional[Any] , lowerCAmelCase : str) -> Optional[int]: """simple docstring""" lowercase__ ...
642
0
from math import ceil def _lowerCAmelCase ( A__ , A__ ): lowercase__ = list(range(0 , A__ ) ) lowercase__ = [item for sublist in list(device_map.values() ) for item in sublist] # Duplicate check lowercase__ = [] for i in device_map_blocks: ...
718
import json from typing import List, Optional, Tuple from tokenizers import pre_tokenizers, processors from ...tokenization_utils_base import AddedToken, BatchEncoding from ...tokenization_utils_fast import PreTrainedTokenizerFast from ...utils import logging from .tokenization_bart import BartTokenizer a__ ...
642
0
from __future__ import annotations a__ : str = tuple[int, int, int] a__ : int = tuple[str, str, str] # used alphabet -------------------------- # from string.ascii_uppercase a__ : int = "ABCDEFGHIJKLMNOPQRSTUVWXYZ" # -------------------------- default selection -----------...
719
import torch from diffusers import DDIMParallelScheduler from .test_schedulers import SchedulerCommonTest class UpperCAmelCase__( lowerCamelCase ): '''simple docstring''' A : str = (DDIMParallelScheduler,) A : Any = (("eta", 0.0), ("num_inference_step...
642
0
from ...configuration_utils import PretrainedConfig from ...utils import logging a__ : Any = logging.get_logger(__name__) a__ : List[Any] = { "google/fnet-base": "https://huggingface.co/google/fnet-base/resolve/main/config.json", "google/fnet-large": "https://huggingface.co/goog...
720
import cva import numpy as np class UpperCAmelCase__: '''simple docstring''' def __init__( self : Union[str, Any] , lowerCAmelCase : float , lowerCAmelCase : int) -> Dict: """simple docstring""" if k in (0.04, 0.06): lowercase__ ...
642
0
from unittest import TestCase from datasets import Dataset from minhash_deduplication import deduplicate_dataset, make_duplicate_clusters def _lowerCAmelCase ( ): lowercase__ = { 'repo_name': ['test_repo1', 'test_repo2', 'test_repo3'], 'path': ['test_1.py', 'test_2.py', 'un...
721
from ...configuration_utils import PretrainedConfig from ...utils import logging a__ : Dict = logging.get_logger(__name__) a__ : List[Any] = { "facebook/s2t-small-librispeech-asr": ( "https://huggingface.co/facebook/s2t-small-librispeech-asr/resolve/main/config.json" ), ...
642
0
from typing import TYPE_CHECKING from ...utils import OptionalDependencyNotAvailable, _LazyModule, is_torch_available a__ : Tuple = { "configuration_table_transformer": [ "TABLE_TRANSFORMER_PRETRAINED_CONFIG_ARCHIVE_MAP", "TableTransformerConfig", "TableTransformerOnnx...
700
from typing import TYPE_CHECKING from ...utils import ( OptionalDependencyNotAvailable, _LazyModule, is_sentencepiece_available, is_tokenizers_available, is_torch_available, ) a__ : Any = {"configuration_reformer": ["REFORMER_PRETRAINED_CONFIG_ARCHIVE_MAP", "ReformerConfig"]} tr...
642
0
from abc import ABC, abstractmethod from typing import List, Optional class UpperCAmelCase__( lowerCamelCase ): '''simple docstring''' def __init__( self : Optional[Any]) -> Optional[Any]: """simple docstring""" self.test() def UpperCAmelCase ( ...
701
# Imports import numpy as np class UpperCAmelCase__: '''simple docstring''' def __init__( self : Any , lowerCAmelCase : Dict=None , lowerCAmelCase : List[Any]=None , lowerCAmelCase : List[Any]=None , lowerCAmelCase : List[str]=None , lowerCAmelCase :...
642
0
'''simple docstring''' from typing import Any, Dict, List, Optional, Tuple, Union import torch from torch import nn from torch.utils.data import DistributedSampler, RandomSampler from transformers import PreTrainedModel, Trainer, logging from transformers.integrations import is_fairscale_available from trans...
702
import unittest from transformers import load_tool from .test_tools_common import ToolTesterMixin class UpperCAmelCase__( unittest.TestCase , lowerCamelCase ): '''simple docstring''' def UpperCAmelCase ( self : List[str]) -> Any: """simple docstring"...
642
0
import argparse import json import os import fairseq import torch from torch import nn from transformers import ( SpeechaTextaConfig, SpeechaTextaForCausalLM, SpeechaTextaTokenizer, SpeechEncoderDecoderConfig, SpeechEncoderDecoderModel, WavaVecaConfig, WavaVecaFeatureExtractor, Wav...
703
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__( lowerCamelCase ): '''simple docstring''' A : List[Any] ...
642
0
from __future__ import annotations def _lowerCAmelCase ( A__ , A__ ): if b == 0: return (1, 0) ((lowercase__), (lowercase__)) = extended_euclid(A__ , a % b ) lowercase__ = a // b return (y, x - k * y) def _lowerCAmelCase ( A__ , A_...
704
from maths.is_square_free import is_square_free from maths.prime_factors import prime_factors def _lowerCAmelCase ( A__ ): lowercase__ = prime_factors(A__ ) if is_square_free(A__ ): return -1 if len(A__ ) % 2 else 1 return 0 if __name__ == "__main__": import doc...
642
0
import pytest import datasets.config from datasets.utils.info_utils import is_small_dataset @pytest.mark.parametrize('dataset_size' , [None, 400 * 2**20, 600 * 2**20] ) @pytest.mark.parametrize('input_in_memory_max_size' , ['default', 0, 100 * 2**20, 900 * 2**20] ) def _lowerCAmelCase ( A__ ...
705
from ...configuration_utils import PretrainedConfig from ...utils import logging from ...utils.backbone_utils import BackboneConfigMixin, get_aligned_output_features_output_indices a__ : List[str] = logging.get_logger(__name__) a__ : List[Any] = { "microsoft/focalnet-tiny": "https:/...
642
0
from itertools import zip_longest import requests from bsa import BeautifulSoup from pandas import DataFrame def _lowerCAmelCase ( A__ = "laptop" ): lowercase__ = F'''https://www.amazon.in/laptop/s?k={product}''' lowercase__ = { 'User-Agent': 'Mozilla/5.0 (X11; Linux x86_6...
706
import json import os from typing import Dict, List, Optional, Tuple import regex as re from ...tokenization_utils import PreTrainedTokenizer from ...utils import logging a__ : Optional[int] = logging.get_logger(__name__) a__ : Dict = { "vocab_file": "vocab.json", "merges_fil...
642
0
import coval # From: git+https://github.com/ns-moosavi/coval.git # noqa: F401 from coval.conll import reader, util from coval.eval import evaluator import datasets a__ : Dict = datasets.logging.get_logger(__name__) a__ : Tuple = "\\n@InProceedings{moosavi2019minimum,\n author = { ...
707
from typing import TYPE_CHECKING from ...utils import ( OptionalDependencyNotAvailable, _LazyModule, is_flax_available, is_tf_available, is_tokenizers_available, is_torch_available, ) a__ : Optional[int] = { "configuration_blenderbot": [ "BLENDERBOT_PRETRAINED_CON...
642
0
from __future__ import annotations import os from collections.abc import Mapping a__ : Union[str, Any] = tuple[int, int] class UpperCAmelCase__: '''simple docstring''' def __init__( self : Optional[int] , lowerCAmelCase : set[int] , lowerCAmelCase : Mapping...
708
import heapq import sys import numpy as np a__ : Dict = tuple[int, int] class UpperCAmelCase__: '''simple docstring''' def __init__( self : List[str]) -> Any: """simple docstring""" lowercase__ = [] lowercase__ = set() def ...
642
0
import requests def _lowerCAmelCase ( A__ , A__ ): lowercase__ = {'Content-Type': 'application/json'} lowercase__ = requests.post(A__ , json={'text': message_body} , headers=A__ ) if response.status_code != 200: lowercase__ = ( ...
709
import math import sys def _lowerCAmelCase ( A__ ): lowercase__ = '' try: with open(A__ , 'rb' ) as binary_file: lowercase__ = binary_file.read() for dat in data: lowercase__ = F'''{dat:08b}''' r...
642
0
def _lowerCAmelCase ( ): for n in range(1 , 1_000_000 ): yield n * (n + 1) // 2 def _lowerCAmelCase ( A__ ): lowercase__ = 1 lowercase__ = 2 while i * i <= n: lowercase__ = 0 while n % i == 0: n //=...
710
import os from typing import List, Optional, Union from ...tokenization_utils import PreTrainedTokenizer from ...tokenization_utils_base import AddedToken from ...utils import logging a__ : int = logging.get_logger(__name__) a__ : Tuple = {"vocab_file": "vocab.txt"} a__ : int ...
642
0
'''simple docstring''' import os import unittest from transformers.models.phobert.tokenization_phobert import VOCAB_FILES_NAMES, PhobertTokenizer from ...test_tokenization_common import TokenizerTesterMixin class UpperCAmelCase__( lowerCamelCase , unittest.TestCase ): '''simple d...
711
from typing import Dict, List from nltk.translate import gleu_score import datasets from datasets import MetricInfo a__ : int = "\\n@misc{wu2016googles,\n title={Google's Neural Machine Translation System: Bridging the Gap between Human and Machine Translation},\n author={Yonghui Wu and M...
642
0
from typing import TYPE_CHECKING from ...utils import ( OptionalDependencyNotAvailable, _LazyModule, is_flax_available, is_tf_available, is_tokenizers_available, is_torch_available, ) a__ : Optional[int] = { "configuration_blenderbot": [ "BLENDERBOT_PRETRAINED_CON...
712
from __future__ import annotations import unittest from transformers import FunnelConfig, is_tf_available from transformers.testing_utils import require_tf from ...test_configuration_common import ConfigTester from ...test_modeling_tf_common import TFModelTesterMixin, ids_tensor, random_attention_mask from ...te...
642
0
import argparse import json import os import torch from torch import nn from transformers import NllbMoeConfig, NllbMoeModel from transformers.modeling_utils import dtype_byte_size from transformers.utils import WEIGHTS_INDEX_NAME, WEIGHTS_NAME def _lowerCAmelCase ( A__ ): lowercase__ = [ ...
713
def _lowerCAmelCase ( A__ , A__ , A__ ): if principal <= 0: raise Exception('Principal borrowed must be > 0' ) if rate_per_annum < 0: raise Exception('Rate of interest must be >= 0' ) if years_to_repay <= 0 or not isinstance(A__ , A__ ): ...
642
0
import gc import unittest import numpy as np import torch from transformers import CLIPTextConfig, CLIPTextModel, CLIPTokenizer from diffusers import ( AutoencoderKL, DDIMScheduler, StableDiffusionSAGPipeline, UNetaDConditionModel, ) from diffusers.utils import slow, torch_device from diffusers.ut...
714
from __future__ import annotations def _lowerCAmelCase ( A__ , A__ ): if b == 0: return (1, 0) ((lowercase__), (lowercase__)) = extended_euclid(A__ , a % b ) lowercase__ = a // b return (y, x - k * y) def _lowerCAmelCase ( A__ , A__...
642
0
import re from typing import Callable, List, Optional, Union import tensorflow as tf try: from tensorflow.keras.optimizers.legacy import Adam except ImportError: from tensorflow.keras.optimizers import Adam class UpperCAmelCase__( tf.keras.optimizers.schedules.LearningRateSchedule ):...
715
from typing import Mapping from ...configuration_utils import PretrainedConfig from ...onnx import OnnxSeqaSeqConfigWithPast from ...utils import logging a__ : Union[str, Any] = logging.get_logger(__name__) a__ : Optional[Any] = { "google/umt5-small": "https://huggingface.co/google...
642
0
import inspect import unittest import torch import torch.nn as nn from accelerate.hooks import ( AlignDevicesHook, ModelHook, SequentialHook, add_hook_to_module, attach_align_device_hook, remove_hook_from_module, remove_hook_from_submodules, ) from accelerate.test_utils import require_...
716
import pickle import shutil import tempfile import unittest from transformers import SPIECE_UNDERLINE, XGLMTokenizer, XGLMTokenizerFast from transformers.testing_utils import get_tests_dir, require_sentencepiece, require_tokenizers, slow from transformers.utils import cached_property from ...test_tokenization_com...
642
0
import heapq def _lowerCAmelCase ( A__ ): lowercase__ = [] # for each node and his adjacency list add them and the rank of the node to queue # using heapq module the queue will be filled like a Priority Queue # heapq works with a min priority queue, so I used -1*len(v) to bui...
717
import argparse import hashlib # hashlib is only used inside the Test class import struct class UpperCAmelCase__: '''simple docstring''' def __init__( self : Optional[Any] , lowerCAmelCase : str) -> Optional[int]: """simple docstring""" lowercase__ ...
642
0
from itertools import product def _lowerCAmelCase ( A__ , A__ ): lowercase__ = sides_number lowercase__ = max_face_number * dice_number lowercase__ = [0] * (max_total + 1) lowercase__ = 1 lowercase__ = range(A__ , max_face_number + 1 )...
718
import json from typing import List, Optional, Tuple from tokenizers import pre_tokenizers, processors from ...tokenization_utils_base import AddedToken, BatchEncoding from ...tokenization_utils_fast import PreTrainedTokenizerFast from ...utils import logging from .tokenization_bart import BartTokenizer a__ ...
642
0
from __future__ import annotations import unittest from transformers import is_tf_available from transformers.testing_utils import require_tf, slow from ...test_configuration_common import ConfigTester from ...test_modeling_tf_common import TFModelTesterMixin, ids_tensor, random_attention_mask from ...test_pipel...
719
import torch from diffusers import DDIMParallelScheduler from .test_schedulers import SchedulerCommonTest class UpperCAmelCase__( lowerCamelCase ): '''simple docstring''' A : str = (DDIMParallelScheduler,) A : Any = (("eta", 0.0), ("num_inference_step...
642
0
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 BeitConfig, BeitForImageClassification, BeitForMaskedImageModeling, BeitImageProcessor from transformers.image_utils import PILImageResamplin...
720
import cva import numpy as np class UpperCAmelCase__: '''simple docstring''' def __init__( self : Union[str, Any] , lowerCAmelCase : float , lowerCAmelCase : int) -> Dict: """simple docstring""" if k in (0.04, 0.06): lowercase__ ...
642
0
import unittest from transformers import MPNetConfig, is_torch_available from transformers.testing_utils import require_torch, slow, torch_device from ...test_configuration_common import ConfigTester from ...test_modeling_common import ModelTesterMixin, ids_tensor, random_attention_mask from ...test_pipeline_mixi...
721
from ...configuration_utils import PretrainedConfig from ...utils import logging a__ : Dict = logging.get_logger(__name__) a__ : List[Any] = { "facebook/s2t-small-librispeech-asr": ( "https://huggingface.co/facebook/s2t-small-librispeech-asr/resolve/main/config.json" ), ...
642
0
from typing import TYPE_CHECKING from ...utils import OptionalDependencyNotAvailable, _LazyModule, is_torch_available a__ : Tuple = { "configuration_swinv2": ["SWINV2_PRETRAINED_CONFIG_ARCHIVE_MAP", "Swinv2Config"], } try: if not is_torch_available(): raise OptionalDepe...
700
from typing import TYPE_CHECKING from ...utils import ( OptionalDependencyNotAvailable, _LazyModule, is_sentencepiece_available, is_tokenizers_available, is_torch_available, ) a__ : Any = {"configuration_reformer": ["REFORMER_PRETRAINED_CONFIG_ARCHIVE_MAP", "ReformerConfig"]} tr...
642
0
import unittest from transformers import load_tool from .test_tools_common import ToolTesterMixin class UpperCAmelCase__( unittest.TestCase , lowerCamelCase ): '''simple docstring''' def UpperCAmelCase ( self : List[str]) -> Any: """simple docstring"...
701
# Imports import numpy as np class UpperCAmelCase__: '''simple docstring''' def __init__( self : Any , lowerCAmelCase : Dict=None , lowerCAmelCase : List[Any]=None , lowerCAmelCase : List[Any]=None , lowerCAmelCase : List[str]=None , lowerCAmelCase :...
642
0
'''simple docstring''' from sklearn.metrics import matthews_corrcoef import datasets a__ : Optional[Any] = "\nCompute the Matthews correlation coefficient (MCC)\n\nThe Matthews correlation coefficient is used in machine learning as a\nmeasure of the quality of binary and multiclass classificati...
702
import unittest from transformers import load_tool from .test_tools_common import ToolTesterMixin class UpperCAmelCase__( unittest.TestCase , lowerCamelCase ): '''simple docstring''' def UpperCAmelCase ( self : List[str]) -> Any: """simple docstring"...
642
0
import copy from ...configuration_utils import PretrainedConfig from ...utils import logging from ..auto import CONFIG_MAPPING a__ : Dict = logging.get_logger(__name__) a__ : Union[str, Any] = { "SenseTime/deformable-detr": "https://huggingface.co/sensetime/deformable-detr/reso...
703
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__( lowerCamelCase ): '''simple docstring''' A : List[Any] ...
642
0
from argparse import ArgumentParser from ..pipelines import Pipeline, PipelineDataFormat, get_supported_tasks, pipeline from ..utils import logging from . import BaseTransformersCLICommand a__ : Any = logging.get_logger(__name__) # pylint: disable=invalid-name def _lowerCAmelCase ( A__ )...
704
from maths.is_square_free import is_square_free from maths.prime_factors import prime_factors def _lowerCAmelCase ( A__ ): lowercase__ = prime_factors(A__ ) if is_square_free(A__ ): return -1 if len(A__ ) % 2 else 1 return 0 if __name__ == "__main__": import doc...
642
0
from typing import List, Optional, Union import numpy as np import tensorflow as tf from .utils import logging a__ : List[str] = logging.get_logger(__name__) def _lowerCAmelCase ( A__ ): if isinstance(A__ , np.ndarray ): return list(tensor.shape ) lowercase_...
705
from ...configuration_utils import PretrainedConfig from ...utils import logging from ...utils.backbone_utils import BackboneConfigMixin, get_aligned_output_features_output_indices a__ : List[str] = logging.get_logger(__name__) a__ : List[Any] = { "microsoft/focalnet-tiny": "https:/...
642
0
import fire from utils import calculate_rouge, save_json def _lowerCAmelCase ( A__ , A__ , A__=None , **A__ ): lowercase__ = [x.strip() for x in open(A__ ).readlines()] lowercase__ = [x.strip() for x in open(A__ ).readlines()][: len(A__ )] lowercase__ = ...
706
import json import os from typing import Dict, List, Optional, Tuple import regex as re from ...tokenization_utils import PreTrainedTokenizer from ...utils import logging a__ : Optional[int] = logging.get_logger(__name__) a__ : Dict = { "vocab_file": "vocab.json", "merges_fil...
642
0
import argparse import shutil import time from json import JSONDecodeError from logging import getLogger from pathlib import Path from typing import Dict, List import torch from torch.utils.data import DataLoader from tqdm import tqdm from transformers import AutoModelForSeqaSeqLM, AutoTokenizer from utils import...
707
from typing import TYPE_CHECKING from ...utils import ( OptionalDependencyNotAvailable, _LazyModule, is_flax_available, is_tf_available, is_tokenizers_available, is_torch_available, ) a__ : Optional[int] = { "configuration_blenderbot": [ "BLENDERBOT_PRETRAINED_CON...
642
0
from __future__ import annotations from collections.abc import Iterator class UpperCAmelCase__: '''simple docstring''' def __init__( self : Tuple , lowerCAmelCase : int) -> None: """simple docstring""" lowercase__ = value lowercase__ =...
708
import heapq import sys import numpy as np a__ : Dict = tuple[int, int] class UpperCAmelCase__: '''simple docstring''' def __init__( self : List[str]) -> Any: """simple docstring""" lowercase__ = [] lowercase__ = set() def ...
642
0
from typing import List from ...configuration_utils import PretrainedConfig from ...utils import logging a__ : int = logging.get_logger(__name__) a__ : Optional[Any] = { "snap-research/efficientformer-l1-300": ( "https://huggingface.co/snap-research/efficientformer-l1-300/r...
709
import math import sys def _lowerCAmelCase ( A__ ): lowercase__ = '' try: with open(A__ , 'rb' ) as binary_file: lowercase__ = binary_file.read() for dat in data: lowercase__ = F'''{dat:08b}''' r...
642
0
from typing import TYPE_CHECKING from ...utils import ( OptionalDependencyNotAvailable, _LazyModule, is_tf_available, is_torch_available, is_vision_available, ) a__ : Dict = {"configuration_deit": ["DEIT_PRETRAINED_CONFIG_ARCHIVE_MAP", "DeiTConfig", "DeiTOnnxConfig"]} try: ...
710
import os from typing import List, Optional, Union from ...tokenization_utils import PreTrainedTokenizer from ...tokenization_utils_base import AddedToken from ...utils import logging a__ : int = logging.get_logger(__name__) a__ : Tuple = {"vocab_file": "vocab.txt"} a__ : int ...
642
0
'''simple docstring''' import importlib import math import os from dataclasses import dataclass from enum import Enum from typing import Any, Dict, Optional, Tuple, Union import flax import jax.numpy as jnp from ..utils import BaseOutput a__ : Dict = "scheduler_config.json" class Uppe...
711
from typing import Dict, List from nltk.translate import gleu_score import datasets from datasets import MetricInfo a__ : int = "\\n@misc{wu2016googles,\n title={Google's Neural Machine Translation System: Bridging the Gap between Human and Machine Translation},\n author={Yonghui Wu and M...
642
0
import copy from typing import Dict, Optional from ...configuration_utils import PretrainedConfig from ...utils import logging from ..auto import CONFIG_MAPPING from ..detr import DetrConfig from ..swin import SwinConfig a__ : List[Any] = { "facebook/maskformer-swin-base-ade": ( "https:/...
712
from __future__ import annotations import unittest from transformers import FunnelConfig, is_tf_available from transformers.testing_utils import require_tf from ...test_configuration_common import ConfigTester from ...test_modeling_tf_common import TFModelTesterMixin, ids_tensor, random_attention_mask from ...te...
642
0
import math import sys import cva import numpy as np def _lowerCAmelCase ( A__ , A__ ): # For applying gaussian function for each element in matrix. lowercase__ = math.sqrt(A__ ) lowercase__ = 1 / (sigma * math.sqrt(2 * math.pi )) return cons * np.exp(-((img / sigm...
713
def _lowerCAmelCase ( A__ , A__ , A__ ): if principal <= 0: raise Exception('Principal borrowed must be > 0' ) if rate_per_annum < 0: raise Exception('Rate of interest must be >= 0' ) if years_to_repay <= 0 or not isinstance(A__ , A__ ): ...
642
0