[Distributed] Make it clear that % should not be in tensor dict keys. (#5927)

Signed-off-by: Xiaowei Jiang <xwjiang2010@gmail.com>
This commit is contained in:
xwjiang2010
2024-06-28 15:20:22 +00:00
committed by GitHub
parent 3b752a6555
commit b90d8cd832
2 changed files with 12 additions and 1 deletions
+3
View File
@@ -58,6 +58,9 @@ def _split_tensor_dict(
metadata_list: List[Tuple[str, Any]] = []
tensor_list = []
for key, value in tensor_dict.items():
assert "%" not in key, (
"Avoid having '%' in key "
"as it is used as a separator for nested entries.")
if isinstance(value, torch.Tensor):
# Note: we cannot use `value.device` here,
# because it contains not only the device type but also the device