Skip to content

Commit

Permalink
Allow unassociated weight during trace; Instead of terminating with a…
Browse files Browse the repository at this point in the history
…n error only raise a warning (#92)
  • Loading branch information
jimgao1 authored Dec 16, 2024
1 parent b461f36 commit 46e237c
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions deepview_profile/tracking/breakdown.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import collections
import math
import os
import warnings

HierarchicalBreakdown = collections.namedtuple(
'HierarchicalBreakdown', ['operations', 'weights', 'peak_usage_bytes'])
Expand Down Expand Up @@ -48,8 +49,7 @@ def add_activation_entry(self, operation_name, size_bytes, stack_context):
def add_weight_entry(
self, weight_name, size_bytes, grad_size_bytes, stack_context):
if len(stack_context.frames) == 0:
raise ValueError(
'Adding weight entry with no context to the breakdown.')
warnings.warn(f"{weight_name} has no accociated context")

for entry in self._traverse_and_insert(
self._weight_root, weight_name, stack_context):
Expand Down

0 comments on commit 46e237c

Please sign in to comment.