
LLaVA visual instruction assembly (Kamath Ch 9)
Source:R/kamath_llm2_native.R
morie_kamath_llava_visual_instruction.Rd[W ViT(image); text] soft tokens; with lm_head and targets the causal
cross entropy is added. targets are 0-BASED with -100 ignored.
Usage
morie_kamath_llava_visual_instruction(
image,
W,
visual_encoder,
text_tokens,
lm_head = NULL,
targets = NULL,
ignore_index = -100L
)Examples
morie_kamath_llava_visual_instruction("im", diag(2), function(i) matrix(c(1,
2), 1), matrix(c(3, 4), 1))
#> $visual_tokens
#> [,1] [,2]
#> [1,] 1 2
#>
#> $inputs
#> [,1] [,2]
#> [1,] 1 2
#> [2,] 3 4
#>
#> $n_visual
#> [1] 1
#>
#> $n_text
#> [1] 1
#>
#> $d_model
#> [1] 2
#>
#> $estimate
#> [1] 1
#>
#> $n
#> [1] 2
#>
#> $method
#> [1] "LLaVA visual instruction assembly"
#>