Update example to cover some common issues
This commit is contained in:
@@ -330,6 +330,15 @@ class ExampleModel(BaseModel):
|
||||
batch max is deferred to get_noise_prediction / the pipeline,
|
||||
which keeps caches small and lets any prompts share a batch.
|
||||
|
||||
Each per-prompt tensor MUST be 2D ``(L, D)`` -- BaseModel infers the
|
||||
text batch size from the list and only treats it as one-per-prompt
|
||||
when the tensors are 2D; a 3D per-prompt tensor is misread as an
|
||||
already-batched ``(B, L, D)`` and training fails with a latents-vs-
|
||||
text batch-size mismatch. If your conditioning has an extra axis
|
||||
(e.g. N stacked encoder layers -> ``(L, N, D)``), flatten it here
|
||||
(``(L, N*D)``) and restore it (``reshape(B, Lt, N, D)``) at the
|
||||
model call.
|
||||
|
||||
You can store any number of keys (pooled embeds, image features,
|
||||
...). If a key must keep its dtype when everything else is cast
|
||||
(masks, token ids), list it in ``embeds.frozen_dtype_keys``.
|
||||
|
||||
Reference in New Issue
Block a user