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

Function select_device

tests/vibevoice/vibevoice_python_warm_bench.py:140–147  ·  view source on GitHub ↗
(args: argparse.Namespace)

Source from the content-addressed store, hash-verified

138
139
140def select_device(args: argparse.Namespace) -> str:
141 torch.set_num_threads(max(1, args.threads))
142 if args.backend == "cuda":
143 if not torch.cuda.is_available():
144 raise RuntimeError("VibeVoice warmbench requested CUDA, but torch.cuda.is_available() is false")
145 torch.cuda.set_device(args.device)
146 return f"cuda:{args.device}"
147 return "cpu"
148
149
150def seed_all(seed: int, backend: str) -> None:

Callers 1

mainFunction · 0.70

Calls 2

maxFunction · 0.85
set_num_threadsMethod · 0.80

Tested by

no test coverage detected