mirror of
https://github.com/nomic-ai/gpt4all.git
synced 2025-06-28 08:17:18 +00:00
Java binding - Improve error check before loading Model file (#1206)
* Javav binding - Add check for Model file be Readable. * add todo for java binding. --------- Co-authored-by: Feliks Zaslavskiy <feliks.zaslavskiy@optum.com> Co-authored-by: felix <felix@zaslavskiy.net>
This commit is contained in:
parent
cfd70b69fc
commit
1e74171a7b
@ -12,12 +12,12 @@ You can add Java bindings into your Java project by adding the following depende
|
|||||||
<dependency>
|
<dependency>
|
||||||
<groupId>com.hexadevlabs</groupId>
|
<groupId>com.hexadevlabs</groupId>
|
||||||
<artifactId>gpt4all-java-binding</artifactId>
|
<artifactId>gpt4all-java-binding</artifactId>
|
||||||
<version>1.1.3</version>
|
<version>1.1.5</version>
|
||||||
</dependency>
|
</dependency>
|
||||||
```
|
```
|
||||||
**Gradle**
|
**Gradle**
|
||||||
```
|
```
|
||||||
implementation 'com.hexadevlabs:gpt4all-java-binding:1.1.3'
|
implementation 'com.hexadevlabs:gpt4all-java-binding:1.1.5'
|
||||||
```
|
```
|
||||||
|
|
||||||
To add the library dependency for another build system see [Maven Central Java bindings](https://central.sonatype.com/artifact/com.hexadevlabs/gpt4all-java-binding/).
|
To add the library dependency for another build system see [Maven Central Java bindings](https://central.sonatype.com/artifact/com.hexadevlabs/gpt4all-java-binding/).
|
||||||
@ -121,4 +121,6 @@ If this is the case you can easily download and install the latest x64 Microsoft
|
|||||||
3. Version **1.1.4**:
|
3. Version **1.1.4**:
|
||||||
- Java bindings is compatible with gpt4all version 2.4.11
|
- Java bindings is compatible with gpt4all version 2.4.11
|
||||||
- Falcon model support included.
|
- Falcon model support included.
|
||||||
|
4. Version **1.1.5**:
|
||||||
|
- Add a check for model file readability before loading model.
|
||||||
|
|
@ -1,2 +1,6 @@
|
|||||||
|
## Needed
|
||||||
|
1. Integrate with circleci build pipeline like the C# binding.
|
||||||
|
|
||||||
|
## These are just ideas
|
||||||
1. Better Chat completions function.
|
1. Better Chat completions function.
|
||||||
2. Chat completion that returns result in OpenAI compatible format.
|
2. Chat completion that returns result in OpenAI compatible format.
|
||||||
|
@ -6,7 +6,7 @@
|
|||||||
|
|
||||||
<groupId>com.hexadevlabs</groupId>
|
<groupId>com.hexadevlabs</groupId>
|
||||||
<artifactId>gpt4all-java-binding</artifactId>
|
<artifactId>gpt4all-java-binding</artifactId>
|
||||||
<version>1.1.4</version>
|
<version>1.1.5</version>
|
||||||
<packaging>jar</packaging>
|
<packaging>jar</packaging>
|
||||||
|
|
||||||
<properties>
|
<properties>
|
||||||
|
@ -184,11 +184,16 @@ public class LLModel implements AutoCloseable {
|
|||||||
throw new IllegalStateException("Model file does not exist: " + modelPathAbs);
|
throw new IllegalStateException("Model file does not exist: " + modelPathAbs);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Check if file is Readable
|
||||||
|
if(!Files.isReadable(modelPath)){
|
||||||
|
throw new IllegalStateException("Model file cannot be read: " + modelPathAbs);
|
||||||
|
}
|
||||||
|
|
||||||
// Create Model Struct. Will load dynamically the correct backend based on model type
|
// Create Model Struct. Will load dynamically the correct backend based on model type
|
||||||
model = library.llmodel_model_create2(modelPathAbs, "auto", error);
|
model = library.llmodel_model_create2(modelPathAbs, "auto", error);
|
||||||
|
|
||||||
if(model == null) {
|
if(model == null) {
|
||||||
throw new IllegalStateException("Could not load gpt4all backend :" + error.message);
|
throw new IllegalStateException("Could not load, gpt4all backend returned error: " + error.message);
|
||||||
}
|
}
|
||||||
library.llmodel_loadModel(model, modelPathAbs);
|
library.llmodel_loadModel(model, modelPathAbs);
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user