From a3dec31fb33b1bbd036a710af7a97c09f387b8ad Mon Sep 17 00:00:00 2001 From: Tarun Karuturi Date: Tue, 13 Feb 2024 00:54:53 -0800 Subject: [PATCH] Fix serialize_metadata Summary: Similar to https://github.com/pytorch/pytorch/pull/118031 Reviewed By: chakriu, angelayi Differential Revision: D53681935 fbshipit-source-id: d05e93902374984ec58fe419631bf07110bf4e95 --- exir/serde/export_serialize.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/exir/serde/export_serialize.py b/exir/serde/export_serialize.py index 79a5c12722..ab24688379 100644 --- a/exir/serde/export_serialize.py +++ b/exir/serde/export_serialize.py @@ -459,7 +459,10 @@ def export_nn_module_stack(val): path, ty = val assert isinstance(path, str) - normalized_ty = ty.__module__ + "." + ty.__qualname__ + if isinstance(ty, str): + normalized_ty = ty + else: + normalized_ty = ty.__module__ + "." + ty.__qualname__ return path + "," + normalized_ty # Serialize to "key,orig_path,type_str"