From 4623dc4d2e36b27b20059e3690ae156dcc55735c Mon Sep 17 00:00:00 2001 From: ceci3 Date: Fri, 19 Nov 2021 14:28:15 +0800 Subject: [PATCH] fix ofa export (#921) --- paddleslim/nas/ofa/ofa.py | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/paddleslim/nas/ofa/ofa.py b/paddleslim/nas/ofa/ofa.py index eff589a4..3f078390 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 -- GitLab