Skip to content

Commit b230f46

Browse files
authored
Add m2m_100 model (#1068)
1 parent aab4685 commit b230f46

File tree

8 files changed

+1873
-0
lines changed

8 files changed

+1873
-0
lines changed

mindone/transformers/__init__.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -260,6 +260,7 @@
260260
)
261261
from .models.llama import LlamaForCausalLM, LlamaForSequenceClassification, LlamaModel, LlamaPreTrainedModel
262262
from .models.llava import LlavaConfig, LlavaForConditionalGeneration
263+
from .models.m2m_100 import M2M100ForConditionalGeneration, M2M100Model, M2M100PreTrainedModel
263264
from .models.megatron_bert import (
264265
MegatronBertForCausalLM,
265266
MegatronBertForMaskedLM,

mindone/transformers/models/__init__.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,7 @@
4949
levit,
5050
llama,
5151
llava,
52+
m2m_100,
5253
megatron_bert,
5354
minicpm4,
5455
mistral,

mindone/transformers/models/auto/configuration_auto.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -69,6 +69,7 @@
6969
("imagegpt", "ImageGPTConfig"),
7070
("led", "LEDConfig"),
7171
("levit", "LevitConfig"),
72+
("m2m_100", "M2M100Config"),
7273
("llama", "LlamaConfig"),
7374
("persimmon", "PersimmonConfig"),
7475
("fuyu", "FuyuConfig"),
@@ -111,6 +112,7 @@
111112
("albert", "ALBERT"),
112113
("aria", "Aria"),
113114
("aria_text", "AriaText"),
115+
("m2m_100", "M2M100"),
114116
("bert", "BERT"),
115117
("bart", "BART"),
116118
("camembert", "CamemBERT"),

mindone/transformers/models/auto/modeling_auto.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,7 @@
5151
("deberta-v2", "DebertaV2Model"),
5252
("dpt", "DPTModel"),
5353
("gemma", "GemmaModel"),
54+
("m2m_100", "M2M100Model"),
5455
("gemma2", "Gemma2Model"),
5556
("persimmon", "PersimmonModel"),
5657
("glm", "GlmModel"),
@@ -135,6 +136,7 @@
135136
# Model with LM heads mapping
136137
("albert", "AlbertForMaskedLM"),
137138
("bart", "BartForConditionalGeneration"),
139+
("m2m_100", "M2M100ForConditionalGeneration"),
138140
("bert", "BertForMaskedLM"),
139141
("deberta", "DebertaForMaskedLM"),
140142
("deberta-v2", "DebertaV2ForMaskedLM"),
@@ -328,6 +330,7 @@
328330
# Model for Seq2Seq Causal LM mapping
329331
("bart", "BartForConditionalGeneration"),
330332
("led", "LEDForConditionalGeneration"),
333+
("m2m_100", "M2M100ForConditionalGeneration"),
331334
("mt5", "MT5ForConditionalGeneration"),
332335
("qwen2_audio", "Qwen2AudioForConditionalGeneration"),
333336
("t5", "T5ForConditionalGeneration"),
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
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_m2m_100 import M2M100ForConditionalGeneration, M2M100Model, M2M100PreTrainedModel

0 commit comments

Comments
 (0)