Instructions to use darask0/MOSS-Image_4-step_adapter_lora with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Diffusers
How to use darask0/MOSS-Image_4-step_adapter_lora with Diffusers:
pip install -U diffusers transformers accelerate
import torch from diffusers import DiffusionPipeline # switch to "mps" for apple devices pipe = DiffusionPipeline.from_pretrained("OpenMOSS-Team/MOSS-Image-SFT", dtype=torch.bfloat16, device_map="cuda") pipe.load_lora_weights("darask0/MOSS-Image_4-step_adapter_lora") prompt = "Astronaut in a jungle, cold color palette, muted colors, detailed, 8k" image = pipe(prompt).images[0] - Notebooks
- Google Colab
- Kaggle
- Local Apps Settings
- Draw Things
- DiffusionBee
comfyui error
result = f(**inputs)
File "M:\ComfyUI\313tor212cu130\ComfyUI\custom_nodes\rapid-moss\nodes.py", line 141, in apply
patched.add_object_patch(target + '.forward', _lora_forward(patched.get_model_object(target), down, up, scale))
~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^
File "M:\ComfyUI\313tor212cu130\ComfyUI\comfy\model_patcher.py", line 772, in get_model_object
return comfy.utils.get_attr(self.model, name)
~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^
File "M:\ComfyUI\313tor212cu130\ComfyUI\comfy\utils.py", line 1018, in get_attr
obj = getattr(obj, name)
File "M:\ComfyUI\313tor212cu130\python_embeded\Lib\site-packages\torch\nn\modules\module.py", line 1967, in __getattr__
raise AttributeError(
f"'{type(self).__name__}' object has no attribute '{name}'"
)
AttributeError: 'ModuleDict' object has no attribute 'q'
good job, thenks
Fixed in 1ec327b9. Thanks for reporting this!
Native ComfyUI models fuse Q/K/V into proj.qkv, whereas the old node expected separate q, k, and v modules. The updated node supports both layouts. It also preserves fp32 modulation/residuals in native blocks to prevent black images and ensures the FFN LoRA is applied.
To update:
- Replace
ComfyUI/custom_nodes/rapid-mosswith the latestcomfyui/rapid-mossfolder from this repo, then restart ComfyUI. No adapter weight re-download is needed. - Load the new native ComfyUI workflow. Use the MOSS-Image-SFT BF16 diffusion model, Qwen3.5-9B with
CLIPLoadertypemoss_image, and the FLUX.2 VAE. - Keep
BasicGuiderand the adapter's dedicated sampler/SIGMAS as wired in the workflow.
The original OpenMOSS HF-loader workflow remains supported. Both loader paths were verified with 1024x1024, 4-step generation, and all 8 regression tests pass. Native testing used official SFT BF16 weights repacked with fused QKV and a BF16 text encoder. INT8/FP8/GGUF diffusion models have not been validated.
Fixed in 1ec327b9. Thanks for reporting this!
Now, that the model error is fixed, another error appears, brief summary: "aimdo memory compile error" (I can use MOSS with another workflow without rapid-moss, so it can't be just related to a memory error I guess).
The error is raised in comfy_aimdo/malloc_graph.py (pop() returns 2) and is triggered from comfy/model_prefetch.py::prefetch_queue_pop (called with malloc_scope="block" from comfy/ldm/moss_image/model.py). The call chain starts in custom_nodes/rapid-moss/nodes.py, line 127, in sample_dataspace, where the model is called directly: denoised = model(x_in, s * s_in, **extra_args).float().
As far as I can tell, newer ComfyUI versions record the allocation sequence of the first forward pass in an aimdo malloc graph and then replay it. If a later call deviates from the recorded pattern (different input shape or dtype, an extra or differently ordered model call, or additional allocations between calls), the graph is flagged as broken, and that is the error I’m seeing.
Your sampler seems to bypass the usual sampling path, so it likely doesn’t set up or reset the malloc graph and prefetch state the way the stock samplers do. Could you check whether:
every model(...) call in sample_dataspace has identical input shape, dtype and device across all steps (including the first and last step)?
there are any extra model calls or allocations (warm-up call, final-step special case, .float() casts on differently sized tensors) that change the allocation pattern?
the sampler should be wrapped or registered through the standard sampler mechanism (e.g. comfy.samplers.KSAMPLER / the executor wrappers) so the core can manage aimdo/prefetch state?
Full error log:
[ERROR] !!! Exception during processing !!! aimdo memory compile error
[ERROR] Traceback (most recent call last):
File "D:\ComfyUI\execution.py", line 548, in execute
output_data, output_ui, has_subgraph, has_pending_tasks = await get_output_data(prompt_id, unique_id, obj, input_data_all, execution_block_cb=execution_block_cb, pre_execute_cb=pre_execute_cb, v3_data=v3_data)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "D:\ComfyUI\execution.py", line 353, in get_output_data
return_values = await _async_map_node_over_list(prompt_id, unique_id, obj, input_data_all, obj.FUNCTION, allow_interrupt=True, execution_block_cb=execution_block_cb, pre_execute_cb=pre_execute_cb, v3_data=v3_data)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "D:\ComfyUI\execution.py", line 327, in async_map_node_over_list
await process_inputs(input_dict, i)
File "D:\ComfyUI\execution.py", line 315, in process_inputs
result = f(**inputs)
File "D:\ComfyUI\comfy_api\internal_init.py", line 149, in wrapped_func
return method(locked_class, **inputs)
File "D:\ComfyUI\comfy_api\latest_io.py", line 2219, in EXECUTE_NORMALIZED
to_return = cls.execute(*args, **kwargs)
File "D:\ComfyUI\comfy_extras\nodes_custom_sampler.py", line 1055, in execute
samples = guider.sample(noise.generate_noise(latent), latent_image, sampler, sigmas, denoise_mask=noise_mask, callback=callback, disable_pbar=disable_pbar, seed=noise.seed)
File "D:\ComfyUI\comfy\samplers.py", line 1335, in sample
output = executor.execute(noise, latent_image, sampler, sigmas, denoise_mask, callback, disable_pbar, seed, latent_shapes=latent_shapes)
File "D:\ComfyUI\comfy\patcher_extension.py", line 113, in execute
return self.original(*args, **kwargs)
~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^
File "D:\ComfyUI\comfy\samplers.py", line 1262, in outer_sample
output = self.inner_sample(noise, latent_image, device, sampler, sigmas, denoise_mask, callback, disable_pbar, seed, latent_shapes=latent_shapes)
File "D:\ComfyUI\comfy\samplers.py", line 1237, in inner_sample
samples = executor.execute(self, sigmas, extra_args, callback, noise, latent_image, denoise_mask, disable_pbar)
File "D:\ComfyUI\comfy\patcher_extension.py", line 113, in execute
return self.original(*args, **kwargs)
~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^
File "D:\ComfyUI\comfy\samplers.py", line 1005, in sample
samples = self.sampler_function(model_k, noise, sigmas, extra_args=extra_args, callback=k_callback, disable=disable_pbar, **self.extra_options)
File "D:\ComfyUI\venv\Lib\site-packages\torch\utils_contextlib.py", line 124, in decorate_context
return func(*args, **kwargs)
File "D:\ComfyUI\custom_nodes\rapid-moss\nodes.py", line 127, in sample_dataspace
denoised = model(x_in, s * s_in, **extra_args).float() # = x_in - s * v
~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "D:\ComfyUI\comfy\samplers.py", line 640, in call
out = self.inner_model(x, sigma, model_options=model_options, seed=seed)
File "D:\ComfyUI\comfy\samplers.py", line 1208, in call
return self.outer_predict_noise(*args, **kwargs)
~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^
File "D:\ComfyUI\comfy\samplers.py", line 1215, in outer_predict_noise
).execute(x, timestep, model_options, seed)
~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "D:\ComfyUI\comfy\patcher_extension.py", line 113, in execute
return self.original(*args, **kwargs)
~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^
File "D:\ComfyUI\comfy\samplers.py", line 1218, in predict_noise
return sampling_function(self.inner_model, x, timestep, self.conds.get("negative", None), self.conds.get("positive", None), self.cfg, model_options=model_options, seed=seed)
File "D:\ComfyUI\comfy\samplers.py", line 620, in sampling_function
out = calc_cond_batch(model, conds, x, timestep, model_options)
File "D:\ComfyUI\comfy\samplers.py", line 211, in calc_cond_batch
return _calc_cond_batch_outer(model, conds, x_in, timestep, model_options)
File "D:\ComfyUI\comfy\samplers.py", line 219, in _calc_cond_batch_outer
return executor.execute(model, conds, x_in, timestep, model_options)
~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "D:\ComfyUI\comfy\patcher_extension.py", line 113, in execute
return self.original(*args, **kwargs)
~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^
File "D:\ComfyUI\comfy\samplers.py", line 335, in calc_cond_batch
output = model.apply_model(input_x, timestep, **c).chunk(batch_chunks)
~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^
File "D:\ComfyUI\comfy\model_base.py", line 212, in apply_model
return comfy.patcher_extension.WrapperExecutor.new_class_executor(
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
...<2 lines>...
comfy.patcher_extension.get_all_wrappers(comfy.patcher_extension.WrappersMP.APPLY_MODEL, transformer_options)
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
).execute(x, t, c_concat, c_crossattn, control, transformer_options, **kwargs)
~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "D:\ComfyUI\comfy\patcher_extension.py", line 113, in execute
return self.original(*args, **kwargs)
~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^
File "D:\ComfyUI\comfy\model_base.py", line 256, in _apply_model
model_output = self.diffusion_model(xc, t, context=context, control=control, transformer_options=transformer_options, **extra_conds)
File "D:\ComfyUI\venv\Lib\site-packages\torch\nn\modules\module.py", line 1778, in _wrapped_call_impl
return self._call_impl(*args, **kwargs)
~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^
File "D:\ComfyUI\venv\Lib\site-packages\torch\nn\modules\module.py", line 1789, in _call_impl
return forward_call(*args, **kwargs)
File "D:\ComfyUI\comfy\ldm\moss_image\model.py", line 151, in forward
return comfy.patcher_extension.WrapperExecutor.new_class_executor(
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
...<2 lines>...
comfy.patcher_extension.get_all_wrappers(comfy.patcher_extension.WrappersMP.DIFFUSION_MODEL, transformer_options)
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
).execute(x, timestep, context, transformer_options, **kwargs)
~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "D:\ComfyUI\comfy\patcher_extension.py", line 113, in execute
return self.original(*args, **kwargs)
~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^
File "D:\ComfyUI\comfy\ldm\moss_image\model.py", line 178, in _forward
comfy.model_prefetch.prefetch_queue_pop(prefetch_queue, device, block, dtype, malloc_scope="block")
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "D:\ComfyUI\comfy\model_prefetch.py", line 211, in prefetch_queue_pop
if malloc_graph.iterate(malloc_scope if module is not None and not graph_hit else None):
~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "D:\ComfyUI\venv\Lib\site-packages\comfy_aimdo\malloc_graph.py", line 58, in iterate
broken = self.pop()
File "D:\ComfyUI\venv\Lib\site-packages\comfy_aimdo\malloc_graph.py", line 25, in pop
broken = self._call(control.lib.malloc_graph_pop) == 2
~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "D:\ComfyUI\venv\Lib\site-packages\comfy_aimdo\malloc_graph.py", line 16, in _call
raise RuntimeError("aimdo memory compile error")
RuntimeError: aimdo memory compile error
yes,same error