Fix to enable loading fp16 repo variant ControlNets #8643
+3
−1
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Summary
Ensured ControlNet diffusers configs detect and propagate the fp16 repo variant so fp16 weight files such as diffusion_pytorch_model.fp16.safetensors are accepted during loading.
Root cause
In the earlier implementation of ControlNet_Diffusers_Config_Base.from_model_on_disk(), the method simply returned cls(**override_fields) once it had validated the directory and base model. Because the repo_variant field was left at its default (ModelRepoVariant.Default), downstream loading logic always looked for the default diffusers weight filename (diffusion_pytorch_model.bin). That default does not match SDXL ControlNet repositories that ship only fp16 weights named diffusion_pytorch_model.fp16.safetensors, so InvokeAI failed to find the downloaded file even though it was present.
Resolution
The updated version now detects the repository variant before instantiating the config. It calls _get_repo_variant_or_raise(), which scans all .safetensors and .bin files beneath the model directory. When it encounters a filename that carries the .fp16 suffix—such as diffusion_pytorch_model.fp16.safetensors—it returns ModelRepoVariant.FP16. Passing that value into the config ensures the loader subsequently searches for the fp16-weight filename instead of the default .bin, allowing SDXL ControlNet models to load successfully without renaming their files
Related Issues / Discussions
After deleting and reinstalling SDXL Depth Map CN Invoke no longer able to load it from assigned folder. Installation with model manager shows no error.
https://discord.com/channels/1020123559063990373/1149506274971631688/1432444353200128000
Fixes #8645
QA Instructions
Did tests with my local dev build and CN loading works as intended.
Merge Plan
Might need a look from someone more experienced.
Checklist
What's Newcopy (if doing a release after this PR)