ImageToTextTransformers
Python template · sinapsis_huggingface_transformers.templates.image_to_text_transformers
Overview
ImageToTextTransformers template to generate text from an image.
This template uses a Hugging Face Transformers pipeline to generate textual descriptions from input images.
Capabilities
Capabilities: not setInstallation
Install the published package using pip or uv.
pip install sinapsis-huggingface-transformers==1.0.0uv pip install sinapsis-huggingface-transformers==1.0.0uv add sinapsis-huggingface-transformers==1.0.0Configuration
Effective fields from the inspector schema, including nested Pydantic model fields.
Optional
Default: null
Optional
Default: null
Optional
Default: "microsoft/trocr-base-handwritten"
Optional
Default: "float16"
Optional
Default: "/home/ariel/.cache/sinapsis"
Optional
Default: null
Required
Default: null
Optional
Default: "float16"
Task-specific parameters for the image-to-text pipeline, such as `max_new_tokens`.
Optional
Default: null
The maximum time in seconds to wait for fetching images from the web.
Optional
Default: null
The maximum number of tokens to generate in the description.
Optional
Default: null
Optional
Default: null
Configuration example
Example from the Python docstring:
agent:
name: my_test_agent
templates:
- template_name: InputTemplate
class_name: InputTemplate
attributes: {}
- template_name: ImageToTextTransformers
class_name: ImageToTextTransformers
template_input: InputTemplate
attributes:
model_path: '/path/to/model'
model_cache_dir: /path/to/cache/dir
device: 'cuda'
torch_dtype: float16Show schema-based configuration skeleton
templates:
- template_name: "ImageToTextTransformers"
class_name: "ImageToTextTransformers"
attributes:
seed: null
model_path: "microsoft/trocr-base-handwritten"
torch_dtype: "float16"
model_cache_dir: "/home/ariel/.cache/sinapsis"
pipeline_kwargs:
device: "<required>"
torch_dtype: "float16"
inference_kwargs:
timeout: null
max_new_tokens: null
generate_kwargs: null
Inheritance
sinapsis_huggingface_transformers.templates.base_transformers.TransformersBaseEnvironment variables
Environment definitions belong to their canonical Python modules.
No directly related environment variables listed.