Spaces:
Sleeping
Sleeping
johnsmith253325
commited on
Commit
·
4bfd3a0
1
Parent(s):
783d4f9
feat: 将LLaMA.cpp用作默认模型
Browse files- modules/models/LLaMA.py +11 -1
- modules/models/base_model.py +1 -1
modules/models/LLaMA.py
CHANGED
|
@@ -88,6 +88,16 @@ class LLaMA_Client(BaseLLMModel):
|
|
| 88 |
else:
|
| 89 |
context.append(conv["content"] + OUTPUT_POSTFIX)
|
| 90 |
return "".join(context)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 91 |
|
| 92 |
def get_answer_at_once(self):
|
| 93 |
context = self._get_llama_style_input()
|
|
@@ -105,7 +115,7 @@ class LLaMA_Client(BaseLLMModel):
|
|
| 105 |
iter = self.model(
|
| 106 |
context,
|
| 107 |
max_tokens=self.max_generation_token,
|
| 108 |
-
stop=[],
|
| 109 |
echo=False,
|
| 110 |
stream=True,
|
| 111 |
)
|
|
|
|
| 88 |
else:
|
| 89 |
context.append(conv["content"] + OUTPUT_POSTFIX)
|
| 90 |
return "".join(context)
|
| 91 |
+
# for conv in self.history:
|
| 92 |
+
# if conv["role"] == "system":
|
| 93 |
+
# context.append(conv["content"])
|
| 94 |
+
# elif conv["role"] == "user":
|
| 95 |
+
# context.append(
|
| 96 |
+
# conv["content"]
|
| 97 |
+
# )
|
| 98 |
+
# else:
|
| 99 |
+
# context.append(conv["content"])
|
| 100 |
+
# return "\n\n".join(context)+"\n\n"
|
| 101 |
|
| 102 |
def get_answer_at_once(self):
|
| 103 |
context = self._get_llama_style_input()
|
|
|
|
| 115 |
iter = self.model(
|
| 116 |
context,
|
| 117 |
max_tokens=self.max_generation_token,
|
| 118 |
+
stop=[SYS_PREFIX, SYS_POSTFIX, INST_PREFIX, OUTPUT_PREFIX,OUTPUT_POSTFIX],
|
| 119 |
echo=False,
|
| 120 |
stream=True,
|
| 121 |
)
|
modules/models/base_model.py
CHANGED
|
@@ -176,7 +176,7 @@ class ModelType(Enum):
|
|
| 176 |
elif "星火大模型" in model_name_lower:
|
| 177 |
model_type = ModelType.Spark
|
| 178 |
else:
|
| 179 |
-
model_type = ModelType.
|
| 180 |
return model_type
|
| 181 |
|
| 182 |
|
|
|
|
| 176 |
elif "星火大模型" in model_name_lower:
|
| 177 |
model_type = ModelType.Spark
|
| 178 |
else:
|
| 179 |
+
model_type = ModelType.LLaMA
|
| 180 |
return model_type
|
| 181 |
|
| 182 |
|