Spaces:
Runtime error
Runtime error
Fix WIP
Browse files
app.py
CHANGED
@@ -11,7 +11,7 @@ with gr.Blocks() as iface:
|
|
11 |
"""# Petals playground
|
12 |
**Let's play with prompts and inference settings for BLOOM and BLOOMZ 176B models!**
|
13 |
|
14 |
-
This space uses websocket API of [chat.petals.
|
15 |
|
16 |
Do NOT talk to BLOOM as an entity, it's not a chatbot but a webpage/blog/article completion model.
|
17 |
For the best results: MIMIC a few sentences of a webpage similar to the content you want to generate.
|
|
|
11 |
"""# Petals playground
|
12 |
**Let's play with prompts and inference settings for BLOOM and BLOOMZ 176B models!**
|
13 |
|
14 |
+
This space uses websocket API of [chat.petals.dev](http://chat.petals.dev). Health status of Petals network [lives here](http://health.petals.dev).
|
15 |
|
16 |
Do NOT talk to BLOOM as an entity, it's not a chatbot but a webpage/blog/article completion model.
|
17 |
For the best results: MIMIC a few sentences of a webpage similar to the content you want to generate.
|
chat.py
CHANGED
@@ -6,8 +6,8 @@ import gradio as gr
|
|
6 |
|
7 |
import chat_client
|
8 |
|
9 |
-
CHAT_URL = "ws://chat.petals.
|
10 |
-
#
|
11 |
|
12 |
EMPTY_STATE = {
|
13 |
"generate": False,
|
@@ -81,7 +81,7 @@ def _generate(
|
|
81 |
|
82 |
try:
|
83 |
state["client"] = chat_client.ModelClient(CHAT_URL)
|
84 |
-
state["client"].open_session(
|
85 |
state["model"] = model
|
86 |
except Exception as e:
|
87 |
print(datetime.now(), str(e)[-500:])
|
@@ -211,7 +211,7 @@ with gr.Blocks() as iface_chat:
|
|
211 |
|
212 |
with gr.Row():
|
213 |
model = gr.Radio(
|
214 |
-
["
|
215 |
)
|
216 |
|
217 |
# Additional ending sequence, at which generation shoud stop
|
|
|
6 |
|
7 |
import chat_client
|
8 |
|
9 |
+
CHAT_URL = "ws://chat.petals.dev/api/v2/generate"
|
10 |
+
#CHAT_URL='ws://localhost:8000/api/v2/generate'
|
11 |
|
12 |
EMPTY_STATE = {
|
13 |
"generate": False,
|
|
|
81 |
|
82 |
try:
|
83 |
state["client"] = chat_client.ModelClient(CHAT_URL)
|
84 |
+
state["client"].open_session(model, max_length)
|
85 |
state["model"] = model
|
86 |
except Exception as e:
|
87 |
print(datetime.now(), str(e)[-500:])
|
|
|
211 |
|
212 |
with gr.Row():
|
213 |
model = gr.Radio(
|
214 |
+
["petals-team/StableBeluga2", "meta-llama/Llama-2-70b-chat-hf", "bigscience/bloomz"], value="petals-team/StableBeluga2", label="Use model"
|
215 |
)
|
216 |
|
217 |
# Additional ending sequence, at which generation shoud stop
|
chat_client.py
CHANGED
@@ -59,8 +59,8 @@ class ModelClient(object):
|
|
59 |
|
60 |
def main():
|
61 |
client = ModelClient("ws://localhost:8000/api/v2/generate")
|
62 |
-
#
|
63 |
-
client.open_session("
|
64 |
|
65 |
if len(sys.argv) > 1:
|
66 |
prompt = sys.argv[1]
|
|
|
59 |
|
60 |
def main():
|
61 |
client = ModelClient("ws://localhost:8000/api/v2/generate")
|
62 |
+
#client = ModelClient("ws://chat.petals.dev/api/v2/generate")
|
63 |
+
client.open_session("stabilityai/StableBeluga2", 128)
|
64 |
|
65 |
if len(sys.argv) > 1:
|
66 |
prompt = sys.argv[1]
|
prompt.py
CHANGED
@@ -4,8 +4,8 @@ import gradio as gr
|
|
4 |
|
5 |
import chat_client
|
6 |
|
7 |
-
CHAT_URL = "ws://chat.petals.
|
8 |
-
#
|
9 |
|
10 |
|
11 |
def generate(state, *args):
|
@@ -48,7 +48,7 @@ def _generate(
|
|
48 |
|
49 |
try:
|
50 |
client = chat_client.ModelClient(CHAT_URL)
|
51 |
-
client.open_session(
|
52 |
except Exception as e:
|
53 |
print(datetime.now(), str(e)[-500:])
|
54 |
raise gr.Error(str(e)[-500:])
|
@@ -94,7 +94,7 @@ def _generate(
|
|
94 |
temperature=temperature,
|
95 |
top_k=top_k,
|
96 |
top_p=top_p,
|
97 |
-
|
98 |
):
|
99 |
|
100 |
if not state["generate"]:
|
@@ -137,7 +137,7 @@ with gr.Blocks() as iface_prompt:
|
|
137 |
|
138 |
with gr.Row():
|
139 |
model = gr.Radio(
|
140 |
-
["
|
141 |
)
|
142 |
|
143 |
# Additional ending sequence, at which generation shoud stop
|
@@ -258,7 +258,7 @@ with gr.Blocks() as iface_prompt:
|
|
258 |
],
|
259 |
[
|
260 |
"Lorem ipsum dolor sit amet, ",
|
261 |
-
"
|
262 |
True,
|
263 |
0,
|
264 |
0.9,
|
|
|
4 |
|
5 |
import chat_client
|
6 |
|
7 |
+
CHAT_URL = "ws://chat.petals.dev/api/v2/generate"
|
8 |
+
#CHAT_URL='ws://localhost:8000/api/v2/generate'
|
9 |
|
10 |
|
11 |
def generate(state, *args):
|
|
|
48 |
|
49 |
try:
|
50 |
client = chat_client.ModelClient(CHAT_URL)
|
51 |
+
client.open_session(model, max_length)
|
52 |
except Exception as e:
|
53 |
print(datetime.now(), str(e)[-500:])
|
54 |
raise gr.Error(str(e)[-500:])
|
|
|
94 |
temperature=temperature,
|
95 |
top_k=top_k,
|
96 |
top_p=top_p,
|
97 |
+
stop_sequences=seq,
|
98 |
):
|
99 |
|
100 |
if not state["generate"]:
|
|
|
137 |
|
138 |
with gr.Row():
|
139 |
model = gr.Radio(
|
140 |
+
["petals-team/StableBeluga2", "codellama/CodeLlama-34b-Instruct-hf", " meta-llama/Llama-2-70b-chat-hf", "meta-llama/Llama-2-70b-hf", "bigscience/bloomz", "bigscience/bloom"], value="stabilityai/StableBeluga2", label="Use model"
|
141 |
)
|
142 |
|
143 |
# Additional ending sequence, at which generation shoud stop
|
|
|
258 |
],
|
259 |
[
|
260 |
"Lorem ipsum dolor sit amet, ",
|
261 |
+
"petals-team/StableBeluga2",
|
262 |
True,
|
263 |
0,
|
264 |
0.9,
|