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,49 @@
|
||||
---
|
||||
name: diffusers_load_lora
|
||||
kind: function
|
||||
lang: py
|
||||
domain: ml
|
||||
version: "1.0.0"
|
||||
purity: impure
|
||||
signature: "def diffusers_load_lora(pipe: Any, lora: LoraRef) -> Any"
|
||||
description: "Carga un adaptador LoRA en un pipeline diffusers via pipe.load_lora_weights. Si lora.weight != 1.0, aplica set_adapters para escalar la contribucion del LoRA."
|
||||
tags: [diffusers, ml, lora, image-generation, fine-tuning]
|
||||
uses_functions: []
|
||||
uses_types: [lora_ref_py_ml]
|
||||
returns: []
|
||||
returns_optional: false
|
||||
error_type: "error_go_core"
|
||||
imports: [diffusers]
|
||||
params:
|
||||
- name: pipe
|
||||
desc: "Pipeline diffusers que soporte load_lora_weights (SD1.5, SDXL, etc.)."
|
||||
- name: lora
|
||||
desc: "Referencia al adaptador LoRA. lora.path al .safetensors o directorio. lora.weight escala la fusion (1.0 = completo, 0.5 = mitad)."
|
||||
output: "El mismo pipe con el LoRA cargado y peso aplicado. Modificacion in-place, retorna pipe para composicion."
|
||||
tested: false
|
||||
tests: []
|
||||
test_file_path: ""
|
||||
file_path: "python/functions/ml/diffusers_load_lora.py"
|
||||
---
|
||||
|
||||
## Ejemplo
|
||||
|
||||
```python
|
||||
from diffusers_load_lora import diffusers_load_lora
|
||||
from lora_ref import LoraRef
|
||||
|
||||
lora = LoraRef(path="/path/to/my_lora.safetensors", weight=0.8)
|
||||
pipe = diffusers_load_lora(pipe, lora)
|
||||
```
|
||||
|
||||
## Notas
|
||||
|
||||
Usa `pipe.load_lora_weights(path)` para cargar. Si `lora.weight != 1.0`:
|
||||
- Intenta `pipe.set_adapters(["default"], adapter_weights=[weight])` (diffusers >= 0.20).
|
||||
- Fallback a `pipe.fuse_lora(lora_scale=weight)` para versiones antiguas.
|
||||
|
||||
El campo `lora.scale` (override de alpha) no se aplica aqui — diffusers no expone
|
||||
un parametro directo equivalente en la API publica actual. Se puede setear via
|
||||
`pipe.load_lora_weights(path, weight_name=...)` si el archivo tiene nombre especifico.
|
||||
|
||||
Import lazy de diffusers — ImportError descriptivo si no instalado.
|
||||
Reference in New Issue
Block a user