Update app.py
Browse files
app.py
CHANGED
|
@@ -20,6 +20,7 @@ from forgekit.config_generator import (
|
|
| 20 |
MERGE_METHODS, PRESETS,
|
| 21 |
)
|
| 22 |
from forgekit.notebook_generator import generate_merge_notebook, save_notebook
|
|
|
|
| 23 |
|
| 24 |
# ===== THEME =====
|
| 25 |
theme = gr.themes.Base(
|
|
@@ -622,7 +623,87 @@ license: apache-2.0
|
|
| 622 |
d_btn.click(gen_deploy, [d_model, d_type], [d_output, d_readme])
|
| 623 |
|
| 624 |
# =====================================================
|
| 625 |
-
# TAB 5:
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 626 |
# =====================================================
|
| 627 |
with gr.Tab("๐ Leaderboard", id="leaderboard"):
|
| 628 |
gr.Markdown("""### Community Merge Leaderboard
|
|
@@ -667,4 +748,4 @@ license: apache-2.0
|
|
| 667 |
|
| 668 |
|
| 669 |
if __name__ == "__main__":
|
| 670 |
-
demo.launch(theme=theme, css=CSS)
|
|
|
|
| 20 |
MERGE_METHODS, PRESETS,
|
| 21 |
)
|
| 22 |
from forgekit.notebook_generator import generate_merge_notebook, save_notebook
|
| 23 |
+
from forgekit.ai_advisor import merge_advisor, model_describer, config_explainer
|
| 24 |
|
| 25 |
# ===== THEME =====
|
| 26 |
theme = gr.themes.Base(
|
|
|
|
| 623 |
d_btn.click(gen_deploy, [d_model, d_type], [d_output, d_readme])
|
| 624 |
|
| 625 |
# =====================================================
|
| 626 |
+
# TAB 5: AI ADVISOR
|
| 627 |
+
# =====================================================
|
| 628 |
+
with gr.Tab("๐ค AI Advisor", id="ai"):
|
| 629 |
+
gr.Markdown("""### AI-Powered Merge Intelligence
|
| 630 |
+
Get smart recommendations, capability predictions, and plain-English explanations โ powered by open-source LLMs via HF Inference API.""")
|
| 631 |
+
|
| 632 |
+
ai_token = gr.Textbox(
|
| 633 |
+
label="HF Token (recommended for faster responses)",
|
| 634 |
+
type="password",
|
| 635 |
+
placeholder="hf_... (optional but reduces rate limits)",
|
| 636 |
+
)
|
| 637 |
+
|
| 638 |
+
with gr.Tabs():
|
| 639 |
+
# --- Merge Advisor ---
|
| 640 |
+
with gr.Tab("๐ก Merge Advisor"):
|
| 641 |
+
gr.Markdown("**Tell the AI what models you want to merge and it'll recommend the best strategy.**")
|
| 642 |
+
ai_models = gr.Textbox(
|
| 643 |
+
label="Models (one per line)",
|
| 644 |
+
placeholder="Qwen/Qwen2.5-Coder-7B-Instruct\nQwen/Qwen2.5-Math-7B-Instruct",
|
| 645 |
+
lines=4,
|
| 646 |
+
)
|
| 647 |
+
ai_goal = gr.Textbox(
|
| 648 |
+
label="What do you want the merged model to do?",
|
| 649 |
+
placeholder="I want a model that's great at both coding and math reasoning",
|
| 650 |
+
)
|
| 651 |
+
ai_advise_btn = gr.Button("๐ก Get Recommendation", variant="primary")
|
| 652 |
+
ai_advise_out = gr.Markdown()
|
| 653 |
+
|
| 654 |
+
ai_advise_btn.click(
|
| 655 |
+
merge_advisor, [ai_models, ai_goal, ai_token], ai_advise_out
|
| 656 |
+
)
|
| 657 |
+
|
| 658 |
+
# --- Model Describer ---
|
| 659 |
+
with gr.Tab("๐ฎ Capability Predictor"):
|
| 660 |
+
gr.Markdown("**Predict what your merged model will be good (and bad) at.**")
|
| 661 |
+
desc_models = gr.Textbox(
|
| 662 |
+
label="Models (one per line)",
|
| 663 |
+
placeholder="Qwen/Qwen2.5-Coder-7B-Instruct\nQwen/Qwen2.5-Math-7B-Instruct",
|
| 664 |
+
lines=4,
|
| 665 |
+
)
|
| 666 |
+
desc_method = gr.Textbox(label="Merge Method", placeholder="dare_ties")
|
| 667 |
+
desc_weights = gr.Textbox(label="Weights", placeholder="0.5, 0.5")
|
| 668 |
+
desc_btn = gr.Button("๐ฎ Predict Capabilities", variant="primary")
|
| 669 |
+
desc_out = gr.Markdown()
|
| 670 |
+
|
| 671 |
+
desc_btn.click(
|
| 672 |
+
model_describer, [desc_models, desc_method, desc_weights, ai_token], desc_out
|
| 673 |
+
)
|
| 674 |
+
|
| 675 |
+
# --- Config Explainer ---
|
| 676 |
+
with gr.Tab("๐ Config Explainer"):
|
| 677 |
+
gr.Markdown("**Paste any mergekit YAML config and get a plain-English explanation.**")
|
| 678 |
+
explain_yaml = gr.Code(
|
| 679 |
+
label="Paste YAML Config",
|
| 680 |
+
language="yaml",
|
| 681 |
+
lines=12,
|
| 682 |
+
value="""merge_method: dare_ties
|
| 683 |
+
base_model: Qwen/Qwen2.5-7B-Instruct
|
| 684 |
+
models:
|
| 685 |
+
- model: Qwen/Qwen2.5-Coder-7B-Instruct
|
| 686 |
+
parameters:
|
| 687 |
+
weight: 0.5
|
| 688 |
+
density: 0.7
|
| 689 |
+
- model: Qwen/Qwen2.5-Math-7B-Instruct
|
| 690 |
+
parameters:
|
| 691 |
+
weight: 0.5
|
| 692 |
+
density: 0.6
|
| 693 |
+
parameters:
|
| 694 |
+
int8_mask: true
|
| 695 |
+
normalize: true
|
| 696 |
+
dtype: bfloat16""",
|
| 697 |
+
)
|
| 698 |
+
explain_btn = gr.Button("๐ Explain This Config", variant="primary")
|
| 699 |
+
explain_out = gr.Markdown()
|
| 700 |
+
|
| 701 |
+
explain_btn.click(
|
| 702 |
+
config_explainer, [explain_yaml, ai_token], explain_out
|
| 703 |
+
)
|
| 704 |
+
|
| 705 |
+
# =====================================================
|
| 706 |
+
# TAB 6: LEADERBOARD
|
| 707 |
# =====================================================
|
| 708 |
with gr.Tab("๐ Leaderboard", id="leaderboard"):
|
| 709 |
gr.Markdown("""### Community Merge Leaderboard
|
|
|
|
| 748 |
|
| 749 |
|
| 750 |
if __name__ == "__main__":
|
| 751 |
+
demo.launch(server_name="0.0.0.0", server_port=7860, theme=theme, css=CSS)
|