Fix: Use OpenLLM modules from uploaded files (model.py and data_loader.py)
Browse files
app.py
CHANGED
|
@@ -1,16 +1,15 @@
|
|
| 1 |
#!/usr/bin/env python3
|
| 2 |
"""
|
| 3 |
-
OpenLLM Training Space Application -
|
| 4 |
|
| 5 |
-
This version
|
| 6 |
-
-
|
| 7 |
-
-
|
| 8 |
-
-
|
| 9 |
-
- Compatible with OpenLLM's actual implementation
|
| 10 |
|
| 11 |
Author: Louis Chua Bean Chong
|
| 12 |
License: GPL-3.0
|
| 13 |
-
Version: 2.0
|
| 14 |
Last Updated: 2024
|
| 15 |
"""
|
| 16 |
|
|
@@ -26,15 +25,13 @@ import threading
|
|
| 26 |
from dataclasses import dataclass
|
| 27 |
from pathlib import Path
|
| 28 |
|
| 29 |
-
# Import OpenLLM's custom model architecture
|
| 30 |
try:
|
| 31 |
-
#
|
| 32 |
-
import sys
|
| 33 |
-
sys.path.append('core/src')
|
| 34 |
from model import GPTModel, GPTConfig, create_model
|
| 35 |
from data_loader import TextDataLoader
|
| 36 |
OPENLLM_AVAILABLE = True
|
| 37 |
-
print("β
OpenLLM custom model architecture imported successfully")
|
| 38 |
except ImportError as e:
|
| 39 |
print(f"β OpenLLM imports failed: {e}")
|
| 40 |
OPENLLM_AVAILABLE = False
|
|
@@ -455,20 +452,20 @@ def main():
|
|
| 455 |
|
| 456 |
# Create the main Gradio application interface
|
| 457 |
with gr.Blocks(
|
| 458 |
-
title="OpenLLM Training Space -
|
| 459 |
theme=gr.themes.Soft()
|
| 460 |
) as demo:
|
| 461 |
|
| 462 |
# Application Header
|
| 463 |
-
gr.Markdown("# π OpenLLM Training Space -
|
| 464 |
-
gr.Markdown("### *Uses OpenLLM's Custom Model Architecture*")
|
| 465 |
gr.Markdown("---")
|
| 466 |
|
| 467 |
# Status Information
|
| 468 |
gr.Markdown(f"**OpenLLM Available**: {'β
Yes' if OPENLLM_AVAILABLE else 'β No'}")
|
| 469 |
gr.Markdown(f"**SentencePiece Available**: {'β
Yes' if SENTENCEPIECE_AVAILABLE else 'β No'}")
|
| 470 |
gr.Markdown(f"**Dependencies Available**: {'β
Yes' if DEPENDENCIES_AVAILABLE else 'β No'}")
|
| 471 |
-
gr.Markdown("**Architecture**: β
OpenLLM Custom GPTModel (
|
| 472 |
|
| 473 |
# Main Content Area
|
| 474 |
with gr.Row():
|
|
@@ -535,9 +532,9 @@ def main():
|
|
| 535 |
stop_btn = gr.Button("βΉοΈ Stop Training", variant="stop")
|
| 536 |
|
| 537 |
# Instructions Section
|
| 538 |
-
gr.Markdown("## π OpenLLM
|
| 539 |
gr.Markdown("""
|
| 540 |
-
This interface uses **OpenLLM's actual custom model architecture
|
| 541 |
|
| 542 |
### **Step 1: Configure Parameters**
|
| 543 |
- **Model Size**: Select the base model to train from (small, medium, large)
|
|
@@ -547,7 +544,7 @@ def main():
|
|
| 547 |
|
| 548 |
### **Step 2: Start Training**
|
| 549 |
- Click "Start Training" to begin the actual training process
|
| 550 |
-
- Uses OpenLLM's custom GPTModel class
|
| 551 |
- Uses sentencepiece.SentencePieceProcessor() for tokenization
|
| 552 |
- Compatible with OpenLLM's actual implementation
|
| 553 |
|
|
@@ -633,7 +630,7 @@ def main():
|
|
| 633 |
# Application Footer
|
| 634 |
gr.Markdown("---")
|
| 635 |
gr.Markdown("**Author**: Louis Chua Bean Chong | **Project**: OpenLLM | **License**: GPL-3.0")
|
| 636 |
-
gr.Markdown("**Architecture**: OpenLLM Custom GPTModel (
|
| 637 |
gr.Markdown("**Tokenizer**: sentencepiece.SentencePieceProcessor()")
|
| 638 |
|
| 639 |
return demo
|
|
|
|
| 1 |
#!/usr/bin/env python3
|
| 2 |
"""
|
| 3 |
+
OpenLLM Training Space Application - Fixed with Uploaded Modules
|
| 4 |
|
| 5 |
+
This version imports OpenLLM modules from the uploaded files in the HF Space:
|
| 6 |
+
- Imports model.py and data_loader.py that were uploaded to the Space
|
| 7 |
+
- Uses OpenLLM's actual custom model architecture
|
| 8 |
+
- Compatible with OpenLLM's implementation
|
|
|
|
| 9 |
|
| 10 |
Author: Louis Chua Bean Chong
|
| 11 |
License: GPL-3.0
|
| 12 |
+
Version: 2.1.0
|
| 13 |
Last Updated: 2024
|
| 14 |
"""
|
| 15 |
|
|
|
|
| 25 |
from dataclasses import dataclass
|
| 26 |
from pathlib import Path
|
| 27 |
|
| 28 |
+
# Import OpenLLM's custom model architecture from uploaded files
|
| 29 |
try:
|
| 30 |
+
# Import from the uploaded files in the HF Space
|
|
|
|
|
|
|
| 31 |
from model import GPTModel, GPTConfig, create_model
|
| 32 |
from data_loader import TextDataLoader
|
| 33 |
OPENLLM_AVAILABLE = True
|
| 34 |
+
print("β
OpenLLM custom model architecture imported successfully from uploaded files")
|
| 35 |
except ImportError as e:
|
| 36 |
print(f"β OpenLLM imports failed: {e}")
|
| 37 |
OPENLLM_AVAILABLE = False
|
|
|
|
| 452 |
|
| 453 |
# Create the main Gradio application interface
|
| 454 |
with gr.Blocks(
|
| 455 |
+
title="OpenLLM Training Space - Fixed with Uploaded Modules",
|
| 456 |
theme=gr.themes.Soft()
|
| 457 |
) as demo:
|
| 458 |
|
| 459 |
# Application Header
|
| 460 |
+
gr.Markdown("# π OpenLLM Training Space - Fixed with Uploaded Modules")
|
| 461 |
+
gr.Markdown("### *Uses OpenLLM's Custom Model Architecture from Uploaded Files*")
|
| 462 |
gr.Markdown("---")
|
| 463 |
|
| 464 |
# Status Information
|
| 465 |
gr.Markdown(f"**OpenLLM Available**: {'β
Yes' if OPENLLM_AVAILABLE else 'β No'}")
|
| 466 |
gr.Markdown(f"**SentencePiece Available**: {'β
Yes' if SENTENCEPIECE_AVAILABLE else 'β No'}")
|
| 467 |
gr.Markdown(f"**Dependencies Available**: {'β
Yes' if DEPENDENCIES_AVAILABLE else 'β No'}")
|
| 468 |
+
gr.Markdown("**Architecture**: β
OpenLLM Custom GPTModel (From Uploaded Files)")
|
| 469 |
|
| 470 |
# Main Content Area
|
| 471 |
with gr.Row():
|
|
|
|
| 532 |
stop_btn = gr.Button("βΉοΈ Stop Training", variant="stop")
|
| 533 |
|
| 534 |
# Instructions Section
|
| 535 |
+
gr.Markdown("## π OpenLLM Training Instructions")
|
| 536 |
gr.Markdown("""
|
| 537 |
+
This interface uses **OpenLLM's actual custom model architecture** from uploaded files:
|
| 538 |
|
| 539 |
### **Step 1: Configure Parameters**
|
| 540 |
- **Model Size**: Select the base model to train from (small, medium, large)
|
|
|
|
| 544 |
|
| 545 |
### **Step 2: Start Training**
|
| 546 |
- Click "Start Training" to begin the actual training process
|
| 547 |
+
- Uses OpenLLM's custom GPTModel class from uploaded files
|
| 548 |
- Uses sentencepiece.SentencePieceProcessor() for tokenization
|
| 549 |
- Compatible with OpenLLM's actual implementation
|
| 550 |
|
|
|
|
| 630 |
# Application Footer
|
| 631 |
gr.Markdown("---")
|
| 632 |
gr.Markdown("**Author**: Louis Chua Bean Chong | **Project**: OpenLLM | **License**: GPL-3.0")
|
| 633 |
+
gr.Markdown("**Architecture**: OpenLLM Custom GPTModel (From Uploaded Files)")
|
| 634 |
gr.Markdown("**Tokenizer**: sentencepiece.SentencePieceProcessor()")
|
| 635 |
|
| 636 |
return demo
|