Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bug fix: Enable fast to override quantize json #1377

Merged
merged 2 commits into from
Nov 20, 2024
Merged

Bug fix: Enable fast to override quantize json #1377

merged 2 commits into from
Nov 20, 2024

Conversation

Jack-Khuu
Copy link
Contributor

Follow up fix for: 4697764

We want to allow "fast" to work as a manual overwrite of a --quantize accelerator config, which the previous PR disabled while fixing a different bug


No overwrite

python3 torchchat.py generate llama3.1 --quantize '{"precision": {"dtype":"float16"}, "executor":{"accelerator":"mps"}}'

NumExpr defaulting to 10 threads.
PyTorch version 2.6.0.dev20241002 available.
lm_eval is not installed, GPTQ may not be usable
Using device=mps

Overwrite with device arg

python3 torchchat.py generate llama3.1 --quantize '{"precision": {"dtype":"float16"}, "executor":{"accelerator":"mps"}}' --device cpu

overriding json-specified device mps with cli device cpu
NumExpr defaulting to 10 threads.
PyTorch version 2.6.0.dev20241002 available.
lm_eval is not installed, GPTQ may not be usable
Using device=cpu Apple M1 Max

Overwrite with fast arg

python3 torchchat.py generate llama3.1 --quantize '{"precision": {"dtype":"float16"}, "executor":{"accelerator":"cpu"}}' --device fast

overriding json-specified device cpu with cli device mps
NumExpr defaulting to 10 threads.
PyTorch version 2.6.0.dev20241002 available.
lm_eval is not installed, GPTQ may not be usable
Using device=mps

Run with fast arg (same as running without device arg)

python3 torchchat.py generate llama3.1 --device fast

NumExpr defaulting to 10 threads.
PyTorch version 2.6.0.dev20241002 available.
lm_eval is not installed, GPTQ may not be usable
Using device=mps

Copy link

pytorch-bot bot commented Nov 15, 2024

🔗 Helpful Links

🧪 See artifacts and rendered test results at hud.pytorch.org/pr/pytorch/torchchat/1377

Note: Links to docs will display an error until the docs builds have been completed.

❗ 1 Active SEVs

There are 1 currently active SEVs. If your PR is affected, please view them below:

✅ No Failures

As of commit 8db4b72 with merge base 4697764 (image):
💚 Looks good so far! There are no failures yet. 💚

This comment was automatically generated by Dr. CI and updates every 15 minutes.

@facebook-github-bot facebook-github-bot added the CLA Signed This label is managed by the Meta Open Source bot. label Nov 15, 2024
@Jack-Khuu
Copy link
Contributor Author

cc: @mikekgfb

@Jack-Khuu Jack-Khuu requested review from byjlw, Gasoonjia and vmpuri and removed request for byjlw November 15, 2024 02:37
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:

@Jack-Khuu Jack-Khuu merged commit b809b69 into main Nov 20, 2024
54 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
CLA Signed This label is managed by the Meta Open Source bot.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants