From fd8f8780fac68d959df0bf521f1b76aac35f88fd Mon Sep 17 00:00:00 2001 From: Fangjun Kuang Date: Wed, 21 May 2025 12:04:57 +0800 Subject: [PATCH] Fix logging torch.dtype. (#1947) --- icefall/utils.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/icefall/utils.py b/icefall/utils.py index aab479e56..ffb926566 100644 --- a/icefall/utils.py +++ b/icefall/utils.py @@ -186,7 +186,7 @@ class AttributeDict(dict): tmp = {} for k, v in self.items(): # PosixPath is ont JSON serializable - if isinstance(v, pathlib.Path) or isinstance(v, torch.device): + if isinstance(v, (pathlib.Path, torch.device, torch.dtype)): v = str(v) tmp[k] = v return json.dumps(tmp, indent=indent, sort_keys=True)