mirror of
https://github.com/huggingface/transformers.git
synced 2025-07-31 02:02:21 +06:00
Remove static pretrained maps from the library's internals (#29112)
* [test_all] Remove static pretrained maps from the library's internals * Deprecate archive maps instead of removing them * Revert init changes * [test_all] Deprecate instead of removing * [test_all] PVT v2 support * [test_all] Tests should all pass * [test_all] Style * Address review comments * Update src/transformers/models/deprecated/_archive_maps.py Co-authored-by: Arthur <48595927+ArthurZucker@users.noreply.github.com> * Update src/transformers/models/deprecated/_archive_maps.py Co-authored-by: Arthur <48595927+ArthurZucker@users.noreply.github.com> * [test_all] trigger tests * [test_all] LLAVA * [test_all] Bad rebase --------- Co-authored-by: Arthur <48595927+ArthurZucker@users.noreply.github.com>
This commit is contained in:
parent
76a33a1092
commit
39114c0383
@ -33,10 +33,6 @@ from transformers import BertConfig, BertModel, PreTrainedModel
|
||||
|
||||
MAX_SIZE = 5000
|
||||
|
||||
BERTABS_FINETUNED_MODEL_ARCHIVE_LIST = [
|
||||
"remi/bertabs-finetuned-cnndm-extractive-abstractive-summarization",
|
||||
]
|
||||
|
||||
|
||||
class BertAbsPreTrainedModel(PreTrainedModel):
|
||||
config_class = BertAbsConfig
|
||||
|
@ -726,7 +726,7 @@ _import_structure = {
|
||||
"ProphetNetTokenizer",
|
||||
],
|
||||
"models.pvt": ["PVT_PRETRAINED_CONFIG_ARCHIVE_MAP", "PvtConfig"],
|
||||
"models.pvt_v2": ["PVT_V2_PRETRAINED_CONFIG_ARCHIVE_MAP", "PvtV2Config"],
|
||||
"models.pvt_v2": ["PvtV2Config"],
|
||||
"models.qdqbert": ["QDQBERT_PRETRAINED_CONFIG_ARCHIVE_MAP", "QDQBertConfig"],
|
||||
"models.qwen2": [
|
||||
"QWEN2_PRETRAINED_CONFIG_ARCHIVE_MAP",
|
||||
@ -3050,7 +3050,6 @@ else:
|
||||
)
|
||||
_import_structure["models.pvt_v2"].extend(
|
||||
[
|
||||
"PVT_V2_PRETRAINED_MODEL_ARCHIVE_LIST",
|
||||
"PvtV2Backbone",
|
||||
"PvtV2ForImageClassification",
|
||||
"PvtV2Model",
|
||||
@ -5602,7 +5601,7 @@ if TYPE_CHECKING:
|
||||
ProphetNetTokenizer,
|
||||
)
|
||||
from .models.pvt import PVT_PRETRAINED_CONFIG_ARCHIVE_MAP, PvtConfig
|
||||
from .models.pvt_v2 import PVT_V2_PRETRAINED_CONFIG_ARCHIVE_MAP, PvtV2Config
|
||||
from .models.pvt_v2 import PvtV2Config
|
||||
from .models.qdqbert import QDQBERT_PRETRAINED_CONFIG_ARCHIVE_MAP, QDQBertConfig
|
||||
from .models.qwen2 import QWEN2_PRETRAINED_CONFIG_ARCHIVE_MAP, Qwen2Config, Qwen2Tokenizer
|
||||
from .models.rag import RagConfig, RagRetriever, RagTokenizer
|
||||
@ -7623,7 +7622,6 @@ if TYPE_CHECKING:
|
||||
PvtPreTrainedModel,
|
||||
)
|
||||
from .models.pvt_v2 import (
|
||||
PVT_V2_PRETRAINED_MODEL_ARCHIVE_LIST,
|
||||
PvtV2Backbone,
|
||||
PvtV2ForImageClassification,
|
||||
PvtV2Model,
|
||||
|
@ -527,35 +527,6 @@ def duplicate_module(
|
||||
# Loop and treat all objects
|
||||
new_objects = []
|
||||
for obj in objects:
|
||||
# Special cases
|
||||
if "PRETRAINED_CONFIG_ARCHIVE_MAP = {" in obj:
|
||||
# docstyle-ignore
|
||||
obj = (
|
||||
f"{new_model_patterns.model_upper_cased}_PRETRAINED_CONFIG_ARCHIVE_MAP = "
|
||||
+ "{"
|
||||
+ f"""
|
||||
"{new_model_patterns.checkpoint}": "https://huggingface.co/{new_model_patterns.checkpoint}/resolve/main/config.json",
|
||||
"""
|
||||
+ "}\n"
|
||||
)
|
||||
new_objects.append(obj)
|
||||
continue
|
||||
elif "PRETRAINED_MODEL_ARCHIVE_LIST = [" in obj:
|
||||
if obj.startswith("TF_"):
|
||||
prefix = "TF_"
|
||||
elif obj.startswith("FLAX_"):
|
||||
prefix = "FLAX_"
|
||||
else:
|
||||
prefix = ""
|
||||
# docstyle-ignore
|
||||
obj = f"""{prefix}{new_model_patterns.model_upper_cased}_PRETRAINED_MODEL_ARCHIVE_LIST = [
|
||||
"{new_model_patterns.checkpoint}",
|
||||
# See all {new_model_patterns.model_name} models at https://huggingface.co/models?filter={new_model_patterns.model_type}
|
||||
]
|
||||
"""
|
||||
new_objects.append(obj)
|
||||
continue
|
||||
|
||||
special_pattern = False
|
||||
for pattern, attr in SPECIAL_PATTERNS.items():
|
||||
if pattern in obj:
|
||||
@ -785,7 +756,6 @@ def retrieve_info_for_model(model_type, frameworks: Optional[List[str]] = None):
|
||||
|
||||
model_name = auto_module.MODEL_NAMES_MAPPING[model_type]
|
||||
config_class = auto_module.configuration_auto.CONFIG_MAPPING_NAMES[model_type]
|
||||
archive_map = auto_module.configuration_auto.CONFIG_ARCHIVE_MAP_MAPPING_NAMES.get(model_type, None)
|
||||
if model_type in auto_module.tokenization_auto.TOKENIZER_MAPPING_NAMES:
|
||||
tokenizer_classes = auto_module.tokenization_auto.TOKENIZER_MAPPING_NAMES[model_type]
|
||||
tokenizer_class = tokenizer_classes[0] if tokenizer_classes[0] is not None else tokenizer_classes[1]
|
||||
@ -814,19 +784,7 @@ def retrieve_info_for_model(model_type, frameworks: Optional[List[str]] = None):
|
||||
|
||||
model_classes = retrieve_model_classes(model_type, frameworks=frameworks)
|
||||
|
||||
# Retrieve model upper-cased name from the constant name of the pretrained archive map.
|
||||
if archive_map is None:
|
||||
model_upper_cased = model_camel_cased.upper()
|
||||
else:
|
||||
parts = archive_map.split("_")
|
||||
idx = 0
|
||||
while idx < len(parts) and parts[idx] != "PRETRAINED":
|
||||
idx += 1
|
||||
if idx < len(parts):
|
||||
model_upper_cased = "_".join(parts[:idx])
|
||||
else:
|
||||
model_upper_cased = model_camel_cased.upper()
|
||||
|
||||
model_upper_cased = model_camel_cased.upper()
|
||||
model_patterns = ModelPatterns(
|
||||
model_name,
|
||||
checkpoint=find_base_model_checkpoint(model_type, model_files=model_files),
|
||||
@ -1135,14 +1093,6 @@ def add_model_to_auto_classes(
|
||||
for attr in ["model_type", "model_name"]:
|
||||
old_model_line = old_model_line.replace("{" + attr + "}", getattr(old_model_patterns, attr))
|
||||
new_model_line = new_model_line.replace("{" + attr + "}", getattr(new_model_patterns, attr))
|
||||
if "pretrained_archive_map" in pattern:
|
||||
old_model_line = old_model_line.replace(
|
||||
"{pretrained_archive_map}", f"{old_model_patterns.model_upper_cased}_PRETRAINED_CONFIG_ARCHIVE_MAP"
|
||||
)
|
||||
new_model_line = new_model_line.replace(
|
||||
"{pretrained_archive_map}", f"{new_model_patterns.model_upper_cased}_PRETRAINED_CONFIG_ARCHIVE_MAP"
|
||||
)
|
||||
|
||||
new_model_line = new_model_line.replace(
|
||||
old_model_patterns.model_camel_cased, new_model_patterns.model_camel_cased
|
||||
)
|
||||
|
@ -19,28 +19,6 @@ import argparse
|
||||
import os
|
||||
|
||||
from . import (
|
||||
ALBERT_PRETRAINED_CONFIG_ARCHIVE_MAP,
|
||||
BART_PRETRAINED_MODEL_ARCHIVE_LIST,
|
||||
BERT_PRETRAINED_CONFIG_ARCHIVE_MAP,
|
||||
CAMEMBERT_PRETRAINED_CONFIG_ARCHIVE_MAP,
|
||||
CTRL_PRETRAINED_CONFIG_ARCHIVE_MAP,
|
||||
DISTILBERT_PRETRAINED_CONFIG_ARCHIVE_MAP,
|
||||
DPR_CONTEXT_ENCODER_PRETRAINED_MODEL_ARCHIVE_LIST,
|
||||
DPR_QUESTION_ENCODER_PRETRAINED_MODEL_ARCHIVE_LIST,
|
||||
DPR_READER_PRETRAINED_MODEL_ARCHIVE_LIST,
|
||||
ELECTRA_PRETRAINED_CONFIG_ARCHIVE_MAP,
|
||||
FLAUBERT_PRETRAINED_CONFIG_ARCHIVE_MAP,
|
||||
GPT2_PRETRAINED_CONFIG_ARCHIVE_MAP,
|
||||
LAYOUTLM_PRETRAINED_MODEL_ARCHIVE_LIST,
|
||||
LXMERT_PRETRAINED_CONFIG_ARCHIVE_MAP,
|
||||
OPENAI_GPT_PRETRAINED_CONFIG_ARCHIVE_MAP,
|
||||
ROBERTA_PRETRAINED_CONFIG_ARCHIVE_MAP,
|
||||
T5_PRETRAINED_CONFIG_ARCHIVE_MAP,
|
||||
TRANSFO_XL_PRETRAINED_CONFIG_ARCHIVE_MAP,
|
||||
WAV_2_VEC_2_PRETRAINED_CONFIG_ARCHIVE_MAP,
|
||||
XLM_PRETRAINED_CONFIG_ARCHIVE_MAP,
|
||||
XLM_ROBERTA_PRETRAINED_CONFIG_ARCHIVE_MAP,
|
||||
XLNET_PRETRAINED_CONFIG_ARCHIVE_MAP,
|
||||
AlbertConfig,
|
||||
BartConfig,
|
||||
BertConfig,
|
||||
@ -140,31 +118,26 @@ MODEL_CLASSES = {
|
||||
TFBartForConditionalGeneration,
|
||||
TFBartForSequenceClassification,
|
||||
BartForConditionalGeneration,
|
||||
BART_PRETRAINED_MODEL_ARCHIVE_LIST,
|
||||
),
|
||||
"bert": (
|
||||
BertConfig,
|
||||
TFBertForPreTraining,
|
||||
BertForPreTraining,
|
||||
BERT_PRETRAINED_CONFIG_ARCHIVE_MAP,
|
||||
),
|
||||
"google-bert/bert-large-uncased-whole-word-masking-finetuned-squad": (
|
||||
BertConfig,
|
||||
TFBertForQuestionAnswering,
|
||||
BertForQuestionAnswering,
|
||||
BERT_PRETRAINED_CONFIG_ARCHIVE_MAP,
|
||||
),
|
||||
"google-bert/bert-large-cased-whole-word-masking-finetuned-squad": (
|
||||
BertConfig,
|
||||
TFBertForQuestionAnswering,
|
||||
BertForQuestionAnswering,
|
||||
BERT_PRETRAINED_CONFIG_ARCHIVE_MAP,
|
||||
),
|
||||
"google-bert/bert-base-cased-finetuned-mrpc": (
|
||||
BertConfig,
|
||||
TFBertForSequenceClassification,
|
||||
BertForSequenceClassification,
|
||||
BERT_PRETRAINED_CONFIG_ARCHIVE_MAP,
|
||||
),
|
||||
"dpr": (
|
||||
DPRConfig,
|
||||
@ -174,130 +147,107 @@ MODEL_CLASSES = {
|
||||
DPRQuestionEncoder,
|
||||
DPRContextEncoder,
|
||||
DPRReader,
|
||||
DPR_CONTEXT_ENCODER_PRETRAINED_MODEL_ARCHIVE_LIST,
|
||||
DPR_QUESTION_ENCODER_PRETRAINED_MODEL_ARCHIVE_LIST,
|
||||
DPR_READER_PRETRAINED_MODEL_ARCHIVE_LIST,
|
||||
),
|
||||
"openai-community/gpt2": (
|
||||
GPT2Config,
|
||||
TFGPT2LMHeadModel,
|
||||
GPT2LMHeadModel,
|
||||
GPT2_PRETRAINED_CONFIG_ARCHIVE_MAP,
|
||||
),
|
||||
"xlnet": (
|
||||
XLNetConfig,
|
||||
TFXLNetLMHeadModel,
|
||||
XLNetLMHeadModel,
|
||||
XLNET_PRETRAINED_CONFIG_ARCHIVE_MAP,
|
||||
),
|
||||
"xlm": (
|
||||
XLMConfig,
|
||||
TFXLMWithLMHeadModel,
|
||||
XLMWithLMHeadModel,
|
||||
XLM_PRETRAINED_CONFIG_ARCHIVE_MAP,
|
||||
),
|
||||
"xlm-roberta": (
|
||||
XLMRobertaConfig,
|
||||
TFXLMRobertaForMaskedLM,
|
||||
XLMRobertaForMaskedLM,
|
||||
XLM_ROBERTA_PRETRAINED_CONFIG_ARCHIVE_MAP,
|
||||
),
|
||||
"transfo-xl": (
|
||||
TransfoXLConfig,
|
||||
TFTransfoXLLMHeadModel,
|
||||
TransfoXLLMHeadModel,
|
||||
TRANSFO_XL_PRETRAINED_CONFIG_ARCHIVE_MAP,
|
||||
),
|
||||
"openai-community/openai-gpt": (
|
||||
OpenAIGPTConfig,
|
||||
TFOpenAIGPTLMHeadModel,
|
||||
OpenAIGPTLMHeadModel,
|
||||
OPENAI_GPT_PRETRAINED_CONFIG_ARCHIVE_MAP,
|
||||
),
|
||||
"roberta": (
|
||||
RobertaConfig,
|
||||
TFRobertaForCausalLM,
|
||||
TFRobertaForMaskedLM,
|
||||
RobertaForMaskedLM,
|
||||
ROBERTA_PRETRAINED_CONFIG_ARCHIVE_MAP,
|
||||
),
|
||||
"layoutlm": (
|
||||
LayoutLMConfig,
|
||||
TFLayoutLMForMaskedLM,
|
||||
LayoutLMForMaskedLM,
|
||||
LAYOUTLM_PRETRAINED_MODEL_ARCHIVE_LIST,
|
||||
),
|
||||
"FacebookAI/roberta-large-mnli": (
|
||||
RobertaConfig,
|
||||
TFRobertaForSequenceClassification,
|
||||
RobertaForSequenceClassification,
|
||||
ROBERTA_PRETRAINED_CONFIG_ARCHIVE_MAP,
|
||||
),
|
||||
"camembert": (
|
||||
CamembertConfig,
|
||||
TFCamembertForMaskedLM,
|
||||
CamembertForMaskedLM,
|
||||
CAMEMBERT_PRETRAINED_CONFIG_ARCHIVE_MAP,
|
||||
),
|
||||
"flaubert": (
|
||||
FlaubertConfig,
|
||||
TFFlaubertWithLMHeadModel,
|
||||
FlaubertWithLMHeadModel,
|
||||
FLAUBERT_PRETRAINED_CONFIG_ARCHIVE_MAP,
|
||||
),
|
||||
"distilbert": (
|
||||
DistilBertConfig,
|
||||
TFDistilBertForMaskedLM,
|
||||
DistilBertForMaskedLM,
|
||||
DISTILBERT_PRETRAINED_CONFIG_ARCHIVE_MAP,
|
||||
),
|
||||
"distilbert-base-distilled-squad": (
|
||||
DistilBertConfig,
|
||||
TFDistilBertForQuestionAnswering,
|
||||
DistilBertForQuestionAnswering,
|
||||
DISTILBERT_PRETRAINED_CONFIG_ARCHIVE_MAP,
|
||||
),
|
||||
"lxmert": (
|
||||
LxmertConfig,
|
||||
TFLxmertForPreTraining,
|
||||
LxmertForPreTraining,
|
||||
LXMERT_PRETRAINED_CONFIG_ARCHIVE_MAP,
|
||||
),
|
||||
"lxmert-visual-feature-encoder": (
|
||||
LxmertConfig,
|
||||
TFLxmertVisualFeatureEncoder,
|
||||
LxmertVisualFeatureEncoder,
|
||||
LXMERT_PRETRAINED_CONFIG_ARCHIVE_MAP,
|
||||
),
|
||||
"Salesforce/ctrl": (
|
||||
CTRLConfig,
|
||||
TFCTRLLMHeadModel,
|
||||
CTRLLMHeadModel,
|
||||
CTRL_PRETRAINED_CONFIG_ARCHIVE_MAP,
|
||||
),
|
||||
"albert": (
|
||||
AlbertConfig,
|
||||
TFAlbertForPreTraining,
|
||||
AlbertForPreTraining,
|
||||
ALBERT_PRETRAINED_CONFIG_ARCHIVE_MAP,
|
||||
),
|
||||
"t5": (
|
||||
T5Config,
|
||||
TFT5ForConditionalGeneration,
|
||||
T5ForConditionalGeneration,
|
||||
T5_PRETRAINED_CONFIG_ARCHIVE_MAP,
|
||||
),
|
||||
"electra": (
|
||||
ElectraConfig,
|
||||
TFElectraForPreTraining,
|
||||
ElectraForPreTraining,
|
||||
ELECTRA_PRETRAINED_CONFIG_ARCHIVE_MAP,
|
||||
),
|
||||
"wav2vec2": (
|
||||
Wav2Vec2Config,
|
||||
TFWav2Vec2Model,
|
||||
Wav2Vec2Model,
|
||||
WAV_2_VEC_2_PRETRAINED_CONFIG_ARCHIVE_MAP,
|
||||
),
|
||||
}
|
||||
|
||||
|
@ -19,18 +19,7 @@ from typing import Mapping
|
||||
|
||||
from ...configuration_utils import PretrainedConfig
|
||||
from ...onnx import OnnxConfig
|
||||
|
||||
|
||||
ALBERT_PRETRAINED_CONFIG_ARCHIVE_MAP = {
|
||||
"albert/albert-base-v1": "https://huggingface.co/albert/albert-base-v1/resolve/main/config.json",
|
||||
"albert/albert-large-v1": "https://huggingface.co/albert/albert-large-v1/resolve/main/config.json",
|
||||
"albert/albert-xlarge-v1": "https://huggingface.co/albert/albert-xlarge-v1/resolve/main/config.json",
|
||||
"albert/albert-xxlarge-v1": "https://huggingface.co/albert/albert-xxlarge-v1/resolve/main/config.json",
|
||||
"albert/albert-base-v2": "https://huggingface.co/albert/albert-base-v2/resolve/main/config.json",
|
||||
"albert/albert-large-v2": "https://huggingface.co/albert/albert-large-v2/resolve/main/config.json",
|
||||
"albert/albert-xlarge-v2": "https://huggingface.co/albert/albert-xlarge-v2/resolve/main/config.json",
|
||||
"albert/albert-xxlarge-v2": "https://huggingface.co/albert/albert-xxlarge-v2/resolve/main/config.json",
|
||||
}
|
||||
from ..deprecated._archive_maps import ALBERT_PRETRAINED_CONFIG_ARCHIVE_MAP # noqa: F401, E402
|
||||
|
||||
|
||||
class AlbertConfig(PretrainedConfig):
|
||||
|
@ -52,17 +52,7 @@ _CHECKPOINT_FOR_DOC = "albert/albert-base-v2"
|
||||
_CONFIG_FOR_DOC = "AlbertConfig"
|
||||
|
||||
|
||||
ALBERT_PRETRAINED_MODEL_ARCHIVE_LIST = [
|
||||
"albert/albert-base-v1",
|
||||
"albert/albert-large-v1",
|
||||
"albert/albert-xlarge-v1",
|
||||
"albert/albert-xxlarge-v1",
|
||||
"albert/albert-base-v2",
|
||||
"albert/albert-large-v2",
|
||||
"albert/albert-xlarge-v2",
|
||||
"albert/albert-xxlarge-v2",
|
||||
# See all ALBERT models at https://huggingface.co/models?filter=albert
|
||||
]
|
||||
from ..deprecated._archive_maps import ALBERT_PRETRAINED_MODEL_ARCHIVE_LIST # noqa: F401, E402
|
||||
|
||||
|
||||
def load_tf_weights_in_albert(model, config, tf_checkpoint_path):
|
||||
|
@ -65,17 +65,8 @@ logger = logging.get_logger(__name__)
|
||||
_CHECKPOINT_FOR_DOC = "albert/albert-base-v2"
|
||||
_CONFIG_FOR_DOC = "AlbertConfig"
|
||||
|
||||
TF_ALBERT_PRETRAINED_MODEL_ARCHIVE_LIST = [
|
||||
"albert/albert-base-v1",
|
||||
"albert/albert-large-v1",
|
||||
"albert/albert-xlarge-v1",
|
||||
"albert/albert-xxlarge-v1",
|
||||
"albert/albert-base-v2",
|
||||
"albert/albert-large-v2",
|
||||
"albert/albert-xlarge-v2",
|
||||
"albert/albert-xxlarge-v2",
|
||||
# See all ALBERT models at https://huggingface.co/models?filter=albert
|
||||
]
|
||||
|
||||
from ..deprecated._archive_maps import TF_ALBERT_PRETRAINED_MODEL_ARCHIVE_LIST # noqa: F401, E402
|
||||
|
||||
|
||||
class TFAlbertPreTrainingLoss:
|
||||
|
@ -29,29 +29,6 @@ from ...utils import logging
|
||||
logger = logging.get_logger(__name__)
|
||||
VOCAB_FILES_NAMES = {"vocab_file": "spiece.model"}
|
||||
|
||||
PRETRAINED_VOCAB_FILES_MAP = {
|
||||
"vocab_file": {
|
||||
"albert/albert-base-v1": "https://huggingface.co/albert/albert-base-v1/resolve/main/spiece.model",
|
||||
"albert/albert-large-v1": "https://huggingface.co/albert/albert-large-v1/resolve/main/spiece.model",
|
||||
"albert/albert-xlarge-v1": "https://huggingface.co/albert/albert-xlarge-v1/resolve/main/spiece.model",
|
||||
"albert/albert-xxlarge-v1": "https://huggingface.co/albert/albert-xxlarge-v1/resolve/main/spiece.model",
|
||||
"albert/albert-base-v2": "https://huggingface.co/albert/albert-base-v2/resolve/main/spiece.model",
|
||||
"albert/albert-large-v2": "https://huggingface.co/albert/albert-large-v2/resolve/main/spiece.model",
|
||||
"albert/albert-xlarge-v2": "https://huggingface.co/albert/albert-xlarge-v2/resolve/main/spiece.model",
|
||||
"albert/albert-xxlarge-v2": "https://huggingface.co/albert/albert-xxlarge-v2/resolve/main/spiece.model",
|
||||
}
|
||||
}
|
||||
|
||||
PRETRAINED_POSITIONAL_EMBEDDINGS_SIZES = {
|
||||
"albert/albert-base-v1": 512,
|
||||
"albert/albert-large-v1": 512,
|
||||
"albert/albert-xlarge-v1": 512,
|
||||
"albert/albert-xxlarge-v1": 512,
|
||||
"albert/albert-base-v2": 512,
|
||||
"albert/albert-large-v2": 512,
|
||||
"albert/albert-xlarge-v2": 512,
|
||||
"albert/albert-xxlarge-v2": 512,
|
||||
}
|
||||
|
||||
SPIECE_UNDERLINE = "▁"
|
||||
|
||||
@ -130,8 +107,6 @@ class AlbertTokenizer(PreTrainedTokenizer):
|
||||
"""
|
||||
|
||||
vocab_files_names = VOCAB_FILES_NAMES
|
||||
pretrained_vocab_files_map = PRETRAINED_VOCAB_FILES_MAP
|
||||
max_model_input_sizes = PRETRAINED_POSITIONAL_EMBEDDINGS_SIZES
|
||||
|
||||
def __init__(
|
||||
self,
|
||||
|
@ -32,39 +32,6 @@ else:
|
||||
logger = logging.get_logger(__name__)
|
||||
VOCAB_FILES_NAMES = {"vocab_file": "spiece.model", "tokenizer_file": "tokenizer.json"}
|
||||
|
||||
PRETRAINED_VOCAB_FILES_MAP = {
|
||||
"vocab_file": {
|
||||
"albert/albert-base-v1": "https://huggingface.co/albert/albert-base-v1/resolve/main/spiece.model",
|
||||
"albert/albert-large-v1": "https://huggingface.co/albert/albert-large-v1/resolve/main/spiece.model",
|
||||
"albert/albert-xlarge-v1": "https://huggingface.co/albert/albert-xlarge-v1/resolve/main/spiece.model",
|
||||
"albert/albert-xxlarge-v1": "https://huggingface.co/albert/albert-xxlarge-v1/resolve/main/spiece.model",
|
||||
"albert/albert-base-v2": "https://huggingface.co/albert/albert-base-v2/resolve/main/spiece.model",
|
||||
"albert/albert-large-v2": "https://huggingface.co/albert/albert-large-v2/resolve/main/spiece.model",
|
||||
"albert/albert-xlarge-v2": "https://huggingface.co/albert/albert-xlarge-v2/resolve/main/spiece.model",
|
||||
"albert/albert-xxlarge-v2": "https://huggingface.co/albert/albert-xxlarge-v2/resolve/main/spiece.model",
|
||||
},
|
||||
"tokenizer_file": {
|
||||
"albert/albert-base-v1": "https://huggingface.co/albert/albert-base-v1/resolve/main/tokenizer.json",
|
||||
"albert/albert-large-v1": "https://huggingface.co/albert/albert-large-v1/resolve/main/tokenizer.json",
|
||||
"albert/albert-xlarge-v1": "https://huggingface.co/albert/albert-xlarge-v1/resolve/main/tokenizer.json",
|
||||
"albert/albert-xxlarge-v1": "https://huggingface.co/albert/albert-xxlarge-v1/resolve/main/tokenizer.json",
|
||||
"albert/albert-base-v2": "https://huggingface.co/albert/albert-base-v2/resolve/main/tokenizer.json",
|
||||
"albert/albert-large-v2": "https://huggingface.co/albert/albert-large-v2/resolve/main/tokenizer.json",
|
||||
"albert/albert-xlarge-v2": "https://huggingface.co/albert/albert-xlarge-v2/resolve/main/tokenizer.json",
|
||||
"albert/albert-xxlarge-v2": "https://huggingface.co/albert/albert-xxlarge-v2/resolve/main/tokenizer.json",
|
||||
},
|
||||
}
|
||||
|
||||
PRETRAINED_POSITIONAL_EMBEDDINGS_SIZES = {
|
||||
"albert/albert-base-v1": 512,
|
||||
"albert/albert-large-v1": 512,
|
||||
"albert/albert-xlarge-v1": 512,
|
||||
"albert/albert-xxlarge-v1": 512,
|
||||
"albert/albert-base-v2": 512,
|
||||
"albert/albert-large-v2": 512,
|
||||
"albert/albert-xlarge-v2": 512,
|
||||
"albert/albert-xxlarge-v2": 512,
|
||||
}
|
||||
|
||||
SPIECE_UNDERLINE = "▁"
|
||||
|
||||
@ -117,8 +84,6 @@ class AlbertTokenizerFast(PreTrainedTokenizerFast):
|
||||
"""
|
||||
|
||||
vocab_files_names = VOCAB_FILES_NAMES
|
||||
pretrained_vocab_files_map = PRETRAINED_VOCAB_FILES_MAP
|
||||
max_model_input_sizes = PRETRAINED_POSITIONAL_EMBEDDINGS_SIZES
|
||||
slow_tokenizer_class = AlbertTokenizer
|
||||
|
||||
def __init__(
|
||||
|
@ -27,9 +27,8 @@ from ...utils import logging
|
||||
|
||||
logger = logging.get_logger(__name__)
|
||||
|
||||
ALIGN_PRETRAINED_CONFIG_ARCHIVE_MAP = {
|
||||
"kakaobrain/align-base": "https://huggingface.co/kakaobrain/align-base/resolve/main/config.json",
|
||||
}
|
||||
|
||||
from ..deprecated._archive_maps import ALIGN_PRETRAINED_CONFIG_ARCHIVE_MAP # noqa: F401, E402
|
||||
|
||||
|
||||
class AlignTextConfig(PretrainedConfig):
|
||||
|
@ -47,10 +47,7 @@ _CHECKPOINT_FOR_DOC = "kakaobrain/align-base"
|
||||
_CONFIG_FOR_DOC = "AlignConfig"
|
||||
|
||||
|
||||
ALIGN_PRETRAINED_MODEL_ARCHIVE_LIST = [
|
||||
"kakaobrain/align-base",
|
||||
# See all ALIGN models at https://huggingface.co/models?filter=align
|
||||
]
|
||||
from ..deprecated._archive_maps import ALIGN_PRETRAINED_MODEL_ARCHIVE_LIST # noqa: F401, E402
|
||||
|
||||
|
||||
ALIGN_START_DOCSTRING = r"""
|
||||
|
@ -22,10 +22,8 @@ from ...utils import logging
|
||||
|
||||
logger = logging.get_logger(__name__)
|
||||
|
||||
ALTCLIP_PRETRAINED_CONFIG_ARCHIVE_MAP = {
|
||||
"BAAI/AltCLIP": "https://huggingface.co/BAAI/AltCLIP/resolve/main/config.json",
|
||||
# See all AltCLIP models at https://huggingface.co/models?filter=altclip
|
||||
}
|
||||
|
||||
from ..deprecated._archive_maps import ALTCLIP_PRETRAINED_CONFIG_ARCHIVE_MAP # noqa: F401, E402
|
||||
|
||||
|
||||
class AltCLIPTextConfig(PretrainedConfig):
|
||||
|
@ -40,10 +40,8 @@ logger = logging.get_logger(__name__)
|
||||
_CHECKPOINT_FOR_DOC = "BAAI/AltCLIP"
|
||||
_CONFIG_FOR_DOC = "AltCLIPConfig"
|
||||
|
||||
ALTCLIP_PRETRAINED_MODEL_ARCHIVE_LIST = [
|
||||
"BAAI/AltCLIP",
|
||||
# See all AltCLIP models at https://huggingface.co/models?filter=altclip
|
||||
]
|
||||
|
||||
from ..deprecated._archive_maps import ALTCLIP_PRETRAINED_MODEL_ARCHIVE_LIST # noqa: F401, E402
|
||||
|
||||
|
||||
ALTCLIP_START_DOCSTRING = r"""
|
||||
|
@ -21,11 +21,8 @@ from ...utils import logging
|
||||
|
||||
logger = logging.get_logger(__name__)
|
||||
|
||||
AUDIO_SPECTROGRAM_TRANSFORMER_PRETRAINED_CONFIG_ARCHIVE_MAP = {
|
||||
"MIT/ast-finetuned-audioset-10-10-0.4593": (
|
||||
"https://huggingface.co/MIT/ast-finetuned-audioset-10-10-0.4593/resolve/main/config.json"
|
||||
),
|
||||
}
|
||||
|
||||
from ..deprecated._archive_maps import AUDIO_SPECTROGRAM_TRANSFORMER_PRETRAINED_CONFIG_ARCHIVE_MAP # noqa: F401, E402
|
||||
|
||||
|
||||
class ASTConfig(PretrainedConfig):
|
||||
|
@ -45,10 +45,7 @@ _SEQ_CLASS_EXPECTED_OUTPUT = "'Speech'"
|
||||
_SEQ_CLASS_EXPECTED_LOSS = 0.17
|
||||
|
||||
|
||||
AUDIO_SPECTROGRAM_TRANSFORMER_PRETRAINED_MODEL_ARCHIVE_LIST = [
|
||||
"MIT/ast-finetuned-audioset-10-10-0.4593",
|
||||
# See all Audio Spectrogram Transformer models at https://huggingface.co/models?filter=ast
|
||||
]
|
||||
from ..deprecated._archive_maps import AUDIO_SPECTROGRAM_TRANSFORMER_PRETRAINED_MODEL_ARCHIVE_LIST # noqa: F401, E402
|
||||
|
||||
|
||||
class ASTEmbeddings(nn.Module):
|
||||
|
@ -27,6 +27,10 @@ from ...utils import CONFIG_NAME, logging
|
||||
|
||||
logger = logging.get_logger(__name__)
|
||||
|
||||
|
||||
from ..deprecated._archive_maps import CONFIG_ARCHIVE_MAP_MAPPING_NAMES # noqa: F401, E402
|
||||
|
||||
|
||||
CONFIG_MAPPING_NAMES = OrderedDict(
|
||||
[
|
||||
# Add configs here
|
||||
@ -276,230 +280,6 @@ CONFIG_MAPPING_NAMES = OrderedDict(
|
||||
]
|
||||
)
|
||||
|
||||
CONFIG_ARCHIVE_MAP_MAPPING_NAMES = OrderedDict(
|
||||
[
|
||||
# Add archive maps here)
|
||||
("albert", "ALBERT_PRETRAINED_CONFIG_ARCHIVE_MAP"),
|
||||
("align", "ALIGN_PRETRAINED_CONFIG_ARCHIVE_MAP"),
|
||||
("altclip", "ALTCLIP_PRETRAINED_CONFIG_ARCHIVE_MAP"),
|
||||
("audio-spectrogram-transformer", "AUDIO_SPECTROGRAM_TRANSFORMER_PRETRAINED_CONFIG_ARCHIVE_MAP"),
|
||||
("autoformer", "AUTOFORMER_PRETRAINED_CONFIG_ARCHIVE_MAP"),
|
||||
("bark", "BARK_PRETRAINED_CONFIG_ARCHIVE_MAP"),
|
||||
("bart", "BART_PRETRAINED_CONFIG_ARCHIVE_MAP"),
|
||||
("beit", "BEIT_PRETRAINED_CONFIG_ARCHIVE_MAP"),
|
||||
("bert", "BERT_PRETRAINED_CONFIG_ARCHIVE_MAP"),
|
||||
("big_bird", "BIG_BIRD_PRETRAINED_CONFIG_ARCHIVE_MAP"),
|
||||
("bigbird_pegasus", "BIGBIRD_PEGASUS_PRETRAINED_CONFIG_ARCHIVE_MAP"),
|
||||
("biogpt", "BIOGPT_PRETRAINED_CONFIG_ARCHIVE_MAP"),
|
||||
("bit", "BIT_PRETRAINED_CONFIG_ARCHIVE_MAP"),
|
||||
("blenderbot", "BLENDERBOT_PRETRAINED_CONFIG_ARCHIVE_MAP"),
|
||||
("blenderbot-small", "BLENDERBOT_SMALL_PRETRAINED_CONFIG_ARCHIVE_MAP"),
|
||||
("blip", "BLIP_PRETRAINED_CONFIG_ARCHIVE_MAP"),
|
||||
("blip-2", "BLIP_2_PRETRAINED_CONFIG_ARCHIVE_MAP"),
|
||||
("bloom", "BLOOM_PRETRAINED_CONFIG_ARCHIVE_MAP"),
|
||||
("bridgetower", "BRIDGETOWER_PRETRAINED_CONFIG_ARCHIVE_MAP"),
|
||||
("bros", "BROS_PRETRAINED_CONFIG_ARCHIVE_MAP"),
|
||||
("camembert", "CAMEMBERT_PRETRAINED_CONFIG_ARCHIVE_MAP"),
|
||||
("canine", "CANINE_PRETRAINED_CONFIG_ARCHIVE_MAP"),
|
||||
("chinese_clip", "CHINESE_CLIP_PRETRAINED_CONFIG_ARCHIVE_MAP"),
|
||||
("clap", "CLAP_PRETRAINED_MODEL_ARCHIVE_LIST"),
|
||||
("clip", "CLIP_PRETRAINED_CONFIG_ARCHIVE_MAP"),
|
||||
("clipseg", "CLIPSEG_PRETRAINED_CONFIG_ARCHIVE_MAP"),
|
||||
("clvp", "CLVP_PRETRAINED_CONFIG_ARCHIVE_MAP"),
|
||||
("codegen", "CODEGEN_PRETRAINED_CONFIG_ARCHIVE_MAP"),
|
||||
("cohere", "COHERE_PRETRAINED_CONFIG_ARCHIVE_MAP"),
|
||||
("conditional_detr", "CONDITIONAL_DETR_PRETRAINED_CONFIG_ARCHIVE_MAP"),
|
||||
("convbert", "CONVBERT_PRETRAINED_CONFIG_ARCHIVE_MAP"),
|
||||
("convnext", "CONVNEXT_PRETRAINED_CONFIG_ARCHIVE_MAP"),
|
||||
("convnextv2", "CONVNEXTV2_PRETRAINED_CONFIG_ARCHIVE_MAP"),
|
||||
("cpmant", "CPMANT_PRETRAINED_CONFIG_ARCHIVE_MAP"),
|
||||
("ctrl", "CTRL_PRETRAINED_CONFIG_ARCHIVE_MAP"),
|
||||
("cvt", "CVT_PRETRAINED_CONFIG_ARCHIVE_MAP"),
|
||||
("data2vec-audio", "DATA2VEC_AUDIO_PRETRAINED_CONFIG_ARCHIVE_MAP"),
|
||||
("data2vec-text", "DATA2VEC_TEXT_PRETRAINED_CONFIG_ARCHIVE_MAP"),
|
||||
("data2vec-vision", "DATA2VEC_VISION_PRETRAINED_CONFIG_ARCHIVE_MAP"),
|
||||
("deberta", "DEBERTA_PRETRAINED_CONFIG_ARCHIVE_MAP"),
|
||||
("deberta-v2", "DEBERTA_V2_PRETRAINED_CONFIG_ARCHIVE_MAP"),
|
||||
("deformable_detr", "DEFORMABLE_DETR_PRETRAINED_CONFIG_ARCHIVE_MAP"),
|
||||
("deit", "DEIT_PRETRAINED_CONFIG_ARCHIVE_MAP"),
|
||||
("depth_anything", "DEPTH_ANYTHING_PRETRAINED_CONFIG_ARCHIVE_MAP"),
|
||||
("deta", "DETA_PRETRAINED_CONFIG_ARCHIVE_MAP"),
|
||||
("detr", "DETR_PRETRAINED_CONFIG_ARCHIVE_MAP"),
|
||||
("dinat", "DINAT_PRETRAINED_CONFIG_ARCHIVE_MAP"),
|
||||
("dinov2", "DINOV2_PRETRAINED_CONFIG_ARCHIVE_MAP"),
|
||||
("distilbert", "DISTILBERT_PRETRAINED_CONFIG_ARCHIVE_MAP"),
|
||||
("donut-swin", "DONUT_SWIN_PRETRAINED_CONFIG_ARCHIVE_MAP"),
|
||||
("dpr", "DPR_PRETRAINED_CONFIG_ARCHIVE_MAP"),
|
||||
("dpt", "DPT_PRETRAINED_CONFIG_ARCHIVE_MAP"),
|
||||
("efficientformer", "EFFICIENTFORMER_PRETRAINED_CONFIG_ARCHIVE_MAP"),
|
||||
("efficientnet", "EFFICIENTNET_PRETRAINED_CONFIG_ARCHIVE_MAP"),
|
||||
("electra", "ELECTRA_PRETRAINED_CONFIG_ARCHIVE_MAP"),
|
||||
("encodec", "ENCODEC_PRETRAINED_CONFIG_ARCHIVE_MAP"),
|
||||
("ernie", "ERNIE_PRETRAINED_CONFIG_ARCHIVE_MAP"),
|
||||
("ernie_m", "ERNIE_M_PRETRAINED_CONFIG_ARCHIVE_MAP"),
|
||||
("esm", "ESM_PRETRAINED_CONFIG_ARCHIVE_MAP"),
|
||||
("falcon", "FALCON_PRETRAINED_CONFIG_ARCHIVE_MAP"),
|
||||
("fastspeech2_conformer", "FASTSPEECH2_CONFORMER_PRETRAINED_CONFIG_ARCHIVE_MAP"),
|
||||
("flaubert", "FLAUBERT_PRETRAINED_CONFIG_ARCHIVE_MAP"),
|
||||
("flava", "FLAVA_PRETRAINED_CONFIG_ARCHIVE_MAP"),
|
||||
("fnet", "FNET_PRETRAINED_CONFIG_ARCHIVE_MAP"),
|
||||
("focalnet", "FOCALNET_PRETRAINED_CONFIG_ARCHIVE_MAP"),
|
||||
("fsmt", "FSMT_PRETRAINED_CONFIG_ARCHIVE_MAP"),
|
||||
("funnel", "FUNNEL_PRETRAINED_CONFIG_ARCHIVE_MAP"),
|
||||
("fuyu", "FUYU_PRETRAINED_CONFIG_ARCHIVE_MAP"),
|
||||
("gemma", "GEMMA_PRETRAINED_CONFIG_ARCHIVE_MAP"),
|
||||
("git", "GIT_PRETRAINED_CONFIG_ARCHIVE_MAP"),
|
||||
("glpn", "GLPN_PRETRAINED_CONFIG_ARCHIVE_MAP"),
|
||||
("gpt2", "GPT2_PRETRAINED_CONFIG_ARCHIVE_MAP"),
|
||||
("gpt_bigcode", "GPT_BIGCODE_PRETRAINED_CONFIG_ARCHIVE_MAP"),
|
||||
("gpt_neo", "GPT_NEO_PRETRAINED_CONFIG_ARCHIVE_MAP"),
|
||||
("gpt_neox", "GPT_NEOX_PRETRAINED_CONFIG_ARCHIVE_MAP"),
|
||||
("gpt_neox_japanese", "GPT_NEOX_JAPANESE_PRETRAINED_CONFIG_ARCHIVE_MAP"),
|
||||
("gptj", "GPTJ_PRETRAINED_CONFIG_ARCHIVE_MAP"),
|
||||
("gptsan-japanese", "GPTSAN_JAPANESE_PRETRAINED_CONFIG_ARCHIVE_MAP"),
|
||||
("graphormer", "GRAPHORMER_PRETRAINED_CONFIG_ARCHIVE_MAP"),
|
||||
("groupvit", "GROUPVIT_PRETRAINED_CONFIG_ARCHIVE_MAP"),
|
||||
("hubert", "HUBERT_PRETRAINED_CONFIG_ARCHIVE_MAP"),
|
||||
("ibert", "IBERT_PRETRAINED_CONFIG_ARCHIVE_MAP"),
|
||||
("idefics", "IDEFICS_PRETRAINED_CONFIG_ARCHIVE_MAP"),
|
||||
("imagegpt", "IMAGEGPT_PRETRAINED_CONFIG_ARCHIVE_MAP"),
|
||||
("informer", "INFORMER_PRETRAINED_CONFIG_ARCHIVE_MAP"),
|
||||
("instructblip", "INSTRUCTBLIP_PRETRAINED_CONFIG_ARCHIVE_MAP"),
|
||||
("jukebox", "JUKEBOX_PRETRAINED_CONFIG_ARCHIVE_MAP"),
|
||||
("kosmos-2", "KOSMOS2_PRETRAINED_CONFIG_ARCHIVE_MAP"),
|
||||
("layoutlm", "LAYOUTLM_PRETRAINED_CONFIG_ARCHIVE_MAP"),
|
||||
("layoutlmv2", "LAYOUTLMV2_PRETRAINED_CONFIG_ARCHIVE_MAP"),
|
||||
("layoutlmv3", "LAYOUTLMV3_PRETRAINED_CONFIG_ARCHIVE_MAP"),
|
||||
("led", "LED_PRETRAINED_CONFIG_ARCHIVE_MAP"),
|
||||
("levit", "LEVIT_PRETRAINED_CONFIG_ARCHIVE_MAP"),
|
||||
("lilt", "LILT_PRETRAINED_CONFIG_ARCHIVE_MAP"),
|
||||
("llama", "LLAMA_PRETRAINED_CONFIG_ARCHIVE_MAP"),
|
||||
("llava", "LLAVA_PRETRAINED_CONFIG_ARCHIVE_MAP"),
|
||||
("llava_next", "LLAVA_NEXT_PRETRAINED_CONFIG_ARCHIVE_MAP"),
|
||||
("longformer", "LONGFORMER_PRETRAINED_CONFIG_ARCHIVE_MAP"),
|
||||
("longt5", "LONGT5_PRETRAINED_CONFIG_ARCHIVE_MAP"),
|
||||
("luke", "LUKE_PRETRAINED_CONFIG_ARCHIVE_MAP"),
|
||||
("lxmert", "LXMERT_PRETRAINED_CONFIG_ARCHIVE_MAP"),
|
||||
("m2m_100", "M2M_100_PRETRAINED_CONFIG_ARCHIVE_MAP"),
|
||||
("mamba", "MAMBA_PRETRAINED_CONFIG_ARCHIVE_MAP"),
|
||||
("markuplm", "MARKUPLM_PRETRAINED_CONFIG_ARCHIVE_MAP"),
|
||||
("mask2former", "MASK2FORMER_PRETRAINED_CONFIG_ARCHIVE_MAP"),
|
||||
("maskformer", "MASKFORMER_PRETRAINED_CONFIG_ARCHIVE_MAP"),
|
||||
("mbart", "MBART_PRETRAINED_CONFIG_ARCHIVE_MAP"),
|
||||
("mctct", "MCTCT_PRETRAINED_CONFIG_ARCHIVE_MAP"),
|
||||
("mega", "MEGA_PRETRAINED_CONFIG_ARCHIVE_MAP"),
|
||||
("megatron-bert", "MEGATRON_BERT_PRETRAINED_CONFIG_ARCHIVE_MAP"),
|
||||
("mgp-str", "MGP_STR_PRETRAINED_CONFIG_ARCHIVE_MAP"),
|
||||
("mistral", "MISTRAL_PRETRAINED_CONFIG_ARCHIVE_MAP"),
|
||||
("mixtral", "MIXTRAL_PRETRAINED_CONFIG_ARCHIVE_MAP"),
|
||||
("mobilenet_v1", "MOBILENET_V1_PRETRAINED_CONFIG_ARCHIVE_MAP"),
|
||||
("mobilenet_v2", "MOBILENET_V2_PRETRAINED_CONFIG_ARCHIVE_MAP"),
|
||||
("mobilevit", "MOBILEVIT_PRETRAINED_CONFIG_ARCHIVE_MAP"),
|
||||
("mobilevitv2", "MOBILEVITV2_PRETRAINED_CONFIG_ARCHIVE_MAP"),
|
||||
("mpnet", "MPNET_PRETRAINED_CONFIG_ARCHIVE_MAP"),
|
||||
("mpt", "MPT_PRETRAINED_CONFIG_ARCHIVE_MAP"),
|
||||
("mra", "MRA_PRETRAINED_CONFIG_ARCHIVE_MAP"),
|
||||
("musicgen", "MUSICGEN_PRETRAINED_CONFIG_ARCHIVE_MAP"),
|
||||
("musicgen_melody", "MUSICGEN_MELODY_PRETRAINED_CONFIG_ARCHIVE_MAP"),
|
||||
("mvp", "MVP_PRETRAINED_CONFIG_ARCHIVE_MAP"),
|
||||
("nat", "NAT_PRETRAINED_CONFIG_ARCHIVE_MAP"),
|
||||
("nezha", "NEZHA_PRETRAINED_CONFIG_ARCHIVE_MAP"),
|
||||
("nllb-moe", "NLLB_MOE_PRETRAINED_CONFIG_ARCHIVE_MAP"),
|
||||
("nystromformer", "NYSTROMFORMER_PRETRAINED_CONFIG_ARCHIVE_MAP"),
|
||||
("oneformer", "ONEFORMER_PRETRAINED_CONFIG_ARCHIVE_MAP"),
|
||||
("open-llama", "OPEN_LLAMA_PRETRAINED_CONFIG_ARCHIVE_MAP"),
|
||||
("openai-gpt", "OPENAI_GPT_PRETRAINED_CONFIG_ARCHIVE_MAP"),
|
||||
("opt", "OPT_PRETRAINED_CONFIG_ARCHIVE_MAP"),
|
||||
("owlv2", "OWLV2_PRETRAINED_CONFIG_ARCHIVE_MAP"),
|
||||
("owlvit", "OWLVIT_PRETRAINED_CONFIG_ARCHIVE_MAP"),
|
||||
("patchtsmixer", "PATCHTSMIXER_PRETRAINED_CONFIG_ARCHIVE_MAP"),
|
||||
("patchtst", "PATCHTST_PRETRAINED_CONFIG_ARCHIVE_MAP"),
|
||||
("pegasus", "PEGASUS_PRETRAINED_CONFIG_ARCHIVE_MAP"),
|
||||
("pegasus_x", "PEGASUS_X_PRETRAINED_CONFIG_ARCHIVE_MAP"),
|
||||
("perceiver", "PERCEIVER_PRETRAINED_CONFIG_ARCHIVE_MAP"),
|
||||
("persimmon", "PERSIMMON_PRETRAINED_CONFIG_ARCHIVE_MAP"),
|
||||
("phi", "PHI_PRETRAINED_CONFIG_ARCHIVE_MAP"),
|
||||
("pix2struct", "PIX2STRUCT_PRETRAINED_CONFIG_ARCHIVE_MAP"),
|
||||
("plbart", "PLBART_PRETRAINED_CONFIG_ARCHIVE_MAP"),
|
||||
("poolformer", "POOLFORMER_PRETRAINED_CONFIG_ARCHIVE_MAP"),
|
||||
("pop2piano", "POP2PIANO_PRETRAINED_CONFIG_ARCHIVE_MAP"),
|
||||
("prophetnet", "PROPHETNET_PRETRAINED_CONFIG_ARCHIVE_MAP"),
|
||||
("pvt", "PVT_PRETRAINED_CONFIG_ARCHIVE_MAP"),
|
||||
("pvt_v2", "PVT_V2_PRETRAINED_CONFIG_ARCHIVE_MAP"),
|
||||
("qdqbert", "QDQBERT_PRETRAINED_CONFIG_ARCHIVE_MAP"),
|
||||
("qwen2", "QWEN2_PRETRAINED_CONFIG_ARCHIVE_MAP"),
|
||||
("realm", "REALM_PRETRAINED_CONFIG_ARCHIVE_MAP"),
|
||||
("regnet", "REGNET_PRETRAINED_CONFIG_ARCHIVE_MAP"),
|
||||
("rembert", "REMBERT_PRETRAINED_CONFIG_ARCHIVE_MAP"),
|
||||
("resnet", "RESNET_PRETRAINED_CONFIG_ARCHIVE_MAP"),
|
||||
("retribert", "RETRIBERT_PRETRAINED_CONFIG_ARCHIVE_MAP"),
|
||||
("roberta", "ROBERTA_PRETRAINED_CONFIG_ARCHIVE_MAP"),
|
||||
("roberta-prelayernorm", "ROBERTA_PRELAYERNORM_PRETRAINED_CONFIG_ARCHIVE_MAP"),
|
||||
("roc_bert", "ROC_BERT_PRETRAINED_CONFIG_ARCHIVE_MAP"),
|
||||
("roformer", "ROFORMER_PRETRAINED_CONFIG_ARCHIVE_MAP"),
|
||||
("rwkv", "RWKV_PRETRAINED_CONFIG_ARCHIVE_MAP"),
|
||||
("sam", "SAM_PRETRAINED_CONFIG_ARCHIVE_MAP"),
|
||||
("seamless_m4t", "SEAMLESS_M4T_PRETRAINED_CONFIG_ARCHIVE_MAP"),
|
||||
("seamless_m4t_v2", "SEAMLESS_M4T_V2_PRETRAINED_CONFIG_ARCHIVE_MAP"),
|
||||
("segformer", "SEGFORMER_PRETRAINED_CONFIG_ARCHIVE_MAP"),
|
||||
("seggpt", "SEGGPT_PRETRAINED_CONFIG_ARCHIVE_MAP"),
|
||||
("sew", "SEW_PRETRAINED_CONFIG_ARCHIVE_MAP"),
|
||||
("sew-d", "SEW_D_PRETRAINED_CONFIG_ARCHIVE_MAP"),
|
||||
("siglip", "SIGLIP_PRETRAINED_CONFIG_ARCHIVE_MAP"),
|
||||
("speech_to_text", "SPEECH_TO_TEXT_PRETRAINED_CONFIG_ARCHIVE_MAP"),
|
||||
("speech_to_text_2", "SPEECH_TO_TEXT_2_PRETRAINED_CONFIG_ARCHIVE_MAP"),
|
||||
("speecht5", "SPEECHT5_PRETRAINED_CONFIG_ARCHIVE_MAP"),
|
||||
("splinter", "SPLINTER_PRETRAINED_CONFIG_ARCHIVE_MAP"),
|
||||
("squeezebert", "SQUEEZEBERT_PRETRAINED_CONFIG_ARCHIVE_MAP"),
|
||||
("stablelm", "STABLELM_PRETRAINED_CONFIG_ARCHIVE_MAP"),
|
||||
("starcoder2", "STARCODER2_PRETRAINED_CONFIG_ARCHIVE_MAP"),
|
||||
("superpoint", "SUPERPOINT_PRETRAINED_CONFIG_ARCHIVE_MAP"),
|
||||
("swiftformer", "SWIFTFORMER_PRETRAINED_CONFIG_ARCHIVE_MAP"),
|
||||
("swin", "SWIN_PRETRAINED_CONFIG_ARCHIVE_MAP"),
|
||||
("swin2sr", "SWIN2SR_PRETRAINED_CONFIG_ARCHIVE_MAP"),
|
||||
("swinv2", "SWINV2_PRETRAINED_CONFIG_ARCHIVE_MAP"),
|
||||
("switch_transformers", "SWITCH_TRANSFORMERS_PRETRAINED_CONFIG_ARCHIVE_MAP"),
|
||||
("t5", "T5_PRETRAINED_CONFIG_ARCHIVE_MAP"),
|
||||
("table-transformer", "TABLE_TRANSFORMER_PRETRAINED_CONFIG_ARCHIVE_MAP"),
|
||||
("tapas", "TAPAS_PRETRAINED_CONFIG_ARCHIVE_MAP"),
|
||||
("time_series_transformer", "TIME_SERIES_TRANSFORMER_PRETRAINED_CONFIG_ARCHIVE_MAP"),
|
||||
("timesformer", "TIMESFORMER_PRETRAINED_CONFIG_ARCHIVE_MAP"),
|
||||
("transfo-xl", "TRANSFO_XL_PRETRAINED_CONFIG_ARCHIVE_MAP"),
|
||||
("tvlt", "TVLT_PRETRAINED_CONFIG_ARCHIVE_MAP"),
|
||||
("tvp", "TVP_PRETRAINED_CONFIG_ARCHIVE_MAP"),
|
||||
("udop", "UDOP_PRETRAINED_CONFIG_ARCHIVE_MAP"),
|
||||
("unispeech", "UNISPEECH_PRETRAINED_CONFIG_ARCHIVE_MAP"),
|
||||
("unispeech-sat", "UNISPEECH_SAT_PRETRAINED_CONFIG_ARCHIVE_MAP"),
|
||||
("univnet", "UNIVNET_PRETRAINED_CONFIG_ARCHIVE_MAP"),
|
||||
("van", "VAN_PRETRAINED_CONFIG_ARCHIVE_MAP"),
|
||||
("videomae", "VIDEOMAE_PRETRAINED_CONFIG_ARCHIVE_MAP"),
|
||||
("vilt", "VILT_PRETRAINED_CONFIG_ARCHIVE_MAP"),
|
||||
("vipllava", "VIPLLAVA_PRETRAINED_CONFIG_ARCHIVE_MAP"),
|
||||
("visual_bert", "VISUAL_BERT_PRETRAINED_CONFIG_ARCHIVE_MAP"),
|
||||
("vit", "VIT_PRETRAINED_CONFIG_ARCHIVE_MAP"),
|
||||
("vit_hybrid", "VIT_HYBRID_PRETRAINED_CONFIG_ARCHIVE_MAP"),
|
||||
("vit_mae", "VIT_MAE_PRETRAINED_CONFIG_ARCHIVE_MAP"),
|
||||
("vit_msn", "VIT_MSN_PRETRAINED_CONFIG_ARCHIVE_MAP"),
|
||||
("vitdet", "VITDET_PRETRAINED_CONFIG_ARCHIVE_MAP"),
|
||||
("vitmatte", "VITMATTE_PRETRAINED_CONFIG_ARCHIVE_MAP"),
|
||||
("vits", "VITS_PRETRAINED_CONFIG_ARCHIVE_MAP"),
|
||||
("vivit", "VIVIT_PRETRAINED_CONFIG_ARCHIVE_MAP"),
|
||||
("wav2vec2", "WAV_2_VEC_2_PRETRAINED_CONFIG_ARCHIVE_MAP"),
|
||||
("wav2vec2-bert", "WAV2VEC2_BERT_PRETRAINED_CONFIG_ARCHIVE_MAP"),
|
||||
("wav2vec2-conformer", "WAV2VEC2_CONFORMER_PRETRAINED_CONFIG_ARCHIVE_MAP"),
|
||||
("whisper", "WHISPER_PRETRAINED_CONFIG_ARCHIVE_MAP"),
|
||||
("xclip", "XCLIP_PRETRAINED_CONFIG_ARCHIVE_MAP"),
|
||||
("xglm", "XGLM_PRETRAINED_CONFIG_ARCHIVE_MAP"),
|
||||
("xlm", "XLM_PRETRAINED_CONFIG_ARCHIVE_MAP"),
|
||||
("xlm-prophetnet", "XLM_PROPHETNET_PRETRAINED_CONFIG_ARCHIVE_MAP"),
|
||||
("xlm-roberta", "XLM_ROBERTA_PRETRAINED_CONFIG_ARCHIVE_MAP"),
|
||||
("xlnet", "XLNET_PRETRAINED_CONFIG_ARCHIVE_MAP"),
|
||||
("xmod", "XMOD_PRETRAINED_CONFIG_ARCHIVE_MAP"),
|
||||
("yolos", "YOLOS_PRETRAINED_CONFIG_ARCHIVE_MAP"),
|
||||
("yoso", "YOSO_PRETRAINED_CONFIG_ARCHIVE_MAP"),
|
||||
]
|
||||
)
|
||||
|
||||
MODEL_NAMES_MAPPING = OrderedDict(
|
||||
[
|
||||
# Add full (and cased) model names here
|
||||
@ -906,11 +686,6 @@ class _LazyLoadAllMappings(OrderedDict):
|
||||
def _initialize(self):
|
||||
if self._initialized:
|
||||
return
|
||||
warnings.warn(
|
||||
"ALL_PRETRAINED_CONFIG_ARCHIVE_MAP is deprecated and will be removed in v5 of Transformers. "
|
||||
"It does not contain all available model checkpoints, far from it. Checkout hf.co/models for that.",
|
||||
FutureWarning,
|
||||
)
|
||||
|
||||
for model_type, map_name in self._mapping.items():
|
||||
module_name = model_type_to_module_name(model_type)
|
||||
@ -945,9 +720,6 @@ class _LazyLoadAllMappings(OrderedDict):
|
||||
return item in self._data
|
||||
|
||||
|
||||
ALL_PRETRAINED_CONFIG_ARCHIVE_MAP = _LazyLoadAllMappings(CONFIG_ARCHIVE_MAP_MAPPING_NAMES)
|
||||
|
||||
|
||||
def _get_class_name(model_class: Union[str, List[str]]):
|
||||
if isinstance(model_class, (list, tuple)):
|
||||
return " or ".join([f"[`{c}`]" for c in model_class if c is not None])
|
||||
@ -1192,3 +964,6 @@ class AutoConfig:
|
||||
"match!"
|
||||
)
|
||||
CONFIG_MAPPING.register(model_type, config, exist_ok=exist_ok)
|
||||
|
||||
|
||||
ALL_PRETRAINED_CONFIG_ARCHIVE_MAP = _LazyLoadAllMappings(CONFIG_ARCHIVE_MAP_MAPPING_NAMES)
|
||||
|
@ -22,9 +22,8 @@ from ...utils import logging
|
||||
|
||||
logger = logging.get_logger(__name__)
|
||||
|
||||
AUTOFORMER_PRETRAINED_CONFIG_ARCHIVE_MAP = {
|
||||
"huggingface/autoformer-tourism-monthly": "https://huggingface.co/huggingface/autoformer-tourism-monthly/resolve/main/config.json",
|
||||
}
|
||||
|
||||
from ..deprecated._archive_maps import AUTOFORMER_PRETRAINED_CONFIG_ARCHIVE_MAP # noqa: F401, E402
|
||||
|
||||
|
||||
class AutoformerConfig(PretrainedConfig):
|
||||
|
@ -167,10 +167,7 @@ class AutoformerModelOutput(ModelOutput):
|
||||
static_features: Optional[torch.FloatTensor] = None
|
||||
|
||||
|
||||
AUTOFORMER_PRETRAINED_MODEL_ARCHIVE_LIST = [
|
||||
"huggingface/autoformer-tourism-monthly",
|
||||
# See all Autoformer models at https://huggingface.co/models?filter=autoformer
|
||||
]
|
||||
from ..deprecated._archive_maps import AUTOFORMER_PRETRAINED_MODEL_ARCHIVE_LIST # noqa: F401, E402
|
||||
|
||||
|
||||
# Copied from transformers.models.time_series_transformer.modeling_time_series_transformer.TimeSeriesFeatureEmbedder with TimeSeries->Autoformer
|
||||
|
@ -25,11 +25,6 @@ from ..auto import CONFIG_MAPPING
|
||||
logger = logging.get_logger(__name__)
|
||||
|
||||
|
||||
BARK_PRETRAINED_CONFIG_ARCHIVE_MAP = {
|
||||
"suno/bark-small": "https://huggingface.co/suno/bark-small/resolve/main/config.json",
|
||||
"suno/bark": "https://huggingface.co/suno/bark/resolve/main/config.json",
|
||||
}
|
||||
|
||||
BARK_SUBMODELCONFIG_START_DOCSTRING = """
|
||||
This is the configuration class to store the configuration of a [`{model}`]. It is used to instantiate the model
|
||||
according to the specified arguments, defining the model architecture. Instantiating a configuration with the
|
||||
|
@ -63,11 +63,8 @@ logger = logging.get_logger(__name__)
|
||||
_CHECKPOINT_FOR_DOC = "suno/bark-small"
|
||||
_CONFIG_FOR_DOC = "BarkConfig"
|
||||
|
||||
BARK_PRETRAINED_MODEL_ARCHIVE_LIST = [
|
||||
"suno/bark-small",
|
||||
"suno/bark",
|
||||
# See all Bark models at https://huggingface.co/models?filter=bark
|
||||
]
|
||||
|
||||
from ..deprecated._archive_maps import BARK_PRETRAINED_MODEL_ARCHIVE_LIST # noqa: F401, E402
|
||||
|
||||
|
||||
# Copied from transformers.models.llama.modeling_llama._get_unpad_data
|
||||
|
@ -26,11 +26,6 @@ from ...utils import TensorType, is_torch_available, logging
|
||||
|
||||
logger = logging.get_logger(__name__)
|
||||
|
||||
BART_PRETRAINED_CONFIG_ARCHIVE_MAP = {
|
||||
"facebook/bart-large": "https://huggingface.co/facebook/bart-large/resolve/main/config.json",
|
||||
# See all BART models at https://huggingface.co/models?filter=bart
|
||||
}
|
||||
|
||||
|
||||
class BartConfig(PretrainedConfig):
|
||||
r"""
|
||||
|
@ -78,10 +78,7 @@ _QA_EXPECTED_LOSS = 0.59
|
||||
_QA_EXPECTED_OUTPUT = "' nice puppet'"
|
||||
|
||||
|
||||
BART_PRETRAINED_MODEL_ARCHIVE_LIST = [
|
||||
"facebook/bart-large",
|
||||
# see all BART models at https://huggingface.co/models?filter=bart
|
||||
]
|
||||
from ..deprecated._archive_maps import BART_PRETRAINED_MODEL_ARCHIVE_LIST # noqa: F401, E402
|
||||
|
||||
|
||||
# Copied from transformers.models.llama.modeling_llama._get_unpad_data
|
||||
|
@ -30,33 +30,6 @@ logger = logging.get_logger(__name__)
|
||||
VOCAB_FILES_NAMES = {"vocab_file": "vocab.json", "merges_file": "merges.txt"}
|
||||
|
||||
# See all BART models at https://huggingface.co/models?filter=bart
|
||||
PRETRAINED_VOCAB_FILES_MAP = {
|
||||
"vocab_file": {
|
||||
"facebook/bart-base": "https://huggingface.co/facebook/bart-base/resolve/main/vocab.json",
|
||||
"facebook/bart-large": "https://huggingface.co/facebook/bart-large/resolve/main/vocab.json",
|
||||
"facebook/bart-large-mnli": "https://huggingface.co/facebook/bart-large-mnli/resolve/main/vocab.json",
|
||||
"facebook/bart-large-cnn": "https://huggingface.co/facebook/bart-large-cnn/resolve/main/vocab.json",
|
||||
"facebook/bart-large-xsum": "https://huggingface.co/facebook/bart-large-xsum/resolve/main/vocab.json",
|
||||
"yjernite/bart_eli5": "https://huggingface.co/yjernite/bart_eli5/resolve/main/vocab.json",
|
||||
},
|
||||
"merges_file": {
|
||||
"facebook/bart-base": "https://huggingface.co/facebook/bart-base/resolve/main/merges.txt",
|
||||
"facebook/bart-large": "https://huggingface.co/facebook/bart-large/resolve/main/merges.txt",
|
||||
"facebook/bart-large-mnli": "https://huggingface.co/facebook/bart-large-mnli/resolve/main/merges.txt",
|
||||
"facebook/bart-large-cnn": "https://huggingface.co/facebook/bart-large-cnn/resolve/main/merges.txt",
|
||||
"facebook/bart-large-xsum": "https://huggingface.co/facebook/bart-large-xsum/resolve/main/merges.txt",
|
||||
"yjernite/bart_eli5": "https://huggingface.co/yjernite/bart_eli5/resolve/main/merges.txt",
|
||||
},
|
||||
}
|
||||
|
||||
PRETRAINED_POSITIONAL_EMBEDDINGS_SIZES = {
|
||||
"facebook/bart-base": 1024,
|
||||
"facebook/bart-large": 1024,
|
||||
"facebook/bart-large-mnli": 1024,
|
||||
"facebook/bart-large-cnn": 1024,
|
||||
"facebook/bart-large-xsum": 1024,
|
||||
"yjernite/bart_eli5": 1024,
|
||||
}
|
||||
|
||||
|
||||
@lru_cache()
|
||||
@ -177,8 +150,6 @@ class BartTokenizer(PreTrainedTokenizer):
|
||||
"""
|
||||
|
||||
vocab_files_names = VOCAB_FILES_NAMES
|
||||
pretrained_vocab_files_map = PRETRAINED_VOCAB_FILES_MAP
|
||||
max_model_input_sizes = PRETRAINED_POSITIONAL_EMBEDDINGS_SIZES
|
||||
model_input_names = ["input_ids", "attention_mask"]
|
||||
|
||||
def __init__(
|
||||
|
@ -30,41 +30,6 @@ logger = logging.get_logger(__name__)
|
||||
VOCAB_FILES_NAMES = {"vocab_file": "vocab.json", "merges_file": "merges.txt", "tokenizer_file": "tokenizer.json"}
|
||||
|
||||
# See all BART models at https://huggingface.co/models?filter=bart
|
||||
PRETRAINED_VOCAB_FILES_MAP = {
|
||||
"vocab_file": {
|
||||
"facebook/bart-base": "https://huggingface.co/facebook/bart-base/resolve/main/vocab.json",
|
||||
"facebook/bart-large": "https://huggingface.co/facebook/bart-large/resolve/main/vocab.json",
|
||||
"facebook/bart-large-mnli": "https://huggingface.co/facebook/bart-large-mnli/resolve/main/vocab.json",
|
||||
"facebook/bart-large-cnn": "https://huggingface.co/facebook/bart-large-cnn/resolve/main/vocab.json",
|
||||
"facebook/bart-large-xsum": "https://huggingface.co/facebook/bart-large-xsum/resolve/main/vocab.json",
|
||||
"yjernite/bart_eli5": "https://huggingface.co/yjernite/bart_eli5/resolve/main/vocab.json",
|
||||
},
|
||||
"merges_file": {
|
||||
"facebook/bart-base": "https://huggingface.co/facebook/bart-base/resolve/main/merges.txt",
|
||||
"facebook/bart-large": "https://huggingface.co/facebook/bart-large/resolve/main/merges.txt",
|
||||
"facebook/bart-large-mnli": "https://huggingface.co/facebook/bart-large-mnli/resolve/main/merges.txt",
|
||||
"facebook/bart-large-cnn": "https://huggingface.co/facebook/bart-large-cnn/resolve/main/merges.txt",
|
||||
"facebook/bart-large-xsum": "https://huggingface.co/facebook/bart-large-xsum/resolve/main/merges.txt",
|
||||
"yjernite/bart_eli5": "https://huggingface.co/yjernite/bart_eli5/resolve/main/merges.txt",
|
||||
},
|
||||
"tokenizer_file": {
|
||||
"facebook/bart-base": "https://huggingface.co/facebook/bart-base/resolve/main/tokenizer.json",
|
||||
"facebook/bart-large": "https://huggingface.co/facebook/bart-large/resolve/main/tokenizer.json",
|
||||
"facebook/bart-large-mnli": "https://huggingface.co/facebook/bart-large-mnli/resolve/main/tokenizer.json",
|
||||
"facebook/bart-large-cnn": "https://huggingface.co/facebook/bart-large-cnn/resolve/main/tokenizer.json",
|
||||
"facebook/bart-large-xsum": "https://huggingface.co/facebook/bart-large-xsum/resolve/main/tokenizer.json",
|
||||
"yjernite/bart_eli5": "https://huggingface.co/yjernite/bart_eli5/resolve/main/tokenizer.json",
|
||||
},
|
||||
}
|
||||
|
||||
PRETRAINED_POSITIONAL_EMBEDDINGS_SIZES = {
|
||||
"facebook/bart-base": 1024,
|
||||
"facebook/bart-large": 1024,
|
||||
"facebook/bart-large-mnli": 1024,
|
||||
"facebook/bart-large-cnn": 1024,
|
||||
"facebook/bart-large-xsum": 1024,
|
||||
"yjernite/bart_eli5": 1024,
|
||||
}
|
||||
|
||||
|
||||
class BartTokenizerFast(PreTrainedTokenizerFast):
|
||||
@ -149,8 +114,6 @@ class BartTokenizerFast(PreTrainedTokenizerFast):
|
||||
"""
|
||||
|
||||
vocab_files_names = VOCAB_FILES_NAMES
|
||||
pretrained_vocab_files_map = PRETRAINED_VOCAB_FILES_MAP
|
||||
max_model_input_sizes = PRETRAINED_POSITIONAL_EMBEDDINGS_SIZES
|
||||
model_input_names = ["input_ids", "attention_mask"]
|
||||
slow_tokenizer_class = BartTokenizer
|
||||
|
||||
|
@ -29,21 +29,6 @@ logger = logging.get_logger(__name__)
|
||||
|
||||
VOCAB_FILES_NAMES = {"vocab_file": "sentencepiece.bpe.model"}
|
||||
|
||||
PRETRAINED_VOCAB_FILES_MAP = {
|
||||
"vocab_file": {
|
||||
"moussaKam/mbarthez": "https://huggingface.co/moussaKam/mbarthez/resolve/main/sentencepiece.bpe.model",
|
||||
"moussaKam/barthez": "https://huggingface.co/moussaKam/barthez/resolve/main/sentencepiece.bpe.model",
|
||||
"moussaKam/barthez-orangesum-title": (
|
||||
"https://huggingface.co/moussaKam/barthez-orangesum-title/resolve/main/sentencepiece.bpe.model"
|
||||
),
|
||||
},
|
||||
}
|
||||
|
||||
PRETRAINED_POSITIONAL_EMBEDDINGS_SIZES = {
|
||||
"moussaKam/mbarthez": 1024,
|
||||
"moussaKam/barthez": 1024,
|
||||
"moussaKam/barthez-orangesum-title": 1024,
|
||||
}
|
||||
|
||||
SPIECE_UNDERLINE = "▁"
|
||||
|
||||
@ -119,8 +104,6 @@ class BarthezTokenizer(PreTrainedTokenizer):
|
||||
"""
|
||||
|
||||
vocab_files_names = VOCAB_FILES_NAMES
|
||||
pretrained_vocab_files_map = PRETRAINED_VOCAB_FILES_MAP
|
||||
max_model_input_sizes = PRETRAINED_POSITIONAL_EMBEDDINGS_SIZES
|
||||
model_input_names = ["input_ids", "attention_mask"]
|
||||
|
||||
def __init__(
|
||||
|
@ -33,28 +33,6 @@ logger = logging.get_logger(__name__)
|
||||
|
||||
VOCAB_FILES_NAMES = {"vocab_file": "sentencepiece.bpe.model", "tokenizer_file": "tokenizer.json"}
|
||||
|
||||
PRETRAINED_VOCAB_FILES_MAP = {
|
||||
"vocab_file": {
|
||||
"moussaKam/mbarthez": "https://huggingface.co/moussaKam/mbarthez/resolve/main/sentencepiece.bpe.model",
|
||||
"moussaKam/barthez": "https://huggingface.co/moussaKam/barthez/resolve/main/sentencepiece.bpe.model",
|
||||
"moussaKam/barthez-orangesum-title": (
|
||||
"https://huggingface.co/moussaKam/barthez-orangesum-title/resolve/main/sentencepiece.bpe.model"
|
||||
),
|
||||
},
|
||||
"tokenizer_file": {
|
||||
"moussaKam/mbarthez": "https://huggingface.co/moussaKam/mbarthez/resolve/main/tokenizer.json",
|
||||
"moussaKam/barthez": "https://huggingface.co/moussaKam/barthez/resolve/main/tokenizer.json",
|
||||
"moussaKam/barthez-orangesum-title": (
|
||||
"https://huggingface.co/moussaKam/barthez-orangesum-title/resolve/main/tokenizer.json"
|
||||
),
|
||||
},
|
||||
}
|
||||
|
||||
PRETRAINED_POSITIONAL_EMBEDDINGS_SIZES = {
|
||||
"moussaKam/mbarthez": 1024,
|
||||
"moussaKam/barthez": 1024,
|
||||
"moussaKam/barthez-orangesum-title": 1024,
|
||||
}
|
||||
|
||||
SPIECE_UNDERLINE = "▁"
|
||||
|
||||
@ -111,8 +89,6 @@ class BarthezTokenizerFast(PreTrainedTokenizerFast):
|
||||
"""
|
||||
|
||||
vocab_files_names = VOCAB_FILES_NAMES
|
||||
pretrained_vocab_files_map = PRETRAINED_VOCAB_FILES_MAP
|
||||
max_model_input_sizes = PRETRAINED_POSITIONAL_EMBEDDINGS_SIZES
|
||||
model_input_names = ["input_ids", "attention_mask"]
|
||||
slow_tokenizer_class = BarthezTokenizer
|
||||
|
||||
|
@ -31,17 +31,6 @@ SPIECE_UNDERLINE = "▁"
|
||||
|
||||
VOCAB_FILES_NAMES = {"vocab_file": "sentencepiece.bpe.model", "monolingual_vocab_file": "dict.txt"}
|
||||
|
||||
PRETRAINED_VOCAB_FILES_MAP = {
|
||||
"vocab_file": {
|
||||
"vinai/bartpho-syllable": "https://huggingface.co/vinai/bartpho-syllable/resolve/main/sentencepiece.bpe.model",
|
||||
},
|
||||
"monolingual_vocab_file": {
|
||||
"vinai/bartpho-syllable": "https://huggingface.co/vinai/bartpho-syllable/resolve/main/dict.txt",
|
||||
},
|
||||
}
|
||||
|
||||
PRETRAINED_POSITIONAL_EMBEDDINGS_SIZES = {"vinai/bartpho-syllable": 1024}
|
||||
|
||||
|
||||
class BartphoTokenizer(PreTrainedTokenizer):
|
||||
"""
|
||||
@ -114,8 +103,6 @@ class BartphoTokenizer(PreTrainedTokenizer):
|
||||
"""
|
||||
|
||||
vocab_files_names = VOCAB_FILES_NAMES
|
||||
pretrained_vocab_files_map = PRETRAINED_VOCAB_FILES_MAP
|
||||
max_model_input_sizes = PRETRAINED_POSITIONAL_EMBEDDINGS_SIZES
|
||||
model_input_names = ["input_ids", "attention_mask"]
|
||||
|
||||
def __init__(
|
||||
|
@ -26,12 +26,8 @@ from ...utils.backbone_utils import BackboneConfigMixin, get_aligned_output_feat
|
||||
|
||||
logger = logging.get_logger(__name__)
|
||||
|
||||
BEIT_PRETRAINED_CONFIG_ARCHIVE_MAP = {
|
||||
"microsoft/beit-base-patch16-224-pt22k": (
|
||||
"https://huggingface.co/microsoft/beit-base-patch16-224-pt22k/resolve/main/config.json"
|
||||
),
|
||||
# See all BEiT models at https://huggingface.co/models?filter=beit
|
||||
}
|
||||
|
||||
from ..deprecated._archive_maps import BEIT_PRETRAINED_CONFIG_ARCHIVE_MAP # noqa: F401, E402
|
||||
|
||||
|
||||
class BeitConfig(BackboneConfigMixin, PretrainedConfig):
|
||||
|
@ -60,10 +60,8 @@ _EXPECTED_OUTPUT_SHAPE = [1, 197, 768]
|
||||
_IMAGE_CLASS_CHECKPOINT = "microsoft/beit-base-patch16-224"
|
||||
_IMAGE_CLASS_EXPECTED_OUTPUT = "tabby, tabby cat"
|
||||
|
||||
BEIT_PRETRAINED_MODEL_ARCHIVE_LIST = [
|
||||
"microsoft/beit-base-patch16-224",
|
||||
# See all BEiT models at https://huggingface.co/models?filter=beit
|
||||
]
|
||||
|
||||
from ..deprecated._archive_maps import BEIT_PRETRAINED_MODEL_ARCHIVE_LIST # noqa: F401, E402
|
||||
|
||||
|
||||
@dataclass
|
||||
|
@ -24,49 +24,8 @@ from ...utils import logging
|
||||
|
||||
logger = logging.get_logger(__name__)
|
||||
|
||||
BERT_PRETRAINED_CONFIG_ARCHIVE_MAP = {
|
||||
"google-bert/bert-base-uncased": "https://huggingface.co/google-bert/bert-base-uncased/resolve/main/config.json",
|
||||
"google-bert/bert-large-uncased": "https://huggingface.co/google-bert/bert-large-uncased/resolve/main/config.json",
|
||||
"google-bert/bert-base-cased": "https://huggingface.co/google-bert/bert-base-cased/resolve/main/config.json",
|
||||
"google-bert/bert-large-cased": "https://huggingface.co/google-bert/bert-large-cased/resolve/main/config.json",
|
||||
"google-bert/bert-base-multilingual-uncased": "https://huggingface.co/google-bert/bert-base-multilingual-uncased/resolve/main/config.json",
|
||||
"google-bert/bert-base-multilingual-cased": "https://huggingface.co/google-bert/bert-base-multilingual-cased/resolve/main/config.json",
|
||||
"google-bert/bert-base-chinese": "https://huggingface.co/google-bert/bert-base-chinese/resolve/main/config.json",
|
||||
"google-bert/bert-base-german-cased": "https://huggingface.co/google-bert/bert-base-german-cased/resolve/main/config.json",
|
||||
"google-bert/bert-large-uncased-whole-word-masking": (
|
||||
"https://huggingface.co/google-bert/bert-large-uncased-whole-word-masking/resolve/main/config.json"
|
||||
),
|
||||
"google-bert/bert-large-cased-whole-word-masking": (
|
||||
"https://huggingface.co/google-bert/bert-large-cased-whole-word-masking/resolve/main/config.json"
|
||||
),
|
||||
"google-bert/bert-large-uncased-whole-word-masking-finetuned-squad": (
|
||||
"https://huggingface.co/google-bert/bert-large-uncased-whole-word-masking-finetuned-squad/resolve/main/config.json"
|
||||
),
|
||||
"google-bert/bert-large-cased-whole-word-masking-finetuned-squad": (
|
||||
"https://huggingface.co/google-bert/bert-large-cased-whole-word-masking-finetuned-squad/resolve/main/config.json"
|
||||
),
|
||||
"google-bert/bert-base-cased-finetuned-mrpc": "https://huggingface.co/google-bert/bert-base-cased-finetuned-mrpc/resolve/main/config.json",
|
||||
"google-bert/bert-base-german-dbmdz-cased": "https://huggingface.co/google-bert/bert-base-german-dbmdz-cased/resolve/main/config.json",
|
||||
"google-bert/bert-base-german-dbmdz-uncased": "https://huggingface.co/google-bert/bert-base-german-dbmdz-uncased/resolve/main/config.json",
|
||||
"cl-tohoku/bert-base-japanese": "https://huggingface.co/cl-tohoku/bert-base-japanese/resolve/main/config.json",
|
||||
"cl-tohoku/bert-base-japanese-whole-word-masking": (
|
||||
"https://huggingface.co/cl-tohoku/bert-base-japanese-whole-word-masking/resolve/main/config.json"
|
||||
),
|
||||
"cl-tohoku/bert-base-japanese-char": (
|
||||
"https://huggingface.co/cl-tohoku/bert-base-japanese-char/resolve/main/config.json"
|
||||
),
|
||||
"cl-tohoku/bert-base-japanese-char-whole-word-masking": (
|
||||
"https://huggingface.co/cl-tohoku/bert-base-japanese-char-whole-word-masking/resolve/main/config.json"
|
||||
),
|
||||
"TurkuNLP/bert-base-finnish-cased-v1": (
|
||||
"https://huggingface.co/TurkuNLP/bert-base-finnish-cased-v1/resolve/main/config.json"
|
||||
),
|
||||
"TurkuNLP/bert-base-finnish-uncased-v1": (
|
||||
"https://huggingface.co/TurkuNLP/bert-base-finnish-uncased-v1/resolve/main/config.json"
|
||||
),
|
||||
"wietsedv/bert-base-dutch-cased": "https://huggingface.co/wietsedv/bert-base-dutch-cased/resolve/main/config.json",
|
||||
# See all BERT models at https://huggingface.co/models?filter=bert
|
||||
}
|
||||
|
||||
from ..deprecated._archive_maps import BERT_PRETRAINED_CONFIG_ARCHIVE_MAP # noqa: F401, E402
|
||||
|
||||
|
||||
class BertConfig(PretrainedConfig):
|
||||
|
@ -77,31 +77,7 @@ _SEQ_CLASS_EXPECTED_OUTPUT = "'LABEL_1'"
|
||||
_SEQ_CLASS_EXPECTED_LOSS = 0.01
|
||||
|
||||
|
||||
BERT_PRETRAINED_MODEL_ARCHIVE_LIST = [
|
||||
"google-bert/bert-base-uncased",
|
||||
"google-bert/bert-large-uncased",
|
||||
"google-bert/bert-base-cased",
|
||||
"google-bert/bert-large-cased",
|
||||
"google-bert/bert-base-multilingual-uncased",
|
||||
"google-bert/bert-base-multilingual-cased",
|
||||
"google-bert/bert-base-chinese",
|
||||
"google-bert/bert-base-german-cased",
|
||||
"google-bert/bert-large-uncased-whole-word-masking",
|
||||
"google-bert/bert-large-cased-whole-word-masking",
|
||||
"google-bert/bert-large-uncased-whole-word-masking-finetuned-squad",
|
||||
"google-bert/bert-large-cased-whole-word-masking-finetuned-squad",
|
||||
"google-bert/bert-base-cased-finetuned-mrpc",
|
||||
"google-bert/bert-base-german-dbmdz-cased",
|
||||
"google-bert/bert-base-german-dbmdz-uncased",
|
||||
"cl-tohoku/bert-base-japanese",
|
||||
"cl-tohoku/bert-base-japanese-whole-word-masking",
|
||||
"cl-tohoku/bert-base-japanese-char",
|
||||
"cl-tohoku/bert-base-japanese-char-whole-word-masking",
|
||||
"TurkuNLP/bert-base-finnish-cased-v1",
|
||||
"TurkuNLP/bert-base-finnish-uncased-v1",
|
||||
"wietsedv/bert-base-dutch-cased",
|
||||
# See all BERT models at https://huggingface.co/models?filter=bert
|
||||
]
|
||||
from ..deprecated._archive_maps import BERT_PRETRAINED_MODEL_ARCHIVE_LIST # noqa: F401, E402
|
||||
|
||||
|
||||
def load_tf_weights_in_bert(model, config, tf_checkpoint_path):
|
||||
|
@ -89,29 +89,8 @@ _CHECKPOINT_FOR_SEQUENCE_CLASSIFICATION = "ydshieh/bert-base-uncased-yelp-polari
|
||||
_SEQ_CLASS_EXPECTED_OUTPUT = "'LABEL_1'"
|
||||
_SEQ_CLASS_EXPECTED_LOSS = 0.01
|
||||
|
||||
TF_BERT_PRETRAINED_MODEL_ARCHIVE_LIST = [
|
||||
"google-bert/bert-base-uncased",
|
||||
"google-bert/bert-large-uncased",
|
||||
"google-bert/bert-base-cased",
|
||||
"google-bert/bert-large-cased",
|
||||
"google-bert/bert-base-multilingual-uncased",
|
||||
"google-bert/bert-base-multilingual-cased",
|
||||
"google-bert/bert-base-chinese",
|
||||
"google-bert/bert-base-german-cased",
|
||||
"google-bert/bert-large-uncased-whole-word-masking",
|
||||
"google-bert/bert-large-cased-whole-word-masking",
|
||||
"google-bert/bert-large-uncased-whole-word-masking-finetuned-squad",
|
||||
"google-bert/bert-large-cased-whole-word-masking-finetuned-squad",
|
||||
"google-bert/bert-base-cased-finetuned-mrpc",
|
||||
"cl-tohoku/bert-base-japanese",
|
||||
"cl-tohoku/bert-base-japanese-whole-word-masking",
|
||||
"cl-tohoku/bert-base-japanese-char",
|
||||
"cl-tohoku/bert-base-japanese-char-whole-word-masking",
|
||||
"TurkuNLP/bert-base-finnish-cased-v1",
|
||||
"TurkuNLP/bert-base-finnish-uncased-v1",
|
||||
"wietsedv/bert-base-dutch-cased",
|
||||
# See all BERT models at https://huggingface.co/models?filter=bert
|
||||
]
|
||||
|
||||
from ..deprecated._archive_maps import TF_BERT_PRETRAINED_MODEL_ARCHIVE_LIST # noqa: F401, E402
|
||||
|
||||
|
||||
class TFBertPreTrainingLoss:
|
||||
|
@ -28,91 +28,6 @@ logger = logging.get_logger(__name__)
|
||||
|
||||
VOCAB_FILES_NAMES = {"vocab_file": "vocab.txt"}
|
||||
|
||||
PRETRAINED_VOCAB_FILES_MAP = {
|
||||
"vocab_file": {
|
||||
"google-bert/bert-base-uncased": "https://huggingface.co/google-bert/bert-base-uncased/resolve/main/vocab.txt",
|
||||
"google-bert/bert-large-uncased": "https://huggingface.co/google-bert/bert-large-uncased/resolve/main/vocab.txt",
|
||||
"google-bert/bert-base-cased": "https://huggingface.co/google-bert/bert-base-cased/resolve/main/vocab.txt",
|
||||
"google-bert/bert-large-cased": "https://huggingface.co/google-bert/bert-large-cased/resolve/main/vocab.txt",
|
||||
"google-bert/bert-base-multilingual-uncased": (
|
||||
"https://huggingface.co/google-bert/bert-base-multilingual-uncased/resolve/main/vocab.txt"
|
||||
),
|
||||
"google-bert/bert-base-multilingual-cased": "https://huggingface.co/google-bert/bert-base-multilingual-cased/resolve/main/vocab.txt",
|
||||
"google-bert/bert-base-chinese": "https://huggingface.co/google-bert/bert-base-chinese/resolve/main/vocab.txt",
|
||||
"google-bert/bert-base-german-cased": "https://huggingface.co/google-bert/bert-base-german-cased/resolve/main/vocab.txt",
|
||||
"google-bert/bert-large-uncased-whole-word-masking": (
|
||||
"https://huggingface.co/google-bert/bert-large-uncased-whole-word-masking/resolve/main/vocab.txt"
|
||||
),
|
||||
"google-bert/bert-large-cased-whole-word-masking": (
|
||||
"https://huggingface.co/google-bert/bert-large-cased-whole-word-masking/resolve/main/vocab.txt"
|
||||
),
|
||||
"google-bert/bert-large-uncased-whole-word-masking-finetuned-squad": (
|
||||
"https://huggingface.co/google-bert/bert-large-uncased-whole-word-masking-finetuned-squad/resolve/main/vocab.txt"
|
||||
),
|
||||
"google-bert/bert-large-cased-whole-word-masking-finetuned-squad": (
|
||||
"https://huggingface.co/google-bert/bert-large-cased-whole-word-masking-finetuned-squad/resolve/main/vocab.txt"
|
||||
),
|
||||
"google-bert/bert-base-cased-finetuned-mrpc": (
|
||||
"https://huggingface.co/google-bert/bert-base-cased-finetuned-mrpc/resolve/main/vocab.txt"
|
||||
),
|
||||
"google-bert/bert-base-german-dbmdz-cased": "https://huggingface.co/google-bert/bert-base-german-dbmdz-cased/resolve/main/vocab.txt",
|
||||
"google-bert/bert-base-german-dbmdz-uncased": (
|
||||
"https://huggingface.co/google-bert/bert-base-german-dbmdz-uncased/resolve/main/vocab.txt"
|
||||
),
|
||||
"TurkuNLP/bert-base-finnish-cased-v1": (
|
||||
"https://huggingface.co/TurkuNLP/bert-base-finnish-cased-v1/resolve/main/vocab.txt"
|
||||
),
|
||||
"TurkuNLP/bert-base-finnish-uncased-v1": (
|
||||
"https://huggingface.co/TurkuNLP/bert-base-finnish-uncased-v1/resolve/main/vocab.txt"
|
||||
),
|
||||
"wietsedv/bert-base-dutch-cased": (
|
||||
"https://huggingface.co/wietsedv/bert-base-dutch-cased/resolve/main/vocab.txt"
|
||||
),
|
||||
}
|
||||
}
|
||||
|
||||
PRETRAINED_POSITIONAL_EMBEDDINGS_SIZES = {
|
||||
"google-bert/bert-base-uncased": 512,
|
||||
"google-bert/bert-large-uncased": 512,
|
||||
"google-bert/bert-base-cased": 512,
|
||||
"google-bert/bert-large-cased": 512,
|
||||
"google-bert/bert-base-multilingual-uncased": 512,
|
||||
"google-bert/bert-base-multilingual-cased": 512,
|
||||
"google-bert/bert-base-chinese": 512,
|
||||
"google-bert/bert-base-german-cased": 512,
|
||||
"google-bert/bert-large-uncased-whole-word-masking": 512,
|
||||
"google-bert/bert-large-cased-whole-word-masking": 512,
|
||||
"google-bert/bert-large-uncased-whole-word-masking-finetuned-squad": 512,
|
||||
"google-bert/bert-large-cased-whole-word-masking-finetuned-squad": 512,
|
||||
"google-bert/bert-base-cased-finetuned-mrpc": 512,
|
||||
"google-bert/bert-base-german-dbmdz-cased": 512,
|
||||
"google-bert/bert-base-german-dbmdz-uncased": 512,
|
||||
"TurkuNLP/bert-base-finnish-cased-v1": 512,
|
||||
"TurkuNLP/bert-base-finnish-uncased-v1": 512,
|
||||
"wietsedv/bert-base-dutch-cased": 512,
|
||||
}
|
||||
|
||||
PRETRAINED_INIT_CONFIGURATION = {
|
||||
"google-bert/bert-base-uncased": {"do_lower_case": True},
|
||||
"google-bert/bert-large-uncased": {"do_lower_case": True},
|
||||
"google-bert/bert-base-cased": {"do_lower_case": False},
|
||||
"google-bert/bert-large-cased": {"do_lower_case": False},
|
||||
"google-bert/bert-base-multilingual-uncased": {"do_lower_case": True},
|
||||
"google-bert/bert-base-multilingual-cased": {"do_lower_case": False},
|
||||
"google-bert/bert-base-chinese": {"do_lower_case": False},
|
||||
"google-bert/bert-base-german-cased": {"do_lower_case": False},
|
||||
"google-bert/bert-large-uncased-whole-word-masking": {"do_lower_case": True},
|
||||
"google-bert/bert-large-cased-whole-word-masking": {"do_lower_case": False},
|
||||
"google-bert/bert-large-uncased-whole-word-masking-finetuned-squad": {"do_lower_case": True},
|
||||
"google-bert/bert-large-cased-whole-word-masking-finetuned-squad": {"do_lower_case": False},
|
||||
"google-bert/bert-base-cased-finetuned-mrpc": {"do_lower_case": False},
|
||||
"google-bert/bert-base-german-dbmdz-cased": {"do_lower_case": False},
|
||||
"google-bert/bert-base-german-dbmdz-uncased": {"do_lower_case": True},
|
||||
"TurkuNLP/bert-base-finnish-cased-v1": {"do_lower_case": False},
|
||||
"TurkuNLP/bert-base-finnish-uncased-v1": {"do_lower_case": True},
|
||||
"wietsedv/bert-base-dutch-cased": {"do_lower_case": False},
|
||||
}
|
||||
|
||||
|
||||
def load_vocab(vocab_file):
|
||||
"""Loads a vocabulary file into a dictionary."""
|
||||
@ -177,9 +92,6 @@ class BertTokenizer(PreTrainedTokenizer):
|
||||
"""
|
||||
|
||||
vocab_files_names = VOCAB_FILES_NAMES
|
||||
pretrained_vocab_files_map = PRETRAINED_VOCAB_FILES_MAP
|
||||
pretrained_init_configuration = PRETRAINED_INIT_CONFIGURATION
|
||||
max_model_input_sizes = PRETRAINED_POSITIONAL_EMBEDDINGS_SIZES
|
||||
|
||||
def __init__(
|
||||
self,
|
||||
|
@ -28,135 +28,6 @@ logger = logging.get_logger(__name__)
|
||||
|
||||
VOCAB_FILES_NAMES = {"vocab_file": "vocab.txt", "tokenizer_file": "tokenizer.json"}
|
||||
|
||||
PRETRAINED_VOCAB_FILES_MAP = {
|
||||
"vocab_file": {
|
||||
"google-bert/bert-base-uncased": "https://huggingface.co/google-bert/bert-base-uncased/resolve/main/vocab.txt",
|
||||
"google-bert/bert-large-uncased": "https://huggingface.co/google-bert/bert-large-uncased/resolve/main/vocab.txt",
|
||||
"google-bert/bert-base-cased": "https://huggingface.co/google-bert/bert-base-cased/resolve/main/vocab.txt",
|
||||
"google-bert/bert-large-cased": "https://huggingface.co/google-bert/bert-large-cased/resolve/main/vocab.txt",
|
||||
"google-bert/bert-base-multilingual-uncased": (
|
||||
"https://huggingface.co/google-bert/bert-base-multilingual-uncased/resolve/main/vocab.txt"
|
||||
),
|
||||
"google-bert/bert-base-multilingual-cased": "https://huggingface.co/google-bert/bert-base-multilingual-cased/resolve/main/vocab.txt",
|
||||
"google-bert/bert-base-chinese": "https://huggingface.co/google-bert/bert-base-chinese/resolve/main/vocab.txt",
|
||||
"google-bert/bert-base-german-cased": "https://huggingface.co/google-bert/bert-base-german-cased/resolve/main/vocab.txt",
|
||||
"google-bert/bert-large-uncased-whole-word-masking": (
|
||||
"https://huggingface.co/google-bert/bert-large-uncased-whole-word-masking/resolve/main/vocab.txt"
|
||||
),
|
||||
"google-bert/bert-large-cased-whole-word-masking": (
|
||||
"https://huggingface.co/google-bert/bert-large-cased-whole-word-masking/resolve/main/vocab.txt"
|
||||
),
|
||||
"google-bert/bert-large-uncased-whole-word-masking-finetuned-squad": (
|
||||
"https://huggingface.co/google-bert/bert-large-uncased-whole-word-masking-finetuned-squad/resolve/main/vocab.txt"
|
||||
),
|
||||
"google-bert/bert-large-cased-whole-word-masking-finetuned-squad": (
|
||||
"https://huggingface.co/google-bert/bert-large-cased-whole-word-masking-finetuned-squad/resolve/main/vocab.txt"
|
||||
),
|
||||
"google-bert/bert-base-cased-finetuned-mrpc": (
|
||||
"https://huggingface.co/google-bert/bert-base-cased-finetuned-mrpc/resolve/main/vocab.txt"
|
||||
),
|
||||
"google-bert/bert-base-german-dbmdz-cased": "https://huggingface.co/google-bert/bert-base-german-dbmdz-cased/resolve/main/vocab.txt",
|
||||
"google-bert/bert-base-german-dbmdz-uncased": (
|
||||
"https://huggingface.co/google-bert/bert-base-german-dbmdz-uncased/resolve/main/vocab.txt"
|
||||
),
|
||||
"TurkuNLP/bert-base-finnish-cased-v1": (
|
||||
"https://huggingface.co/TurkuNLP/bert-base-finnish-cased-v1/resolve/main/vocab.txt"
|
||||
),
|
||||
"TurkuNLP/bert-base-finnish-uncased-v1": (
|
||||
"https://huggingface.co/TurkuNLP/bert-base-finnish-uncased-v1/resolve/main/vocab.txt"
|
||||
),
|
||||
"wietsedv/bert-base-dutch-cased": (
|
||||
"https://huggingface.co/wietsedv/bert-base-dutch-cased/resolve/main/vocab.txt"
|
||||
),
|
||||
},
|
||||
"tokenizer_file": {
|
||||
"google-bert/bert-base-uncased": "https://huggingface.co/google-bert/bert-base-uncased/resolve/main/tokenizer.json",
|
||||
"google-bert/bert-large-uncased": "https://huggingface.co/google-bert/bert-large-uncased/resolve/main/tokenizer.json",
|
||||
"google-bert/bert-base-cased": "https://huggingface.co/google-bert/bert-base-cased/resolve/main/tokenizer.json",
|
||||
"google-bert/bert-large-cased": "https://huggingface.co/google-bert/bert-large-cased/resolve/main/tokenizer.json",
|
||||
"google-bert/bert-base-multilingual-uncased": (
|
||||
"https://huggingface.co/google-bert/bert-base-multilingual-uncased/resolve/main/tokenizer.json"
|
||||
),
|
||||
"google-bert/bert-base-multilingual-cased": (
|
||||
"https://huggingface.co/google-bert/bert-base-multilingual-cased/resolve/main/tokenizer.json"
|
||||
),
|
||||
"google-bert/bert-base-chinese": "https://huggingface.co/google-bert/bert-base-chinese/resolve/main/tokenizer.json",
|
||||
"google-bert/bert-base-german-cased": "https://huggingface.co/google-bert/bert-base-german-cased/resolve/main/tokenizer.json",
|
||||
"google-bert/bert-large-uncased-whole-word-masking": (
|
||||
"https://huggingface.co/google-bert/bert-large-uncased-whole-word-masking/resolve/main/tokenizer.json"
|
||||
),
|
||||
"google-bert/bert-large-cased-whole-word-masking": (
|
||||
"https://huggingface.co/google-bert/bert-large-cased-whole-word-masking/resolve/main/tokenizer.json"
|
||||
),
|
||||
"google-bert/bert-large-uncased-whole-word-masking-finetuned-squad": (
|
||||
"https://huggingface.co/google-bert/bert-large-uncased-whole-word-masking-finetuned-squad/resolve/main/tokenizer.json"
|
||||
),
|
||||
"google-bert/bert-large-cased-whole-word-masking-finetuned-squad": (
|
||||
"https://huggingface.co/google-bert/bert-large-cased-whole-word-masking-finetuned-squad/resolve/main/tokenizer.json"
|
||||
),
|
||||
"google-bert/bert-base-cased-finetuned-mrpc": (
|
||||
"https://huggingface.co/google-bert/bert-base-cased-finetuned-mrpc/resolve/main/tokenizer.json"
|
||||
),
|
||||
"google-bert/bert-base-german-dbmdz-cased": (
|
||||
"https://huggingface.co/google-bert/bert-base-german-dbmdz-cased/resolve/main/tokenizer.json"
|
||||
),
|
||||
"google-bert/bert-base-german-dbmdz-uncased": (
|
||||
"https://huggingface.co/google-bert/bert-base-german-dbmdz-uncased/resolve/main/tokenizer.json"
|
||||
),
|
||||
"TurkuNLP/bert-base-finnish-cased-v1": (
|
||||
"https://huggingface.co/TurkuNLP/bert-base-finnish-cased-v1/resolve/main/tokenizer.json"
|
||||
),
|
||||
"TurkuNLP/bert-base-finnish-uncased-v1": (
|
||||
"https://huggingface.co/TurkuNLP/bert-base-finnish-uncased-v1/resolve/main/tokenizer.json"
|
||||
),
|
||||
"wietsedv/bert-base-dutch-cased": (
|
||||
"https://huggingface.co/wietsedv/bert-base-dutch-cased/resolve/main/tokenizer.json"
|
||||
),
|
||||
},
|
||||
}
|
||||
|
||||
PRETRAINED_POSITIONAL_EMBEDDINGS_SIZES = {
|
||||
"google-bert/bert-base-uncased": 512,
|
||||
"google-bert/bert-large-uncased": 512,
|
||||
"google-bert/bert-base-cased": 512,
|
||||
"google-bert/bert-large-cased": 512,
|
||||
"google-bert/bert-base-multilingual-uncased": 512,
|
||||
"google-bert/bert-base-multilingual-cased": 512,
|
||||
"google-bert/bert-base-chinese": 512,
|
||||
"google-bert/bert-base-german-cased": 512,
|
||||
"google-bert/bert-large-uncased-whole-word-masking": 512,
|
||||
"google-bert/bert-large-cased-whole-word-masking": 512,
|
||||
"google-bert/bert-large-uncased-whole-word-masking-finetuned-squad": 512,
|
||||
"google-bert/bert-large-cased-whole-word-masking-finetuned-squad": 512,
|
||||
"google-bert/bert-base-cased-finetuned-mrpc": 512,
|
||||
"google-bert/bert-base-german-dbmdz-cased": 512,
|
||||
"google-bert/bert-base-german-dbmdz-uncased": 512,
|
||||
"TurkuNLP/bert-base-finnish-cased-v1": 512,
|
||||
"TurkuNLP/bert-base-finnish-uncased-v1": 512,
|
||||
"wietsedv/bert-base-dutch-cased": 512,
|
||||
}
|
||||
|
||||
PRETRAINED_INIT_CONFIGURATION = {
|
||||
"google-bert/bert-base-uncased": {"do_lower_case": True},
|
||||
"google-bert/bert-large-uncased": {"do_lower_case": True},
|
||||
"google-bert/bert-base-cased": {"do_lower_case": False},
|
||||
"google-bert/bert-large-cased": {"do_lower_case": False},
|
||||
"google-bert/bert-base-multilingual-uncased": {"do_lower_case": True},
|
||||
"google-bert/bert-base-multilingual-cased": {"do_lower_case": False},
|
||||
"google-bert/bert-base-chinese": {"do_lower_case": False},
|
||||
"google-bert/bert-base-german-cased": {"do_lower_case": False},
|
||||
"google-bert/bert-large-uncased-whole-word-masking": {"do_lower_case": True},
|
||||
"google-bert/bert-large-cased-whole-word-masking": {"do_lower_case": False},
|
||||
"google-bert/bert-large-uncased-whole-word-masking-finetuned-squad": {"do_lower_case": True},
|
||||
"google-bert/bert-large-cased-whole-word-masking-finetuned-squad": {"do_lower_case": False},
|
||||
"google-bert/bert-base-cased-finetuned-mrpc": {"do_lower_case": False},
|
||||
"google-bert/bert-base-german-dbmdz-cased": {"do_lower_case": False},
|
||||
"google-bert/bert-base-german-dbmdz-uncased": {"do_lower_case": True},
|
||||
"TurkuNLP/bert-base-finnish-cased-v1": {"do_lower_case": False},
|
||||
"TurkuNLP/bert-base-finnish-uncased-v1": {"do_lower_case": True},
|
||||
"wietsedv/bert-base-dutch-cased": {"do_lower_case": False},
|
||||
}
|
||||
|
||||
|
||||
class BertTokenizerFast(PreTrainedTokenizerFast):
|
||||
r"""
|
||||
@ -199,9 +70,6 @@ class BertTokenizerFast(PreTrainedTokenizerFast):
|
||||
"""
|
||||
|
||||
vocab_files_names = VOCAB_FILES_NAMES
|
||||
pretrained_vocab_files_map = PRETRAINED_VOCAB_FILES_MAP
|
||||
pretrained_init_configuration = PRETRAINED_INIT_CONFIGURATION
|
||||
max_model_input_sizes = PRETRAINED_POSITIONAL_EMBEDDINGS_SIZES
|
||||
slow_tokenizer_class = BertTokenizer
|
||||
|
||||
def __init__(
|
||||
|
@ -29,16 +29,6 @@ logger = logging.get_logger(__name__)
|
||||
|
||||
VOCAB_FILES_NAMES = {"vocab_file": "spiece.model"}
|
||||
|
||||
PRETRAINED_VOCAB_FILES_MAP = {
|
||||
"vocab_file": {
|
||||
"bert_for_seq_generation": (
|
||||
"https://huggingface.co/google/bert_for_seq_generation_L-24_bbc_encoder/resolve/main/spiece.model"
|
||||
),
|
||||
}
|
||||
}
|
||||
|
||||
PRETRAINED_POSITIONAL_EMBEDDINGS_SIZES = {"bert_for_seq_generation": 512}
|
||||
|
||||
|
||||
class BertGenerationTokenizer(PreTrainedTokenizer):
|
||||
"""
|
||||
@ -82,8 +72,6 @@ class BertGenerationTokenizer(PreTrainedTokenizer):
|
||||
"""
|
||||
|
||||
vocab_files_names = VOCAB_FILES_NAMES
|
||||
pretrained_vocab_files_map = PRETRAINED_VOCAB_FILES_MAP
|
||||
max_model_input_sizes = PRETRAINED_POSITIONAL_EMBEDDINGS_SIZES
|
||||
prefix_tokens: List[int] = []
|
||||
model_input_names = ["input_ids", "attention_mask"]
|
||||
|
||||
|
@ -36,51 +36,6 @@ VOCAB_FILES_NAMES = {"vocab_file": "vocab.txt", "spm_file": "spiece.model"}
|
||||
|
||||
SPIECE_UNDERLINE = "▁"
|
||||
|
||||
PRETRAINED_VOCAB_FILES_MAP = {
|
||||
"vocab_file": {
|
||||
"cl-tohoku/bert-base-japanese": "https://huggingface.co/cl-tohoku/bert-base-japanese/resolve/main/vocab.txt",
|
||||
"cl-tohoku/bert-base-japanese-whole-word-masking": (
|
||||
"https://huggingface.co/cl-tohoku/bert-base-japanese-whole-word-masking/resolve/main/vocab.txt"
|
||||
),
|
||||
"cl-tohoku/bert-base-japanese-char": (
|
||||
"https://huggingface.co/cl-tohoku/bert-base-japanese-char/resolve/main/vocab.txt"
|
||||
),
|
||||
"cl-tohoku/bert-base-japanese-char-whole-word-masking": (
|
||||
"https://huggingface.co/cl-tohoku/bert-base-japanese-char-whole-word-masking/resolve/main/vocab.txt"
|
||||
),
|
||||
}
|
||||
}
|
||||
|
||||
PRETRAINED_POSITIONAL_EMBEDDINGS_SIZES = {
|
||||
"cl-tohoku/bert-base-japanese": 512,
|
||||
"cl-tohoku/bert-base-japanese-whole-word-masking": 512,
|
||||
"cl-tohoku/bert-base-japanese-char": 512,
|
||||
"cl-tohoku/bert-base-japanese-char-whole-word-masking": 512,
|
||||
}
|
||||
|
||||
PRETRAINED_INIT_CONFIGURATION = {
|
||||
"cl-tohoku/bert-base-japanese": {
|
||||
"do_lower_case": False,
|
||||
"word_tokenizer_type": "mecab",
|
||||
"subword_tokenizer_type": "wordpiece",
|
||||
},
|
||||
"cl-tohoku/bert-base-japanese-whole-word-masking": {
|
||||
"do_lower_case": False,
|
||||
"word_tokenizer_type": "mecab",
|
||||
"subword_tokenizer_type": "wordpiece",
|
||||
},
|
||||
"cl-tohoku/bert-base-japanese-char": {
|
||||
"do_lower_case": False,
|
||||
"word_tokenizer_type": "mecab",
|
||||
"subword_tokenizer_type": "character",
|
||||
},
|
||||
"cl-tohoku/bert-base-japanese-char-whole-word-masking": {
|
||||
"do_lower_case": False,
|
||||
"word_tokenizer_type": "mecab",
|
||||
"subword_tokenizer_type": "character",
|
||||
},
|
||||
}
|
||||
|
||||
|
||||
# Copied from transformers.models.bert.tokenization_bert.load_vocab
|
||||
def load_vocab(vocab_file):
|
||||
@ -136,9 +91,6 @@ class BertJapaneseTokenizer(PreTrainedTokenizer):
|
||||
"""
|
||||
|
||||
vocab_files_names = VOCAB_FILES_NAMES
|
||||
pretrained_vocab_files_map = PRETRAINED_VOCAB_FILES_MAP
|
||||
pretrained_init_configuration = PRETRAINED_INIT_CONFIGURATION
|
||||
max_model_input_sizes = PRETRAINED_POSITIONAL_EMBEDDINGS_SIZES
|
||||
|
||||
def __init__(
|
||||
self,
|
||||
|
@ -35,19 +35,6 @@ VOCAB_FILES_NAMES = {
|
||||
"merges_file": "bpe.codes",
|
||||
}
|
||||
|
||||
PRETRAINED_VOCAB_FILES_MAP = {
|
||||
"vocab_file": {
|
||||
"vinai/bertweet-base": "https://huggingface.co/vinai/bertweet-base/resolve/main/vocab.txt",
|
||||
},
|
||||
"merges_file": {
|
||||
"vinai/bertweet-base": "https://huggingface.co/vinai/bertweet-base/resolve/main/bpe.codes",
|
||||
},
|
||||
}
|
||||
|
||||
PRETRAINED_POSITIONAL_EMBEDDINGS_SIZES = {
|
||||
"vinai/bertweet-base": 128,
|
||||
}
|
||||
|
||||
|
||||
def get_pairs(word):
|
||||
"""
|
||||
@ -117,8 +104,6 @@ class BertweetTokenizer(PreTrainedTokenizer):
|
||||
"""
|
||||
|
||||
vocab_files_names = VOCAB_FILES_NAMES
|
||||
pretrained_vocab_files_map = PRETRAINED_VOCAB_FILES_MAP
|
||||
max_model_input_sizes = PRETRAINED_POSITIONAL_EMBEDDINGS_SIZES
|
||||
|
||||
def __init__(
|
||||
self,
|
||||
|
@ -23,12 +23,8 @@ from ...utils import logging
|
||||
|
||||
logger = logging.get_logger(__name__)
|
||||
|
||||
BIG_BIRD_PRETRAINED_CONFIG_ARCHIVE_MAP = {
|
||||
"google/bigbird-roberta-base": "https://huggingface.co/google/bigbird-roberta-base/resolve/main/config.json",
|
||||
"google/bigbird-roberta-large": "https://huggingface.co/google/bigbird-roberta-large/resolve/main/config.json",
|
||||
"google/bigbird-base-trivia-itc": "https://huggingface.co/google/bigbird-base-trivia-itc/resolve/main/config.json",
|
||||
# See all BigBird models at https://huggingface.co/models?filter=big_bird
|
||||
}
|
||||
|
||||
from ..deprecated._archive_maps import BIG_BIRD_PRETRAINED_CONFIG_ARCHIVE_MAP # noqa: F401, E402
|
||||
|
||||
|
||||
class BigBirdConfig(PretrainedConfig):
|
||||
|
@ -54,12 +54,9 @@ logger = logging.get_logger(__name__)
|
||||
_CHECKPOINT_FOR_DOC = "google/bigbird-roberta-base"
|
||||
_CONFIG_FOR_DOC = "BigBirdConfig"
|
||||
|
||||
BIG_BIRD_PRETRAINED_MODEL_ARCHIVE_LIST = [
|
||||
"google/bigbird-roberta-base",
|
||||
"google/bigbird-roberta-large",
|
||||
"google/bigbird-base-trivia-itc",
|
||||
# See all BigBird models at https://huggingface.co/models?filter=big_bird
|
||||
]
|
||||
|
||||
from ..deprecated._archive_maps import BIG_BIRD_PRETRAINED_MODEL_ARCHIVE_LIST # noqa: F401, E402
|
||||
|
||||
|
||||
_TRIVIA_QA_MAPPING = {
|
||||
"big_bird_attention": "attention/self",
|
||||
|
@ -30,24 +30,6 @@ logger = logging.get_logger(__name__)
|
||||
|
||||
VOCAB_FILES_NAMES = {"vocab_file": "spiece.model"}
|
||||
|
||||
PRETRAINED_VOCAB_FILES_MAP = {
|
||||
"vocab_file": {
|
||||
"google/bigbird-roberta-base": "https://huggingface.co/google/bigbird-roberta-base/resolve/main/spiece.model",
|
||||
"google/bigbird-roberta-large": (
|
||||
"https://huggingface.co/google/bigbird-roberta-large/resolve/main/spiece.model"
|
||||
),
|
||||
"google/bigbird-base-trivia-itc": (
|
||||
"https://huggingface.co/google/bigbird-base-trivia-itc/resolve/main/spiece.model"
|
||||
),
|
||||
}
|
||||
}
|
||||
|
||||
PRETRAINED_POSITIONAL_EMBEDDINGS_SIZES = {
|
||||
"google/bigbird-roberta-base": 4096,
|
||||
"google/bigbird-roberta-large": 4096,
|
||||
"google/bigbird-base-trivia-itc": 4096,
|
||||
}
|
||||
|
||||
|
||||
class BigBirdTokenizer(PreTrainedTokenizer):
|
||||
"""
|
||||
@ -97,8 +79,6 @@ class BigBirdTokenizer(PreTrainedTokenizer):
|
||||
"""
|
||||
|
||||
vocab_files_names = VOCAB_FILES_NAMES
|
||||
pretrained_vocab_files_map = PRETRAINED_VOCAB_FILES_MAP
|
||||
max_model_input_sizes = PRETRAINED_POSITIONAL_EMBEDDINGS_SIZES
|
||||
model_input_names = ["input_ids", "attention_mask"]
|
||||
prefix_tokens: List[int] = []
|
||||
|
||||
|
@ -32,35 +32,6 @@ else:
|
||||
logger = logging.get_logger(__name__)
|
||||
VOCAB_FILES_NAMES = {"vocab_file": "spiece.model", "tokenizer_file": "tokenizer.json"}
|
||||
|
||||
PRETRAINED_VOCAB_FILES_MAP = {
|
||||
"vocab_file": {
|
||||
"google/bigbird-roberta-base": "https://huggingface.co/google/bigbird-roberta-base/resolve/main/spiece.model",
|
||||
"google/bigbird-roberta-large": (
|
||||
"https://huggingface.co/google/bigbird-roberta-large/resolve/main/spiece.model"
|
||||
),
|
||||
"google/bigbird-base-trivia-itc": (
|
||||
"https://huggingface.co/google/bigbird-base-trivia-itc/resolve/main/spiece.model"
|
||||
),
|
||||
},
|
||||
"tokenizer_file": {
|
||||
"google/bigbird-roberta-base": (
|
||||
"https://huggingface.co/google/bigbird-roberta-base/resolve/main/tokenizer.json"
|
||||
),
|
||||
"google/bigbird-roberta-large": (
|
||||
"https://huggingface.co/google/bigbird-roberta-large/resolve/main/tokenizer.json"
|
||||
),
|
||||
"google/bigbird-base-trivia-itc": (
|
||||
"https://huggingface.co/google/bigbird-base-trivia-itc/resolve/main/tokenizer.json"
|
||||
),
|
||||
},
|
||||
}
|
||||
|
||||
PRETRAINED_POSITIONAL_EMBEDDINGS_SIZES = {
|
||||
"google/bigbird-roberta-base": 4096,
|
||||
"google/bigbird-roberta-large": 4096,
|
||||
"google/bigbird-base-trivia-itc": 4096,
|
||||
}
|
||||
|
||||
|
||||
SPIECE_UNDERLINE = "▁"
|
||||
|
||||
@ -107,8 +78,6 @@ class BigBirdTokenizerFast(PreTrainedTokenizerFast):
|
||||
"""
|
||||
|
||||
vocab_files_names = VOCAB_FILES_NAMES
|
||||
pretrained_vocab_files_map = PRETRAINED_VOCAB_FILES_MAP
|
||||
max_model_input_sizes = PRETRAINED_POSITIONAL_EMBEDDINGS_SIZES
|
||||
slow_tokenizer_class = BigBirdTokenizer
|
||||
model_input_names = ["input_ids", "attention_mask"]
|
||||
prefix_tokens: List[int] = []
|
||||
|
@ -26,18 +26,8 @@ from ...utils import TensorType, is_torch_available, logging
|
||||
|
||||
logger = logging.get_logger(__name__)
|
||||
|
||||
BIGBIRD_PEGASUS_PRETRAINED_CONFIG_ARCHIVE_MAP = {
|
||||
"google/bigbird-pegasus-large-arxiv": (
|
||||
"https://huggingface.co/google/bigbird-pegasus-large-arxiv/resolve/main/config.json"
|
||||
),
|
||||
"google/bigbird-pegasus-large-pubmed": (
|
||||
"https://huggingface.co/google/bigbird-pegasus-large-pubmed/resolve/main/config.json"
|
||||
),
|
||||
"google/bigbird-pegasus-large-bigpatent": (
|
||||
"https://huggingface.co/google/bigbird-pegasus-large-bigpatent/resolve/main/config.json"
|
||||
),
|
||||
# See all BigBirdPegasus models at https://huggingface.co/models?filter=bigbird_pegasus
|
||||
}
|
||||
|
||||
from ..deprecated._archive_maps import BIGBIRD_PEGASUS_PRETRAINED_CONFIG_ARCHIVE_MAP # noqa: F401, E402
|
||||
|
||||
|
||||
class BigBirdPegasusConfig(PretrainedConfig):
|
||||
|
@ -54,12 +54,7 @@ _CONFIG_FOR_DOC = "BigBirdPegasusConfig"
|
||||
_EXPECTED_OUTPUT_SHAPE = [1, 7, 1024]
|
||||
|
||||
|
||||
BIGBIRD_PEGASUS_PRETRAINED_MODEL_ARCHIVE_LIST = [
|
||||
"google/bigbird-pegasus-large-arxiv",
|
||||
"google/bigbird-pegasus-large-pubmed",
|
||||
"google/bigbird-pegasus-large-bigpatent",
|
||||
# See all BigBirdPegasus models at https://huggingface.co/models?filter=bigbird_pegasus
|
||||
]
|
||||
from ..deprecated._archive_maps import BIGBIRD_PEGASUS_PRETRAINED_MODEL_ARCHIVE_LIST # noqa: F401, E402
|
||||
|
||||
|
||||
def shift_tokens_right(input_ids: torch.Tensor, pad_token_id: int, decoder_start_token_id: int):
|
||||
|
@ -20,10 +20,8 @@ from ...utils import logging
|
||||
|
||||
logger = logging.get_logger(__name__)
|
||||
|
||||
BIOGPT_PRETRAINED_CONFIG_ARCHIVE_MAP = {
|
||||
"microsoft/biogpt": "https://huggingface.co/microsoft/biogpt/resolve/main/config.json",
|
||||
# See all BioGPT models at https://huggingface.co/models?filter=biogpt
|
||||
}
|
||||
|
||||
from ..deprecated._archive_maps import BIOGPT_PRETRAINED_CONFIG_ARCHIVE_MAP # noqa: F401, E402
|
||||
|
||||
|
||||
class BioGptConfig(PretrainedConfig):
|
||||
|
@ -47,11 +47,7 @@ _CHECKPOINT_FOR_DOC = "microsoft/biogpt"
|
||||
_CONFIG_FOR_DOC = "BioGptConfig"
|
||||
|
||||
|
||||
BIOGPT_PRETRAINED_MODEL_ARCHIVE_LIST = [
|
||||
"microsoft/biogpt",
|
||||
"microsoft/BioGPT-Large",
|
||||
# See all BioGPT models at https://huggingface.co/models?filter=biogpt
|
||||
]
|
||||
from ..deprecated._archive_maps import BIOGPT_PRETRAINED_MODEL_ARCHIVE_LIST # noqa: F401, E402
|
||||
|
||||
|
||||
# Copied from transformers.models.opt.modeling_opt.OPTLearnedPositionalEmbedding with OPT->BioGpt
|
||||
|
@ -28,17 +28,6 @@ VOCAB_FILES_NAMES = {
|
||||
"merges_file": "merges.txt",
|
||||
}
|
||||
|
||||
PRETRAINED_VOCAB_FILES_MAP = {
|
||||
"vocab_file": {
|
||||
"microsoft/biogpt": "https://huggingface.co/microsoft/biogpt/resolve/main/vocab.json",
|
||||
},
|
||||
"merges_file": {"microsoft/biogpt": "https://huggingface.co/microsoft/biogpt/resolve/main/merges.txt"},
|
||||
}
|
||||
|
||||
PRETRAINED_POSITIONAL_EMBEDDINGS_SIZES = {
|
||||
"microsoft/biogpt": 1024,
|
||||
}
|
||||
|
||||
|
||||
def get_pairs(word):
|
||||
"""
|
||||
@ -97,8 +86,6 @@ class BioGptTokenizer(PreTrainedTokenizer):
|
||||
"""
|
||||
|
||||
vocab_files_names = VOCAB_FILES_NAMES
|
||||
pretrained_vocab_files_map = PRETRAINED_VOCAB_FILES_MAP
|
||||
max_model_input_sizes = PRETRAINED_POSITIONAL_EMBEDDINGS_SIZES
|
||||
model_input_names = ["input_ids", "attention_mask"]
|
||||
|
||||
def __init__(
|
||||
|
@ -21,9 +21,8 @@ from ...utils.backbone_utils import BackboneConfigMixin, get_aligned_output_feat
|
||||
|
||||
logger = logging.get_logger(__name__)
|
||||
|
||||
BIT_PRETRAINED_CONFIG_ARCHIVE_MAP = {
|
||||
"google/bit-50": "https://huggingface.co/google/bit-50/resolve/main/config.json",
|
||||
}
|
||||
|
||||
from ..deprecated._archive_maps import BIT_PRETRAINED_CONFIG_ARCHIVE_MAP # noqa: F401, E402
|
||||
|
||||
|
||||
class BitConfig(BackboneConfigMixin, PretrainedConfig):
|
||||
|
@ -56,10 +56,8 @@ _EXPECTED_OUTPUT_SHAPE = [1, 2048, 7, 7]
|
||||
_IMAGE_CLASS_CHECKPOINT = "google/bit-50"
|
||||
_IMAGE_CLASS_EXPECTED_OUTPUT = "tiger cat"
|
||||
|
||||
BIT_PRETRAINED_MODEL_ARCHIVE_LIST = [
|
||||
"google/bit-50",
|
||||
# See all BiT models at https://huggingface.co/models?filter=bit
|
||||
]
|
||||
|
||||
from ..deprecated._archive_maps import BIT_PRETRAINED_MODEL_ARCHIVE_LIST # noqa: F401, E402
|
||||
|
||||
|
||||
def get_padding_value(padding=None, kernel_size=7, stride=1, dilation=1) -> Tuple[Tuple, bool]:
|
||||
|
@ -27,10 +27,8 @@ from ...utils import logging
|
||||
|
||||
logger = logging.get_logger(__name__)
|
||||
|
||||
BLENDERBOT_PRETRAINED_CONFIG_ARCHIVE_MAP = {
|
||||
"facebook/blenderbot-3B": "https://huggingface.co/facebook/blenderbot-3B/resolve/main/config.json",
|
||||
# See all Blenderbot models at https://huggingface.co/models?filter=blenderbot
|
||||
}
|
||||
|
||||
from ..deprecated._archive_maps import BLENDERBOT_PRETRAINED_CONFIG_ARCHIVE_MAP # noqa: F401, E402
|
||||
|
||||
|
||||
class BlenderbotConfig(PretrainedConfig):
|
||||
|
@ -53,10 +53,7 @@ _CONFIG_FOR_DOC = "BlenderbotConfig"
|
||||
_CHECKPOINT_FOR_DOC = "facebook/blenderbot-400M-distill"
|
||||
|
||||
|
||||
BLENDERBOT_PRETRAINED_MODEL_ARCHIVE_LIST = [
|
||||
"facebook/blenderbot-3B",
|
||||
# See all Blenderbot models at https://huggingface.co/models?filter=blenderbot
|
||||
]
|
||||
from ..deprecated._archive_maps import BLENDERBOT_PRETRAINED_MODEL_ARCHIVE_LIST # noqa: F401, E402
|
||||
|
||||
|
||||
# Copied from transformers.models.bart.modeling_bart.shift_tokens_right
|
||||
|
@ -34,16 +34,6 @@ VOCAB_FILES_NAMES = {
|
||||
"tokenizer_config_file": "tokenizer_config.json",
|
||||
}
|
||||
|
||||
PRETRAINED_VOCAB_FILES_MAP = {
|
||||
"vocab_file": {"facebook/blenderbot-3B": "https://huggingface.co/facebook/blenderbot-3B/resolve/main/vocab.json"},
|
||||
"merges_file": {"facebook/blenderbot-3B": "https://huggingface.co/facebook/blenderbot-3B/resolve/main/merges.txt"},
|
||||
"tokenizer_config_file": {
|
||||
"facebook/blenderbot-3B": "https://huggingface.co/facebook/blenderbot-3B/resolve/main/tokenizer_config.json"
|
||||
},
|
||||
}
|
||||
|
||||
PRETRAINED_POSITIONAL_EMBEDDINGS_SIZES = {"facebook/blenderbot-3B": 128}
|
||||
|
||||
|
||||
@lru_cache()
|
||||
# Copied from transformers.models.roberta.tokenization_roberta.bytes_to_unicode
|
||||
@ -166,8 +156,6 @@ class BlenderbotTokenizer(PreTrainedTokenizer):
|
||||
"""
|
||||
|
||||
vocab_files_names = VOCAB_FILES_NAMES
|
||||
pretrained_vocab_files_map = PRETRAINED_VOCAB_FILES_MAP
|
||||
max_model_input_sizes = PRETRAINED_POSITIONAL_EMBEDDINGS_SIZES
|
||||
model_input_names = ["input_ids", "attention_mask"]
|
||||
|
||||
# Copied from transformers.models.roberta.tokenization_roberta.RobertaTokenizer.__init__ with Roberta->Blenderbot, RoBERTa->Blenderbot
|
||||
|
@ -33,16 +33,6 @@ VOCAB_FILES_NAMES = {
|
||||
"tokenizer_config_file": "tokenizer_config.json",
|
||||
}
|
||||
|
||||
PRETRAINED_VOCAB_FILES_MAP = {
|
||||
"vocab_file": {"facebook/blenderbot-3B": "https://huggingface.co/facebook/blenderbot-3B/resolve/main/vocab.json"},
|
||||
"merges_file": {"facebook/blenderbot-3B": "https://huggingface.co/facebook/blenderbot-3B/resolve/main/merges.txt"},
|
||||
"tokenizer_config_file": {
|
||||
"facebook/blenderbot-3B": "https://huggingface.co/facebook/blenderbot-3B/resolve/main/tokenizer_config.json"
|
||||
},
|
||||
}
|
||||
|
||||
PRETRAINED_POSITIONAL_EMBEDDINGS_SIZES = {"facebook/blenderbot-3B": 128}
|
||||
|
||||
|
||||
class BlenderbotTokenizerFast(PreTrainedTokenizerFast):
|
||||
"""
|
||||
@ -126,8 +116,6 @@ class BlenderbotTokenizerFast(PreTrainedTokenizerFast):
|
||||
"""
|
||||
|
||||
vocab_files_names = VOCAB_FILES_NAMES
|
||||
pretrained_vocab_files_map = PRETRAINED_VOCAB_FILES_MAP
|
||||
max_model_input_sizes = PRETRAINED_POSITIONAL_EMBEDDINGS_SIZES
|
||||
model_input_names = ["input_ids", "attention_mask"]
|
||||
slow_tokenizer_class = BlenderbotTokenizer
|
||||
|
||||
|
@ -27,10 +27,7 @@ from ...utils import logging
|
||||
|
||||
logger = logging.get_logger(__name__)
|
||||
|
||||
BLENDERBOT_SMALL_PRETRAINED_CONFIG_ARCHIVE_MAP = {
|
||||
"facebook/blenderbot_small-90M": "https://huggingface.co/facebook/blenderbot_small-90M/resolve/main/config.json",
|
||||
# See all BlenderbotSmall models at https://huggingface.co/models?filter=blenderbot_small
|
||||
}
|
||||
from ..deprecated._archive_maps import BLENDERBOT_SMALL_PRETRAINED_CONFIG_ARCHIVE_MAP # noqa: F401, E402
|
||||
|
||||
|
||||
class BlenderbotSmallConfig(PretrainedConfig):
|
||||
|
@ -49,10 +49,7 @@ logger = logging.get_logger(__name__)
|
||||
_CONFIG_FOR_DOC = "BlenderbotSmallConfig"
|
||||
|
||||
|
||||
BLENDERBOT_SMALL_PRETRAINED_MODEL_ARCHIVE_LIST = [
|
||||
"facebook/blenderbot_small-90M",
|
||||
# See all BlenderbotSmall models at https://huggingface.co/models?filter=blenderbot_small
|
||||
]
|
||||
from ..deprecated._archive_maps import BLENDERBOT_SMALL_PRETRAINED_MODEL_ARCHIVE_LIST # noqa: F401, E402
|
||||
|
||||
|
||||
# Copied from transformers.models.bart.modeling_bart.shift_tokens_right
|
||||
|
@ -33,22 +33,6 @@ VOCAB_FILES_NAMES = {
|
||||
"tokenizer_config_file": "tokenizer_config.json",
|
||||
}
|
||||
|
||||
PRETRAINED_VOCAB_FILES_MAP = {
|
||||
"vocab_file": {
|
||||
"facebook/blenderbot_small-90M": "https://huggingface.co/facebook/blenderbot_small-90M/resolve/main/vocab.json"
|
||||
},
|
||||
"merges_file": {
|
||||
"facebook/blenderbot_small-90M": "https://huggingface.co/facebook/blenderbot_small-90M/resolve/main/merges.txt"
|
||||
},
|
||||
"tokenizer_config_file": {
|
||||
"facebook/blenderbot_small-90M": (
|
||||
"https://huggingface.co/facebook/blenderbot_small-90M/resolve/main/tokenizer_config.json"
|
||||
)
|
||||
},
|
||||
}
|
||||
|
||||
PRETRAINED_POSITIONAL_EMBEDDINGS_SIZES = {"facebook/blenderbot_small-90M": 512}
|
||||
|
||||
|
||||
def get_pairs(word):
|
||||
"""
|
||||
@ -92,8 +76,6 @@ class BlenderbotSmallTokenizer(PreTrainedTokenizer):
|
||||
"""
|
||||
|
||||
vocab_files_names = VOCAB_FILES_NAMES
|
||||
pretrained_vocab_files_map = PRETRAINED_VOCAB_FILES_MAP
|
||||
max_model_input_sizes = PRETRAINED_POSITIONAL_EMBEDDINGS_SIZES
|
||||
model_input_names = ["input_ids", "attention_mask"]
|
||||
|
||||
def __init__(
|
||||
|
@ -30,24 +30,6 @@ VOCAB_FILES_NAMES = {
|
||||
"tokenizer_config_file": "tokenizer_config.json",
|
||||
}
|
||||
|
||||
PRETRAINED_VOCAB_FILES_MAP = {
|
||||
"vocab_file": {
|
||||
"facebook/blenderbot_small-90M": "https://huggingface.co/facebook/blenderbot_small-90M/resolve/main/vocab.json"
|
||||
},
|
||||
"merges_file": {
|
||||
"facebook/blenderbot_small-90M": "https://huggingface.co/facebook/blenderbot_small-90M/resolve/main/merges.txt"
|
||||
},
|
||||
"tokenizer_config_file": {
|
||||
"facebook/blenderbot_small-90M": (
|
||||
"https://huggingface.co/facebook/blenderbot_small-90M/resolve/main/tokenizer_config.json"
|
||||
)
|
||||
},
|
||||
}
|
||||
|
||||
PRETRAINED_POSITIONAL_EMBEDDINGS_SIZES = {
|
||||
"facebook/blenderbot_small-90M": 512,
|
||||
}
|
||||
|
||||
|
||||
class BlenderbotSmallTokenizerFast(PreTrainedTokenizerFast):
|
||||
"""
|
||||
@ -59,8 +41,6 @@ class BlenderbotSmallTokenizerFast(PreTrainedTokenizerFast):
|
||||
"""
|
||||
|
||||
vocab_files_names = VOCAB_FILES_NAMES
|
||||
pretrained_vocab_files_map = PRETRAINED_VOCAB_FILES_MAP
|
||||
max_model_input_sizes = PRETRAINED_POSITIONAL_EMBEDDINGS_SIZES
|
||||
slow_tokenizer_class = BlenderbotSmallTokenizer
|
||||
|
||||
def __init__(
|
||||
|
@ -23,24 +23,8 @@ from ...utils import logging
|
||||
|
||||
logger = logging.get_logger(__name__)
|
||||
|
||||
BLIP_PRETRAINED_CONFIG_ARCHIVE_MAP = {
|
||||
"Salesforce/blip-vqa-base": "https://huggingface.co/Salesforce/blip-vqa-base/resolve/main/config.json",
|
||||
"Salesforce/blip-vqa-capfit-large": (
|
||||
"https://huggingface.co/Salesforce/blip-vqa-base-capfit/resolve/main/config.json"
|
||||
),
|
||||
"Salesforce/blip-image-captioning-base": (
|
||||
"https://huggingface.co/Salesforce/blip-image-captioning-base/resolve/main/config.json"
|
||||
),
|
||||
"Salesforce/blip-image-captioning-large": (
|
||||
"https://huggingface.co/Salesforce/blip-image-captioning-large/resolve/main/config.json"
|
||||
),
|
||||
"Salesforce/blip-itm-base-coco": "https://huggingface.co/Salesforce/blip-itm-base-coco/resolve/main/config.json",
|
||||
"Salesforce/blip-itm-large-coco": "https://huggingface.co/Salesforce/blip-itm-large-coco/resolve/main/config.json",
|
||||
"Salesforce/blip-itm-base-flikr": "https://huggingface.co/Salesforce/blip-itm-base-flikr/resolve/main/config.json",
|
||||
"Salesforce/blip-itm-large-flikr": (
|
||||
"https://huggingface.co/Salesforce/blip-itm-large-flikr/resolve/main/config.json"
|
||||
),
|
||||
}
|
||||
|
||||
from ..deprecated._archive_maps import BLIP_PRETRAINED_CONFIG_ARCHIVE_MAP # noqa: F401, E402
|
||||
|
||||
|
||||
class BlipTextConfig(PretrainedConfig):
|
||||
|
@ -41,17 +41,8 @@ logger = logging.get_logger(__name__)
|
||||
|
||||
_CHECKPOINT_FOR_DOC = "Salesforce/blip-vqa-base"
|
||||
|
||||
BLIP_PRETRAINED_MODEL_ARCHIVE_LIST = [
|
||||
"Salesforce/blip-vqa-base",
|
||||
"Salesforce/blip-vqa-capfilt-large",
|
||||
"Salesforce/blip-image-captioning-base",
|
||||
"Salesforce/blip-image-captioning-large",
|
||||
"Salesforce/blip-itm-base-coco",
|
||||
"Salesforce/blip-itm-large-coco",
|
||||
"Salesforce/blip-itm-base-flickr",
|
||||
"Salesforce/blip-itm-large-flickr",
|
||||
# See all BLIP models at https://huggingface.co/models?filter=blip
|
||||
]
|
||||
|
||||
from ..deprecated._archive_maps import BLIP_PRETRAINED_MODEL_ARCHIVE_LIST # noqa: F401, E402
|
||||
|
||||
|
||||
# Copied from transformers.models.clip.modeling_clip.contrastive_loss
|
||||
|
@ -48,17 +48,8 @@ logger = logging.get_logger(__name__)
|
||||
|
||||
_CHECKPOINT_FOR_DOC = "Salesforce/blip-vqa-base"
|
||||
|
||||
TF_BLIP_PRETRAINED_MODEL_ARCHIVE_LIST = [
|
||||
"Salesforce/blip-vqa-base",
|
||||
"Salesforce/blip-vqa-capfilt-large",
|
||||
"Salesforce/blip-image-captioning-base",
|
||||
"Salesforce/blip-image-captioning-large",
|
||||
"Salesforce/blip-itm-base-coco",
|
||||
"Salesforce/blip-itm-large-coco",
|
||||
"Salesforce/blip-itm-base-flickr",
|
||||
"Salesforce/blip-itm-large-flickr",
|
||||
# See all BLIP models at https://huggingface.co/models?filter=blip
|
||||
]
|
||||
|
||||
from ..deprecated._archive_maps import TF_BLIP_PRETRAINED_MODEL_ARCHIVE_LIST # noqa: F401, E402
|
||||
|
||||
|
||||
# Copied from transformers.models.clip.modeling_tf_clip.contrastive_loss
|
||||
|
@ -25,9 +25,8 @@ from ..auto import CONFIG_MAPPING
|
||||
|
||||
logger = logging.get_logger(__name__)
|
||||
|
||||
BLIP_2_PRETRAINED_CONFIG_ARCHIVE_MAP = {
|
||||
"salesforce/blip2-opt-2.7b": "https://huggingface.co/salesforce/blip2-opt-2.7b/resolve/main/config.json",
|
||||
}
|
||||
|
||||
from ..deprecated._archive_maps import BLIP_2_PRETRAINED_CONFIG_ARCHIVE_MAP # noqa: F401, E402
|
||||
|
||||
|
||||
class Blip2VisionConfig(PretrainedConfig):
|
||||
|
@ -47,10 +47,8 @@ logger = logging.get_logger(__name__)
|
||||
|
||||
_CHECKPOINT_FOR_DOC = "Salesforce/blip2-opt-2.7b"
|
||||
|
||||
BLIP_2_PRETRAINED_MODEL_ARCHIVE_LIST = [
|
||||
"Salesforce/blip2-opt-2.7b",
|
||||
# See all BLIP-2 models at https://huggingface.co/models?filter=blip
|
||||
]
|
||||
|
||||
from ..deprecated._archive_maps import BLIP_2_PRETRAINED_MODEL_ARCHIVE_LIST # noqa: F401, E402
|
||||
|
||||
|
||||
@dataclass
|
||||
|
@ -29,14 +29,8 @@ from ...utils import is_torch_available, logging
|
||||
|
||||
logger = logging.get_logger(__name__)
|
||||
|
||||
BLOOM_PRETRAINED_CONFIG_ARCHIVE_MAP = {
|
||||
"bigscience/bloom": "https://huggingface.co/bigscience/bloom/resolve/main/config.json",
|
||||
"bigscience/bloom-560m": "https://huggingface.co/bigscience/bloom-560m/blob/main/config.json",
|
||||
"bigscience/bloom-1b1": "https://huggingface.co/bigscience/bloom-1b1/blob/main/config.json",
|
||||
"bigscience/bloom-1b7": "https://huggingface.co/bigscience/bloom-1b7/blob/main/config.json",
|
||||
"bigscience/bloom-3b": "https://huggingface.co/bigscience/bloom-3b/blob/main/config.json",
|
||||
"bigscience/bloom-7b1": "https://huggingface.co/bigscience/bloom-7b1/blob/main/config.json",
|
||||
}
|
||||
|
||||
from ..deprecated._archive_maps import BLOOM_PRETRAINED_CONFIG_ARCHIVE_MAP # noqa: F401, E402
|
||||
|
||||
|
||||
class BloomConfig(PretrainedConfig):
|
||||
|
@ -43,15 +43,8 @@ logger = logging.get_logger(__name__)
|
||||
_CHECKPOINT_FOR_DOC = "bigscience/bloom-560m"
|
||||
_CONFIG_FOR_DOC = "BloomConfig"
|
||||
|
||||
BLOOM_PRETRAINED_MODEL_ARCHIVE_LIST = [
|
||||
"bigscience/bigscience-small-testing",
|
||||
"bigscience/bloom-560m",
|
||||
"bigscience/bloom-1b1",
|
||||
"bigscience/bloom-1b7",
|
||||
"bigscience/bloom-3b",
|
||||
"bigscience/bloom-7b1",
|
||||
"bigscience/bloom",
|
||||
]
|
||||
|
||||
from ..deprecated._archive_maps import BLOOM_PRETRAINED_MODEL_ARCHIVE_LIST # noqa: F401, E402
|
||||
|
||||
|
||||
def build_alibi_tensor(attention_mask: torch.Tensor, num_heads: int, dtype: torch.dtype) -> torch.Tensor:
|
||||
|
@ -27,18 +27,6 @@ logger = logging.get_logger(__name__)
|
||||
|
||||
VOCAB_FILES_NAMES = {"tokenizer_file": "tokenizer.json"}
|
||||
|
||||
PRETRAINED_VOCAB_FILES_MAP = {
|
||||
"tokenizer_file": {
|
||||
"bigscience/tokenizer": "https://huggingface.co/bigscience/tokenizer/blob/main/tokenizer.json",
|
||||
"bigscience/bloom-560m": "https://huggingface.co/bigscience/bloom-560m/blob/main/tokenizer.json",
|
||||
"bigscience/bloom-1b1": "https://huggingface.co/bigscience/bloom-1b1/blob/main/tokenizer.json",
|
||||
"bigscience/bloom-1b7": "https://huggingface.co/bigscience/bloom-1b7/blob/main/tokenizer.json",
|
||||
"bigscience/bloom-3b": "https://huggingface.co/bigscience/bloom-3b/blob/main/tokenizer.json",
|
||||
"bigscience/bloom-7b1": "https://huggingface.co/bigscience/bloom-7b1/blob/main/tokenizer.json",
|
||||
"bigscience/bloom": "https://huggingface.co/bigscience/bloom/blob/main/tokenizer.json",
|
||||
},
|
||||
}
|
||||
|
||||
|
||||
class BloomTokenizerFast(PreTrainedTokenizerFast):
|
||||
"""
|
||||
@ -94,7 +82,6 @@ class BloomTokenizerFast(PreTrainedTokenizerFast):
|
||||
"""
|
||||
|
||||
vocab_files_names = VOCAB_FILES_NAMES
|
||||
pretrained_vocab_files_map = PRETRAINED_VOCAB_FILES_MAP
|
||||
model_input_names = ["input_ids", "attention_mask"]
|
||||
slow_tokenizer_class = None
|
||||
# No `max_model_input_sizes` as BLOOM uses ALiBi positional embeddings
|
||||
|
@ -23,12 +23,8 @@ from ...utils import logging
|
||||
|
||||
logger = logging.get_logger(__name__)
|
||||
|
||||
BRIDGETOWER_PRETRAINED_CONFIG_ARCHIVE_MAP = {
|
||||
"BridgeTower/bridgetower-base": "https://huggingface.co/BridgeTower/bridgetower-base/blob/main/config.json",
|
||||
"BridgeTower/bridgetower-base-itm-mlm": (
|
||||
"https://huggingface.co/BridgeTower/bridgetower-base-itm-mlm/blob/main/config.json"
|
||||
),
|
||||
}
|
||||
|
||||
from ..deprecated._archive_maps import BRIDGETOWER_PRETRAINED_CONFIG_ARCHIVE_MAP # noqa: F401, E402
|
||||
|
||||
|
||||
class BridgeTowerVisionConfig(PretrainedConfig):
|
||||
|
@ -44,11 +44,8 @@ _CONFIG_FOR_DOC = "BridgeTowerConfig"
|
||||
_CHECKPOINT_FOR_DOC = "BridgeTower/bridgetower-base"
|
||||
_TOKENIZER_FOR_DOC = "RobertaTokenizer"
|
||||
|
||||
BRIDGETOWER_PRETRAINED_MODEL_ARCHIVE_LIST = [
|
||||
"BridgeTower/bridgetower-base",
|
||||
"BridgeTower/bridgetower-base-itm-mlm",
|
||||
# See all bridgetower models at https://huggingface.co/BridgeTower
|
||||
]
|
||||
|
||||
from ..deprecated._archive_maps import BRIDGETOWER_PRETRAINED_MODEL_ARCHIVE_LIST # noqa: F401, E402
|
||||
|
||||
|
||||
BRIDGETOWER_START_DOCSTRING = r"""
|
||||
|
@ -20,10 +20,8 @@ from ...utils import logging
|
||||
|
||||
logger = logging.get_logger(__name__)
|
||||
|
||||
BROS_PRETRAINED_CONFIG_ARCHIVE_MAP = {
|
||||
"jinho8345/bros-base-uncased": "https://huggingface.co/jinho8345/bros-base-uncased/blob/main/config.json",
|
||||
"jinho8345/bros-large-uncased": "https://huggingface.co/jinho8345/bros-large-uncased/blob/main/config.json",
|
||||
}
|
||||
|
||||
from ..deprecated._archive_maps import BROS_PRETRAINED_CONFIG_ARCHIVE_MAP # noqa: F401, E402
|
||||
|
||||
|
||||
class BrosConfig(PretrainedConfig):
|
||||
|
@ -47,11 +47,9 @@ logger = logging.get_logger(__name__)
|
||||
_CHECKPOINT_FOR_DOC = "jinho8345/bros-base-uncased"
|
||||
_CONFIG_FOR_DOC = "BrosConfig"
|
||||
|
||||
BROS_PRETRAINED_MODEL_ARCHIVE_LIST = [
|
||||
"jinho8345/bros-base-uncased",
|
||||
"jinho8345/bros-large-uncased",
|
||||
# See all Bros models at https://huggingface.co/models?filter=bros
|
||||
]
|
||||
|
||||
from ..deprecated._archive_maps import BROS_PRETRAINED_MODEL_ARCHIVE_LIST # noqa: F401, E402
|
||||
|
||||
|
||||
BROS_START_DOCSTRING = r"""
|
||||
This model is also a PyTorch [torch.nn.Module](https://pytorch.org/docs/stable/nn.html#torch.nn.Module) subclass.
|
||||
|
@ -25,15 +25,8 @@ from ...utils import logging
|
||||
|
||||
logger = logging.get_logger(__name__)
|
||||
|
||||
CAMEMBERT_PRETRAINED_CONFIG_ARCHIVE_MAP = {
|
||||
"almanach/camembert-base": "https://huggingface.co/almanach/camembert-base/resolve/main/config.json",
|
||||
"umberto-commoncrawl-cased-v1": (
|
||||
"https://huggingface.co/Musixmatch/umberto-commoncrawl-cased-v1/resolve/main/config.json"
|
||||
),
|
||||
"umberto-wikipedia-uncased-v1": (
|
||||
"https://huggingface.co/Musixmatch/umberto-wikipedia-uncased-v1/resolve/main/config.json"
|
||||
),
|
||||
}
|
||||
|
||||
from ..deprecated._archive_maps import CAMEMBERT_PRETRAINED_CONFIG_ARCHIVE_MAP # noqa: F401, E402
|
||||
|
||||
|
||||
class CamembertConfig(PretrainedConfig):
|
||||
|
@ -51,12 +51,9 @@ logger = logging.get_logger(__name__)
|
||||
_CHECKPOINT_FOR_DOC = "almanach/camembert-base"
|
||||
_CONFIG_FOR_DOC = "CamembertConfig"
|
||||
|
||||
CAMEMBERT_PRETRAINED_MODEL_ARCHIVE_LIST = [
|
||||
"almanach/camembert-base",
|
||||
"Musixmatch/umberto-commoncrawl-cased-v1",
|
||||
"Musixmatch/umberto-wikipedia-uncased-v1",
|
||||
# See all CamemBERT models at https://huggingface.co/models?filter=camembert
|
||||
]
|
||||
|
||||
from ..deprecated._archive_maps import CAMEMBERT_PRETRAINED_MODEL_ARCHIVE_LIST # noqa: F401, E402
|
||||
|
||||
|
||||
CAMEMBERT_START_DOCSTRING = r"""
|
||||
|
||||
|
@ -65,9 +65,8 @@ logger = logging.get_logger(__name__)
|
||||
_CHECKPOINT_FOR_DOC = "almanach/camembert-base"
|
||||
_CONFIG_FOR_DOC = "CamembertConfig"
|
||||
|
||||
TF_CAMEMBERT_PRETRAINED_MODEL_ARCHIVE_LIST = [
|
||||
# See all CamemBERT models at https://huggingface.co/models?filter=camembert
|
||||
]
|
||||
|
||||
from ..deprecated._archive_maps import TF_CAMEMBERT_PRETRAINED_MODEL_ARCHIVE_LIST # noqa: F401, E402
|
||||
|
||||
|
||||
CAMEMBERT_START_DOCSTRING = r"""
|
||||
|
@ -29,15 +29,6 @@ logger = logging.get_logger(__name__)
|
||||
|
||||
VOCAB_FILES_NAMES = {"vocab_file": "sentencepiece.bpe.model"}
|
||||
|
||||
PRETRAINED_VOCAB_FILES_MAP = {
|
||||
"vocab_file": {
|
||||
"almanach/camembert-base": "https://huggingface.co/almanach/camembert-base/resolve/main/sentencepiece.bpe.model",
|
||||
}
|
||||
}
|
||||
|
||||
PRETRAINED_POSITIONAL_EMBEDDINGS_SIZES = {
|
||||
"almanach/camembert-base": 512,
|
||||
}
|
||||
|
||||
SPIECE_UNDERLINE = "▁"
|
||||
|
||||
@ -113,8 +104,6 @@ class CamembertTokenizer(PreTrainedTokenizer):
|
||||
"""
|
||||
|
||||
vocab_files_names = VOCAB_FILES_NAMES
|
||||
pretrained_vocab_files_map = PRETRAINED_VOCAB_FILES_MAP
|
||||
max_model_input_sizes = PRETRAINED_POSITIONAL_EMBEDDINGS_SIZES
|
||||
model_input_names = ["input_ids", "attention_mask"]
|
||||
|
||||
def __init__(
|
||||
|
@ -34,18 +34,6 @@ logger = logging.get_logger(__name__)
|
||||
|
||||
VOCAB_FILES_NAMES = {"vocab_file": "sentencepiece.bpe.model", "tokenizer_file": "tokenizer.json"}
|
||||
|
||||
PRETRAINED_VOCAB_FILES_MAP = {
|
||||
"vocab_file": {
|
||||
"almanach/camembert-base": "https://huggingface.co/almanach/camembert-base/resolve/main/sentencepiece.bpe.model",
|
||||
},
|
||||
"tokenizer_file": {
|
||||
"almanach/camembert-base": "https://huggingface.co/almanach/camembert-base/resolve/main/tokenizer.json",
|
||||
},
|
||||
}
|
||||
|
||||
PRETRAINED_POSITIONAL_EMBEDDINGS_SIZES = {
|
||||
"almanach/camembert-base": 512,
|
||||
}
|
||||
|
||||
SPIECE_UNDERLINE = "▁"
|
||||
|
||||
@ -103,8 +91,6 @@ class CamembertTokenizerFast(PreTrainedTokenizerFast):
|
||||
"""
|
||||
|
||||
vocab_files_names = VOCAB_FILES_NAMES
|
||||
pretrained_vocab_files_map = PRETRAINED_VOCAB_FILES_MAP
|
||||
max_model_input_sizes = PRETRAINED_POSITIONAL_EMBEDDINGS_SIZES
|
||||
model_input_names = ["input_ids", "attention_mask"]
|
||||
slow_tokenizer_class = CamembertTokenizer
|
||||
|
||||
|
@ -20,10 +20,8 @@ from ...utils import logging
|
||||
|
||||
logger = logging.get_logger(__name__)
|
||||
|
||||
CANINE_PRETRAINED_CONFIG_ARCHIVE_MAP = {
|
||||
"google/canine-s": "https://huggingface.co/google/canine-s/resolve/main/config.json",
|
||||
# See all CANINE models at https://huggingface.co/models?filter=canine
|
||||
}
|
||||
|
||||
from ..deprecated._archive_maps import CANINE_PRETRAINED_CONFIG_ARCHIVE_MAP # noqa: F401, E402
|
||||
|
||||
|
||||
class CanineConfig(PretrainedConfig):
|
||||
|
@ -52,11 +52,9 @@ logger = logging.get_logger(__name__)
|
||||
_CHECKPOINT_FOR_DOC = "google/canine-s"
|
||||
_CONFIG_FOR_DOC = "CanineConfig"
|
||||
|
||||
CANINE_PRETRAINED_MODEL_ARCHIVE_LIST = [
|
||||
"google/canine-s",
|
||||
"google/canine-r",
|
||||
# See all CANINE models at https://huggingface.co/models?filter=canine
|
||||
]
|
||||
|
||||
from ..deprecated._archive_maps import CANINE_PRETRAINED_MODEL_ARCHIVE_LIST # noqa: F401, E402
|
||||
|
||||
|
||||
# Support up to 16 hash functions.
|
||||
_PRIMES = [31, 43, 59, 61, 73, 97, 103, 113, 137, 149, 157, 173, 181, 193, 211, 223]
|
||||
|
@ -23,10 +23,6 @@ from ...utils import logging
|
||||
logger = logging.get_logger(__name__)
|
||||
|
||||
|
||||
PRETRAINED_POSITIONAL_EMBEDDINGS_SIZES = {
|
||||
"nielsr/canine-s": 2048,
|
||||
}
|
||||
|
||||
# Unicode defines 1,114,112 total “codepoints”
|
||||
UNICODE_VOCAB_SIZE = 1114112
|
||||
|
||||
@ -73,8 +69,6 @@ class CanineTokenizer(PreTrainedTokenizer):
|
||||
The maximum sentence length the model accepts.
|
||||
"""
|
||||
|
||||
max_model_input_sizes = PRETRAINED_POSITIONAL_EMBEDDINGS_SIZES
|
||||
|
||||
def __init__(
|
||||
self,
|
||||
bos_token=chr(CLS),
|
||||
|
@ -30,11 +30,8 @@ from ...utils import logging
|
||||
|
||||
logger = logging.get_logger(__name__)
|
||||
|
||||
CHINESE_CLIP_PRETRAINED_CONFIG_ARCHIVE_MAP = {
|
||||
"OFA-Sys/chinese-clip-vit-base-patch16": (
|
||||
"https://huggingface.co/OFA-Sys/chinese-clip-vit-base-patch16/resolve/main/config.json"
|
||||
),
|
||||
}
|
||||
|
||||
from ..deprecated._archive_maps import CHINESE_CLIP_PRETRAINED_CONFIG_ARCHIVE_MAP # noqa: F401, E402
|
||||
|
||||
|
||||
class ChineseCLIPTextConfig(PretrainedConfig):
|
||||
|
@ -48,10 +48,8 @@ logger = logging.get_logger(__name__)
|
||||
_CHECKPOINT_FOR_DOC = "OFA-Sys/chinese-clip-vit-base-patch16"
|
||||
_CONFIG_FOR_DOC = "ChineseCLIPConfig"
|
||||
|
||||
CHINESE_CLIP_PRETRAINED_MODEL_ARCHIVE_LIST = [
|
||||
"OFA-Sys/chinese-clip-vit-base-patch16",
|
||||
# See all Chinese-CLIP models at https://huggingface.co/models?filter=chinese_clip
|
||||
]
|
||||
|
||||
from ..deprecated._archive_maps import CHINESE_CLIP_PRETRAINED_MODEL_ARCHIVE_LIST # noqa: F401, E402
|
||||
|
||||
|
||||
# https://sachinruk.github.io/blog/pytorch/pytorch%20lightning/loss%20function/gpu/2021/03/07/CLIP.html
|
||||
|
@ -23,11 +23,6 @@ from ...utils import logging
|
||||
|
||||
logger = logging.get_logger(__name__)
|
||||
|
||||
CLAP_PRETRAINED_MODEL_ARCHIVE_LIST = {
|
||||
"laion/clap-htsat-fused": "https://huggingface.co/laion/clap-htsat-fused/resolve/main/config.json",
|
||||
"laion/clap-htsat-unfused": "https://huggingface.co/laion/clap-htsat-unfused/resolve/main/config.json",
|
||||
}
|
||||
|
||||
|
||||
class ClapTextConfig(PretrainedConfig):
|
||||
r"""
|
||||
|
@ -44,11 +44,8 @@ logger = logging.get_logger(__name__)
|
||||
|
||||
_CHECKPOINT_FOR_DOC = "laion/clap-htsat-fused"
|
||||
|
||||
CLAP_PRETRAINED_MODEL_ARCHIVE_LIST = [
|
||||
"laion/clap-htsat-fused",
|
||||
"laion/clap-htsat-unfused",
|
||||
# See all clap models at https://huggingface.co/models?filter=clap
|
||||
]
|
||||
|
||||
from ..deprecated._archive_maps import CLAP_PRETRAINED_MODEL_ARCHIVE_LIST # noqa: F401, E402
|
||||
|
||||
|
||||
# Adapted from: https://github.com/LAION-AI/CLAP/blob/6ad05a971ba0622f6acee8c41993e0d02bbed639/src/open_clip/utils.py#L191
|
||||
|
@ -30,10 +30,8 @@ from ...utils import logging
|
||||
|
||||
logger = logging.get_logger(__name__)
|
||||
|
||||
CLIP_PRETRAINED_CONFIG_ARCHIVE_MAP = {
|
||||
"openai/clip-vit-base-patch32": "https://huggingface.co/openai/clip-vit-base-patch32/resolve/main/config.json",
|
||||
# See all CLIP models at https://huggingface.co/models?filter=clip
|
||||
}
|
||||
|
||||
from ..deprecated._archive_maps import CLIP_PRETRAINED_CONFIG_ARCHIVE_MAP # noqa: F401, E402
|
||||
|
||||
|
||||
class CLIPTextConfig(PretrainedConfig):
|
||||
|
@ -48,10 +48,8 @@ _CHECKPOINT_FOR_DOC = "openai/clip-vit-base-patch32"
|
||||
_IMAGE_CLASS_CHECKPOINT = "openai/clip-vit-base-patch32"
|
||||
_IMAGE_CLASS_EXPECTED_OUTPUT = "LABEL_0"
|
||||
|
||||
CLIP_PRETRAINED_MODEL_ARCHIVE_LIST = [
|
||||
"openai/clip-vit-base-patch32",
|
||||
# See all CLIP models at https://huggingface.co/models?filter=clip
|
||||
]
|
||||
|
||||
from ..deprecated._archive_maps import CLIP_PRETRAINED_MODEL_ARCHIVE_LIST # noqa: F401, E402
|
||||
|
||||
|
||||
# contrastive loss function, adapted from
|
||||
|
@ -51,10 +51,8 @@ logger = logging.get_logger(__name__)
|
||||
|
||||
_CHECKPOINT_FOR_DOC = "openai/clip-vit-base-patch32"
|
||||
|
||||
TF_CLIP_PRETRAINED_MODEL_ARCHIVE_LIST = [
|
||||
"openai/clip-vit-base-patch32",
|
||||
# See all CLIP models at https://huggingface.co/models?filter=clip
|
||||
]
|
||||
|
||||
from ..deprecated._archive_maps import TF_CLIP_PRETRAINED_MODEL_ARCHIVE_LIST # noqa: F401, E402
|
||||
|
||||
|
||||
LARGE_NEGATIVE = -1e8
|
||||
|
@ -33,24 +33,6 @@ VOCAB_FILES_NAMES = {
|
||||
"merges_file": "merges.txt",
|
||||
}
|
||||
|
||||
PRETRAINED_VOCAB_FILES_MAP = {
|
||||
"vocab_file": {
|
||||
"openai/clip-vit-base-patch32": "https://huggingface.co/openai/clip-vit-base-patch32/resolve/main/vocab.json",
|
||||
},
|
||||
"merges_file": {
|
||||
"openai/clip-vit-base-patch32": "https://huggingface.co/openai/clip-vit-base-patch32/resolve/main/merges.txt",
|
||||
},
|
||||
}
|
||||
|
||||
PRETRAINED_POSITIONAL_EMBEDDINGS_SIZES = {
|
||||
"openai/clip-vit-base-patch32": 77,
|
||||
}
|
||||
|
||||
|
||||
PRETRAINED_INIT_CONFIGURATION = {
|
||||
"openai/clip-vit-base-patch32": {},
|
||||
}
|
||||
|
||||
|
||||
@lru_cache()
|
||||
def bytes_to_unicode():
|
||||
@ -296,8 +278,6 @@ class CLIPTokenizer(PreTrainedTokenizer):
|
||||
"""
|
||||
|
||||
vocab_files_names = VOCAB_FILES_NAMES
|
||||
pretrained_vocab_files_map = PRETRAINED_VOCAB_FILES_MAP
|
||||
max_model_input_sizes = PRETRAINED_POSITIONAL_EMBEDDINGS_SIZES
|
||||
model_input_names = ["input_ids", "attention_mask"]
|
||||
|
||||
def __init__(
|
||||
|
@ -28,24 +28,6 @@ logger = logging.get_logger(__name__)
|
||||
|
||||
VOCAB_FILES_NAMES = {"vocab_file": "vocab.json", "merges_file": "merges.txt", "tokenizer_file": "tokenizer.json"}
|
||||
|
||||
PRETRAINED_VOCAB_FILES_MAP = {
|
||||
"vocab_file": {
|
||||
"openai/clip-vit-base-patch32": "https://huggingface.co/openai/clip-vit-base-patch32/resolve/main/vocab.json",
|
||||
},
|
||||
"merges_file": {
|
||||
"openai/clip-vit-base-patch32": "https://huggingface.co/openai/clip-vit-base-patch32/resolve/main/merges.txt",
|
||||
},
|
||||
"tokenizer_file": {
|
||||
"openai/clip-vit-base-patch32": (
|
||||
"https://huggingface.co/openai/clip-vit-base-patch32/resolve/main/tokenizer.json"
|
||||
),
|
||||
},
|
||||
}
|
||||
|
||||
PRETRAINED_POSITIONAL_EMBEDDINGS_SIZES = {
|
||||
"openai/clip-vit-base-patch32": 77,
|
||||
}
|
||||
|
||||
|
||||
class CLIPTokenizerFast(PreTrainedTokenizerFast):
|
||||
"""
|
||||
@ -74,8 +56,6 @@ class CLIPTokenizerFast(PreTrainedTokenizerFast):
|
||||
"""
|
||||
|
||||
vocab_files_names = VOCAB_FILES_NAMES
|
||||
pretrained_vocab_files_map = PRETRAINED_VOCAB_FILES_MAP
|
||||
max_model_input_sizes = PRETRAINED_POSITIONAL_EMBEDDINGS_SIZES
|
||||
model_input_names = ["input_ids", "attention_mask"]
|
||||
slow_tokenizer_class = CLIPTokenizer
|
||||
|
||||
|
@ -23,9 +23,8 @@ from ...utils import logging
|
||||
|
||||
logger = logging.get_logger(__name__)
|
||||
|
||||
CLIPSEG_PRETRAINED_CONFIG_ARCHIVE_MAP = {
|
||||
"CIDAS/clipseg-rd64": "https://huggingface.co/CIDAS/clipseg-rd64/resolve/main/config.json",
|
||||
}
|
||||
|
||||
from ..deprecated._archive_maps import CLIPSEG_PRETRAINED_CONFIG_ARCHIVE_MAP # noqa: F401, E402
|
||||
|
||||
|
||||
class CLIPSegTextConfig(PretrainedConfig):
|
||||
|
@ -42,10 +42,8 @@ logger = logging.get_logger(__name__)
|
||||
|
||||
_CHECKPOINT_FOR_DOC = "CIDAS/clipseg-rd64-refined"
|
||||
|
||||
CLIPSEG_PRETRAINED_MODEL_ARCHIVE_LIST = [
|
||||
"CIDAS/clipseg-rd64-refined",
|
||||
# See all CLIPSeg models at https://huggingface.co/models?filter=clipseg
|
||||
]
|
||||
|
||||
from ..deprecated._archive_maps import CLIPSEG_PRETRAINED_MODEL_ARCHIVE_LIST # noqa: F401, E402
|
||||
|
||||
|
||||
# contrastive loss function, adapted from
|
||||
|
@ -28,9 +28,8 @@ from ...utils import logging
|
||||
|
||||
logger = logging.get_logger(__name__)
|
||||
|
||||
CLVP_PRETRAINED_CONFIG_ARCHIVE_MAP = {
|
||||
"susnato/clvp_dev": "https://huggingface.co/susnato/clvp_dev/resolve/main/config.json",
|
||||
}
|
||||
|
||||
from ..deprecated._archive_maps import CLVP_PRETRAINED_CONFIG_ARCHIVE_MAP # noqa: F401, E402
|
||||
|
||||
|
||||
class ClvpEncoderConfig(PretrainedConfig):
|
||||
|
@ -55,10 +55,8 @@ logger = logging.get_logger(__name__)
|
||||
|
||||
_CHECKPOINT_FOR_DOC = "susnato/clvp_dev"
|
||||
|
||||
CLVP_PRETRAINED_MODEL_ARCHIVE_LIST = [
|
||||
"susnato/clvp_dev",
|
||||
# See all Clvp models at https://huggingface.co/models?filter=clvp
|
||||
]
|
||||
|
||||
from ..deprecated._archive_maps import CLVP_PRETRAINED_MODEL_ARCHIVE_LIST # noqa: F401, E402
|
||||
|
||||
|
||||
# Copied from transformers.models.clip.modeling_clip.contrastive_loss
|
||||
|
@ -33,19 +33,6 @@ VOCAB_FILES_NAMES = {
|
||||
"merges_file": "merges.txt",
|
||||
}
|
||||
|
||||
PRETRAINED_VOCAB_FILES_MAP = {
|
||||
"vocab_file": {
|
||||
"clvp_dev": "https://huggingface.co/susnato/clvp_dev/blob/main/vocab.json",
|
||||
},
|
||||
"merges_file": {
|
||||
"clvp_dev": "https://huggingface.co/susnato/clvp_dev/blob/main/merges.txt",
|
||||
},
|
||||
}
|
||||
|
||||
PRETRAINED_POSITIONAL_EMBEDDINGS_SIZES = {
|
||||
"clvp_dev": 1024,
|
||||
}
|
||||
|
||||
|
||||
@lru_cache()
|
||||
# Copied from transformers.models.gpt2.tokenization_gpt2.bytes_to_unicode
|
||||
@ -145,8 +132,6 @@ class ClvpTokenizer(PreTrainedTokenizer):
|
||||
"""
|
||||
|
||||
vocab_files_names = VOCAB_FILES_NAMES
|
||||
pretrained_vocab_files_map = PRETRAINED_VOCAB_FILES_MAP
|
||||
max_model_input_sizes = PRETRAINED_POSITIONAL_EMBEDDINGS_SIZES
|
||||
model_input_names = [
|
||||
"input_ids",
|
||||
"attention_mask",
|
||||
|
@ -30,17 +30,6 @@ logger = logging.get_logger(__name__)
|
||||
|
||||
VOCAB_FILES_NAMES = {"vocab_file": "tokenizer.model"}
|
||||
|
||||
PRETRAINED_VOCAB_FILES_MAP = {
|
||||
"vocab_file": {
|
||||
"hf-internal-testing/llama-code-tokenizer": "https://huggingface.co/hf-internal-testing/llama-tokenizer/resolve/main/tokenizer.model",
|
||||
},
|
||||
"tokenizer_file": {
|
||||
"hf-internal-testing/llama-code-tokenizer": "https://huggingface.co/hf-internal-testing/llama-tokenizer/resolve/main/tokenizer_config.json",
|
||||
},
|
||||
}
|
||||
PRETRAINED_POSITIONAL_EMBEDDINGS_SIZES = {
|
||||
"hf-internal-testing/llama-code-tokenizer": 2048,
|
||||
}
|
||||
SPIECE_UNDERLINE = "▁"
|
||||
|
||||
B_INST, E_INST = "[INST]", "[/INST]"
|
||||
@ -123,8 +112,6 @@ class CodeLlamaTokenizer(PreTrainedTokenizer):
|
||||
"""
|
||||
|
||||
vocab_files_names = VOCAB_FILES_NAMES
|
||||
pretrained_vocab_files_map = PRETRAINED_VOCAB_FILES_MAP
|
||||
max_model_input_sizes = PRETRAINED_POSITIONAL_EMBEDDINGS_SIZES
|
||||
model_input_names = ["input_ids", "attention_mask"]
|
||||
|
||||
def __init__(
|
||||
|
@ -25,20 +25,7 @@ from ...utils import logging
|
||||
logger = logging.get_logger(__name__)
|
||||
|
||||
|
||||
CODEGEN_PRETRAINED_CONFIG_ARCHIVE_MAP = {
|
||||
"Salesforce/codegen-350M-nl": "https://huggingface.co/Salesforce/codegen-350M-nl/resolve/main/config.json",
|
||||
"Salesforce/codegen-350M-multi": "https://huggingface.co/Salesforce/codegen-350M-multi/resolve/main/config.json",
|
||||
"Salesforce/codegen-350M-mono": "https://huggingface.co/Salesforce/codegen-350M-mono/resolve/main/config.json",
|
||||
"Salesforce/codegen-2B-nl": "https://huggingface.co/Salesforce/codegen-2B-nl/resolve/main/config.json",
|
||||
"Salesforce/codegen-2B-multi": "https://huggingface.co/Salesforce/codegen-2B-multi/resolve/main/config.json",
|
||||
"Salesforce/codegen-2B-mono": "https://huggingface.co/Salesforce/codegen-2B-mono/resolve/main/config.json",
|
||||
"Salesforce/codegen-6B-nl": "https://huggingface.co/Salesforce/codegen-6B-nl/resolve/main/config.json",
|
||||
"Salesforce/codegen-6B-multi": "https://huggingface.co/Salesforce/codegen-6B-multi/resolve/main/config.json",
|
||||
"Salesforce/codegen-6B-mono": "https://huggingface.co/Salesforce/codegen-6B-mono/resolve/main/config.json",
|
||||
"Salesforce/codegen-16B-nl": "https://huggingface.co/Salesforce/codegen-16B-nl/resolve/main/config.json",
|
||||
"Salesforce/codegen-16B-multi": "https://huggingface.co/Salesforce/codegen-16B-multi/resolve/main/config.json",
|
||||
"Salesforce/codegen-16B-mono": "https://huggingface.co/Salesforce/codegen-16B-mono/resolve/main/config.json",
|
||||
}
|
||||
from ..deprecated._archive_maps import CODEGEN_PRETRAINED_CONFIG_ARCHIVE_MAP # noqa: F401, E402
|
||||
|
||||
|
||||
class CodeGenConfig(PretrainedConfig):
|
||||
|
@ -34,21 +34,7 @@ _CHECKPOINT_FOR_DOC = "Salesforce/codegen-2B-mono"
|
||||
_CONFIG_FOR_DOC = "CodeGenConfig"
|
||||
|
||||
|
||||
CODEGEN_PRETRAINED_MODEL_ARCHIVE_LIST = [
|
||||
"Salesforce/codegen-350M-nl",
|
||||
"Salesforce/codegen-350M-multi",
|
||||
"Salesforce/codegen-350M-mono",
|
||||
"Salesforce/codegen-2B-nl",
|
||||
"Salesforce/codegen-2B-multi",
|
||||
"Salesforce/codegen-2B-mono",
|
||||
"Salesforce/codegen-6B-nl",
|
||||
"Salesforce/codegen-6B-multi",
|
||||
"Salesforce/codegen-6B-mono",
|
||||
"Salesforce/codegen-16B-nl",
|
||||
"Salesforce/codegen-16B-multi",
|
||||
"Salesforce/codegen-16B-mono",
|
||||
# See all CodeGen models at https://huggingface.co/models?filter=codegen
|
||||
]
|
||||
from ..deprecated._archive_maps import CODEGEN_PRETRAINED_MODEL_ARCHIVE_LIST # noqa: F401, E402
|
||||
|
||||
|
||||
# Copied from transformers.models.gptj.modeling_gptj.create_sinusoidal_positions
|
||||
|
@ -42,19 +42,6 @@ VOCAB_FILES_NAMES = {
|
||||
"merges_file": "merges.txt",
|
||||
}
|
||||
|
||||
PRETRAINED_VOCAB_FILES_MAP = {
|
||||
"vocab_file": {
|
||||
"Salesforce/codegen-350M-mono": "https://huggingface.co/Salesforce/codegen-350M-mono/resolve/main/vocab.json",
|
||||
},
|
||||
"merges_file": {
|
||||
"Salesforce/codegen-350M-mono": "https://huggingface.co/Salesforce/codegen-350M-mono/resolve/main/merges.txt",
|
||||
},
|
||||
}
|
||||
|
||||
PRETRAINED_POSITIONAL_EMBEDDINGS_SIZES = {
|
||||
"Salesforce/codegen-350M-mono": 2048,
|
||||
}
|
||||
|
||||
|
||||
@lru_cache()
|
||||
def bytes_to_unicode():
|
||||
@ -150,8 +137,6 @@ class CodeGenTokenizer(PreTrainedTokenizer):
|
||||
"""
|
||||
|
||||
vocab_files_names = VOCAB_FILES_NAMES
|
||||
pretrained_vocab_files_map = PRETRAINED_VOCAB_FILES_MAP
|
||||
max_model_input_sizes = PRETRAINED_POSITIONAL_EMBEDDINGS_SIZES
|
||||
model_input_names = ["input_ids", "attention_mask"]
|
||||
|
||||
def __init__(
|
||||
|
@ -41,24 +41,6 @@ logger = logging.get_logger(__name__)
|
||||
|
||||
VOCAB_FILES_NAMES = {"vocab_file": "vocab.json", "merges_file": "merges.txt", "tokenizer_file": "tokenizer.json"}
|
||||
|
||||
PRETRAINED_VOCAB_FILES_MAP = {
|
||||
"vocab_file": {
|
||||
"Salesforce/codegen-350M-mono": "https://huggingface.co/Salesforce/codegen-350M-mono/resolve/main/vocab.json",
|
||||
},
|
||||
"merges_file": {
|
||||
"Salesforce/codegen-350M-mono": "https://huggingface.co/Salesforce/codegen-350M-mono/resolve/main/merges.txt",
|
||||
},
|
||||
"tokenizer_file": {
|
||||
"Salesforce/codegen-350M-mono": (
|
||||
"https://huggingface.co/Salesforce/codegen-350M-mono/resolve/main/tokenizer.json"
|
||||
),
|
||||
},
|
||||
}
|
||||
|
||||
PRETRAINED_POSITIONAL_EMBEDDINGS_SIZES = {
|
||||
"Salesforce/codegen-350M-mono": 2048,
|
||||
}
|
||||
|
||||
|
||||
class CodeGenTokenizerFast(PreTrainedTokenizerFast):
|
||||
"""
|
||||
@ -112,8 +94,6 @@ class CodeGenTokenizerFast(PreTrainedTokenizerFast):
|
||||
"""
|
||||
|
||||
vocab_files_names = VOCAB_FILES_NAMES
|
||||
pretrained_vocab_files_map = PRETRAINED_VOCAB_FILES_MAP
|
||||
max_model_input_sizes = PRETRAINED_POSITIONAL_EMBEDDINGS_SIZES
|
||||
model_input_names = ["input_ids", "attention_mask"]
|
||||
slow_tokenizer_class = CodeGenTokenizer
|
||||
|
||||
|
@ -26,11 +26,8 @@ from ..auto import CONFIG_MAPPING
|
||||
|
||||
logger = logging.get_logger(__name__)
|
||||
|
||||
CONDITIONAL_DETR_PRETRAINED_CONFIG_ARCHIVE_MAP = {
|
||||
"microsoft/conditional-detr-resnet-50": (
|
||||
"https://huggingface.co/microsoft/conditional-detr-resnet-50/resolve/main/config.json"
|
||||
),
|
||||
}
|
||||
|
||||
from ..deprecated._archive_maps import CONDITIONAL_DETR_PRETRAINED_CONFIG_ARCHIVE_MAP # noqa: F401, E402
|
||||
|
||||
|
||||
class ConditionalDetrConfig(PretrainedConfig):
|
||||
|
@ -60,10 +60,8 @@ logger = logging.get_logger(__name__)
|
||||
_CONFIG_FOR_DOC = "ConditionalDetrConfig"
|
||||
_CHECKPOINT_FOR_DOC = "microsoft/conditional-detr-resnet-50"
|
||||
|
||||
CONDITIONAL_DETR_PRETRAINED_MODEL_ARCHIVE_LIST = [
|
||||
"microsoft/conditional-detr-resnet-50",
|
||||
# See all Conditional DETR models at https://huggingface.co/models?filter=conditional_detr
|
||||
]
|
||||
|
||||
from ..deprecated._archive_maps import CONDITIONAL_DETR_PRETRAINED_MODEL_ARCHIVE_LIST # noqa: F401, E402
|
||||
|
||||
|
||||
@dataclass
|
||||
|
@ -24,14 +24,8 @@ from ...utils import logging
|
||||
|
||||
logger = logging.get_logger(__name__)
|
||||
|
||||
CONVBERT_PRETRAINED_CONFIG_ARCHIVE_MAP = {
|
||||
"YituTech/conv-bert-base": "https://huggingface.co/YituTech/conv-bert-base/resolve/main/config.json",
|
||||
"YituTech/conv-bert-medium-small": (
|
||||
"https://huggingface.co/YituTech/conv-bert-medium-small/resolve/main/config.json"
|
||||
),
|
||||
"YituTech/conv-bert-small": "https://huggingface.co/YituTech/conv-bert-small/resolve/main/config.json",
|
||||
# See all ConvBERT models at https://huggingface.co/models?filter=convbert
|
||||
}
|
||||
|
||||
from ..deprecated._archive_maps import CONVBERT_PRETRAINED_CONFIG_ARCHIVE_MAP # noqa: F401, E402
|
||||
|
||||
|
||||
class ConvBertConfig(PretrainedConfig):
|
||||
|
@ -45,12 +45,8 @@ logger = logging.get_logger(__name__)
|
||||
_CHECKPOINT_FOR_DOC = "YituTech/conv-bert-base"
|
||||
_CONFIG_FOR_DOC = "ConvBertConfig"
|
||||
|
||||
CONVBERT_PRETRAINED_MODEL_ARCHIVE_LIST = [
|
||||
"YituTech/conv-bert-base",
|
||||
"YituTech/conv-bert-medium-small",
|
||||
"YituTech/conv-bert-small",
|
||||
# See all ConvBERT models at https://huggingface.co/models?filter=convbert
|
||||
]
|
||||
|
||||
from ..deprecated._archive_maps import CONVBERT_PRETRAINED_MODEL_ARCHIVE_LIST # noqa: F401, E402
|
||||
|
||||
|
||||
def load_tf_weights_in_convbert(model, config, tf_checkpoint_path):
|
||||
|
@ -60,12 +60,8 @@ logger = logging.get_logger(__name__)
|
||||
_CHECKPOINT_FOR_DOC = "YituTech/conv-bert-base"
|
||||
_CONFIG_FOR_DOC = "ConvBertConfig"
|
||||
|
||||
TF_CONVBERT_PRETRAINED_MODEL_ARCHIVE_LIST = [
|
||||
"YituTech/conv-bert-base",
|
||||
"YituTech/conv-bert-medium-small",
|
||||
"YituTech/conv-bert-small",
|
||||
# See all ConvBERT models at https://huggingface.co/models?filter=convbert
|
||||
]
|
||||
|
||||
from ..deprecated._archive_maps import TF_CONVBERT_PRETRAINED_MODEL_ARCHIVE_LIST # noqa: F401, E402
|
||||
|
||||
|
||||
# Copied from transformers.models.albert.modeling_tf_albert.TFAlbertEmbeddings with Albert->ConvBert
|
||||
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user