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
OpenDAS
ColossalAI
Commits
85774f0c
"examples/git@developer.sourcefind.cn:OpenDAS/colossalai.git" did not exist on "bf0204604f61314316fdd43795ead7abf8b8c356"
Commit
85774f0c
authored
Jul 18, 2023
by
ocd_with_naming
Committed by
binmakeswell
Jul 26, 2023
Browse files
[NFC] polish colossalai/cli/benchmark/utils.py code style (#4254)
parent
dee1c963
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
6 additions
and
5 deletions
+6
-5
colossalai/cli/benchmark/utils.py
colossalai/cli/benchmark/utils.py
+6
-5
No files found.
colossalai/cli/benchmark/utils.py
View file @
85774f0c
import
math
import
math
import
time
import
time
from
typing
import
Callable
,
Dict
,
List
,
Tuple
import
torch
import
torch
from
colossalai.context
import
Config
,
ParallelMode
from
colossalai.utils
import
MultiTimer
from
colossalai.utils
import
MultiTimer
from
colossalai.context
import
ParallelMode
,
Config
from
typing
import
List
,
Dict
,
Tuple
,
Callable
def
get_time_stamp
()
->
int
:
def
get_time_stamp
()
->
int
:
...
@@ -25,8 +26,8 @@ def get_memory_states() -> Tuple[float]:
...
@@ -25,8 +26,8 @@ def get_memory_states() -> Tuple[float]:
Return the memory statistics.
Return the memory statistics.
Returns:
Returns:
max_allocated (float): the allocated CUDA memory
max_allocated (float): the allocated CUDA memory
max_cached (float): the cached CUDA memory
max_cached (float): the cached CUDA memory
"""
"""
max_allocated
=
torch
.
cuda
.
max_memory_allocated
()
/
(
1024
**
3
)
max_allocated
=
torch
.
cuda
.
max_memory_allocated
()
/
(
1024
**
3
)
...
@@ -101,7 +102,7 @@ def profile_model(model: torch.nn.Module, warmup_steps: int, profile_steps: int,
...
@@ -101,7 +102,7 @@ def profile_model(model: torch.nn.Module, warmup_steps: int, profile_steps: int,
profile_steps (int): the number of steps for profiling
profile_steps (int): the number of steps for profiling
data_func (Callable): a function to generate random data
data_func (Callable): a function to generate random data
timer (colossalai.utils.Multitimer): a timer instance for time recording
timer (colossalai.utils.Multitimer): a timer instance for time recording
Returns:
Returns:
fwd_time (float): the average forward time taken by forward pass in second
fwd_time (float): the average forward time taken by forward pass in second
bwd_time (float): the average backward time taken by forward pass in second
bwd_time (float): the average backward time taken by forward pass in second
...
...
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