Patryk Studzinski commited on
Commit
cdff838
·
1 Parent(s): baa08b7

enhance error handling in LlamaCppModel initialization; include full traceback on failure

Browse files
app/models/llama_cpp_model.py CHANGED
@@ -5,6 +5,7 @@ Highly optimized for CPU inference.
5
 
6
  import os
7
  import asyncio
 
8
  from typing import List, Dict, Any, Optional
9
  from app.models.base_llm import BaseLLM
10
 
@@ -58,8 +59,11 @@ class LlamaCppModel(BaseLLM):
58
  print(f"[{self.name}] GGUF Model loaded successfully (n_ctx={self.n_ctx})")
59
 
60
  except Exception as e:
61
- print(f"[{self.name}] Failed to load GGUF model: {e}")
62
- raise
 
 
 
63
 
64
  async def generate(
65
  self,
 
5
 
6
  import os
7
  import asyncio
8
+ import traceback
9
  from typing import List, Dict, Any, Optional
10
  from app.models.base_llm import BaseLLM
11
 
 
59
  print(f"[{self.name}] GGUF Model loaded successfully (n_ctx={self.n_ctx})")
60
 
61
  except Exception as e:
62
+ error_msg = str(e) if str(e) else repr(e)
63
+ print(f"[{self.name}] Failed to load GGUF model: {error_msg}")
64
+ print(f"[{self.name}] Full traceback:")
65
+ traceback.print_exc()
66
+ raise RuntimeError(f"Failed to load GGUF model: {error_msg}") from e
67
 
68
  async def generate(
69
  self,
app/models/registry.py CHANGED
@@ -23,10 +23,11 @@ MODEL_CONFIG = {
23
  "size": "1.5B",
24
  },
25
  "bielik-1.5b-gguf": {
26
- "id": "speakleash/Bielik-1.5B-v3.0-Instruct-GGUF",
27
- "filename": "Bielik-1.5B-v3.0-Instruct.Q8_0.gguf",
28
- "type": "gguf",
29
- "size": "1.7 GB",
 
30
  },
31
  "qwen2.5-3b": {
32
  "id": "Qwen/Qwen2.5-3B-Instruct",
 
23
  "size": "1.5B",
24
  },
25
  "bielik-1.5b-gguf": {
26
+ "id": "speakleash/Bielik-1.5B-v3.0-Instruct-GGUF",
27
+ "local_path": "bielik-1.5b-gguf",
28
+ "filename": "Bielik-1.5B-v3.0-Instruct.Q8_0.gguf",
29
+ "type": "gguf",
30
+ "size": "1.7 GB",
31
  },
32
  "qwen2.5-3b": {
33
  "id": "Qwen/Qwen2.5-3B-Instruct",