Spaces:
Paused
Paused
Update app.py
Browse files
app.py
CHANGED
|
@@ -1,4 +1,5 @@
|
|
| 1 |
import os
|
|
|
|
| 2 |
import time
|
| 3 |
import random
|
| 4 |
import yaml
|
|
@@ -21,6 +22,24 @@ N_ROWS = 20
|
|
| 21 |
WAIT_TIME = 3600
|
| 22 |
|
| 23 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 24 |
def create_dataset() -> bool:
|
| 25 |
"""
|
| 26 |
Use Scrape Open LLM Leaderboard to create a CSV dataset.
|
|
@@ -316,7 +335,7 @@ def merge_loop():
|
|
| 316 |
# Evaluate model on Runpod
|
| 317 |
create_pod(model_name, USERNAME)
|
| 318 |
|
| 319 |
-
|
| 320 |
command = ["git", "clone", "-q", "https://github.com/Weyaxi/scrape-open-llm-leaderboard"]
|
| 321 |
subprocess.run(command, check=True, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True)
|
| 322 |
|
|
@@ -329,6 +348,8 @@ subprocess.run(command, check=True, stdout=subprocess.PIPE, stderr=subprocess.PI
|
|
| 329 |
command = ["pip", "install", "-e", "mergekit"]
|
| 330 |
subprocess.run(command, check=True, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True)
|
| 331 |
|
|
|
|
|
|
|
| 332 |
# Gradio interface
|
| 333 |
title = """
|
| 334 |
<div align="center">
|
|
@@ -337,8 +358,10 @@ title = """
|
|
| 337 |
<p><em>AutoMerger selects two 7B models on top of the Open LLM Leaderboard, combine them with a merge technique, and evaluate the resulting model.</em></p>
|
| 338 |
</div>
|
| 339 |
"""
|
| 340 |
-
with gr.Blocks() as demo:
|
| 341 |
gr.Markdown(title)
|
|
|
|
|
|
|
| 342 |
demo.launch(server_name="0.0.0.0", prevent_thread_lock=True)
|
| 343 |
|
| 344 |
print("Start AutoMerger...")
|
|
|
|
| 1 |
import os
|
| 2 |
+
import sys
|
| 3 |
import time
|
| 4 |
import random
|
| 5 |
import yaml
|
|
|
|
| 22 |
WAIT_TIME = 3600
|
| 23 |
|
| 24 |
|
| 25 |
+
# Logger from https://github.com/gradio-app/gradio/issues/2362
|
| 26 |
+
class Logger:
|
| 27 |
+
def __init__(self, filename):
|
| 28 |
+
self.terminal = sys.stdout
|
| 29 |
+
self.log = open(filename, "w")
|
| 30 |
+
|
| 31 |
+
def write(self, message):
|
| 32 |
+
self.terminal.write(message)
|
| 33 |
+
self.log.write(message)
|
| 34 |
+
|
| 35 |
+
def flush(self):
|
| 36 |
+
self.terminal.flush()
|
| 37 |
+
self.log.flush()
|
| 38 |
+
|
| 39 |
+
def isatty(self):
|
| 40 |
+
return False
|
| 41 |
+
|
| 42 |
+
|
| 43 |
def create_dataset() -> bool:
|
| 44 |
"""
|
| 45 |
Use Scrape Open LLM Leaderboard to create a CSV dataset.
|
|
|
|
| 335 |
# Evaluate model on Runpod
|
| 336 |
create_pod(model_name, USERNAME)
|
| 337 |
|
| 338 |
+
# Install scrape-open-llm-leaderboard and mergekit
|
| 339 |
command = ["git", "clone", "-q", "https://github.com/Weyaxi/scrape-open-llm-leaderboard"]
|
| 340 |
subprocess.run(command, check=True, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True)
|
| 341 |
|
|
|
|
| 348 |
command = ["pip", "install", "-e", "mergekit"]
|
| 349 |
subprocess.run(command, check=True, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True)
|
| 350 |
|
| 351 |
+
sys.stdout = Logger("output.log")
|
| 352 |
+
|
| 353 |
# Gradio interface
|
| 354 |
title = """
|
| 355 |
<div align="center">
|
|
|
|
| 358 |
<p><em>AutoMerger selects two 7B models on top of the Open LLM Leaderboard, combine them with a merge technique, and evaluate the resulting model.</em></p>
|
| 359 |
</div>
|
| 360 |
"""
|
| 361 |
+
with gr.Blocks(theme=gr.themes.Glass()) as demo:
|
| 362 |
gr.Markdown(title)
|
| 363 |
+
logs = gr.Textbox()
|
| 364 |
+
demo.load(read_logs, None, logs, every=1)
|
| 365 |
demo.launch(server_name="0.0.0.0", prevent_thread_lock=True)
|
| 366 |
|
| 367 |
print("Start AutoMerger...")
|