MCPcopy
hub / github.com/kohya-ss/sd-scripts / _preprocess_text_embeds

Method _preprocess_text_embeds

library/anima_models.py:1377–1390  ·  view source on GitHub ↗
(
        self, source_hidden_states, target_input_ids, target_attention_mask=None, source_attention_mask=None
    )

Source from the content-addressed store, hash-verified

1375 return self.forward_mini_train_dit(x, timesteps, context, fps=fps, padding_mask=padding_mask, **kwargs)
1376
1377 def _preprocess_text_embeds(
1378 self, source_hidden_states, target_input_ids, target_attention_mask=None, source_attention_mask=None
1379 ):
1380 if target_input_ids is not None:
1381 context = self.llm_adapter(
1382 source_hidden_states,
1383 target_input_ids,
1384 target_attention_mask=target_attention_mask,
1385 source_attention_mask=source_attention_mask,
1386 )
1387 context[~target_attention_mask.bool()] = 0 # zero out padding tokens
1388 return context
1389 else:
1390 return source_hidden_states
1391
1392
1393# LLM Adapter: Bridges Qwen3 embeddings to T5-compatible space

Callers 2

forwardMethod · 0.95
prepare_text_inputsFunction · 0.80

Calls

no outgoing calls

Tested by

no test coverage detected