Comfy-Org / Comfy-Org/ComfyUI

how to know which model unload and load in model_management?

Open
#5,979 1 comment 0 reactions 0 assignees View on GitHub
Feature
Dominant language
Python
Stars
133k
Forks
15.7k
Avg merge
1d 6h
Merged PRs (30d)
155

Description

### Feature Idea

code version:2024/4/19
133dc3351b3277f6ce41da7839ace9055329c64c
GPU: L4,,24G
GPU utilization: 16G

i have a comfyui server backend, and i found before sample, the workflow exectue some load and unload model operation, but i don't know which model does it unload, because many models have been loaded by inspire-pack.
1)16:56:09 and 16:56:13 have 4 seconds gap, i want to know what happend in these 4 seconds for my model_management model?
2)how to print/log out the real model name like "sdxl1.0 safetensor" in model_management?
some logs like this:
```
[2024-12-09 16:56] [2024-12-09 16:56:09 +0800] [/home/service/var/comfyui-workflow/./ComfyUI/comfy/model_management.py] [356] [DEBUG] test,free_memory,keep_loaded[]
[2024-12-09 16:56] test,free_memory,can_unload
[2024-12-09 16:56] [2024-12-09 16:56:09 +0800] [/home/service/var/comfyui-workflow/./ComfyUI/comfy/model_management.py] [362] [DEBUG] test,free_memory,can_unload
[2024-12-09 16:56] test,free_memory,can_unload
[2024-12-09 16:56] [2024-12-09 16:56:09 +0800] [/home/service/var/comfyui-workflow/./ComfyUI/comfy/model_management.py] [362] [DEBUG] test,free_memory,can_unload
[2024-12-09 16:56] test,free_memory,can_unload
[2024-12-09 16:56] [2024-12-09 16:56:09 +0800] [/home/service/var/comfyui-workflow/./ComfyUI/comfy/model_management.py] [362] [DEBUG] test,free_memory,can_unload
[2024-12-09 16:56] test,free_memory,can_unload
[2024-12-09 16:56] [2024-12-09 16:56:09 +0800] [/home/service/var/comfyui-workflow/./ComfyUI/comfy/model_management.py] [362] [DEBUG] test,free_memory,can_unload
[2024-12-09 16:56] test,free_memory,can_unload[(3, 1839310856, 4), (3, 2502028320, 3), (2, 5134967368, 2), (3, 167307726, 1)]
[2024-12-09 16:56] [2024-12-09 16:56:09 +0800] [/home/service/var/comfyui-workflow/./ComfyUI/comfy/model_management.py] [365] [DEBUG] test,free_memory,can_unload[(3, 1839310856, 4), (3, 2502028320, 3), (2, 5134967368, 2), (3, 167307726, 1)]
[2024-12-09 16:56] test,free_memory,keep_loaded[]
[2024-12-09 16:56] [2024-12-09 16:56:13 +0800] [/home/service/var/comfyui-workflow/./ComfyUI/comfy/model_management.py] [356] [DEBUG] test,free_memory,keep_loaded[]
[2024-12-09 16:56] test,free_memory,can_unload
[2024-12-09 16:56] [2024-12-09 16:56:13 +0800] [/home/service/var/comfyui-workflow/./ComfyUI/comfy/model_management.py] [362] [DEBUG] test,free_memory,can_unload
[2024-12-09 16:56] test,free_memory,can_unload
[2024-12-09 16:56] [2024-12-09 16:56:13 +0800] [/home/service/var/comfyui-workflow/./ComfyUI/comfy/model_management.py] [362] [DEBUG] test,free_memory,can_unload
[2024-12-09 16:56] test,free_memory,can_unload
[2024-12-09 16:56] [2024-12-09 16:56:13 +0800] [/home/service/var/comfyui-workflow/./ComfyUI/comfy/model_management.py] [362] [DEBUG] test,free_memory,can_unload
[2024-12-09 16:56] test,free_memory,can_unload
[2024-12-09 16:56] [2024-12-09 16:56:13 +0800] [/home/service/var/comfyui-workflow/./ComfyUI/comfy/model_management.py] [362] [DEBUG] test,free_memory,can_unload
[2024-12-09 16:56] test,free_memory,can_unload[(3, 1839310856, 4), (4, 2502028320, 3), (2, 5134967368, 2), (3, 1268951040, 1)]
[2024-12-09 16:56] [2024-12-09 16:56:13 +0800] [/home/service/var/comfyui-workflow/./ComfyUI/comfy/model_management.py] [365] [DEBUG] test,free_memory,can_unload[(3, 1839310856, 4), (4, 2502028320, 3), (2, 5134967368, 2), (3, 1268951040, 1)]
[2024-12-09 16:56] Requested to load SDXL
[2024-12-09 16:56] [2024-12-09 16:56:14 +0800] [/home/service/var/comfyui-workflow/./ComfyUI/comfy/model_management.py] [405] [INFO] Requested to load SDXL
[2024-12-09 16:56] Loading 1 new model
[2024-12-09 16:56] [2024-12-09 16:56:14 +0800] [/home/service/var/comfyui-workflow/./ComfyUI/comfy/model_management.py] [415] [INFO] Loading 1 new model
[2024-12-09 16:56] unload clone 3 False
[2024-12-09 16:56] [2024-12-09 16:56:14 +0800] [/home/service/var/comfyui-workflow/./ComfyUI/comfy/model_management.py] [348] [DEBUG] unload clone 3 False
[2024-12-09 16:56] test,load_models_gpu current_loaded_models insert
[2024-12-09 16:56] [2024-12-09 16:56:14 +0800] [/home/service/var/comfyui-workflow/./ComfyUI/comfy/model_management.py] [453] [INFO] test,load_models_gpu current_loaded_models insert
[2024-12-09 16:56] ^M100%|██████████| 20/20 [00:17<00:00, 1.26it/s]^M100%|██████████| 20/20 [00:17<00:00, 1.15it/s]
[2024-12-09 16:56] test,free_memory,keep_loaded[]
[2024-12-09 16:56] [2024-12-09 16:56:32 +0800] [/home/service/var/comfyui-workflow/./ComfyUI/comfy/model_management.py] [356] [DEBUG] test,free_memory,keep_loaded[]
[2024-12-09 16:56] test,free_memory,can_unload
[2024-12-09 16:56] [2024-12-09 16:56:32 +0800] [/home/service/var/comfyui-workflow/./ComfyUI/comfy/model_management.py] [362] [DEBUG] test,free_memory,can_unload
[2024-12-09 16:56] test,free_memory,can_unload
[2024-12-09 16:56] [2024-12-09 16:56:32 +0800] [/home/service/var/comfyui-workflow/./ComfyUI/comfy/model_management.py] [362] [DEBUG] test,free_memory,can_unload
[2024-12-09 16:56] test,free_memory,can_unload
[2024-12-09 16:56] [2024-12-09 16:56:32 +0800] [/home/service/var/comfyui-workflow/./ComfyUI/comfy/model_management.py] [362] [DEBUG] test,free_memory,can_unload
[2024-12-09 16:56] test,free_memory,can_unload
[2024-12-09 16:56] [2024-12-09 16:56:32 +0800] [/home/service/var/comfyui-workflow/./ComfyUI/comfy/model_management.py] [362] [DEBUG] test,free_memory,can_unload
[2024-12-09 16:56] test,free_memory,can_unload[(3, 1839310856, 4), (3, 1268951040, 3), (4, 2502028320, 2), (3, 5134967368, 1)]
[2024-12-09 16:56] [2024-12-09 16:56:32 +0800] [/home/service/var/comfyui-workflow/./ComfyUI/comfy/model_management.py] [365] [DEBUG] test,free_memory,can_unload[(3, 1839310856, 4), (3, 1268951040, 3), (4, 2502028320, 2), (3, 5134967368, 1)]
[2024-12-09 16:56] Prompt executed in 27.44 seconds
[2024-12-09 16:56] [2024-12-09 16:56:36 +0800] [/home/service/var/comfyui-workflow/app/workflow/comfyui_main.py] [124] [INFO] Prompt executed in 27.44 seconds
```

### Existing Solutions

_No response_

### Other

_No response_

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.