Ajaykanth Maddi commited on
Commit ·
de11497
1
Parent(s): 6d2d3fd
Fixed dataset path and requests.
Browse files- ragbench.py +21 -1
ragbench.py
CHANGED
|
@@ -13,7 +13,7 @@ from langchain.schema import Document as LangchainDocument
|
|
| 13 |
import torch
|
| 14 |
from transformers import AutoTokenizer, AutoModelForCausalLM
|
| 15 |
|
| 16 |
-
from huggingface_hub import hf_hub_download
|
| 17 |
|
| 18 |
|
| 19 |
from constants import (
|
|
@@ -96,6 +96,26 @@ class RAGSystem:
|
|
| 96 |
}
|
| 97 |
|
| 98 |
def load_embeddings_database(self):
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 99 |
"""Load pre-built FAISS index and retrievers"""
|
| 100 |
# basepath = "/kaggle/input/rag26-emanual"
|
| 101 |
# fName = basepath + f"/faiss_index_{self.subset}_{self.dataset_type}_{self.strategy}"
|
|
|
|
| 13 |
import torch
|
| 14 |
from transformers import AutoTokenizer, AutoModelForCausalLM
|
| 15 |
|
| 16 |
+
from huggingface_hub import hf_hub_download, HfApi
|
| 17 |
|
| 18 |
|
| 19 |
from constants import (
|
|
|
|
| 96 |
}
|
| 97 |
|
| 98 |
def load_embeddings_database(self):
|
| 99 |
+
try:
|
| 100 |
+
# 1. First verify the repo exists
|
| 101 |
+
api = HfApi()
|
| 102 |
+
repo_info = api.repo_info(
|
| 103 |
+
repo_id="bfrogs/rag26-emanual",
|
| 104 |
+
repo_type="dataset", # or "model" if you used model repo
|
| 105 |
+
token=os.getenv("HF_TOKEN")
|
| 106 |
+
)
|
| 107 |
+
print(f"Repo exists: {repo_info}")
|
| 108 |
+
|
| 109 |
+
# 2. List files to verify filename
|
| 110 |
+
repo_files = api.list_repo_files(
|
| 111 |
+
repo_id="bfrogs/rag26-emanual",
|
| 112 |
+
repo_type="dataset"
|
| 113 |
+
)
|
| 114 |
+
print("Available files:", repo_files)
|
| 115 |
+
except Exception as e:
|
| 116 |
+
print(f"Error accessing Hugging Face repo: {e}")
|
| 117 |
+
return
|
| 118 |
+
|
| 119 |
"""Load pre-built FAISS index and retrievers"""
|
| 120 |
# basepath = "/kaggle/input/rag26-emanual"
|
| 121 |
# fName = basepath + f"/faiss_index_{self.subset}_{self.dataset_type}_{self.strategy}"
|