Skip to main content

Agentic Medical Deep Learning Engineer

Project description

Med-DLE: Agentic Medical Deep Learning Engineer

MedDLE is designed to be a codegen agentic system for medical deep learning tasks.

Alert: For current version, monai prompt & rag (q2d+rerank) are defaultly enabled.

Since we update the Auto-Tuning Pipeline with many changes, please refer to branch v0 if you wanna use the old settings.

Quick Start

Setup environment

  1. we recommand use conda to create a virtual environment:
conda create --name meddle python=3.11 
conda activate meddle
  1. Then install meddle via:
pip install uv
uv pip install -r requirements.txt
uv pip install -e .
  1. remember to set up your private api key of OPENAI/ANTROPIC/OPENROUNTER
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

  1. Get data from link and move the data into med_dl_tasks
  2. The goal and eval target of MedMNIST dataset can be found in scripts.

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 AUC between the predicted and ground-truth class." \
     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

Total time limit

To test with a total time limit for all steps, you can set config 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

  • We thank all medical workers and dataset owners for making public datasets available to the community.
  • Thanks to the open-source of the following projects, our code is developed based on their contributions:

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

meddle-0.1.1.tar.gz (41.8 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

meddle-0.1.1-py3-none-any.whl (53.8 kB view details)

Uploaded Python 3

File details

Details for the file meddle-0.1.1.tar.gz.

File metadata

  • Download URL: meddle-0.1.1.tar.gz
  • Upload date:
  • Size: 41.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.12.9

File hashes

Hashes for meddle-0.1.1.tar.gz
Algorithm Hash digest
SHA256 49b1965f67afee3f903f4f2aef82ad40d5a04d79526984d91f66066e50da7ba3
MD5 1c52ca33c28b7afcf82efb28c3afc1ff
BLAKE2b-256 1a14966c25e76759ace9ba9fa7177c9199faf76bfa18a85660a4bc22ee3aeb06

See more details on using hashes here.

File details

Details for the file meddle-0.1.1-py3-none-any.whl.

File metadata

  • Download URL: meddle-0.1.1-py3-none-any.whl
  • Upload date:
  • Size: 53.8 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.12.9

File hashes

Hashes for meddle-0.1.1-py3-none-any.whl
Algorithm Hash digest
SHA256 5b0ba9dc055c3ca652d092f993d7f9b23cae2dd8327f593f35da539ee49a5b75
MD5 26f2c539b176c8ce7b371a5f439ba332
BLAKE2b-256 86a74e81ef2484598ae7ce8195ec47a6150ad9271ec5bcd1b0c0e177b1e60f46

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page