File tree Expand file tree Collapse file tree 1 file changed +11
-1
lines changed Expand file tree Collapse file tree 1 file changed +11
-1
lines changed Original file line number Diff line number Diff line change @@ -342,9 +342,19 @@ def serialize(
342
342
)
343
343
else :
344
344
example_inputs = b""
345
+
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
345
355
return export_serialize ._SerializedProgram (
346
356
serialized_ep ,
347
- export_serialize .serialize_torch_artifact (exported_program . state_dict ),
357
+ export_serialize .serialize_torch_artifact (new_state_dict ),
348
358
export_serialize .serialize_torch_artifact (constants ),
349
359
example_inputs ,
350
360
)
You can’t perform that action at this time.
0 commit comments