Skip to content

Commit cb47733

Browse files
committed
fix load_torch_model
1 parent 8d76a81 commit cb47733

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

bioimageio/core/backends/pytorch_backend.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -113,7 +113,7 @@ def load_torch_model(
113113
network = arch(**model_kwargs)
114114
if not isinstance(network, nn.Module):
115115
raise ValueError(
116-
f"calling {weight_spec.architecture.callable} did not return a torch.nn.Module"
116+
f"calling {weight_spec.architecture.callable_name if isinstance(weight_spec.architecture, (v0_4.CallableFromFile, v0_4.CallableFromDepencency)) else weight_spec.architecture.callable} did not return a torch.nn.Module"
117117
)
118118

119119
if load_state or devices:
@@ -153,7 +153,7 @@ def get_devices(
153153
) -> List[torch.device]:
154154
if not devices:
155155
torch_devices = [
156-
(torch.device("cuda") if torch.cuda.is_available() else torch.device("cpu"))
156+
torch.device("cuda") if torch.cuda.is_available() else torch.device("cpu")
157157
]
158158
else:
159159
torch_devices = [torch.device(d) for d in devices]

0 commit comments

Comments
 (0)