Add an encoder¶
For a new encoder that reads an existing family. Encoder folders live in perception/encoders/ and are built into images; they are not part of the installed package.
Before you start¶
- The encoder reads one existing family. Its code, weights and test data have licenses that allow you to package them.
- Test data for the family: synthetic or openly licensed, with a provenance note.
Steps¶
-
Create the encoder folder:
medomni perception new <family>/<encoder>It writes:
perception/encoders/<family>/<encoder>/ ├── adapter.py ├── card.yaml ├── Dockerfile ├── assets.json └── testdata/ empty, filled in step 4 -
Implement the adapter and pin the image:
encode(sample, options)inadapter.py, with expensive set-up inload()- base image, dependencies and source revision pinned in the Dockerfile
- torch, if the encoder needs it, installed with
torch==<version>from the CPU build index, at a version listed insrc/medomni/perception/registry/torch.yaml - weights and other files in
assets.json, each with its source (a URL or a Hugging Face file) and sha256; the image build fetches and checks them
- Write the model card: the family, outputs, options, license and source. See Encoders.
-
Write the test data, its inputs and
PROVENANCE.md:medomni studio testdata <family>__<encoder> -
Record the expected responses on the test data, and open a pull request.
medomni perception check perception/encoders/<family>/<encoder> --freeze
Check¶
medomni perception check perception/encoders/<family>/<encoder>
It validates the model card with medomni contracts check, checks the Dockerfile's torch installs against the list, builds the image, checks the torch inside it is a listed CPU build, and runs the encoder's tests: it runs the image on the test data and compares the responses with expected.json. See Check and freeze. GPU encoders may run on a self-hosted runner.
Submit it as a pull request, or ship it in your own plug-in package. Contribute covers both.
Where next¶
- Contribute: pull requests, plug-in packages and how MedOmni is developed.
- Encoders: how an encoder is checked, recorded and served.
- Encoders reference: the model card fields.