MCPcopy Create free account
hub / github.com/0xShug0/audio.cpp / normalize_device

Function normalize_device

tests/stable_audio/stable_audio_python_warm_bench.py:215–222  ·  view source on GitHub ↗
(args: argparse.Namespace)

Source from the content-addressed store, hash-verified

213
214
215def normalize_device(args: argparse.Namespace) -> str:
216 torch.set_num_threads(max(1, args.threads))
217 if args.backend == "cpu":
218 return "cpu"
219 if not torch.cuda.is_available():
220 raise RuntimeError("Stable Audio warmbench requested CUDA, but torch.cuda.is_available() is false")
221 torch.cuda.set_device(args.device)
222 return f"cuda:{args.device}"
223
224
225def sync_device(device: str) -> None:

Callers 1

mainFunction · 0.70

Calls 2

maxFunction · 0.85
set_num_threadsMethod · 0.80

Tested by

no test coverage detected