mirror of
https://github.com/hwchase17/langchain.git
synced 2025-09-17 23:41:46 +00:00
[Breaking] Migrate GPT4All to use PyGPT4All (#3934)
Seems the pyllamacpp package is no longer the supported bindings from gpt4all. Tested that this works locally. Given that the older models weren't very performant, I think it's better to migrate now without trying to include a lot of try / except blocks --------- Co-authored-by: Nissan Pow <npow@users.noreply.github.com> Co-authored-by: Nissan Pow <pownissa@amazon.com>
This commit is contained in:
@@ -7,21 +7,12 @@ from langchain.llms import GPT4All
|
||||
|
||||
|
||||
def _download_model() -> str:
|
||||
"""Download model.
|
||||
From https://the-eye.eu/public/AI/models/nomic-ai/gpt4all/gpt4all-lora-quantized.bin,
|
||||
convert to new ggml format and return model path."""
|
||||
model_url = "https://the-eye.eu/public/AI/models/nomic-ai/gpt4all/gpt4all-lora-quantized.bin"
|
||||
tokenizer_url = "https://huggingface.co/decapoda-research/llama-7b-hf/resolve/main/tokenizer.model"
|
||||
conversion_script = "https://github.com/nomic-ai/pyllamacpp/blob/main/pyllamacpp/scripts/convert_gpt4all.py"
|
||||
"""Download model."""
|
||||
model_url = "http://gpt4all.io/models/ggml-gpt4all-l13b-snoozy.bin"
|
||||
local_filename = model_url.split("/")[-1]
|
||||
|
||||
if not os.path.exists("convert_gpt4all.py"):
|
||||
urlretrieve(conversion_script, "convert_gpt4all.py")
|
||||
if not os.path.exists("tokenizer.model"):
|
||||
urlretrieve(tokenizer_url, "tokenizer.model")
|
||||
if not os.path.exists(local_filename):
|
||||
urlretrieve(model_url, local_filename)
|
||||
os.system(f"python convert_gpt4all.py.py . tokenizer.model")
|
||||
|
||||
return local_filename
|
||||
|
||||
|
Reference in New Issue
Block a user