Skip to content

Commit

Permalink
Bug fix: Enable fast to override quantize json (#1377)
Browse files Browse the repository at this point in the history
* Bug fix: Enable fast to override quantize json

* collapse conditional
  • Loading branch information
Jack-Khuu authored Nov 20, 2024
1 parent 8dccc5a commit b809b69
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions torchchat/cli/cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -533,16 +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:
if executor_handler["accelerator"] != args.device:
print('overriding json-specified device {executor_handler["accelerator"]} with cli device {args.device}')
executor_handler["accelerator"] = args.device
if executor_handler and executor_handler["accelerator"] != 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:
if getattr(args, "compile", False) or getattr(args, "compile_prefill", False):
Expand Down

0 comments on commit b809b69

Please sign in to comment.