Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
@@ -137,21 +137,11 @@ def check_environment():
|
|
137 |
|
138 |
@st.cache_resource
|
139 |
def initialize_model(self):
|
140 |
-
"""Initialize the model with proper error handling and verification
|
141 |
-
|
142 |
-
Returns:
|
143 |
-
Llama: Initialized model instance
|
144 |
-
|
145 |
-
Raises:
|
146 |
-
FileNotFoundError: If model file cannot be found or downloaded
|
147 |
-
ValueError: If model file is corrupted or too small
|
148 |
-
RuntimeError: If model initialization fails
|
149 |
-
"""
|
150 |
try:
|
151 |
if not os.path.exists(self.model_path):
|
152 |
direct_url = "https://huggingface.co/TheBloke/Mistral-7B-v0.1-GGUF/resolve/main/mistral-7b-v0.1.Q4_K_M.gguf"
|
153 |
download_file_with_progress(direct_url, self.model_path)
|
154 |
-
|
155 |
# Verify file exists and has content
|
156 |
if not os.path.exists(self.model_path):
|
157 |
raise FileNotFoundError(f"Model file {self.model_path} not found after download attempts")
|
|
|
137 |
|
138 |
@st.cache_resource
|
139 |
def initialize_model(self):
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
140 |
try:
|
141 |
if not os.path.exists(self.model_path):
|
142 |
direct_url = "https://huggingface.co/TheBloke/Mistral-7B-v0.1-GGUF/resolve/main/mistral-7b-v0.1.Q4_K_M.gguf"
|
143 |
download_file_with_progress(direct_url, self.model_path)
|
144 |
+
|
145 |
# Verify file exists and has content
|
146 |
if not os.path.exists(self.model_path):
|
147 |
raise FileNotFoundError(f"Model file {self.model_path} not found after download attempts")
|