Skip to content

Commit

Permalink
Avoid duplicated loading native library (#3020)
Browse files Browse the repository at this point in the history
  • Loading branch information
frankfliu committed Apr 26, 2024
1 parent fc7f58c commit 813e2d8
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 3 deletions.
3 changes: 2 additions & 1 deletion engines/llama/src/main/java/ai/djl/llama/jni/LibUtils.java
Original file line number Diff line number Diff line change
Expand Up @@ -55,8 +55,9 @@ public static void loadLibrary() {
String nativeHelper = System.getProperty("ai.djl.llama.native_helper");
if (nativeHelper != null && !nativeHelper.isEmpty()) {
ClassLoaderUtils.nativeLoad(nativeHelper, path);
} else {
System.load(path); // NOPMD
}
System.load(path); // NOPMD
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -361,8 +361,9 @@ private static void loadNativeLibrary(String path) {
String nativeHelper = System.getProperty("ai.djl.pytorch.native_helper");
if (nativeHelper != null && !nativeHelper.isEmpty()) {
ClassLoaderUtils.nativeLoad(nativeHelper, path);
} else {
System.load(path); // NOPMD
}
System.load(path); // NOPMD
}

private static LibTorch downloadPyTorch(Platform platform) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -72,8 +72,9 @@ private static void loadLibrary() {
String nativeHelper = System.getProperty("ai.djl.huggingface.native_helper");
if (nativeHelper != null && !nativeHelper.isEmpty()) {
ClassLoaderUtils.nativeLoad(nativeHelper, path);
} else {
System.load(path); // NOPMD
}
System.load(path); // NOPMD
}
}

Expand Down

0 comments on commit 813e2d8

Please sign in to comment.