Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
@@ -212,12 +212,15 @@ class RAGPipeline:
|
|
212 |
self.retriever = SentenceTransformerRetriever()
|
213 |
self.documents = []
|
214 |
self.device = torch.device("cpu")
|
215 |
-
|
216 |
self.model_path = "mistral-7b-v0.1.Q4_K_M.gguf"
|
217 |
-
|
|
|
|
|
|
|
218 |
|
219 |
@st.cache_resource
|
220 |
def initialize_model(self):
|
|
|
221 |
try:
|
222 |
if not os.path.exists(self.model_path):
|
223 |
direct_url = "https://huggingface.co/TheBloke/Mistral-7B-v0.1-GGUF/resolve/main/mistral-7b-v0.1.Q4_K_M.gguf"
|
@@ -239,9 +242,7 @@ class RAGPipeline:
|
|
239 |
"verbose": False
|
240 |
}
|
241 |
|
242 |
-
self.llm = Llama(model_path=self.model_path,
|
243 |
-
**llm_config)
|
244 |
-
|
245 |
st.success("Model loaded successfully!")
|
246 |
|
247 |
except Exception as e:
|
|
|
212 |
self.retriever = SentenceTransformerRetriever()
|
213 |
self.documents = []
|
214 |
self.device = torch.device("cpu")
|
|
|
215 |
self.model_path = "mistral-7b-v0.1.Q4_K_M.gguf"
|
216 |
+
# Initialize model in init
|
217 |
+
self.llm = None
|
218 |
+
self.initialize_model()
|
219 |
+
|
220 |
|
221 |
@st.cache_resource
|
222 |
def initialize_model(self):
|
223 |
+
"""Initialize the model with proper error handling and verification"""
|
224 |
try:
|
225 |
if not os.path.exists(self.model_path):
|
226 |
direct_url = "https://huggingface.co/TheBloke/Mistral-7B-v0.1-GGUF/resolve/main/mistral-7b-v0.1.Q4_K_M.gguf"
|
|
|
242 |
"verbose": False
|
243 |
}
|
244 |
|
245 |
+
self.llm = Llama(model_path=self.model_path, **llm_config)
|
|
|
|
|
246 |
st.success("Model loaded successfully!")
|
247 |
|
248 |
except Exception as e:
|