Skip to content

Commit

Permalink
Wrapped with try-except
Browse files Browse the repository at this point in the history
  • Loading branch information
xeon27 committed Mar 15, 2024
1 parent 5c91e46 commit 78c2803
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions kronfluence/computer/computer.py
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@
find_executable_batch_size,
make_indices_partition,
)
from kronfluence.utils.exceptions import FactorsNotFoundError, UnsupportableModuleError
from kronfluence.utils.exceptions import FactorsNotFoundError, UnsupportableModuleError, TrackedModuleNotFoundError
from kronfluence.utils.logger import PassThroughProfiler, Profiler, get_logger, get_time
from kronfluence.utils.save import (
FACTOR_ARGUMENTS_NAME,
Expand Down Expand Up @@ -80,8 +80,9 @@ def __init__(
self.model.eval()
self.task = task

tracked_module_names = get_tracked_module_names(self.model)
if len(tracked_module_names) == 0:
try:
tracked_module_names = get_tracked_module_names(self.model)
except TrackedModuleNotFoundError:
error_msg = (
f"No tracked modules found in the provided model: {self.model}. "
f"Please make sure to run `prepare_model` before passing it in to the "
Expand Down

0 comments on commit 78c2803

Please sign in to comment.