Class MultiModalProcessor
java.lang.Object
smile.onnx.genai.MultiModalProcessor
- All Implemented Interfaces:
AutoCloseable
Converts text / images / audios into
NamedTensors for multimodal models.-
Method Summary
Modifier and TypeMethodDescriptionvoidclose()Creates a tokenizer stream from this processor.decode(int[] tokens) Decodes token ids using the processor's tokenizer.static MultiModalProcessorCreates a processor for the given model.processAudios(String prompt, Audios audios) Processes a prompt and optional audios into model inputs.processImages(String prompt, Images images) Processes a prompt and optional images into model inputs.processImagesAndAudios(String prompt, Images images, Audios audios) Processes a prompt with optional images and audios.
-
Method Details
-
of
Creates a processor for the given model.- Parameters:
model- multimodal GenAI model.- Returns:
- processor owned by the caller.
-
processImages
Processes a prompt and optional images into model inputs.- Parameters:
prompt- text prompt.images- images, ornull.- Returns:
- named tensors owned by the caller.
-
processAudios
Processes a prompt and optional audios into model inputs.- Parameters:
prompt- text prompt.audios- audios, ornull.- Returns:
- named tensors owned by the caller.
-
processImagesAndAudios
Processes a prompt with optional images and audios.- Parameters:
prompt- text prompt.images- images, ornull.audios- audios, ornull.- Returns:
- named tensors owned by the caller.
-
decode
Decodes token ids using the processor's tokenizer.- Parameters:
tokens- token ids.- Returns:
- decoded text.
-
createStream
Creates a tokenizer stream from this processor.- Returns:
- stream owned by the caller.
-
close
public void close()- Specified by:
closein interfaceAutoCloseable
-