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 shutil import tempfile import unittest import numpy as np import pytest from transformers.testing_utils import require_vision from transformers.utils import is_vision_available if is_vision_available(): from PIL import Image from transformers import ( AutoProcessor, ...
475
'''simple docstring''' import os from huggingface_hub.constants import HUGGINGFACE_HUB_CACHE, hf_cache_home __UpperCamelCase = HUGGINGFACE_HUB_CACHE __UpperCamelCase = "config.json" __UpperCamelCase = "diffusion_pytorch_model.bin" __UpperCamelCase ...
26
0
def _lowerCAmelCase ( _lowerCAmelCase ) -> bool: '''simple docstring''' __snake_case = (1 + 24 * n) ** 0.5 return ((1 + root) / 6) % 1 == 0 def _lowerCAmelCase ( _lowerCAmelCase = 5000 ) -> int: '''s...
371
'''simple docstring''' import argparse import json import re from pathlib import Path import requests import torch from huggingface_hub import hf_hub_download from PIL import Image from transformers import ( MobileNetVaConfig, MobileNetVaForImageClassification, Mobile...
26
0
import json import os from datetime import date from pathlib import Path from tabulate import DataRow, TableFormat, tabulate lowercase_: Any = TableFormat( lineabove=None, linebelowheader=None, linebetweenrows=None, linebelow=None, headerrow=DataRow('', '|', '|...
648
'''simple docstring''' from sklearn.metrics import recall_score import datasets __UpperCamelCase = "\nRecall is the fraction of the positive examples that were correctly labeled by the model as positive. It can be computed with the equation:\nRecall = TP / (TP + FN)\nWhere TP is...
26
0
"""simple docstring""" from random import shuffle import tensorflow as tf from numpy import array def lowerCAmelCase_ ( SCREAMING_SNAKE_CASE__, SCREAMING_SNAKE_CASE__ ) -> str: a_ : str = int(_lowerCamelCase ) assert noofclusters < len(_lowerCamelCase ) # Fi...
237
'''simple docstring''' from sklearn.metrics import matthews_corrcoef import datasets __UpperCamelCase = "\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...
26
0
"""simple docstring""" class a__ : def __init__( self : str) -> List[Any]: """simple docstring""" _lowerCAmelCase:Optional[Any] = 0 _lowerCAmelCase:List[Any] = 0 _lowerCAmelCase:List[Any] = {} ...
227
'''simple docstring''' import json import os from pathlib import Path import pytest from datasets.download.download_config import DownloadConfig from datasets.download.download_manager import DownloadManager from datasets.utils.file_utils import hash_url_to_filename __UpperCamelC...
26
0
def _lowerCamelCase ( __lowerCamelCase ) -> Any: '''simple docstring''' UpperCAmelCase__ : List[Any] = [0] * len(_lowerCamelCase ) UpperCAmelCase__ : List[Any] = [] UpperCAmelCase__ : List[Any] = [1] * le...
79
'''simple docstring''' def _a ( _lowerCamelCase = 100 ) -> int: """simple docstring""" __snake_case : Any = n * (n + 1) * (2 * n + 1) / 6 __snake_case : List[Any] = (n * (n + 1) / 2) ** 2 return int(s...
26
0
import argparse from collections import OrderedDict from pathlib import Path import requests import torch from PIL import Image from transformers import GLPNConfig, GLPNForDepthEstimation, GLPNImageProcessor from transformers.utils import logging logging.set_verbosity_info() snake_case_ : Optional[int] ...
488
'''simple docstring''' from __future__ import annotations from typing import Any class _A : def __init__( self : str , __magic_name__ : int , __magic_name__ : int , __magic_name__ : float = 0 ) -> None: """simple d...
26
0
def __SCREAMING_SNAKE_CASE ( a__ : List[str] = 100 ) -> int: __A : Any = n * (n + 1) * (2 * n + 1) / 6 __A : List[Any] = (n * (n + 1) / 2) ** 2 return int(square_of_sum - sum_of_squares ) if __name__ == "__main__": print(f"""{solution() = }""")
17
'''simple docstring''' 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 d...
26
0
"""simple docstring""" def __magic_name__ ( __snake_case : str , __snake_case : Optional[int] ) -> List[Any]: lowercase : Optional[Any] = [0 for i in range(r + 1 )] # nc0 = 1 lowercase : Optional[Any] ...
361
'''simple docstring''' import cva import numpy as np class _A : def __init__( self : Any , __magic_name__ : float , __magic_name__ : int ) -> Optional[int]: """simple docstring""" if k in (0.04, 0.06): __snake_c...
26
0
from __future__ import annotations def _SCREAMING_SNAKE_CASE ( lowercase : int , lowercase : Optional[Any] = None , lowercase : Union[str, Any] = None ): '''simple docstring''' if start is None: lowerCamelCase_ = ...
70
'''simple docstring''' import warnings from ...processing_utils import ProcessorMixin from ...tokenization_utils_base import BatchEncoding class _A ( __lowercase ): lowercase__: Any = ['''image_processor''', '''tokenizer'''] lowercase__: Any = ''...
26
0
"""simple docstring""" from .constants import ( MODEL_NAME, OPTIMIZER_NAME, RNG_STATE_NAME, SAFE_WEIGHTS_INDEX_NAME, SAFE_WEIGHTS_NAME, SCALER_NAME, SCHEDULER_NAME, TORCH_LAUNCH_PARAMS, WEIGHTS_INDEX_NAME, WEIGHTS_NAME, ) from .dataclasses import ( BnbQuantizatio...
512
'''simple docstring''' import datasets import faiss import numpy as np import streamlit as st import torch from elasticsearch import Elasticsearch from elia_utils import ( embed_questions_for_retrieval, make_qa_sas_model, qa_sas_generate, query_es_index, query_qa_...
26
0
from typing import TYPE_CHECKING from ...utils import ( OptionalDependencyNotAvailable, _LazyModule, is_tf_available, is_tokenizers_available, is_torch_available, ) A = { "configuration_longformer": [ "LONGFORMER_PRETRAINED_CONFIG_ARCHIVE_MAP", "Longfor...
475
'''simple docstring''' import warnings from ...utils import logging from .image_processing_owlvit import OwlViTImageProcessor __UpperCamelCase = logging.get_logger(__name__) class _A ( __lowercase ): def __init__( self : int , *__magic_name__ ...
26
0
def _lowerCAmelCase ( _lowerCAmelCase , _lowerCAmelCase ) -> str: '''simple docstring''' if a < 0 or b < 0: raise ValueError("the value of both inputs must be positive" ) __snake_case = str(bin(_lowerCamelCase ) )[2:] ...
371
'''simple docstring''' import argparse import torch from transformers import BlenderbotConfig, BlenderbotForConditionalGeneration from transformers.utils import logging logging.set_verbosity_info() __UpperCamelCase = logging.get_logger(__name__) __UpperCamelCase ...
26
0
import dataclasses import re import string from typing import Any, Dict, Iterator, List, Mapping, Optional, Sequence, Tuple import numpy as np from . import residue_constants lowercase_: List[Any] = Mapping[str, np.ndarray] lowercase_: int = Mapping[str, Any] # Is a...
648
'''simple docstring''' import argparse import os import re import packaging.version __UpperCamelCase = "examples/" __UpperCamelCase = { "examples": (re.compile(R"^check_min_version\(\"[^\"]+\"\)\s*$", re.MULTILINE), "check_min_version(\"VERSION\")\n"), "init...
26
0
"""simple docstring""" import json import os import unittest from transformers.models.biogpt.tokenization_biogpt import VOCAB_FILES_NAMES, BioGptTokenizer from transformers.testing_utils import slow from ...test_tokenization_common import TokenizerTesterMixin class snake_case_ ( __lowercase ,unit...
237
'''simple docstring''' from unittest import TestCase from datasets import Sequence, Value from datasets.arrow_dataset import Dataset class _A ( __lowercase ): def lowercase__ ( self : Any ) -> str: """simple docstring""" return [ ...
26
0
"""simple docstring""" from typing import TYPE_CHECKING from ...utils import OptionalDependencyNotAvailable, _LazyModule, is_torch_available UpperCamelCase__ = { '''configuration_table_transformer''': [ '''TABLE_TRANSFORMER_PRETRAINED_CONFIG_ARCHIVE_MAP''', '''TableTransformerC...
227
'''simple docstring''' 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...
26
0
import argparse import json from dataclasses import dataclass, field from functools import partial from pathlib import Path from typing import Callable, Dict, List, Tuple import timm import torch import torch.nn as nn from classy_vision.models.regnet import RegNet, RegNetParams, RegNetYaagf, Re...
79
'''simple docstring''' from __future__ import annotations __UpperCamelCase = [ [-1, 0], # left [0, -1], # down [1, 0], # right [0, 1], # up ] def _a ( _lowerCamelCase , _lowerCamelCase , _lowerCamelCase , _lowerCamelCas...
26
0
import unittest import numpy as np from transformers import RoFormerConfig, is_flax_available from transformers.testing_utils import require_flax, slow from ...test_modeling_flax_common import FlaxModelTesterMixin, ids_tensor, random_attention_mask if is_flax_available(): import jax.numpy as jnp from trans...
488
'''simple docstring''' def _a ( _lowerCamelCase ) -> int: """simple docstring""" if not isinstance(_lowerCamelCase , _lowerCamelCase ): raise TypeError("""only integers accepted as input""" ) else: __snake_case : List[Any] ...
26
0
from ...configuration_utils import PretrainedConfig from ...utils import logging UpperCAmelCase_ : str = logging.get_logger(__name__) UpperCAmelCase_ : Union[str, Any] = { '''MIT/ast-finetuned-audioset-10-10-0.4593''': ( '''https://huggingface.co/MIT/ast-finetuned-audioset-1...
17
'''simple docstring''' from __future__ import annotations import math def _a ( _lowerCamelCase , _lowerCamelCase , _lowerCamelCase , _lowerCamelCase , _lowerCamelCase ) -> int: """simple docstring""" if depth < 0: raise V...
26
0
"""simple docstring""" from typing import Dict, List from nltk.translate import gleu_score import datasets from datasets import MetricInfo _A : List[Any] = """\\n@misc{wu2016googles,\n title={Google's Neural Machine Translation System: Bridging the Gap between Human and Machin...
361
'''simple docstring''' from __future__ import annotations def _a ( _lowerCamelCase , _lowerCamelCase = None , _lowerCamelCase = None ) -> None: """simple docstring""" if start is None: __snake_case : Optional[Any] ...
26
0
from typing import TYPE_CHECKING from ...utils import ( OptionalDependencyNotAvailable, _LazyModule, is_sentencepiece_available, is_tf_available, is_tokenizers_available, is_torch_available, ) lowerCamelCase : int = {"configuration_xlnet": ["XLNET_...
70
'''simple docstring''' import doctest import logging import os import unittest from pathlib import Path from typing import List, Union import transformers from transformers.testing_utils import require_tf, require_torch, slow __UpperCamelCase = logging.getLogger() ...
26
0
"""simple docstring""" from ...utils import is_torch_available, is_transformers_available if is_transformers_available() and is_torch_available(): from .pipeline_vq_diffusion import LearnedClassifierFreeSamplingEmbeddings, VQDiffusionPipeline
512
'''simple docstring''' import inspect from typing import Callable, List, Optional, Union import torch from transformers import ( CLIPImageProcessor, CLIPTextModel, CLIPTokenizer, WhisperForConditionalGeneration, WhisperProcessor, ) from diffusers import ( ...
26
0
def __UpperCAmelCase ( __A ) -> str: '''simple docstring''' return " ".join(input_str.split()[::-1] ) if __name__ == "__main__": import doctest doctest.testmod()
475
'''simple docstring''' import os from huggingface_hub.constants import HUGGINGFACE_HUB_CACHE, hf_cache_home __UpperCamelCase = HUGGINGFACE_HUB_CACHE __UpperCamelCase = "config.json" __UpperCamelCase = "diffusion_pytorch_model.bin" __UpperCamelCase ...
26
0
import warnings from ...utils import logging from .image_processing_beit import BeitImageProcessor A : List[str] = logging.get_logger(__name__) class UpperCamelCase( __lowercase ): def __init__( self : str , *SCREAMING_SNAKE_CASE : Tuple , ...
371
'''simple docstring''' import argparse import json import re from pathlib import Path import requests import torch from huggingface_hub import hf_hub_download from PIL import Image from transformers import ( MobileNetVaConfig, MobileNetVaForImageClassification, Mobile...
26
0
lowercase_: Tuple = 0 # The first color of the flag. lowercase_: List[Any] = 1 # The second color of the flag. lowercase_: List[str] = 2 # The third color of the flag. lowercase_: int = (red, white, blue) def _lowercase ( UpperCAmelCase_): ...
648
'''simple docstring''' from sklearn.metrics import recall_score import datasets __UpperCamelCase = "\nRecall is the fraction of the positive examples that were correctly labeled by the model as positive. It can be computed with the equation:\nRecall = TP / (TP + FN)\nWhere TP is...
26
0
"""simple docstring""" from ...configuration_utils import PretrainedConfig from ...utils import logging SCREAMING_SNAKE_CASE_ = logging.get_logger(__name__) SCREAMING_SNAKE_CASE_ = { """microsoft/trocr-base-handwritten""": ( """https://huggingface.co/microsoft/trocr-base-han...
237
'''simple docstring''' from sklearn.metrics import matthews_corrcoef import datasets __UpperCamelCase = "\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...
26
0
"""simple docstring""" UpperCamelCase__ = '''Alexander Joslin''' import operator as op from .stack import Stack def UpperCAmelCase ( snake_case : List[str] ): _lowerCAmelCase:Dict = {"""*""": op.mul, """/""": op.truediv, """+""": op.add, """-""": op.sub} _l...
227
'''simple docstring''' import json import os from pathlib import Path import pytest from datasets.download.download_config import DownloadConfig from datasets.download.download_manager import DownloadManager from datasets.utils.file_utils import hash_url_to_filename __UpperCamelC...
26
0
from __future__ import annotations import math import random from typing import Any class UpperCAmelCase_ : def __init__( self ): UpperCAmelCase__ : list[Any] = [] UpperCAmelCase__ : int = 0 Upper...
79
'''simple docstring''' def _a ( _lowerCamelCase = 100 ) -> int: """simple docstring""" __snake_case : Any = n * (n + 1) * (2 * n + 1) / 6 __snake_case : List[Any] = (n * (n + 1) / 2) ** 2 return int(s...
26
0
import gc import unittest import numpy as np import torch from transformers import CLIPTextConfig, CLIPTextModelWithProjection, CLIPTokenizer from diffusers import HeunDiscreteScheduler, PriorTransformer, ShapEPipeline from diffusers.pipelines.shap_e import ShapERenderer from diffusers.utils import load_numpy, s...
488
'''simple docstring''' from __future__ import annotations from typing import Any class _A : def __init__( self : str , __magic_name__ : int , __magic_name__ : int , __magic_name__ : float = 0 ) -> None: """simple d...
26
0
from __future__ import annotations def __SCREAMING_SNAKE_CASE ( a__ : Optional[int] ,a__ : Any ,a__ : int ) -> int | float: if len(_lowerCamelCase ) == 0: raise ValueError("""find_max() arg is an empty sequence""" ) if ( left >= len(_lowerCamelCase ...
17
'''simple docstring''' 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 d...
26
0
"""simple docstring""" import random import timeit from functools import wraps from typing import Callable, Optional from ..configuration_utils import PretrainedConfig from ..models.auto.modeling_tf_auto import TF_MODEL_MAPPING, TF_MODEL_WITH_LM_HEAD_MAPPING from ..utils import is_pyanvml_available, ...
361
'''simple docstring''' import cva import numpy as np class _A : def __init__( self : Any , __magic_name__ : float , __magic_name__ : int ) -> Optional[int]: """simple docstring""" if k in (0.04, 0.06): __snake_c...
26
0
import io import json import fsspec import pytest from datasets import Dataset, DatasetDict, Features, NamedSplit, Value from datasets.io.json import JsonDatasetReader, JsonDatasetWriter from ..utils import assert_arrow_memory_doesnt_increase, assert_arrow_memory_increases def _SCREAMING_S...
70
'''simple docstring''' import warnings from ...processing_utils import ProcessorMixin from ...tokenization_utils_base import BatchEncoding class _A ( __lowercase ): lowercase__: Any = ['''image_processor''', '''tokenizer'''] lowercase__: Any = ''...
26
0
"""simple docstring""" def _A (__a ) -> bool: """simple docstring""" if not isinstance(_lowerCamelCase , _lowerCamelCase ): SCREAMING_SNAKE_CASE_ : Dict = f'Input value of [number={number}] must be an integer' raise TypeError(_low...
512
'''simple docstring''' import datasets import faiss import numpy as np import streamlit as st import torch from elasticsearch import Elasticsearch from elia_utils import ( embed_questions_for_retrieval, make_qa_sas_model, qa_sas_generate, query_es_index, query_qa_...
26
0
from typing import TYPE_CHECKING from ...utils import ( OptionalDependencyNotAvailable, _LazyModule, is_tf_available, is_tokenizers_available, is_torch_available, ) A = { "configuration_deberta": ["DEBERTA_PRETRAINED_CONFIG_ARCHIVE_MAP", "DebertaConfig", "DebertaOnnxConf...
475
'''simple docstring''' import warnings from ...utils import logging from .image_processing_owlvit import OwlViTImageProcessor __UpperCamelCase = logging.get_logger(__name__) class _A ( __lowercase ): def __init__( self : int , *__magic_name__ ...
26
0
from collections import OrderedDict from typing import TYPE_CHECKING, Any, Mapping, Optional from ...configuration_utils import PretrainedConfig from ...onnx import OnnxConfig from ...utils import logging if TYPE_CHECKING: from ... import FeatureExtractionMixin, TensorType A : Dict =...
371
'''simple docstring''' import argparse import torch from transformers import BlenderbotConfig, BlenderbotForConditionalGeneration from transformers.utils import logging logging.set_verbosity_info() __UpperCamelCase = logging.get_logger(__name__) __UpperCamelCase ...
26
0
from dataclasses import dataclass from typing import List, Optional, Union import numpy as np import PIL from ...utils import BaseOutput, OptionalDependencyNotAvailable, is_torch_available, is_transformers_available from .timesteps import ( fastaa_timesteps, smartaa_timesteps, smartaa_ti...
648
'''simple docstring''' import argparse import os import re import packaging.version __UpperCamelCase = "examples/" __UpperCamelCase = { "examples": (re.compile(R"^check_min_version\(\"[^\"]+\"\)\s*$", re.MULTILINE), "check_min_version(\"VERSION\")\n"), "init...
26
0
"""simple docstring""" import gc import unittest import numpy as np import torch from transformers import CLIPTextConfig, CLIPTextModel, XLMRobertaTokenizer from diffusers import AltDiffusionPipeline, AutoencoderKL, DDIMScheduler, PNDMScheduler, UNetaDConditionModel from diffusers.pipelines.alt_diffusion.modeling...
237
'''simple docstring''' from unittest import TestCase from datasets import Sequence, Value from datasets.arrow_dataset import Dataset class _A ( __lowercase ): def lowercase__ ( self : Any ) -> str: """simple docstring""" return [ ...
26
0
"""simple docstring""" from ...configuration_utils import PretrainedConfig from ...utils import logging UpperCamelCase__ = logging.get_logger(__name__) UpperCamelCase__ = { '''facebook/xglm-564M''': '''https://huggingface.co/facebook/xglm-564M/resolve/main/config.json''', # See all...
227
'''simple docstring''' 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...
26
0
import math import sys def _lowerCamelCase ( __lowerCamelCase ) -> str: '''simple docstring''' UpperCAmelCase__ : List[str] = """""" try: with open(_lowerCamelCase , """rb""" ) as binary_file: UpperC...
79
'''simple docstring''' from __future__ import annotations __UpperCamelCase = [ [-1, 0], # left [0, -1], # down [1, 0], # right [0, 1], # up ] def _a ( _lowerCamelCase , _lowerCamelCase , _lowerCamelCase , _lowerCamelCas...
26
0
def __a ( __UpperCAmelCase : List[str] , __UpperCAmelCase : Union[str, Any] , __UpperCAmelCase : str ) -> float: """simple docstring""" return round(float(moles / volume ) * nfactor ) def __a ( __UpperCAmelCase : Tupl...
488
'''simple docstring''' def _a ( _lowerCamelCase ) -> int: """simple docstring""" if not isinstance(_lowerCamelCase , _lowerCamelCase ): raise TypeError("""only integers accepted as input""" ) else: __snake_case : List[Any] ...
26
0
from collections.abc import Iterable from typing import Any class lowerCamelCase_ : def __init__( self : Optional[int] , __A : int | None = None ): __A : str = value __A : Node | None = None # Added in order to delete a node easier __A...
17
'''simple docstring''' from __future__ import annotations import math def _a ( _lowerCamelCase , _lowerCamelCase , _lowerCamelCase , _lowerCamelCase , _lowerCamelCase ) -> int: """simple docstring""" if depth < 0: raise V...
26
0
"""simple docstring""" from __future__ import annotations from fractions import Fraction def __magic_name__ ( __snake_case : List[Any] , __snake_case : Tuple ) -> bool: return ( num != den and num % 10 == den // 10 and (num // 10) / (den %...
361
'''simple docstring''' from __future__ import annotations def _a ( _lowerCamelCase , _lowerCamelCase = None , _lowerCamelCase = None ) -> None: """simple docstring""" if start is None: __snake_case : Optional[Any] ...
26
0
import copy import inspect import unittest from transformers import AutoBackbone from transformers.configuration_utils import PretrainedConfig from transformers.testing_utils import require_timm, require_torch, torch_device from transformers.utils.import_utils import is_torch_available from ...test...
70
'''simple docstring''' import doctest import logging import os import unittest from pathlib import Path from typing import List, Union import transformers from transformers.testing_utils import require_tf, require_torch, slow __UpperCamelCase = logging.getLogger() ...
26
0
"""simple docstring""" from typing import List from .keymap import KEYMAP, get_character def _A (__a ) -> int: """simple docstring""" def decorator(__a ): SCREAMING_SNAKE_CASE_ : str = getattr(_lowerCamelCase , '''handle_key''' ...
512
'''simple docstring''' import inspect from typing import Callable, List, Optional, Union import torch from transformers import ( CLIPImageProcessor, CLIPTextModel, CLIPTokenizer, WhisperForConditionalGeneration, WhisperProcessor, ) from diffusers import ( ...
26
0
import unittest from accelerate import debug_launcher from accelerate.test_utils import require_cpu, test_ops, test_script @require_cpu class lowercase__ ( unittest.TestCase ): def _UpperCAmelCase ( self : Tuple ): """simple docstring"""...
475
'''simple docstring''' import os from huggingface_hub.constants import HUGGINGFACE_HUB_CACHE, hf_cache_home __UpperCamelCase = HUGGINGFACE_HUB_CACHE __UpperCamelCase = "config.json" __UpperCamelCase = "diffusion_pytorch_model.bin" __UpperCamelCase ...
26
0
from __future__ import annotations import os import tempfile import unittest import numpy as np from huggingface_hub import hf_hub_download from transformers import is_tensorflow_text_available, is_tf_available from transformers.testing_utils import require_tensorflow_text, require_tf, slow from ....
371
'''simple docstring''' import argparse import json import re from pathlib import Path import requests import torch from huggingface_hub import hf_hub_download from PIL import Image from transformers import ( MobileNetVaConfig, MobileNetVaForImageClassification, Mobile...
26
0
from __future__ import annotations def _lowercase ( UpperCAmelCase_ , UpperCAmelCase_ , UpperCAmelCase_ , UpperCAmelCase_): # noqa: E741 """simple docstring""" while r - l > 1: snake_case__ : str = (l + r) // 2 if v[m] >= key: snake_...
648
'''simple docstring''' from sklearn.metrics import recall_score import datasets __UpperCamelCase = "\nRecall is the fraction of the positive examples that were correctly labeled by the model as positive. It can be computed with the equation:\nRecall = TP / (TP + FN)\nWhere TP is...
26
0
"""simple docstring""" def lowerCAmelCase_ ( SCREAMING_SNAKE_CASE__, SCREAMING_SNAKE_CASE__ ) -> list[int]: a_ : Tuple = int(_lowerCamelCase ) # Initialize Result a_ : Union[str, Any] = [] # Traverse through all denomination for denomination in reverse...
237
'''simple docstring''' from sklearn.metrics import matthews_corrcoef import datasets __UpperCamelCase = "\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...
26
0
"""simple docstring""" import sys from collections import defaultdict class a__ : def __init__( self : List[Any]) -> Optional[int]: """simple docstring""" _lowerCAmelCase:Optional[Any] = [] def __UpperCamelCase ( ...
227
'''simple docstring''' import json import os from pathlib import Path import pytest from datasets.download.download_config import DownloadConfig from datasets.download.download_manager import DownloadManager from datasets.utils.file_utils import hash_url_to_filename __UpperCamelC...
26
0
import math from dataclasses import dataclass from typing import Optional, Tuple, Union import numpy as np import torch from ..configuration_utils import ConfigMixin, register_to_config from ..utils import BaseOutput, randn_tensor from .scheduling_utils import SchedulerMixin @dat...
79
'''simple docstring''' def _a ( _lowerCamelCase = 100 ) -> int: """simple docstring""" __snake_case : Any = n * (n + 1) * (2 * n + 1) / 6 __snake_case : List[Any] = (n * (n + 1) / 2) ** 2 return int(s...
26
0
from __future__ import annotations def __a ( __UpperCAmelCase : Tuple ) -> bool: """simple docstring""" lowerCamelCase_ : Union[str, Any] = len(_lowerCamelCase ) # We need to create solution object to save path. lowerCamelCase_ ...
488
'''simple docstring''' from __future__ import annotations from typing import Any class _A : def __init__( self : str , __magic_name__ : int , __magic_name__ : int , __magic_name__ : float = 0 ) -> None: """simple d...
26
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_t...
17
'''simple docstring''' 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 d...
26
0
"""simple docstring""" from typing import TYPE_CHECKING from ...utils import OptionalDependencyNotAvailable, _LazyModule, is_tf_available, is_torch_available _A : List[Any] = { """configuration_data2vec_audio""": ["""DATA2VEC_AUDIO_PRETRAINED_CONFIG_ARCHIVE_MAP""", """Data2VecAudi...
361
'''simple docstring''' import cva import numpy as np class _A : def __init__( self : Any , __magic_name__ : float , __magic_name__ : int ) -> Optional[int]: """simple docstring""" if k in (0.04, 0.06): __snake_c...
26
0
import logging import torch from torch import nn from torch.nn import CrossEntropyLoss, MSELoss from transformers.file_utils import add_start_docstrings, add_start_docstrings_to_model_forward from transformers.models.bert.modeling_bert import ( BERT_INPUTS_DOCSTRING, BERT_START_DOCSTRING, ...
70
'''simple docstring''' import warnings from ...processing_utils import ProcessorMixin from ...tokenization_utils_base import BatchEncoding class _A ( __lowercase ): lowercase__: Any = ['''image_processor''', '''tokenizer'''] lowercase__: Any = ''...
26
0
"""simple docstring""" from __future__ import annotations import math def _A (__a , __a ) -> float: """simple docstring""" SCREAMING_SNAKE_CASE_ : Any = u for i in range(1 , _lowerCamelCase ): SCREAMING_SNAKE_CASE_ : ...
512
'''simple docstring''' import datasets import faiss import numpy as np import streamlit as st import torch from elasticsearch import Elasticsearch from elia_utils import ( embed_questions_for_retrieval, make_qa_sas_model, qa_sas_generate, query_es_index, query_qa_...
26
0
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 lowercase__ ( __lowercase ): ...
475
'''simple docstring''' import warnings from ...utils import logging from .image_processing_owlvit import OwlViTImageProcessor __UpperCamelCase = logging.get_logger(__name__) class _A ( __lowercase ): def __init__( self : int , *__magic_name__ ...
26
0
from sklearn.metrics import mean_squared_error import datasets A : str = '\\n@article{scikit-learn,\n title={Scikit-learn: Machine Learning in {P}ython},\n author={Pedregosa, F. and Varoquaux, G. and Gramfort, A. and Michel, V.\n and Thirion, B. and Grisel, O. and Blondel, M. and Pr...
371
'''simple docstring''' import argparse import torch from transformers import BlenderbotConfig, BlenderbotForConditionalGeneration from transformers.utils import logging logging.set_verbosity_info() __UpperCamelCase = logging.get_logger(__name__) __UpperCamelCase ...
26
0
from typing import TYPE_CHECKING from ...utils import OptionalDependencyNotAvailable, _LazyModule, is_tf_available, is_torch_available lowercase_: Any = { 'configuration_rag': ['RagConfig'], 'retrieval_rag': ['RagRetriever'], 'tokenization_rag': ['RagTokenizer'], } try:...
648
'''simple docstring''' import argparse import os import re import packaging.version __UpperCamelCase = "examples/" __UpperCamelCase = { "examples": (re.compile(R"^check_min_version\(\"[^\"]+\"\)\s*$", re.MULTILINE), "check_min_version(\"VERSION\")\n"), "init...
26
0
"""simple docstring""" import functools from typing import Any def lowerCAmelCase_ ( SCREAMING_SNAKE_CASE__, SCREAMING_SNAKE_CASE__ ) -> bool: if not isinstance(_lowerCamelCase, _lowerCamelCase ) or len(_lowerCamelCase ) == 0: raise ValueError("the string should be ...
237
'''simple docstring''' from unittest import TestCase from datasets import Sequence, Value from datasets.arrow_dataset import Dataset class _A ( __lowercase ): def lowercase__ ( self : Any ) -> str: """simple docstring""" return [ ...
26
0
"""simple docstring""" import unittest import numpy as np from diffusers import LMSDiscreteScheduler, OnnxStableDiffusionInpaintPipeline from diffusers.utils.testing_utils import ( is_onnx_available, load_image, nightly, require_onnxruntime, require_torch_gpu, ) from ..test_pipelines_o...
227
'''simple docstring''' 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...
26
0
from torch import nn def _lowerCamelCase ( __lowerCamelCase ) -> Tuple: '''simple docstring''' if act_fn in ["swish", "silu"]: return nn.SiLU() elif act_fn == "mish": return nn.Mish() elif act_fn == "gelu": return...
79
'''simple docstring''' from __future__ import annotations __UpperCamelCase = [ [-1, 0], # left [0, -1], # down [1, 0], # right [0, 1], # up ] def _a ( _lowerCamelCase , _lowerCamelCase , _lowerCamelCase , _lowerCamelCas...
26
0
import copy from ...configuration_utils import PretrainedConfig from ...utils import logging snake_case_ : Optional[Any] = logging.get_logger(__name__) class snake_case_ ( __lowercase ): '''simple docstring''' lowerCamelCase = '''encoder-decoder''' lowerCamelCase ...
488
'''simple docstring''' def _a ( _lowerCamelCase ) -> int: """simple docstring""" if not isinstance(_lowerCamelCase , _lowerCamelCase ): raise TypeError("""only integers accepted as input""" ) else: __snake_case : List[Any] ...
26
0
from __future__ import annotations from typing import Any class lowerCamelCase_ : def __init__( self : str , __A : int , __A : int , __A : float = 0 ): __A : Optional[Any] = row, column __A : Dict = [[...
17
'''simple docstring''' from __future__ import annotations import math def _a ( _lowerCamelCase , _lowerCamelCase , _lowerCamelCase , _lowerCamelCase , _lowerCamelCase ) -> int: """simple docstring""" if depth < 0: raise V...
26
0
"""simple docstring""" from __future__ import annotations import math import random from collections.abc import Collection from typing import overload class a__ : def __init__( self , _a = None ): if components is None: lowercase :...
361
'''simple docstring''' from __future__ import annotations def _a ( _lowerCamelCase , _lowerCamelCase = None , _lowerCamelCase = None ) -> None: """simple docstring""" if start is None: __snake_case : Optional[Any] ...
26
0
from ... import PretrainedConfig lowerCamelCase : List[str] = { "sijunhe/nezha-cn-base": "https://huggingface.co/sijunhe/nezha-cn-base/resolve/main/config.json", } class A( __lowercase ): '''simple docstring''' UpperCamelCase = NEZHA_PRE...
70
'''simple docstring''' import doctest import logging import os import unittest from pathlib import Path from typing import List, Union import transformers from transformers.testing_utils import require_tf, require_torch, slow __UpperCamelCase = logging.getLogger() ...
26
0
"""simple docstring""" import argparse import json import re from pathlib import Path import requests import torch from huggingface_hub import hf_hub_download from PIL import Image from transformers import ( MobileNetVaConfig, MobileNetVaForImageClassification, MobileNetVaImageProcessor, ...
512
'''simple docstring''' import inspect from typing import Callable, List, Optional, Union import torch from transformers import ( CLIPImageProcessor, CLIPTextModel, CLIPTokenizer, WhisperForConditionalGeneration, WhisperProcessor, ) from diffusers import ( ...
26
0
from unittest import TestCase from datasets import Sequence, Value from datasets.arrow_dataset import Dataset class lowercase__ ( __lowercase ): def _UpperCAmelCase ( self : Any ): """simple docstring""" return [ ...
475
'''simple docstring''' import os from huggingface_hub.constants import HUGGINGFACE_HUB_CACHE, hf_cache_home __UpperCamelCase = HUGGINGFACE_HUB_CACHE __UpperCamelCase = "config.json" __UpperCamelCase = "diffusion_pytorch_model.bin" __UpperCamelCase ...
26
0
import glob import os import random from string import ascii_lowercase, digits import cva A : Tuple = '' A : int = '' A : Optional[Any] = '' A : Tuple = 1 # (0 is vertical, 1 is horizontal) def _lowerCAmelCase ( ) ...
371
'''simple docstring''' import argparse import json import re from pathlib import Path import requests import torch from huggingface_hub import hf_hub_download from PIL import Image from transformers import ( MobileNetVaConfig, MobileNetVaForImageClassification, Mobile...
26
0
import operator as op def _lowercase ( UpperCAmelCase_): """simple docstring""" snake_case__ : List[Any] = [] snake_case__ : Optional[int] = lambda UpperCAmelCase_ , UpperCAmelCase_: int(x / y) # noqa: E731 integer division operation ...
648
'''simple docstring''' from sklearn.metrics import recall_score import datasets __UpperCamelCase = "\nRecall is the fraction of the positive examples that were correctly labeled by the model as positive. It can be computed with the equation:\nRecall = TP / (TP + FN)\nWhere TP is...
26
0
"""simple docstring""" import warnings from ...processing_utils import ProcessorMixin from ...tokenization_utils_base import BatchEncoding class snake_case_ ( __lowercase ): __lowerCAmelCase = ['''image_processor''', '''tokenizer'''] __lowerCAmelCase = ...
237
'''simple docstring''' from sklearn.metrics import matthews_corrcoef import datasets __UpperCamelCase = "\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...
26
0
"""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 N...
227
'''simple docstring''' import json import os from pathlib import Path import pytest from datasets.download.download_config import DownloadConfig from datasets.download.download_manager import DownloadManager from datasets.utils.file_utils import hash_url_to_filename __UpperCamelC...
26
0
import inspect import unittest from huggingface_hub import hf_hub_download from transformers import ConvNextConfig, UperNetConfig from transformers.testing_utils import require_torch, require_torch_multi_gpu, require_vision, slow, torch_device from transformers.utils import is_torch_available, is...
79
'''simple docstring''' def _a ( _lowerCamelCase = 100 ) -> int: """simple docstring""" __snake_case : Any = n * (n + 1) * (2 * n + 1) / 6 __snake_case : List[Any] = (n * (n + 1) / 2) ** 2 return int(s...
26
0
from .integrations import ( is_optuna_available, is_ray_available, is_sigopt_available, is_wandb_available, run_hp_search_optuna, run_hp_search_ray, run_hp_search_sigopt, run_hp_search_wandb, ) from .trainer_utils import ( HPSearchBackend, default_hp_space_optuna, defaul...
488
'''simple docstring''' from __future__ import annotations from typing import Any class _A : def __init__( self : str , __magic_name__ : int , __magic_name__ : int , __magic_name__ : float = 0 ) -> None: """simple d...
26
0
def __SCREAMING_SNAKE_CASE ( a__ : Union[str, Any] ) -> int: return 1 if digit in (0, 1) else (digit * factorial(digit - 1 )) def __SCREAMING_SNAKE_CASE ( a__ : int ) -> bool: __A : str = 0 __A : Any = number while duplicate > 0...
17
'''simple docstring''' 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 d...
26
0
"""simple docstring""" import numpy as np import torch from torch.utils.data import Dataset, IterableDataset from ..utils.generic import ModelOutput class a__ ( __lowercase ): def __init__( self , _a , _a , _a ): lowercase : ...
361
'''simple docstring''' import cva import numpy as np class _A : def __init__( self : Any , __magic_name__ : float , __magic_name__ : int ) -> Optional[int]: """simple docstring""" if k in (0.04, 0.06): __snake_c...
26
0
class A: '''simple docstring''' def __init__( self : List[str] ) -> None: """simple docstring""" lowerCamelCase_ = {} # Mapping from char to TrieNode lowerCamelCase_ = False def a__ ( self...
70
'''simple docstring''' import warnings from ...processing_utils import ProcessorMixin from ...tokenization_utils_base import BatchEncoding class _A ( __lowercase ): lowercase__: Any = ['''image_processor''', '''tokenizer'''] lowercase__: Any = ''...
26
0
"""simple docstring""" import unittest import numpy as np from transformers import is_flax_available from transformers.testing_utils import require_flax from ..test_modeling_flax_common import ids_tensor if is_flax_available(): import jax import jax.numpy as jnp from transformers.generation imp...
512
'''simple docstring''' import datasets import faiss import numpy as np import streamlit as st import torch from elasticsearch import Elasticsearch from elia_utils import ( embed_questions_for_retrieval, make_qa_sas_model, qa_sas_generate, query_es_index, query_qa_...
26
0
import inspect import unittest import numpy as np from tests.test_modeling_common import floats_tensor from transformers import DetrConfig, MaskFormerConfig, SwinConfig, is_torch_available, is_vision_available from transformers.testing_utils import require_torch, require_torch_multi_gpu, require_vision, ...
475
'''simple docstring''' import warnings from ...utils import logging from .image_processing_owlvit import OwlViTImageProcessor __UpperCamelCase = logging.get_logger(__name__) class _A ( __lowercase ): def __init__( self : int , *__magic_name__ ...
26
0
import doctest import sys import warnings from os.path import abspath, dirname, join import _pytest from transformers.testing_utils import HfDoctestModule, HfDocTestParser # allow having multiple repository checkouts and not needing to remember to rerun # 'pip install -e .[dev]' when switching betw...
371
'''simple docstring''' import argparse import torch from transformers import BlenderbotConfig, BlenderbotForConditionalGeneration from transformers.utils import logging logging.set_verbosity_info() __UpperCamelCase = logging.get_logger(__name__) __UpperCamelCase ...
26
0
import argparse import os.path as osp import re import torch from safetensors.torch import load_file, save_file # =================# # UNet Conversion # # =================# lowercase_: List[str] = [ # (stable-diffusion, HF Diffusers) ('time_embed.0.weight', 'time_embedd...
648
'''simple docstring''' import argparse import os import re import packaging.version __UpperCamelCase = "examples/" __UpperCamelCase = { "examples": (re.compile(R"^check_min_version\(\"[^\"]+\"\)\s*$", re.MULTILINE), "check_min_version(\"VERSION\")\n"), "init...
26
0
from typing import TYPE_CHECKING from ...utils import OptionalDependencyNotAvailable, _LazyModule, is_torch_available __A : Optional[Any] = {"configuration_wavlm": ["WAVLM_PRETRAINED_CONFIG_ARCHIVE_MAP", "WavLMConfig"]} try: if not is_torch_available(): raise OptionalDepend...
27
def __lowerCAmelCase( _SCREAMING_SNAKE_CASE ) -> bool: """simple docstring""" if not isinstance(_SCREAMING_SNAKE_CASE , _SCREAMING_SNAKE_CASE ): raise ValueError('check_bouncy() accepts only integer arguments' ) _A = str(_S...
27
1
import warnings from contextlib import contextmanager from ...processing_utils import ProcessorMixin from .feature_extraction_wavaveca import WavaVecaFeatureExtractor from .tokenization_wavaveca import WavaVecaCTCTokenizer class lowerCamelCase( __snake_case ): '''simple ...
27
def __lowerCAmelCase( _SCREAMING_SNAKE_CASE , _SCREAMING_SNAKE_CASE ) -> float: """simple docstring""" return price * (1 + tax_rate) if __name__ == "__main__": print(f"{price_plus_tax(100, 0.2_5) = }") print(f"{price_plus_tax(1_2_5.5_0, 0.0_5) ...
27
1
def __lowerCAmelCase( _SCREAMING_SNAKE_CASE ) -> int: """simple docstring""" if n == 1 or not isinstance(_SCREAMING_SNAKE_CASE , _SCREAMING_SNAKE_CASE ): return 0 elif n == 2: return 1 else: _A = [0, 1] ...
27
from collections.abc import Callable def __lowerCAmelCase( _SCREAMING_SNAKE_CASE , _SCREAMING_SNAKE_CASE , _SCREAMING_SNAKE_CASE ) -> float: """simple docstring""" _A = a _A = b if function(_SCREAMING_S...
27
1
def __lowerCAmelCase( _SCREAMING_SNAKE_CASE ) -> str: """simple docstring""" _A = 0 # if input_string is "aba" than new_input_string become "a|b|a" _A = '' _A = '' # append each character + "|" in new_string f...
27
import unittest from transformers import AutoTokenizer, NystromformerConfig, 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_atte...
27
1
def __lowerCAmelCase( _SCREAMING_SNAKE_CASE , _SCREAMING_SNAKE_CASE ) -> Dict: """simple docstring""" _A = [1] for i in range(2 , _SCREAMING_SNAKE_CASE ): factorials.append(factorials[-1] * i ) assert 0 <= k ...
27
from typing import TYPE_CHECKING from ...utils import ( OptionalDependencyNotAvailable, _LazyModule, is_flax_available, is_tf_available, is_tokenizers_available, is_torch_available, ) __A : Dict = { "configuration_blenderbot": [ "BLENDER...
27
1
import gc import unittest from diffusers import FlaxStableDiffusionInpaintPipeline from diffusers.utils import is_flax_available, load_image, slow from diffusers.utils.testing_utils import require_flax if is_flax_available(): import jax import jax.numpy as jnp from flax.jax_utils import rep...
27
import sys from .dependency_versions_table import deps from .utils.versions import require_version, require_version_core # define which module versions we always want to check at run time # (usually the ones defined in `install_requires` in setup.py) # # order specific notes: # - tqdm must be c...
27
1
from google.protobuf import descriptor as _descriptor from google.protobuf import descriptor_pool as _descriptor_pool from google.protobuf import symbol_database as _symbol_database from google.protobuf.internal import builder as _builder # @@protoc_insertion_point(imports) __A : List[Any...
27
def __lowerCAmelCase( _SCREAMING_SNAKE_CASE , _SCREAMING_SNAKE_CASE ) -> int: """simple docstring""" return int((input_a, input_a).count(0 ) != 0 ) def __lowerCAmelCase( ) -> None: """simple docstring""" ...
27
1
from collections import OrderedDict from typing import TYPE_CHECKING, Any, Mapping, Optional, Union from ...configuration_utils import PretrainedConfig from ...onnx import OnnxConfig from ...utils import logging if TYPE_CHECKING: from ... import FeatureExtractionMixin, PreTrainedTokenizerBase, ...
27
from __future__ import annotations import unittest from transformers import EsmConfig, is_tf_available from transformers.testing_utils import require_tf, slow from ...test_configuration_common import ConfigTester from ...test_modeling_tf_common import TFModelTesterMixin, floats_tensor, ids_tensor...
27
1
import copy from typing import TYPE_CHECKING, Any, Mapping, Optional, OrderedDict from packaging import version from ...configuration_utils import PretrainedConfig from ...onnx import OnnxConfig from ...utils import logging from ..auto.configuration_auto import AutoConfig if TYPE_CHECKING: ...
27
import logging from pathlib import Path import numpy as np import pytorch_lightning as pl import torch from pytorch_lightning.callbacks import EarlyStopping, ModelCheckpoint from pytorch_lightning.utilities import rank_zero_only from utils_rag import save_json def __lowerCAmelCase( ...
27
1
def __lowerCAmelCase( _SCREAMING_SNAKE_CASE , _SCREAMING_SNAKE_CASE , _SCREAMING_SNAKE_CASE = 0 , _SCREAMING_SNAKE_CASE = 0 ) -> int: """simple docstring""" _A = right or len(_SCREAMING_SNAKE_CASE ) - 1 if left > ri...
27
def __lowerCAmelCase( _SCREAMING_SNAKE_CASE , _SCREAMING_SNAKE_CASE ) -> int: """simple docstring""" print('\nThe shortest path matrix using Floyd Warshall algorithm\n' ) for i in range(_SCREAMING_SNAKE_CASE ): for j in range(_SCREAM...
27
1
import itertools import os import random import tempfile import unittest import numpy as np from datasets import load_dataset from transformers import is_speech_available from transformers.testing_utils import check_json_file_has_correct_format, require_torch, require_torchaudio from transforme...
27
# 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 # # Unless r...
27
1
import os def __lowerCAmelCase( ) -> Union[str, Any]: """simple docstring""" with open(os.path.dirname(_SCREAMING_SNAKE_CASE ) + '/grid.txt' ) as f: _A = [] # noqa: E741 for _ in range(20 ): l.append([int...
27
from ... import PretrainedConfig __A : Optional[Any] = { "sijunhe/nezha-cn-base": "https://huggingface.co/sijunhe/nezha-cn-base/resolve/main/config.json", } class lowerCamelCase( __snake_case ): '''simple docstring''' __magic_name__ = ...
27
1
import sys __A : Union[str, Any] = ( "73167176531330624919225119674426574742355349194934" "96983520312774506326239578318016984801869478851843" "85861560789112949495459501737958331952853208805511" "12540698747158523863050715693290963295227443043557" "668966489504...
27
from collections import defaultdict from math import ceil, sqrt def __lowerCAmelCase( _SCREAMING_SNAKE_CASE = 1_000_000 , _SCREAMING_SNAKE_CASE = 10 ) -> int: """simple docstring""" _A = defaultdict(_SCREAMING_SNAKE_CASE ) ...
27
1
import datasets from .evaluate import evaluate __A : int = "\\n@inproceedings{Rajpurkar2016SQuAD10,\n title={SQuAD: 100, 000+ Questions for Machine Comprehension of Text},\n author={Pranav Rajpurkar and Jian Zhang and Konstantin Lopyrev and Percy Liang},\n booktitle={EMNLP},\n ...
27
from math import pi, sqrt, tan def __lowerCAmelCase( _SCREAMING_SNAKE_CASE ) -> float: """simple docstring""" if side_length < 0: raise ValueError('surface_area_cube() only accepts non-negative values' ) return 6 * side_length**2 ...
27
1
import qiskit def __lowerCAmelCase( _SCREAMING_SNAKE_CASE , _SCREAMING_SNAKE_CASE ) -> qiskit.result.counts.Counts: """simple docstring""" _A = qiskit.Aer.get_backend('aer_simulator' ) # Create a Quantum Circuit acting on ...
27
import numpy as np def __lowerCAmelCase( _SCREAMING_SNAKE_CASE ) -> np.array: """simple docstring""" return (2 / (1 + np.exp(-2 * vector ))) - 1 if __name__ == "__main__": import doctest doctest.testmod()
27
1
# 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 # # Unless r...
27
from typing import TYPE_CHECKING from ...utils import OptionalDependencyNotAvailable, _LazyModule, is_sentencepiece_available __A : Optional[Any] = {} try: if not is_sentencepiece_available(): raise OptionalDependencyNotAvailable() except OptionalDependencyNotAvailable: ...
27
1
import gc import unittest import numpy as np import torch from transformers import CLIPTextConfig, CLIPTextModel, XLMRobertaTokenizer from diffusers import AltDiffusionPipeline, AutoencoderKL, DDIMScheduler, PNDMScheduler, UNetaDConditionModel from diffusers.pipelines.alt_diffusion.modeling_robert...
27
import json import os from pathlib import Path import pytest from datasets.download.download_config import DownloadConfig from datasets.download.download_manager import DownloadManager from datasets.utils.file_utils import hash_url_to_filename __A : List[Any] = "http://www.m...
27
1
import logging from pathlib import Path import numpy as np import pytorch_lightning as pl import torch from pytorch_lightning.callbacks import EarlyStopping, ModelCheckpoint from pytorch_lightning.utilities import rank_zero_only from utils_rag import save_json def __lowerCAmelCase( ...
27
from __future__ import annotations from fractions import Fraction from math import gcd, sqrt def __lowerCAmelCase( _SCREAMING_SNAKE_CASE ) -> bool: """simple docstring""" _A = int(number**0.5 ) return number == sq * sq ...
27
1
import argparse import json from typing import List from ltp import LTP from transformers.models.bert.tokenization_bert import BertTokenizer def __lowerCAmelCase( _SCREAMING_SNAKE_CASE ) -> List[Any]: """simple docstring""" if ( (cp >=...
27
from __future__ import annotations import math def __lowerCAmelCase( _SCREAMING_SNAKE_CASE ) -> list[int]: """simple docstring""" if num <= 0: _A = F"{num}: Invalid input, please enter a positive integer." raise ValueErro...
27
1
import inspect import unittest from transformers import ViTConfig from transformers.testing_utils import ( require_accelerate, require_torch, require_torch_gpu, require_vision, slow, torch_device, ) from transformers.utils import cached_property, is_torch_available, is_v...
27
__A : Dict = "Alexander Joslin" import operator as op from .stack import Stack def __lowerCAmelCase( _SCREAMING_SNAKE_CASE ) -> int: """simple docstring""" _A = {'*': op.mul, '/': op.truediv, '+': op.add, '-': op.sub} ...
27
1