Spaces:
Runtime error
Runtime error
Update prepare_vector_dp.py
Browse files- prepare_vector_dp.py +11 -13
prepare_vector_dp.py
CHANGED
|
@@ -3,27 +3,25 @@ from langchain_community.document_loaders import PyPDFLoader, DirectoryLoader
|
|
| 3 |
from langchain_community.vectorstores import FAISS
|
| 4 |
from langchain_community.embeddings import GPT4AllEmbeddings
|
| 5 |
|
| 6 |
-
|
| 7 |
|
| 8 |
-
from llama_cpp import Llama
|
| 9 |
import os
|
| 10 |
|
| 11 |
-
model_file = Llama.from_pretrained(
|
| 12 |
-
|
| 13 |
-
|
| 14 |
-
)
|
| 15 |
|
| 16 |
# Khai bao bien
|
| 17 |
pdf_data_path = "data"
|
| 18 |
vector_dp_path = "vectorstores/db_faiss"
|
| 19 |
|
| 20 |
-
|
| 21 |
-
|
| 22 |
-
|
| 23 |
-
|
| 24 |
-
|
| 25 |
-
# cache_dir="model" # Will be created in the Space's environment
|
| 26 |
-
# )
|
| 27 |
|
| 28 |
# Ham 1. Tao ra vector DB tu 1 doan text
|
| 29 |
def create_db_from_text():
|
|
|
|
| 3 |
from langchain_community.vectorstores import FAISS
|
| 4 |
from langchain_community.embeddings import GPT4AllEmbeddings
|
| 5 |
|
| 6 |
+
from huggingface_hub import hf_hub_download
|
| 7 |
|
| 8 |
+
# from llama_cpp import Llama
|
| 9 |
import os
|
| 10 |
|
| 11 |
+
# model_file = Llama.from_pretrained(
|
| 12 |
+
# repo_id="Pudding48/TinyLLamaTest",
|
| 13 |
+
# filename="tinyllama-1.1b-chat-v1.0.Q8_0.gguf",
|
| 14 |
+
# )
|
| 15 |
|
| 16 |
# Khai bao bien
|
| 17 |
pdf_data_path = "data"
|
| 18 |
vector_dp_path = "vectorstores/db_faiss"
|
| 19 |
|
| 20 |
+
model_file = hf_hub_download(
|
| 21 |
+
repo_id="Pudding48/TinyLlamaTest", # 🟢 This must be a model repo, not a Space
|
| 22 |
+
filename="tinyllama-1.1b-chat-v1.0.Q8_0.gguf",
|
| 23 |
+
cache_dir="model"
|
| 24 |
+
)
|
|
|
|
|
|
|
| 25 |
|
| 26 |
# Ham 1. Tao ra vector DB tu 1 doan text
|
| 27 |
def create_db_from_text():
|