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

[Help] ptu微调之后,模型加载要5,6分钟有什么办法可以提升速度呢 #1460

Open
1 task done
1042312930 opened this issue Feb 22, 2024 · 0 comments
Open
1 task done

Comments

@1042312930
Copy link

Is there an existing issue for this?

  • I have searched the existing issues

Current Behavior

加载代码如下
tokenizer = AutoTokenizer.from_pretrained("THUDM\chatglm-6b", trust_remote_code=True)
two_model = AutoModel.from_pretrained("THUDM\chatglm-6b", trust_remote_code=True)
two_prefix_state_dict = torch.load(os.path.join("ptuning/output/adgen-pt-128-2e-2-405sql_train/checkpoint-500", "pytorch_model.bin"))

two_new_prefix_state_dict = {}
for k, v in two_prefix_state_dict.items():
if k.startswith("transformer.prefix_encoder."):
two_new_prefix_state_dict[k[len("transformer.prefix_encoder."):]] = v
two_model.transformer.prefix_encoder.load_state_dict(two_new_prefix_state_dict)

Comment out the following line if you don't use quantization

two_model = two_model.quantize(4)
two_model = two_model.half().cuda()
two_model.transformer.prefix_encoder.float()
two_model = two_model.eval()

Expected Behavior

No response

Steps To Reproduce

训练完成后加载模型(训练的权重也加上)

Environment

- OS:
- Python:3.9
- CUDA Support
- 内存 16G
- GPU 12G

Anything else?

No response

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