Update app.py
Browse files
app.py
CHANGED
|
@@ -8,10 +8,13 @@ print(os.environ)
|
|
| 8 |
openai.api_base = os.environ.get("OPENAI_API_BASE")
|
| 9 |
openai.api_key = os.environ.get("OPENAI_API_KEY")
|
| 10 |
|
| 11 |
-
BASE_SYSTEM_MESSAGE = """
|
|
|
|
|
|
|
|
|
|
| 12 |
|
| 13 |
def make_prediction(prompt, max_tokens=None, temperature=None, top_p=None, top_k=None, repetition_penalty=None):
|
| 14 |
-
completion = openai.Completion.create(model="Open-Orca/
|
| 15 |
for chunk in completion:
|
| 16 |
yield chunk["choices"][0]["text"]
|
| 17 |
|
|
@@ -72,11 +75,11 @@ with gr.Blocks(css=CSS) as demo:
|
|
| 72 |
with gr.Row():
|
| 73 |
with gr.Column():
|
| 74 |
gr.Markdown(f"""
|
| 75 |
-
## This demo is an unquantized GPU chatbot of [
|
| 76 |
Brought to you by your friends at Alignment Lab AI, OpenChat, and Open Access AI Collective!
|
| 77 |
""")
|
| 78 |
with gr.Row():
|
| 79 |
-
gr.Markdown("# π
|
| 80 |
with gr.Row():
|
| 81 |
#chatbot = gr.Chatbot().style(height=500)
|
| 82 |
chatbot = gr.Chatbot(elem_id="chatbot")
|
|
@@ -94,7 +97,7 @@ with gr.Blocks(css=CSS) as demo:
|
|
| 94 |
with gr.Row():
|
| 95 |
with gr.Column():
|
| 96 |
max_tokens = gr.Slider(20, 1000, label="Max Tokens", step=20, value=500)
|
| 97 |
-
temperature = gr.Slider(0.
|
| 98 |
top_p = gr.Slider(0.0, 1.0, label="Top P", step=0.05, value=0.95)
|
| 99 |
top_k = gr.Slider(0, 100, label="Top K", step=1, value=40)
|
| 100 |
repetition_penalty = gr.Slider(0.0, 2.0, label="Repetition Penalty", step=0.1, value=1.1)
|
|
|
|
| 8 |
openai.api_base = os.environ.get("OPENAI_API_BASE")
|
| 9 |
openai.api_key = os.environ.get("OPENAI_API_KEY")
|
| 10 |
|
| 11 |
+
BASE_SYSTEM_MESSAGE = """I am MistralOra. I was trained by Alignment Lab AI.
|
| 12 |
+
I carefully provide accurate, factual, thoughtful, nuanced answers and am brilliant at reasoning.
|
| 13 |
+
I am an assistant who thinks through their answers step-by-step to be sure I always get the right answer.
|
| 14 |
+
I think more clearly if I write out my thought process in a scratchpad manner first; therefore, I always explain background context, assumptions, and step-by-step thinking BEFORE trying to answer a question."""
|
| 15 |
|
| 16 |
def make_prediction(prompt, max_tokens=None, temperature=None, top_p=None, top_k=None, repetition_penalty=None):
|
| 17 |
+
completion = openai.Completion.create(model="Open-Orca/Mistral-7B-OpenOrca", prompt=prompt, max_tokens=max_tokens, temperature=temperature, top_p=top_p, top_k=top_k, repetition_penalty=repetition_penalty, stream=True, stop=["</s>", "<|im_end|>"])
|
| 18 |
for chunk in completion:
|
| 19 |
yield chunk["choices"][0]["text"]
|
| 20 |
|
|
|
|
| 75 |
with gr.Row():
|
| 76 |
with gr.Column():
|
| 77 |
gr.Markdown(f"""
|
| 78 |
+
## This demo is an unquantized GPU chatbot of [Mistral-7B-OpenOrca](https://huggingface.co/Open-Orca/Mistral-7B-OpenOrca)
|
| 79 |
Brought to you by your friends at Alignment Lab AI, OpenChat, and Open Access AI Collective!
|
| 80 |
""")
|
| 81 |
with gr.Row():
|
| 82 |
+
gr.Markdown("# π Mistral-7B-OpenOrca Playground Space! π")
|
| 83 |
with gr.Row():
|
| 84 |
#chatbot = gr.Chatbot().style(height=500)
|
| 85 |
chatbot = gr.Chatbot(elem_id="chatbot")
|
|
|
|
| 97 |
with gr.Row():
|
| 98 |
with gr.Column():
|
| 99 |
max_tokens = gr.Slider(20, 1000, label="Max Tokens", step=20, value=500)
|
| 100 |
+
temperature = gr.Slider(0.1, 2.0, label="Temperature", step=0.1, value=0.8)
|
| 101 |
top_p = gr.Slider(0.0, 1.0, label="Top P", step=0.05, value=0.95)
|
| 102 |
top_k = gr.Slider(0, 100, label="Top K", step=1, value=40)
|
| 103 |
repetition_penalty = gr.Slider(0.0, 2.0, label="Repetition Penalty", step=0.1, value=1.1)
|