param( [int]$Epochs = 10, [string]$Config = "configs/marslm-300M.yaml", [string]$Output = "datasets/wikipedia/programacion.txt" ) $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 - Entrenamiento y evaluación" -ForegroundColor Cyan Write-Host "========================================" -ForegroundColor Cyan Write-Host "" Write-Host "[1/4] Preparando corpus..." -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 "[2/4] Entrenando tokenizador..." -ForegroundColor Yellow python tokenizer/train_tokenizer.py --input datasets/spanish_corpus_train.txt $Output --model-prefix artifacts/tokenizer/marslm --vocab-size 20000 Write-Host "" Write-Host "[3/4] Preprocesando 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 512 Write-Host "" Write-Host "[4/4] Entrenando modelo..." -ForegroundColor Yellow python training/train.py --config $Config --train-file artifacts/data/tokens.pt --tokenizer-model artifacts/tokenizer/marslm.json --output-dir artifacts/checkpoints --epochs $Epochs --batch-size 1 --gradient-accumulation-steps 4 --warmup-steps 50 Write-Host "" Write-Host "Entrenamiento completado." -ForegroundColor Green Write-Host "Puedes probar el modelo con:" -ForegroundColor Green Write-Host " powershell -ExecutionPolicy Bypass -File .\scripts\GenerateText.ps1 -Prompt 'La programación' -MaxNewTokens 60 -Temperature 0.2" -ForegroundColor Green