Download scripts/TrainAndLearn.ps1 from Ian26/MarsLM: direct link, hf CLI and curl.
- Browser
- Download file 2.14 kB
-
https://huggingface.co/Ian26/MarsLM/resolve/main/scripts/TrainAndLearn.ps1
- Command line
-
hf download hf://Ian26/MarsLM/scripts/TrainAndLearn.ps1
-
curl -L -o TrainAndLearn.ps1 https://huggingface.co/Ian26/MarsLM/resolve/main/scripts/TrainAndLearn.ps1
2.14 kB
| param( | |
| [string]$Output = "datasets/wikipedia/programacion.txt", | |
| [string]$Config = "configs/marslm-300M.yaml", | |
| [string]$TokenizerPrefix = "artifacts/tokenizer/marslm", | |
| [string]$VocabSize = "20000", | |
| [string]$BlockSize = "512", | |
| [string]$OutputDir = "artifacts/checkpoints", | |
| [int]$Epochs = 10 | |
| ) | |
| $ErrorActionPreference = "Stop" | |
| $scriptPath = Split-Path -Parent $MyInvocation.MyCommand.Path | |
| $repoRoot = Resolve-Path (Join-Path $scriptPath "..") | |
| Set-Location $repoRoot | |
| Write-Host "========================================" -ForegroundColor Cyan | |
| Write-Host "MarsLM - Guía rápida para enseñar la IA" -ForegroundColor Cyan | |
| Write-Host "========================================" -ForegroundColor Cyan | |
| Write-Host "" | |
| Write-Host "Paso 1/4: Preparando el corpus de entrenamiento..." -ForegroundColor Yellow | |
| python -c "from pathlib import Path; src=Path('datasets/spanish_corpus_large.txt').read_text(encoding='utf-8'); Path('datasets/spanish_corpus_train.txt').write_text((src+'\n\n')*20, encoding='utf-8'); print('Corpus preparado')" | |
| python datasets/download_dataset.py --output $Output --random-pages 6 | |
| Write-Host "" | |
| Write-Host "Paso 2/4: Entrenando el tokenizador..." -ForegroundColor Yellow | |
| python tokenizer/train_tokenizer.py --input datasets/spanish_corpus_train.txt $Output --model-prefix $TokenizerPrefix --vocab-size $VocabSize | |
| Write-Host "" | |
| Write-Host "Paso 3/4: Preprocesando los datos..." -ForegroundColor Yellow | |
| python datasets/preprocess.py --input datasets/spanish_corpus_train.txt $Output --tokenizer artifacts/tokenizer/marslm.json --output artifacts/data/tokens.pt --block-size $BlockSize | |
| Write-Host "" | |
| Write-Host "Paso 4/4: Entrenando el modelo..." -ForegroundColor Yellow | |
| python training/train.py --config $Config --train-file artifacts/data/tokens.pt --tokenizer-model artifacts/tokenizer/marslm.json --output-dir $OutputDir --epochs $Epochs --batch-size 1 --gradient-accumulation-steps 4 --warmup-steps 50 | |
| Write-Host "" | |
| Write-Host "Proceso completado." -ForegroundColor Green | |
| Write-Host "Puedes revisar los checkpoints en: $OutputDir" -ForegroundColor Green | |