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,39 @@
|
||||
---
|
||||
name: gpu_info
|
||||
lang: go
|
||||
domain: infra
|
||||
version: "1.0.0"
|
||||
algebraic: product
|
||||
definition: |
|
||||
type GpuInfo struct {
|
||||
Index int `json:"index"`
|
||||
Name string `json:"name"`
|
||||
VramTotalMb int `json:"vram_total_mb"`
|
||||
VramFreeMb int `json:"vram_free_mb"`
|
||||
DriverVersion string `json:"driver_version"`
|
||||
CudaVersion string `json:"cuda_version,omitempty"`
|
||||
}
|
||||
description: "Describe una GPU detectada en el sistema con capacidad de VRAM total y libre, version de driver y version de CUDA (opcional, solo NVIDIA)."
|
||||
tags: [gpu, cuda, hardware, infra, ml]
|
||||
uses_types: []
|
||||
file_path: "functions/infra/gpu_info.go"
|
||||
---
|
||||
|
||||
## Ejemplo
|
||||
|
||||
```go
|
||||
gpu := GpuInfo{
|
||||
Index: 0,
|
||||
Name: "NVIDIA GeForce RTX 4090",
|
||||
VramTotalMb: 24576,
|
||||
VramFreeMb: 20000,
|
||||
DriverVersion: "545.23.08",
|
||||
CudaVersion: "12.3",
|
||||
}
|
||||
```
|
||||
|
||||
## Notas
|
||||
|
||||
`CudaVersion` es opcional y solo se rellena en GPUs NVIDIA con driver CUDA instalado.
|
||||
Los valores de VRAM estan en megabytes enteros para evitar ambiguedad con unidades.
|
||||
Espejo JSON-compatible de `GpuInfo_py_ml` (si existe) — tags `json:` en snake_case.
|
||||
@@ -0,0 +1,51 @@
|
||||
---
|
||||
name: vault_file
|
||||
lang: go
|
||||
domain: infra
|
||||
version: "1.0.0"
|
||||
algebraic: product
|
||||
definition: |
|
||||
type VaultFile struct {
|
||||
VaultID string `json:"vault_id"`
|
||||
VaultName string `json:"vault_name"`
|
||||
RelPath string `json:"rel_path"`
|
||||
Size int64 `json:"size"`
|
||||
Mtime int64 `json:"mtime"`
|
||||
Sha256 string `json:"sha256"`
|
||||
Mime string `json:"mime"`
|
||||
Ext string `json:"ext"`
|
||||
Bucket string `json:"bucket"`
|
||||
SubBucket string `json:"sub_bucket"`
|
||||
}
|
||||
description: "Describe un fichero individual dentro de un vault: identidad (vault + ruta relativa), metadatos de contenido (tamano, mtime, sha256, mime) y clasificacion estructural (bucket, sub-bucket)."
|
||||
tags: [vault, file, metadata, infra, storage]
|
||||
uses_types: []
|
||||
file_path: "functions/infra/vault_file.go"
|
||||
---
|
||||
|
||||
## Ejemplo
|
||||
|
||||
```go
|
||||
vf := VaultFile{
|
||||
VaultID: "turismo_spain_app_turismo",
|
||||
VaultName: "turismo_spain",
|
||||
RelPath: "data/raw/hoteles_2024.csv",
|
||||
Size: 142340,
|
||||
Mtime: 1715000000,
|
||||
Sha256: "e3b0c44298fc1c149afb...",
|
||||
Mime: "text/csv",
|
||||
Ext: ".csv",
|
||||
Bucket: "data",
|
||||
SubBucket: "raw",
|
||||
}
|
||||
```
|
||||
|
||||
## Notas
|
||||
|
||||
`Bucket` acepta exactamente "data" o "knowledge". `SubBucket` puede ser vacio si el fichero
|
||||
esta directamente en la raiz del bucket. Los valores conocidos de SubBucket son:
|
||||
- data: raw, processed, exports
|
||||
- knowledge: decisions, domains, models, benchmarks, test_documents
|
||||
|
||||
`Mtime` en unix seconds UTC. `Sha256` hex lowercase sin prefijo. `Size` en bytes.
|
||||
JSON tags en snake_case para serializar directamente a la tabla `vault_files` de operations.db.
|
||||
@@ -0,0 +1,53 @@
|
||||
---
|
||||
name: generation_config
|
||||
lang: go
|
||||
domain: ml
|
||||
version: "1.0.0"
|
||||
algebraic: product
|
||||
definition: |
|
||||
type GenerationConfig struct {
|
||||
Prompt string `json:"prompt"`
|
||||
NegativePrompt string `json:"negative_prompt,omitempty"`
|
||||
Seed int64 `json:"seed"`
|
||||
Steps int `json:"steps"`
|
||||
CfgScale float64 `json:"cfg_scale"`
|
||||
Sampler string `json:"sampler"`
|
||||
Width int `json:"width"`
|
||||
Height int `json:"height"`
|
||||
Model ModelRef `json:"model"`
|
||||
Loras []LoraRef `json:"loras,omitempty"`
|
||||
ClipSkip *int `json:"clip_skip,omitempty"`
|
||||
}
|
||||
description: "Parametros de una solicitud de generacion de imagen. Espejo JSON-compatible de GenerationConfig_py_ml: roundtrip JSON bytes <-> Python sin perdida."
|
||||
tags: [ml, image-gen, diffusion, config]
|
||||
uses_types: [model_ref_go_ml, lora_ref_go_ml]
|
||||
file_path: "functions/ml/generation_config.go"
|
||||
---
|
||||
|
||||
## Ejemplo
|
||||
|
||||
```go
|
||||
clipSkip := 2
|
||||
cfg := GenerationConfig{
|
||||
Prompt: "a photo of a cat in space, 8k, highly detailed",
|
||||
Seed: 42,
|
||||
Steps: 20,
|
||||
CfgScale: 7.0,
|
||||
Sampler: "euler_a",
|
||||
Width: 512,
|
||||
Height: 512,
|
||||
Model: ModelRef{
|
||||
Name: "dreamshaper_8",
|
||||
ModelType: "sd15",
|
||||
Quantization: "fp16",
|
||||
},
|
||||
ClipSkip: &clipSkip,
|
||||
}
|
||||
```
|
||||
|
||||
## Notas
|
||||
|
||||
Todos los campos usan tags `json:` snake_case para coincidir con el dataclass Python homólogo.
|
||||
`NegativePrompt`, `Loras` y `ClipSkip` son opcionales (`omitempty` / puntero).
|
||||
`Sampler` es string libre — ver `SamplerName_go_ml` para los valores documentados.
|
||||
`Seed` es `int64` para compatibilidad con seeds grandes de algunos backends.
|
||||
@@ -0,0 +1,39 @@
|
||||
---
|
||||
name: image_gen_result
|
||||
lang: go
|
||||
domain: ml
|
||||
version: "1.0.0"
|
||||
algebraic: product
|
||||
definition: |
|
||||
type ImageGenResult struct {
|
||||
ImageBytes []byte `json:"-"`
|
||||
Format string `json:"format"`
|
||||
Meta map[string]any `json:"meta"`
|
||||
DurationMs int64 `json:"duration_ms"`
|
||||
VramPeakMb *int `json:"vram_peak_mb,omitempty"`
|
||||
}
|
||||
description: "Resultado de una solicitud de generacion de imagen. ImageBytes contiene los bytes raw del PNG (excluido del JSON). Meta transporta metadata del backend (seed efectivo, steps, modelo, etc.)."
|
||||
tags: [ml, image-gen, diffusion, result]
|
||||
uses_types: []
|
||||
file_path: "functions/ml/image_gen_result.go"
|
||||
---
|
||||
|
||||
## Ejemplo
|
||||
|
||||
```go
|
||||
result, err := gen.Generate(ctx, cfg)
|
||||
if err != nil {
|
||||
log.Fatal(err)
|
||||
}
|
||||
// Bytes raw del PNG — escribir a disco o enviar como multipart
|
||||
os.WriteFile("output.png", result.ImageBytes, 0644)
|
||||
// Metadata serializable a JSON
|
||||
fmt.Println(result.DurationMs, result.Format)
|
||||
```
|
||||
|
||||
## Notas
|
||||
|
||||
`ImageBytes` usa `json:"-"` porque viaja por canal binario separado (multipart, gRPC bytes, archivo).
|
||||
El JSON de este tipo solo transporta metadata, no los bytes de la imagen.
|
||||
`Meta` es un mapa libre — los backends lo usan para devolver seed efectivo, steps realizados,
|
||||
nombre del modelo, etc. `VramPeakMb` es opcional y solo se rellena si el backend lo reporta.
|
||||
@@ -0,0 +1,33 @@
|
||||
---
|
||||
name: image_generator
|
||||
lang: go
|
||||
domain: ml
|
||||
version: "1.0.0"
|
||||
algebraic: product
|
||||
definition: |
|
||||
type ImageGenerator interface {
|
||||
Generate(ctx context.Context, cfg GenerationConfig) (ImageGenResult, error)
|
||||
}
|
||||
description: "Interface para backends de generacion de imagenes. Implementaciones pueden ser locales (ComfyUI, diffusers via Python subprocess) o remotas (API HTTP)."
|
||||
tags: [ml, image-gen, diffusion, interface]
|
||||
uses_types: [generation_config_go_ml, image_gen_result_go_ml]
|
||||
file_path: "functions/ml/image_generator.go"
|
||||
---
|
||||
|
||||
## Ejemplo
|
||||
|
||||
```go
|
||||
// Cualquier backend que implemente Generate puede usarse de forma intercambiable.
|
||||
var gen ImageGenerator = NewComfyUIBackend(cfg)
|
||||
result, err := gen.Generate(ctx, GenerationConfig{
|
||||
Prompt: "a serene mountain lake at dawn",
|
||||
Steps: 25,
|
||||
// ...
|
||||
})
|
||||
```
|
||||
|
||||
## Notas
|
||||
|
||||
Interface minima de un metodo. Los backends locales (ComfyUI, diffusers) y remotos (APIs)
|
||||
implementan el mismo contrato. El caller no necesita saber el backend concreto.
|
||||
`ctx` permite cancelacion y timeout. Los errores de backend se propagan directamente.
|
||||
@@ -0,0 +1,39 @@
|
||||
---
|
||||
name: lora_ref
|
||||
lang: go
|
||||
domain: ml
|
||||
version: "1.0.0"
|
||||
algebraic: product
|
||||
definition: |
|
||||
type LoraRef struct {
|
||||
Path string `json:"path"`
|
||||
Weight float64 `json:"weight"`
|
||||
Scale *float64 `json:"scale,omitempty"`
|
||||
}
|
||||
description: "Referencia a un adaptador LoRA con su peso de fusion (0.0-1.0) y escala opcional de activacion."
|
||||
tags: [ml, lora, image-gen, diffusion]
|
||||
uses_types: []
|
||||
file_path: "functions/ml/lora_ref.go"
|
||||
---
|
||||
|
||||
## Ejemplo
|
||||
|
||||
```go
|
||||
lora := LoraRef{
|
||||
Path: "/loras/detail_tweaker.safetensors",
|
||||
Weight: 0.7,
|
||||
}
|
||||
|
||||
scale := 0.5
|
||||
lora2 := LoraRef{
|
||||
Path: "/loras/lighting.safetensors",
|
||||
Weight: 0.8,
|
||||
Scale: &scale,
|
||||
}
|
||||
```
|
||||
|
||||
## Notas
|
||||
|
||||
Espejo JSON-compatible de `LoraRef_py_ml`.
|
||||
`Weight` es el multiplicador de fusion aplicado al modelo base (0.0 = sin efecto, 1.0 = efecto completo).
|
||||
`Scale` es un override de escala de activacion — omitir si se usa el default del backend.
|
||||
@@ -0,0 +1,36 @@
|
||||
---
|
||||
name: model_ref
|
||||
lang: go
|
||||
domain: ml
|
||||
version: "1.0.0"
|
||||
algebraic: product
|
||||
definition: |
|
||||
type ModelRef struct {
|
||||
Name string `json:"name"`
|
||||
ModelType string `json:"model_type"`
|
||||
Quantization string `json:"quantization"`
|
||||
Path string `json:"path,omitempty"`
|
||||
}
|
||||
description: "Referencia a un modelo de generacion de imagenes: nombre, arquitectura (sd15|sdxl|flux_dev|...), cuantizacion (fp16|q8_0|...) y path opcional en disco."
|
||||
tags: [ml, model, image-gen, diffusion]
|
||||
uses_types: []
|
||||
file_path: "functions/ml/model_ref.go"
|
||||
---
|
||||
|
||||
## Ejemplo
|
||||
|
||||
```go
|
||||
m := ModelRef{
|
||||
Name: "dreamshaper_8",
|
||||
ModelType: "sd15",
|
||||
Quantization: "fp16",
|
||||
Path: "/models/dreamshaper_8.safetensors",
|
||||
}
|
||||
```
|
||||
|
||||
## Notas
|
||||
|
||||
Espejo JSON-compatible de `ModelRef_py_ml`. Los tags `json:` coinciden con los
|
||||
campos snake_case del dataclass Python para roundtrip sin perdida.
|
||||
`ModelType` es string libre — los valores documentados son `sd15`, `sdxl`,
|
||||
`flux_dev`, `flux_schnell`. `Quantization` habitual: `fp16`, `bf16`, `q8_0`, `q4_K_M`.
|
||||
Reference in New Issue
Block a user