Tiny allow profiler API to auto create directory (#6865)
This commit is contained in:
@@ -24,6 +24,7 @@ from collections import defaultdict, deque
|
|||||||
from concurrent import futures
|
from concurrent import futures
|
||||||
from dataclasses import dataclass
|
from dataclasses import dataclass
|
||||||
from http import HTTPStatus
|
from http import HTTPStatus
|
||||||
|
from pathlib import Path
|
||||||
from types import SimpleNamespace
|
from types import SimpleNamespace
|
||||||
from typing import Dict, List, Optional, Tuple, Union
|
from typing import Dict, List, Optional, Tuple, Union
|
||||||
|
|
||||||
@@ -2283,6 +2284,9 @@ class Scheduler(
|
|||||||
message="Profiling is not in progress. Call /start_profile first.",
|
message="Profiling is not in progress. Call /start_profile first.",
|
||||||
)
|
)
|
||||||
|
|
||||||
|
if not Path(self.torch_profiler_output_dir).exists():
|
||||||
|
Path(self.torch_profiler_output_dir).mkdir(parents=True, exist_ok=True)
|
||||||
|
|
||||||
stage_suffix = f"-{stage.__str__()}" if stage else ""
|
stage_suffix = f"-{stage.__str__()}" if stage else ""
|
||||||
logger.info("Stop profiling" + stage_suffix + "...")
|
logger.info("Stop profiling" + stage_suffix + "...")
|
||||||
if self.torch_profiler is not None:
|
if self.torch_profiler is not None:
|
||||||
|
|||||||
Reference in New Issue
Block a user