Fix issue of saving full models when block compile is on
This commit is contained in:
1 parent
1beba8a96d
commit
ea47c120aa
1 file changed
+2
@@ -903,6 +903,8 @@ class OstrisModelMixin:
|
|||||||
value = value.to(dtype=dtype)
|
value = value.to(dtype=dtype)
|
||||||
state_dict[key] = value.detach().to("cpu").contiguous()
|
state_dict[key] = value.detach().to("cpu").contiguous()
|
||||||
state_dict.update(q_entries)
|
state_dict.update(q_entries)
|
||||||
|
# block_compile wraps blocks in OptimizedModule: drop its "._orig_mod." key segment
|
||||||
|
state_dict = {k.replace("._orig_mod.", "."): v for k, v in state_dict.items()}
|
||||||
state_dict = self.convert_state_dict_on_save(state_dict)
|
state_dict = self.convert_state_dict_on_save(state_dict)
|
||||||
|
|
||||||
parent = os.path.dirname(output_path)
|
parent = os.path.dirname(output_path)
|
||||||
|
|||||||
Reference in new issue
Block a user