princeton-nlp / CoFiPruning

[ACL 2022] Structured Pruning Learns Compact and Accurate Models https://arxiv.org/abs/2204.00408
MIT License
188 stars 32 forks source link

potential bug loading a pruned model with no masks #22

Closed ctsan closed 1 year ago

ctsan commented 2 years ago

load_pruned_model in the cofi_utils file seems to take a model as a first argument, however load_model(..) calls load_pruned_model by passing a string. In this case the program crashes as the string doesn't have a "config" property for example

ctsan commented 2 years ago

I also noticed that actually load_pruned_model sometimes is called with model_path, and model_class arguments and sometimes is called with model and weights arguments. Maybe this was changed but some things were not updated?

xiamengzhou commented 1 year ago

Hi,

Sorry for the late reply!!

For the first issue, I think load_model is always used for loading a model along with the masks zs. If zs is not provided, as you said, the program crashes. I updated the function to remove the second path, which is never triggered in the codebase. Sorry for the confusion!

For the second issue, yes! I think only in test.py file, load_pruned_model is called with model_path and model_class, which is a deprecated use.

Let me know if you have more questions and I am happy to help!