-
Notifications
You must be signed in to change notification settings - Fork 673
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
[LightGBM] Create initial LightGBM engine #1895
Conversation
Codecov Report
@@ Coverage Diff @@
## master #1895 +/- ##
============================================
- Coverage 72.08% 69.77% -2.32%
- Complexity 5126 5643 +517
============================================
Files 473 539 +66
Lines 21970 24957 +2987
Branches 2351 2706 +355
============================================
+ Hits 15838 17413 +1575
- Misses 4925 6209 +1284
- Partials 1207 1335 +128
Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here. |
/** {@code LgbmNDArray} is the LightGBM implementation of {@link NDArray}. */ | ||
public class LgbmNDArray extends NDArrayAdapter { | ||
|
||
private ByteBuffer data; |
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.
This part looks strange to me. Why we are trying to keep a ByteBuffer reference instead of storing a native pointer for the data? And I can see you are trying to pass the data to native only during getHandle()
function. Shoudn't we just create the handle and pass it to the NDArray?
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.
We need keep both handler and ByteBuffer.
The problem the handle is write only, cannot read data from it. It can only used for inference.
So we have to have two type of NDArray:
- input only NDArraty, we create handle and pass to engine for inference
- output only NDArray, we get bytes from the model and need return a NDArray, we don't have handle in this case.
/** {@code LgbmNDArray} is the LightGBM implementation of {@link NDArray}. */ | ||
public class LgbmNDArray extends NDArrayAdapter { | ||
|
||
private ByteBuffer data; |
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.
We need keep both handler and ByteBuffer.
The problem the handle is write only, cannot read data from it. It can only used for inference.
So we have to have two type of NDArray:
- input only NDArraty, we create handle and pass to engine for inference
- output only NDArray, we get bytes from the model and need return a NDArray, we don't have handle in this case.
engines/ml/lightgbm/src/test/java/ai/djl/ml/lightgbm/package-info.java
Outdated
Show resolved
Hide resolved
engines/ml/lightgbm/src/test/java/ai/djl/ml/lightgbm/LgbmModelTest.java
Outdated
Show resolved
Hide resolved
engines/ml/lightgbm/src/main/java/ai/djl/ml/lightgbm/package-info.java
Outdated
Show resolved
Hide resolved
engines/ml/lightgbm/src/main/java/ai/djl/ml/lightgbm/jni/package-info.java
Outdated
Show resolved
Hide resolved
engines/ml/lightgbm/src/main/java/ai/djl/ml/lightgbm/LgbmNDArray.java
Outdated
Show resolved
Hide resolved
engines/ml/lightgbm/src/main/java/ai/djl/ml/lightgbm/LgbmModel.java
Outdated
Show resolved
Hide resolved
engines/ml/lightgbm/src/main/java/ai/djl/ml/lightgbm/LgbmEngineProvider.java
Outdated
Show resolved
Hide resolved
engines/ml/lightgbm/src/main/java/ai/djl/ml/lightgbm/LgbmEngine.java
Outdated
Show resolved
Hide resolved
Change-Id: I67533d25c61d26d9e24b5bc70b0993569b483cc8
…1895) * [LightGBM] Create initial LightGBM engine * Fix copyright years and build.gradle exclusions * minor update for unit test Change-Id: I67533d25c61d26d9e24b5bc70b0993569b483cc8 Co-authored-by: Frank Liu <[email protected]>
* [LightGBM] Create initial LightGBM engine * Fix copyright years and build.gradle exclusions * minor update for unit test Change-Id: I67533d25c61d26d9e24b5bc70b0993569b483cc8 Co-authored-by: Frank Liu <[email protected]>
No description provided.