Skip to content

Commit 2405f74

Browse files
authored
Remove Proxy from exported programs and modules
Differential Revision: D60940832 Pull Request resolved: #4598
1 parent d04c9d6 commit 2405f74

File tree

1 file changed

+1
-10
lines changed

1 file changed

+1
-10
lines changed

exir/serde/serialize.py

Lines changed: 1 addition & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -343,18 +343,9 @@ def serialize(
343343
else:
344344
example_inputs = b""
345345

346-
# TODO (shangdi): change to use `torch._export.utils.remove_proxy_from_state_dict`
347-
# after pytorch repo is updated.
348-
# Proxy cannot be dumped, so we remove them.
349-
new_state_dict = {}
350-
for k, v in exported_program.state_dict.items():
351-
if "proxy" in v.__dict__:
352-
new_state_dict[k] = v.clone().detach()
353-
else:
354-
new_state_dict[k] = v
355346
return export_serialize._SerializedProgram(
356347
serialized_ep,
357-
export_serialize.serialize_torch_artifact(new_state_dict),
348+
export_serialize.serialize_torch_artifact(exported_program.state_dict),
358349
export_serialize.serialize_torch_artifact(constants),
359350
example_inputs,
360351
)

0 commit comments

Comments
 (0)