Skip to content

Commit

Permalink
Don't require torch in mira.core.
Browse files Browse the repository at this point in the history
  • Loading branch information
faustomorales committed Mar 4, 2022
1 parent bb9b56f commit ca89924
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion mira/core/callbacks.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
import typing

import torch
try:
import torch
except ImportError:
torch = None # type: ignore
import pandas as pd
import typing_extensions as tx

Expand Down Expand Up @@ -31,6 +34,8 @@ def best_weights(
maximizes it).
key: What name to use for the saved flag.
"""
if torch is None:
raise ValueError("You must install pytorch to use this callback.")

def callback(detector, summaries):
saved = False
Expand Down

0 comments on commit ca89924

Please sign in to comment.