ModerRAS commited on
Commit
4df510c
·
1 Parent(s): 410e000

修复colab_train.py shell引号嵌套导致的Syntax error

Browse files
Files changed (1) hide show
  1. colab_train.py +3 -2
colab_train.py CHANGED
@@ -83,13 +83,14 @@ print("\n" + "=" * 60)
83
  print("STEP 4: Verify GPU")
84
  print("=" * 60)
85
  run("nvidia-smi 2>/dev/null || echo 'No GPU found — training will be slow on CPU'")
86
- run('python -c "import torch; print(f\"PyTorch {torch.__version__}, CUDA available: {torch.cuda.is_available()}\")"')
 
87
 
88
  # ── 5. Verify vocab ────────────────────────────────────────────
89
  print("\n" + "=" * 60)
90
  print("STEP 5: Verify vocabulary")
91
  print("=" * 60)
92
- run('python -c "import json; v=json.load(open(\"vocab.json\")); print(f\"Vocab size: {len(v)} tokens\"); print(f\"Key tokens present: [={repr(\"[\" in v)}, ]={repr(\"]\" in v)}\" )"')
93
 
94
  # ── 6. Run training ────────────────────────────────────────────
95
  print("\n" + "=" * 60)
 
83
  print("STEP 4: Verify GPU")
84
  print("=" * 60)
85
  run("nvidia-smi 2>/dev/null || echo 'No GPU found — training will be slow on CPU'")
86
+ # Single-quote the shell command to avoid bash expanding {torch...}
87
+ run("python -c 'import torch; print(f\"PyTorch {torch.__version__}, CUDA available: {torch.cuda.is_available()}\")'")
88
 
89
  # ── 5. Verify vocab ────────────────────────────────────────────
90
  print("\n" + "=" * 60)
91
  print("STEP 5: Verify vocabulary")
92
  print("=" * 60)
93
+ run("python -c 'import json; v=json.load(open(\"vocab.json\")); print(f\"Vocab size: {len(v)} tokens\")'")
94
 
95
  # ── 6. Run training ────────────────────────────────────────────
96
  print("\n" + "=" * 60)