Vllm.Multimodal.Inputs.MultiModalFieldConfig (VLLM v0.3.0)

Copy Markdown View Source

MultiModalFieldConfig(field: vllm.multimodal.inputs.BaseMultiModalField, modality: str)

Summary

Functions

Defines a field where an element in the batch is obtained by

Python method MultiModalFieldConfig.build_elems.

Defines a field where an element in the batch is obtained by

Defines a field where an element in the batch is obtained by

Initialize self. See help(type(self)) for accurate signature.

Defines a field where an element in the batch is obtained by

Types

t()

@opaque t()

Functions

batched(ref, modality, opts \\ [])

@spec batched(SnakeBridge.Ref.t(), String.t(), keyword()) ::
  {:ok, term()} | {:error, Snakepit.Error.t()}

Defines a field where an element in the batch is obtained by

indexing into the first dimension of the underlying data.

Parameters

  • modality - The modality of the multi-modal item that uses this keyword argument.
  • keep_on_cpu - Whether to keep this field on the CPU for the model inputs.

Returns

  • term()

build_elems(ref, key, batch, opts \\ [])

@spec build_elems(
  SnakeBridge.Ref.t(),
  String.t(),
  (([(([term()] | [term()]) | term()) | {term(), term()}] | [term()]) | term())
  | {term(), term()},
  keyword()
) :: {:ok, term()} | {:error, Snakepit.Error.t()}

Python method MultiModalFieldConfig.build_elems.

Parameters

  • key (String.t())
  • batch (((list(((list(term()) | list(term())) | term()) | {term(), term()}) | list(term())) | term()) | {term(), term()})

Returns

  • term()

flat(ref, modality, slices, args, opts \\ [])

@spec flat(SnakeBridge.Ref.t(), String.t(), term(), [term()], keyword()) ::
  {:ok, term()} | {:error, Snakepit.Error.t()}

Defines a field where an element in the batch is obtained by

slicing along the first dimension of the underlying data.

Parameters

  • modality - The modality of the multi-modal item that uses this keyword argument.
  • slices - For each multi-modal item, a slice (dim=0) or a tuple of slices (dim>0) that is used to extract the data corresponding to it.
  • dim - The dimension to extract data, default to 0.
  • keep_on_cpu - Whether to keep this field on the CPU for the model inputs.

Returns

  • term()

flat_from_sizes(ref, modality, size_per_item, args, opts \\ [])

@spec flat_from_sizes(SnakeBridge.Ref.t(), String.t(), term(), [term()], keyword()) ::
  {:ok, term()} | {:error, Snakepit.Error.t()}

Defines a field where an element in the batch is obtained by

slicing along the first dimension of the underlying data.

Parameters

  • modality - The modality of the multi-modal item that uses this keyword argument.
  • size_per_item - For each multi-modal item, the size of the slice that is used to extract the data corresponding to it.
  • dim - The dimension to slice, default to 0.
  • keep_on_cpu - Whether to keep this field on the CPU for the model inputs.

Returns

  • term()

new(field, modality, opts \\ [])

@spec new(term(), String.t(), keyword()) ::
  {:ok, SnakeBridge.Ref.t()} | {:error, Snakepit.Error.t()}

Initialize self. See help(type(self)) for accurate signature.

Parameters

  • field (term())
  • modality (String.t())

shared(ref, modality, batch_size, opts \\ [])

@spec shared(SnakeBridge.Ref.t(), String.t(), integer(), keyword()) ::
  {:ok, term()} | {:error, Snakepit.Error.t()}

Defines a field where an element in the batch is obtained by

taking the entirety of the underlying data.

This means that the data is the same for each element in the batch.

Parameters

  • modality - The modality of the multi-modal item that uses this keyword argument.
  • batch_size - The number of multi-modal items which share this data.
  • keep_on_cpu - Whether to keep this field on the CPU for the model inputs.

Returns

  • term()