From d666efb1625bce4c076f7b6843d50484ded25763 Mon Sep 17 00:00:00 2001 From: Russell Ballestrini Date: Fri, 29 Dec 2023 13:28:53 -0500 Subject: [PATCH] implement together/solar modified: README.rst modified: app.py --- README.rst | 1 + app.py | 17 +++++++++++++++++ 2 files changed, 18 insertions(+) diff --git a/README.rst b/README.rst index 0732bfc..09f1062 100644 --- a/README.rst +++ b/README.rst @@ -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. diff --git a/app.py b/app.py index e58eafe..b7f063f 100644 --- a/app.py +++ b/app.py @@ -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=["###", ""], + ) @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" {chat_history_str}" + chunks = together.Complete.create_streaming( prompt, model=model_name,