Prithvik-1 commited on
Commit
7d4b5f8
·
verified ·
1 Parent(s): 8514fc9

Upload scripts/training/train_wrapper.py with huggingface_hub

Browse files
Files changed (1) hide show
  1. scripts/training/train_wrapper.py +35 -0
scripts/training/train_wrapper.py ADDED
@@ -0,0 +1,35 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ #!/usr/bin/env python3
2
+ """
3
+ Training wrapper with checkpoint support and better logging
4
+ """
5
+
6
+ import sys
7
+ import os
8
+ import shutil
9
+ from pathlib import Path
10
+
11
+ # Clear cache before training
12
+ print("🧹 Clearing HuggingFace cache...")
13
+ cache_dir = Path("/workspace/.hf_home/hub/models--mistralai--Mistral-7B-v0.1")
14
+ if cache_dir.exists():
15
+ try:
16
+ shutil.rmtree(cache_dir)
17
+ print("✓ Cache cleared")
18
+ except Exception as e:
19
+ print(f"⚠️ Cache clear warning: {e}")
20
+
21
+ # Force unbuffered output for real-time logs
22
+ sys.stdout = os.fdopen(sys.stdout.fileno(), 'w', buffering=1)
23
+ sys.stderr = os.fdopen(sys.stderr.fileno(), 'w', buffering=1)
24
+
25
+ print("=" * 70)
26
+ print("🚀 Starting Training with Real-time Logging")
27
+ print("=" * 70)
28
+ sys.stdout.flush()
29
+
30
+ # Import and run training
31
+ sys.path.insert(0, "/workspace/ftt/ft/models/msp")
32
+ from ft.finetune_mistral7b import main
33
+
34
+ if __name__ == "__main__":
35
+ main()