Skip to content
This repository was archived by the owner on Sep 10, 2025. It is now read-only.
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions torchchat/cli/cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -533,15 +533,16 @@ def arg_init(args):
# Localized import to minimize expensive imports
from torchchat.utils.build_utils import get_device_str

if args.device is None or args.device == "fast":
if args.device is None:
args.device = get_device_str(
args.quantize.get("executor", {}).get("accelerator", default_device)
)
else:
args.device = get_device_str(args.device)
executor_handler = args.quantize.get("executor", None)
if executor_handler:
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

consider merging this if statement with below if:

Suggested change
if executor_handler:
if executor_handler and executor_handler["accelerator"] != args.device:

if executor_handler["accelerator"] != args.device:
print('overriding json-specified device {executor_handler["accelerator"]} with cli device {args.device}')
print(f'overriding json-specified device {executor_handler["accelerator"]} with cli device {args.device}')
executor_handler["accelerator"] = args.device

if "mps" in args.device:
Expand Down
Loading