Skip to contents

Per-step scoring is delegated to morie_geron_dalle_autoregressive_token; this wrapper runs the generation loop and reshapes into the token grid.

Usage

morie_geron_dalle(
  text,
  model,
  n_image_tokens = 4,
  temperature = 1,
  top_k = NULL,
  image_vocab = NULL,
  grid = NULL
)

Arguments

text

Prompt token ids.

model

function(context) -> logits.

n_image_tokens

int (>=1).

temperature, top_k

Sampling knobs.

image_vocab

Codebook size (default model width).

grid

c(h,w).

Value

List with image_tokens, token_grid, log_likelihood, perplexity, n_steps.

Examples

skewed <- function(ctx) c(0, 5)
morie_geron_dalle(0, skewed, n_image_tokens = 4)
#> $image_tokens
#> [1] 1 1 1 1
#> 
#> $token_grid
#>      [,1] [,2]
#> [1,]    1    1
#> [2,]    1    1
#> 
#> $log_likelihood
#> [1] -0.02686139
#> 
#> $token_logprobs
#> [1] -0.006715348 -0.006715348 -0.006715348 -0.006715348
#> 
#> $perplexity
#> [1] 1.006738
#> 
#> $context
#> [1] 0 1 1 1 1
#> 
#> $prompt
#> [1] 0
#> 
#> $n_steps
#> [1] 4
#> 
#> $vocab_size
#> [1] 2
#> 
#> $grid
#> [1] 2 2
#> 
#> $temperature
#> [1] 1
#> 
#> $estimate
#> [1] -0.02686139
#> 
#> $n
#> [1] 4
#> 
#> $method
#> [1] "autoregressive image-token generation; per-step scoring delegated to grdal"
#>