Tiny allow profiler API to auto create directory (#6865)

This commit is contained in:
fzyzcjy
2025-06-05 15:07:03 +08:00
committed by GitHub
parent 0de5e7d40f
commit bcf66ef3e1

View File

@@ -24,6 +24,7 @@ from collections import defaultdict, deque
from concurrent import futures
from dataclasses import dataclass
from http import HTTPStatus
from pathlib import Path
from types import SimpleNamespace
from typing import Dict, List, Optional, Tuple, Union
@@ -2283,6 +2284,9 @@ class Scheduler(
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 ""
logger.info("Stop profiling" + stage_suffix + "...")
if self.torch_profiler is not None: