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

Fix save_model #69

Merged
merged 1 commit into from
Mar 24, 2023
Merged

Fix save_model #69

merged 1 commit into from
Mar 24, 2023

Conversation

ypwhs
Copy link
Contributor

@ypwhs ypwhs commented Mar 24, 2023

The original save_model function saved all parameters, resulting in a file size of 6GB, while the actual Lora model is only 200MB and does not require such a large file. The modified save_model function uses the save_tunable_parameters function, which saves only the tunable parameters and reduces the saved model size to 200MB.

Before:

(base) ➜  ChatGLM-Tuning tree -h exp1
ykx_5k
├── [224M]  chatglm-lora.pt
├── [4.0K]  checkpoint-1000
│   ├── [448M]  optimizer.pt
│   ├── [6.6G]  pytorch_model.bin
│   ├── [ 14K]  rng_state_0.pth
│   ├── [ 14K]  rng_state_1.pth
│   ├── [ 14K]  rng_state_2.pth
│   ├── [ 14K]  rng_state_3.pth
│   ├── [ 14K]  rng_state_4.pth
│   ├── [ 14K]  rng_state_5.pth
│   ├── [ 14K]  rng_state_6.pth
│   ├── [ 14K]  rng_state_7.pth
│   ├── [ 557]  scaler.pt
│   ├── [ 627]  scheduler.pt
│   ├── [2.5K]  trainer_state.json
│   └── [3.5K]  training_args.bin
......

After:

(base) ➜  ChatGLM-Tuning tree -h exp2
.
├── [4.0K]  checkpoint-1000
│   ├── [224M]  chatglm-lora.pt
│   ├── [448M]  optimizer.pt
│   ├── [ 14K]  rng_state_0.pth
│   ├── [ 14K]  rng_state_1.pth
│   ├── [ 14K]  rng_state_2.pth
│   ├── [ 14K]  rng_state_3.pth
│   ├── [ 14K]  rng_state_4.pth
│   ├── [ 14K]  rng_state_5.pth
│   ├── [ 14K]  rng_state_6.pth
│   ├── [ 14K]  rng_state_7.pth
│   ├── [ 557]  scaler.pt
│   ├── [ 627]  scheduler.pt
│   ├── [2.6K]  trainer_state.json
│   └── [3.5K]  training_args.bin
......

@mymusise
Copy link
Owner

Thanks for this PR, I will merge it after test.

@mymusise mymusise merged commit f8b95d5 into mymusise:master Mar 24, 2023
@ypwhs ypwhs deleted the patch-2 branch March 27, 2023 07:58
This pull request was closed.
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

Successfully merging this pull request may close these issues.

2 participants