Skip to content

Commit

Permalink
add doctsring to profiler
Browse files Browse the repository at this point in the history
  • Loading branch information
drisspg committed Jun 3, 2024
1 parent 1b105c1 commit 1134a7c
Showing 1 changed file with 12 additions and 1 deletion.
13 changes: 12 additions & 1 deletion transformer_nuggets/utils/benchmark.py
Original file line number Diff line number Diff line change
Expand Up @@ -177,7 +177,18 @@ def profiler(
profile_memory: bool = False,
with_stack: bool = True,
):
"""Thin wrapper around torch.profiler"""
"""Thin wrapper around torch.profiler
Args:
path: The path to save the trace file to
record_shapes: Record shapes of tensors
profile_memory: Profile memory usage
with_stack: Record stack traces
Usage:
with profiler(Path("trace.json")):
# code to profile
"""
assert path.is_file(), f"{path} is not a file."
path = path.with_suffix(".json")
# make parent dir if it doesn't exist
Expand Down

0 comments on commit 1134a7c

Please sign in to comment.