eeshaAI commited on
Commit
defa07b
Β·
verified Β·
1 Parent(s): 91d65b4

Upload app.py

Browse files
Files changed (1) hide show
  1. app.py +66 -8
app.py CHANGED
@@ -1,10 +1,68 @@
 
 
 
 
 
 
 
 
1
  import gradio as gr
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
2
 
3
- with gr.Blocks(fill_height=True) as demo:
4
- with gr.Sidebar():
5
- gr.Markdown("# Inference Provider")
6
- gr.Markdown("This Space showcases the stabilityai/stable-diffusion-3.5-large model, served by the fal-ai API. Sign in with your Hugging Face account to use this API.")
7
- button = gr.LoginButton("Sign in")
8
- gr.load("models/stabilityai/stable-diffusion-3.5-large", accept_token=button, provider="fal-ai")
9
-
10
- demo.launch()
 
1
+ #!/usr/bin/env python3
2
+ """
3
+ Gradio App for EeshaAI/Zeeb Training Space
4
+ ==========================================
5
+ Provides a web UI to trigger LoRA fine-tuning of OLMo 2 1B Instruct
6
+ on tokenized video data, then push the trained model to EeshaAI/zeeb.
7
+ """
8
+
9
  import gradio as gr
10
+ from train_on_hf_spaces import train
11
+
12
+
13
+ def run_training():
14
+ """Run the training pipeline and stream logs to the UI."""
15
+ for log_msg in train("tokenized_dataset.json"):
16
+ yield log_msg
17
+
18
+
19
+ with gr.Blocks(
20
+ title="Zeeb β€” Video-LLM Trainer",
21
+ theme=gr.themes.Soft(),
22
+ css="""
23
+ #logbox { font-family: 'Courier New', monospace; font-size: 13px; line-height: 1.5; }
24
+ #title { text-align: center; }
25
+ .contain { max-width: 800px; margin: auto; }
26
+ """
27
+ ) as demo:
28
+
29
+ gr.Markdown(
30
+ """
31
+ # 🎬 Zeeb β€” Video-LLM Trainer
32
+ Fine-tune **OLMo 2 1B Instruct** with **LoRA (r=4)** to generate video tokens.
33
+ Trained model is automatically pushed to [EeshaAI/zeeb](https://huggingface.co/EeshaAI/zeeb).
34
+ """,
35
+ elem_id="title",
36
+ )
37
+
38
+ with gr.Row():
39
+ train_btn = gr.Button("πŸš€ Start Training", variant="primary", size="lg")
40
+
41
+ logbox = gr.Textbox(
42
+ label="Training Log",
43
+ elem_id="logbox",
44
+ lines=25,
45
+ max_lines=100,
46
+ interactive=False,
47
+ show_copy_button=True,
48
+ )
49
+
50
+ gr.Markdown(
51
+ """
52
+ ### What happens when you click "Start Training"?
53
+ 1. πŸ“¦ Downloads **OLMo 2 1B Instruct** from HuggingFace
54
+ 2. πŸ”€ Expands vocabulary with **1,024 visual tokens** (`<v_0>` ... `<v_1023>`)
55
+ 3. πŸ”§ Applies **LoRA r=4** to q_proj & v_proj (minimal memory)
56
+ 4. πŸ”₯ Trains for **3 epochs** on the tokenized video dataset
57
+ 5. πŸ”€ Merges LoRA weights back into the base model
58
+ 6. πŸš€ Pushes the merged model to **EeshaAI/zeeb**
59
+
60
+ ⚠️ Training on CPU takes time (~10-30 min depending on dataset size).
61
+ """
62
+ )
63
+
64
+ train_btn.click(fn=run_training, outputs=logbox)
65
+
66
 
67
+ if __name__ == "__main__":
68
+ demo.launch(server_name="0.0.0.0", server_port=7860)