Skip to content

Commit ba90004

Browse files
authored
Merge pull request #257 from NeuroBench/refactor-nir
refactor nit import
2 parents 1b45447 + 7dcb159 commit ba90004

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

neurobench/benchmarks/benchmark.py

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,6 @@
2121
import snntorch
2222
from torch import Tensor
2323
import torch
24-
import nir
2524

2625

2726
class Benchmark:
@@ -228,6 +227,12 @@ def to_nir(self, dummy_input: Tensor, filename: str, **kwargs) -> None:
228227
If the installed version of `snntorch` is less than `0.9.0`.
229228
230229
"""
230+
try:
231+
import nir
232+
except ImportError:
233+
raise ImportError(
234+
"Exporting to NIR requires the `nir` package. Install it using `pip install nir`."
235+
)
231236
if snntorch.__version__ < "0.9.0":
232237
raise ValueError("Exporting to NIR requires snntorch version >= 0.9.0")
233238

0 commit comments

Comments
 (0)