-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathsetup_maining.py
More file actions
91 lines (76 loc) · 3 KB
/
setup_maining.py
File metadata and controls
91 lines (76 loc) · 3 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
78
79
80
81
82
83
84
85
86
87
88
89
90
91
# Setup script for Advanced Training AI
import subprocess
import sys
import os
def install_requirements():
"""
Install required libraries for Advanced Training AI
"""
requirements = [
"scikit-learn",
"numpy",
"scipy"
]
print("🔧 Installing libraries for Advanced Training AI...")
for package in requirements:
try:
print(f"📦 Installing {package}...")
subprocess.check_call([sys.executable, "-m", "pip", "install", package])
print(f"✅ Installed {package}")
except subprocess.CalledProcessError as e:
print(f"❌ Error installing {package}: {e}")
print("\n🎉 Installation complete!")
# Check dataset folder
print("\n📁 Checking dataset folder...")
dataset_folder = "dataset"
if os.path.exists(dataset_folder):
txt_files = []
for root, dirs, files in os.walk(dataset_folder):
for file in files:
if file.endswith('.txt'):
txt_files.append(os.path.join(root, file))
if txt_files:
total_size = 0
for file in txt_files:
try:
size = os.path.getsize(file)
total_size += size
except:
pass
print(f"✅ Found {len(txt_files)} .txt files in dataset folder")
print(f"📊 Total size: {total_size / (1024*1024):.1f} MB")
# Estimate training time
estimated_time = len(txt_files) * 0.5 # 0.5 seconds per file (rough estimate)
print(f"⏱️ Estimated training time: ~{estimated_time:.1f} seconds")
else:
print("⚠️ No .txt files found in dataset folder!")
else:
print(f"❌ Dataset folder '{dataset_folder}' not found!")
print("Please create 'dataset' folder and add your .txt files there")
print("\n📋 Usage Instructions:")
print("1. Make sure your .txt files are in the 'dataset' folder")
print("2. Run: python advanced_training_ai.py")
print("3. Wait for training to complete")
print("4. Start asking questions!")
print("5. For text generation: python semantic_text_generator.py")
def check_memory():
"""
Check if system has enough memory for training
"""
print("\n💾 Checking system memory...")
try:
import psutil
mem = psutil.virtual_memory()
available_gb = mem.available / (1024**3)
print(f"Available memory: {available_gb:.1f} GB")
if available_gb < 2:
print("⚠️ Warning: Less than 2GB available memory might cause issues with large datasets")
else:
print("✅ Memory check passed")
except ImportError:
print("⚠️ Could not check memory (psutil not installed)")
except:
print("⚠️ Could not determine available memory")
if __name__ == "__main__":
install_requirements()
check_memory()