Update model evaluation to use gpu for on the cloud
Change model evaluation to use available device (CPU or CUDA).
This commit is contained in:
+3
-2
@@ -79,7 +79,8 @@ def _load_model(model_name: str):
|
||||
except AttributeError:
|
||||
model = constructor(pretrained=True)
|
||||
|
||||
model.eval().cpu()
|
||||
device = "cuda" if torch.cuda.is_available() else "cpu"
|
||||
model.eval().to(device)
|
||||
# Deep clone all params and buffers to ensure no inference tensors remain
|
||||
for param in model.parameters():
|
||||
param.data = param.data.clone()
|
||||
@@ -490,4 +491,4 @@ NODE_DISPLAY_NAME_MAPPINGS = {
|
||||
"SaliencyMap": "Saliency Map (PAIR)",
|
||||
"SaliencyComparison": "Saliency Comparison Grid (PAIR)",
|
||||
"SaliencyArt": "Explainable AI",
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user