Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

训练后加载跑,无效果,请看看这样对吗 #17

Open
dragononly opened this issue Jun 30, 2023 · 0 comments
Open

训练后加载跑,无效果,请看看这样对吗 #17

dragononly opened this issue Jun 30, 2023 · 0 comments

Comments

@dragononly
Copy link

@st.cache_resource
def get_model():
tokenizer = AutoTokenizer.from_pretrained("chatglm2-6b", trust_remote_code=True)
model = AutoModel.from_pretrained("chatglm2-6b", trust_remote_code=True).cuda()
model = PeftModel.from_pretrained(model, "weights/sentiment_comp_ie_chatglm2").half()
# 多显卡支持,使用下面两行代替上面一行,将num_gpus改为你实际的显卡数量
# from utils import load_model_on_gpus
# model = load_model_on_gpus("chatglm2-6b", num_gpus=2)
model = model.eval()
return tokenizer, model

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant