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

add finding BlockFactory feature in model loading #805

Merged
merged 4 commits into from
Apr 11, 2021

Conversation

lanking520
Copy link
Contributor

Description

Support BlockFactory searching and loading in the current Model directory. This method should work on:

factory.class
my_fancy_jar.jar

We will scan through this and figure out if there is a class implements BlockFactory.

@codecov-io
Copy link

codecov-io commented Apr 2, 2021

Codecov Report

Merging #805 (04af07f) into master (10689d7) will increase coverage by 0.10%.
The diff coverage is 61.72%.

Impacted file tree graph

@@             Coverage Diff              @@
##             master     #805      +/-   ##
============================================
+ Coverage     70.27%   70.37%   +0.10%     
- Complexity     4963     4991      +28     
============================================
  Files           486      486              
  Lines         21793    21873      +80     
  Branches       2263     2277      +14     
============================================
+ Hits          15314    15394      +80     
  Misses         5279     5279              
  Partials       1200     1200              
Impacted Files Coverage Δ Complexity Δ
api/src/main/java/ai/djl/util/Utils.java 63.00% <53.73%> (-5.87%) 40.00 <9.00> (+9.00) ⬇️
api/src/main/java/ai/djl/BaseModel.java 74.65% <100.00%> (+0.71%) 38.00 <2.00> (+2.00)
...ine/src/main/java/ai/djl/mxnet/engine/MxModel.java 62.16% <100.00%> (+1.05%) 14.00 <0.00> (+1.00)
...e/src/main/java/ai/djl/pytorch/engine/PtModel.java 52.11% <100.00%> (+1.38%) 10.00 <0.00> (+1.00)
...main/java/ai/djl/pytorch/engine/PtSymbolBlock.java 79.41% <100.00%> (+31.79%) 15.00 <3.00> (+8.00)
api/src/main/java/ai/djl/nn/SymbolBlock.java 33.33% <0.00%> (-33.34%) 1.00% <0.00%> (-1.00%)
...ava/ai/djl/translate/ServingTranslatorFactory.java 84.10% <0.00%> (-1.33%) 33.00% <0.00%> (-1.00%)
...ain/java/ai/djl/modality/cv/util/NDImageUtils.java 63.15% <0.00%> (-1.32%) 20.00% <0.00%> (-1.00%)
...n/java/ai/djl/tensorflow/engine/TfSymbolBlock.java 84.52% <0.00%> (-1.20%) 16.00% <0.00%> (-1.00%)
...ine/src/main/java/ai/djl/pytorch/jni/JniUtils.java 90.86% <0.00%> (+0.32%) 194.00% <0.00%> (+1.00%)
... and 6 more

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 10689d7...04af07f. Read the comment docs.

// we only consider .class files and skip .java files
List<Path> jarFiles =
Files.list(path)
.filter(p -> p.toString().endsWith(".jar"))
Copy link
Contributor

Choose a reason for hiding this comment

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

it it possible we have some other type of file as well ?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

We only scan on the .class files. These mostly only live in Java jars.

Change-Id: I87e2c31443a7f2c21874b16991f91e539832a2b7
@lanking520 lanking520 merged commit ab491ce into deepjavalibrary:master Apr 11, 2021
@lanking520 lanking520 deleted the block branch May 6, 2021 22:03
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants