Fix cache_text_encoder device preset missing in BaseModel
BaseModel.set_device_state_preset() has no branch for the
'cache_text_encoder' preset, so when TextEmbeddingCachingMixin calls
set_device_state_preset('cache_text_encoder') the active_modules list
stays empty and the text encoder is placed on CPU. With
cache_text_embeddings enabled on a BaseModel arch (e.g. chroma), every
caption is then encoded on CPU — with a quantized T5-XXL this took
~6.5 minutes per caption (~21 hours for a 205-image dataset) while the
GPU sat idle. StableDiffusion.set_device_state_preset() already has
this branch; this adds the same two lines to BaseModel.
This commit is contained in:
1 parent
5497a001cb
commit
5fc8fd76de
1 file changed
+2
@@ -1567,6 +1567,8 @@ class BaseModel:
|
||||
active_modules = ['vae']
|
||||
if device_state_preset in ['cache_clip']:
|
||||
active_modules = ['clip']
|
||||
if device_state_preset in ['cache_text_encoder']:
|
||||
active_modules = ['text_encoder']
|
||||
if device_state_preset in ['generate']:
|
||||
active_modules = ['vae', 'unet',
|
||||
'text_encoder', 'adapter', 'refiner_unet']
|
||||
|
||||
Reference in new issue
Block a user