Tonic commited on
Commit
fe5f524
Β·
verified Β·
1 Parent(s): 93ed7a1

adds better huggingface deploy

Browse files
scripts/dataset_tonic/setup_hf_dataset.py CHANGED
@@ -267,10 +267,23 @@ def setup_trackio_dataset():
267
  dataset.push_to_hub(
268
  dataset_repo,
269
  token=hf_token,
270
- private=True, # Make it private for security
271
- readme_content=readme_content # Include README if available
272
  )
273
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
274
  print(f"βœ… Successfully created dataset: {dataset_repo}")
275
  print(f"πŸ“Š Added {len(initial_experiments)} experiments")
276
  if readme_content:
 
267
  dataset.push_to_hub(
268
  dataset_repo,
269
  token=hf_token,
270
+ private=False # Make it private for security
 
271
  )
272
 
273
+ # Create README separately if available
274
+ if readme_content:
275
+ try:
276
+ api.upload_file(
277
+ path_or_fileobj=readme_content.encode('utf-8'),
278
+ path_in_repo="README.md",
279
+ repo_id=dataset_repo,
280
+ repo_type="dataset",
281
+ token=hf_token
282
+ )
283
+ print("πŸ“ Uploaded README.md separately")
284
+ except Exception as e:
285
+ print(f"⚠️ Could not upload README: {e}")
286
+
287
  print(f"βœ… Successfully created dataset: {dataset_repo}")
288
  print(f"πŸ“Š Added {len(initial_experiments)} experiments")
289
  if readme_content:
scripts/training/train.py CHANGED
@@ -56,11 +56,13 @@ def main():
56
 
57
  args = parser.parse_args()
58
 
59
- # Add the current directory to Python path
60
- sys.path.insert(0, str(Path(__file__).parent))
 
61
 
62
  # Import the configuration
63
  try:
 
64
  from config.train_smollm3_openhermes_fr_a100_large import get_config as get_large_config
65
  from config.train_smollm3_openhermes_fr_a100_multiple_passes import get_config as get_multiple_passes_config
66
  from config.train_smollm3_h100_lightweight import config as h100_lightweight_config
@@ -128,7 +130,7 @@ def main():
128
  # Import and run training
129
  try:
130
  # Add src directory to path
131
- src_path = str(Path(__file__).parent.parent.parent / "src")
132
  sys.path.insert(0, src_path)
133
  from train import main as train_main
134
 
 
56
 
57
  args = parser.parse_args()
58
 
59
+ # Add the project root to Python path
60
+ project_root = Path(__file__).parent.parent.parent
61
+ sys.path.insert(0, str(project_root))
62
 
63
  # Import the configuration
64
  try:
65
+ # Import all available configurations
66
  from config.train_smollm3_openhermes_fr_a100_large import get_config as get_large_config
67
  from config.train_smollm3_openhermes_fr_a100_multiple_passes import get_config as get_multiple_passes_config
68
  from config.train_smollm3_h100_lightweight import config as h100_lightweight_config
 
130
  # Import and run training
131
  try:
132
  # Add src directory to path
133
+ src_path = str(project_root / "src")
134
  sys.path.insert(0, src_path)
135
  from train import main as train_main
136
 
test_pipeline.py ADDED
@@ -0,0 +1,125 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ #!/usr/bin/env python3
2
+ """
3
+ Test script to verify the training pipeline works correctly
4
+ """
5
+
6
+ import sys
7
+ import os
8
+ from pathlib import Path
9
+
10
+ # Add project root to path
11
+ project_root = Path(__file__).parent
12
+ sys.path.insert(0, str(project_root))
13
+
14
+ def test_config_imports():
15
+ """Test that all configuration files can be imported correctly"""
16
+ print("πŸ§ͺ Testing configuration imports...")
17
+
18
+ try:
19
+ # Test base config only
20
+ from config.train_smollm3 import SmolLM3Config, get_config
21
+ print("βœ… Base config imported successfully")
22
+
23
+ # Test H100 lightweight config (without triggering __post_init__)
24
+ import importlib.util
25
+ spec = importlib.util.spec_from_file_location("h100_config", "config/train_smollm3_h100_lightweight.py")
26
+ h100_module = importlib.util.module_from_spec(spec)
27
+ spec.loader.exec_module(h100_module)
28
+ print("βœ… H100 lightweight config imported successfully")
29
+
30
+ return True
31
+
32
+ except ImportError as e:
33
+ print(f"❌ Import error: {e}")
34
+ return False
35
+
36
+ def test_training_script():
37
+ """Test that the training script can be imported"""
38
+ print("\nπŸ§ͺ Testing training script...")
39
+
40
+ try:
41
+ # Add src to path
42
+ src_path = str(project_root / "src")
43
+ sys.path.insert(0, src_path)
44
+
45
+ # Test importing training modules
46
+ from train import main as train_main
47
+ print("βœ… Training script imported successfully")
48
+
49
+ from model import SmolLM3Model
50
+ print("βœ… Model module imported successfully")
51
+
52
+ from data import load_dataset
53
+ print("βœ… Data module imported successfully")
54
+
55
+ from monitoring import SmolLM3Monitor, create_monitor_from_config
56
+ print("βœ… Monitoring module imported successfully")
57
+
58
+ return True
59
+
60
+ except ImportError as e:
61
+ print(f"❌ Import error: {e}")
62
+ return False
63
+
64
+ def test_scripts():
65
+ """Test that the scripts can be imported"""
66
+ print("\nπŸ§ͺ Testing scripts...")
67
+
68
+ try:
69
+ # Test dataset setup script
70
+ sys.path.insert(0, str(project_root / "scripts" / "dataset_tonic"))
71
+ from setup_hf_dataset import setup_trackio_dataset
72
+ print("βœ… Dataset setup script imported successfully")
73
+
74
+ # Test trackio scripts
75
+ sys.path.insert(0, str(project_root / "scripts" / "trackio_tonic"))
76
+ from deploy_trackio_space import TrackioSpaceDeployer
77
+ print("βœ… Trackio deployment script imported successfully")
78
+
79
+ from configure_trackio import configure_trackio
80
+ print("βœ… Trackio configuration script imported successfully")
81
+
82
+ # Test model push script
83
+ sys.path.insert(0, str(project_root / "scripts" / "model_tonic"))
84
+ from push_to_huggingface import HuggingFacePusher
85
+ print("βœ… Model push script imported successfully")
86
+
87
+ return True
88
+
89
+ except ImportError as e:
90
+ print(f"❌ Import error: {e}")
91
+ return False
92
+
93
+ def main():
94
+ """Run all tests"""
95
+ print("πŸš€ Testing SmolLM3 Fine-tuning Pipeline")
96
+ print("=" * 50)
97
+
98
+ tests = [
99
+ test_config_imports,
100
+ test_training_script,
101
+ test_scripts
102
+ ]
103
+
104
+ passed = 0
105
+ total = len(tests)
106
+
107
+ for test in tests:
108
+ if test():
109
+ passed += 1
110
+ print()
111
+
112
+ print("=" * 50)
113
+ print(f"πŸ“Š Test Results: {passed}/{total} tests passed")
114
+
115
+ if passed == total:
116
+ print("πŸŽ‰ All tests passed! Pipeline is ready to use.")
117
+ print("\nπŸš€ You can now run: ./launch.sh")
118
+ else:
119
+ print("❌ Some tests failed. Please check the errors above.")
120
+ return 1
121
+
122
+ return 0
123
+
124
+ if __name__ == "__main__":
125
+ exit(main())