| sdcpp_python_load |
function |
py |
ml |
1.0.0 |
impure |
def sdcpp_python_load(model: ModelRef, n_threads: int = -1, wtype: str = 'default', rng_type: str = 'cuda') -> Any |
Carga un StableDiffusion via stable-diffusion-cpp-python con cache global por (model_key, wtype, n_threads). Segunda llamada con mismos params retorna instancia cacheada sin recargar disco. |
| ml |
| stable-diffusion |
| sdcpp |
| inference |
| backend |
| cache |
| load |
|
|
|
|
false |
error_go_core |
|
| name |
desc |
| model |
Referencia al modelo. model.path se usa si presente; si no, model.name como ruta local o HuggingFace hub. |
|
| name |
desc |
| n_threads |
Numero de hilos CPU para inferencia. -1 usa todos los disponibles. |
|
| name |
desc |
| wtype |
Tipo de pesos en memoria: 'default' | 'f32' | 'f16' | 'q8_0' | 'q5_1' | 'q5_0' | 'q4_1' | 'q4_0'. 'default' respeta el tipo original del checkpoint. |
|
| name |
desc |
| rng_type |
Generador de aleatorios: 'std_default' | 'cuda'. 'cuda' produce resultados compatibles con la implementacion CUDA incluso en CPU. |
|
|
Instancia StableDiffusion (stable_diffusion_cpp.StableDiffusion) lista para llamar a generate_image(). |
true |
| load retorna objeto StableDiffusion |
| segunda llamada retorna instancia cacheada |
|
python/functions/ml/tests/test_sdcpp_python_backend.py |
python/functions/ml/sdcpp_python_load.py |