Spaces:
Running
Running
File size: 3,819 Bytes
fe5f524 |
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 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 |
#!/usr/bin/env python3
"""
Test script to verify the training pipeline works correctly
"""
import sys
import os
from pathlib import Path
# Add project root to path
project_root = Path(__file__).parent
sys.path.insert(0, str(project_root))
def test_config_imports():
"""Test that all configuration files can be imported correctly"""
print("π§ͺ Testing configuration imports...")
try:
# Test base config only
from config.train_smollm3 import SmolLM3Config, get_config
print("β
Base config imported successfully")
# Test H100 lightweight config (without triggering __post_init__)
import importlib.util
spec = importlib.util.spec_from_file_location("h100_config", "config/train_smollm3_h100_lightweight.py")
h100_module = importlib.util.module_from_spec(spec)
spec.loader.exec_module(h100_module)
print("β
H100 lightweight config imported successfully")
return True
except ImportError as e:
print(f"β Import error: {e}")
return False
def test_training_script():
"""Test that the training script can be imported"""
print("\nπ§ͺ Testing training script...")
try:
# Add src to path
src_path = str(project_root / "src")
sys.path.insert(0, src_path)
# Test importing training modules
from train import main as train_main
print("β
Training script imported successfully")
from model import SmolLM3Model
print("β
Model module imported successfully")
from data import load_dataset
print("β
Data module imported successfully")
from monitoring import SmolLM3Monitor, create_monitor_from_config
print("β
Monitoring module imported successfully")
return True
except ImportError as e:
print(f"β Import error: {e}")
return False
def test_scripts():
"""Test that the scripts can be imported"""
print("\nπ§ͺ Testing scripts...")
try:
# Test dataset setup script
sys.path.insert(0, str(project_root / "scripts" / "dataset_tonic"))
from setup_hf_dataset import setup_trackio_dataset
print("β
Dataset setup script imported successfully")
# Test trackio scripts
sys.path.insert(0, str(project_root / "scripts" / "trackio_tonic"))
from deploy_trackio_space import TrackioSpaceDeployer
print("β
Trackio deployment script imported successfully")
from configure_trackio import configure_trackio
print("β
Trackio configuration script imported successfully")
# Test model push script
sys.path.insert(0, str(project_root / "scripts" / "model_tonic"))
from push_to_huggingface import HuggingFacePusher
print("β
Model push script imported successfully")
return True
except ImportError as e:
print(f"β Import error: {e}")
return False
def main():
"""Run all tests"""
print("π Testing SmolLM3 Fine-tuning Pipeline")
print("=" * 50)
tests = [
test_config_imports,
test_training_script,
test_scripts
]
passed = 0
total = len(tests)
for test in tests:
if test():
passed += 1
print()
print("=" * 50)
print(f"π Test Results: {passed}/{total} tests passed")
if passed == total:
print("π All tests passed! Pipeline is ready to use.")
print("\nπ You can now run: ./launch.sh")
else:
print("β Some tests failed. Please check the errors above.")
return 1
return 0
if __name__ == "__main__":
exit(main()) |