[torch.compile] serialize cudagraph_mode as its enum name instead of value (#25868)

Signed-off-by: zjy0516 <riverclouds.zhu@qq.com>
This commit is contained in:
Jiangyun Zhu
2025-09-29 21:54:52 +08:00
committed by GitHub
parent 8616300ae2
commit 43227236ec

View File

@@ -73,6 +73,9 @@ class CUDAGraphMode(enum.Enum):
CUDAGraphMode.NONE, CUDAGraphMode.PIECEWISE, CUDAGraphMode.FULL CUDAGraphMode.NONE, CUDAGraphMode.PIECEWISE, CUDAGraphMode.FULL
] ]
def __str__(self) -> str:
return self.name
@config @config
@dataclass @dataclass
@@ -417,10 +420,11 @@ class CompilationConfig:
if pass_config_exclude: if pass_config_exclude:
exclude["pass_config"] = pass_config_exclude exclude["pass_config"] = pass_config_exclude
return TypeAdapter(CompilationConfig).dump_json( config = TypeAdapter(CompilationConfig).dump_python(self,
self, exclude=exclude,
exclude=exclude, # type: ignore[arg-type] exclude_unset=True)
exclude_unset=True).decode()
return str(config)
__str__ = __repr__ __str__ = __repr__