{"record":{"id":"f5d0431896562f52","repo":"invoke-ai/InvokeAI","slug":"self-class-has-the-config-param-addition-em-f5d043","errorCode":null,"errorMessage":"{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`","messagePattern":"(.+?) 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`","errorType":"validation","errorClass":"ValueError","httpStatus":null,"severity":"error","filePath":"invokeai/backend/hidiffusion/hidiffusion.py","lineNumber":1088,"sourceCode":"                else:\n                    emb = emb + class_emb\n\n            if self.config.addition_embed_type == \"text\":\n                aug_emb = self.add_embedding(encoder_hidden_states)\n            elif self.config.addition_embed_type == \"text_image\":\n                # Kandinsky 2.1 - style\n                if \"image_embeds\" not in added_cond_kwargs:\n                    raise ValueError(\n                        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`\"\n                    )\n\n                image_embs = added_cond_kwargs.get(\"image_embeds\")\n                text_embs = added_cond_kwargs.get(\"text_embeds\", encoder_hidden_states)\n                aug_emb = self.add_embedding(text_embs, image_embs)\n            elif self.config.addition_embed_type == \"text_time\":\n                # SDXL - style\n                if \"text_embeds\" not in added_cond_kwargs:\n                    raise ValueError(\n                        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`\"\n                    )\n                text_embeds = added_cond_kwargs.get(\"text_embeds\")\n                if \"time_ids\" not in added_cond_kwargs:\n                    raise ValueError(\n                        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`\"\n                    )\n                time_ids = added_cond_kwargs.get(\"time_ids\")\n                time_embeds = self.add_time_proj(time_ids.flatten())\n                time_embeds = time_embeds.reshape((text_embeds.shape[0], -1))\n                add_embeds = torch.concat([text_embeds, time_embeds], dim=-1)\n                add_embeds = add_embeds.to(emb.dtype)\n                aug_emb = self.add_embedding(add_embeds)\n            elif self.config.addition_embed_type == \"image\":\n                # Kandinsky 2.2 - style\n                if \"image_embeds\" not in added_cond_kwargs:\n                    raise ValueError(\n                        f\"{self.__class__} has the config param `addition_embed_type` set to 'image' which requires the keyword argument `image_embeds` to be passed in `added_cond_kwargs`\"","sourceCodeStart":1070,"sourceCodeEnd":1106,"githubUrl":"https://github.com/invoke-ai/InvokeAI/blob/0b6a024f2ff6a86bfb953dcdb9cc504ef7397a06/invokeai/backend/hidiffusion/hidiffusion.py#L1070-L1106","documentation":"The UNet config sets `addition_embed_type='text_time'` (SDXL-style extra conditioning), so forward requires `added_cond_kwargs['text_embeds']` (pooled text embeddings) to build the augmentation embedding. The model raises when this key is missing rather than continuing with incomplete SDXL conditioning.","triggerScenarios":"Calling forward on an SDXL UNet (`addition_embed_type='text_time'`) without `added_cond_kwargs={'text_embeds': ..., 'time_ids': ...}`, or with only `time_ids` supplied.","commonSituations":"Porting an SD 1.5 sampling loop to SDXL without adding the extra conditioning; calling `unet.forward` directly in a custom scheduler loop; using a refiner/base SDXL pipeline that drops `added_cond_kwargs` during denormalized timesteps.","solutions":["Pass `added_cond_kwargs={'text_embeds': pooled_prompt_embeds, 'time_ids': add_time_ids}` to the UNet call","Compute pooled embeddings via the SDXL text encoder's `text_encoder_2(...).pooler_output` and build `add_time_ids` from original/resolution/target sizes","If SDXL conditioning is undesired, reload the UNet with a non-`text_time` `addition_embed_type`"],"exampleFix":"// before\nnoise_pred = unet(sample, t, encoder_hidden_states=prompt_emb)\n// after\nnoise_pred = unet(sample, t, encoder_hidden_states=prompt_emb,\n                  added_cond_kwargs={'text_embeds': pooled_prompt_embeds,\n                                     'time_ids': add_time_ids})","handlingStrategy":"validation","validationCode":"if getattr(unet.config, 'addition_embed_type', None) == 'text_time' and not (added_cond_kwargs and 'text_embeds' in added_cond_kwargs):\n    raise ValueError(\"SDXL UNet requires added_cond_kwargs with 'text_embeds' (and 'time_ids')\")","typeGuard":"def has_text_embeds(added_cond_kwargs) -> bool:\n    return isinstance(added_cond_kwargs, dict) and 'text_embeds' in added_cond_kwargs","tryCatchPattern":"try:\n    out = unet(sample, t, emb, added_cond_kwargs=ackw)\nexcept ValueError as e:\n    if 'text_embeds' in str(e):\n        ackw['text_embeds'] = pooled_prompt_embeds; out = unet(sample, t, emb, added_cond_kwargs=ackw)\n    else: raise","preventionTips":["Always build SDXL kwargs: {'text_embeds': pooled, 'time_ids': add_time_ids}","Reuse pipeline internals (`_get_add_time_ids`) instead of hand-rolling","Test SDXL paths once with a tiny scheduler loop before production"],"tags":["diffusers","unet","sdxl","missing-argument","conditioning"],"backgroundTag":"missing-required-argument","analyzedSha":"0b6a024f2ff6a86bfb953dcdb9cc504ef7397a06","analyzedAt":"2026-08-29T04:46:49.967Z","schemaVersion":2},"datasetVersion":"2026-08-29T07:17:48.351Z"}