File size: 2,139 Bytes
7afadff | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 | 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
|