Med-DLE: Agentic Medical Deep Learning Engineer
MedDLE is designed to be a codegen agentic system for medical deep learning tasks.
Quick Start
Setup environment
- we recommand use
condato create a virtual environment:
conda create --name meddle python=3.11
conda activate meddle
- Then install
meddlevia:
pip install uv
uv pip install -r requirements.txt
uv pip install -e .
- remember to set up your private api key of OPENAI/ANTROPIC/OPENROUNTER for openai-compatible endpoint
export OPENAI_BASE_URL="<your base url>" # (e.g. https://api.openai.com/v1)
export OPENAI_API_KEY="<your key>"
Setup knowledge base for RAG
You can create the knowledge base with create_monai_knowledge_base.sh or download from link.
You could use this command to check whether the creation succeeds.
python -m meddle.monai_rag.query_rag_db
Setup dataset
- Get data from link and move the data into
med_dl_tasks. This zip file contains both MedMNIST only. - The goals and evaluation targets for each dataset can be found in the corresponding shell scripts:
- For MedMNIST datasets, see
run_medmnist_all.sh. - For MCO (Molecular and Cellular Oncology) datasets, see
run_mco_all.sh.
- For MedMNIST datasets, see
Try MedDLE
meddle data_dir=<your dataset> \
goal=<your goal> \
eval=<your metrics> \
agent.steps=30 agent.enable_monai_knowledge_base=true
here's a detailed example:
meddle data_dir="meddle/example_tasks/retinamnist_224" exp_name="torch-example_task_retina"\
goal="Predict the category of each given Fundus Camera image by selecting the most appropriate one from the 5 available classes." \
eval="Use the accuracy and the area under curve (AUC) between the predicted class and ground-truth class on the test set." \
agent.step_plan.proposal=20 agent.step_plan.tuning=10 agent.step_plan.hpo=5
You can set general steps (MedDLE with auto-schedule steps for multiple agents) or detailed step_plan for
each agent.
Advanced Features
RAG Mode
We support both basic RAG and advanced (query2doc) mode. They are controlled with the following configs.
agent.enable_monai_knowledge_base=true agent.enable_query2doc=true
Time Limits
MedDLE supports configurable timeouts for code execution. The default timeout is 3600 seconds, which can be adjusted via:
exec.timeout: Base timeout for all agents (default: 3600s)- HPO agent automatically gets 2x timeout: 7200s when running hyperparameter optimization
To set a total time limit for all steps, use agent.total_time_limit:
meddle data_dir="meddle/example_tasks/retinamnist_224" exp_name="test_timelimit-example_task_retina"\
goal="Predict the category of each given Fundus Camera image by selecting the most appropriate one from the 5 available classes." \
eval="Use the accuracy and the area under curve (AUC) between the predicted class and ground-truth class on the test set." \
agent.force_monai_with_prompt=false agent.enable_monai_knowledge_base=false agent.expose_prediction=true \
agent.steps=100 agent.total_time_limit=60
🙏 Acknowledgement
Metadata
Release files for meddle 0.1.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 |
|---|---|---|---|---|
| meddle-0.1.2.tar.gz | 52.1 kB | Without provenance | Details for meddle-0.1.2.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| meddle-0.1.2-py3-none-any.whl | Python 3 | none | any | Details for meddle-0.1.2-py3-none-any.whl |
Total release size: 117.6 kB
Release files / meddle-0.1.2.tar.gz
| Download URL | meddle-0.1.2.tar.gz |
|---|---|
| Size | 52.1 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
3925650724122f5ac176ed2f0ac06d8d30deab9265f169848a9b1e760f7fea38
|
|
BLAKE2b-256 checksum How to use checksums |
d3d5b296bc7f85fe9edb1f404d77cb6c53fb34f48091e6bd706b53ec9bb5b5d9
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.1.0 CPython/3.11.0
|
Release files / meddle-0.1.2-py3-none-any.whl
| Download URL | meddle-0.1.2-py3-none-any.whl |
|---|---|
| Size | 65.6 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
98a089358a4ead975c583a1ed118d3c3fa8c23c19e410e8b074e631f3cc2b7b1
|
|
BLAKE2b-256 checksum How to use checksums |
40a813cd6bc429853d77b2a281fb79fe9646ccad1c69dd3137ef0214ee485899
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.1.0 CPython/3.11.0
|
Security for meddle 0.1.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.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A 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.