diff --git a/paddleslim/nas/ofa/ofa.py b/paddleslim/nas/ofa/ofa.py index eff589a4a7eb7445851e32be7b66dc37c3f66513..3f07839090597986173aa4697fc5165176e354d0 100644 --- a/paddleslim/nas/ofa/ofa.py +++ b/paddleslim/nas/ofa/ofa.py @@ -584,8 +584,7 @@ class OFA(OFABase): t_value.set(pruned_state_dict[name], place) if super_model_state_dict != None and len(super_model_state_dict) != 0: - for k, v in super_model_state_dict.items(): - setattr(origin_model, k, v) + origin_model.set_state_dict(super_model_state_dict) return origin_model