prismatic
prismatic
¶
Prismatic VLM component for VLA decoders.
PrismaticVLM
¶
PrismaticVLM(input_keys, pretrained, frozen, model_name=value, repository_id=PRISMATIC_REPOSITORY_ID, attention_type=value, model_dtype=None, max_text_length=None, lora_config=None, gradient_checkpointing=False)
Bases: GenerativeVLM
Raw Prismatic VLM checkpoint loader for interleaved VLA decoders.
Load or initialize a raw Prismatic VLM.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
input_keys
|
str | list[str]
|
RGB camera keys consumed by the VLM. |
required |
pretrained
|
bool
|
Whether to load the raw Prismatic checkpoint. |
required |
frozen
|
bool
|
Whether to freeze all model weights. |
required |
model_name
|
str
|
Prismatic checkpoint folder name, or a local checkpoint
directory containing |
value
|
repository_id
|
str
|
HuggingFace repository containing raw Prismatic checkpoint folders. |
PRISMATIC_REPOSITORY_ID
|
attention_type
|
str
|
HuggingFace attention implementation for the language model. |
value
|
model_dtype
|
str | None
|
Optional precision string for model parameter dtype. |
None
|
max_text_length
|
int | None
|
Optional text sequence length. Defaults to the
raw Prismatic |
None
|
lora_config
|
LoRAAdaptation | None
|
Optional LoRA adapter configuration for the language model. |
None
|
gradient_checkpointing
|
bool
|
Whether to enable activation checkpointing in the language model during training. |
False
|
Source code in src/versatil/models/decoding/generative_language_models/vision_language/prismatic.py
55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 | |
get_vocab_size
¶
resize_token_embeddings
¶
Resize the Prismatic causal language-model token embeddings and output head.
Source code in src/versatil/models/decoding/generative_language_models/vision_language/prismatic.py
forward_language_model
¶
forward_language_model(input_ids=None, inputs_embeds=None, attention_mask=None, past_key_values=None, use_cache=False, cache_position=None, position_ids=None, output_hidden_states=True)
Run the Prismatic language model over token IDs or embeddings.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
input_ids
|
Tensor | None
|
Optional token IDs with shape |
None
|
inputs_embeds
|
Tensor | None
|
Optional token embeddings with shape |
None
|
attention_mask
|
Tensor | None
|
Optional language-model attention mask. |
None
|
past_key_values
|
Cache | tuple[tuple[Tensor, ...], ...] | None
|
Optional cached key/value tensors. |
None
|
use_cache
|
bool
|
Whether to return/update cached key/value tensors. |
False
|
cache_position
|
Tensor | None
|
Optional HuggingFace KV-cache slots for the tokens
in this call. During cached decoding, if the prefix has length
|
None
|
position_ids
|
Tensor | None
|
Optional positions for the language model positional
encoding, with shape |
None
|
output_hidden_states
|
bool
|
Whether to return hidden states. |
True
|
Returns:
| Type | Description |
|---|---|
CausalLanguageModelOutput
|
Causal language-model output with logits shape |