Spaces:
Running
on
TPU v5e
Running
on
TPU v5e
martin-gorner
commited on
Commit
·
3a9ff40
1
Parent(s):
38f8411
info string changes
Browse files
app.py
CHANGED
@@ -29,21 +29,21 @@ from models import (
|
|
29 |
model_labels_list = list(model_labels)
|
30 |
|
31 |
# load and warm up (compile) all the models
|
32 |
-
models = []
|
33 |
-
for preset in model_presets:
|
34 |
-
|
35 |
-
|
36 |
-
|
37 |
-
|
38 |
-
|
39 |
-
|
40 |
-
|
41 |
|
42 |
# For local debugging
|
43 |
-
|
44 |
-
|
45 |
-
|
46 |
-
|
47 |
|
48 |
|
49 |
def chat_turn_assistant_1(
|
@@ -184,10 +184,9 @@ with gr.Blocks(fill_width=True, title="Keras demo") as demo:
|
|
184 |
gr.HTML(
|
185 |
"<H2> Battle of the Keras chatbots on TPU</H2>"
|
186 |
+ "All the models are loaded into the TPU memory. "
|
187 |
-
+ "You can call any of them and compare their answers.
|
188 |
-
+ "The entire chat
|
189 |
-
+ "This demo is runnig on a Google TPU v5e 2x4 (8 cores).
|
190 |
-
+ "All models run on `bfloat16` precision.",
|
191 |
)
|
192 |
with gr.Row():
|
193 |
sel1, sel2 = instantiate_select_boxes(0, 1, model_labels_list)
|
|
|
29 |
model_labels_list = list(model_labels)
|
30 |
|
31 |
# load and warm up (compile) all the models
|
32 |
+
# models = []
|
33 |
+
# for preset in model_presets:
|
34 |
+
# model = load_model(preset)
|
35 |
+
# chat_template = get_appropriate_chat_template(preset)
|
36 |
+
# chat_state = ChatState(model, "", chat_template)
|
37 |
+
# prompt, response = chat_state.send_message("Hello")
|
38 |
+
# print("model " + preset + " loaded and initialized.")
|
39 |
+
# print("The model responded: " + response)
|
40 |
+
# models.append(model)
|
41 |
|
42 |
# For local debugging
|
43 |
+
model = keras_hub.models.Llama3CausalLM.from_preset(
|
44 |
+
"hf://meta-llama/Llama-3.2-1B-Instruct", dtype="bfloat16"
|
45 |
+
)
|
46 |
+
models = [model, model, model, model, model]
|
47 |
|
48 |
|
49 |
def chat_turn_assistant_1(
|
|
|
184 |
gr.HTML(
|
185 |
"<H2> Battle of the Keras chatbots on TPU</H2>"
|
186 |
+ "All the models are loaded into the TPU memory. "
|
187 |
+
+ "You can call any of them and compare their answers. "
|
188 |
+
+ "The entire chat<br/>history is fed to the models at every submission. "
|
189 |
+
+ "This demo is runnig on a Google TPU v5e 2x4 (8 cores) in bfloat16 precision."
|
|
|
190 |
)
|
191 |
with gr.Row():
|
192 |
sel1, sel2 = instantiate_select_boxes(0, 1, model_labels_list)
|