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
xuwx1
LightX2V
Commits
46e17eec
Commit
46e17eec
authored
Aug 07, 2025
by
helloyongyang
Browse files
update logs
parent
a9f0ab52
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
0 additions
and
14 deletions
+0
-14
lightx2v/utils/profiler.py
lightx2v/utils/profiler.py
+0
-14
No files found.
lightx2v/utils/profiler.py
View file @
46e17eec
...
@@ -20,36 +20,22 @@ class _ProfilingContext:
...
@@ -20,36 +20,22 @@ class _ProfilingContext:
def
__enter__
(
self
):
def
__enter__
(
self
):
torch
.
cuda
.
synchronize
()
torch
.
cuda
.
synchronize
()
if
torch
.
cuda
.
is_available
():
torch
.
cuda
.
reset_peak_memory_stats
()
self
.
start_time
=
time
.
perf_counter
()
self
.
start_time
=
time
.
perf_counter
()
return
self
return
self
def
__exit__
(
self
,
exc_type
,
exc_val
,
exc_tb
):
def
__exit__
(
self
,
exc_type
,
exc_val
,
exc_tb
):
torch
.
cuda
.
synchronize
()
torch
.
cuda
.
synchronize
()
if
torch
.
cuda
.
is_available
():
peak_memory
=
torch
.
cuda
.
max_memory_allocated
()
/
(
1024
**
3
)
# 转换为GB
logger
.
info
(
f
"[Profile]
{
self
.
rank_info
}
-
{
self
.
name
}
Peak Memory:
{
peak_memory
:.
2
f
}
GB"
)
else
:
logger
.
info
(
f
"[Profile]
{
self
.
rank_info
}
-
{
self
.
name
}
executed without GPU."
)
elapsed
=
time
.
perf_counter
()
-
self
.
start_time
elapsed
=
time
.
perf_counter
()
-
self
.
start_time
logger
.
info
(
f
"[Profile]
{
self
.
rank_info
}
-
{
self
.
name
}
cost
{
elapsed
:.
6
f
}
seconds"
)
logger
.
info
(
f
"[Profile]
{
self
.
rank_info
}
-
{
self
.
name
}
cost
{
elapsed
:.
6
f
}
seconds"
)
return
False
return
False
async
def
__aenter__
(
self
):
async
def
__aenter__
(
self
):
torch
.
cuda
.
synchronize
()
torch
.
cuda
.
synchronize
()
if
torch
.
cuda
.
is_available
():
torch
.
cuda
.
reset_peak_memory_stats
()
self
.
start_time
=
time
.
perf_counter
()
self
.
start_time
=
time
.
perf_counter
()
return
self
return
self
async
def
__aexit__
(
self
,
exc_type
,
exc_val
,
exc_tb
):
async
def
__aexit__
(
self
,
exc_type
,
exc_val
,
exc_tb
):
torch
.
cuda
.
synchronize
()
torch
.
cuda
.
synchronize
()
if
torch
.
cuda
.
is_available
():
peak_memory
=
torch
.
cuda
.
max_memory_allocated
()
/
(
1024
**
3
)
# 转换为GB
logger
.
info
(
f
"[Profile]
{
self
.
rank_info
}
-
{
self
.
name
}
Peak Memory:
{
peak_memory
:.
2
f
}
GB"
)
else
:
logger
.
info
(
f
"[Profile]
{
self
.
rank_info
}
-
{
self
.
name
}
executed without GPU."
)
elapsed
=
time
.
perf_counter
()
-
self
.
start_time
elapsed
=
time
.
perf_counter
()
-
self
.
start_time
logger
.
info
(
f
"[Profile]
{
self
.
rank_info
}
-
{
self
.
name
}
cost
{
elapsed
:.
6
f
}
seconds"
)
logger
.
info
(
f
"[Profile]
{
self
.
rank_info
}
-
{
self
.
name
}
cost
{
elapsed
:.
6
f
}
seconds"
)
return
False
return
False
...
...
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