deepspeedai / deepspeedai/DeepSpeedExamples
Why is my model bigger after compression?
Nobody has claimed this yet.
- Dominant language
- Python
- Stars
- 6.8k
- Forks
- 1.1k
- Avg merge
- 2d 16h
- Merged PRs (30d)
- 1
Description
Hello,
I am using this config on a translation model (Helsinki-NLP/opus-mt-zh-en), and I check the size of the model using the following function before and after running init_compression and deepspeed.initialize:
def print_size_of_model(model, label=""):
torch.save(model.state_dict(), "temp.p")
size=os.path.getsize("temp.p")
print("model: ",label,' \t','Size (KB):', size/1e3)
os.remove('temp.p')
return size
Weirdly, the size of the model increases after running init_compression and deepspeed.initialize. Even after I use redundancy_clean at the end of training and save the model to disk, the size of the model stays what had been returned by print_size_of_model after running init_compression and deepspeed.initialize.
Am I missing something? Can you please explain?
Thanks a lot
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with model_compression/bert/config/XTC/ds_config_W1A8_Qgroup1_fp32.json and reproduce the reported size comparison around init_compression and deepspeed.initialize using the provided print_size_of_model function. Trace the resulting state_dict and redundancy_clean behavior; done means explaining why the serialized model grows and whether the final saved size is expected.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- python, pytorch
- Domain
- machine-learning
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 28/100