From 667188d77a4f27c4f5d4465f06864d2c98d70030 Mon Sep 17 00:00:00 2001 From: Brandon Rising Date: Thu, 5 Sep 2024 13:12:25 -0400 Subject: [PATCH] Add comment explaining the cache make room call --- invokeai/backend/model_manager/load/model_loaders/flux.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/invokeai/backend/model_manager/load/model_loaders/flux.py b/invokeai/backend/model_manager/load/model_loaders/flux.py index cd48cefb803..934fffbbf3e 100644 --- a/invokeai/backend/model_manager/load/model_loaders/flux.py +++ b/invokeai/backend/model_manager/load/model_loaders/flux.py @@ -199,6 +199,9 @@ def _load_from_singlefile( if "model.diffusion_model.double_blocks.0.img_attn.norm.key_norm.scale" in sd: sd = convert_bundle_to_flux_transformer_checkpoint(sd) futures: list[torch.jit.Future[tuple[str, torch.Tensor]]] = [] + # For the first iteration we are just requesting the current size of the state dict + # This is due to an expected doubling of the tensor sizes in memory after converting float8 -> float16 + # This should be refined in the future if not removed entirely when we support more data types sd_size = asizeof.asizeof(sd) cache_updated = False for k in sd.keys():