Upload handler.py with huggingface_hub
Browse files- handler.py +4 -1
handler.py
CHANGED
|
@@ -80,7 +80,10 @@ class EndpointHandler:
|
|
| 80 |
self.model.load_state_dict(state_dict, strict=False)
|
| 81 |
self.model.eval()
|
| 82 |
|
| 83 |
-
|
|
|
|
|
|
|
|
|
|
| 84 |
self.model = self.model.to(self.device)
|
| 85 |
print(f"[handler] Prithvi-EO-2.0-300M ready on {self.device}")
|
| 86 |
|
|
|
|
| 80 |
self.model.load_state_dict(state_dict, strict=False)
|
| 81 |
self.model.eval()
|
| 82 |
|
| 83 |
+
# Force CPU: prithvi_mae uses get_3d_sincos_pos_embed (numpy-sourced tensors) which
|
| 84 |
+
# land on CPU at runtime. Running model on GPU then causes a cross-device error.
|
| 85 |
+
# CPU is sufficient for 224×224 patch inference at benchmark scale.
|
| 86 |
+
self.device = torch.device("cpu")
|
| 87 |
self.model = self.model.to(self.device)
|
| 88 |
print(f"[handler] Prithvi-EO-2.0-300M ready on {self.device}")
|
| 89 |
|