@@ -182,7 +182,8 @@ class CompilationConfig:
182182 backend : str = "inductor"
183183 """The backend for compilation. It needs to be a string:
184184
185- - "" (empty string): use the default backend ("inductor" on CUDA-alike platforms).
185+ - "" (empty string): use the default backend ("inductor" on CUDA-alike
186+ platforms).
186187 - "eager"/"openxla"/...: use the specified backend registered in PyTorch.
187188 - "full.module.name": a qualified name which can be used to import the
188189
@@ -192,7 +193,7 @@ class CompilationConfig:
192193 used for the compilation directly (it sees the whole graph). When the
193194 compilation level is 3, the backend is used for the piecewise compilation
194195 (it sees a part of the graph)."""
195- custom_ops : list [str ] = field (default_factory = lambda : list () )
196+ custom_ops : list [str ] = field (default_factory = list )
196197 """Fine-grained control over which custom ops to enable/disable. Use 'all'
197198 to enable all, 'none' to disable all. Also specify a list of custom op
198199 names to enable (prefixed with a '+'), or disable (prefixed with a '-').
@@ -521,13 +522,16 @@ def __post_init__(self) -> None:
521522 raise ValueError (
522523 f"Invalid backend for piecewise compilation: { self .backend } " )
523524
524- if self .backend == "" :
525- self .backend = "inductor"
526525 if self .use_inductor is not None :
527526 logger .warning_once (
528527 "The 'use_inductor' flag is deprecated and will be\
529528 removed in a future release."
530529 "Please use the 'backend' option instead." , )
530+ self .backend = "inductor" if self .use_inductor else "eager"
531+
532+ if self .backend == "" :
533+ self .backend = "inductor"
534+
531535 if count_none + count_all == 0 :
532536 if self .level > 0 and self .backend != "eager" :
533537 self .custom_ops .insert (0 , "none" )
0 commit comments