Files
fn_registry/python/functions/ml/diffusers_load_lora.md
T
egutierrez a802f59f55 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>
2026-05-13 00:50:34 +02:00

1.8 KiB

name, kind, lang, domain, version, purity, signature, description, tags, uses_functions, uses_types, returns, returns_optional, error_type, imports, params, output, tested, tests, test_file_path, file_path
name kind lang domain version purity signature description tags uses_functions uses_types returns returns_optional error_type imports params output tested tests test_file_path file_path
diffusers_load_lora function py ml 1.0.0 impure def diffusers_load_lora(pipe: Any, lora: LoraRef) -> Any 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.
diffusers
ml
lora
image-generation
fine-tuning
lora_ref_py_ml
false error_go_core
diffusers
name desc
pipe Pipeline diffusers que soporte load_lora_weights (SD1.5, SDXL, etc.).
name desc
lora Referencia al adaptador LoRA. lora.path al .safetensors o directorio. lora.weight escala la fusion (1.0 = completo, 0.5 = mitad).
El mismo pipe con el LoRA cargado y peso aplicado. Modificacion in-place, retorna pipe para composicion. false
python/functions/ml/diffusers_load_lora.py

Ejemplo

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.