-
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathstart-dpg-ui.py
More file actions
executable file
·77 lines (61 loc) · 2.03 KB
/
start-dpg-ui.py
File metadata and controls
executable file
·77 lines (61 loc) · 2.03 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
#!/usr/bin/env python3
"""
Main entry point for the Dear PyGui version of OneTrainer
This script launches the OneTrainer application with the Dear PyGui UI.
"""
import os
import sys
import traceback
# Add the current directory to the path to allow importing local modules
current_dir = os.path.dirname(os.path.abspath(__file__))
if current_dir not in sys.path:
sys.path.insert(0, current_dir)
# Create a startup banner
banner = """
======================================================
OneTrainer with Dear PyGui
======================================================
Starting OneTrainer with the Dear PyGui interface...
"""
def check_dependencies():
"""
Check if required dependencies are installed
Returns:
True if all dependencies are installed, False otherwise
"""
try:
# Check Dear PyGui
import dearpygui.dearpygui as dpg
print("✓ Dear PyGui is installed")
# Check other key dependencies
import torch
print("✓ PyTorch is installed")
# Try to import key OneTrainer modules
from modules.util.config.TrainConfig import TrainConfig
print("✓ OneTrainer modules are available")
return True
except ImportError as e:
print(f"Error: {e}")
print("\nPlease install the missing dependencies:")
print(" pip install dearpygui")
print(" pip install -r requirements.txt")
return False
def main():
"""Main entry point"""
print(banner)
# Check dependencies
if not check_dependencies():
return 1
try:
# Import and run the application
from dpg_ui.app import OneTrainerApp
print("Launching OneTrainer with Dear PyGui interface...")
app = OneTrainerApp()
app.run()
return 0
except Exception as e:
print(f"Error launching the application: {e}")
traceback.print_exc()
return 1
if __name__ == "__main__":
sys.exit(main())