(args: argparse.Namespace)
| 213 | |
| 214 | |
| 215 | def 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 | |
| 225 | def sync_device(device: str) -> None: |
no test coverage detected