Skip to content

Commit c6d7c8c

Browse files
authored
Add Mvp model (#1085)
* Add mvp model * Add mvp model
1 parent b230f46 commit c6d7c8c

File tree

8 files changed

+2301
-0
lines changed

8 files changed

+2301
-0
lines changed

mindone/transformers/__init__.py

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -317,6 +317,14 @@
317317
MT5Model,
318318
MT5PreTrainedModel,
319319
)
320+
from .models.mvp import (
321+
MvpForCausalLM,
322+
MvpForConditionalGeneration,
323+
MvpForQuestionAnswering,
324+
MvpForSequenceClassification,
325+
MvpModel,
326+
MvpPreTrainedModel,
327+
)
320328
from .models.paligemma import PaliGemmaForConditionalGeneration, PaliGemmaPreTrainedModel
321329
from .models.persimmon import (
322330
PersimmonForCausalLM,

mindone/transformers/models/__init__.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,7 @@
5656
mixtral,
5757
mobilebert,
5858
mpt,
59+
mvp,
5960
paligemma,
6061
persimmon,
6162
phi,

mindone/transformers/models/auto/configuration_auto.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -98,6 +98,7 @@
9898
("t5", "T5Config"),
9999
("umt5", "UMT5Config"),
100100
("wav2vec2", "Wav2Vec2Config"),
101+
("mvp", "MvpConfig"),
101102
("whisper", "WhisperConfig"),
102103
("xlm-roberta", "XLMRobertaConfig"),
103104
("xlm-roberta-xl", "XLMRobertaXLConfig"),
@@ -118,6 +119,7 @@
118119
("camembert", "CamemBERT"),
119120
("bit", "BiT"),
120121
("blip", "BLIP"),
122+
("mvp", "MVP"),
121123
("blip-2", "BLIP-2"),
122124
("chameleon", "Chameleon"),
123125
("clap", "CLAP"),

mindone/transformers/models/auto/modeling_auto.py

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,7 @@
3838
("bert", "BertModel"),
3939
("bart", "BartModel"),
4040
("camembert", "CamembertModel"),
41+
("mvp", "MvpModel"),
4142
("bit", "BitModel"),
4243
("blip", "BlipModel"),
4344
("blip-2", "Blip2Model"),
@@ -110,6 +111,7 @@
110111
("albert", "AlbertForPreTraining"),
111112
("bart", "BartForConditionalGeneration"),
112113
("camembert", "CamembertForMaskedLM"),
114+
("mvp", "MvpForConditionalGeneration"),
113115
("bert", "BertForPreTraining"),
114116
("gpt2", "GPT2LMHeadModel"),
115117
("gemma3", "Gemma3ForConditionalGeneration"),
@@ -135,6 +137,7 @@
135137
[
136138
# Model with LM heads mapping
137139
("albert", "AlbertForMaskedLM"),
140+
("mvp", "MvpForConditionalGeneration"),
138141
("bart", "BartForConditionalGeneration"),
139142
("m2m_100", "M2M100ForConditionalGeneration"),
140143
("bert", "BertForMaskedLM"),
@@ -162,6 +165,7 @@
162165
("aria_text", "AriaTextForCausalLM"),
163166
("bart", "BartForCausalLM"),
164167
("camembert", "CamembertForCausalLM"),
168+
("mvp", "MvpForCausalLM"),
165169
("bert", "BertLMHeadModel"),
166170
("bert-generation", "BertGenerationDecoder"),
167171
("gemma", "GemmaForCausalLM"),
@@ -278,6 +282,7 @@
278282
MODEL_FOR_MASKED_LM_MAPPING_NAMES = OrderedDict(
279283
[
280284
# Model for Masked LM mapping
285+
("mvp", "MvpForConditionalGeneration"),
281286
("albert", "AlbertForMaskedLM"),
282287
("bart", "BartForConditionalGeneration"),
283288
("bert", "BertForMaskedLM"),
@@ -331,6 +336,7 @@
331336
("bart", "BartForConditionalGeneration"),
332337
("led", "LEDForConditionalGeneration"),
333338
("m2m_100", "M2M100ForConditionalGeneration"),
339+
("mvp", "MvpForConditionalGeneration"),
334340
("mt5", "MT5ForConditionalGeneration"),
335341
("qwen2_audio", "Qwen2AudioForConditionalGeneration"),
336342
("t5", "T5ForConditionalGeneration"),
@@ -352,6 +358,7 @@
352358
("bart", "BartForSequenceClassification"),
353359
("camembert", "CamembertForSequenceClassification"),
354360
("bert", "BertForSequenceClassification"),
361+
("mvp", "MvpForSequenceClassification"),
355362
("roberta", "RobertaForSequenceClassification"),
356363
("deberta", "DebertaForSequenceClassification"),
357364
("deberta-v2", "DebertaV2ForSequenceClassification"),
@@ -386,6 +393,7 @@
386393
("bart", "BartForQuestionAnswering"),
387394
("bert", "BertForQuestionAnswering"),
388395
("camembert", "CamembertForQuestionAnswering"),
396+
("mvp", "MvpForQuestionAnswering"),
389397
("roberta", "RobertaForQuestionAnswering"),
390398
("deberta", "DebertaForQuestionAnswering"),
391399
("deberta-v2", "DebertaV2ForQuestionAnswering"),
Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
# Copyright 2024 The HuggingFace Team. All rights reserved.
2+
#
3+
# This code is adapted from https://github.com/huggingface/transformers
4+
# with modifications to run transformers on mindspore.
5+
#
6+
# Licensed under the Apache License, Version 2.0 (the "License");
7+
# you may not use this file except in compliance with the License.
8+
# You may obtain a copy of the License at
9+
#
10+
# http://www.apache.org/licenses/LICENSE-2.0
11+
#
12+
# Unless required by applicable law or agreed to in writing, software
13+
# distributed under the License is distributed on an "AS IS" BASIS,
14+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15+
# See the License for the specific language governing permissions and
16+
# limitations under the License.
17+
from .modeling_mvp import (
18+
MvpForCausalLM,
19+
MvpForConditionalGeneration,
20+
MvpForQuestionAnswering,
21+
MvpForSequenceClassification,
22+
MvpModel,
23+
MvpPreTrainedModel,
24+
)

0 commit comments

Comments
 (0)