invoke-ai/InvokeAI · error · ValueError
{self.__class__} has the config param `addition_embed_type`
Error message
{self.__class__} has the config param `addition_embed_type` set to 'text_image' which requires the keyword argument `image_embeds` to be passed in `added_cond_kwargs` What it means
The UNet config sets `addition_embed_type='text_image'` (Kandinsky 2.1 style extra conditioning), so `forward()` requires `added_cond_kwargs={'image_embeds': ...}` to build the augmentation embedding from text+image embeddings. When `image_embeds` is absent from `added_cond_kwargs`, the model raises instead of silently producing wrong conditioning.
Source
Thrown at invokeai/backend/hidiffusion/hidiffusion.py:1078
class_labels = self.time_proj(class_labels)
# `Timesteps` does not contain any weights and will always return f32 tensors
# there might be better ways to encapsulate this.
class_labels = class_labels.to(dtype=sample.dtype)
class_emb = self.class_embedding(class_labels).to(dtype=sample.dtype)
if self.config.class_embeddings_concat:
emb = torch.cat([emb, class_emb], dim=-1)
else:
emb = emb + class_emb
if self.config.addition_embed_type == "text":
aug_emb = self.add_embedding(encoder_hidden_states)
elif self.config.addition_embed_type == "text_image":
# Kandinsky 2.1 - style
if "image_embeds" not in added_cond_kwargs:
raise ValueError(
f"{self.__class__} has the config param `addition_embed_type` set to 'text_image' which requires the keyword argument `image_embeds` to be passed in `added_cond_kwargs`"
)
image_embs = added_cond_kwargs.get("image_embeds")
text_embs = added_cond_kwargs.get("text_embeds", encoder_hidden_states)
aug_emb = self.add_embedding(text_embs, image_embs)
elif self.config.addition_embed_type == "text_time":
# SDXL - style
if "text_embeds" not in added_cond_kwargs:
raise ValueError(
f"{self.__class__} has the config param `addition_embed_type` set to 'text_time' which requires the keyword argument `text_embeds` to be passed in `added_cond_kwargs`"
)
text_embeds = added_cond_kwargs.get("text_embeds")
if "time_ids" not in added_cond_kwargs:
raise ValueError(
f"{self.__class__} has the config param `addition_embed_type` set to 'text_time' which requires the keyword argument `time_ids` to be passed in `added_cond_kwargs`"
)
time_ids = added_cond_kwargs.get("time_ids")View on GitHub (pinned to 0b6a024f2f)
Solutions
- Pass `added_cond_kwargs={'image_embeds': image_embeds}` to the UNet forward call
- Pass `text_embeds` too if the text embeddings differ from `encoder_hidden_states` (optional; it defaults to encoder_hidden_states)
- If the checkpoint is not Kandinsky-style, load a UNet with `addition_embed_type=None`
Example fix
// before
noise_pred = unet(sample, t, encoder_hidden_states=text_emb)
// after
noise_pred = unet(sample, t, encoder_hidden_states=text_emb,
added_cond_kwargs={'image_embeds': image_embeds}) Defensive patterns
Strategy: validation
Validate before calling
if getattr(unet.config, 'addition_embed_type', None) == 'text_image' and not (added_cond_kwargs and 'image_embeds' in added_cond_kwargs):
raise ValueError("text_image UNet requires added_cond_kwargs={'image_embeds': ...}") Type guard
def has_image_embeds(added_cond_kwargs) -> bool:
return isinstance(added_cond_kwargs, dict) and 'image_embeds' in added_cond_kwargs Try / catch
try:
out = unet(sample, t, emb, added_cond_kwargs=ackw)
except ValueError as e:
if 'image_embeds' in str(e):
ackw = {'image_embeds': image_embeds}; out = unet(sample, t, emb, added_cond_kwargs=ackw)
else: raise Prevention
- Inspect `unet.config.addition_embed_type` after loading any checkpoint
- Branch your forward-call helper on addition_embed_type to assemble kwargs
- Use official Kandinsky 2.1 pipelines rather than hand-rolled loops
When it happens
Trigger: Calling forward on a UNet whose `config.addition_embed_type == 'text_image'` (Kandinsky 2.1) without passing `added_cond_kwargs` or passing a dict that lacks the `image_embeds` key.
Common situations: Loading a Kandinsky 2.1 checkpoint and calling the UNet directly with only sample/timestep/text embeddings; adapting an SD pipeline loop to Kandinsky without adding the extra kwargs; copying UNet forward calls between models with different `addition_embed_type` configs.
Understand the failure class
Background: "missing required argument" and "the following required arguments were not provided": what required-argument errors mean and how to fix them — this error's family across 20 libraries.
Related errors
- {self.__class__} has the config param `addition_embed_type`
- {self.__class__} has the config param `encoder_hid_dim_type`
- class_labels should be provided when num_class_embeds > 0
- {self.__class__} has the config param `addition_embed_type`
- {self.__class__} has the config param `addition_embed_type`
AI-assisted analysis of invoke-ai/InvokeAI@0b6a024f2f (2026-08-29).
Data as JSON: /api/errors/ebb5739e172f3459.
Report an issue: GitHub.