Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
ModelZoo
FinGPT-glm_pytorch
Commits
e9a3ef66
Commit
e9a3ef66
authored
May 10, 2024
by
wanglch
Browse files
Update infernece_FinGPT.py
parent
3dd62397
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
2 additions
and
4 deletions
+2
-4
infernece_FinGPT.py
infernece_FinGPT.py
+2
-4
No files found.
infernece_FinGPT.py
View file @
e9a3ef66
...
...
@@ -3,14 +3,12 @@ import platform
import
signal
from
transformers
import
AutoTokenizer
,
AutoModel
import
readline
from
peft
import
PeftModel
base_model
=
'../FinGPT/THUDM/chatglm2-6b'
# 模型地址,可在对应模型官网进行下载模型文件,也可以直接使用huggingface的模型加载
lora
_model
=
'
../FinGPT/saves/FinGPT/pretrained_lora/fingpt-mt_chatglm2-6b_lora'
# 需要下载,本地模型预训练权重,可在 <https://huggingface.co/FinGPT>下载对应模型的预训练权重
base
_model
=
'
/home/wanglch/projects/FinGPT/FinGPT_mt_chatglm2-6b-merged'
tokenizer
=
AutoTokenizer
.
from_pretrained
(
base_model
,
trust_remote_code
=
True
)
model
=
AutoModel
.
from_pretrained
(
base_model
,
trust_remote_code
=
True
,
device_map
=
"auto"
)
lora_model
=
PeftModel
.
from_pretrained
(
model
,
lora_model
)
# 多显卡支持,使用下面两行代替上面一行,将num_gpus改为你实际的显卡数量
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment