Text Generation
Transformers
Safetensors
English
cxrmate-2
chest X-ray report generation
radiology report generation
image captioning
chest X-ray
X-ray
radiology
cxrmate
cxrmate-ed
cxrmate-rrg24
report
radiology report
multimodal
patient data
mimic-cxr
custom_code
Instructions to use aehrc/cxrmate-2 with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use aehrc/cxrmate-2 with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-generation", model="aehrc/cxrmate-2", trust_remote_code=True)# pip install -U transformers accelerate # Load model directly from transformers import AutoModelForCausalLM model = AutoModelForCausalLM.from_pretrained("aehrc/cxrmate-2", trust_remote_code=True, device_map="auto") - Notebooks
- Google Colab
- Kaggle
- Local Apps Settings
- vLLM
How to use aehrc/cxrmate-2 with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "aehrc/cxrmate-2" # 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-2", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }'Use Docker
docker model run hf.co/aehrc/cxrmate-2
- SGLang
How to use aehrc/cxrmate-2 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-2" \ --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-2", "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-2" \ --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-2", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }' - Docker Model Runner
How to use aehrc/cxrmate-2 with Docker Model Runner:
docker model run hf.co/aehrc/cxrmate-2
Download config.json from aehrc/cxrmate-2: direct link, hf CLI and curl.
- Browser
- Download file 3.06 kB
-
https://huggingface.co/aehrc/cxrmate-2/resolve/main/config.json
- Command line
-
hf download hf://aehrc/cxrmate-2/config.json
-
curl -L -o config.json https://huggingface.co/aehrc/cxrmate-2/resolve/main/config.json
3.06 kB
| { | |
| "architectures": [ | |
| "CXRMate2ForConditionalGeneration" | |
| ], | |
| "auto_map": { | |
| "AutoConfig": "configuration_cxrmate2.CXRMate2Config", | |
| "AutoModelForCausalLM": "modelling_cxrmate2.CXRMate2ForConditionalGeneration" | |
| }, | |
| "bos_token_id": 128000, | |
| "config": "cxrmate2/config/002_grpo_rev_a", | |
| "dtype": "float32", | |
| "findings_token_type_id": 128029, | |
| "generate_both_sections_token_id": null, | |
| "generate_findings_token_id": 128003, | |
| "generate_impression_token_id": 128005, | |
| "image_token_index": 128002, | |
| "impression_token_type_id": 128030, | |
| "missing_time_delta_token_id": 128012, | |
| "model_type": "cxrmate-2", | |
| "multimodal_projector_bias": false, | |
| "num_q_adapter_layers": 2, | |
| "num_q_adapter_positions": 1497, | |
| "num_q_adapter_queries": 128, | |
| "num_token_types": null, | |
| "permute_encoder_last_hidden_state": true, | |
| "projector_hidden_act": null, | |
| "sep_token_id": 128072, | |
| "text_config": { | |
| "_name_or_path": "meta-llama/Llama-3.2-3B", | |
| "architectures": [ | |
| "LlamaForCausalLM" | |
| ], | |
| "attention_bias": false, | |
| "attention_dropout": 0.0, | |
| "bos_token_id": 128000, | |
| "dtype": "float32", | |
| "eos_token_id": 128001, | |
| "head_dim": 128, | |
| "hidden_act": "silu", | |
| "hidden_size": 3072, | |
| "initializer_range": 0.02, | |
| "intermediate_size": 8192, | |
| "max_position_embeddings": 131072, | |
| "mlp_bias": false, | |
| "model_type": "llama", | |
| "num_attention_heads": 24, | |
| "num_hidden_layers": 28, | |
| "num_key_value_heads": 8, | |
| "pretraining_tp": 1, | |
| "rms_norm_eps": 1e-05, | |
| "rope_scaling": { | |
| "factor": 32.0, | |
| "high_freq_factor": 4.0, | |
| "low_freq_factor": 1.0, | |
| "original_max_position_embeddings": 8192, | |
| "rope_type": "llama3" | |
| }, | |
| "rope_theta": 500000.0, | |
| "tie_word_embeddings": true, | |
| "use_cache": true, | |
| "vocab_size": 128256 | |
| }, | |
| "time_delta_encoder_intermediate_size": 2048, | |
| "time_delta_monotonic_inversion": true, | |
| "transformers_version": "4.57.1", | |
| "trial": 6, | |
| "vision_config": { | |
| "_name_or_path": "microsoft/rad-dino-maira-2", | |
| "apply_layernorm": true, | |
| "architectures": [ | |
| "Dinov2Model" | |
| ], | |
| "attention_probs_dropout_prob": 0.0, | |
| "drop_path_rate": 0.0, | |
| "dtype": "float32", | |
| "hidden_act": "gelu", | |
| "hidden_dropout_prob": 0.0, | |
| "hidden_size": 768, | |
| "image_size": 518, | |
| "initializer_range": 0.02, | |
| "layer_norm_eps": 1e-06, | |
| "layerscale_value": 1.0, | |
| "mlp_ratio": 4, | |
| "model_type": "dinov2", | |
| "num_attention_heads": 12, | |
| "num_channels": 3, | |
| "num_hidden_layers": 12, | |
| "out_features": [ | |
| "stage12" | |
| ], | |
| "out_indices": [ | |
| 12 | |
| ], | |
| "patch_size": 14, | |
| "qkv_bias": true, | |
| "reshape_hidden_states": true, | |
| "stage_names": [ | |
| "stem", | |
| "stage1", | |
| "stage2", | |
| "stage3", | |
| "stage4", | |
| "stage5", | |
| "stage6", | |
| "stage7", | |
| "stage8", | |
| "stage9", | |
| "stage10", | |
| "stage11", | |
| "stage12" | |
| ], | |
| "use_mask_token": true, | |
| "use_swiglu_ffn": false | |
| }, | |
| "vision_feature_layer": -1, | |
| "vision_feature_select_strategy": "full" | |
| } | |