Skip to content

Commit 85dee3b

Browse files
committed
Add compatibility method for langchain4j and quarkus in ModelLoader
1 parent 3722b09 commit 85dee3b

File tree

1 file changed

+12
-0
lines changed

1 file changed

+12
-0
lines changed

src/main/java/org/beehive/gpullama3/model/loader/ModelLoader.java

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -90,6 +90,18 @@ public static Model loadModel(Options options) throws IOException {
9090
return modelType.loadModel(gguf.getFileChannel(), gguf, contextLength, useTornadovm);
9191
}
9292

93+
/**
94+
* For compatibility with langchain4j and quarkus.
95+
*/
96+
public static Model loadModel(Path ggufPath, int contextLength, boolean loadWeights, boolean useTornadovm) throws IOException {
97+
// initial load of metadata from gguf file
98+
GGUF gguf = GGUF.loadGGUFMetadata(ggufPath);
99+
// detect model type
100+
ModelType modelType = detectModelType(gguf.getMetadata());
101+
// model type-specific load
102+
return modelType.loadModel(gguf.getFileChannel(), gguf, contextLength, useTornadovm);
103+
}
104+
93105
/**
94106
* Dispatcher method for loading a standard (non-tornado) tensor based on GGML type.
95107
* Used in CPU-path.

0 commit comments

Comments
 (0)