-
Notifications
You must be signed in to change notification settings - Fork 44
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
Correct conversions errors from u64 to size_t(u32 on msvc32) #104
Merged
Merged
Changes from 1 commit
Commits
Show all changes
2 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -24,4 +24,6 @@ VERSION | |
__pycache__/ | ||
|
||
# Mac OS | ||
.DS_Store | ||
.DS_Store | ||
|
||
build/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -177,29 +177,33 @@ Status MikolovModelReader::parse() { | |
auto maxBlock = std::max<u64>({hdr.layerSize * hdr.vocabSize, hdr.maxentSize, | ||
hdr.layerSize * hdr.layerSize}); | ||
// 3 comes from rounding to next value + sizeof(float) | ||
auto pageSize = 1ULL << (static_cast<u32>(std::log2(maxBlock)) + 3); | ||
auto pageSize = static_cast<size_t>(1) << (static_cast<u32>(std::log2(maxBlock)) + 3); | ||
data_->memmgr.initialize(pageSize); | ||
data_->alloc = data_->memmgr.value().core(); | ||
auto& alloc = data_->alloc; | ||
|
||
const auto embedding_size = static_cast<size_t>(hdr.layerSize) * static_cast<size_t>(hdr.vocabSize); | ||
const auto matrix_size = static_cast<size_t>(hdr.layerSize) * static_cast<size_t>(hdr.layerSize); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I had second thought about whether There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. It's a square matrix layerSize times layerSize, so that's correct |
||
|
||
data_->embeddingData = | ||
alloc->allocateBuf<float>(hdr.layerSize * hdr.vocabSize, 64); | ||
alloc->allocateBuf<float>(embedding_size, 64); | ||
data_->nceEmbeddingData = | ||
alloc->allocateBuf<float>(hdr.layerSize * hdr.vocabSize, 64); | ||
alloc->allocateBuf<float>(embedding_size, 64); | ||
data_->matrixData = | ||
alloc->allocateBuf<float>(hdr.layerSize * hdr.layerSize, 64); | ||
data_->maxentWeightData = alloc->allocateBuf<float>(hdr.maxentSize, 64); | ||
alloc->allocateBuf<float>(matrix_size, 64); | ||
data_->maxentWeightData = alloc->allocateBuf<float>(static_cast<size_t>(hdr.maxentSize), 64); | ||
|
||
JPP_RIE_MSG(copyArray(contents, data_->embeddingData, | ||
hdr.layerSize * hdr.vocabSize, &start), | ||
embedding_size, &start), | ||
"embeds"); | ||
JPP_RIE_MSG(copyArray(contents, data_->nceEmbeddingData, | ||
hdr.layerSize * hdr.vocabSize, &start), | ||
embedding_size, &start), | ||
"nce embeds"); | ||
JPP_RIE_MSG(copyArray(contents, data_->matrixData, | ||
hdr.layerSize * hdr.layerSize, &start), | ||
matrix_size, &start), | ||
"matrix"); | ||
JPP_RIE_MSG( | ||
copyArray(contents, data_->maxentWeightData, hdr.maxentSize, &start), | ||
copyArray(contents, data_->maxentWeightData, static_cast<size_t>(hdr.maxentSize), &start), | ||
"maxent weights"); | ||
if (start != contents.size()) { | ||
return Status::InvalidState() << "did not read rnn model file fully"; | ||
|
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
Could you name this embedding_matrix_size
Usually, a vector representation for a single token is called embedding.
Next thing should be called transition_matrix_size in that case.
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.
Renamed 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.
transition_matrix_size as well please!
Anyway, congratulations on 1000th commit :p
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.
Oh sorry, I thought you meant it as if we leave name as it is
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.
Sorry for the confusion.
Need to improve my clearness.
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.
Addressed.
And thanks, sorry about ruining nice number
999
😄