mirror of
https://github.com/Physton/sd-webui-prompt-all-in-one.git
synced 2026-04-25 00:38:53 +00:00
This fixes the TypeError that occurs during model switching in sd-webui-reforge and possibly other optimized environments. The error happens because 'get_token_counter' tries to access 'sd_models.model_data.sd_model.cond_stage_model' before the model is fully loaded (when 'sd_model' is None). The fix adds a check for the 'None' value to safely return 0 tokens instead of throwing an error.