EmbedAI
EmbedAI copied to clipboard
Error on downloading model
Before downloading the model, create the models folder under server folder.
Fixing it soon
Simple fix.
- In the
serverdirectory runmkdir -p models - In
privateGPT.pyreplace thedef 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
Fixed now