Skip to content
data

T5ModelOutput

extendsModelOutput
T5ModelOutput(last_hidden_state: Tensor, encoder_last_hidden_state: Tensor)

Output of the bare T5 trunk (no language-modelling head).

Attributes

last_hidden_stateTensor
Decoder output after the final norm, (B, T_dec, d_model).
encoder_last_hidden_stateTensor
Encoder output after the final norm, (B, T_src, d_model) — what every decoder block cross-attends to.

Examples

>>> import lucid
>>> from lucid.models.text.t5._model import T5ModelOutput
>>> out = T5ModelOutput(
...     last_hidden_state=lucid.zeros(2, 7, 512),
...     encoder_last_hidden_state=lucid.zeros(2, 20, 512),
... )
>>> out.last_hidden_state.shape, out.encoder_last_hidden_state.shape
((2, 7, 512), (2, 20, 512))
These are activations of width d_model; T5ForSeq2SeqLM
is the model that turns the decoder side into vocabulary logits.

Used by 1