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

gpt4all doesn't load on linux server #1

Open
altacountbabi opened this issue Apr 8, 2023 · 5 comments
Open

gpt4all doesn't load on linux server #1

altacountbabi opened this issue Apr 8, 2023 · 5 comments

Comments

@altacountbabi
Copy link

I tried this on my local machine and linux server but neither of them actually worked I gave it a pretty generous amount of time to load but I don't think it even started gpt4all.

additional info (windows)

index.js: https://pastebin.com/raw/FTDL7dHK
gpt.js: https://pastebin.com/raw/eQNgh41t
file structure:
image

Please tell me if I did anything wrong, i'm not sure if I did the installation process correctly.

@9P9
Copy link
Owner

9P9 commented Apr 8, 2023

Hi! Would you be able to show me what comes up in terminal when you run it?

Also, if you wish to trouble shoot yourself

import { spawn } from 'child_process';
import { EventEmitter } from 'events'; 

class GPT4ALL extends EventEmitter {
    status = 0;
    buffer = "";
    constructor(app) {
        super();
        this.chat = spawn(app);
        this.chat.stdout.on('data', (data) => {
            let str = data.toString();
            if (str.includes("\x1b[33m")) {
                this.status = 1;
                this.emit("ready");
                this.buffer = "";
            } else if (str.includes(">")) {
                this.emit("data", this.buffer);
                this.buffer = "";
            } else {
                this.buffer += str;
            }
        });
	this.chat.on('exit', (code) => { console.error(`${code}`);
    }
    async ask(msg) {
        if (!this.status) return null;
        this.chat.stdin.write(`${msg}\n`);
        return new Promise(resolve => this.once("data", resolve));
    }
}

export default GPT4ALL;

here is a version of the gpt4all wrapper that includes error handling (which will be hopefully re-added to the official release)

@altacountbabi
Copy link
Author

altacountbabi commented Apr 9, 2023

It just says that the express server is running

image

also there was a small error in the error handling wrapper

this.chat.on('exit', (code) => { console.error(`${code}`); //doesnt work
this.chat.on('exit', (code) => { console.error(`${code}`) }); //works

edit: I ran it with the error handling and it seems like gpt just exits with error code 1
edit 2: also dont you need to specify the model path when launching the .exe ?

@altacountbabi
Copy link
Author

altacountbabi commented Apr 10, 2023

after a little more debugging than i would like to admit i figured out that the model was corrupted, I redownloaded it from the original gpt4all repository and it works now.

Nvm i only got it to work in command prompt but the sdk still does the same thing

@9P9
Copy link
Owner

9P9 commented Apr 10, 2023

Can you show what you mean by working in command prompt?

@altacountbabi
Copy link
Author

it works when I run it from command prompt
image
But it still doesnt work with the library
image

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

No branches or pull requests

2 participants