encode_with_t5

Encode prompts with the T5 encoder

Description

Tokenizes with encode_unigram (right padding to max_sequence_length) and runs the encoder. Matching the FLUX reference pipeline, no attention mask is used.

Usage

encode_with_t5(prompts, model, tokenizer, max_sequence_length = 256L,
               device = NULL)

Arguments

  • prompts: Character vector.
  • model: A t5_encoder.
  • tokenizer: A unigram_tokenizer.
  • max_sequence_length: Integer. Fixed token length (schnell: 256).
  • device: Device for the input ids (defaults to the model’s).

Value

Tensor [length(prompts), max_sequence_length, d_model].