File size: 344 Bytes
0afcb9c df3a6ee 37f2c10 | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 | from llama_cpp import Llama
def load_model(model_path: str):
n_ctx = 2048 # bạn có thể điều chỉnh tùy theo mô hình
llm = Llama(
model_path=model_path,
n_ctx=n_ctx,
n_threads=4,
n_gpu_layers=0,
use_mlock=False,
logits_all=False
)
return {"llm": llm, "n_ctx": n_ctx}
|