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

[CLI] Use auto device map for model load #1596

Merged
merged 1 commit into from
May 2, 2024
Merged

[CLI] Use auto device map for model load #1596

merged 1 commit into from
May 2, 2024

Conversation

lewtun
Copy link
Member

@lewtun lewtun commented Apr 28, 2024

As a user of the chat CLI, I expect the model to be loaded on GPU by default instead of having to manually specify --device "cuda"

I believe this can be achieved by simply setting device_map="auto" which will also work on CPU if the user should require it.

@@ -220,7 +220,7 @@ def load_model_and_tokenizer(args):
trust_remote_code=args.trust_remote_code,
attn_implementation=args.attn_implementation,
torch_dtype=torch_dtype,
device_map=get_kbit_device_map() if quantization_config is not None else None,
Copy link
Member Author

Choose a reason for hiding this comment

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

I don't think the k-bit device map is actually needed for inference (one can shard and quantize AFAIK)

@lewtun lewtun requested a review from younesbelkada April 28, 2024 17:20
@HuggingFaceDocBuilderDev

The docs for this PR live here. All of your documentation changes will be reflected on that endpoint. The docs are available until 30 days after the last update.

Copy link
Contributor

@younesbelkada younesbelkada left a comment

Choose a reason for hiding this comment

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

sounds good, thanks !

@lewtun lewtun merged commit 5f09131 into main May 2, 2024
9 checks passed
@lewtun lewtun deleted the chat-on-gpu branch May 2, 2024 07:22
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants