adding failure-modes
Browse files- trl/SKILL.md +50 -0
trl/SKILL.md
CHANGED
|
@@ -388,6 +388,56 @@ See `references/training_patterns.md` for detailed examples including:
|
|
| 388 |
- DPO training (preference learning)
|
| 389 |
- GRPO training (online RL)
|
| 390 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 391 |
## Troubleshooting
|
| 392 |
|
| 393 |
**Common issues:**
|
|
|
|
| 388 |
- DPO training (preference learning)
|
| 389 |
- GRPO training (online RL)
|
| 390 |
|
| 391 |
+
## Common Failure Modes
|
| 392 |
+
|
| 393 |
+
### Out of Memory (OOM)
|
| 394 |
+
|
| 395 |
+
**Fix (try in order):**
|
| 396 |
+
1. Reduce batch size: `per_device_train_batch_size=1`, increase `gradient_accumulation_steps=8`. Effective batch size is `per_device_train_batch_size` x `gradient_accumulation_steps`. For best performance keep effective batch size close to 128.
|
| 397 |
+
2. Enable: `gradient_checkpointing=True`
|
| 398 |
+
3. Upgrade hardware: t4-small → l4x1, a10g-small → a10g-large etc.
|
| 399 |
+
|
| 400 |
+
### Dataset Misformatted
|
| 401 |
+
|
| 402 |
+
**Fix:**
|
| 403 |
+
1. Validate first: `python scripts/validate_dataset.py --dataset name --method sft`
|
| 404 |
+
2. Check required columns:
|
| 405 |
+
- SFT: `messages` OR `text` OR `prompt`+`completion`
|
| 406 |
+
- DPO: `prompt`, `chosen`, `rejected`
|
| 407 |
+
- GRPO: `prompt` only
|
| 408 |
+
3. Apply formatting if needed:
|
| 409 |
+
```python
|
| 410 |
+
dataset = dataset.map(lambda x: {"text": f"User: {x['input']}\nBot: {x['output']}"})
|
| 411 |
+
```
|
| 412 |
+
|
| 413 |
+
### Job Timeout
|
| 414 |
+
|
| 415 |
+
**Fix:**
|
| 416 |
+
1. Check logs for actual runtime: `hf_jobs("logs", {"job_id": "..."})`
|
| 417 |
+
2. Increase timeout with buffer: `"timeout": "3h"` (add 30% to estimated time)
|
| 418 |
+
3. Or reduce training: lower `num_train_epochs`, use smaller dataset, enable `max_steps`
|
| 419 |
+
4. Save checkpoints: `save_strategy="steps"`, `save_steps=500`, `hub_strategy="every_save"`
|
| 420 |
+
|
| 421 |
+
**Note:** Default 30min is insufficient for real training. Minimum 1-2 hours.
|
| 422 |
+
|
| 423 |
+
### Hub Push Failures
|
| 424 |
+
|
| 425 |
+
**Fix:**
|
| 426 |
+
1. Add to job: `secrets={"HF_TOKEN": "$HF_TOKEN"}`
|
| 427 |
+
2. Add to config: `push_to_hub=True`, `hub_model_id="username/model-name"`
|
| 428 |
+
3. Verify auth: `mcp__huggingface__hf_whoami()`
|
| 429 |
+
4. Check token has write permissions and repo exists (or set `hub_private_repo=True`)
|
| 430 |
+
|
| 431 |
+
### Missing Dependencies
|
| 432 |
+
|
| 433 |
+
**Fix:**
|
| 434 |
+
Add to PEP 723 header:
|
| 435 |
+
```python
|
| 436 |
+
# /// script
|
| 437 |
+
# dependencies = ["trl>=0.12.0", "peft>=0.7.0", "trackio", "missing-package"]
|
| 438 |
+
# ///
|
| 439 |
+
```
|
| 440 |
+
|
| 441 |
## Troubleshooting
|
| 442 |
|
| 443 |
**Common issues:**
|