Skip to content

fix https://github.com/hwchase17/langchain/issues/2392 #2393

New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Merged
merged 1 commit into from
Apr 6, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 7 additions & 2 deletions tests/integration_tests/embeddings/test_llamacpp.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,17 +14,22 @@ def get_model() -> str:
model_url = "https://huggingface.co/Sosaka/Alpaca-native-4bit-ggml/resolve/main/ggml-alpaca-7b-q4.bin"
tokenizer_url = "https://huggingface.co/decapoda-research/llama-7b-hf/resolve/main/tokenizer.model"
conversion_script = "https://github.com/ggerganov/llama.cpp/raw/master/convert-unversioned-ggml-to-ggml.py"
migrate_script = "https://github.com/ggerganov/llama.cpp/raw/master/migrate-ggml-2023-03-30-pr613.py"
local_filename = model_url.split("/")[-1]
local_filename_ggjt = local_filename.split('.')[0] + '-ggjt.' + local_filename.split('.')[1]

if not os.path.exists("convert-unversioned-ggml-to-ggml.py"):
urlretrieve(conversion_script, "convert-unversioned-ggml-to-ggml.py")
if not os.path.exists("migrate-ggml-2023-03-30-pr613.py"):
urlretrieve(migrate_script, "migrate-ggml-2023-03-30-pr613.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("python convert-unversioned-ggml-to-ggml.py . tokenizer.model")
os.system(f"python convert-unversioned-ggml-to-ggml.py . tokenizer.model")
os.system(f"python migrate-ggml-2023-03-30-pr613.py {local_filename} {local_filename_ggjt}")

return local_filename
return local_filename_ggjt


def test_llamacpp_embedding_documents() -> None:
Expand Down
7 changes: 6 additions & 1 deletion tests/integration_tests/llms/test_llamacpp.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,17 +13,22 @@ def get_model() -> str:
model_url = "https://huggingface.co/Sosaka/Alpaca-native-4bit-ggml/resolve/main/ggml-alpaca-7b-q4.bin"
tokenizer_url = "https://huggingface.co/decapoda-research/llama-7b-hf/resolve/main/tokenizer.model"
conversion_script = "https://github.com/ggerganov/llama.cpp/raw/master/convert-unversioned-ggml-to-ggml.py"
migrate_script = "https://github.com/ggerganov/llama.cpp/raw/master/migrate-ggml-2023-03-30-pr613.py"
local_filename = model_url.split("/")[-1]
local_filename_ggjt = local_filename.split('.')[0] + '-ggjt.' + local_filename.split('.')[1]

if not os.path.exists("convert-unversioned-ggml-to-ggml.py"):
urlretrieve(conversion_script, "convert-unversioned-ggml-to-ggml.py")
if not os.path.exists("migrate-ggml-2023-03-30-pr613.py"):
urlretrieve(migrate_script, "migrate-ggml-2023-03-30-pr613.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-unversioned-ggml-to-ggml.py . tokenizer.model")
os.system(f"python migrate-ggml-2023-03-30-pr613.py {local_filename} {local_filename_ggjt}")

return local_filename
return local_filename_ggjt


def test_llamacpp_inference() -> None:
Expand Down