Skip to content

The most powerful and modular diffusion model GUI, api and backend with a graph/nodes interface. The fastest local inference engine in the world.

Add some option to model_options for the text encoder.

comfyanonymousd514bb38ee11
diff --git a/comfy/sd.py b/comfy/sd.py
index 07310b9d4..8c5b058ce 100644
--- a/comfy/sd.py
+++ b/comfy/sd.py
@@ -70,14 +70,14 @@ class CLIP:
clip = target.clip
tokenizer = target.tokenizer
- load_device = model_management.text_encoder_device()
- offload_device = model_management.text_encoder_offload_device()
+ load_device = model_options.get("load_device", model_management.text_encoder_device())
+ offload_device = model_options.get("offload_device", model_management.text_encoder_offload_device())
dtype = model_options.get("dtype", None)
if dtype is None:
dtype = model_management.text_encoder_dtype(load_device)
params['dtype'] = dtype
- params['device'] = model_management.text_encoder_initial_device(load_device, offload_device, parameters * model_management.dtype_size(dtype))
+ params['device'] = model_options.get("initial_device", model_management.text_encoder_initial_device(load_device, offload_device, parameters * model_management.dtype_size(dtype)))
params['model_options'] = model_options
self.cond_stage_model = clip(**(params))