implement together/solar

modified:   README.rst
	modified:   app.py
This commit is contained in:
Russell Ballestrini 2023-12-29 13:28:53 -05:00
parent 79cc174b28
commit d666efb162
2 changed files with 18 additions and 0 deletions

View file

@ -100,6 +100,7 @@ To interact with the various language models, you can use the following commands
- For Together OpenChat, send a message with ``together/openchat`` and include your prompt.
- For Together Mistral, send a message with ``together/mistral`` and include your prompt.
- For Together Mixtral, send a message with ``together/mixtral`` and include your prompt.
- For Together Solar, send a message with ``together/solar`` and include your prompt.
- For Dall-e-3, send a message with ``dall-e-3`` and include your prompt.
The system will process your message and provide a response from the selected language model.

17
app.py
View file

@ -44,6 +44,7 @@ system_users = [
"mistralai/Mixtral-8x7B-v0.1",
"mistralai/Mistral-7B-Instruct-v0.1",
"openchat/openchat-3.5-1210",
"upstage/SOLAR-10.7B-Instruct-v1.0",
]
@ -328,6 +329,15 @@ def handle_message(data):
data["message"],
model_name="mistralai/Mistral-7B-Instruct-v0.1",
)
if "together/solar" in data["message"]:
eventlet.spawn(
chat_together,
data["username"],
room.name,
data["message"],
model_name="upstage/SOLAR-10.7B-Instruct-v1.0",
stop=["###", "</s>"],
)
@socketio.on("delete_message")
@ -741,6 +751,10 @@ def chat_together(
]
if "mistralai" in model_name:
chat_history_str = "\n\n".join(chat_history)
elif "solar" in model_name:
chat_history_str = "### \n\n".join(chat_history)
chat_history_str += "### Assistant:"
else:
chat_history_str = "<|end_of_turn|>\n\n".join(chat_history)
chat_history_str += "<|end_of_turn|>Math Correct Assistant:"
@ -761,6 +775,9 @@ def chat_together(
prompt = f"{chat_history_str}"
if "mistralai" in model_name:
prompt = f"[INST] {chat_history_str} [/INST]"
if "solar" in model_name:
prompt = f"<s> {chat_history_str}"
chunks = together.Complete.create_streaming(
prompt,
model=model_name,