microsoft / DeepSpeedExamples

Example models using DeepSpeed
Apache License 2.0
5.97k stars 1.01k forks source link

Why is my model bigger after compression? #209

Open rlenain opened 1 year ago

rlenain commented 1 year ago

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

AIsimrand commented 10 months ago

Hi I'm getting the same issue while using XTC method to compress vicuna model. So could you please tell me how were you able to solve it ?