Skip to content

Commit

Permalink
fix cpu use (#693)
Browse files Browse the repository at this point in the history
  • Loading branch information
Picus303 authored Dec 2, 2024
1 parent 1359896 commit 65e2531
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 0 deletions.
5 changes: 5 additions & 0 deletions tools/api.py
Original file line number Diff line number Diff line change
Expand Up @@ -871,6 +871,11 @@ def initialize_app(app: Kui):
args = parse_args() # args same as ones in other processes
args.precision = torch.half if args.half else torch.bfloat16

# Check if CUDA is available
if not torch.cuda.is_available():
logger.info("CUDA is not available, running on CPU.")
args.device = "cpu"

if args.load_asr_model:
logger.info(f"Loading ASR model...")
asr_model = load_asr_model(device=args.device)
Expand Down
5 changes: 5 additions & 0 deletions tools/webui.py
Original file line number Diff line number Diff line change
Expand Up @@ -510,6 +510,11 @@ def parse_args():
args = parse_args()
args.precision = torch.half if args.half else torch.bfloat16

# Check if CUDA is available
if not torch.cuda.is_available():
logger.info("CUDA is not available, running on CPU.")
args.device = "cpu"

logger.info("Loading Llama model...")
llama_queue = launch_thread_safe_queue(
checkpoint_path=args.llama_checkpoint_path,
Expand Down

0 comments on commit 65e2531

Please sign in to comment.