Skip to content

Commit eff29d5

Browse files
authored
Add canine model (#1035)
1 parent 9a88568 commit eff29d5

File tree

8 files changed

+1991
-0
lines changed

8 files changed

+1991
-0
lines changed

mindone/transformers/__init__.py

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -130,6 +130,15 @@
130130
CamembertModel,
131131
CamembertPreTrainedModel,
132132
)
133+
from .models.canine import (
134+
CanineForMultipleChoice,
135+
CanineForQuestionAnswering,
136+
CanineForSequenceClassification,
137+
CanineForTokenClassification,
138+
CanineLayer,
139+
CanineModel,
140+
CaninePreTrainedModel,
141+
)
133142
from .models.chameleon import (
134143
ChameleonForConditionalGeneration,
135144
ChameleonModel,

mindone/transformers/models/__init__.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@
2929
blip,
3030
blip_2,
3131
camembert,
32+
canine,
3233
clap,
3334
clip,
3435
convbert,

mindone/transformers/models/auto/configuration_auto.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -71,6 +71,7 @@
7171
("led", "LEDConfig"),
7272
("levit", "LevitConfig"),
7373
("m2m_100", "M2M100Config"),
74+
("canine", "CanineConfig"),
7475
("llama", "LlamaConfig"),
7576
("persimmon", "PersimmonConfig"),
7677
("fuyu", "FuyuConfig"),
@@ -125,6 +126,7 @@
125126
("blip-2", "BLIP-2"),
126127
("chameleon", "Chameleon"),
127128
("clap", "CLAP"),
129+
("canine", "CANINE"),
128130
("clip", "CLIP"),
129131
("starcoder2", "Starcoder2"),
130132
("clip_vision_model", "CLIPVisionModel"),

mindone/transformers/models/auto/modeling_auto.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,7 @@
4444
("blip", "BlipModel"),
4545
("blip-2", "Blip2Model"),
4646
("starcoder2", "Starcoder2Model"),
47+
("canine", "CanineModel"),
4748
("chameleon", "ChameleonModel"),
4849
("clap", "ClapModel"),
4950
("clip", "CLIPModel"),
@@ -374,6 +375,7 @@
374375
("helium", "HeliumForSequenceClassification"),
375376
("led", "LEDForSequenceClassification"),
376377
("starcoder2", "Starcoder2ForSequenceClassification"),
378+
("canine", "CanineForSequenceClassification"),
377379
("llama", "LlamaForSequenceClassification"),
378380
("persimmon", "PersimmonForSequenceClassification"),
379381
("mobilebert", "MobileBertForSequenceClassification"),
@@ -416,6 +418,7 @@
416418
("t5", "T5ForQuestionAnswering"),
417419
("mixtral", "MixtralForQuestionAnswering"),
418420
("mpt", "MptForQuestionAnswering"),
421+
("canine", "CanineForQuestionAnswering"),
419422
("umt5", "UMT5ForQuestionAnswering"),
420423
("xlm-roberta", "XLMRobertaForQuestionAnswering"),
421424
("xlm-roberta-xl", "XLMRobertaXLForQuestionAnswering"),
@@ -456,6 +459,7 @@
456459
("roberta", "RobertaForTokenClassification"),
457460
("rembert", "RemBertForTokenClassification"),
458461
("convbert", "ConvBertForTokenClassification"),
462+
("canine", "CanineForTokenClassification"),
459463
("t5", "T5ForTokenClassification"),
460464
("umt5", "UMT5ForTokenClassification"),
461465
("xlm-roberta", "XLMRobertaForTokenClassification"),
@@ -469,6 +473,7 @@
469473
("camembert", "CamembertForMultipleChoice"),
470474
("albert", "AlbertForMultipleChoice"),
471475
("convbert", "ConvBertForMultipleChoice"),
476+
("canine", "CanineForMultipleChoice"),
472477
("bert", "BertForMultipleChoice"),
473478
("roberta", "RobertaForMultipleChoice"),
474479
("deberta-v2", "DebertaV2ForMultipleChoice"),
Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
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_canine import (
18+
CanineForMultipleChoice,
19+
CanineForQuestionAnswering,
20+
CanineForSequenceClassification,
21+
CanineForTokenClassification,
22+
CanineLayer,
23+
CanineModel,
24+
CaninePreTrainedModel,
25+
)

0 commit comments

Comments
 (0)