mirror of
https://github.com/abetlen/llama-cpp-python.git
synced 2023-09-07 17:34:22 +03:00
Add ctx check and re-order __init__. Closes #112
This commit is contained in:
@@ -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,
|
||||||
|
|||||||
Reference in New Issue
Block a user