xuqinyang commited on
Commit
dbc3c4a
·
1 Parent(s): ea0d3c0

Update model.py

Browse files
Files changed (1) hide show
  1. model.py +2 -2
model.py CHANGED
@@ -9,7 +9,7 @@ from huggingface_hub import snapshot_download
9
 
10
  snapshot_download(model_id, local_dir="./")
11
  from llama_cpp import Llama
12
- self.llm = Llama(model_path="./ggml-model-q4_0.bin", n_ctx=4096,seed=-1,n_threads=4)
13
 
14
  def run(message: str,
15
  chat_history: list[tuple[str, str]],
@@ -22,6 +22,6 @@ def run(message: str,
22
  for i in chat_history:
23
  history.append({"role": "user", "content": i[0]})
24
  history.append({"role": "assistant", "content": i[1]})
25
- for response in self.llm.create_chat_completion(messages,stream=True,max_tokens=-1,temperature=0.3,top_k=5,top_p=0.85,repeat_penalty=1.1):
26
  if "content" in response["choices"][0]["delta"]:
27
  yield response["choices"][0]["delta"]["content"]
 
9
 
10
  snapshot_download(model_id, local_dir="./")
11
  from llama_cpp import Llama
12
+ llm = Llama(model_path="./ggml-model-q4_0.bin", n_ctx=4096,seed=-1,n_threads=4)
13
 
14
  def run(message: str,
15
  chat_history: list[tuple[str, str]],
 
22
  for i in chat_history:
23
  history.append({"role": "user", "content": i[0]})
24
  history.append({"role": "assistant", "content": i[1]})
25
+ for response in llm.create_chat_completion(messages,stream=True,max_tokens=-1,temperature=0.3,top_k=5,top_p=0.85,repeat_penalty=1.1):
26
  if "content" in response["choices"][0]["delta"]:
27
  yield response["choices"][0]["delta"]["content"]