-
Notifications
You must be signed in to change notification settings - Fork 77
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
[CharTensor] Enable memory data to store scale factors based on quantization schemes #2844
[CharTensor] Enable memory data to store scale factors based on quantization schemes #2844
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good works :) Please check my review below:
nntrainer/tensor/char_tensor.cpp
Outdated
MemoryData *mem_data = | ||
new MemoryData((void *)(new int8_t[dim.getDataLen()]())); | ||
new MemoryData((void *)(new int8_t[dim.getDataLen() + 4 * scale_size()]())); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What about updating the code like:
new MemoryData((void *)(new int8_t[dim.getDataLen() + 4 * scale_size()]())); | |
new MemoryData((void *)(new int8_t[dim.getDataLen() + sizeof(float) * scale_size()]())); |
If you have a plan to support different type of scales
, it would be better to update it.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
thank you for sharing your thoughts! sizeof(float)
makes more sense :)
nntrainer/tensor/char_tensor.cpp
Outdated
return nullptr; | ||
|
||
data->validate(); | ||
return ((int8_t *)getScale()) + idx; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Isn't it ((float *)getScale()) + idx
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yes, you're right! thank you 👍
c55db72
to
a5ec4e6
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM !
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
…ization schemes This pull request aims to modify the existing codebase such that the memory data of CharTensor can now store scale factors based on different quantization schemes. Additionally, this change allows the Tensor class to specify the desired quantization scheme while creating a new CharTensor instance. The scale factors are determined either during the quantization process using a specific quantizer or they can be manually initialized if both the quantized data and the corresponding scale factors are provided as inputs. **Self-evaluation:** 1. Build test: [X]Passed [ ]Failed [ ]Skipped 2. Run test: [X]Passed [ ]Failed [ ]Skipped Signed-off-by: Donghyeon Jeong <[email protected]>
a5ec4e6
to
44fbaf6
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
This pull request aims to modify the existing codebase such that the memory data of CharTensor can now store scale factors based on different quantization schemes.
Additionally, this change allows the Tensor class to specify the desired quantization scheme while creating a new CharTensor instance.
The scale factors are determined either during the quantization process using a specific quantizer or they can be manually initialized if both the quantized data and the corresponding scale factors are provided as inputs.
Self-evaluation: