Add ctx check and re-order __init__. Closes #112
This commit is contained in:
parent
996e31d861
commit
cc706fb944
1 changed files with 5 additions and 2 deletions
|
@ -133,6 +133,9 @@ class Llama:
|
||||||
|
|
||||||
self.n_threads = n_threads or max(multiprocessing.cpu_count() // 2, 1)
|
self.n_threads = n_threads or max(multiprocessing.cpu_count() // 2, 1)
|
||||||
|
|
||||||
|
self.lora_base = lora_base
|
||||||
|
self.lora_path = lora_path
|
||||||
|
|
||||||
if not os.path.exists(model_path):
|
if not os.path.exists(model_path):
|
||||||
raise ValueError(f"Model path does not exist: {model_path}")
|
raise ValueError(f"Model path does not exist: {model_path}")
|
||||||
|
|
||||||
|
@ -140,8 +143,8 @@ class Llama:
|
||||||
self.model_path.encode("utf-8"), self.params
|
self.model_path.encode("utf-8"), self.params
|
||||||
)
|
)
|
||||||
|
|
||||||
self.lora_base = lora_base
|
assert self.ctx is not None
|
||||||
self.lora_path = lora_path
|
|
||||||
if self.lora_path:
|
if self.lora_path:
|
||||||
if llama_cpp.llama_apply_lora_from_file(
|
if llama_cpp.llama_apply_lora_from_file(
|
||||||
self.ctx,
|
self.ctx,
|
||||||
|
|
Loading…
Reference in a new issue