-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmodule_setup.py
51 lines (45 loc) · 2.72 KB
/
module_setup.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
# -*- coding: utf-8 -*-
# @Time: 23:34
# @Author: tk
# @File:model_setup
import os
from deep_training.utils.hf import register_transformer_model,register_transformer_config
from config import *
_model_card = (config_args["model_name_or_path"] or config_args["config_name"])
_model_card = _model_card.split('/')[-1].lower() if os.path.isdir(_model_card) else str(os.path.dirname(_model_card)).split('/')[-1].lower()
assert "7b" in _model_card or "13b" in _model_card
if "baichuan2" in _model_card:
if "7b" in _model_card:
from deep_training.zoo.model_zoo.baichuan.baichuan2_7b.llm_model import (MyTransformer,PetlArguments, # noqa
LoraConfig,PetlModel,
PromptArguments,
BaichuanConfig,
BaichuanTokenizer)
else:
from deep_training.zoo.model_zoo.baichuan.baichuan2_13b.llm_model import (MyTransformer, PetlArguments, # noqa
LoraConfig,PetlModel,
PromptArguments,
BaichuanConfig,
BaichuanTokenizer)
else:
if "7b" in _model_card:
from deep_training.zoo.model_zoo.baichuan.baichuan_7b.llm_model import (MyTransformer, PetlArguments, # noqa
LoraConfig, PetlModel,
PromptArguments,
BaichuanConfig,
BaichuanTokenizer)
else:
from deep_training.zoo.model_zoo.baichuan.baichuan_13b.llm_model import (MyTransformer, PetlArguments, # noqa
LoraConfig, PetlModel,
PromptArguments,
BaichuanConfig,
BaichuanTokenizer)
del _model_card
__all__ = [
"module_setup"
]
def module_setup():
pass
# 导入模型
#register_transformer_config(XverseConfig)
# register_transformer_model(LlamaForCausalLM, AutoModelForCausalLM)