mirror of
https://github.com/vladmandic/automatic
synced 2026-09-20 01:31:13 +02:00
fix(ltx): wrap explicit encode_prompt in inference_context
Upstream LTX2 encode_prompt is not @torch.no_grad-decorated; only __call__ is. Calling encode_prompt directly from ltx_process recorded the full Gemma3 forward graph.
This commit is contained in:
@@ -326,12 +326,13 @@ def run_ltx(task_id,
|
||||
extra_networks.activate(p, networks)
|
||||
# Encode once and reuse across stages; encode_prompt short-circuits when
|
||||
# embeds are passed to __call__. CPU park keeps them off GPU between stages.
|
||||
prompt_embeds, prompt_attention_mask, negative_prompt_embeds, negative_prompt_attention_mask = shared.sd_model.encode_prompt(
|
||||
prompt=prompt_final,
|
||||
negative_prompt=negative_final,
|
||||
do_classifier_free_guidance=True,
|
||||
device=devices.device,
|
||||
)
|
||||
with devices.inference_context():
|
||||
prompt_embeds, prompt_attention_mask, negative_prompt_embeds, negative_prompt_attention_mask = shared.sd_model.encode_prompt(
|
||||
prompt=prompt_final,
|
||||
negative_prompt=negative_final,
|
||||
do_classifier_free_guidance=True,
|
||||
device=devices.device,
|
||||
)
|
||||
prompt_embeds = prompt_embeds.cpu()
|
||||
prompt_attention_mask = prompt_attention_mask.cpu() if prompt_attention_mask is not None else None
|
||||
negative_prompt_embeds = negative_prompt_embeds.cpu() if negative_prompt_embeds is not None else None
|
||||
|
||||
Reference in New Issue
Block a user