MCPcopy Create free account
hub / github.com/algorithmicsuperintelligence/optillm / get_device

Function get_device

optillm/cot_decoding.py:6–12  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

4import numpy as np
5
6def get_device():
7 if torch.backends.mps.is_available():
8 return torch.device("mps")
9 elif torch.cuda.is_available():
10 return torch.device("cuda")
11 else:
12 return torch.device("cpu")
13
14def calculate_confidence(logits: List[torch.Tensor], answer_ids: torch.Tensor) -> float:
15 """

Callers 1

cot_decodeFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected