Skip to content

Commit 612cc3f

Browse files
committed
add bitnet model
1 parent 8f6e9c9 commit 612cc3f

File tree

8 files changed

+708
-0
lines changed

8 files changed

+708
-0
lines changed

mindone/transformers/__init__.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -222,6 +222,7 @@
222222
BioGptPreTrainedModel,
223223
)
224224
from .models.bit import BitBackbone
225+
from .models.bitnet import BitNetForCausalLM, BitNetModel, BitNetPreTrainedModel
225226
from .models.blenderbot import (
226227
BlenderbotForCausalLM,
227228
BlenderbotForConditionalGeneration,

mindone/transformers/models/__init__.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@
3333
bigbird_pegasus,
3434
biogpt,
3535
bit,
36+
bitnet,
3637
blip,
3738
blip_2,
3839
bloom,

mindone/transformers/models/auto/configuration_auto.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,7 @@
4949
("bert-generation", "BertGenerationConfig"),
5050
("biogpt", "BioGptConfig"),
5151
("bit", "BitConfig"),
52+
("bitnet", "BitNetConfig"),
5253
("blenderbot", "BlenderbotConfig"),
5354
("blenderbot-small", "BlenderbotSmallConfig"),
5455
("blip", "BlipConfig"),
@@ -316,6 +317,7 @@
316317
("bert-generation", "Bert Generation"),
317318
("biogpt", "BioGpt"),
318319
("bit", "BiT"),
320+
("bitnet", "BitNet"),
319321
("blenderbot", "Blenderbot"),
320322
("blenderbot-small", "BlenderbotSmall"),
321323
("blip", "BLIP"),

mindone/transformers/models/auto/modeling_auto.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,7 @@
4545
("bert-generation", "BertGenerationEncoder"),
4646
("bert", "BertModel"),
4747
("bit", "BitModel"),
48+
("bitnet", "BitNetModel"),
4849
("blenderbot", "BlenderbotModel"),
4950
("blenderbot-small", "BlenderbotSmallModel"),
5051
("blip", "BlipModel"),
@@ -415,6 +416,7 @@
415416
("bamba", "BambaForCausalLM"),
416417
("bart", "BartForCausalLM"),
417418
("biogpt", "BioGptForCausalLM"),
419+
("bitnet", "BitNetForCausalLM"),
418420
("camembert", "CamembertForCausalLM"),
419421
("bert", "BertLMHeadModel"),
420422
("bert-generation", "BertGenerationDecoder"),
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
# Copyright 2025 The BitNet Team and The HuggingFace Inc. 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_bitnet import *

0 commit comments

Comments
 (0)