EmbedAI icon indicating copy to clipboard operation
EmbedAI copied to clipboard

Error on downloading model

Open skalra90 opened this issue 2 years ago • 1 comments

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

skalra90 avatar May 28 '23 12:05 skalra90

Fixing it soon

Anil-matcha avatar May 28 '23 14:05 Anil-matcha

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

joemccann avatar May 28 '23 20:05 joemccann

Fixed now

Anil-matcha avatar May 28 '23 20:05 Anil-matcha