Skip to content

Commit

Permalink
feat: 将LLaMA.cpp用作默认模型
Browse files Browse the repository at this point in the history
  • Loading branch information
GaiZhenbiao committed Sep 28, 2023
1 parent 783d4f9 commit 4bfd3a0
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 2 deletions.
12 changes: 11 additions & 1 deletion modules/models/LLaMA.py
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,16 @@ def _get_llama_style_input(self):
else:
context.append(conv["content"] + OUTPUT_POSTFIX)
return "".join(context)
# for conv in self.history:
# if conv["role"] == "system":
# context.append(conv["content"])
# elif conv["role"] == "user":
# context.append(
# conv["content"]
# )
# else:
# context.append(conv["content"])
# return "\n\n".join(context)+"\n\n"

def get_answer_at_once(self):
context = self._get_llama_style_input()
Expand All @@ -105,7 +115,7 @@ def get_answer_stream_iter(self):
iter = self.model(
context,
max_tokens=self.max_generation_token,
stop=[],
stop=[SYS_PREFIX, SYS_POSTFIX, INST_PREFIX, OUTPUT_PREFIX,OUTPUT_POSTFIX],
echo=False,
stream=True,
)
Expand Down
2 changes: 1 addition & 1 deletion modules/models/base_model.py
Original file line number Diff line number Diff line change
Expand Up @@ -176,7 +176,7 @@ def get_type(cls, model_name: str):
elif "星火大模型" in model_name_lower:
model_type = ModelType.Spark
else:
model_type = ModelType.Unknown
model_type = ModelType.LLaMA
return model_type


Expand Down

0 comments on commit 4bfd3a0

Please sign in to comment.