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

Error on downloading model #15

Closed
skalra90 opened this issue May 28, 2023 · 3 comments
Closed

Error on downloading model #15

skalra90 opened this issue May 28, 2023 · 3 comments

Comments

@skalra90
Copy link

Before downloading the model, create the models folder under server folder.

@Anil-matcha
Copy link
Contributor

Fixing it soon

@joemccann
Copy link
Contributor

Simple fix.

  1. In the server directory run mkdir -p models
  2. In privateGPT.py replace the def download_and_save(): method with the following code:
def download_and_save():
    url = 'https://gpt4all.io/models/ggml-gpt4all-j-v1.3-groovy.bin'
    filename = 'ggml-gpt4all-j-v1.3-groovy.bin'
    models_folder = 'models'
    n_ctx = 1024  # Replace this with correct value

    response = requests.get(url, stream=True)
    total_size = int(response.headers.get('content-length', 0))
    bytes_downloaded = 0
    file_path = f'{models_folder}/{filename}'
    if os.path.exists(file_path):
        return jsonify(response="Download completed")

    with open(file_path, 'wb') as file:
        for chunk in response.iter_content(chunk_size=4096):
            file.write(chunk)
            bytes_downloaded += len(chunk)
            progress = round((bytes_downloaded / total_size) * 100, 2)
            print(f'Download Progress: {progress}%')

    callbacks = [StreamingStdOutCallbackHandler()]
    llm = GPT4All(model=file_path, n_ctx=n_ctx, backend='gptj', callbacks=callbacks, verbose=False)
    return jsonify(response="Download completed")

Then run python privateGPT.py

@Anil-matcha
Copy link
Contributor

Fixed now

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

3 participants