Image-Text-to-Text
Transformers
Safetensors
English
libra
text-generation
maira2
custom_code
radiology
Automated Chest X-ray Report Generation
MLLM
RRG
conversational
Instructions to use X-iZhang/libra-maira-2 with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use X-iZhang/libra-maira-2 with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("image-text-to-text", model="X-iZhang/libra-maira-2", 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)# pip install -U transformers accelerate # Load model directly from transformers import AutoModelForCausalLM model = AutoModelForCausalLM.from_pretrained("X-iZhang/libra-maira-2", trust_remote_code=True, device_map="auto") - Notebooks
- Google Colab
- Kaggle
- Local Apps Settings
- vLLM
How to use X-iZhang/libra-maira-2 with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "X-iZhang/libra-maira-2" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "X-iZhang/libra-maira-2", "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/X-iZhang/libra-maira-2
- SGLang
How to use X-iZhang/libra-maira-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 "X-iZhang/libra-maira-2" \ --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": "X-iZhang/libra-maira-2", "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 "X-iZhang/libra-maira-2" \ --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": "X-iZhang/libra-maira-2", "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 X-iZhang/libra-maira-2 with Docker Model Runner:
docker model run hf.co/X-iZhang/libra-maira-2
Commit History
-
Update README.md
Verified signaturef1ca4ab
-
Update README.md
Verified signature62cd5fa
-
Update README.md
Verified signature0d8c0aa -
Update README.md
Verified signature8d0e128
-
Update README.md
Verified signatureda3c6e4 -
Upload tokenizer.json
Verified signature5633a68
-
Update generation_config.json
Verified signature457bffc
-
Update README.md
Verified signaturedf5a8a0 -
Update README.md
Verified signature7904955 -
Update README.md
Verified signature746fba3 -
Update config.json
Verified signature88f2d2c -
Update config.json
Verified signature3e11f09 -
Update README.md
Verified signature880c798 -
Create README.md
Verified signature49823b0 -
Initial model upload
Verified signaturecd1f8f4 -
initial commit
Verified signatureef6356a