Files
fn_registry/python/functions/ml/diffusers_unload.md
T
egutierrez e3c8979e8d 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.6 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_unload function py ml 1.0.0 impure def diffusers_unload(pipe: Any | None = None) -> None Libera la memoria de un pipeline diffusers. Si pipe=None limpia el cache global de diffusers_load_pipeline. Siempre llama gc.collect() y torch.cuda.empty_cache().
diffusers
ml
memory
cleanup
vram
cache
false error_go_core
torch
gc
name desc
pipe Pipeline a liberar con del. Si None, limpia el cache global _PIPELINE_CACHE de diffusers_load_pipeline (descarga todos los pipelines cacheados).
None. Efecto secundario: del pipe si pasado, cache limpiado si None, gc.collect() y torch.cuda.empty_cache() siempre. true
unload None limpia cache cuda si disponible
python/functions/ml/tests/test_diffusers_backend.py python/functions/ml/diffusers_unload.py

Ejemplo

from diffusers_unload import diffusers_unload

# Liberar un pipeline especifico
diffusers_unload(pipe)

# Limpiar TODO el cache (descarga todos los modelos en memoria)
diffusers_unload()

Notas

del pipe no garantiza liberacion inmediata si hay otras referencias al objeto. Llamar diffusers_unload(pipe) + borrar la referencia local (pipe = None) para asegurar que el GC pueda recolectar.

torch.cuda.empty_cache() solo libera cache del allocator de PyTorch, no memoria que otros procesos ocupen. Para liberacion total, el proceso debe terminar.

Import lazy de torch — si no esta instalado, omite empty_cache silenciosamente.