[Issue]: compile model doesnt work with anima
Issue Description
default settings except i enabled torch compile inductor for model
image doesnt start generating
Version Platform Description
11:22:50-852159 INFO Starting SD.Next 11:22:50-854247 INFO Logger: file="I:\aistuff\sdnext\sdnext.log" level=DEBUG host="User" size=71 mode=append 11:22:50-876801 INFO Platform: arch=AMD64 cpu=AMD64 Family 26 Model 68 Stepping 0, AuthenticAMD system=Windows release=Windows-11-10.0.26200-SP0 python=3.13.14 locale=('English_United States', '1252') setuptools=69.5.1 docker=False pip=26.1.2 uv=None 11:22:51-091337 INFO Version: app=sd.next updated=2026-07-14 commit=e08063a96 branch=master url=https://github.com/vladmandic/sdnext/tree/master kanvas=main ui=main 11:22:51-125997 DEBUG Packages: prefix=venv site=['venv', 'venv\Lib\site-packages'] 11:22:51-127378 INFO Args: ['--debug', '--use-cuda', '--quick'] 11:22:51-127914 DEBUG Setting environment tuning 11:22:51-128382 DEBUG Torch allocator: "garbage_collection_threshold:0.80,max_split_size_mb:512" 11:22:51-129816 INFO Torch: verifying installation 11:22:51-130334 DEBUG Torch overrides: cuda=True rocm=False ipex=False directml=False openvino=False zluda=False 11:22:51-130872 INFO CUDA: nVidia toolkit detected 11:22:52-127701 INFO Torch backend: {'version': '2.13.0+cu132', 'type': 'cuda', 'cuda': '13.2', 'cudnn': 92000} 11:22:52-128449 INFO Torch detected: {'gpu': 'NVIDIA GeForce RTX 4090', 'vram': 24564, 'arch': '8.9 Ada Lovelace', 'cores': 128} 11:22:52-133619 INFO Install: verifying requirements 11:22:52-157921 INFO Startup: launch=quick 11:22:52-158447 INFO Extensions: disabled=[]
Relevant log output
11:25:02-480509 ERROR Encode prompt: UnspecializedNNModuleVariable(Qwen3Model) is already tracked for mutation. This
could be because you are not using VariableBuilder to construct the variable tracker. Source
of new object:
UnspecializedNNModuleSource(base=AttrSource(base=AttrSource(base=AttrSource(base=GlobalSource(
global_name='shared'), member='sd_model'), member='text_encoder'), member='_orig_mod')).
Source of previously tracked object:
UnspecializedNNModuleSource(base=LocalSource(local_name='module', is_input=True,
dynamism=None, is_derefed_cell_contents=False)).
from user code:
File "I:\aistuff\sdnext\modules\sd_offload.py", line 250, in
torch_dynamo_resume_in_pre_forward_at_246
for module_name in get_module_names(pipe):
~~~~~~~~~~~~~~~~^^^^^^
File "I:\aistuff\sdnext\modules\sd_offload.py", line 365, in get_module_names
modules_names = [m for m in modules_names if is_valid(m)]
~~~~~~~~^^^
File "I:\aistuff\sdnext\modules\sd_offload.py", line 338, in is_valid
if isinstance(getattr(pipe, module, None), torch.nn.ModuleDict):
~~~~~~~^^^^^^^^^^^^^^^^^^^^
Set TORCHDYNAMO_VERBOSE=1 for the internal stack trace (please do this especially if you're
reporting a bug to PyTorch). For even more developer context, set TORCH_LOGS="+dynamo"
11:25:02-482833 ERROR Encode prompt: AssertionError
I:\aistuff\sdnext\modules\sd_hijack_te.py:69 in hijack_encode_prompt
68 if hasattr(shared.sd_model, 'orig_encode_prompt'):
❱ 69 res = shared.sd_model.orig_encode_prompt(*args_copy, **kwargs)
70 else:
I:\aistuff\sdnext\pipelines\anima\pipeline.py:154 in encode_prompt
153 if prompt_embeds is None:
❱ 154 prompt_embeds = self._encode_prompt(prompt, device, dtype, max_sequence_length)
155 _, seq_len, _ = prompt_embeds.shape
I:\aistuff\sdnext\pipelines\anima\pipeline.py:102 in _encode_prompt
101 # Get Qwen3 hidden states
❱ 102 qwen_outputs = self.text_encoder(
103 input_ids=qwen_input_ids,
I:\aistuff\sdnext\venv\Lib\site-packages\torch\_dynamo\eval_frame.py:511 in __call__
510 with _set_in_optimized_module():
❱ 511 return super().__call__(*args, **kwargs)
512
I:\aistuff\sdnext\venv\Lib\site-packages\torch\nn\modules\module.py:1778 in _wrapped_call_impl
1777 else:
❱ 1778 return self._call_impl(*args, **kwargs)
1779
I:\aistuff\sdnext\venv\Lib\site-packages\torch\nn\modules\module.py:1789 in _call_impl
1788 or _global_forward_hooks or _global_forward_pre_hooks):
❱ 1789 return forward_call(*args, **kwargs)
1790
I:\aistuff\sdnext\venv\Lib\site-packages\torch\_dynamo\eval_frame.py:1166 in compile_wrapper
1165 try:
❱ 1166 result = fn(*args, **kwargs)
1167 call_succeeded = True
I:\aistuff\sdnext\venv\Lib\site-packages\torch\nn\modules\module.py:1778 in _wrapped_call_impl
1777 else:
❱ 1778 return self._call_impl(*args, **kwargs)
1779
... 50 frames hidden ...
I:\aistuff\sdnext\venv\Lib\site-packages\torch\_dynamo\variables\lazy.py:50 in realize
49 # when LazyVariableTracker.realize() returns LazyConstantVariable.
❱ 50 self.vt = builder.VariableBuilder(
51 tx, self.source, allow_lazy_constant=False
I:\aistuff\sdnext\venv\Lib\site-packages\torch\_dynamo\variables\builder.py:790 in __call__
789 try:
❱ 790 return self._call_impl(value)
791 finally:
I:\aistuff\sdnext\venv\Lib\site-packages\torch\_dynamo\variables\builder.py:827 in _call_impl
826
❱ 827 vt = self._wrap(value)
828
I:\aistuff\sdnext\venv\Lib\site-packages\torch\_dynamo\variables\builder.py:1225 in _wrap
1224 elif isinstance(value, torch.nn.Module):
❱ 1225 return self.wrap_module(value)
1226 elif ConstantVariable.is_literal(value): # non-atomic literals
I:\aistuff\sdnext\venv\Lib\site-packages\torch\_dynamo\variables\builder.py:2446 in wrap_module
2445 self.source = AttrSource(self.source, "_orig_mod")
❱ 2446 return self.wrap_module(value._orig_mod)
2447
I:\aistuff\sdnext\venv\Lib\site-packages\torch\_dynamo\variables\builder.py:2572 in wrap_module
2571 return result
❱ 2572 return self.tx.output.side_effects.track_object_existing(value, result)
2573 elif issubclass(
I:\aistuff\sdnext\venv\Lib\site-packages\torch\_dynamo\side_effects.py:636 in track_object_existing
635 # variable
❱ 636 return self._track_obj(
637 item,
I:\aistuff\sdnext\venv\Lib\site-packages\torch\_dynamo\side_effects.py:614 in _track_obj
613 if id(item) in self.id_to_variable:
❱ 614 raise AssertionError(
615 f"{variable} is already tracked for mutation. This could be "
AssertionError: UnspecializedNNModuleVariable(Qwen3Model) is already tracked for mutation. This could be because you are not using VariableBuilder to construct the variable tracker. Source of new object: UnspecializedNNModuleSource(base=AttrSource(base=AttrSource(base=AttrSource(base=GlobalSource(global_name='shared'), member='sd_model'), member='text_encoder'), member='_orig_mod')). Source of previously tracked object: UnspecializedNNModuleSource(base=LocalSource(local_name='module', is_input=True, dynamism=None, is_derefed_cell_contents=False)).
from user code:
File "I:\aistuff\sdnext\modules\sd_offload.py", line 250, in torch_dynamo_resume_in_pre_forward_at_246
for module_name in get_module_names(pipe):
~~~~~~~~~~~~~~~~^^^^^^
File "I:\aistuff\sdnext\modules\sd_offload.py", line 365, in get_module_names
modules_names = [m for m in modules_names if is_valid(m)]
~~~~~~~~^^^
File "I:\aistuff\sdnext\modules\sd_offload.py", line 338, in is_valid
if isinstance(getattr(pipe, module, None), torch.nn.ModuleDict):
~~~~~~~^^^^^^^^^^^^^^^^^^^^
Set TORCHDYNAMO_VERBOSE=1 for the internal stack trace (please do this especially if you're reporting a bug to PyTorch). For even more developer context, set TORCH_LOGS="+dynamo"
11:25:03-443309 ERROR Processing: args={'prompt': ['kita ikuyo'], 'negative_prompt': [''], 'generator':
[<torch._C.Generator object at 0x00000213A3BD1D90>], 'callback_on_step_end': <function
diffusers_callback at 0x00000213A084E7A0>, 'callback_on_step_end_tensor_inputs': ['latents',
'prompt_embeds', 'negative_prompt_embeds'], 'num_inference_steps': 20, 'output_type':
'latent', 'width': 1024, 'height': 1024} not enough values to unpack (expected 2, got 1)
11:25:03-444660 ERROR Processing: ValueError
I:\aistuff\sdnext\modules\processing_diffusers.py:186 in process_base
185 taskid = shared.state.begin('Inference')
❱ 186 output = shared.sd_model(**base_args)
187 shared.state.end(taskid)
I:\aistuff\sdnext\venv\Lib\site-packages\torch\\\utils\_contextlib.py:124 in decorate_context
123 with ctx_factory():
❱ 124 return func(*args, **kwargs)
125
I:\aistuff\sdnext\pipelines\anima\pipeline.py:258 in __call__
257 # Encode prompt
❱ 258 prompt_embeds, negative_prompt_embeds = self.encode_prompt(
259 prompt=prompt,
ValueError: not enough values to unpack (expected 2, got 1)Operating system
Windows
Compute
nVidia CUDA
Interface
ModernUI
Branch
Master
Model
Other image model
Acknowledgements
- I have read the above and searched for existing issues
- I confirm that this is classified correctly and its not an extension issue
Source: vladmandic/sdnext