code
stringlengths
86
54.5k
code_codestyle
int64
0
371
style_context
stringlengths
87
49.2k
style_context_codestyle
int64
0
349
label
int64
0
1
import argparse import pytorch_lightning as pl import torch from torch import nn from transformers import LongformerForQuestionAnswering, LongformerModel class A (pl.LightningModule ): '''simple docstring''' def __init__( self : List[str] , __lowe...
276
from typing import Dict, List, Optional, Union import numpy as np from ...image_processing_utils import BaseImageProcessor, BatchFeature, get_size_dict from ...image_transforms import ( center_crop, get_resize_output_image_size, normalize, rescale, resize, to_channel_dim...
276
1
# Usage: # ./gen-card-facebook-wmt19.py import os from pathlib import Path def __lowerCamelCase ( __a :Optional[int] , __a :Optional[int] , __a :Dict ) -> Union[str, Any]: """simple docstring""" A__ = { ...
276
def __lowerCamelCase ( __a :float , __a :list[float] ) -> float: """simple docstring""" if discount_rate < 0: raise ValueError("""Discount rate cannot be negative""" ) if not cash_flows: raise ValueError("""Cash flows list cannot be emp...
276
1
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_device...
276
from collections import OrderedDict from typing import Mapping from ...configuration_utils import PretrainedConfig from ...onnx import OnnxConfig from ...utils import logging A : Tuple = logging.get_logger(__name__) A : Optional[int] = { '''roberta-base''': '''https://huggin...
276
1
import os from shutil import copyfile from typing import Any, Dict, List, Optional, Tuple import sentencepiece as spm from ...tokenization_utils import PreTrainedTokenizer from ...utils import logging A : Dict = logging.get_logger(__name__) A : Union[str, Any] = {'''vocab_file...
276
def __lowerCamelCase ( __a :int = 3 , __a :int = 7 , __a :int = 1_0_0_0_0_0_0 ) -> int: """simple docstring""" A__ = 0 A__ = 1 for current_denominator in range(1 , limit + 1 ): A__ = cu...
276
1
from typing import TYPE_CHECKING from ...utils import OptionalDependencyNotAvailable, _LazyModule, is_torch_available, is_vision_available A : Any = { '''configuration_chinese_clip''': [ '''CHINESE_CLIP_PRETRAINED_CONFIG_ARCHIVE_MAP''', '''ChineseCLIPConfig''', ...
276
from maths.is_square_free import is_square_free from maths.prime_factors import prime_factors def __lowerCamelCase ( __a :int ) -> int: """simple docstring""" A__ = prime_factors(__a ) if is_square_free(__a ): return -1 if l...
276
1
from transformers import HfArgumentParser, TensorFlowBenchmark, TensorFlowBenchmarkArguments def __lowerCamelCase ( ) -> Any: """simple docstring""" A__ = HfArgumentParser(__a ) A__ = parser.parse_args_into_dataclasses()[0] A_...
276
import unittest from transformers import EsmConfig, is_torch_available from transformers.testing_utils import TestCasePlus, require_torch, slow, torch_device from ...test_configuration_common import ConfigTester from ...test_modeling_common import ModelTesterMixin, ids_tensor, random_attention_mask ...
276
1
from collections import OrderedDict from typing import Mapping from ...configuration_utils import PretrainedConfig from ...onnx import OnnxConfig from ...utils import logging A : Any = logging.get_logger(__name__) A : str = { '''facebook/data2vec-text-base''': '''https://hug...
276
from typing import List, Optional, Union from ...configuration_utils import PretrainedConfig from ...utils import logging A : Optional[Any] = logging.get_logger(__name__) A : List[str] = { '''huggingface/time-series-transformer-tourism-monthly''': ( '''https://hugging...
276
1
from typing import List, Union import numpy as np from ..utils import add_end_docstrings, is_torch_available, is_vision_available, logging, requires_backends from .base import PIPELINE_INIT_ARGS, Pipeline if is_vision_available(): from PIL import Image from ..image_utils import loa...
276
import math def __lowerCamelCase ( __a :int ) -> bool: """simple docstring""" A__ = math.loga(math.sqrt(4 * positive_integer + 1 ) / 2 + 1 / 2 ) return exponent == int(__a ) def __lowerCamelCase ( _...
276
1
from .imports import is_tqdm_available if is_tqdm_available(): from tqdm.auto import tqdm as _tqdm from ..state import PartialState def __lowerCamelCase ( __a :bool = True , *__a :Dict , **__a :str ) -> List[Any]: "...
276
import math def __lowerCamelCase ( ) -> None: """simple docstring""" A__ = input("""Enter message: """ ) A__ = int(input(F'Enter key [2-{len(__a ) - 1}]: ' ) ) A__ = input("""Encryption/Decryption [e/d]: """ ...
276
1
import numpy as np import qiskit def __lowerCamelCase ( __a :int = 8 , __a :int | None = None ) -> str: """simple docstring""" A__ = np.random.default_rng(seed=__a ) # Roughly 25% of the qubits will contribute to the ...
276
import os import re import shutil import sys import tempfile import unittest import black A : Dict = os.path.abspath(os.path.dirname(os.path.dirname(os.path.dirname(__file__)))) sys.path.append(os.path.join(git_repo_path, '''utils''')) import check_copies # noqa: E402 # This is...
276
1
import tempfile import unittest from pathlib import Path from shutil import copyfile from transformers import BatchEncoding, MarianTokenizer from transformers.testing_utils import get_tests_dir, require_sentencepiece, slow from transformers.utils import is_sentencepiece_available, is_tf_available, i...
276
import argparse import torch from transformers import BertForMaskedLM if __name__ == "__main__": A : List[str] = argparse.ArgumentParser( description=( '''Extraction some layers of the full BertForMaskedLM or RObertaForMaskedLM for Transfer Learned''' ...
276
1
from __future__ import annotations from typing import Any def __lowerCamelCase ( __a :list[Any] ) -> None: """simple docstring""" create_state_space_tree(__a , [] , 0 ) def __lowerCamelCase ( __a :...
276
from string import ascii_uppercase A : List[str] = {str(ord(c) - 5_5): c for c in ascii_uppercase} def __lowerCamelCase ( __a :int , __a :int ) -> str: """simple docstring""" if isinstance(__a , __a ): raise TypeE...
276
1
import argparse import torch from diffusers.pipelines.stable_diffusion.convert_from_ckpt import download_from_original_stable_diffusion_ckpt if __name__ == "__main__": A : List[str] = argparse.ArgumentParser() parser.add_argument( '''--checkpoint_path''', default=No...
276
from typing import TYPE_CHECKING from ...utils import ( OptionalDependencyNotAvailable, _LazyModule, is_flax_available, is_tf_available, is_torch_available, ) A : Optional[Any] = {'''configuration_vit_mae''': ['''VIT_MAE_PRETRAINED_CONFIG_ARCHIVE_MAP''', '''ViTMAECon...
276
1
from collections import OrderedDict from typing import Mapping from ...configuration_utils import PretrainedConfig from ...onnx import OnnxConfig from ...utils import logging A : int = logging.get_logger(__name__) A : Any = { '''xlm-mlm-en-2048''': '''https://huggingface.co/...
276
import unittest import numpy as np def __lowerCamelCase ( __a :np.ndarray , __a :np.ndarray , __a :np.ndarray , __a :np.ndarray | None = None , ) -> np.ndarray: """simple docstring""" A__ = np.s...
276
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 ...
276
from ...utils import is_note_seq_available, is_transformers_available, is_torch_available from ...utils import OptionalDependencyNotAvailable try: if not (is_transformers_available() and is_torch_available()): raise OptionalDependencyNotAvailable() except OptionalDependencyNotAvailab...
276
1
from abc import ABC, abstractmethod from argparse import ArgumentParser class A (SCREAMING_SNAKE_CASE ): '''simple docstring''' @staticmethod @abstractmethod def a_ ( __lowerCAmelCase : ArgumentParser ) -> Union[str, Any]: ...
276
import argparse import math import traceback import dateutil.parser as date_parser import requests def __lowerCamelCase ( __a :str ) -> Optional[int]: """simple docstring""" A__ = {} A__ = job["""started_at"""] A...
276
1
import os import unittest from transformers import LxmertTokenizer, LxmertTokenizerFast from transformers.models.bert.tokenization_bert import VOCAB_FILES_NAMES from transformers.testing_utils import require_tokenizers from ...test_tokenization_common import TokenizerTesterMixin @require_token...
276
from __future__ import annotations import unittest from transformers import BlenderbotSmallConfig, BlenderbotSmallTokenizer, is_tf_available from transformers.testing_utils import require_tf, require_tokenizers, slow from transformers.utils import cached_property from ...test_configuration_common...
276
1
from typing import Dict, List, Optional, Union import numpy as np from ...image_processing_utils import BaseImageProcessor, BatchFeature, get_size_dict from ...image_transforms import ( center_crop, convert_to_rgb, get_resize_output_image_size, normalize, rescale, resize...
276
from ...configuration_utils import PretrainedConfig from ...utils import logging A : Dict = logging.get_logger(__name__) A : Dict = { '''google/pegasus-large''': '''https://huggingface.co/google/pegasus-large/resolve/main/config.json''', # See all PEGASUS models at https://h...
276
1
from collections import defaultdict def __lowerCamelCase ( __a :str , __a :str ) -> bool: """simple docstring""" A__ = first_str.lower().strip() A__ = second_str.lower().strip() # Remove whitespace A__ ...
276
# Copyright 2023 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...
276
1
import argparse import json from collections import OrderedDict import torch from huggingface_hub import cached_download, hf_hub_url from transformers import AutoImageProcessor, CvtConfig, CvtForImageClassification def __lowerCamelCase ( __a :Tuple ) -> int: ...
276
import inspect from typing import Callable, List, Optional, Union import torch from transformers import ( CLIPImageProcessor, CLIPTextModel, CLIPTokenizer, WhisperForConditionalGeneration, WhisperProcessor, ) from diffusers import ( AutoencoderKL, DDIMScheduler, ...
276
1
import re from filelock import FileLock try: import nltk A : List[str] = True except (ImportError, ModuleNotFoundError): A : Dict = False if NLTK_AVAILABLE: with FileLock('''.lock''') as lock: nltk.download('''punkt''', quiet=True) ...
276
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...
276
1
import gc import unittest from diffusers import FlaxControlNetModel, FlaxStableDiffusionControlNetPipeline 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 ...
276
from typing import TYPE_CHECKING from ...utils import _LazyModule A : Optional[Any] = {'''processing_wav2vec2_with_lm''': ['''Wav2Vec2ProcessorWithLM''']} if TYPE_CHECKING: from .processing_wavaveca_with_lm import WavaVecaProcessorWithLM else: import sys A : List[s...
276
1
from typing import TYPE_CHECKING from ...utils import OptionalDependencyNotAvailable, _LazyModule, is_torch_available, is_vision_available A : List[Any] = { '''configuration_conditional_detr''': [ '''CONDITIONAL_DETR_PRETRAINED_CONFIG_ARCHIVE_MAP''', '''ConditionalDetrC...
276
from typing import Dict, List, Optional, Union import numpy as np from ...image_processing_utils import BaseImageProcessor, BatchFeature, get_size_dict from ...image_transforms import ( center_crop, get_resize_output_image_size, normalize, rescale, resize, to_channel_dim...
276
1
from math import loga def __lowerCamelCase ( __a :int ) -> int: """simple docstring""" if a < 0: raise ValueError("""Input value must be a positive integer""" ) elif isinstance(__a , __a ): raise TypeError("""Input value must...
276
def __lowerCamelCase ( __a :float , __a :list[float] ) -> float: """simple docstring""" if discount_rate < 0: raise ValueError("""Discount rate cannot be negative""" ) if not cash_flows: raise ValueError("""Cash flows list cannot be emp...
276
1
from ....utils import logging A : Optional[int] = logging.get_logger(__name__) class A (SCREAMING_SNAKE_CASE ): '''simple docstring''' def __init__( self : str , __lowerCAmelCase : List[str] , __lowerCAmelCase : Any=N...
276
from collections import OrderedDict from typing import Mapping from ...configuration_utils import PretrainedConfig from ...onnx import OnnxConfig from ...utils import logging A : Tuple = logging.get_logger(__name__) A : Optional[int] = { '''roberta-base''': '''https://huggin...
276
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_bert import BertTokenizer A : str = logging.get_logger(__name__) A : List[str] = ...
276
def __lowerCamelCase ( __a :int = 3 , __a :int = 7 , __a :int = 1_0_0_0_0_0_0 ) -> int: """simple docstring""" A__ = 0 A__ = 1 for current_denominator in range(1 , limit + 1 ): A__ = cu...
276
1
from __future__ import annotations def __lowerCamelCase ( __a :list , __a :int , __a :int , __a :int ) -> list: """simple docstring""" A__ = [] A__ , A__ = input_list[low:mid], in...
276
from maths.is_square_free import is_square_free from maths.prime_factors import prime_factors def __lowerCamelCase ( __a :int ) -> int: """simple docstring""" A__ = prime_factors(__a ) if is_square_free(__a ): return -1 if l...
276
1
import json import os import sys import tempfile import unittest from pathlib import Path from shutil import copyfile from huggingface_hub import HfFolder, Repository, create_repo, delete_repo from requests.exceptions import HTTPError import transformers from transformers import ( CONFIG_...
276
import unittest from transformers import EsmConfig, is_torch_available from transformers.testing_utils import TestCasePlus, require_torch, slow, torch_device from ...test_configuration_common import ConfigTester from ...test_modeling_common import ModelTesterMixin, ids_tensor, random_attention_mask ...
276
1
# Copyright 2023 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...
276
from typing import List, Optional, Union from ...configuration_utils import PretrainedConfig from ...utils import logging A : Optional[Any] = logging.get_logger(__name__) A : List[str] = { '''huggingface/time-series-transformer-tourism-monthly''': ( '''https://hugging...
276
1
import json import pathlib import unittest import numpy as np from transformers.testing_utils import require_torch, require_vision, slow from transformers.utils import is_torch_available, is_vision_available from ...test_image_processing_common import ImageProcessingSavingTestMixin, prepare_imag...
276
import math def __lowerCamelCase ( __a :int ) -> bool: """simple docstring""" A__ = math.loga(math.sqrt(4 * positive_integer + 1 ) / 2 + 1 / 2 ) return exponent == int(__a ) def __lowerCamelCase ( _...
276
1
import inspect from typing import List, Optional, Tuple, Union import torch from ...models import UNetaDModel, VQModel from ...schedulers import DDIMScheduler from ...utils import randn_tensor from ..pipeline_utils import DiffusionPipeline, ImagePipelineOutput class A (SCREAMING_SNAKE_...
276
import math def __lowerCamelCase ( ) -> None: """simple docstring""" A__ = input("""Enter message: """ ) A__ = int(input(F'Enter key [2-{len(__a ) - 1}]: ' ) ) A__ = input("""Encryption/Decryption [e/d]: """ ...
276
1
from ...configuration_utils import PretrainedConfig from ...utils import logging A : List[Any] = logging.get_logger(__name__) A : List[Any] = { '''microsoft/biogpt''': '''https://huggingface.co/microsoft/biogpt/resolve/main/config.json''', # See all BioGPT models at https://...
276
import os import re import shutil import sys import tempfile import unittest import black A : Dict = os.path.abspath(os.path.dirname(os.path.dirname(os.path.dirname(__file__)))) sys.path.append(os.path.join(git_repo_path, '''utils''')) import check_copies # noqa: E402 # This is...
276
1
from pathlib import Path import numpy as np from PIL import Image def __lowerCamelCase ( __a :np.ndarray ) -> np.ndarray: """simple docstring""" A__ , A__ , A__ = rgb[:, :, 0], rgb[:, :, 1], rgb[:, :, 2] return 0.2...
276
import argparse import torch from transformers import BertForMaskedLM if __name__ == "__main__": A : List[str] = argparse.ArgumentParser( description=( '''Extraction some layers of the full BertForMaskedLM or RObertaForMaskedLM for Transfer Learned''' ...
276
1
import inspect from typing import Callable, List, Optional, Union import torch from transformers import ( CLIPImageProcessor, CLIPTextModel, CLIPTokenizer, WhisperForConditionalGeneration, WhisperProcessor, ) from diffusers import ( AutoencoderKL, DDIMScheduler, ...
276
from string import ascii_uppercase A : List[str] = {str(ord(c) - 5_5): c for c in ascii_uppercase} def __lowerCamelCase ( __a :int , __a :int ) -> str: """simple docstring""" if isinstance(__a , __a ): raise TypeE...
276
1
import os import pytest from datasets import ( get_dataset_config_info, get_dataset_config_names, get_dataset_infos, get_dataset_split_names, inspect_dataset, inspect_metric, ) A : Tuple = pytest.mark.integration @pytest.mark.parametrize("""pat...
276
from typing import TYPE_CHECKING from ...utils import ( OptionalDependencyNotAvailable, _LazyModule, is_flax_available, is_tf_available, is_torch_available, ) A : Optional[Any] = {'''configuration_vit_mae''': ['''VIT_MAE_PRETRAINED_CONFIG_ARCHIVE_MAP''', '''ViTMAECon...
276
1
from ...configuration_utils import PretrainedConfig from ...utils import logging A : Union[str, Any] = logging.get_logger(__name__) A : str = { '''weiweishi/roc-bert-base-zh''': '''https://huggingface.co/weiweishi/roc-bert-base-zh/resolve/main/config.json''', } class A ...
276
import unittest import numpy as np def __lowerCamelCase ( __a :np.ndarray , __a :np.ndarray , __a :np.ndarray , __a :np.ndarray | None = None , ) -> np.ndarray: """simple docstring""" A__ = np.s...
276
1
from __future__ import annotations import unittest from transformers import BlenderbotSmallConfig, BlenderbotSmallTokenizer, is_tf_available from transformers.testing_utils import require_tf, require_tokenizers, slow from transformers.utils import cached_property from ...test_configuration_common...
276
from ...utils import is_note_seq_available, is_transformers_available, is_torch_available from ...utils import OptionalDependencyNotAvailable try: if not (is_transformers_available() and is_torch_available()): raise OptionalDependencyNotAvailable() except OptionalDependencyNotAvailab...
276
1
import gc import unittest import numpy as np import torch from transformers import CLIPTextConfig, CLIPTextModel, CLIPTokenizer from diffusers import ( AutoencoderKL, DDIMScheduler, StableDiffusionAttendAndExcitePipeline, UNetaDConditionModel, ) from diffusers.utils import loa...
276
import argparse import math import traceback import dateutil.parser as date_parser import requests def __lowerCamelCase ( __a :str ) -> Optional[int]: """simple docstring""" A__ = {} A__ = job["""started_at"""] A...
276
1
from __future__ import annotations from typing import TypedDict class A (SCREAMING_SNAKE_CASE ): '''simple docstring''' __lowerCamelCase : str __lowerCamelCase : int def __lowerCamelCase ( __a :str ) -> list[str]: ...
276
from __future__ import annotations import unittest from transformers import BlenderbotSmallConfig, BlenderbotSmallTokenizer, is_tf_available from transformers.testing_utils import require_tf, require_tokenizers, slow from transformers.utils import cached_property from ...test_configuration_common...
276
1
from timeit import timeit def __lowerCamelCase ( __a :int ) -> int: """simple docstring""" if number < 0: raise ValueError("""the value of input must not be negative""" ) A__ = 0 while number: number &= number - 1 ...
276
from ...configuration_utils import PretrainedConfig from ...utils import logging A : Dict = logging.get_logger(__name__) A : Dict = { '''google/pegasus-large''': '''https://huggingface.co/google/pegasus-large/resolve/main/config.json''', # See all PEGASUS models at https://h...
276
1
from typing import List, Optional, Union from ...configuration_utils import PretrainedConfig from ...utils import logging A : Optional[Any] = logging.get_logger(__name__) A : List[str] = { '''huggingface/time-series-transformer-tourism-monthly''': ( '''https://hugging...
276
# Copyright 2023 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...
276
1
import argparse import requests import torch # pip3 install salesforce-lavis # I'm actually installing a slightly modified version: pip3 install git+https://github.com/nielsrogge/LAVIS.git@fix_lavis_float32 (there's also the fix_lavis branch) # also note: to convert Vicuna checkpoints, we had to in...
276
import inspect from typing import Callable, List, Optional, Union import torch from transformers import ( CLIPImageProcessor, CLIPTextModel, CLIPTokenizer, WhisperForConditionalGeneration, WhisperProcessor, ) from diffusers import ( AutoencoderKL, DDIMScheduler, ...
276
1
import inspect import os import unittest from pathlib import Path import torch import accelerate from accelerate.test_utils import execute_subprocess_async from accelerate.test_utils.testing import run_command class A (unittest.TestCase ): '''simple docstring''' __lo...
276
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...
276
1
from __future__ import annotations import os import tempfile import unittest from transformers import ConvBertConfig, is_tf_available from transformers.testing_utils import require_tf, slow from ...test_configuration_common import ConfigTester from ...test_modeling_tf_common import TFModelTeste...
276
from typing import TYPE_CHECKING from ...utils import _LazyModule A : Optional[Any] = {'''processing_wav2vec2_with_lm''': ['''Wav2Vec2ProcessorWithLM''']} if TYPE_CHECKING: from .processing_wavaveca_with_lm import WavaVecaProcessorWithLM else: import sys A : List[s...
276
1
from typing import TYPE_CHECKING from ...utils import ( OptionalDependencyNotAvailable, _LazyModule, is_tf_available, is_tokenizers_available, is_torch_available, is_vision_available, ) A : Union[str, Any] = { '''configuration_layoutlmv3''': [ '''L...
276
from typing import Dict, List, Optional, Union import numpy as np from ...image_processing_utils import BaseImageProcessor, BatchFeature, get_size_dict from ...image_transforms import ( center_crop, get_resize_output_image_size, normalize, rescale, resize, to_channel_dim...
276
1
from typing import TYPE_CHECKING from ...utils import OptionalDependencyNotAvailable, _LazyModule, is_sentencepiece_available A : Any = {} try: if not is_sentencepiece_available(): raise OptionalDependencyNotAvailable() except OptionalDependencyNotAvailable: pass e...
276
def __lowerCamelCase ( __a :float , __a :list[float] ) -> float: """simple docstring""" if discount_rate < 0: raise ValueError("""Discount rate cannot be negative""" ) if not cash_flows: raise ValueError("""Cash flows list cannot be emp...
276
1
from ...configuration_utils import PretrainedConfig from ...utils import logging A : Dict = logging.get_logger(__name__) A : Dict = { '''google/pegasus-large''': '''https://huggingface.co/google/pegasus-large/resolve/main/config.json''', # See all PEGASUS models at https://h...
276
from collections import OrderedDict from typing import Mapping from ...configuration_utils import PretrainedConfig from ...onnx import OnnxConfig from ...utils import logging A : Tuple = logging.get_logger(__name__) A : Optional[int] = { '''roberta-base''': '''https://huggin...
276
1
import logging from transformers.configuration_utils import PretrainedConfig A : Any = logging.getLogger(__name__) class A (SCREAMING_SNAKE_CASE ): '''simple docstring''' __lowerCamelCase : Any = '''masked_bert''' def __init__( ...
276
def __lowerCamelCase ( __a :int = 3 , __a :int = 7 , __a :int = 1_0_0_0_0_0_0 ) -> int: """simple docstring""" A__ = 0 A__ = 1 for current_denominator in range(1 , limit + 1 ): A__ = cu...
276
1
from __future__ import annotations import unittest from transformers import FunnelConfig, is_tf_available from transformers.testing_utils import require_tf from ...test_configuration_common import ConfigTester from ...test_modeling_tf_common import TFModelTesterMixin, ids_tensor, random_attention...
276
from maths.is_square_free import is_square_free from maths.prime_factors import prime_factors def __lowerCamelCase ( __a :int ) -> int: """simple docstring""" A__ = prime_factors(__a ) if is_square_free(__a ): return -1 if l...
276
1
import os import re import shutil import sys import tempfile import unittest import black A : Dict = os.path.abspath(os.path.dirname(os.path.dirname(os.path.dirname(__file__)))) sys.path.append(os.path.join(git_repo_path, '''utils''')) import check_copies # noqa: E402 # This is...
276
import unittest from transformers import EsmConfig, is_torch_available from transformers.testing_utils import TestCasePlus, require_torch, slow, torch_device from ...test_configuration_common import ConfigTester from ...test_modeling_common import ModelTesterMixin, ids_tensor, random_attention_mask ...
276
1
import os import textwrap import pyarrow as pa import pytest from datasets import ClassLabel, Features, Image from datasets.packaged_modules.csv.csv import Csv from ..utils import require_pil @pytest.fixture def __lowerCamelCase ( __a :Optional[int] ) -> ...
276
from typing import List, Optional, Union from ...configuration_utils import PretrainedConfig from ...utils import logging A : Optional[Any] = logging.get_logger(__name__) A : List[str] = { '''huggingface/time-series-transformer-tourism-monthly''': ( '''https://hugging...
276
1
from typing import Any, Callable, Dict, List, Optional, Union import torch from transformers import CLIPImageProcessor, CLIPTextModel, CLIPTokenizer from diffusers import ( AutoencoderKL, DDIMScheduler, DiffusionPipeline, LMSDiscreteScheduler, PNDMScheduler, StableDiffus...
276
import math def __lowerCamelCase ( __a :int ) -> bool: """simple docstring""" A__ = math.loga(math.sqrt(4 * positive_integer + 1 ) / 2 + 1 / 2 ) return exponent == int(__a ) def __lowerCamelCase ( _...
276
1
from math import ceil, sqrt def __lowerCamelCase ( __a :int = 1_0_0_0_0_0_0 ) -> int: """simple docstring""" A__ = 0 for outer_width in range(3 , (limit // 4) + 2 ): if outer_width**2 > limit: A__ = ma...
350
import math def __lowerCamelCase ( ) -> None: """simple docstring""" A__ = input("""Enter message: """ ) A__ = int(input(F'Enter key [2-{len(__a ) - 1}]: ' ) ) A__ = input("""Encryption/Decryption [e/d]: """ ...
276
0
import argparse import json import os import evaluate import torch from datasets import load_dataset from torch.optim import AdamW from torch.utils.data import DataLoader from transformers import AutoModelForSequenceClassification, AutoTokenizer, get_linear_schedule_with_warmup, set_seed from a...
351
import os import re import shutil import sys import tempfile import unittest import black A : Dict = os.path.abspath(os.path.dirname(os.path.dirname(os.path.dirname(__file__)))) sys.path.append(os.path.join(git_repo_path, '''utils''')) import check_copies # noqa: E402 # This is...
276
0
"""simple docstring""" import warnings from contextlib import contextmanager from ...processing_utils import ProcessorMixin class A (_UpperCAmelCase ): '''simple docstring''' __lowerCamelCase : List[Any] = "Speech2TextFeatureExtractor" __lowerCam...
352
import argparse import torch from transformers import BertForMaskedLM if __name__ == "__main__": A : List[str] = argparse.ArgumentParser( description=( '''Extraction some layers of the full BertForMaskedLM or RObertaForMaskedLM for Transfer Learned''' ...
276
0
import argparse import torch from huggingface_hub import hf_hub_download from transformers import AutoTokenizer, RobertaPreLayerNormConfig, RobertaPreLayerNormForMaskedLM from transformers.utils import logging logging.set_verbosity_info() A : List[Any] = logging.get_logger(__name__) ...
353
from string import ascii_uppercase A : List[str] = {str(ord(c) - 5_5): c for c in ascii_uppercase} def __lowerCamelCase ( __a :int , __a :int ) -> str: """simple docstring""" if isinstance(__a , __a ): raise TypeE...
276
0
import unittest import numpy as np from transformers.testing_utils import require_pytesseract, require_torch from transformers.utils import is_pytesseract_available, is_torch_available from ...test_image_processing_common import ImageProcessingSavingTestMixin, prepare_image_inputs if is_torch...
354
from typing import TYPE_CHECKING from ...utils import ( OptionalDependencyNotAvailable, _LazyModule, is_flax_available, is_tf_available, is_torch_available, ) A : Optional[Any] = {'''configuration_vit_mae''': ['''VIT_MAE_PRETRAINED_CONFIG_ARCHIVE_MAP''', '''ViTMAECon...
276
0
def __lowerCamelCase ( __a :str , __a :int ) -> str: """simple docstring""" A__ = [[] for _ in range(__a )] A__ = key - 1 if key <= 0: raise ValueError("""Height of grid can\'t be 0 or negative""" ) if key == 1 or len(__a ) <= ...
355
import unittest import numpy as np def __lowerCamelCase ( __a :np.ndarray , __a :np.ndarray , __a :np.ndarray , __a :np.ndarray | None = None , ) -> np.ndarray: """simple docstring""" A__ = np.s...
276
0
import pytest from datasets import inspect_metric, list_metrics, load_metric @pytest.fixture def __lowerCamelCase ( __a :List[str] ) -> Dict: """simple docstring""" monkeypatch.setattr("""datasets.utils.deprecation_utils._emitted_deprecation_wa...
356
from ...utils import is_note_seq_available, is_transformers_available, is_torch_available from ...utils import OptionalDependencyNotAvailable try: if not (is_transformers_available() and is_torch_available()): raise OptionalDependencyNotAvailable() except OptionalDependencyNotAvailab...
276
0
"""simple docstring""" def __lowerCamelCase ( __a :int , __a :int ) -> str: """simple docstring""" return "\n".join( F'{number} * {i} = {number * i}' for i in range(1 , number_of_terms + 1 ) ) if __name__ == "__main__": ...
357
import argparse import math import traceback import dateutil.parser as date_parser import requests def __lowerCamelCase ( __a :str ) -> Optional[int]: """simple docstring""" A__ = {} A__ = job["""started_at"""] A...
276
0
import os import pickle import unittest from transformers import AutoTokenizer from transformers.models.bert.tokenization_bert import BertTokenizer from transformers.models.bert_japanese.tokenization_bert_japanese import ( VOCAB_FILES_NAMES, BertJapaneseTokenizer, CharacterTokenizer, JumanppToken...
358
from __future__ import annotations import unittest from transformers import BlenderbotSmallConfig, BlenderbotSmallTokenizer, is_tf_available from transformers.testing_utils import require_tf, require_tokenizers, slow from transformers.utils import cached_property from ...test_configuration_common...
276
0
from __future__ import annotations from itertools import permutations from random import randint from timeit import repeat def __lowerCamelCase ( ) -> Optional[int]: """simple docstring""" A__ = [randint(-1_0_0_0 , 1_0_0_0 ) for i i...
359
from ...configuration_utils import PretrainedConfig from ...utils import logging A : Dict = logging.get_logger(__name__) A : Dict = { '''google/pegasus-large''': '''https://huggingface.co/google/pegasus-large/resolve/main/config.json''', # See all PEGASUS models at https://h...
276
0
import copy from typing import Dict, Optional from ...configuration_utils import PretrainedConfig from ...utils import logging from ..auto import CONFIG_MAPPING from ..detr import DetrConfig from ..swin import SwinConfig A : int = { '''facebook/maskformer-swin-base-ade''': ( ...
360
# Copyright 2023 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...
276
0
import importlib import json import os from collections import OrderedDict from typing import Dict, Optional, Union # Build the list of all feature extractors from ...configuration_utils import PretrainedConfig from ...dynamic_module_utils import get_class_from_dynamic_module, resolve_trust_remote_code from ...f...
361
import inspect from typing import Callable, List, Optional, Union import torch from transformers import ( CLIPImageProcessor, CLIPTextModel, CLIPTokenizer, WhisperForConditionalGeneration, WhisperProcessor, ) from diffusers import ( AutoencoderKL, DDIMScheduler, ...
276
0
import math from ...configuration_utils import PretrainedConfig from ...utils import logging A : Any = logging.get_logger(__name__) A : int = { '''facebook/data2vec-base-960h''': '''https://huggingface.co/facebook/data2vec-audio-base-960h/resolve/main/config.json''', # See all Data...
362
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...
276
0
def __lowerCamelCase ( __a :Optional[Any] , __a :Union[str, Any] , __a :Tuple , __a :Optional[int] ) -> bool: """simple docstring""" if graph[path[curr_ind - 1]][next_ver] == 0: return False # 2. Validate that next ve...
363
from typing import TYPE_CHECKING from ...utils import _LazyModule A : Optional[Any] = {'''processing_wav2vec2_with_lm''': ['''Wav2Vec2ProcessorWithLM''']} if TYPE_CHECKING: from .processing_wavaveca_with_lm import WavaVecaProcessorWithLM else: import sys A : List[s...
276
0
import gc import random import unittest import numpy as np import torch from PIL import Image from diffusers import ( DDIMScheduler, KandinskyVaaControlnetImgaImgPipeline, KandinskyVaaPriorEmbaEmbPipeline, UNetaDConditionModel, VQModel, ) from diffusers.utils import floa...
364
from typing import Dict, List, Optional, Union import numpy as np from ...image_processing_utils import BaseImageProcessor, BatchFeature, get_size_dict from ...image_transforms import ( center_crop, get_resize_output_image_size, normalize, rescale, resize, to_channel_dim...
276
0
import itertools from dataclasses import dataclass from typing import Optional import pandas as pd import pyarrow as pa import datasets from datasets.table import table_cast @dataclass class A (datasets.BuilderConfig ): '''simple docstring''' __lowerCamelCase : O...
365
def __lowerCamelCase ( __a :float , __a :list[float] ) -> float: """simple docstring""" if discount_rate < 0: raise ValueError("""Discount rate cannot be negative""" ) if not cash_flows: raise ValueError("""Cash flows list cannot be emp...
276
0
import os import random import sys from . import cryptomath_module as cryptoMath # noqa: N812 from . import rabin_miller as rabinMiller # noqa: N812 def __lowerCamelCase ( ) -> List[Any]: """simple docstring""" print("""Making key files...""" ) ...
366
from collections import OrderedDict from typing import Mapping from ...configuration_utils import PretrainedConfig from ...onnx import OnnxConfig from ...utils import logging A : Tuple = logging.get_logger(__name__) A : Optional[int] = { '''roberta-base''': '''https://huggin...
276
0
"""simple docstring""" import functools import logging import os import sys import threading from logging import ( CRITICAL, # NOQA DEBUG, # NOQA ERROR, # NOQA FATAL, # NOQA INFO, # NOQA NOTSET, # NOQA WARN, # NOQA WARNING, # NOQA ) from typing...
367
def __lowerCamelCase ( __a :int = 3 , __a :int = 7 , __a :int = 1_0_0_0_0_0_0 ) -> int: """simple docstring""" A__ = 0 A__ = 1 for current_denominator in range(1 , limit + 1 ): A__ = cu...
276
0
def __lowerCamelCase ( __a :int = 1_0_0 ) -> 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(F'''{so...
368
from maths.is_square_free import is_square_free from maths.prime_factors import prime_factors def __lowerCamelCase ( __a :int ) -> int: """simple docstring""" A__ = prime_factors(__a ) if is_square_free(__a ): return -1 if l...
276
0
import copy import tempfile import unittest from transformers import MaMaaaConfig, is_torch_available from transformers.testing_utils import require_sentencepiece, require_tokenizers, require_torch, slow, torch_device from transformers.utils import cached_property from ...generation.test_utils imp...
369
import unittest from transformers import EsmConfig, is_torch_available from transformers.testing_utils import TestCasePlus, require_torch, slow, torch_device from ...test_configuration_common import ConfigTester from ...test_modeling_common import ModelTesterMixin, ids_tensor, random_attention_mask ...
276
0
from __future__ import annotations def __lowerCamelCase ( __a :list[list[int]] ): """simple docstring""" for i in range(1 , len(matrix[0] ) ): matrix[0][i] += matrix[0][i - 1] # preprocessing the first column for i in range(1 ,...
370
from typing import List, Optional, Union from ...configuration_utils import PretrainedConfig from ...utils import logging A : Optional[Any] = logging.get_logger(__name__) A : List[str] = { '''huggingface/time-series-transformer-tourism-monthly''': ( '''https://hugging...
276
0
from typing import TYPE_CHECKING from ...utils import ( OptionalDependencyNotAvailable, _LazyModule, is_sentencepiece_available, is_tokenizers_available, is_torch_available, ) A : Any = { "configuration_llama": ["LLAMA_PRETRAINED_CONFIG_ARCHIVE_MAP", "LlamaConfi...
371
import math def __lowerCamelCase ( __a :int ) -> bool: """simple docstring""" A__ = math.loga(math.sqrt(4 * positive_integer + 1 ) / 2 + 1 / 2 ) return exponent == int(__a ) def __lowerCamelCase ( _...
276
0
import argparse import os import evaluate import torch from datasets import load_dataset from torch.optim import AdamW from torch.utils.data import DataLoader from transformers import AutoModelForSequenceClassification, AutoTokenizer, get_linear_schedule_with_warmup, set_seed from accelerate imp...
350
import math def __lowerCamelCase ( ) -> None: """simple docstring""" A__ = input("""Enter message: """ ) A__ = int(input(F'Enter key [2-{len(__a ) - 1}]: ' ) ) A__ = input("""Encryption/Decryption [e/d]: """ ...
276
0
from typing import TYPE_CHECKING from ...utils import OptionalDependencyNotAvailable, _LazyModule, is_torch_available, is_vision_available A : List[Any] = {'''configuration_glpn''': ['''GLPN_PRETRAINED_CONFIG_ARCHIVE_MAP''', '''GLPNConfig''']} try: if not is_vision_available(): ...
351
import os import re import shutil import sys import tempfile import unittest import black A : Dict = os.path.abspath(os.path.dirname(os.path.dirname(os.path.dirname(__file__)))) sys.path.append(os.path.join(git_repo_path, '''utils''')) import check_copies # noqa: E402 # This is...
276
0
"""simple docstring""" import argparse import hashlib import os import urllib import warnings import torch from torch import nn from tqdm import tqdm from transformers import WhisperConfig, WhisperForConditionalGeneration A : str = { """tiny.en""": """https://openaipubl...
352
import argparse import torch from transformers import BertForMaskedLM if __name__ == "__main__": A : List[str] = argparse.ArgumentParser( description=( '''Extraction some layers of the full BertForMaskedLM or RObertaForMaskedLM for Transfer Learned''' ...
276
0
import json from typing import List, Optional, Tuple from tokenizers import normalizers from ...tokenization_utils_fast import PreTrainedTokenizerFast from ...utils import logging from .tokenization_convbert import ConvBertTokenizer A : str = logging.get_logger(__name__) A : str ...
353
from string import ascii_uppercase A : List[str] = {str(ord(c) - 5_5): c for c in ascii_uppercase} def __lowerCamelCase ( __a :int , __a :int ) -> str: """simple docstring""" if isinstance(__a , __a ): raise TypeE...
276
0
from collections import OrderedDict from typing import Mapping from packaging import version from ...configuration_utils import PretrainedConfig from ...onnx import OnnxConfig from ...utils import logging A : Tuple = logging.get_logger(__name__) A : str = { '''faceboo...
354
from typing import TYPE_CHECKING from ...utils import ( OptionalDependencyNotAvailable, _LazyModule, is_flax_available, is_tf_available, is_torch_available, ) A : Optional[Any] = {'''configuration_vit_mae''': ['''VIT_MAE_PRETRAINED_CONFIG_ARCHIVE_MAP''', '''ViTMAECon...
276
0
import re import warnings from contextlib import contextmanager from ...processing_utils import ProcessorMixin class A (_UpperCAmelCase ): '''simple docstring''' __lowerCamelCase : Tuple = ['image_processor', 'tokenizer'] __lowerCamelCase : Union[str, Any] = ...
355
import unittest import numpy as np def __lowerCamelCase ( __a :np.ndarray , __a :np.ndarray , __a :np.ndarray , __a :np.ndarray | None = None , ) -> np.ndarray: """simple docstring""" A__ = np.s...
276
0
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 from sag...
356
from ...utils import is_note_seq_available, is_transformers_available, is_torch_available from ...utils import OptionalDependencyNotAvailable try: if not (is_transformers_available() and is_torch_available()): raise OptionalDependencyNotAvailable() except OptionalDependencyNotAvailab...
276
0
"""simple docstring""" from ...configuration_utils import PretrainedConfig from ...utils import logging A : Union[str, Any] = logging.get_logger(__name__) A : Optional[int] = { '''studio-ousia/luke-base''': '''https://huggingface.co/studio-ousia/luke-base/resolve/main/co...
357
import argparse import math import traceback import dateutil.parser as date_parser import requests def __lowerCamelCase ( __a :str ) -> Optional[int]: """simple docstring""" A__ = {} A__ = job["""started_at"""] A...
276
0
import numpy as np def __lowerCamelCase ( __a :Tuple , __a :List[str] ) -> Any: """simple docstring""" return np.where(vector > 0 , __a , (alpha * (np.exp(__a ) - 1)) ) if __name__ == "__main__": import doctest doctest.testmod() ...
358
from __future__ import annotations import unittest from transformers import BlenderbotSmallConfig, BlenderbotSmallTokenizer, is_tf_available from transformers.testing_utils import require_tf, require_tokenizers, slow from transformers.utils import cached_property from ...test_configuration_common...
276
0
import json import os import shutil import tempfile import unittest import numpy as np import pytest from transformers import MgpstrTokenizer from transformers.models.mgp_str.tokenization_mgp_str import VOCAB_FILES_NAMES from transformers.testing_utils import require_torch, require_vision from...
359
from ...configuration_utils import PretrainedConfig from ...utils import logging A : Dict = logging.get_logger(__name__) A : Dict = { '''google/pegasus-large''': '''https://huggingface.co/google/pegasus-large/resolve/main/config.json''', # See all PEGASUS models at https://h...
276
0
import argparse import torch from torch import nn from transformers import SpeechaTextConfig, SpeechaTextForConditionalGeneration def __lowerCamelCase ( __a :Any ) -> Dict: """simple docstring""" A__ = [ """encoder.version"...
360
# Copyright 2023 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...
276
0
import argparse import fairseq import torch from transformers import UniSpeechSatConfig, UniSpeechSatForCTC, UniSpeechSatForPreTraining, logging logging.set_verbosity_info() A : str = logging.get_logger(__name__) A : Any = { 'post_extract_proj': 'feature_projection.projection', 'encoder...
361
import inspect from typing import Callable, List, Optional, Union import torch from transformers import ( CLIPImageProcessor, CLIPTextModel, CLIPTokenizer, WhisperForConditionalGeneration, WhisperProcessor, ) from diffusers import ( AutoencoderKL, DDIMScheduler, ...
276
0
from abc import ABC, abstractmethod from argparse import ArgumentParser class A (__snake_case ): '''simple docstring''' @staticmethod @abstractmethod def a_ ( __lowerCAmelCase : Optional[int] ) -> int: """simple docstring""" ...
362
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...
276
0
from collections import OrderedDict from typing import Mapping from ...configuration_utils import PretrainedConfig from ...onnx import OnnxConfig from ...utils import logging A : Optional[int] = logging.get_logger(__name__) A : Optional[int] = { '''andreasmadsen/efficient_mlm_m0...
363
from typing import TYPE_CHECKING from ...utils import _LazyModule A : Optional[Any] = {'''processing_wav2vec2_with_lm''': ['''Wav2Vec2ProcessorWithLM''']} if TYPE_CHECKING: from .processing_wavaveca_with_lm import WavaVecaProcessorWithLM else: import sys A : List[s...
276
0
def __lowerCamelCase ( __a :list , __a :int = 0 ) -> List[Any]: """simple docstring""" A__ = length or len(_a ) A__ = False for i in range(length - 1 ): if list_data[i] > list_data[i + 1]: A__ = l...
364
from typing import Dict, List, Optional, Union import numpy as np from ...image_processing_utils import BaseImageProcessor, BatchFeature, get_size_dict from ...image_transforms import ( center_crop, get_resize_output_image_size, normalize, rescale, resize, to_channel_dim...
276
0
import math class A : '''simple docstring''' def a_ ( self : Optional[int] , __lowerCAmelCase : list[list[float]] , __lowerCAmelCase : list[int] ) -> List[Any]: """simple docstring""" ...
365
def __lowerCamelCase ( __a :float , __a :list[float] ) -> float: """simple docstring""" if discount_rate < 0: raise ValueError("""Discount rate cannot be negative""" ) if not cash_flows: raise ValueError("""Cash flows list cannot be emp...
276
0
from typing import List, Optional, Tuple, Union import PIL import torch from torchvision import transforms from diffusers.pipeline_utils import DiffusionPipeline, ImagePipelineOutput from diffusers.schedulers import DDIMScheduler from diffusers.utils import randn_tensor A : Optional[Any] ...
366
from collections import OrderedDict from typing import Mapping from ...configuration_utils import PretrainedConfig from ...onnx import OnnxConfig from ...utils import logging A : Tuple = logging.get_logger(__name__) A : Optional[int] = { '''roberta-base''': '''https://huggin...
276
0
"""simple docstring""" import functools import operator from ...configuration_utils import PretrainedConfig from ...utils import logging A : List[Any] = logging.get_logger(__name__) A : Optional[Any] = { 'microsoft/unispeech-large-1500h-cv': ( 'https://huggi...
367
def __lowerCamelCase ( __a :int = 3 , __a :int = 7 , __a :int = 1_0_0_0_0_0_0 ) -> int: """simple docstring""" A__ = 0 A__ = 1 for current_denominator in range(1 , limit + 1 ): A__ = cu...
276
0
from collections import OrderedDict from typing import Mapping from ...configuration_utils import PretrainedConfig from ...onnx import OnnxConfig from ...utils import logging A : Union[str, Any] = logging.get_logger(__name__) A : Optional[Any] = { '''junnyu/roformer_chinese_...
368
from maths.is_square_free import is_square_free from maths.prime_factors import prime_factors def __lowerCamelCase ( __a :int ) -> int: """simple docstring""" A__ = prime_factors(__a ) if is_square_free(__a ): return -1 if l...
276
0
import unittest from transformers import EsmConfig, is_torch_available from transformers.testing_utils import TestCasePlus, require_torch, slow, torch_device from ...test_configuration_common import ConfigTester from ...test_modeling_common import ModelTesterMixin, ids_tensor, random_attention_mask ...
369
import unittest from transformers import EsmConfig, is_torch_available from transformers.testing_utils import TestCasePlus, require_torch, slow, torch_device from ...test_configuration_common import ConfigTester from ...test_modeling_common import ModelTesterMixin, ids_tensor, random_attention_mask ...
276
0
import glob import os import random from string import ascii_lowercase, digits import cva A : int = '''''' A : Union[str, Any] = '''''' A : Union[str, Any] = '''''' A : List[str] = 1 # (0 is vertical, 1 is horizontal) def __lowerCamelCase ( ...
370
from typing import List, Optional, Union from ...configuration_utils import PretrainedConfig from ...utils import logging A : Optional[Any] = logging.get_logger(__name__) A : List[str] = { '''huggingface/time-series-transformer-tourism-monthly''': ( '''https://hugging...
276
0
from typing import Optional import numpy as np import torch from torch import nn from transformers import GPTaConfig, GPTaLMHeadModel from transformers.modeling_utils import ModuleUtilsMixin from ...configuration_utils import ConfigMixin, register_to_config from ...models import ModelMixin c...
371
import math def __lowerCamelCase ( __a :int ) -> bool: """simple docstring""" A__ = math.loga(math.sqrt(4 * positive_integer + 1 ) / 2 + 1 / 2 ) return exponent == int(__a ) def __lowerCamelCase ( _...
276
0
from functools import lru_cache def __lowerCamelCase ( __a :int ) -> set: """simple docstring""" A__ = 2 A__ = set() while i * i <= n: if n % i: i += 1 else: n //= i factors.add(__lowerCAme...
350
import math def __lowerCamelCase ( ) -> None: """simple docstring""" A__ = input("""Enter message: """ ) A__ = int(input(F'Enter key [2-{len(__a ) - 1}]: ' ) ) A__ = input("""Encryption/Decryption [e/d]: """ ...
276
0
import fire from utils import calculate_rouge, save_json def __lowerCamelCase ( __a :List[str] , __a :List[Any] , __a :Optional[Any]=None , **__a :Any ) -> Optional[int]: """simple docstring""" A__ = ...
351
import os import re import shutil import sys import tempfile import unittest import black A : Dict = os.path.abspath(os.path.dirname(os.path.dirname(os.path.dirname(__file__)))) sys.path.append(os.path.join(git_repo_path, '''utils''')) import check_copies # noqa: E402 # This is...
276
0
"""simple docstring""" from typing import List, Optional, Tuple from ...tokenization_utils_fast import PreTrainedTokenizerFast from ...utils import logging from .tokenization_herbert import HerbertTokenizer A : str = logging.get_logger(__name__) A : int = {"""vocab_file""...
352
import argparse import torch from transformers import BertForMaskedLM if __name__ == "__main__": A : List[str] = argparse.ArgumentParser( description=( '''Extraction some layers of the full BertForMaskedLM or RObertaForMaskedLM for Transfer Learned''' ...
276
0
from typing import List, Optional, Union import numpy as np import torch import torchaudio.compliance.kaldi as ta_kaldi from ...feature_extraction_sequence_utils import SequenceFeatureExtractor from ...feature_extraction_utils import BatchFeature from ...utils import PaddingStrategy, TensorType, l...
353
from string import ascii_uppercase A : List[str] = {str(ord(c) - 5_5): c for c in ascii_uppercase} def __lowerCamelCase ( __a :int , __a :int ) -> str: """simple docstring""" if isinstance(__a , __a ): raise TypeE...
276
0