Text Generation
Transformers
Safetensors
English
cxrmate-ed
chest X-ray report generation
radiology report generation
image captioning
chest X-ray
X-ray
radiology
cxrmate
report
radiology report
multimodal
patient data
patient records
mimic-cxr
mimic-iv-ed
custom_code
Instructions to use aehrc/cxrmate-ed with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use aehrc/cxrmate-ed with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-generation", model="aehrc/cxrmate-ed", trust_remote_code=True)# Load model directly from transformers import AutoModelForCausalLM model = AutoModelForCausalLM.from_pretrained("aehrc/cxrmate-ed", trust_remote_code=True, device_map="auto") - Notebooks
- Google Colab
- Kaggle
- Local Apps Settings
- vLLM
How to use aehrc/cxrmate-ed with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "aehrc/cxrmate-ed" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "aehrc/cxrmate-ed", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }'Use Docker
docker model run hf.co/aehrc/cxrmate-ed
- SGLang
How to use aehrc/cxrmate-ed 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 "aehrc/cxrmate-ed" \ --host 0.0.0.0 \ --port 30000 # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:30000/v1/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "aehrc/cxrmate-ed", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }'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 "aehrc/cxrmate-ed" \ --host 0.0.0.0 \ --port 30000 # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:30000/v1/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "aehrc/cxrmate-ed", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }' - Docker Model Runner
How to use aehrc/cxrmate-ed with Docker Model Runner:
docker model run hf.co/aehrc/cxrmate-ed
Upload model
Browse files- create_section_files.py +1 -4
- prepare_dataset.py +0 -4
create_section_files.py
CHANGED
|
@@ -4,10 +4,7 @@ from pathlib import Path
|
|
| 4 |
|
| 5 |
from tqdm import tqdm
|
| 6 |
|
| 7 |
-
|
| 8 |
-
from .section_parser import custom_mimic_cxr_rules, section_text
|
| 9 |
-
except ImportError:
|
| 10 |
-
from section_parser import custom_mimic_cxr_rules, section_text
|
| 11 |
|
| 12 |
|
| 13 |
def list_rindex(l, s):
|
|
|
|
| 4 |
|
| 5 |
from tqdm import tqdm
|
| 6 |
|
| 7 |
+
from .section_parser import custom_mimic_cxr_rules, section_text
|
|
|
|
|
|
|
|
|
|
| 8 |
|
| 9 |
|
| 10 |
def list_rindex(l, s):
|
prepare_dataset.py
CHANGED
|
@@ -11,12 +11,8 @@ import duckdb
|
|
| 11 |
import numpy as np
|
| 12 |
import pandas as pd
|
| 13 |
|
| 14 |
-
# try:
|
| 15 |
from .create_section_files import create_section_files
|
| 16 |
|
| 17 |
-
# except ImportError:
|
| 18 |
-
# from create_section_files import create_section_files
|
| 19 |
-
|
| 20 |
|
| 21 |
def mimic_cxr_image_path(dir, subject_id, study_id, dicom_id, ext='dcm'):
|
| 22 |
return os.path.join(dir, 'p' + str(subject_id)[:2], 'p' + str(subject_id),
|
|
|
|
| 11 |
import numpy as np
|
| 12 |
import pandas as pd
|
| 13 |
|
|
|
|
| 14 |
from .create_section_files import create_section_files
|
| 15 |
|
|
|
|
|
|
|
|
|
|
| 16 |
|
| 17 |
def mimic_cxr_image_path(dir, subject_id, study_id, dicom_id, ext='dcm'):
|
| 18 |
return os.path.join(dir, 'p' + str(subject_id)[:2], 'p' + str(subject_id),
|