System packages
Deploy a model with both Python and system dependencies
Some Python dependencies require system-level packages to function. Truss allows you to specify APT-installable Debian packages in config.yaml
.
Adding System Packages
Specify system dependencies under system_packages
:
Example: LayoutLM Document QA
LayoutLM Document QA is a model that requires tesseract-ocr
for text recognition. Below is a minimal setup for deploying it with Truss.
1. Initialize Truss
2. Implement the Model Class
Define the model in model/model.py:
3. Set Dependencies
Add Python and system dependencies in config.yaml
:
TIP: Always pin exact package versions to avoid breaking changes.
4. Configure Model Resources
One of the Python dependencies, pytesseract
, also requires a system package to operate.
Adding system packages works just like adding Python requirements. You can specify any package that’s available via apt
on Debian.
5. Deploy and Invoke
You’ll need a Baseten API key for this step.
We have successfully packaged LayoutLM Document QA as a Truss. Let’s deploy!
Was this page helpful?