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

Speed up torch engine w8a8 model init #1088

Merged
merged 7 commits into from
Feb 2, 2024
Merged

Conversation

yinfan98
Copy link
Contributor

When using w8a8 model, it will cost a bunch of time for model loading. I found that when using

QRMSNorm.from_float()
## or
QLinear.from_float()

this func cal the per_channel_quant to get the scale and quanted weight, but it is useless. Because the para not load to model yet, it is just cal for all the zero... so I fix it when init the model on inference stage.

time cost(s)
cal the scale and weight 17
dont cal 0.08

And I tested it on internLM and internLM2

@HIT-cwh
Copy link
Collaborator

HIT-cwh commented Feb 1, 2024

Hi @yinfan98 !
Thank you for your contribution, we truly appreciate it. We are just a small step away from achieving success. For the next steps, please refer to this document to configure the pre-commit then proceed to complete the lint check. We are looking forward to seeing the completion.

"""Class method to create a QLinear instance from a floating-point
module."""
module. initialization for dummy init."""
Copy link
Collaborator

Choose a reason for hiding this comment

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

It seems that initialization = True means real init and initialization = False means dummy init?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@HIT-cwh, yes

yinfan98 and others added 3 commits February 1, 2024 15:57
@lvhan028
Copy link
Collaborator

lvhan028 commented Feb 2, 2024

Hi, @yinfan98 thanks very much for the contribution.
Could you kindly provide the request throughput of w8a8?

@lvhan028 lvhan028 merged commit a15cede into InternLM:main Feb 2, 2024
4 checks passed
@yinfan98
Copy link
Contributor Author

yinfan98 commented Feb 2, 2024

@lvhan028 Sure, I will finish benchmark these days

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants