MCPcopy Create free account
hub / github.com/QodeXcli/QodeX / _pick_device

Function _pick_device

services/reranker/server.py:73–84  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

71
72
73def _pick_device() -> str:
74 if DEVICE:
75 return DEVICE
76 try:
77 import torch
78 if torch.backends.mps.is_available():
79 return "mps" # Apple Silicon GPU
80 if torch.cuda.is_available():
81 return "cuda"
82 except Exception:
83 pass
84 return "cpu"
85
86
87# ── Lazy model load (so the server starts fast and reports readiness) ──────

Callers 1

server.pyFile · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected