Model with system packages
Deploy a model with both Python and system dependencies
View on Github
In this example, we build a Truss with a model that requires specific system packages.
To add system packages to your Truss, you can add a system_packages
key to your config.yaml file,
for instance:
To add system packages to your model serving environment, open config.yaml and
update the system_packages key with a list of apt-installable Debian packages:
For this example, we use the LayoutLM Document QA model, a multimodal model that answers questions about provided invoice documents. This model requires a system package, tesseract-ocr, which needs to be included in the model serving environment.
Setting up the model.py
For this model, we use the HuggingFace transformers library, and the document-question-answering task.
Setting up the config.yaml file
The main items that need to be configured in the config.yaml file are requirements
and system_packages
sections.
Specify the versions of the Python requirements that are needed.
The system_packages section is the other important bit here, you can
add any package thatβs available via apt
on Debian.
Deploy the model
You can then invoke the model with: