Angelos Perivolaropoulos commited on
Commit
07e54b2
·
unverified ·
2 Parent(s): 8e29e099fa1e22

Merge pull request #4 from hobostay/fix/missing-train-main-block

Browse files
Files changed (1) hide show
  1. docs/03-training-loop.md +18 -0
docs/03-training-loop.md CHANGED
@@ -194,6 +194,24 @@ def train(data_path, max_steps=5000, batch_size=64,
194
  return model, stoi, itos
195
  ```
196
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
197
  ### What Each Part Does
198
 
199
  **Validation loss**: Every 100 steps, evaluate on held-out data. If train loss goes down but val loss goes up, you're overfitting.
 
194
  return model, stoi, itos
195
  ```
196
 
197
+ ### Step 6: Entry Point
198
+
199
+ Add this to the bottom of `train.py` so you can run it from the terminal:
200
+
201
+ ```python
202
+ if __name__ == "__main__":
203
+ train("../data/shakespeare.txt")
204
+ ```
205
+
206
+ This calls the training function with the default config (6L/6H/384D, 5000 steps) and the included Shakespeare dataset. You can customize the model by passing different arguments:
207
+
208
+ ```python
209
+ if __name__ == "__main__":
210
+ import sys
211
+ data_path = sys.argv[1] if len(sys.argv) > 1 else "../data/shakespeare.txt"
212
+ train(data_path)
213
+ ```
214
+
215
  ### What Each Part Does
216
 
217
  **Validation loss**: Every 100 steps, evaluate on held-out data. If train loss goes down but val loss goes up, you're overfitting.