Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
|
@@ -58,7 +58,7 @@ def replyA(prompt, history, modelA):
|
|
| 58 |
df = pd.read_csv("models.csv")
|
| 59 |
df.loc[df["MODEL"] == modelA, "MATCHES_PLAYED"] += 1
|
| 60 |
df.to_csv("models.csv", index=False)
|
| 61 |
-
pipeA = pipeline("text-generation", model=models_and_tokenizers[modelA][0], tokenizer=models_and_tokenizers[modelA][1], max_new_tokens=512, repetition_penalty=1.5, temperature=0.5,
|
| 62 |
responseA = run_inference(pipeA, prompt)
|
| 63 |
r = ''
|
| 64 |
for c in responseA:
|
|
@@ -72,7 +72,7 @@ def replyB(prompt, history, modelB):
|
|
| 72 |
df = pd.read_csv("models.csv")
|
| 73 |
df.loc[df["MODEL"] == modelB, "MATCHES_PLAYED"] += 1
|
| 74 |
df.to_csv("models.csv", index=False)
|
| 75 |
-
pipeB = pipeline("text-generation", model=models_and_tokenizers[modelB][0], tokenizer=models_and_tokenizers[modelB][1], max_new_tokens=512, repetition_penalty=1.5, temperature=0.5,
|
| 76 |
responseB = run_inference(pipeB, prompt)
|
| 77 |
r = ''
|
| 78 |
for c in responseB:
|
|
@@ -106,9 +106,7 @@ with gr.Blocks() as demo1:
|
|
| 106 |
btnA.click(modelA_button, inputs=None, outputs=None)
|
| 107 |
btnB.click(modelB_button, inputs=None, outputs=None)
|
| 108 |
|
| 109 |
-
demo = gr.TabbedInterface([demo1, demo2], ["Chat Arena", "Leaderboard"]
|
| 110 |
-
<h2 align='center'>Cast your vote to choose the best Small Language Model (100M-1.7B)!🚀</h2>
|
| 111 |
-
<h3 align='center'>[<a href="https://github.com/AstraBert/smollm-arena">GitHub</a>] [<a href="https://github.com/AstraBert/smollm-arena?tab=readme-ov-file#usage">Usage Guide</a>]""")
|
| 112 |
|
| 113 |
if __name__ == "__main__":
|
| 114 |
demo.launch(server_name="0.0.0.0", server_port=7860)
|
|
|
|
| 58 |
df = pd.read_csv("models.csv")
|
| 59 |
df.loc[df["MODEL"] == modelA, "MATCHES_PLAYED"] += 1
|
| 60 |
df.to_csv("models.csv", index=False)
|
| 61 |
+
pipeA = pipeline("text-generation", model=models_and_tokenizers[modelA][0], tokenizer=models_and_tokenizers[modelA][1], max_new_tokens=512, repetition_penalty=1.5, temperature=0.5, device_map="cuda:0")
|
| 62 |
responseA = run_inference(pipeA, prompt)
|
| 63 |
r = ''
|
| 64 |
for c in responseA:
|
|
|
|
| 72 |
df = pd.read_csv("models.csv")
|
| 73 |
df.loc[df["MODEL"] == modelB, "MATCHES_PLAYED"] += 1
|
| 74 |
df.to_csv("models.csv", index=False)
|
| 75 |
+
pipeB = pipeline("text-generation", model=models_and_tokenizers[modelB][0], tokenizer=models_and_tokenizers[modelB][1], max_new_tokens=512, repetition_penalty=1.5, temperature=0.5, device_map="cuda:0")
|
| 76 |
responseB = run_inference(pipeB, prompt)
|
| 77 |
r = ''
|
| 78 |
for c in responseB:
|
|
|
|
| 106 |
btnA.click(modelA_button, inputs=None, outputs=None)
|
| 107 |
btnB.click(modelB_button, inputs=None, outputs=None)
|
| 108 |
|
| 109 |
+
demo = gr.TabbedInterface([demo1, demo2], ["Chat Arena", "Leaderboard"])
|
|
|
|
|
|
|
| 110 |
|
| 111 |
if __name__ == "__main__":
|
| 112 |
demo.launch(server_name="0.0.0.0", server_port=7860)
|