Merge pull request #66 from Ivan-Inby/bugfix/fallback-to-cpu-if-no-cuda

fix: fallback to CPU when CUDA is not available
This commit is contained in:
Hao Feng 2025-06-15 22:05:53 +08:00 committed by GitHub
commit cb1c409cea
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -93,7 +93,8 @@ class DOLPHIN:
ckpt = try_rename_lagacy_weights(ckpt)
self.model.load_state_dict(ckpt, strict=True)
self.model.to("cuda")
device = "cuda" if torch.cuda.is_available() else "cpu"
self.model.to(device)
self.model.eval()
transform_args = {
"input_size": self.swin_args["img_size"],