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 __future__ import annotations
import collections
import pprint
from pathlib import Path
def _SCREAMING_SNAKE_CASE ( __lowercase : str ) -> str:
"""simple docstring"""
return "".join(sorted(__lowercase ) )
def _SCREAMING_SNAKE_CASE ( __lowercas... | 637 |
def _SCREAMING_SNAKE_CASE ( __lowercase : int ) -> list[int]:
"""simple docstring"""
if length <= 0 or not isinstance(__lowercase , __lowercase ):
raise ValueError("""Length must be a positive integer.""" )
return [n * (2 * n - 1) for n in range... | 637 | 1 |
from typing import TYPE_CHECKING
from ...utils import (
OptionalDependencyNotAvailable,
_LazyModule,
is_sentencepiece_available,
is_tf_available,
is_tokenizers_available,
is_torch_available,
)
__a : Optional[int] = {"configuration_xlnet": ["XLNET_PRETRAINED_CONFIG_ARCHIVE_... | 637 |
from __future__ import annotations
from PIL import Image
# Define glider example
__a : Tuple = [
[0, 1, 0, 0, 0, 0, 0, 0],
[0, 0, 1, 0, 0, 0, 0, 0],
[1, 1, 1, 0, 0, 0, 0, 0],
[0, 0, 0, 0, 0, 0, 0, 0],
[0, 0, 0, 0, 0, 0, 0, 0],
[0, 0, 0, 0, 0, 0, 0, 0],
[0, 0, 0, 0, 0, 0... | 637 | 1 |
from typing import Optional, Union
import torch
from torch import nn
from torch.nn import BCEWithLogitsLoss, CrossEntropyLoss, MSELoss
from ...activations import ACTaFN
from ...modeling_outputs import BaseModelOutputWithPoolingAndNoAttention, ImageClassifierOutputWithNoAttention
from ...modeling_utils import P... | 637 |
import json
from typing import List, Optional, Tuple
from tokenizers import pre_tokenizers, processors
from ...tokenization_utils_base import AddedToken, BatchEncoding
from ...tokenization_utils_fast import PreTrainedTokenizerFast
from ...utils import logging
from .tokenization_roberta import RobertaTokenizer
... | 637 | 1 |
import argparse
import json
import os
import fairseq
import torch
from fairseq.data import Dictionary
# Register SEW's fairseq modules
from sew_asapp import tasks # noqa: F401
from transformers import (
SEWConfig,
SEWForCTC,
SEWModel,
WavaVecaCTCTokenizer,
WavaVecaFeatureExtractor,
Wa... | 637 |
from typing import TYPE_CHECKING
from ...utils import OptionalDependencyNotAvailable, _LazyModule, is_torch_available
__a : Any = {
"configuration_time_series_transformer": [
"TIME_SERIES_TRANSFORMER_PRETRAINED_CONFIG_ARCHIVE_MAP",
"TimeSeriesTransformerConfig",
],
}
try:... | 637 | 1 |
from collections.abc import Generator
from math import sin
def _SCREAMING_SNAKE_CASE ( __lowercase : bytes ) -> bytes:
"""simple docstring"""
if len(__lowercase ) != 3_2:
raise ValueError("""Input must be of length 32""" )
__A = B""""""
... | 637 |
import argparse
import pathlib
import fairseq
import torch
from fairseq.models.roberta import RobertaModel as FairseqRobertaModel
from fairseq.modules import TransformerSentenceEncoderLayer
from packaging import version
from transformers import XLMRobertaConfig, XLMRobertaXLForMaskedLM, XLMRobertaXLForSequence... | 637 | 1 |
class __lowercase :
'''simple docstring'''
def __init__( self : Optional[int] , UpperCamelCase_ : Optional[Any] ):
"""simple docstring"""
__A = val
__A = None
__A = None
... | 637 |
from ...configuration_utils import PretrainedConfig
from ...utils import logging
__a : Dict = logging.get_logger(__name__)
__a : Dict = {
"bigcode/gpt_bigcode-santacoder": "https://huggingface.co/bigcode/gpt_bigcode-santacoder/resolve/main/config.json",
}
class __lowercase ... | 637 | 1 |
import warnings
from ..trainer import Trainer
from ..utils import logging
__a : Tuple = logging.get_logger(__name__)
class __lowercase ( lowercase_ ):
'''simple docstring'''
def __init__( self : List[Any] , UpperCamelCase_ : str=No... | 637 |
from __future__ import annotations
def _SCREAMING_SNAKE_CASE ( __lowercase : list[int] , __lowercase : int ) -> bool:
"""simple docstring"""
if len(__lowercase ) == 0:
return False
__A = len(__lowercase ) // 2
if a_list[mi... | 637 | 1 |
def _SCREAMING_SNAKE_CASE ( __lowercase : str ) -> str:
"""simple docstring"""
__A = """"""
for ch in key:
if ch == " " or ch not in key_no_dups and ch.isalpha():
key_no_dups += ch
return key_no_dups
def _SCREAMING_SNAKE_CASE ... | 637 |
# Copyright 2023 The HuggingFace Inc. team. All rights reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required ... | 637 | 1 |
import datasets
from .evaluate import evaluate
__a : List[Any] = "\\n@inproceedings{Rajpurkar2016SQuAD10,\n title={SQuAD: 100, 000+ Questions for Machine Comprehension of Text},\n author={Pranav Rajpurkar and Jian Zhang and Konstantin Lopyrev and Percy Liang},\n booktitle={EMNLP},\n year={201... | 637 |
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 : List[str] = "▁"
__a : int = {"vocab_file": "spiece.model"}
__a : A... | 637 | 1 |
import unittest
import numpy as np
import timeout_decorator # noqa
from transformers import BlenderbotConfig, is_flax_available
from transformers.testing_utils import jax_device, require_flax, slow
from ...generation.test_flax_utils import FlaxGenerationTesterMixin
from ...test_modeling_flax_common import Fl... | 637 |
from ...configuration_utils import PretrainedConfig
from ...utils import logging
__a : Optional[Any] = logging.get_logger(__name__)
__a : Dict = {
"google/realm-cc-news-pretrained-embedder": (
"https://huggingface.co/google/realm-cc-news-pretrained-embedder/resolve/main/c... | 637 | 1 |
from typing import TYPE_CHECKING
from ...utils import OptionalDependencyNotAvailable, _LazyModule, is_torch_available
__a : Dict = {
"configuration_clipseg": [
"CLIPSEG_PRETRAINED_CONFIG_ARCHIVE_MAP",
"CLIPSegConfig",
"CLIPSegTextConfig",
"CLIPSegVisionConfig",... | 637 |
import argparse
import os
import re
import packaging.version
__a : Tuple = "examples/"
__a : Any = {
"examples": (re.compile(R"^check_min_version\(\"[^\"]+\"\)\s*$", re.MULTILINE), "check_min_version(\"VERSION\")\n"),
"init": (re.compile(R"^__version__\s+=\s+\"([^\"]+)\"\s*$"... | 637 | 1 |
from typing import List
import datasets
from datasets.tasks import AudioClassification
from ..folder_based_builder import folder_based_builder
__a : List[str] = datasets.utils.logging.get_logger(__name__)
class __lowercase ( folder_based_builder.FolderBasedBuilderConfig ):
... | 637 |
from ....configuration_utils import PretrainedConfig
from ....utils import logging
__a : List[Any] = logging.get_logger(__name__)
# TODO: upload to AWS
__a : Union[str, Any] = {
"yjernite/retribert-base-uncased": (
"https://huggingface.co/yjernite/retribert-base-uncased/r... | 637 | 1 |
def _SCREAMING_SNAKE_CASE ( __lowercase : list , __lowercase : list ) -> float:
"""simple docstring"""
_validate_point(__lowercase )
_validate_point(__lowercase )
if len(__lowercase ) != len(__lowercase ):
raise ValueError("""Bo... | 637 |
def _SCREAMING_SNAKE_CASE ( __lowercase : List[Any] ) -> Any:
"""simple docstring"""
stooge(__lowercase , 0 , len(__lowercase ) - 1 )
return arr
def _SCREAMING_SNAKE_CASE ( __lowercase : str , __lowercase : Dict... | 637 | 1 |
import unittest
from pathlib import Path
from tempfile import NamedTemporaryFile, TemporaryDirectory
from transformers import BertConfig, BertTokenizerFast, FeatureExtractionPipeline
from transformers.convert_graph_to_onnx import (
convert,
ensure_valid_input,
generate_identified_filename,
infer... | 637 |
def _SCREAMING_SNAKE_CASE ( __lowercase : str ) -> str:
"""simple docstring"""
__A = """"""
for ch in key:
if ch == " " or ch not in key_no_dups and ch.isalpha():
key_no_dups += ch
return key_no_dups
def _SCREAMING_SNAKE_CASE ... | 637 | 1 |
import importlib.util
import json
import os
import warnings
from dataclasses import dataclass, field
import torch
from ..training_args import TrainingArguments
from ..utils import cached_property, is_sagemaker_dp_enabled, logging
__a : Optional[int] = logging.get_logger(__name__)
def _S... | 637 |
from __future__ import annotations
from typing import Any
class __lowercase :
'''simple docstring'''
def __init__( self : Dict , UpperCamelCase_ : int , UpperCamelCase_ : int , UpperCamelCase_ : float = 0 ):
... | 637 | 1 |
from itertools import product
from cva import COLOR_BGR2GRAY, cvtColor, imread, imshow, waitKey
from numpy import dot, exp, mgrid, pi, ravel, square, uinta, zeros
def _SCREAMING_SNAKE_CASE ( __lowercase : List[Any] , __lowercase : int ) -> Union[str, Any]:
"""s... | 637 |
import warnings
from ...utils import logging
from .image_processing_deit import DeiTImageProcessor
__a : Any = logging.get_logger(__name__)
class __lowercase ( lowercase_ ):
'''simple docstring'''
def __init__( self : Union[str, Any] , *Upper... | 637 | 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 : List[str] = "▁"
__a : int = {"vocab_file": "spiece.model"}
__a : A... | 637 |
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 import Accelerator... | 637 | 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_MAPPING,
FEATU... | 637 |
from typing import TYPE_CHECKING
from ...utils import (
OptionalDependencyNotAvailable,
_LazyModule,
is_sentencepiece_available,
is_tf_available,
is_tokenizers_available,
is_torch_available,
)
__a : Optional[int] = {"configuration_xlnet": ["XLNET_PRETRAINED_CONFIG_ARCHIVE_... | 637 | 1 |
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 : Tuple = {
"xlm-roberta-base": "https://huggin... | 637 |
from typing import Optional, Union
import torch
from torch import nn
from torch.nn import BCEWithLogitsLoss, CrossEntropyLoss, MSELoss
from ...activations import ACTaFN
from ...modeling_outputs import BaseModelOutputWithPoolingAndNoAttention, ImageClassifierOutputWithNoAttention
from ...modeling_utils import P... | 637 | 1 |
from __future__ import annotations
from math import pi
# Define the Reduced Planck Constant ℏ (H bar), speed of light C, value of
# Pi and the function
__a : str = 1.0_5457_1817e-34 # unit of ℏ : J * s
__a : Any = 3e8 # unit of c : m * s^-1
def _SCREAMING_SNAKE_CASE ( ... | 637 |
import unittest
from transformers import SqueezeBertConfig, is_torch_available
from transformers.testing_utils import require_sentencepiece, require_tokenizers, require_torch, slow, torch_device
from ...test_configuration_common import ConfigTester
from ...test_modeling_common import ModelTesterMixin, ids_tens... | 637 | 1 |
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 D... | 637 |
import os
import shutil
import tempfile
from unittest import TestCase
from unittest.mock import patch
import numpy as np
from datasets import Dataset
from transformers.models.realm.configuration_realm import RealmConfig
from transformers.models.realm.retrieval_realm import _REALM_BLOCK_RECORDS_FILENAME, RealmR... | 637 | 1 |
import math
import flax.linen as nn
import jax.numpy as jnp
def _SCREAMING_SNAKE_CASE ( __lowercase : jnp.ndarray , __lowercase : int , __lowercase : float = 1 , __lowercase : float = 1 , __lowercase : float = 1.0E4 , __lowercas... | 637 |
from __future__ import annotations
from typing import Generic, TypeVar
__a : str = TypeVar("T")
class __lowercase ( Generic[T] ):
'''simple docstring'''
def __init__( self : Any , UpperCamelCase_ : T ):
"""simple docs... | 637 | 1 |
from argparse import ArgumentParser, Namespace
from ..utils import logging
from . import BaseTransformersCLICommand
def _SCREAMING_SNAKE_CASE ( __lowercase : Namespace ) -> Dict:
"""simple docstring"""
return ConvertCommand(
args.model_type , args.tf_ch... | 637 |
def _SCREAMING_SNAKE_CASE ( __lowercase : int ) -> list[int]:
"""simple docstring"""
if length <= 0 or not isinstance(__lowercase , __lowercase ):
raise ValueError("""Length must be a positive integer.""" )
return [n * (2 * n - 1) for n in range... | 637 | 1 |
import inspect
import os
import torch
from transformers import AutoModel
from transformers.testing_utils import mockenv_context
from transformers.trainer_utils import set_seed
import accelerate
from accelerate.accelerator import Accelerator
from accelerate.state import AcceleratorState
from accelerate.test_uti... | 637 |
from __future__ import annotations
from PIL import Image
# Define glider example
__a : Tuple = [
[0, 1, 0, 0, 0, 0, 0, 0],
[0, 0, 1, 0, 0, 0, 0, 0],
[1, 1, 1, 0, 0, 0, 0, 0],
[0, 0, 0, 0, 0, 0, 0, 0],
[0, 0, 0, 0, 0, 0, 0, 0],
[0, 0, 0, 0, 0, 0, 0, 0],
[0, 0, 0, 0, 0, 0... | 637 | 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 __lowercase ( unittest.TestCase ):
'''simple docstring'''
SCREAMIN... | 637 |
import json
from typing import List, Optional, Tuple
from tokenizers import pre_tokenizers, processors
from ...tokenization_utils_base import AddedToken, BatchEncoding
from ...tokenization_utils_fast import PreTrainedTokenizerFast
from ...utils import logging
from .tokenization_roberta import RobertaTokenizer
... | 637 | 1 |
from typing import TYPE_CHECKING
from ...utils import OptionalDependencyNotAvailable, _LazyModule, is_speech_available, is_torch_available
__a : Tuple = {
"configuration_audio_spectrogram_transformer": [
"AUDIO_SPECTROGRAM_TRANSFORMER_PRETRAINED_CONFIG_ARCHIVE_MAP",
"ASTConfig... | 637 |
from typing import TYPE_CHECKING
from ...utils import OptionalDependencyNotAvailable, _LazyModule, is_torch_available
__a : Any = {
"configuration_time_series_transformer": [
"TIME_SERIES_TRANSFORMER_PRETRAINED_CONFIG_ARCHIVE_MAP",
"TimeSeriesTransformerConfig",
],
}
try:... | 637 | 1 |
from math import ceil
def _SCREAMING_SNAKE_CASE ( __lowercase : List[Any] , __lowercase : Optional[int] ) -> List[str]:
"""simple docstring"""
__A = list(range(0 , __lowercase ) )
__A = [item for sublist in list(d... | 637 |
import argparse
import pathlib
import fairseq
import torch
from fairseq.models.roberta import RobertaModel as FairseqRobertaModel
from fairseq.modules import TransformerSentenceEncoderLayer
from packaging import version
from transformers import XLMRobertaConfig, XLMRobertaXLForMaskedLM, XLMRobertaXLForSequence... | 637 | 1 |
def _SCREAMING_SNAKE_CASE ( __lowercase : list ) -> list:
"""simple docstring"""
if len(__lowercase ) <= 1:
return [tuple(__lowercase )]
__A = []
def generate(__lowercase : int , __lowercase : list ):
__A ... | 637 |
from ...configuration_utils import PretrainedConfig
from ...utils import logging
__a : Dict = logging.get_logger(__name__)
__a : Dict = {
"bigcode/gpt_bigcode-santacoder": "https://huggingface.co/bigcode/gpt_bigcode-santacoder/resolve/main/config.json",
}
class __lowercase ... | 637 | 1 |
def _SCREAMING_SNAKE_CASE ( __lowercase : int , __lowercase : int , __lowercase : int ) -> int:
"""simple docstring"""
if exponent == 1:
return base
if exponent % 2 == 0:
__A = _modexpt(__lowercase , expone... | 637 |
from __future__ import annotations
def _SCREAMING_SNAKE_CASE ( __lowercase : list[int] , __lowercase : int ) -> bool:
"""simple docstring"""
if len(__lowercase ) == 0:
return False
__A = len(__lowercase ) // 2
if a_list[mi... | 637 | 1 |
from typing import TYPE_CHECKING
from ...utils import (
OptionalDependencyNotAvailable,
_LazyModule,
is_tf_available,
is_torch_available,
is_vision_available,
)
__a : Union[str, Any] = {
"configuration_mobilevit": ["MOBILEVIT_PRETRAINED_CONFIG_ARCHIVE_MAP", "MobileViTConfi... | 637 |
# Copyright 2023 The HuggingFace Inc. team. All rights reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required ... | 637 | 1 |
from sklearn.metrics import mean_squared_error
import datasets
__a : Any = "\\n@article{scikit-learn,\n title={Scikit-learn: Machine Learning in {P}ython},\n author={Pedregosa, F. and Varoquaux, G. and Gramfort, A. and Michel, V.\n and Thirion, B. and Grisel, O. and Blondel, M. and Prette... | 637 |
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 : List[str] = "▁"
__a : int = {"vocab_file": "spiece.model"}
__a : A... | 637 | 1 |
import unittest
import numpy as np
import torch
from .utils_summarization import build_mask, compute_token_type_ids, process_story, truncate_or_pad
class __lowercase ( unittest.TestCase ):
'''simple docstring'''
def lowerCAmelCase_ ( self : List[Any] ):
... | 637 |
from ...configuration_utils import PretrainedConfig
from ...utils import logging
__a : Optional[Any] = logging.get_logger(__name__)
__a : Dict = {
"google/realm-cc-news-pretrained-embedder": (
"https://huggingface.co/google/realm-cc-news-pretrained-embedder/resolve/main/c... | 637 | 1 |
from __future__ import annotations
import numpy as np
def _SCREAMING_SNAKE_CASE ( __lowercase : list[float] ) -> Optional[Any]:
"""simple docstring"""
return np.maximum(0 , __lowercase )
if __name__ == "__main__":
print(np.array(relu([-1, 0, 5]))) # --... | 637 |
import argparse
import os
import re
import packaging.version
__a : Tuple = "examples/"
__a : Any = {
"examples": (re.compile(R"^check_min_version\(\"[^\"]+\"\)\s*$", re.MULTILINE), "check_min_version(\"VERSION\")\n"),
"init": (re.compile(R"^__version__\s+=\s+\"([^\"]+)\"\s*$"... | 637 | 1 |
from __future__ import annotations
from collections import deque
class __lowercase :
'''simple docstring'''
def __init__( self : Dict , UpperCamelCase_ : list[str] ):
"""simple docstring"""
__A = []
self.... | 637 |
from ....configuration_utils import PretrainedConfig
from ....utils import logging
__a : List[Any] = logging.get_logger(__name__)
# TODO: upload to AWS
__a : Union[str, Any] = {
"yjernite/retribert-base-uncased": (
"https://huggingface.co/yjernite/retribert-base-uncased/r... | 637 | 1 |
from dataclasses import dataclass, field
from typing import Optional
@dataclass
class __lowercase :
'''simple docstring'''
SCREAMING_SNAKE_CASE = field(
default="codeparrot/codeparrot" , metadata={"help": "Model name or path of model to be trained."} )
SCREAMI... | 637 |
def _SCREAMING_SNAKE_CASE ( __lowercase : List[Any] ) -> Any:
"""simple docstring"""
stooge(__lowercase , 0 , len(__lowercase ) - 1 )
return arr
def _SCREAMING_SNAKE_CASE ( __lowercase : str , __lowercase : Dict... | 637 | 1 |
import unittest
from parameterized import parameterized
from transformers import LlamaConfig, is_torch_available, set_seed
from transformers.testing_utils import require_torch, slow, torch_device
from ...generation.test_utils import GenerationTesterMixin
from ...test_configuration_common import ConfigTester
f... | 637 |
def _SCREAMING_SNAKE_CASE ( __lowercase : str ) -> str:
"""simple docstring"""
__A = """"""
for ch in key:
if ch == " " or ch not in key_no_dups and ch.isalpha():
key_no_dups += ch
return key_no_dups
def _SCREAMING_SNAKE_CASE ... | 637 | 1 |
import argparse
import pathlib
import fairseq
import torch
from fairseq.models.roberta import RobertaModel as FairseqRobertaModel
from fairseq.modules import TransformerSentenceEncoderLayer
from packaging import version
from transformers import XLMRobertaConfig, XLMRobertaXLForMaskedLM, XLMRobertaXLForSequence... | 637 |
from __future__ import annotations
from typing import Any
class __lowercase :
'''simple docstring'''
def __init__( self : Dict , UpperCamelCase_ : int , UpperCamelCase_ : int , UpperCamelCase_ : float = 0 ):
... | 637 | 1 |
from ...configuration_utils import PretrainedConfig
from ...utils import logging
__a : Dict = logging.get_logger(__name__)
__a : Dict = {
"bigcode/gpt_bigcode-santacoder": "https://huggingface.co/bigcode/gpt_bigcode-santacoder/resolve/main/config.json",
}
class __lowercase ... | 637 |
import warnings
from ...utils import logging
from .image_processing_deit import DeiTImageProcessor
__a : Any = logging.get_logger(__name__)
class __lowercase ( lowercase_ ):
'''simple docstring'''
def __init__( self : Union[str, Any] , *Upper... | 637 | 1 |
from typing import TYPE_CHECKING
from ...utils import OptionalDependencyNotAvailable, _LazyModule, is_torch_available
__a : int = {"configuration_ibert": ["IBERT_PRETRAINED_CONFIG_ARCHIVE_MAP", "IBertConfig", "IBertOnnxConfig"]}
try:
if not is_torch_available():
raise OptionalDependencyNot... | 637 |
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 import Accelerator... | 637 | 1 |
import itertools
import random
import unittest
import numpy as np
from transformers import ASTFeatureExtractor
from transformers.testing_utils import require_torch, require_torchaudio
from transformers.utils.import_utils import is_torch_available
from ...test_sequence_feature_extraction_common import Sequence... | 637 |
from typing import TYPE_CHECKING
from ...utils import (
OptionalDependencyNotAvailable,
_LazyModule,
is_sentencepiece_available,
is_tf_available,
is_tokenizers_available,
is_torch_available,
)
__a : Optional[int] = {"configuration_xlnet": ["XLNET_PRETRAINED_CONFIG_ARCHIVE_... | 637 | 1 |
__a : int = "Tobias Carryer"
from time import time
class __lowercase :
'''simple docstring'''
def __init__( self : str , UpperCamelCase_ : int , UpperCamelCase_ : Any , UpperCamelCase_ : Union[str, Any]... | 637 |
from typing import Optional, Union
import torch
from torch import nn
from torch.nn import BCEWithLogitsLoss, CrossEntropyLoss, MSELoss
from ...activations import ACTaFN
from ...modeling_outputs import BaseModelOutputWithPoolingAndNoAttention, ImageClassifierOutputWithNoAttention
from ...modeling_utils import P... | 637 | 1 |
__a : Optional[Any] = [
(1000, "M"),
(900, "CM"),
(500, "D"),
(400, "CD"),
(100, "C"),
(90, "XC"),
(50, "L"),
(40, "XL"),
(10, "X"),
(9, "IX"),
(5, "V"),
(4, "IV"),
(1, "I"),
]
def _SCREAMING_SNAKE_CASE ( __lowercase : str ) ... | 637 |
import unittest
from transformers import SqueezeBertConfig, is_torch_available
from transformers.testing_utils import require_sentencepiece, require_tokenizers, require_torch, slow, torch_device
from ...test_configuration_common import ConfigTester
from ...test_modeling_common import ModelTesterMixin, ids_tens... | 637 | 1 |
from ...utils import (
OptionalDependencyNotAvailable,
is_torch_available,
is_transformers_available,
is_transformers_version,
)
try:
if not (is_transformers_available() and is_torch_available()):
raise OptionalDependencyNotAvailable()
except OptionalDependencyNotAvailable:
from ...util... | 637 |
import os
import shutil
import tempfile
from unittest import TestCase
from unittest.mock import patch
import numpy as np
from datasets import Dataset
from transformers.models.realm.configuration_realm import RealmConfig
from transformers.models.realm.retrieval_realm import _REALM_BLOCK_RECORDS_FILENAME, RealmR... | 637 | 1 |
from __future__ import annotations
import numpy as np
def _SCREAMING_SNAKE_CASE ( __lowercase : np.ndarray ) -> tuple[np.ndarray, np.ndarray]:
"""simple docstring"""
__A , __A = np.shape(__lowercase )
if rows != columns:
__A = ... | 637 |
from __future__ import annotations
from typing import Generic, TypeVar
__a : str = TypeVar("T")
class __lowercase ( Generic[T] ):
'''simple docstring'''
def __init__( self : Any , UpperCamelCase_ : T ):
"""simple docs... | 637 | 1 |
import pytest
from datasets.parallel import ParallelBackendConfig, parallel_backend
from datasets.utils.py_utils import map_nested
from .utils import require_dill_gt_0_3_2, require_joblibspark, require_not_windows
def _SCREAMING_SNAKE_CASE ( __lowercase : Tuple ) -> List[str]: # pi... | 637 |
def _SCREAMING_SNAKE_CASE ( __lowercase : int ) -> list[int]:
"""simple docstring"""
if length <= 0 or not isinstance(__lowercase , __lowercase ):
raise ValueError("""Length must be a positive integer.""" )
return [n * (2 * n - 1) for n in range... | 637 | 1 |
import os
import shutil
import sys
import tempfile
import unittest
from pathlib import Path
import pytest
import transformers
from transformers import (
BERT_PRETRAINED_CONFIG_ARCHIVE_MAP,
GPT2_PRETRAINED_CONFIG_ARCHIVE_MAP,
AutoTokenizer,
BertConfig,
BertTokenizer,
BertTokenizerFast,
... | 637 |
from __future__ import annotations
from PIL import Image
# Define glider example
__a : Tuple = [
[0, 1, 0, 0, 0, 0, 0, 0],
[0, 0, 1, 0, 0, 0, 0, 0],
[1, 1, 1, 0, 0, 0, 0, 0],
[0, 0, 0, 0, 0, 0, 0, 0],
[0, 0, 0, 0, 0, 0, 0, 0],
[0, 0, 0, 0, 0, 0, 0, 0],
[0, 0, 0, 0, 0, 0... | 637 | 1 |
import argparse
import json
import numpy
import torch
from transformers.models.xlm.tokenization_xlm import VOCAB_FILES_NAMES
from transformers.utils import CONFIG_NAME, WEIGHTS_NAME, logging
logging.set_verbosity_info()
def _SCREAMING_SNAKE_CASE ( __lowercase : int , __lowercase :... | 637 |
import json
from typing import List, Optional, Tuple
from tokenizers import pre_tokenizers, processors
from ...tokenization_utils_base import AddedToken, BatchEncoding
from ...tokenization_utils_fast import PreTrainedTokenizerFast
from ...utils import logging
from .tokenization_roberta import RobertaTokenizer
... | 637 | 1 |
from ...configuration_utils import PretrainedConfig
from ...utils import logging
__a : Union[str, Any] = logging.get_logger(__name__)
__a : Dict = {
"facebook/vit-mae-base": "https://huggingface.co/facebook/vit-mae-base/resolve/main/config.json",
# See all ViT MAE models at h... | 637 |
from typing import TYPE_CHECKING
from ...utils import OptionalDependencyNotAvailable, _LazyModule, is_torch_available
__a : Any = {
"configuration_time_series_transformer": [
"TIME_SERIES_TRANSFORMER_PRETRAINED_CONFIG_ARCHIVE_MAP",
"TimeSeriesTransformerConfig",
],
}
try:... | 637 | 1 |
__a : Any = "\n# Transformers installation\n! pip install transformers datasets\n# To install from source instead of the last release, comment the command above and uncomment the following one.\n# ! pip install git+https://github.com/huggingface/transformers.git\n"
__a : Optional[int] ... | 637 |
import argparse
import pathlib
import fairseq
import torch
from fairseq.models.roberta import RobertaModel as FairseqRobertaModel
from fairseq.modules import TransformerSentenceEncoderLayer
from packaging import version
from transformers import XLMRobertaConfig, XLMRobertaXLForMaskedLM, XLMRobertaXLForSequence... | 637 | 1 |
import argparse
import json
from collections import OrderedDict
from pathlib import Path
import requests
import torch
from huggingface_hub import hf_hub_download
from PIL import Image
from transformers import PoolFormerConfig, PoolFormerForImageClassification, PoolFormerImageProcessor
from transformers.utils i... | 637 |
from ...configuration_utils import PretrainedConfig
from ...utils import logging
__a : Dict = logging.get_logger(__name__)
__a : Dict = {
"bigcode/gpt_bigcode-santacoder": "https://huggingface.co/bigcode/gpt_bigcode-santacoder/resolve/main/config.json",
}
class __lowercase ... | 637 | 1 |
import collections
from typing import List, Optional, Union
from ...tokenization_utils_base import BatchEncoding
from ...utils import TensorType, add_end_docstrings, add_start_docstrings, logging
from ..bert.tokenization_bert import BertTokenizer
__a : List[str] = logging.get_logger(__name__)
__... | 637 |
from __future__ import annotations
def _SCREAMING_SNAKE_CASE ( __lowercase : list[int] , __lowercase : int ) -> bool:
"""simple docstring"""
if len(__lowercase ) == 0:
return False
__A = len(__lowercase ) // 2
if a_list[mi... | 637 | 1 |
from math import factorial, radians
def _SCREAMING_SNAKE_CASE ( __lowercase : float , __lowercase : int = 1_8 , __lowercase : int = 1_0 ) -> float:
"""simple docstring"""
__A = angle_in_degrees - ((angle_in_degrees // 360.0) * 360.0... | 637 |
# Copyright 2023 The HuggingFace Inc. team. All rights reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required ... | 637 | 1 |
from __future__ import annotations
import os
import tempfile
import unittest
import numpy as np
from huggingface_hub import hf_hub_download
from transformers import is_tensorflow_text_available, is_tf_available
from transformers.testing_utils import require_tensorflow_text, require_tf, slow
from ..test_model... | 637 |
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 : List[str] = "▁"
__a : int = {"vocab_file": "spiece.model"}
__a : A... | 637 | 1 |
from ....configuration_utils import PretrainedConfig
from ....utils import logging
__a : List[Any] = logging.get_logger(__name__)
# TODO: upload to AWS
__a : Union[str, Any] = {
"yjernite/retribert-base-uncased": (
"https://huggingface.co/yjernite/retribert-base-uncased/r... | 637 |
from ...configuration_utils import PretrainedConfig
from ...utils import logging
__a : Optional[Any] = logging.get_logger(__name__)
__a : Dict = {
"google/realm-cc-news-pretrained-embedder": (
"https://huggingface.co/google/realm-cc-news-pretrained-embedder/resolve/main/c... | 637 | 1 |
import argparse
import json
import os
import tensorstore as ts
import torch
from flax import serialization
from flax.traverse_util import flatten_dict, unflatten_dict
from tensorflow.io import gfile
from transformers.modeling_utils import dtype_byte_size
from transformers.models.switch_transformers.convert_swi... | 637 |
import argparse
import os
import re
import packaging.version
__a : Tuple = "examples/"
__a : Any = {
"examples": (re.compile(R"^check_min_version\(\"[^\"]+\"\)\s*$", re.MULTILINE), "check_min_version(\"VERSION\")\n"),
"init": (re.compile(R"^__version__\s+=\s+\"([^\"]+)\"\s*$"... | 637 | 1 |
import unittest
from transformers.models.xlm_prophetnet.tokenization_xlm_prophetnet import SPIECE_UNDERLINE, XLMProphetNetTokenizer
from transformers.testing_utils import get_tests_dir, require_sentencepiece, slow
from transformers.utils import cached_property
from ...test_tokenization_common import TokenizerT... | 637 |
from ....configuration_utils import PretrainedConfig
from ....utils import logging
__a : List[Any] = logging.get_logger(__name__)
# TODO: upload to AWS
__a : Union[str, Any] = {
"yjernite/retribert-base-uncased": (
"https://huggingface.co/yjernite/retribert-base-uncased/r... | 637 | 1 |
from __future__ import annotations
import inspect
import unittest
import numpy as np
from transformers import ResNetConfig
from transformers.testing_utils import require_tf, require_vision, slow
from transformers.utils import cached_property, is_tf_available, is_vision_available
from ...test_configuration_co... | 637 |
def _SCREAMING_SNAKE_CASE ( __lowercase : List[Any] ) -> Any:
"""simple docstring"""
stooge(__lowercase , 0 , len(__lowercase ) - 1 )
return arr
def _SCREAMING_SNAKE_CASE ( __lowercase : str , __lowercase : Dict... | 637 | 1 |
import unittest
from datasets import load_dataset
from transformers import BloomTokenizerFast
from transformers.testing_utils import require_tokenizers
from ...test_tokenization_common import TokenizerTesterMixin
@require_tokenizers
class __lowercase ( lowercase_ , unittest.TestCase ):
... | 637 |
def _SCREAMING_SNAKE_CASE ( __lowercase : str ) -> str:
"""simple docstring"""
__A = """"""
for ch in key:
if ch == " " or ch not in key_no_dups and ch.isalpha():
key_no_dups += ch
return key_no_dups
def _SCREAMING_SNAKE_CASE ... | 637 | 1 |
def _SCREAMING_SNAKE_CASE ( __lowercase : int = 1_0_0_0 ) -> int:
"""simple docstring"""
return sum(e for e in range(3 , __lowercase ) if e % 3 == 0 or e % 5 == 0 )
if __name__ == "__main__":
print(f"""{solution() = }""")
| 637 |
from __future__ import annotations
from typing import Any
class __lowercase :
'''simple docstring'''
def __init__( self : Dict , UpperCamelCase_ : int , UpperCamelCase_ : int , UpperCamelCase_ : float = 0 ):
... | 637 | 1 |
import unittest
from pathlib import Path
from tempfile import TemporaryDirectory
from transformers import AutoConfig, TFGPTaLMHeadModel, is_keras_nlp_available, is_tf_available
from transformers.models.gpta.tokenization_gpta import GPTaTokenizer
from transformers.testing_utils import require_keras_nlp, require_... | 637 |
import warnings
from ...utils import logging
from .image_processing_deit import DeiTImageProcessor
__a : Any = logging.get_logger(__name__)
class __lowercase ( lowercase_ ):
'''simple docstring'''
def __init__( self : Union[str, Any] , *Upper... | 637 | 1 |
from ...configuration_utils import PretrainedConfig
from ...utils import logging
__a : str = logging.get_logger(__name__)
__a : int = {
"microsoft/swinv2-tiny-patch4-window8-256": (
"https://huggingface.co/microsoft/swinv2-tiny-patch4-window8-256/resolve/main/config.json"... | 637 |
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 import Accelerator... | 637 | 1 |
def _SCREAMING_SNAKE_CASE ( __lowercase : int , __lowercase : list ) -> Dict:
"""simple docstring"""
_enforce_args(__lowercase , __lowercase )
if n == 0:
return 0
__A = float("""-inf""" )
for i in range(1 , ... | 637 |
from typing import TYPE_CHECKING
from ...utils import (
OptionalDependencyNotAvailable,
_LazyModule,
is_sentencepiece_available,
is_tf_available,
is_tokenizers_available,
is_torch_available,
)
__a : Optional[int] = {"configuration_xlnet": ["XLNET_PRETRAINED_CONFIG_ARCHIVE_... | 637 | 1 |
from __future__ import annotations
import unittest
from transformers import is_tf_available, is_torch_available
from transformers.testing_utils import DUMMY_UNKNOWN_IDENTIFIER, SMALL_MODEL_IDENTIFIER, is_pt_tf_cross_test, slow
if is_tf_available():
from transformers import (
AutoConfig,
BertCon... | 637 |
from typing import Optional, Union
import torch
from torch import nn
from torch.nn import BCEWithLogitsLoss, CrossEntropyLoss, MSELoss
from ...activations import ACTaFN
from ...modeling_outputs import BaseModelOutputWithPoolingAndNoAttention, ImageClassifierOutputWithNoAttention
from ...modeling_utils import P... | 637 | 1 |
import logging
import os
import sys
from dataclasses import dataclass, field
from importlib import import_module
from typing import Dict, List, Optional, Tuple
import numpy as np
from seqeval.metrics import accuracy_score, fa_score, precision_score, recall_score
from torch import nn
from utils_ner import Split,... | 637 |
import unittest
from transformers import SqueezeBertConfig, is_torch_available
from transformers.testing_utils import require_sentencepiece, require_tokenizers, require_torch, slow, torch_device
from ...test_configuration_common import ConfigTester
from ...test_modeling_common import ModelTesterMixin, ids_tens... | 637 | 1 |
from abc import ABC, abstractmethod
from argparse import ArgumentParser
class __lowercase ( lowercase_ ):
'''simple docstring'''
@staticmethod
@abstractmethod
def lowerCAmelCase_ ( UpperCamelCase_ : ArgumentParser ):
"""simple docstring"... | 637 |
import os
import shutil
import tempfile
from unittest import TestCase
from unittest.mock import patch
import numpy as np
from datasets import Dataset
from transformers.models.realm.configuration_realm import RealmConfig
from transformers.models.realm.retrieval_realm import _REALM_BLOCK_RECORDS_FILENAME, RealmR... | 637 | 1 |
import argparse
import json
import gdown
import numpy as np
import torch
from huggingface_hub import hf_hub_download
from transformers import (
VideoMAEConfig,
VideoMAEForPreTraining,
VideoMAEForVideoClassification,
VideoMAEImageProcessor,
)
def _SCREAMING_SNAKE_CASE ( __lowercase... | 637 |
from __future__ import annotations
from typing import Generic, TypeVar
__a : str = TypeVar("T")
class __lowercase ( Generic[T] ):
'''simple docstring'''
def __init__( self : Any , UpperCamelCase_ : T ):
"""simple docs... | 637 | 1 |
def _SCREAMING_SNAKE_CASE ( __lowercase : int | float | str ) -> tuple[int, int]:
"""simple docstring"""
try:
__A = float(__lowercase )
except ValueError:
raise ValueError("""Please enter a valid number""" )
__A = decima... | 637 |
def _SCREAMING_SNAKE_CASE ( __lowercase : int ) -> list[int]:
"""simple docstring"""
if length <= 0 or not isinstance(__lowercase , __lowercase ):
raise ValueError("""Length must be a positive integer.""" )
return [n * (2 * n - 1) for n in range... | 637 | 1 |
import unittest
from transformers import is_torch_available
from transformers.testing_utils import require_sentencepiece, require_tokenizers, require_torch, slow, torch_device
if is_torch_available():
from transformers import AutoModelForSeqaSeqLM, AutoTokenizer
@require_torch
@require_sentencepiece
@requ... | 637 |
from __future__ import annotations
from PIL import Image
# Define glider example
__a : Tuple = [
[0, 1, 0, 0, 0, 0, 0, 0],
[0, 0, 1, 0, 0, 0, 0, 0],
[1, 1, 1, 0, 0, 0, 0, 0],
[0, 0, 0, 0, 0, 0, 0, 0],
[0, 0, 0, 0, 0, 0, 0, 0],
[0, 0, 0, 0, 0, 0, 0, 0],
[0, 0, 0, 0, 0, 0... | 637 | 1 |
from typing import TYPE_CHECKING
from ...utils import (
OptionalDependencyNotAvailable,
_LazyModule,
is_sentencepiece_available,
is_speech_available,
is_tf_available,
is_torch_available,
)
__a : Any = {
"configuration_speech_to_text": ["SPEECH_TO_TEXT_PRETRAINED_CONFIG... | 637 |
import json
from typing import List, Optional, Tuple
from tokenizers import pre_tokenizers, processors
from ...tokenization_utils_base import AddedToken, BatchEncoding
from ...tokenization_utils_fast import PreTrainedTokenizerFast
from ...utils import logging
from .tokenization_roberta import RobertaTokenizer
... | 637 | 1 |
from typing import TYPE_CHECKING
from ...utils import (
OptionalDependencyNotAvailable,
_LazyModule,
is_sentencepiece_available,
is_speech_available,
is_torch_available,
)
__a : Dict = {
"configuration_trocr": ["TROCR_PRETRAINED_CONFIG_ARCHIVE_MAP", "TrOCRConfig"],
"pr... | 637 |
from typing import TYPE_CHECKING
from ...utils import OptionalDependencyNotAvailable, _LazyModule, is_torch_available
__a : Any = {
"configuration_time_series_transformer": [
"TIME_SERIES_TRANSFORMER_PRETRAINED_CONFIG_ARCHIVE_MAP",
"TimeSeriesTransformerConfig",
],
}
try:... | 637 | 1 |
import os
import pytest
from transformers.dynamic_module_utils import get_imports
__a : List[str] = "\nimport os\n"
__a : str = "\ndef foo():\n import os\n return False\n"
__a : List[str] = "\ndef foo():\n def bar():\n if True:\n import os\n... | 637 |
import argparse
import pathlib
import fairseq
import torch
from fairseq.models.roberta import RobertaModel as FairseqRobertaModel
from fairseq.modules import TransformerSentenceEncoderLayer
from packaging import version
from transformers import XLMRobertaConfig, XLMRobertaXLForMaskedLM, XLMRobertaXLForSequence... | 637 | 1 |
import doctest
import logging
import os
import unittest
from pathlib import Path
from typing import List, Union
import transformers
from transformers.testing_utils import require_tf, require_torch, slow
__a : Dict = logging.getLogger()
@unittest.skip("Temporarily disable the doc tests." )
@requ... | 637 |
from ...configuration_utils import PretrainedConfig
from ...utils import logging
__a : Dict = logging.get_logger(__name__)
__a : Dict = {
"bigcode/gpt_bigcode-santacoder": "https://huggingface.co/bigcode/gpt_bigcode-santacoder/resolve/main/config.json",
}
class __lowercase ... | 637 | 1 |
# Copyright 2022 The HuggingFace Team and The OpenBMB 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
#
# ... | 637 |
from __future__ import annotations
def _SCREAMING_SNAKE_CASE ( __lowercase : list[int] , __lowercase : int ) -> bool:
"""simple docstring"""
if len(__lowercase ) == 0:
return False
__A = len(__lowercase ) // 2
if a_list[mi... | 637 | 1 |
# this script reports modified .py files under the desired list of top-level sub-dirs passed as a list of arguments, e.g.:
# python ./utils/get_modified_files.py utils src tests examples
#
# it uses git to find the forking point and which files were modified - i.e. files not under git won't be considered
# sin... | 637 |
# Copyright 2023 The HuggingFace Inc. team. All rights reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required ... | 637 | 1 |
import json
import os
import unittest
from transformers.models.biogpt.tokenization_biogpt import VOCAB_FILES_NAMES, BioGptTokenizer
from transformers.testing_utils import slow
from ...test_tokenization_common import TokenizerTesterMixin
class __lowercase ( lowercase_ , unittest.TestCase ):
... | 637 |
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 : List[str] = "▁"
__a : int = {"vocab_file": "spiece.model"}
__a : A... | 637 | 1 |
import os
from shutil import copyfile
from typing import Any, Dict, List, Optional, Tuple
import sentencepiece as spm
from ...tokenization_utils import AddedToken, BatchEncoding, PreTrainedTokenizer
from ...utils import logging
__a : Tuple = logging.get_logger(__name__)
__a : Tuple ... | 637 |
from ...configuration_utils import PretrainedConfig
from ...utils import logging
__a : Optional[Any] = logging.get_logger(__name__)
__a : Dict = {
"google/realm-cc-news-pretrained-embedder": (
"https://huggingface.co/google/realm-cc-news-pretrained-embedder/resolve/main/c... | 637 | 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 TFModelTesterMixin, ids_ten... | 637 |
import argparse
import os
import re
import packaging.version
__a : Tuple = "examples/"
__a : Any = {
"examples": (re.compile(R"^check_min_version\(\"[^\"]+\"\)\s*$", re.MULTILINE), "check_min_version(\"VERSION\")\n"),
"init": (re.compile(R"^__version__\s+=\s+\"([^\"]+)\"\s*$"... | 637 | 1 |
from typing import List, Optional, Union
import numpy as np
import PIL
import torch
from PIL import Image
from ...models import UNetaDConditionModel, VQModel
from ...pipelines import DiffusionPipeline
from ...pipelines.pipeline_utils import ImagePipelineOutput
from ...schedulers import DDPMScheduler
from ...ut... | 637 |
from ....configuration_utils import PretrainedConfig
from ....utils import logging
__a : List[Any] = logging.get_logger(__name__)
# TODO: upload to AWS
__a : Union[str, Any] = {
"yjernite/retribert-base-uncased": (
"https://huggingface.co/yjernite/retribert-base-uncased/r... | 637 | 1 |
from ...configuration_utils import PretrainedConfig
from ...utils import logging
__a : Any = logging.get_logger(__name__)
__a : Any = {
"tiiuae/falcon-40b": "https://huggingface.co/tiiuae/falcon-40b/resolve/main/config.json",
"tiiuae/falcon-7b": "https://huggingface.co/tiiuae... | 637 |
def _SCREAMING_SNAKE_CASE ( __lowercase : List[Any] ) -> Any:
"""simple docstring"""
stooge(__lowercase , 0 , len(__lowercase ) - 1 )
return arr
def _SCREAMING_SNAKE_CASE ( __lowercase : str , __lowercase : Dict... | 637 | 1 |
from __future__ import annotations
def _SCREAMING_SNAKE_CASE ( __lowercase : list[list[int]] ) -> bool:
"""simple docstring"""
__A = len(__lowercase )
# We need to create solution object to save path.
__A = [[0 for _ in range(__lowercase... | 637 |
def _SCREAMING_SNAKE_CASE ( __lowercase : str ) -> str:
"""simple docstring"""
__A = """"""
for ch in key:
if ch == " " or ch not in key_no_dups and ch.isalpha():
key_no_dups += ch
return key_no_dups
def _SCREAMING_SNAKE_CASE ... | 637 | 1 |
from typing import List
from ...configuration_utils import PretrainedConfig
from ...utils import logging
__a : Dict = logging.get_logger(__name__)
__a : str = {
"snap-research/efficientformer-l1-300": (
"https://huggingface.co/snap-research/efficientformer-l1-300/resolve... | 637 |
from __future__ import annotations
from typing import Any
class __lowercase :
'''simple docstring'''
def __init__( self : Dict , UpperCamelCase_ : int , UpperCamelCase_ : int , UpperCamelCase_ : float = 0 ):
... | 637 | 1 |
from typing import TYPE_CHECKING
from ...utils import (
OptionalDependencyNotAvailable,
_LazyModule,
is_torch_available,
)
__a : Tuple = {
"configuration_falcon": ["FALCON_PRETRAINED_CONFIG_ARCHIVE_MAP", "FalconConfig"],
}
try:
if not is_torch_available():
raise OptionalDep... | 637 |
import warnings
from ...utils import logging
from .image_processing_deit import DeiTImageProcessor
__a : Any = logging.get_logger(__name__)
class __lowercase ( lowercase_ ):
'''simple docstring'''
def __init__( self : Union[str, Any] , *Upper... | 637 | 1 |
import math
from dataclasses import dataclass
from typing import Optional, Tuple, Union
import numpy as np
import torch
from ..configuration_utils import ConfigMixin, register_to_config
from ..utils import BaseOutput, randn_tensor
from .scheduling_utils import SchedulerMixin
@dataclass
# Copied from diffuser... | 637 |
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 import Accelerator... | 637 | 1 |
from typing import List, Optional, Tuple, Union
import torch
from ...utils import logging, randn_tensor
from ..pipeline_utils import AudioPipelineOutput, DiffusionPipeline
__a : int = logging.get_logger(__name__) # pylint: disable=invalid-name
class __lowercase ( lowercase_ ):
... | 637 |
from typing import TYPE_CHECKING
from ...utils import (
OptionalDependencyNotAvailable,
_LazyModule,
is_sentencepiece_available,
is_tf_available,
is_tokenizers_available,
is_torch_available,
)
__a : Optional[int] = {"configuration_xlnet": ["XLNET_PRETRAINED_CONFIG_ARCHIVE_... | 637 | 1 |
def _SCREAMING_SNAKE_CASE ( __lowercase : List[Any] ) -> Any:
"""simple docstring"""
stooge(__lowercase , 0 , len(__lowercase ) - 1 )
return arr
def _SCREAMING_SNAKE_CASE ( __lowercase : str , __lowercase : Dict... | 637 |
from typing import Optional, Union
import torch
from torch import nn
from torch.nn import BCEWithLogitsLoss, CrossEntropyLoss, MSELoss
from ...activations import ACTaFN
from ...modeling_outputs import BaseModelOutputWithPoolingAndNoAttention, ImageClassifierOutputWithNoAttention
from ...modeling_utils import P... | 637 | 1 |
from ....configuration_utils import PretrainedConfig
from ....utils import logging
__a : str = logging.get_logger(__name__)
__a : int = {
"CarlCochet/trajectory-transformer-halfcheetah-medium-v2": (
"https://huggingface.co/CarlCochet/trajectory-transformer-halfcheetah-med... | 637 |
import unittest
from transformers import SqueezeBertConfig, is_torch_available
from transformers.testing_utils import require_sentencepiece, require_tokenizers, require_torch, slow, torch_device
from ...test_configuration_common import ConfigTester
from ...test_modeling_common import ModelTesterMixin, ids_tens... | 637 | 1 |
import unittest
from transformers import GPTSwaTokenizer
from transformers.testing_utils import get_tests_dir, require_sentencepiece, require_tokenizers, slow
from ...test_tokenization_common import TokenizerTesterMixin
__a : Union[str, Any] = get_tests_dir("fixtures/test_sentencepiece_with_byte... | 637 |
import os
import shutil
import tempfile
from unittest import TestCase
from unittest.mock import patch
import numpy as np
from datasets import Dataset
from transformers.models.realm.configuration_realm import RealmConfig
from transformers.models.realm.retrieval_realm import _REALM_BLOCK_RECORDS_FILENAME, RealmR... | 637 | 1 |
import os
import zipfile
import requests
from get_ci_error_statistics import download_artifact, get_artifacts_links
def _SCREAMING_SNAKE_CASE ( __lowercase : Optional[Any] , __lowercase : Tuple=7 ) -> Optional[int]:
"""simple docstring"""
__A = ... | 637 |
from __future__ import annotations
from typing import Generic, TypeVar
__a : str = TypeVar("T")
class __lowercase ( Generic[T] ):
'''simple docstring'''
def __init__( self : Any , UpperCamelCase_ : T ):
"""simple docs... | 637 | 1 |
import glob
import os
import random
from string import ascii_lowercase, digits
import cva
__a : Tuple = ""
__a : Dict = ""
__a : List[str] = ""
__a : str = 1 # (0 is vertical, 1 is horizontal)
def _SCREAMING_SNAKE_CASE ( ) -> None:
... | 637 |
def _SCREAMING_SNAKE_CASE ( __lowercase : int ) -> list[int]:
"""simple docstring"""
if length <= 0 or not isinstance(__lowercase , __lowercase ):
raise ValueError("""Length must be a positive integer.""" )
return [n * (2 * n - 1) for n in range... | 637 | 1 |
import os
import re
import unicodedata
from shutil import copyfile
from typing import TYPE_CHECKING, Any, Dict, List, Optional, Tuple, Union
import sentencepiece as spm
from ...tokenization_utils import PreTrainedTokenizer
from ...utils import is_torch_available, logging
if is_torch_available():
import tor... | 637 |
from __future__ import annotations
from PIL import Image
# Define glider example
__a : Tuple = [
[0, 1, 0, 0, 0, 0, 0, 0],
[0, 0, 1, 0, 0, 0, 0, 0],
[1, 1, 1, 0, 0, 0, 0, 0],
[0, 0, 0, 0, 0, 0, 0, 0],
[0, 0, 0, 0, 0, 0, 0, 0],
[0, 0, 0, 0, 0, 0, 0, 0],
[0, 0, 0, 0, 0, 0... | 637 | 1 |
def _SCREAMING_SNAKE_CASE ( __lowercase : int = 4_0_0_0_0_0_0 ) -> int:
"""simple docstring"""
__A = [0, 1]
__A = 0
while fib[i] <= n:
fib.append(fib[i] + fib[i + 1] )
if fib[i + 2] > n:
break
i += 1
... | 637 |
import json
from typing import List, Optional, Tuple
from tokenizers import pre_tokenizers, processors
from ...tokenization_utils_base import AddedToken, BatchEncoding
from ...tokenization_utils_fast import PreTrainedTokenizerFast
from ...utils import logging
from .tokenization_roberta import RobertaTokenizer
... | 637 | 1 |
import argparse
import os
from pathlib import Path
from typing import Dict
import tensorflow as tf
import torch
from tqdm import tqdm
from transformers import PegasusConfig, PegasusForConditionalGeneration, PegasusTokenizer
from transformers.models.pegasus.configuration_pegasus import DEFAULTS, task_specific_p... | 637 |
from typing import TYPE_CHECKING
from ...utils import OptionalDependencyNotAvailable, _LazyModule, is_torch_available
__a : Any = {
"configuration_time_series_transformer": [
"TIME_SERIES_TRANSFORMER_PRETRAINED_CONFIG_ARCHIVE_MAP",
"TimeSeriesTransformerConfig",
],
}
try:... | 637 | 1 |
import functools
import operator
from ...configuration_utils import PretrainedConfig
from ...utils import logging
__a : Optional[int] = logging.get_logger(__name__)
__a : Optional[Any] = {
"microsoft/unispeech-sat-base-100h-libri-ft": (
"https://huggingface.co/microsoft/... | 637 |
import argparse
import pathlib
import fairseq
import torch
from fairseq.models.roberta import RobertaModel as FairseqRobertaModel
from fairseq.modules import TransformerSentenceEncoderLayer
from packaging import version
from transformers import XLMRobertaConfig, XLMRobertaXLForMaskedLM, XLMRobertaXLForSequence... | 637 | 1 |
# Copyright 2023 The HuggingFace Inc. team. All rights reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required ... | 637 |
from ...configuration_utils import PretrainedConfig
from ...utils import logging
__a : Dict = logging.get_logger(__name__)
__a : Dict = {
"bigcode/gpt_bigcode-santacoder": "https://huggingface.co/bigcode/gpt_bigcode-santacoder/resolve/main/config.json",
}
class __lowercase ... | 637 | 1 |
import os
from typing import List, Optional, Union
from ...image_processing_utils import BatchFeature
from ...image_utils import ImageInput
from ...processing_utils import ProcessorMixin
from ...tokenization_utils_base import PaddingStrategy, PreTokenizedInput, TextInput, TruncationStrategy
from ...utils import... | 637 |
from __future__ import annotations
def _SCREAMING_SNAKE_CASE ( __lowercase : list[int] , __lowercase : int ) -> bool:
"""simple docstring"""
if len(__lowercase ) == 0:
return False
__A = len(__lowercase ) // 2
if a_list[mi... | 637 | 1 |
import argparse
import collections
import os
import re
import tempfile
import pandas as pd
from datasets import Dataset
from huggingface_hub import hf_hub_download, upload_folder
from transformers.utils import direct_transformers_import
# All paths are set with the intent you should run this script from the ... | 637 |
# Copyright 2023 The HuggingFace Inc. team. All rights reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required ... | 637 | 1 |
import os
from collections import namedtuple
import pytest
from datasets import ClassLabel, Features, Sequence, Value
from datasets.commands.test import TestCommand
from datasets.info import DatasetInfo, DatasetInfosDict
__a : Union[str, Any] = namedtuple(
"_TestCommandArgs",
[
"... | 637 |
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 : List[str] = "▁"
__a : int = {"vocab_file": "spiece.model"}
__a : A... | 637 | 1 |
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_barthez impo... | 637 |
from ...configuration_utils import PretrainedConfig
from ...utils import logging
__a : Optional[Any] = logging.get_logger(__name__)
__a : Dict = {
"google/realm-cc-news-pretrained-embedder": (
"https://huggingface.co/google/realm-cc-news-pretrained-embedder/resolve/main/c... | 637 | 1 |
from __future__ import annotations
from PIL import Image
# Define glider example
__a : Tuple = [
[0, 1, 0, 0, 0, 0, 0, 0],
[0, 0, 1, 0, 0, 0, 0, 0],
[1, 1, 1, 0, 0, 0, 0, 0],
[0, 0, 0, 0, 0, 0, 0, 0],
[0, 0, 0, 0, 0, 0, 0, 0],
[0, 0, 0, 0, 0, 0, 0, 0],
[0, 0, 0, 0, 0, 0... | 637 |
import argparse
import os
import re
import packaging.version
__a : Tuple = "examples/"
__a : Any = {
"examples": (re.compile(R"^check_min_version\(\"[^\"]+\"\)\s*$", re.MULTILINE), "check_min_version(\"VERSION\")\n"),
"init": (re.compile(R"^__version__\s+=\s+\"([^\"]+)\"\s*$"... | 637 | 1 |
# Lint as: python3
import sys
from collections.abc import Mapping
from typing import TYPE_CHECKING
import numpy as np
import pyarrow as pa
from .. import config
from ..utils.py_utils import map_nested
from .formatting import TensorFormatter
if TYPE_CHECKING:
import torch
class __lowercase ( Ten... | 637 |
from ....configuration_utils import PretrainedConfig
from ....utils import logging
__a : List[Any] = logging.get_logger(__name__)
# TODO: upload to AWS
__a : Union[str, Any] = {
"yjernite/retribert-base-uncased": (
"https://huggingface.co/yjernite/retribert-base-uncased/r... | 637 | 1 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.