Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
change
sglang
Commits
93ef9a09
Unverified
Commit
93ef9a09
authored
Oct 24, 2025
by
Muqi Li
Committed by
GitHub
Oct 24, 2025
Browse files
[Profiler] expand '~' for `torch_profiler_output_dir` (#11999)
parent
b04cd3d4
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
3 additions
and
4 deletions
+3
-4
python/sglang/srt/managers/scheduler_profiler_mixin.py
python/sglang/srt/managers/scheduler_profiler_mixin.py
+3
-4
No files found.
python/sglang/srt/managers/scheduler_profiler_mixin.py
View file @
93ef9a09
...
@@ -28,7 +28,7 @@ logger = logging.getLogger(__name__)
...
@@ -28,7 +28,7 @@ logger = logging.getLogger(__name__)
class
SchedulerProfilerMixin
:
class
SchedulerProfilerMixin
:
def
init_profiler
(
self
):
def
init_profiler
(
self
):
self
.
torch_profiler
=
None
self
.
torch_profiler
=
None
self
.
torch_profiler_output_dir
:
Optional
[
str
]
=
None
self
.
torch_profiler_output_dir
:
Optional
[
Path
]
=
None
self
.
profiler_activities
:
Optional
[
List
[
str
]]
=
None
self
.
profiler_activities
:
Optional
[
List
[
str
]]
=
None
self
.
profile_id
:
Optional
[
str
]
=
None
self
.
profile_id
:
Optional
[
str
]
=
None
self
.
profiler_start_forward_ct
:
Optional
[
int
]
=
None
self
.
profiler_start_forward_ct
:
Optional
[
int
]
=
None
...
@@ -69,7 +69,7 @@ class SchedulerProfilerMixin:
...
@@ -69,7 +69,7 @@ class SchedulerProfilerMixin:
if
activities
is
None
:
if
activities
is
None
:
activities
=
[
"CPU"
,
"GPU"
]
activities
=
[
"CPU"
,
"GPU"
]
self
.
torch_profiler_output_dir
=
output_dir
self
.
torch_profiler_output_dir
=
Path
(
output_dir
).
expanduser
()
self
.
torch_profiler_with_stack
=
with_stack
self
.
torch_profiler_with_stack
=
with_stack
self
.
torch_profiler_record_shapes
=
record_shapes
self
.
torch_profiler_record_shapes
=
record_shapes
self
.
profiler_activities
=
activities
self
.
profiler_activities
=
activities
...
@@ -213,8 +213,7 @@ class SchedulerProfilerMixin:
...
@@ -213,8 +213,7 @@ class SchedulerProfilerMixin:
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
():
self
.
torch_profiler_output_dir
.
mkdir
(
parents
=
True
,
exist_ok
=
True
)
Path
(
self
.
torch_profiler_output_dir
).
mkdir
(
parents
=
True
,
exist_ok
=
True
)
stage_suffix
=
f
"-
{
stage
.
name
}
"
if
stage
else
""
stage_suffix
=
f
"-
{
stage
.
name
}
"
if
stage
else
""
logger
.
info
(
"Stop profiling"
+
stage_suffix
+
"..."
)
logger
.
info
(
"Stop profiling"
+
stage_suffix
+
"..."
)
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment