code
stringlengths
82
54.1k
code_codestyle
int64
0
699
style_context
stringlengths
111
35.6k
style_context_codestyle
int64
0
699
label
int64
0
1
from dataclasses import dataclass, field from typing import Tuple from ..utils import cached_property, is_torch_available, is_torch_tpu_available, logging, requires_backends from .benchmark_args_utils import BenchmarkArguments if is_torch_available(): import torch if is_torch_tpu_avai...
63
import contextlib import os import sqlitea import pytest from datasets import Dataset, Features, Value from datasets.io.sql import SqlDatasetReader, SqlDatasetWriter from ..utils import assert_arrow_memory_doesnt_increase, assert_arrow_memory_increases, require_sqlalchemy def ...
63
1
import gc import unittest import numpy as np import torch import torch.nn.functional as F from transformers import ( ClapTextConfig, ClapTextModelWithProjection, RobertaTokenizer, SpeechTaHifiGan, SpeechTaHifiGanConfig, ) from diffusers import ( AudioLDMPipeline, ...
63
from __future__ import annotations a : Optional[Any] = [True] * 1_000_001 a : Union[str, Any] = 2 while i * i <= 1_000_000: if seive[i]: for j in range(i * i, 1_000_001, i): a : Optional[Any] = False ...
63
1
from ..utils import ( OptionalDependencyNotAvailable, is_flax_available, is_scipy_available, is_torch_available, is_torchsde_available, ) try: if not is_torch_available(): raise OptionalDependencyNotAvailable() except OptionalDependencyNotAvailable: ...
63
import argparse import torch from transformers import BlenderbotConfig, BlenderbotForConditionalGeneration from transformers.utils import logging logging.set_verbosity_info() a : Dict = logging.get_logger(__name__) a : Tuple = [ ["attention", "attn"], ...
63
1
import argparse import json import requests import torch from huggingface_hub import hf_hub_download from PIL import Image from torchvision import transforms from transformers import BitImageProcessor, FocalNetConfig, FocalNetForImageClassification from transformers.image_utils import IMAGENET...
63
def lowerCamelCase__ ( __lowerCamelCase : Tuple , __lowerCamelCase : List[Any] ): __UpperCAmelCase : List[str] = 0 __UpperCAmelCase : List[str] = len(__lowerCamelCase ) - 1 while left <= right: # avoid divided by 0 during inter...
63
1
from ....configuration_utils import PretrainedConfig from ....utils import logging a : Union[str, Any] = logging.get_logger(__name__) a : Any = { "Visual-Attention-Network/van-base": ( "https://huggingface.co/Visual-Attention-Network/van-base/blob/mai...
63
from ...utils import ( OptionalDependencyNotAvailable, is_torch_available, is_transformers_available, is_transformers_version, ) try: if not (is_transformers_available() and is_torch_available() and is_transformers_version(">=", "4.25.0")): raise OptionalDe...
63
1
import json import os import tempfile import unittest import unittest.mock as mock from pathlib import Path from requests.exceptions import HTTPError from transformers.utils import ( CONFIG_NAME, FLAX_WEIGHTS_NAME, TF2_WEIGHTS_NAME, TRANSFORMERS_CACHE, WEIGHTS_NAME, ...
63
import math from typing import List, Optional, Tuple, Union import numpy as np import torch from ..configuration_utils import ConfigMixin, register_to_config from .scheduling_utils import SchedulerMixin, SchedulerOutput class a ( lowercase__ , lowercase__ ): "...
63
1
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": [ "BLENDERBO...
63
from argparse import ArgumentParser from .add_new_model import AddNewModelCommand from .add_new_model_like import AddNewModelLikeCommand from .convert import ConvertCommand from .download import DownloadCommand from .env import EnvironmentCommand from .lfs import LfsCommands from .pt_to_tf import...
63
1
import math from enum import Enum from typing import Optional, Union from torch.optim import Optimizer from torch.optim.lr_scheduler import LambdaLR from .utils import logging a : Optional[int] = logging.get_logger(__name__) class a ( lowercase__ ): ...
63
from typing import TYPE_CHECKING from ...utils import ( OptionalDependencyNotAvailable, _LazyModule, is_flax_available, is_sentencepiece_available, is_tf_available, is_tokenizers_available, is_torch_available, ) a : List[str] = {"configuration_xg...
63
1
import unittest from knapsack import knapsack as k class a ( unittest.TestCase ): """simple docstring""" def UpperCAmelCase ( self : Optional[Any] ) -> Dict: __UpperCAmelCase : List[str] = 0 __UpperCAmelCase : ...
63
from typing import TYPE_CHECKING from ...utils import OptionalDependencyNotAvailable, _LazyModule, is_sentencepiece_available a : str = {} try: if not is_sentencepiece_available(): raise OptionalDependencyNotAvailable() except OptionalDependencyNotAvailab...
63
1
from dataclasses import dataclass, field from typing import ClassVar, Dict from ..features import Features, Sequence, Value from .base import TaskTemplate @dataclass(frozen=lowercase__ ) class a ( lowercase__ ): """simple docstring""" a : str ...
63
def lowerCamelCase__ ( __lowerCamelCase : int ): if num <= 0: raise ValueError("""Input must be a positive integer""" ) __UpperCAmelCase : int = [True] * (num + 1) __UpperCAmelCase : Tuple = 2 while p * p <= num: if primes[p]: ...
63
1
from math import asin, atan, cos, radians, sin, sqrt, tan a : Tuple = 6_37_81_37.0 a : Any = 6_35_67_52.31_42_45 a : Tuple = 6_378_137 def lowerCamelCase__ ( __lowerCamelCase : float , __lowerCamelCase : float ...
63
import copy import os from typing import Union from ...configuration_utils import PretrainedConfig from ...utils import logging a : str = logging.get_logger(__name__) a : Union[str, Any] = { "microsoft/git-base": "https://huggingface.co/microsoft/git-base...
63
1
class a : """simple docstring""" def __init__( self : Optional[Any] ) -> Union[str, Any]: __UpperCAmelCase : Optional[Any] = {} def UpperCAmelCase ( self : str ) -> None: print(self.vertex ) fo...
63
import unittest from transformers import BarthezTokenizer, BarthezTokenizerFast, BatchEncoding from transformers.testing_utils import require_sentencepiece, require_tokenizers, require_torch, slow from ...test_tokenization_common import TokenizerTesterMixin @require_tokenizers @require_sentencepi...
63
1
from __future__ import annotations a : Optional[Any] = list[list[int]] # assigning initial values to the grid a : Matrix = [ [3, 0, 6, 5, 0, 8, 4, 0, 0], [5, 2, 0, 0, 0, 0, 0, 0, 0], [0, 8, 7, 0, 0, 0, 0, 3, 1], [0, 0, 3, 0, 1, 0, 0, 8, 0], [...
63
from __future__ import annotations import math def lowerCamelCase__ ( __lowerCamelCase : int , __lowerCamelCase : int , __lowerCamelCase : bool , __lowerCamelCase : list[int] , __lowerCamelCase : float ): if depth <...
63
1
from typing import TYPE_CHECKING from ...utils import ( OptionalDependencyNotAvailable, _LazyModule, is_sentencepiece_available, is_tokenizers_available, is_torch_available, ) a : int = {"configuration_reformer": ["REFORMER_PRETRAINED_CONFIG_ARCHIVE_MAP", ...
63
from ...configuration_utils import PretrainedConfig from ...utils import logging a : Tuple = logging.get_logger(__name__) a : List[str] = {"openai-gpt": "https://huggingface.co/openai-gpt/resolve/main/config.json"} class a ( lowercase__ ): ...
63
1
from __future__ import annotations a : str = "Muhammad Umer Farooq" a : Tuple = "MIT" a : int = "1.0.0" a : List[str] = "Muhammad Umer Farooq" a : Union[str, Any] = "contact@muhammadumerfarooq.me" a : Tuple ...
63
import gc import random import unittest import numpy as np import torch from PIL import Image from diffusers import ( DDIMScheduler, KandinskyVaaInpaintPipeline, KandinskyVaaPriorPipeline, UNetaDConditionModel, VQModel, ) from diffusers.utils import floats_tensor, load...
63
1
from collections.abc import Sequence def lowerCamelCase__ ( __lowerCamelCase : Sequence[float] , __lowerCamelCase : bool = False ): if not arr: return 0 __UpperCAmelCase : Optional[int] = 0 if allow_empty_subarrays else float("""-inf"...
63
import copy import fnmatch import json import os import pickle as pkl import shutil import sys import tarfile import tempfile from collections import OrderedDict from contextlib import contextmanager from functools import partial from hashlib import shaaaa from io import BytesIO from pathlib...
63
1
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 transfo...
63
import unittest import numpy as np from transformers import RobertaConfig, is_flax_available from transformers.testing_utils import require_flax, slow from ...test_modeling_flax_common import FlaxModelTesterMixin, floats_tensor, ids_tensor, random_attention_mask if is_flax_available(): ...
63
1
import json import os import subprocess import unittest from ast import literal_eval import pytest from parameterized import parameterized, parameterized_class from . import is_sagemaker_available if is_sagemaker_available(): from sagemaker import Session, TrainingJobAnalytics ...
63
import math from enum import Enum from typing import Optional, Union from torch.optim import Optimizer from torch.optim.lr_scheduler import LambdaLR from .utils import logging a : Optional[int] = logging.get_logger(__name__) class a ( lowercase__ ): ...
63
1
import warnings from ...utils import logging from .image_processing_imagegpt import ImageGPTImageProcessor a : Any = logging.get_logger(__name__) class a ( lowercase__ ): """simple docstring""" def __init__( self : Optional[int] ...
63
from math import pi, sqrt def lowerCamelCase__ ( __lowerCamelCase : float ): if num <= 0: raise ValueError("""math domain error""" ) if num > 1_7_1.5: raise OverflowError("""math range error""" ) elif num - int(__lowerCamelCase ) not in ...
63
1
from tempfile import TemporaryDirectory from unittest import TestCase from unittest.mock import MagicMock, patch from transformers import AutoModel, TFAutoModel from transformers.onnx import FeaturesManager from transformers.testing_utils import SMALL_MODEL_IDENTIFIER, require_tf, require_torch @r...
63
from __future__ import annotations from collections import deque from collections.abc import Sequence from dataclasses import dataclass from typing import Any @dataclass class a : """simple docstring""" a : int a : Node | None = ...
63
1
import unittest import numpy as np from transformers import RobertaConfig, is_flax_available from transformers.testing_utils import require_flax, slow from ...test_modeling_flax_common import FlaxModelTesterMixin, floats_tensor, ids_tensor, random_attention_mask if is_flax_available(): ...
63
import json import os import unittest from transformers.models.gptsan_japanese.tokenization_gptsan_japanese import ( VOCAB_FILES_NAMES, GPTSanJapaneseTokenizer, ) from transformers.testing_utils import require_tokenizers, slow from ...test_tokenization_common import TokenizerTesterMixi...
63
1
import numpy as np import torch import torch.nn as nn from transformers import CLIPConfig, CLIPVisionModelWithProjection, PreTrainedModel from ...utils import logging a : List[str] = logging.get_logger(__name__) class a ( lowercase__ ): """simple ...
63
from dataclasses import dataclass, field from typing import Tuple from ..utils import cached_property, is_torch_available, is_torch_tpu_available, logging, requires_backends from .benchmark_args_utils import BenchmarkArguments if is_torch_available(): import torch if is_torch_tpu_avai...
63
1
from itertools import product def lowerCamelCase__ ( __lowerCamelCase : int , __lowerCamelCase : int ): __UpperCAmelCase : Tuple = sides_number __UpperCAmelCase : int = max_face_number * dice_number __UpperCAmelCase : ...
63
import contextlib import os import sqlitea import pytest from datasets import Dataset, Features, Value from datasets.io.sql import SqlDatasetReader, SqlDatasetWriter from ..utils import assert_arrow_memory_doesnt_increase, assert_arrow_memory_increases, require_sqlalchemy def ...
63
1
import os from glob import glob import imageio import torch import torchvision import wandb from img_processing import custom_to_pil, loop_post_process, preprocess, preprocess_vqgan from loaders import load_vqgan from PIL import Image from torch import nn from transformers import CLIPModel, ...
63
from __future__ import annotations a : Optional[Any] = [True] * 1_000_001 a : Union[str, Any] = 2 while i * i <= 1_000_000: if seive[i]: for j in range(i * i, 1_000_001, i): a : Optional[Any] = False ...
63
1
import argparse import torch # Step 1. clone https://github.com/microsoft/unilm # Step 2. git checkout to https://github.com/microsoft/unilm/commit/b94ec76c36f02fb2b0bf0dcb0b8554a2185173cd # Step 3. cd unilm # Step 4. ln -s $(realpath wavlm/modules.py) ./ # create simlink # import classes from...
63
import argparse import torch from transformers import BlenderbotConfig, BlenderbotForConditionalGeneration from transformers.utils import logging logging.set_verbosity_info() a : Dict = logging.get_logger(__name__) a : Tuple = [ ["attention", "attn"], ...
63
1
from dataclasses import dataclass from typing import Tuple import numpy as np import torch @dataclass class a : """simple docstring""" a : torch.Tensor # [batch_size x 3] a : torch.Tensor # [batch_size x 3] a : torch.Tensor ...
63
def lowerCamelCase__ ( __lowerCamelCase : Tuple , __lowerCamelCase : List[Any] ): __UpperCAmelCase : List[str] = 0 __UpperCAmelCase : List[str] = len(__lowerCamelCase ) - 1 while left <= right: # avoid divided by 0 during inter...
63
1
import numpy as np import torch from imwatermark import WatermarkEncoder # Copied from https://github.com/Stability-AI/generative-models/blob/613af104c6b85184091d42d374fef420eddb356d/scripts/demo/streamlit_helpers.py#L66 a : Optional[Any] = 0B1011_0011_1110_1100_1001_0000_0111_1011...
63
from ...utils import ( OptionalDependencyNotAvailable, is_torch_available, is_transformers_available, is_transformers_version, ) try: if not (is_transformers_available() and is_torch_available() and is_transformers_version(">=", "4.25.0")): raise OptionalDe...
63
1
import unittest from transformers import BarthezTokenizer, BarthezTokenizerFast, BatchEncoding from transformers.testing_utils import require_sentencepiece, require_tokenizers, require_torch, slow from ...test_tokenization_common import TokenizerTesterMixin @require_tokenizers @require_sentencepi...
63
import math from typing import List, Optional, Tuple, Union import numpy as np import torch from ..configuration_utils import ConfigMixin, register_to_config from .scheduling_utils import SchedulerMixin, SchedulerOutput class a ( lowercase__ , lowercase__ ): "...
63
1
import json import sys import tempfile import unittest from pathlib import Path import transformers from transformers import ( CONFIG_MAPPING, IMAGE_PROCESSOR_MAPPING, AutoConfig, AutoImageProcessor, CLIPConfig, CLIPImageProcessor, ) from transformers.testing_utils ...
63
from argparse import ArgumentParser from .add_new_model import AddNewModelCommand from .add_new_model_like import AddNewModelLikeCommand from .convert import ConvertCommand from .download import DownloadCommand from .env import EnvironmentCommand from .lfs import LfsCommands from .pt_to_tf import...
63
1
def lowerCamelCase__ ( __lowerCamelCase : float , __lowerCamelCase : list[float] ): if discount_rate < 0: raise ValueError("""Discount rate cannot be negative""" ) if not cash_flows: raise ValueError("""Cash flows list cannot be empty""" ) __U...
63
from typing import TYPE_CHECKING from ...utils import ( OptionalDependencyNotAvailable, _LazyModule, is_flax_available, is_sentencepiece_available, is_tf_available, is_tokenizers_available, is_torch_available, ) a : List[str] = {"configuration_xg...
63
1
from __future__ import annotations a : Optional[int] = list[tuple[int, int]] a : int = [ [0, 0, 0, 0, 0, 0, 0], [0, 1, 0, 0, 0, 0, 0], # 0 are free path whereas 1's are obstacles [0, 0, 0, 0, 0, 0, 0], [0, 0, 1, 0, 0, 0, 0], [1, 0, 1, 0, 0, 0...
63
from typing import TYPE_CHECKING from ...utils import OptionalDependencyNotAvailable, _LazyModule, is_sentencepiece_available a : str = {} try: if not is_sentencepiece_available(): raise OptionalDependencyNotAvailable() except OptionalDependencyNotAvailab...
63
1
class a : """simple docstring""" def __init__( self : List[str] ) -> None: __UpperCAmelCase : dict[str, TrieNode] = {} # Mapping from char to TrieNode __UpperCAmelCase : List[str] = False def UpperCAmel...
63
def lowerCamelCase__ ( __lowerCamelCase : int ): if num <= 0: raise ValueError("""Input must be a positive integer""" ) __UpperCAmelCase : int = [True] * (num + 1) __UpperCAmelCase : Tuple = 2 while p * p <= num: if primes[p]: ...
63
1
import warnings from typing import List import numpy as np from ...processing_utils import ProcessorMixin from ...tokenization_utils_base import BatchEncoding from ...utils import is_flax_available, is_tf_available, is_torch_available class a ( lowercase__ ): """si...
63
import copy import os from typing import Union from ...configuration_utils import PretrainedConfig from ...utils import logging a : str = logging.get_logger(__name__) a : Union[str, Any] = { "microsoft/git-base": "https://huggingface.co/microsoft/git-base...
63
1
from typing import TYPE_CHECKING from ...utils import OptionalDependencyNotAvailable, _LazyModule, is_tokenizers_available, is_torch_available a : Optional[Any] = { "configuration_m2m_100": ["M2M_100_PRETRAINED_CONFIG_ARCHIVE_MAP", "M2M100Config", "M2M100OnnxConfig"], "to...
63
import unittest from transformers import BarthezTokenizer, BarthezTokenizerFast, BatchEncoding from transformers.testing_utils import require_sentencepiece, require_tokenizers, require_torch, slow from ...test_tokenization_common import TokenizerTesterMixin @require_tokenizers @require_sentencepi...
63
1
import copy from ...configuration_utils import PretrainedConfig from ...utils import add_start_docstrings a : List[str] = r"\n [`RagConfig`] stores the configuration of a *RagModel*. Configuration objects inherit from [`PretrainedConfig`] and\n can be used to control the mod...
63
from __future__ import annotations import math def lowerCamelCase__ ( __lowerCamelCase : int , __lowerCamelCase : int , __lowerCamelCase : bool , __lowerCamelCase : list[int] , __lowerCamelCase : float ): if depth <...
63
1
import json from typing import List, Optional, Tuple from tokenizers import normalizers from ....tokenization_utils_fast import PreTrainedTokenizerFast from ....utils import logging from .tokenization_retribert import RetriBertTokenizer a : List[str] = logging.get_logger(__na...
63
from ...configuration_utils import PretrainedConfig from ...utils import logging a : Tuple = logging.get_logger(__name__) a : List[str] = {"openai-gpt": "https://huggingface.co/openai-gpt/resolve/main/config.json"} class a ( lowercase__ ): ...
63
1
from datetime import datetime import requests from bsa import BeautifulSoup if __name__ == "__main__": a : Optional[Any] = input("Enter image url: ").strip() print(f"""Downloading image from {url} ...""") a : Tuple = BeautifulSoup(requests.get...
63
import gc import random import unittest import numpy as np import torch from PIL import Image from diffusers import ( DDIMScheduler, KandinskyVaaInpaintPipeline, KandinskyVaaPriorPipeline, UNetaDConditionModel, VQModel, ) from diffusers.utils import floats_tensor, load...
63
1
import contextlib import os import sqlitea import pytest from datasets import Dataset, Features, Value from datasets.io.sql import SqlDatasetReader, SqlDatasetWriter from ..utils import assert_arrow_memory_doesnt_increase, assert_arrow_memory_increases, require_sqlalchemy def ...
63
import copy import fnmatch import json import os import pickle as pkl import shutil import sys import tarfile import tempfile from collections import OrderedDict from contextlib import contextmanager from functools import partial from hashlib import shaaaa from io import BytesIO from pathlib...
63
1
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_soun...
63
import unittest import numpy as np from transformers import RobertaConfig, is_flax_available from transformers.testing_utils import require_flax, slow from ...test_modeling_flax_common import FlaxModelTesterMixin, floats_tensor, ids_tensor, random_attention_mask if is_flax_available(): ...
63
1
from typing import TYPE_CHECKING from ..utils import _LazyModule a : Optional[int] = { "config": [ "EXTERNAL_DATA_FORMAT_SIZE_LIMIT", "OnnxConfig", "OnnxConfigWithPast", "OnnxSeq2SeqConfigWithPast", "PatchingSpec", ], "con...
63
import math from enum import Enum from typing import Optional, Union from torch.optim import Optimizer from torch.optim.lr_scheduler import LambdaLR from .utils import logging a : Optional[int] = logging.get_logger(__name__) class a ( lowercase__ ): ...
63
1
from ...configuration_utils import PretrainedConfig class lowerCamelCase_ ( lowerCamelCase ): a__ = '''bert-generation''' def __init__( self , __lowerCAmelCase=5_0_3_5_8 , __lowerCAmelCase=1_0_2_4 , __lowerCAmelCase=2_4 , ...
0
from math import pi, sqrt def lowerCamelCase__ ( __lowerCamelCase : float ): if num <= 0: raise ValueError("""math domain error""" ) if num > 1_7_1.5: raise OverflowError("""math range error""" ) elif num - int(__lowerCamelCase ) not in ...
63
0
def _A ( ) -> List[str]: """simple docstring""" __UpperCamelCase = 0 for i in range(1 , 10_01 ): total += i**i return str(_lowercase )[-10:] if __name__ == "__main__": print(solution())
1
from __future__ import annotations from collections import deque from collections.abc import Sequence from dataclasses import dataclass from typing import Any @dataclass class a : """simple docstring""" a : int a : Node | None = ...
63
0
import unittest from transformers import JukeboxTokenizer from transformers.testing_utils import require_torch class lowerCamelCase__ ( unittest.TestCase): """simple docstring""" a__ : Tuple = JukeboxTokenizer a__ : Union[str, Any] = { "artist": "Zac Brown Band", ...
2
import json import os import unittest from transformers.models.gptsan_japanese.tokenization_gptsan_japanese import ( VOCAB_FILES_NAMES, GPTSanJapaneseTokenizer, ) from transformers.testing_utils import require_tokenizers, slow from ...test_tokenization_common import TokenizerTesterMixi...
63
0
'''simple docstring''' import argparse import tensorflow as tf import torch from transformers import BertConfig, BertForMaskedLM from transformers.models.bert.modeling_bert import ( BertIntermediate, BertLayer, BertOutput, BertPooler, BertSelfAttention, BertSelfOutput, ) from ...
3
from dataclasses import dataclass, field from typing import Tuple from ..utils import cached_property, is_torch_available, is_torch_tpu_available, logging, requires_backends from .benchmark_args_utils import BenchmarkArguments if is_torch_available(): import torch if is_torch_tpu_avai...
63
0
"""simple docstring""" import argparse from collections import defaultdict def _SCREAMING_SNAKE_CASE (_UpperCAmelCase : List[str] , _UpperCAmelCase : Optional[int] , _UpperCAmelCase : int , _UpperCAmelCase : str , _UpperCAmelCase : List[Any] ): lowerC...
4
import contextlib import os import sqlitea import pytest from datasets import Dataset, Features, Value from datasets.io.sql import SqlDatasetReader, SqlDatasetWriter from ..utils import assert_arrow_memory_doesnt_increase, assert_arrow_memory_increases, require_sqlalchemy def ...
63
0
'''simple docstring''' import json import logging import os import sys from time import time from unittest.mock import patch from transformers.testing_utils import TestCasePlus, require_torch_tpu logging.basicConfig(level=logging.DEBUG) _lowercase = logging.getLogger() def A (__lowerCamelCase :s...
5
from __future__ import annotations a : Optional[Any] = [True] * 1_000_001 a : Union[str, Any] = 2 while i * i <= 1_000_000: if seive[i]: for j in range(i * i, 1_000_001, i): a : Optional[Any] = False ...
63
0
import argparse import torch from torch import nn from transformers import MaMaaaConfig, MaMaaaForConditionalGeneration def SCREAMING_SNAKE_CASE__ ( UpperCamelCase__: int ): SCREAMING_SNAKE_CASE__ = [ """encoder.version""", """decoder.version""", """model....
6
import argparse import torch from transformers import BlenderbotConfig, BlenderbotForConditionalGeneration from transformers.utils import logging logging.set_verbosity_info() a : Dict = logging.get_logger(__name__) a : Tuple = [ ["attention", "attn"], ...
63
0
"""simple docstring""" def _snake_case ( _snake_case : str ) -> str: '''simple docstring''' if not all(char in '01' for char in bin_string ): raise ValueError('Non-binary value was passed to the function' ) if not bin_string: raise ValueE...
7
def lowerCamelCase__ ( __lowerCamelCase : Tuple , __lowerCamelCase : List[Any] ): __UpperCAmelCase : List[str] = 0 __UpperCAmelCase : List[str] = len(__lowerCamelCase ) - 1 while left <= right: # avoid divided by 0 during inter...
63
0
'''simple docstring''' import unittest from transformers import MODEL_FOR_DOCUMENT_QUESTION_ANSWERING_MAPPING, AutoTokenizer, is_vision_available from transformers.pipelines import pipeline from transformers.pipelines.document_question_answering import apply_tesseract from transformers.testin...
8
from ...utils import ( OptionalDependencyNotAvailable, is_torch_available, is_transformers_available, is_transformers_version, ) try: if not (is_transformers_available() and is_torch_available() and is_transformers_version(">=", "4.25.0")): raise OptionalDe...
63
0
from __future__ import annotations def A ( __UpperCamelCase , __UpperCamelCase , __UpperCamelCase ) -> tuple[float, list[float]]: A__ = list(range(len(__UpperCamelCase ) ) ) A__ = [v / w for v, w in zip(__UpperCamelCase , __UpperCamelCas...
9
import math from typing import List, Optional, Tuple, Union import numpy as np import torch from ..configuration_utils import ConfigMixin, register_to_config from .scheduling_utils import SchedulerMixin, SchedulerOutput class a ( lowercase__ , lowercase__ ): "...
63
0
def _snake_case ( ): _UpperCamelCase = 0 for i in range(1 , 1001 ): total += i**i return str(__snake_case )[-10:] if __name__ == "__main__": print(solution())
10
from argparse import ArgumentParser from .add_new_model import AddNewModelCommand from .add_new_model_like import AddNewModelLikeCommand from .convert import ConvertCommand from .download import DownloadCommand from .env import EnvironmentCommand from .lfs import LfsCommands from .pt_to_tf import...
63
0
'''simple docstring''' def lowerCAmelCase (__A , __A): """simple docstring""" if digit_amount > 0: return round(number - int(__A) , __A) return number - int(__A) if __name__ == "__main__": print(decimal_isolate(1.53, 0)) print(decimal_isolate(35.345, 1)) ...
11
from typing import TYPE_CHECKING from ...utils import ( OptionalDependencyNotAvailable, _LazyModule, is_flax_available, is_sentencepiece_available, is_tf_available, is_tokenizers_available, is_torch_available, ) a : List[str] = {"configuration_xg...
63
0
from math import factorial def UpperCamelCase ( lowercase_ = 20 ) -> int: '''simple docstring''' lowercase__ : Tuple = 2 * n # middle entry of odd rows starting at row 3 is the solution for n = 1, # 2, 3,... lowercase__ : Union[str, Any] = n // 2 ret...
12
from typing import TYPE_CHECKING from ...utils import OptionalDependencyNotAvailable, _LazyModule, is_sentencepiece_available a : str = {} try: if not is_sentencepiece_available(): raise OptionalDependencyNotAvailable() except OptionalDependencyNotAvailab...
63
0
'''simple docstring''' import timeit import numpy as np import datasets from datasets.arrow_writer import ArrowWriter from datasets.features.features import _ArrayXD def UpperCAmelCase__ ( UpperCAmelCase_ : Union[str, Any] ) -> List[Any]: def wrapper(*UpperCAmelCase_ ...
13
def lowerCamelCase__ ( __lowerCamelCase : int ): if num <= 0: raise ValueError("""Input must be a positive integer""" ) __UpperCAmelCase : int = [True] * (num + 1) __UpperCAmelCase : Tuple = 2 while p * p <= num: if primes[p]: ...
63
0
import copy from collections import OrderedDict from typing import Dict, Mapping from packaging import version from ...configuration_utils import PretrainedConfig from ...onnx import OnnxConfig from ...utils import logging from ..auto import CONFIG_MAPPING a__ = logging.get_logger(__...
14
import copy import os from typing import Union from ...configuration_utils import PretrainedConfig from ...utils import logging a : str = logging.get_logger(__name__) a : Union[str, Any] = { "microsoft/git-base": "https://huggingface.co/microsoft/git-base...
63
0
import warnings from .generation import TFGenerationMixin class A ( UpperCAmelCase__ ): '''simple docstring''' warnings.warn( '''Importing `TFGenerationMixin` from `src/transformers/generation_tf_utils.py` is deprecated and will ''' '''be remove...
15
import unittest from transformers import BarthezTokenizer, BarthezTokenizerFast, BatchEncoding from transformers.testing_utils import require_sentencepiece, require_tokenizers, require_torch, slow from ...test_tokenization_common import TokenizerTesterMixin @require_tokenizers @require_sentencepi...
63
0
from typing import TYPE_CHECKING from ...utils import ( OptionalDependencyNotAvailable, _LazyModule, is_flax_available, is_tf_available, is_tokenizers_available, is_torch_available, is_vision_available, ) __A : Dict = { 'configuration_owlvit': [ ...
16
from __future__ import annotations import math def lowerCamelCase__ ( __lowerCamelCase : int , __lowerCamelCase : int , __lowerCamelCase : bool , __lowerCamelCase : list[int] , __lowerCamelCase : float ): if depth <...
63
0
import numpy as np class lowerCamelCase_ : def __init__( self : Union[str, Any] ): __A : Union[str, Any] = (0, 0) __A : Optional[Any] = None __A : int = 0 __A : List[Any] = 0 __A : Any = 0 def __eq__( self : ...
17
from ...configuration_utils import PretrainedConfig from ...utils import logging a : Tuple = logging.get_logger(__name__) a : List[str] = {"openai-gpt": "https://huggingface.co/openai-gpt/resolve/main/config.json"} class a ( lowercase__ ): ...
63
0
'''simple docstring''' from __future__ import annotations from fractions import Fraction def __a(SCREAMING_SNAKE_CASE_ : int , SCREAMING_SNAKE_CASE_ : int ): '''simple docstring''' return ( num != den and num % 10 == den // 10 and (num // 10) / (den % 10) ...
18
import gc import random import unittest import numpy as np import torch from PIL import Image from diffusers import ( DDIMScheduler, KandinskyVaaInpaintPipeline, KandinskyVaaPriorPipeline, UNetaDConditionModel, VQModel, ) from diffusers.utils import floats_tensor, load...
63
0
"""simple docstring""" from __future__ import annotations class _UpperCAmelCase: def __init__( self , __a) -> None: '''simple docstring''' _UpperCamelCase = data _UpperCamelCase = None _UpperCame...
19
import copy import fnmatch import json import os import pickle as pkl import shutil import sys import tarfile import tempfile from collections import OrderedDict from contextlib import contextmanager from functools import partial from hashlib import shaaaa from io import BytesIO from pathlib...
63
0
import json import sys import tempfile import unittest from pathlib import Path import transformers from transformers import ( CONFIG_MAPPING, FEATURE_EXTRACTOR_MAPPING, AutoConfig, AutoFeatureExtractor, WavaVecaConfig, WavaVecaFeatureExtractor, ) from transformers.testing_utils import DUMMY...
20
import unittest import numpy as np from transformers import RobertaConfig, is_flax_available from transformers.testing_utils import require_flax, slow from ...test_modeling_flax_common import FlaxModelTesterMixin, floats_tensor, ids_tensor, random_attention_mask if is_flax_available(): ...
63
0
import heapq def lowerCAmelCase_ ( lowerCamelCase ): __magic_name__ : list[list] =[] # 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...
21
import math from enum import Enum from typing import Optional, Union from torch.optim import Optimizer from torch.optim.lr_scheduler import LambdaLR from .utils import logging a : Optional[int] = logging.get_logger(__name__) class a ( lowercase__ ): ...
63
0
'''simple docstring''' import requests def snake_case_ (UpperCamelCase : str , UpperCamelCase : str ): '''simple docstring''' _a = {'''Content-Type''': '''application/json'''} _a = requests.post(UpperCamelCase ,...
22
from math import pi, sqrt def lowerCamelCase__ ( __lowerCamelCase : float ): if num <= 0: raise ValueError("""math domain error""" ) if num > 1_7_1.5: raise OverflowError("""math range error""" ) elif num - int(__lowerCamelCase ) not in ...
63
0
import gc import unittest import numpy as np import torch from diffusers import ( AudioDiffusionPipeline, AutoencoderKL, DDIMScheduler, DDPMScheduler, DiffusionPipeline, Mel, UNetaDConditionModel, UNetaDModel, ) from diffusers.utils import slow, torch_devi...
23
from __future__ import annotations from collections import deque from collections.abc import Sequence from dataclasses import dataclass from typing import Any @dataclass class a : """simple docstring""" a : int a : Node | None = ...
63
0
'''simple docstring''' from argparse import ArgumentParser, Namespace from ..utils import logging from . import BaseTransformersCLICommand def _UpperCamelCase (_lowerCamelCase : Namespace )-> List[str]: '''simple docstring''' return ConvertCommand( args.model...
24
import json import os import unittest from transformers.models.gptsan_japanese.tokenization_gptsan_japanese import ( VOCAB_FILES_NAMES, GPTSanJapaneseTokenizer, ) from transformers.testing_utils import require_tokenizers, slow from ...test_tokenization_common import TokenizerTesterMixi...
63
0
import numpy as np from matplotlib import pyplot as plt from sklearn.datasets import load_iris from sklearn.metrics import ConfusionMatrixDisplay from sklearn.model_selection import train_test_split from xgboost import XGBClassifier def lowerCamelCase__ ( _a): return (data["data"], data["target"]) def ...
25
from dataclasses import dataclass, field from typing import Tuple from ..utils import cached_property, is_torch_available, is_torch_tpu_available, logging, requires_backends from .benchmark_args_utils import BenchmarkArguments if is_torch_available(): import torch if is_torch_tpu_avai...
63
0
'''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
import contextlib import os import sqlitea import pytest from datasets import Dataset, Features, Value from datasets.io.sql import SqlDatasetReader, SqlDatasetWriter from ..utils import assert_arrow_memory_doesnt_increase, assert_arrow_memory_increases, require_sqlalchemy def ...
63
0
def __lowerCAmelCase( _SCREAMING_SNAKE_CASE = 100 ) -> int: """simple docstring""" _A = n * (n + 1) * (2 * n + 1) / 6 _A = (n * (n + 1) / 2) ** 2 return int(square_of_sum - sum_of_squares ) if __name__ == "__main__": print(...
27
from __future__ import annotations a : Optional[Any] = [True] * 1_000_001 a : Union[str, Any] = 2 while i * i <= 1_000_000: if seive[i]: for j in range(i * i, 1_000_001, i): a : Optional[Any] = False ...
63
0
'''simple docstring''' import logging import os from dataclasses import dataclass, field from typing import Dict, Optional import numpy as np from utils_multiple_choice import MultipleChoiceDataset, Split, processors import transformers from transformers import ( AutoConfig, AutoMo...
28
import argparse import torch from transformers import BlenderbotConfig, BlenderbotForConditionalGeneration from transformers.utils import logging logging.set_verbosity_info() a : Dict = logging.get_logger(__name__) a : Tuple = [ ["attention", "attn"], ...
63
0
"""simple docstring""" import string from math import logaa def lowercase ( lowerCAmelCase__ ,lowerCAmelCase__ ): lowerCamelCase_ = document.translate( str.maketrans('''''' ,'''''' ,string.punctuation ) ).replace('''\n''' ,'''''' ) lowerCamelCase_ = document_wit...
29
def lowerCamelCase__ ( __lowerCamelCase : Tuple , __lowerCamelCase : List[Any] ): __UpperCAmelCase : List[str] = 0 __UpperCAmelCase : List[str] = len(__lowerCamelCase ) - 1 while left <= right: # avoid divided by 0 during inter...
63
0
import re from flax.core.frozen_dict import freeze from flax.traverse_util import flatten_dict, unflatten_dict from jax.experimental import PartitionSpec as P # Sentinels __a = object() # For specifying empty leaf dict `{}` __a = object() def lowerCamelCase__ ( _lowerc...
30
from ...utils import ( OptionalDependencyNotAvailable, is_torch_available, is_transformers_available, is_transformers_version, ) try: if not (is_transformers_available() and is_torch_available() and is_transformers_version(">=", "4.25.0")): raise OptionalDe...
63
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 lowerCamelCase__ : List[str] = logging.get_logger(__name__) lowerCamelCase__ : U...
31
import math from typing import List, Optional, Tuple, Union import numpy as np import torch from ..configuration_utils import ConfigMixin, register_to_config from .scheduling_utils import SchedulerMixin, SchedulerOutput class a ( lowercase__ , lowercase__ ): "...
63
0
import copy import inspect import unittest import numpy as np from huggingface_hub import hf_hub_download from transformers import TimesformerConfig from transformers.models.auto import get_values from transformers.testing_utils import require_torch, require_vision, slow, torch_device from transformers.utils im...
32
from argparse import ArgumentParser from .add_new_model import AddNewModelCommand from .add_new_model_like import AddNewModelLikeCommand from .convert import ConvertCommand from .download import DownloadCommand from .env import EnvironmentCommand from .lfs import LfsCommands from .pt_to_tf import...
63
0
def SCREAMING_SNAKE_CASE ( __lowerCAmelCase , __lowerCAmelCase ) -> str: if a < 0 or b < 0: raise ValueError('''the value of both inputs must be positive''' ) snake_case__ = str(bin(__lowerCAmelCase ) )[2:] # remove the leading "0b" snake_case__ = str(bin(__l...
33
from typing import TYPE_CHECKING from ...utils import ( OptionalDependencyNotAvailable, _LazyModule, is_flax_available, is_sentencepiece_available, is_tf_available, is_tokenizers_available, is_torch_available, ) a : List[str] = {"configuration_xg...
63
0
"""simple docstring""" from collections import OrderedDict from typing import TYPE_CHECKING, Any, Mapping, Optional from packaging import version from ...configuration_utils import PretrainedConfig from ...onnx import OnnxConfig from ...onnx.utils import compute_effective_axis_dimension from ...utils impo...
34
from typing import TYPE_CHECKING from ...utils import OptionalDependencyNotAvailable, _LazyModule, is_sentencepiece_available a : str = {} try: if not is_sentencepiece_available(): raise OptionalDependencyNotAvailable() except OptionalDependencyNotAvailab...
63
0
import os from shutil import copyfile from typing import List, Optional, Tuple from ...tokenization_utils import AddedToken from ...tokenization_utils_fast import PreTrainedTokenizerFast from ...utils import is_sentencepiece_available, logging if is_sentencepiece_available(): from .tokenization_camembert impo...
35
def lowerCamelCase__ ( __lowerCamelCase : int ): if num <= 0: raise ValueError("""Input must be a positive integer""" ) __UpperCAmelCase : int = [True] * (num + 1) __UpperCAmelCase : Tuple = 2 while p * p <= num: if primes[p]: ...
63
0
# Copyright (c) 2021-, NVIDIA CORPORATION. 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 ap...
36
import copy import os from typing import Union from ...configuration_utils import PretrainedConfig from ...utils import logging a : str = logging.get_logger(__name__) a : Union[str, Any] = { "microsoft/git-base": "https://huggingface.co/microsoft/git-base...
63
0
from math import ceil def UpperCamelCase_ ( __a = 1_001 ) -> int: a__ : Optional[Any] = 1 for i in range(1 , int(ceil(n / 2.0 ) ) ): a__ : List[str] = 2 * i + 1 a__ : Optional[int] = 2 * i a__ : Dict = to...
37
import unittest from transformers import BarthezTokenizer, BarthezTokenizerFast, BatchEncoding from transformers.testing_utils import require_sentencepiece, require_tokenizers, require_torch, slow from ...test_tokenization_common import TokenizerTesterMixin @require_tokenizers @require_sentencepi...
63
0
'''simple docstring''' import heapq as hq import math from collections.abc import Iterator class __snake_case : '''simple docstring''' def __init__( self , __SCREAMING_SNAKE_CASE ): snake_case__ : List[Any] = str(id_ ) snake_case__ : Dict...
38
from __future__ import annotations import math def lowerCamelCase__ ( __lowerCamelCase : int , __lowerCamelCase : int , __lowerCamelCase : bool , __lowerCamelCase : list[int] , __lowerCamelCase : float ): if depth <...
63
0
import argparse import logging import sys from unittest.mock import patch import run_glue_deebert from transformers.testing_utils import TestCasePlus, get_gpu_count, require_torch_non_multi_gpu, slow logging.basicConfig(level=logging.DEBUG) lowerCAmelCase_ = logging.getLogger() de...
39
from ...configuration_utils import PretrainedConfig from ...utils import logging a : Tuple = logging.get_logger(__name__) a : List[str] = {"openai-gpt": "https://huggingface.co/openai-gpt/resolve/main/config.json"} class a ( lowercase__ ): ...
63
0
import os import time import warnings from dataclasses import dataclass, field from enum import Enum from typing import List, Optional, Union import torch from filelock import FileLock from torch.utils.data import Dataset from ...tokenization_utils_base import PreTrainedTokenizerBase from ...utils import logging ...
40
import gc import random import unittest import numpy as np import torch from PIL import Image from diffusers import ( DDIMScheduler, KandinskyVaaInpaintPipeline, KandinskyVaaPriorPipeline, UNetaDConditionModel, VQModel, ) from diffusers.utils import floats_tensor, load...
63
0
'''simple docstring''' from typing import TYPE_CHECKING from ...utils import OptionalDependencyNotAvailable, _LazyModule, is_flax_available, is_torch_available lowerCAmelCase__ = { '''configuration_gpt_neo''': ['''GPT_NEO_PRETRAINED_CONFIG_ARCHIVE_MAP''', '''GPTNeoConfig''', '''GPTNeoOnnxConfig'...
41
import copy import fnmatch import json import os import pickle as pkl import shutil import sys import tarfile import tempfile from collections import OrderedDict from contextlib import contextmanager from functools import partial from hashlib import shaaaa from io import BytesIO from pathlib...
63
0
'''simple docstring''' A_ = {0: [2, 3], 1: [0], 2: [1], 3: [4], 4: []} A_ = {0: [1, 2, 3], 1: [2], 2: [0], 3: [4], 4: [5], 5: [3]} def _UpperCamelCase ( __UpperCamelCase ,__UpperCamelCase ,__UpperCamelCase ) -> list[int]: lowerCamelCase_ = True lowerCamelCase_ = ...
42
import unittest import numpy as np from transformers import RobertaConfig, is_flax_available from transformers.testing_utils import require_flax, slow from ...test_modeling_flax_common import FlaxModelTesterMixin, floats_tensor, ids_tensor, random_attention_mask if is_flax_available(): ...
63
0
import argparse import random import joblib import numpy as np import torch from igf.igf import ( SecondaryLearner, collect_objective_set, compute_perplexity, generate_datasets, load_gpta, recopy_gpta, set_seed, train_secondary_learner, ) from torch.utils.data impo...
43
import math from enum import Enum from typing import Optional, Union from torch.optim import Optimizer from torch.optim.lr_scheduler import LambdaLR from .utils import logging a : Optional[int] = logging.get_logger(__name__) class a ( lowercase__ ): ...
63
0
'''simple docstring''' import warnings from contextlib import contextmanager from ....processing_utils import ProcessorMixin class UpperCAmelCase__ ( A ): lowerCAmelCase_ = 'MCTCTFeatureExtractor' lowerCAmelCase_ = 'AutoTokenizer' def __init__( self : ...
44
from math import pi, sqrt def lowerCamelCase__ ( __lowerCamelCase : float ): if num <= 0: raise ValueError("""math domain error""" ) if num > 1_7_1.5: raise OverflowError("""math range error""" ) elif num - int(__lowerCamelCase ) not in ...
63
0
from math import factorial def A ( lowercase__ : int , lowercase__ : int ) -> int: # If either of the conditions are true, the function is being asked # to calculate a factorial of a negative number, which is not possible if n < k or k < 0: raise ValueError("""Please enter positive inte...
45
from __future__ import annotations from collections import deque from collections.abc import Sequence from dataclasses import dataclass from typing import Any @dataclass class a : """simple docstring""" a : int a : Node | None = ...
63
0
"""simple docstring""" from ..utils import ( OptionalDependencyNotAvailable, is_flax_available, is_scipy_available, is_torch_available, is_torchsde_available, ) try: if not is_torch_available(): raise OptionalDependencyNotAvailable() except OptionalDependencyNotAvailable: from ..u...
46
import json import os import unittest from transformers.models.gptsan_japanese.tokenization_gptsan_japanese import ( VOCAB_FILES_NAMES, GPTSanJapaneseTokenizer, ) from transformers.testing_utils import require_tokenizers, slow from ...test_tokenization_common import TokenizerTesterMixi...
63
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 transfor...
47
from dataclasses import dataclass, field from typing import Tuple from ..utils import cached_property, is_torch_available, is_torch_tpu_available, logging, requires_backends from .benchmark_args_utils import BenchmarkArguments if is_torch_available(): import torch if is_torch_tpu_avai...
63
0
'''simple docstring''' def A ( ) -> int: '''simple docstring''' lowerCAmelCase__ = [] lowerCAmelCase__ = 1 while len(UpperCamelCase_ ) < 1E6: constant.append(str(UpperCamelCase_ ) ) i += 1 lowerCAmelCase__ = "".join(Upper...
48
import contextlib import os import sqlitea import pytest from datasets import Dataset, Features, Value from datasets.io.sql import SqlDatasetReader, SqlDatasetWriter from ..utils import assert_arrow_memory_doesnt_increase, assert_arrow_memory_increases, require_sqlalchemy def ...
63
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 transfo...
49
from __future__ import annotations a : Optional[Any] = [True] * 1_000_001 a : Union[str, Any] = 2 while i * i <= 1_000_000: if seive[i]: for j in range(i * i, 1_000_001, i): a : Optional[Any] = False ...
63
0
'''simple docstring''' import functools import operator from ...configuration_utils import PretrainedConfig from ...utils import logging UpperCamelCase : Dict = logging.get_logger(__name__) UpperCamelCase : Optional[Any] = { 'asapp/sew-tiny-100k': 'https://huggingface.co/...
50
import argparse import torch from transformers import BlenderbotConfig, BlenderbotForConditionalGeneration from transformers.utils import logging logging.set_verbosity_info() a : Dict = logging.get_logger(__name__) a : Tuple = [ ["attention", "attn"], ...
63
0
'''simple docstring''' import string def __snake_case ( SCREAMING_SNAKE_CASE_ : str ) -> str: """simple docstring""" UpperCAmelCase = '''''' for i in sequence: UpperCAmelCase = ord(SCREAMING_SNAKE_CASE_ ) if 65 <= extract <= 90: ...
51
def lowerCamelCase__ ( __lowerCamelCase : Tuple , __lowerCamelCase : List[Any] ): __UpperCAmelCase : List[str] = 0 __UpperCAmelCase : List[str] = len(__lowerCamelCase ) - 1 while left <= right: # avoid divided by 0 during inter...
63
0
"""simple docstring""" import itertools import string from collections.abc import Generator, Iterable def __A ( a_ :Iterable[str] , a_ :int) -> Generator[tuple[str, ...], None, None]: __a : List[str] = iter(a_) while True: __a ...
52
from ...utils import ( OptionalDependencyNotAvailable, is_torch_available, is_transformers_available, is_transformers_version, ) try: if not (is_transformers_available() and is_torch_available() and is_transformers_version(">=", "4.25.0")): raise OptionalDe...
63
0
class _UpperCAmelCase : """simple docstring""" def __init__( self : Optional[Any] , lowerCAmelCase_ : int ) -> Optional[Any]: __lowerCAmelCase = n __lowerCAmelCase = [None] * self.n __lowerCAmelCase = 0 ...
53
import math from typing import List, Optional, Tuple, Union import numpy as np import torch from ..configuration_utils import ConfigMixin, register_to_config from .scheduling_utils import SchedulerMixin, SchedulerOutput class a ( lowercase__ , lowercase__ ): "...
63
0
import itertools import os import random import tempfile import unittest import numpy as np from transformers import TvltFeatureExtractor, is_datasets_available from transformers.testing_utils import check_json_file_has_correct_format, require_torch, require_torchaudio from transformers.utils.im...
54
from argparse import ArgumentParser from .add_new_model import AddNewModelCommand from .add_new_model_like import AddNewModelLikeCommand from .convert import ConvertCommand from .download import DownloadCommand from .env import EnvironmentCommand from .lfs import LfsCommands from .pt_to_tf import...
63
0
from collections import OrderedDict from typing import List, Mapping from packaging import version from ...configuration_utils import PretrainedConfig from ...onnx import OnnxConfig from ...utils import logging SCREAMING_SNAKE_CASE :Union[str, Any] = logging.get_logger(__name__) SCREAMING_SNAKE_C...
55
from typing import TYPE_CHECKING from ...utils import ( OptionalDependencyNotAvailable, _LazyModule, is_flax_available, is_sentencepiece_available, is_tf_available, is_tokenizers_available, is_torch_available, ) a : List[str] = {"configuration_xg...
63
0
'''simple docstring''' from transformers import HfArgumentParser, TensorFlowBenchmark, TensorFlowBenchmarkArguments def _a () -> Any: """simple docstring""" __snake_case = HfArgumentParser(lowercase__ ) __snake_case = parser.parse_args_into_data...
56
from typing import TYPE_CHECKING from ...utils import OptionalDependencyNotAvailable, _LazyModule, is_sentencepiece_available a : str = {} try: if not is_sentencepiece_available(): raise OptionalDependencyNotAvailable() except OptionalDependencyNotAvailab...
63
0
import unittest import numpy as np import torch from diffusers import KarrasVePipeline, KarrasVeScheduler, UNetaDModel from diffusers.utils.testing_utils import enable_full_determinism, require_torch, slow, torch_device enable_full_determinism() class _lowerCAmelCase( unitte...
57
def lowerCamelCase__ ( __lowerCamelCase : int ): if num <= 0: raise ValueError("""Input must be a positive integer""" ) __UpperCAmelCase : int = [True] * (num + 1) __UpperCAmelCase : Tuple = 2 while p * p <= num: if primes[p]: ...
63
0
"""simple docstring""" import unittest from transformers import AlbertConfig, is_torch_available from transformers.models.auto import get_values from transformers.testing_utils import require_torch, slow, torch_device from ...test_configuration_common import ConfigTester from ...test_modelin...
58
import copy import os from typing import Union from ...configuration_utils import PretrainedConfig from ...utils import logging a : str = logging.get_logger(__name__) a : Union[str, Any] = { "microsoft/git-base": "https://huggingface.co/microsoft/git-base...
63
0
import warnings from ...utils import logging from .image_processing_layoutlmva import LayoutLMvaImageProcessor __A = logging.get_logger(__name__) class _SCREAMING_SNAKE_CASE ( __SCREAMING_SNAKE_CASE ): '''simple docstring''' def __init__(self : Optional[int] ,...
59
import unittest from transformers import BarthezTokenizer, BarthezTokenizerFast, BatchEncoding from transformers.testing_utils import require_sentencepiece, require_tokenizers, require_torch, slow from ...test_tokenization_common import TokenizerTesterMixin @require_tokenizers @require_sentencepi...
63
0