-
Notifications
You must be signed in to change notification settings - Fork 105
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
Implement Memory-mapped MLModel #275
Conversation
37437c5
to
5c06b9e
Compare
@@ -1168,3 +1168,36 @@ def test_mmap(tmpdir): | |||
py_pred = py_model.predict(Xt, **kwargs).todense() | |||
mmap_pred = mmap_model.predict(Xt, **kwargs).todense() | |||
assert mmap_pred == approx(py_pred, abs=1e-6), f"post_processor:{pp}" | |||
|
|||
|
|||
def test_mmap_mlmodel(tmpdir): |
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.
I think this test should be put in https://github.com/amzn/pecos/blob/mainline/test/pecos/xmc/test_xmc.py
since the functionalities added are for the xmc/base.py
class.
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.
Fixed. See latest Revision.
pecos/core/libpecos.cpp
Outdated
// ==== C Interface of XMC Models ==== | ||
// ==== C Interface of MLModels ==== | ||
// Only implemented for w_matrix_t = pecos::csc_t | ||
//typedef pecos::bin_search_chunked_matrix_t MLMODEL_MAT_T; |
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.
Remove this unused comment.
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.
Fixed. See latest Revision.
5c06b9e
to
8f397c0
Compare
Issue #, if available:
Description of changes:
Implement Memory-mapped MLModel class for both C and Python Interface.
Usage
User needs to have a MLModel saved on disk (in original .npz format),
and manually compile into mmap format by calling compile_mmap_model:
Then user can load the memory-mapped model and do inference:
By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.