MCPcopy Create free account
hub / github.com/Ishabdullah/Codey-v2 / load_primary

Method load_primary

core/loader_v2.py:309–341  ·  view source on GitHub ↗

Load the primary (7B) model.

(self)

Source from the content-addressed store, hash-verified

307 self._load_failures: int = 0
308
309 def load_primary(self) -> bool:
310 """Load the primary (7B) model."""
311 try:
312 info(f"Loading model: {MODEL_PATH.name}")
313
314 # Check if model file exists
315 if not MODEL_PATH.exists():
316 error(f"Model file not found: {MODEL_PATH}")
317 self._load_failures += 1
318 return False
319
320 # Check if llama-server binary exists
321 llama_bin = Path(LLAMA_SERVER_BIN)
322 if not llama_bin.exists():
323 error(f"llama-server not found: {LLAMA_SERVER_BIN}")
324 self._load_failures += 1
325 return False
326
327 # Start server
328 self._server = LlamaServer(MODEL_PATH)
329 if not self._server.start():
330 self._load_failures += 1
331 return False
332
333 self._loaded = True
334 self._loaded_at = time.time()
335 success(f"Loaded model ({MODEL_PATH.name})")
336 return True
337
338 except Exception as e:
339 error(f"Failed to load model: {e}")
340 self._load_failures += 1
341 return False
342
343 def unload(self):
344 """Unload (stop) the current model server."""

Callers 6

ensure_modelMethod · 0.95
replFunction · 0.80
mainFunction · 0.80
_main_loopMethod · 0.80
swap_to_finetuned_modelFunction · 0.80
rollback_to_backupFunction · 0.80

Calls 6

infoFunction · 0.90
errorFunction · 0.90
successFunction · 0.90
LlamaServerClass · 0.85
existsMethod · 0.80
startMethod · 0.45

Tested by

no test coverage detected