{"id":22852428,"url":"https://github.com/abdur75648/medicalgpt","last_synced_at":"2026-05-01T14:34:04.675Z","repository":{"id":245190255,"uuid":"814857823","full_name":"abdur75648/MedicalGPT","owner":"abdur75648","description":"Medical Report Generation And VQA (Adapting XrayGPT to Any Modality)","archived":false,"fork":false,"pushed_at":"2025-06-28T08:58:41.000Z","size":26083,"stargazers_count":6,"open_issues_count":1,"forks_count":4,"subscribers_count":4,"default_branch":"main","last_synced_at":"2025-06-28T09:48:11.265Z","etag":null,"topics":["chatgpt","chatgpt4o","llama","llm","llms","medical-dataset","medical-imaging","medical-report-generation","medicalgpt","minigpt4","multimodal-llm","vicuna","vqa","vqa-dataset","xraygpt"],"latest_commit_sha":null,"homepage":"https://abdur75648.github.io/MedicalGPT/","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/abdur75648.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2024-06-13T21:21:55.000Z","updated_at":"2025-06-28T09:04:32.000Z","dependencies_parsed_at":"2024-06-24T07:51:18.019Z","dependency_job_id":null,"html_url":"https://github.com/abdur75648/MedicalGPT","commit_stats":null,"previous_names":["abdur75648/medicalgpt"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/abdur75648/MedicalGPT","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/abdur75648%2FMedicalGPT","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/abdur75648%2FMedicalGPT/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/abdur75648%2FMedicalGPT/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/abdur75648%2FMedicalGPT/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/abdur75648","download_url":"https://codeload.github.com/abdur75648/MedicalGPT/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/abdur75648%2FMedicalGPT/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":32501403,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-04-30T13:12:12.517Z","status":"online","status_checked_at":"2026-05-01T02:00:05.856Z","response_time":64,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["chatgpt","chatgpt4o","llama","llm","llms","medical-dataset","medical-imaging","medical-report-generation","medicalgpt","minigpt4","multimodal-llm","vicuna","vqa","vqa-dataset","xraygpt"],"created_at":"2024-12-13T06:08:16.377Z","updated_at":"2026-05-01T14:34:04.665Z","avatar_url":"https://github.com/abdur75648.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# MedicalGPT For Medical Report Generation and VQA\nExtending XrayGPT for Multi-Modal Medical Visual Question Answering and Report Generation.\n\n\u003e **Note · Personal R\u0026D (2024):** This repo comes from an independent research project I undertook in 2024 to explore and advance multimodal medical VLMs. I’m sharing it for educational and community use.\n\n## About XrayGPT\n\nXrayGPT is a state-of-the-art model for chest report generation using large medical vision-language models. Built on top of BLIP-2 and MedCLIP, XrayGPT aligns a frozen visual encoder with a frozen large language model (LLM), Vicuna, using BLIP-2's Q-Former. This repository extends XrayGPT for general-purpose medical report generation and Visual Question Answering (VQA).\n\n- [XrayGPT Paper](https://arxiv.org/abs/2306.07971)\n- [XrayGPT Repository](https://github.com/mbzuai-oryx/XrayGPT)\n\n## MedicalGPT\nThis project enhances the XrayGPT model, a specialized VLM for chest X-rays, by transforming it into a versatile, multi-modal medical diagnostics tool. By leveraging a strategic fine-tuning process on a novel, composite dataset, the model's capabilities were extended beyond its original domain to interpret a diverse range of medical images (CT scans, MRIs) and perform both long-form report generation and precise Visual Question Answering (VQA).\n\n## Using This Repository\n\n### Installation\n\nDue to inconsistencies and incompatibilities among various libraries in the original codebase, a new environment is created to run the code in a Runpod container. The environment is based on Python 3.10, PyTorch 2.0.0, and CUDA 11.8.\n\n[Runpod Website](https://runpod.io/)\n\nUse the Runpod Template `pytorch:2.1.0-py3.10-cuda11.8.0` and run the following commands to install the required libraries:\n\n```bash\napt-get update -y \u0026\u0026 apt-get install zip unzip vim -y\npython -m pip install --upgrade pip\npip install gdown\npip install torch==2.0.0 torchvision==0.15.1 torchaudio==2.0.1 --index-url https://download.pytorch.org/whl/cu118\npip install -r hard_requirements.txt --no-deps\npip install pydantic==1.10.7\npip install hyperframe==5.2.0\npip install gradio==3.23.0\npip install safetensors==0.4.3\n```\n\n### Setup\nBelow is a brief overview of the steps for fine-tuning the trained XrayGPT model. Instructions for training XrayGPT from scratch are provided in the original repository.\n\n#### 1. Prepare the Datasets for Training\nPublicly available datasets for medical report generation predominantly focus on chest X-ray reports, often derived from sources like MIMIC-CXR/OpenI. While these datasets are valuable, they lack diversity in terms of medical imaging modalities. To address this limitation and enhance the model's capabilities for multi-modality report generation and Visual Question Answering (VQA), we curated a unique dataset by integrating two distinct datasets: OpenI and ROCO.\n\n**OpenI Dataset**: [OpenI](https://openi.nlm.nih.gov/faq) is a well-known resource provided by the Indiana University School of Medicine, comprising chest X-ray images paired with corresponding radiology reports.\n\n- **Kaggle Download:** [Link](https://www.kaggle.com/datasets/raddar/chest-xrays-indiana-university)\n- **Description:** Radiology reports and chest X-ray images\n- **Samples:** 4,000\n- **Usage:** Report generation (Chest X-ray)\n\n**ROCO Dataset**: [ROCO](https://github.com/razorx89/roco-dataset) (Radiology Objects in COntext) is a multimodal medical image dataset enriched with descriptive captions, offering a broader spectrum of medical imaging scenarios.\n\n- **Description:** Multimodal images with detailed descriptive captions\n- **Dataset Size:** 8,000 samples (validation split used)\n- **Usage:** Enables the model to generalize across various medical imaging modalities beyond chest X-rays.\n\nBy processing the OpenI and ROCO datasets using the OpenAI API and combining them, we created a comprehensive dataset suitable for training our model. The data integration resulted in a structured dataset stored in the `dataset` folder, facilitating efficient training and evaluation processes.\n\n* **Scripts to create the dataset given in [Data_Creation_Scripts](Data_Creation_Scripts/) folder**\n\nThe final structure of the dataset folder is as follows:\n\n```\ndataset\n├── image\n|   ├──1.jpg\n|   ├──2.jpg\n|   ├──3.jpg\n|    .....\n├── filter_cap.json\n```\n\n#### 2. Prepare the Pretrained Vicuna Weights\n\nDownload the finetuned version of `Vicuna-7B` from the [original XrayGPT link](https://mbzuaiac-my.sharepoint.com/:u:/g/personal/omkar_thawakar_mbzuai_ac_ae/EWoMYn3x7sdEnM2CdJRwWZgBCkMpLM03bk4GR5W0b3KIQQ?e=q6hEBz). The final weights should be in a single folder with a structure similar to the following:\n\n```\nvicuna_weights\n├── config.json\n├── generation_config.json\n├── pytorch_model.bin.index.json\n├── pytorch_model-00001-of-00003.bin\n...   \n```\n\n#### 3. Download the Pretrained XrayGPT Checkpoint\n\nDownload the trained XrayGPT model from [here](https://mbzuaiac-my.sharepoint.com/:u:/g/personal/omkar_thawakar_mbzuai_ac_ae/EbGJZmueJkFAstU965buWs8B7T8tLcks7N-P79gsExRH0Q?e=mVASdV).\n\nThis checkpoint file contains the trained weights for the Q-Former, which form the bridge between the vision encoder and the LLM.\n\n### Model Training\nHere we fine-tuned a pretrained XrayGPT model on the dataset created above. The model was initially trained on the MIMIC and OpenI datasets in a two-stage training process.\n\nRun the following command:\n\n```bash\npython3 train.py --cfg-path train_configs/xraygpt_openi_finetune.yaml\n```\n\n### Launching the Demo\n\nDownload the pretrained XrayGPT checkpoints from the [link](https://mbzuaiac-my.sharepoint.com/:u:/g/personal/omkar_thawakar_mbzuai_ac_ae/EbGJZmueJkFAstU965buWs8B7T8tLcks7N-P79gsExRH0Q?e=mVASdV) and add this checkpoint in `eval_configs/xraygpt_eval.yaml`.\n\nRun the following command to launch the demo:\n\n```bash\npython demo.py --cfg-path eval_configs/xraygpt_eval.yaml --gpu-id 0\n```\n\n## Citation\n\nIf you use this work, please cite the following original XrayGPT paper:\n\n```bibtex\n@article{Omkar2023XrayGPT,\n    title={XrayGPT: Chest Radiographs Summarization using Large Medical Vision-Language Models},\n    author={Omkar Thawkar, Abdelrahman Shaker, Sahal Shaji Mullappilly, Hisham Cholakkal, Rao Muhammad Anwer, Salman Khan, Jorma Laaksonen and Fahad Shahbaz Khan},\n    journal={arXiv: 2306.07971},\n    year={2023}\n}\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fabdur75648%2Fmedicalgpt","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fabdur75648%2Fmedicalgpt","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fabdur75648%2Fmedicalgpt/lists"}