2bitbit commited on
Commit ·
2bb93b2
1
Parent(s): f068604
fix: correct minor typos in help text, README, and comments
Browse files- README.md +1 -1
- scripts/chat_sft.py +1 -1
- scripts/tok_train.py +1 -1
README.md
CHANGED
|
@@ -52,7 +52,7 @@ A few more notes:
|
|
| 52 |
|
| 53 |
- The code will run just fine on the Ampere 8XA100 GPU node as well, but a bit slower.
|
| 54 |
- All code will run just fine on even a single GPU by omitting `torchrun`, and will produce ~identical results (code will automatically switch to gradient accumulation), but you'll have to wait 8 times longer.
|
| 55 |
-
- If your GPU(s) have less than 80GB, you'll have to tune some of the hyperparameters or you will OOM / run out of VRAM. Look for `--
|
| 56 |
- Most of the code is fairly vanilla PyTorch so it should run on anything that supports that - xpu, mps, or etc, but I haven't personally exercised all of these code paths so there might be sharp edges.
|
| 57 |
|
| 58 |
## Research
|
|
|
|
| 52 |
|
| 53 |
- The code will run just fine on the Ampere 8XA100 GPU node as well, but a bit slower.
|
| 54 |
- All code will run just fine on even a single GPU by omitting `torchrun`, and will produce ~identical results (code will automatically switch to gradient accumulation), but you'll have to wait 8 times longer.
|
| 55 |
+
- If your GPU(s) have less than 80GB, you'll have to tune some of the hyperparameters or you will OOM / run out of VRAM. Look for `--device-batch-size` in the scripts and reduce it until things fit. E.g. from 32 (default) to 16, 8, 4, 2, or even 1. Less than that you'll have to know a bit more what you're doing and get more creative.
|
| 56 |
- Most of the code is fairly vanilla PyTorch so it should run on anything that supports that - xpu, mps, or etc, but I haven't personally exercised all of these code paths so there might be sharp edges.
|
| 57 |
|
| 58 |
## Research
|
scripts/chat_sft.py
CHANGED
|
@@ -177,7 +177,7 @@ val_dataset = TaskMixture([
|
|
| 177 |
SmolTalk(split="test"), # 24K rows in test set
|
| 178 |
MMLU(subset="all", split="test", stop=5200), # 14K rows in test set, use only 5.2K to match the train ratios
|
| 179 |
GSM8K(subset="main", split="test", stop=420), # 1.32K rows in test set, use only 420 to match the train ratios
|
| 180 |
-
]) # total: 24K +
|
| 181 |
# DataLoader is defined here, it emits inputs, targets : 2D tensors of shape (device_batch_size, max_seq_len)
|
| 182 |
# A big problem is that we don't know the final num_iterations in advance. So we create
|
| 183 |
# these two global variables and update them from within the data generator.
|
|
|
|
| 177 |
SmolTalk(split="test"), # 24K rows in test set
|
| 178 |
MMLU(subset="all", split="test", stop=5200), # 14K rows in test set, use only 5.2K to match the train ratios
|
| 179 |
GSM8K(subset="main", split="test", stop=420), # 1.32K rows in test set, use only 420 to match the train ratios
|
| 180 |
+
]) # total: 24K + 5.2K + 0.42K ~= 29.6K rows
|
| 181 |
# DataLoader is defined here, it emits inputs, targets : 2D tensors of shape (device_batch_size, max_seq_len)
|
| 182 |
# A big problem is that we don't know the final num_iterations in advance. So we create
|
| 183 |
# these two global variables and update them from within the data generator.
|
scripts/tok_train.py
CHANGED
|
@@ -14,7 +14,7 @@ from nanochat.dataset import parquets_iter_batched
|
|
| 14 |
# Parse command line arguments
|
| 15 |
|
| 16 |
parser = argparse.ArgumentParser(description='Train a BPE tokenizer')
|
| 17 |
-
parser.add_argument('--max-chars', type=int, default=2_000_000_000, help='Maximum characters to train on (default:
|
| 18 |
parser.add_argument('--doc-cap', type=int, default=10_000, help='Maximum characters per document (default: 10,000)')
|
| 19 |
parser.add_argument('--vocab-size', type=int, default=32768, help='Vocabulary size (default: 32768 = 2^15)')
|
| 20 |
args = parser.parse_args()
|
|
|
|
| 14 |
# Parse command line arguments
|
| 15 |
|
| 16 |
parser = argparse.ArgumentParser(description='Train a BPE tokenizer')
|
| 17 |
+
parser.add_argument('--max-chars', type=int, default=2_000_000_000, help='Maximum characters to train on (default: 2B)')
|
| 18 |
parser.add_argument('--doc-cap', type=int, default=10_000, help='Maximum characters per document (default: 10,000)')
|
| 19 |
parser.add_argument('--vocab-size', type=int, default=32768, help='Vocabulary size (default: 32768 = 2^15)')
|
| 20 |
args = parser.parse_args()
|