chore: auto-commit (95 archivos)
- cmd/fn/doctor.go - cmd/fn/main.go - cpp/apps/primitives_gallery/playground/tables/CMakeLists.txt - cpp/apps/primitives_gallery/playground/tables/data_table.cpp - cpp/apps/primitives_gallery/playground/tables/data_table_logic.cpp - cpp/apps/primitives_gallery/playground/tables/data_table_logic.h - cpp/apps/primitives_gallery/playground/tables/self_test.cpp - cpp/apps/primitives_gallery/playground/tables/tql.cpp - cpp/apps/primitives_gallery/playground/tables/viz.cpp - cpp/apps/primitives_gallery/playground/tables/viz.h - ... Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -0,0 +1,50 @@
|
||||
---
|
||||
name: sdcli_parse_progress
|
||||
kind: function
|
||||
lang: go
|
||||
domain: ml
|
||||
version: "1.0.0"
|
||||
purity: pure
|
||||
signature: "func SdcliParseProgress(line string) (SdcliProgress, bool)"
|
||||
description: "Parsea una linea de stderr de stable-diffusion.cpp / sd-cli y extrae el estado de progreso. Soporta el formato compacto '3/30 | 0.84it/s | 10%', el formato verbose 'sampling: step 3 of 30 (0.84 it/s)', y el formato minimal 'progress: 3/30'. Retorna (zero, false) si la linea no contiene informacion de progreso reconocible."
|
||||
tags: [ml, stable-diffusion, sdcli, progress, parser, stderr, pure]
|
||||
uses_functions: []
|
||||
uses_types: []
|
||||
returns: []
|
||||
returns_optional: false
|
||||
error_type: ""
|
||||
imports: ["regexp", "strconv"]
|
||||
params:
|
||||
- name: line
|
||||
desc: "Una linea de stderr emitida por sd-cli / stable-diffusion.cpp durante la fase de sampling. Puede contener espacios al inicio o final."
|
||||
output: "Par (SdcliProgress, bool). bool=true si se reconocio un patron de progreso; SdcliProgress contiene Step (paso actual), TotalSteps (pasos totales), ItPerSec (iteraciones por segundo, 0 si no disponible) y Percent (porcentaje 0-100 calculado o leido de la linea). bool=false y struct zero si la linea no contiene progreso."
|
||||
tested: true
|
||||
tests:
|
||||
- "formato estandar compacto step/total/itpersec/percent"
|
||||
- "linea sin patron retorna false"
|
||||
- "formato sampling verbose con velocidad"
|
||||
file_path: "functions/ml/sdcli_parse_progress.go"
|
||||
test_file_path: "functions/ml/sdcli_parse_progress_test.go"
|
||||
---
|
||||
|
||||
## Ejemplo
|
||||
|
||||
```go
|
||||
p, ok := ml.SdcliParseProgress(" 3/30 | 0.84it/s | 10%")
|
||||
// ok = true
|
||||
// p = SdcliProgress{Step:3, TotalSteps:30, ItPerSec:0.84, Percent:10.0}
|
||||
|
||||
p2, ok2 := ml.SdcliParseProgress("sampling: step 15 of 30 (1.2 it/s)")
|
||||
// ok2 = true
|
||||
// p2 = SdcliProgress{Step:15, TotalSteps:30, ItPerSec:1.2, Percent:50.0}
|
||||
|
||||
_, ok3 := ml.SdcliParseProgress("loading model...")
|
||||
// ok3 = false
|
||||
```
|
||||
|
||||
## Notas
|
||||
|
||||
- Regexps precompiladas como vars de paquete (se compilan una sola vez al init del paquete).
|
||||
- Tolerante a variaciones de espaciado gracias a `\s*` en los patrones.
|
||||
- El campo `Percent` en el formato verbose se calcula como `100 * step / total` (no se lee de la linea porque ese formato no lo emite).
|
||||
- Funcion pura: sin I/O, sin estado mutable, determinista.
|
||||
Reference in New Issue
Block a user