Cotorra: a configurable trainer
🦜 the wild parakeet of Chicago's south side
About
This repo provides a configurable trainer for generative event models on tokenized timelines. It also supports three types of downstream inference on held-out data: (i) representation-based, (ii) generative, and (iii) inference via supervised training heads. Cotorra is a Spanish term for a small-to-medium sized parrot, particularly the Monk parakeet. Monk parakeets were introduced to the south side of Chicago, where they have flourished. 1 The library benefits from previous experience training foundation models on tokenized electronic health records. 2 3 4 5 6
Installation
Install the latest release from PyPI:
pip install "cotorra" \
--index-url https://download.pytorch.org/whl/cu128 \
--extra-index-url https://pypi.org/simple
This installs the cotorra command. To see it run end to end on public data,
follow the
MIMIC-IV demo.
cotorra generative-score also needs SGLang, which the gen extra installs
(pip install "cotorra[gen]>=26.11.1") on Linux with an NVIDIA GPU and Python
3.11 or 3.12, or 3.13 once a Rust compiler and a few build tools are in place;
see the MIMIC-IV demo's
generative step.
Usage
Each stage of the pipeline is a cotorra command, driven by a YAML config:
train / tune → extract → rep-based-score
↘ generative-score
baseline-score (transformer-free)
The documentation covers:
- Inputs: the tokenized timelines and tables the commands read, as cocoa writes them.
cotorra train/cotorra tune: fits a model. How records are packed into rows and the secondary heads, if any, trained alongside next-token prediction are customizable.cotorra extract: extracts hidden-state representations and head predictions from a trained model.cotorra rep-based-score/cotorra generative-score: scores outcomes on held-out data, from an estimator fit on extracted features or from sampled trajectories. A supervised head can score them too, andcotorra baseline-scorescores them with baselines that need no model, for comparison.- Configuration: the YAML config each command reads, and how to change its keys on the command line.
- The CLI reference, with every command's options, and the recipes, worked examples from a run on public data to transfer learning.
Contributing
Bug reports, fixes, recipes, and new features are all welcome. The contributing guide explains how to report an issue, set up a development install, and open a pull request.
-
L. Gersony, "The Quiet Victory of Chicago’s Monk Parakeets," The Chicago Maroon, 23 January 2022, https://chicagomaroon.com/28830/grey-city/quiet-protest-chicagos-monk-parakeets/ ↩
-
M. Burkhart, B. Ramadan, Z. Liao, K. Chhikara, J. Rojas, W. Parker, & B. Beaulieu-Jones, Foundation models for electronic health records: representation dynamics and transferability, arXiv:2504.10422 ↩
-
M. Burkhart, B. Ramadan, L. Solo, W. Parker, & B. Beaulieu-Jones, Quantifying surprise in clinical care: Detecting highly informative events in electronic health records with foundation models, Pacific Symposium on Biocomputing 31 (2026), 173–188 ↩
-
L. Solo, M. McDermott, W. Parker, B. Ramadan, M. Burkhart, & B. Beaulieu-Jones, Efficient generative prediction for EHR foundation models: the SCOPE and REACH estimators, arXiv:2602.03730 ↩
-
I. Lee, L. Solo, M. Burkhart, B. Ramadan, W. Parker, & B. Beaulieu-Jones, Representation before training: a fixed-budget benchmark for generative medical event models, arXiv:2604.16775, to appear in ML4H 2026 ↩
-
M. Burkhart, L. Solo, I. Lee, S. Charles, Z. Liao, K. Chhikara, D. Therese, W.-T. Liao, C. Gao, W. Parker, & B. Beaulieu-Jones, Federated generative event models for tokenized electronic health records, arXiv:2608.02939 ↩
Metadata
Release files for cotorra 26.11.2
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| cotorra-26.11.2.tar.gz | 205.4 kB | With provenance | Details for cotorra-26.11.2.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| cotorra-26.11.2-py3-none-any.whl | Python 3 | none | any | Details for cotorra-26.11.2-py3-none-any.whl |
Total release size: 284.4 kB
Release files / cotorra-26.11.2.tar.gz
| Download URL | cotorra-26.11.2.tar.gz |
|---|---|
| Size | 205.4 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
bb7013091eb0a304997f6280cc1bc7365698ed6e186e282074538098dde2c509
|
|
BLAKE2b-256 checksum How to use checksums |
dd53a2ed18fe35bca45b2335575ff0e9c0ba37180d86ee13b43491d9af9034bd
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.16
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Nov 25, 2026.
Transparency logRelease files / cotorra-26.11.2-py3-none-any.whl
| Download URL | cotorra-26.11.2-py3-none-any.whl |
|---|---|
| Size | 79.0 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
45a9d72f0540500eed8c0cd4f0abf2eec333d6b71e69258456fb0d73c3dceb29
|
|
BLAKE2b-256 checksum How to use checksums |
4ab985befc9e387b3b9ad7b7c376f515e83e2a62c8f56192c63d970c4bec2600
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.16
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Nov 25, 2026.
Transparency logSecurity for cotorra 26.11.2
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
Full provenance
Both files in this release have been uploaded with provenance metadata.
Attestation for cotorra-26.11.2.tar.gz
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Nov 25, 2026.
Transparency logA note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.