CLIPTokenizer

Tokenize a prompt

Description

Tokenize a prompt

Usage

CLIPTokenizer(prompt,
              merges = system.file("tokenizer/merges.txt", package = "diffuseR"),
              vocab_file = system.file("tokenizer/vocab.json", package = "diffuseR"),
              pad_token = 0L)

Arguments

  • prompt: A character string prompt describing the image to generate.
  • merges: Path to the merges file (BPE merges).
  • vocab_file: Path to the vocabulary file (token->id mapping).
  • pad_token: The token ID used for padding (default is 0).

Value

A 2D torch tensor of shape c(1, 77) containing the token IDs.