Image-Text-to-Text
Transformers
Safetensors
English
phi
text-generation
medical
radiology
chest-x-ray
multimodal
report-generation
structured-reporting
contextualized
temporal-reasoning
impression
lora
medical-imaging
clinical-nlp
conversational
custom_code
text-generation-inference
Instructions to use erjui/CheXagent-2-3b-csrrg-impression with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use erjui/CheXagent-2-3b-csrrg-impression with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("image-text-to-text", model="erjui/CheXagent-2-3b-csrrg-impression", trust_remote_code=True) messages = [ { "role": "user", "content": [ {"type": "image", "url": "https://huggingface.co/datasets/huggingface/documentation-images/resolve/main/p-blog/candy.JPG"}, {"type": "text", "text": "What animal is on the candy?"} ] }, ] pipe(text=messages)# Load model directly from transformers import AutoTokenizer, AutoModelForCausalLM tokenizer = AutoTokenizer.from_pretrained("erjui/CheXagent-2-3b-csrrg-impression", trust_remote_code=True) model = AutoModelForCausalLM.from_pretrained("erjui/CheXagent-2-3b-csrrg-impression", trust_remote_code=True, device_map="auto") messages = [ { "role": "user", "content": [ {"type": "image", "url": "https://huggingface.co/datasets/huggingface/documentation-images/resolve/main/p-blog/candy.JPG"}, {"type": "text", "text": "What animal is on the candy?"} ] }, ] inputs = tokenizer.apply_chat_template( messages, add_generation_prompt=True, tokenize=True, return_dict=True, return_tensors="pt", ).to(model.device) outputs = model.generate(**inputs, max_new_tokens=40) print(tokenizer.decode(outputs[0][inputs["input_ids"].shape[-1]:])) - Notebooks
- Google Colab
- Kaggle
- Local Apps Settings
- vLLM
How to use erjui/CheXagent-2-3b-csrrg-impression with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "erjui/CheXagent-2-3b-csrrg-impression" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "erjui/CheXagent-2-3b-csrrg-impression", "messages": [ { "role": "user", "content": [ { "type": "text", "text": "Describe this image in one sentence." }, { "type": "image_url", "image_url": { "url": "https://cdn.britannica.com/61/93061-050-99147DCE/Statue-of-Liberty-Island-New-York-Bay.jpg" } } ] } ] }'Use Docker
docker model run hf.co/erjui/CheXagent-2-3b-csrrg-impression
- SGLang
How to use erjui/CheXagent-2-3b-csrrg-impression with SGLang:
Install from pip and serve model
# Install SGLang from pip: pip install sglang # Start the SGLang server: python3 -m sglang.launch_server \ --model-path "erjui/CheXagent-2-3b-csrrg-impression" \ --host 0.0.0.0 \ --port 30000 # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:30000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "erjui/CheXagent-2-3b-csrrg-impression", "messages": [ { "role": "user", "content": [ { "type": "text", "text": "Describe this image in one sentence." }, { "type": "image_url", "image_url": { "url": "https://cdn.britannica.com/61/93061-050-99147DCE/Statue-of-Liberty-Island-New-York-Bay.jpg" } } ] } ] }'Use Docker images
docker run --gpus all \ --shm-size 32g \ -p 30000:30000 \ -v ~/.cache/huggingface:/root/.cache/huggingface \ --env "HF_TOKEN=<secret>" \ --ipc=host \ lmsysorg/sglang:latest \ python3 -m sglang.launch_server \ --model-path "erjui/CheXagent-2-3b-csrrg-impression" \ --host 0.0.0.0 \ --port 30000 # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:30000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "erjui/CheXagent-2-3b-csrrg-impression", "messages": [ { "role": "user", "content": [ { "type": "text", "text": "Describe this image in one sentence." }, { "type": "image_url", "image_url": { "url": "https://cdn.britannica.com/61/93061-050-99147DCE/Statue-of-Liberty-Island-New-York-Bay.jpg" } } ] } ] }' - Docker Model Runner
How to use erjui/CheXagent-2-3b-csrrg-impression with Docker Model Runner:
docker model run hf.co/erjui/CheXagent-2-3b-csrrg-impression
Upload README.md with huggingface_hub
Browse files
README.md
CHANGED
|
@@ -90,7 +90,7 @@ This model performs **Contextualized Structured Radiology Report Generation (CSR
|
|
| 90 |
- Max images per sample: 2
|
| 91 |
|
| 92 |
**Hardware:**
|
| 93 |
-
- GPU: NVIDIA
|
| 94 |
- Training framework: HuggingFace Transformers + PEFT
|
| 95 |
|
| 96 |
## Usage
|
|
@@ -161,37 +161,6 @@ IMPRESSION:
|
|
| 161 |
2. Recommend repeat dedicated AP and lateral chest radiograph, or CT for further evaluation.
|
| 162 |
```
|
| 163 |
|
| 164 |
-
## Evaluation
|
| 165 |
-
|
| 166 |
-
The model is evaluated using standard medical NLG metrics with additional temporal reasoning evaluation:
|
| 167 |
-
|
| 168 |
-
- **RadGraph F1**: Measures clinical entity and relation extraction accuracy
|
| 169 |
-
- **BLEU**: N-gram overlap with reference reports
|
| 170 |
-
- **ROUGE** (ROUGE-1, ROUGE-2, ROUGE-L): Recall-oriented metrics
|
| 171 |
-
- **BERTScore**: Semantic similarity using contextual embeddings
|
| 172 |
-
- **CheXbert F1**: Clinical accuracy for pathology classification
|
| 173 |
-
- **Temporal consistency**: Evaluation of comparison statements and longitudinal reasoning
|
| 174 |
-
|
| 175 |
-
For detailed evaluation results, see the paper: [Automated Structured Radiology Report Generation with Rich Clinical Context](https://arxiv.org/abs/2510.00428)
|
| 176 |
-
|
| 177 |
-
## Limitations
|
| 178 |
-
|
| 179 |
-
- Trained exclusively on chest X-ray images (not applicable to other imaging modalities)
|
| 180 |
-
- Performance may vary on images from different institutions or imaging protocols
|
| 181 |
-
- May not capture all rare pathologies or edge cases
|
| 182 |
-
- Requires expert radiologist review before clinical use
|
| 183 |
-
- Temporal reasoning accuracy depends on quality of prior study information
|
| 184 |
-
- Should not be used as the sole diagnostic tool
|
| 185 |
-
|
| 186 |
-
## Ethical Considerations
|
| 187 |
-
|
| 188 |
-
- **Medical AI Responsibility**: This model generates medical text and must be used responsibly
|
| 189 |
-
- **Human Oversight Required**: All outputs should be reviewed by qualified radiologists
|
| 190 |
-
- **Data Privacy**: Ensure compliance with HIPAA, GDPR, and local healthcare regulations
|
| 191 |
-
- **Bias and Fairness**: Model trained on specific datasets may have biases; validate on diverse populations
|
| 192 |
-
- **Clinical Validation**: Requires thorough validation before any clinical deployment
|
| 193 |
-
- **Longitudinal Data Handling**: Ensure proper patient consent and data governance for temporal data
|
| 194 |
-
|
| 195 |
## Citation
|
| 196 |
|
| 197 |
If you use this model, please cite:
|
|
@@ -208,8 +177,8 @@ If you use this model, please cite:
|
|
| 208 |
Also cite the base model:
|
| 209 |
```bibtex
|
| 210 |
@article{chen2024chexagent,
|
| 211 |
-
title={
|
| 212 |
-
author={Chen, Zhihong and Varma, Maya and Delbrouck, Jean-Benoit and Paschali, Magdalini and Blankemeier, Louis and Van Veen, Dave and Valanarasu, Jeya Maria Jose and Youssef, Alaa and Cohen, Joseph Paul and Reis, Eduardo Pontes and
|
| 213 |
journal={arXiv preprint arXiv:2401.12208},
|
| 214 |
year={2024}
|
| 215 |
}
|
|
|
|
| 90 |
- Max images per sample: 2
|
| 91 |
|
| 92 |
**Hardware:**
|
| 93 |
+
- GPU: NVIDIA H100
|
| 94 |
- Training framework: HuggingFace Transformers + PEFT
|
| 95 |
|
| 96 |
## Usage
|
|
|
|
| 161 |
2. Recommend repeat dedicated AP and lateral chest radiograph, or CT for further evaluation.
|
| 162 |
```
|
| 163 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 164 |
## Citation
|
| 165 |
|
| 166 |
If you use this model, please cite:
|
|
|
|
| 177 |
Also cite the base model:
|
| 178 |
```bibtex
|
| 179 |
@article{chen2024chexagent,
|
| 180 |
+
title={Chexagent: Towards a foundation model for chest x-ray interpretation},
|
| 181 |
+
author={Chen, Zhihong and Varma, Maya and Delbrouck, Jean-Benoit and Paschali, Magdalini and Blankemeier, Louis and Van Veen, Dave and Valanarasu, Jeya Maria Jose and Youssef, Alaa and Cohen, Joseph Paul and Reis, Eduardo Pontes and others},
|
| 182 |
journal={arXiv preprint arXiv:2401.12208},
|
| 183 |
year={2024}
|
| 184 |
}
|