//clika-runtime/io.clika.runtime/Processor
Processor
[common]
class Processor
A model directory's preprocessors as one composite: the tokenizer and the one media processor (image, audio or video) its files describe; a missing piece leaves its slot empty rather than failing the load. Each accessor hands out a standalone handle sharing the composite's instance, valid after the composite is closed; an empty slot fails with NOT_FOUND, so check the has properties first. AutoCloseable.
Processor.fromHuggingface("/path/to/model").use { composite ->
val tokenizer = composite.tokenizer()
if (composite.hasImageProcessor) composite.imageProcessor().use { /* ... */}
}
Types
| Name | Summary |
|---|---|
| Companion | [common] object Companion |
Properties
| Name | Summary |
|---|---|
| hasAudioProcessor | [common] val hasAudioProcessor: Boolean True when an audio processor is present. |
| hasImageProcessor | [common] val hasImageProcessor: Boolean True when an image processor is present. |
| hasTokenizer | [common] val hasTokenizer: Boolean True when the model directory shipped a tokenizer. |
| hasVideoProcessor | [common] val hasVideoProcessor: Boolean True when a video processor is present. |
Functions
| Name | Summary |
|---|---|
| audioProcessor | [common] fun audioProcessor(): AudioProcessor The audio processor; fails with NOT_FOUND when the slot is empty. |
| close | [common] open fun close() |
| imageProcessor | [common] fun imageProcessor(): ImageProcessor The image processor; fails with NOT_FOUND when the slot is empty. |
| tokenizer | [common] fun tokenizer(): Tokenizer The tokenizer the model directory shipped, with the special ids its configuration names. |
| videoProcessor | [common] fun videoProcessor(): VideoProcessor The video processor; fails with NOT_FOUND when the slot is empty. |