Skip to content

Commit b6cb276

Browse files
Cache dir fix
1 parent 52cc3d2 commit b6cb276

File tree

1 file changed

+7
-3
lines changed

1 file changed

+7
-3
lines changed

model_navigator/runners/torch.py

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -392,14 +392,18 @@ def deactivate_impl(self):
392392

393393
def set_cache_dir(self):
394394
"""For each runner name there is separate cache dir."""
395-
workspace = ctx.global_context.get(ctx.INPLACE_OPTIMIZE_WORKSPACE_CONTEXT_KEY)
395+
torch_inductor_cache_dir = os.environ.get("TORCHINDUCTOR_CACHE_DIR")
396+
if torch_inductor_cache_dir:
397+
LOGGER.debug("TORCHINDUCTOR_CACHE_DIR: {} set by the user.", torch_inductor_cache_dir)
398+
return
396399

400+
workspace = ctx.global_context.get(ctx.INPLACE_OPTIMIZE_WORKSPACE_CONTEXT_KEY)
397401
if workspace:
398402
workspace = pathlib.Path(workspace)
399403
else:
400-
workspace = pathlib.Path("/tmp/model_navigator/torch_compile_cache")
404+
workspace = pathlib.Path("/tmp/model_navigator/.torch_compile_cache")
401405

402-
workspace = workspace / self.name()
406+
workspace = workspace / self.name() / ".torch_compile_cache"
403407
workspace.mkdir(parents=True, exist_ok=True)
404408

405409
os.environ["TORCHINDUCTOR_CACHE_DIR"] = str(workspace)

0 commit comments

Comments
 (0)