Image-Text-to-Text
Transformers
Safetensors
libra_mistral
text-generation
medical
Automated Chest X-ray Report Generation
RRG
radiology
conversational
Instructions to use X-iZhang/libra-llava-med-v1.5-mistral-7b with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use X-iZhang/libra-llava-med-v1.5-mistral-7b with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("image-text-to-text", model="X-iZhang/libra-llava-med-v1.5-mistral-7b") 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 AutoModelForCausalLM model = AutoModelForCausalLM.from_pretrained("X-iZhang/libra-llava-med-v1.5-mistral-7b", device_map="auto") - Notebooks
- Google Colab
- Kaggle
- Local Apps Settings
- vLLM
How to use X-iZhang/libra-llava-med-v1.5-mistral-7b with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "X-iZhang/libra-llava-med-v1.5-mistral-7b" # 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-llava-med-v1.5-mistral-7b", "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-llava-med-v1.5-mistral-7b
- SGLang
How to use X-iZhang/libra-llava-med-v1.5-mistral-7b 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-llava-med-v1.5-mistral-7b" \ --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-llava-med-v1.5-mistral-7b", "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-llava-med-v1.5-mistral-7b" \ --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-llava-med-v1.5-mistral-7b", "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-llava-med-v1.5-mistral-7b with Docker Model Runner:
docker model run hf.co/X-iZhang/libra-llava-med-v1.5-mistral-7b
|
Download README.md from X-iZhang/libra-llava-med-v1.5-mistral-7b: direct link, hf CLI and curl.
- Browser
- Download file 2.29 kB
-
https://huggingface.co/X-iZhang/libra-llava-med-v1.5-mistral-7b/resolve/main/README.md
- Command line
-
hf download hf://X-iZhang/libra-llava-med-v1.5-mistral-7b/README.md
-
curl -L -o README.md https://huggingface.co/X-iZhang/libra-llava-med-v1.5-mistral-7b/resolve/main/README.md
2.29 kB
| license: apache-2.0 | |
| base_model: | |
| - mistralai/Mistral-7B-Instruct-v0.2 | |
| - openai/clip-vit-large-patch14-336 | |
| base_model_relation: merge | |
| pipeline_tag: image-text-to-text | |
| library_name: transformers | |
| tags: | |
| - image-text-to-text | |
| - medical | |
| - Automated Chest X-ray Report Generation | |
| - RRG | |
| - radiology | |
| # LLaVA-Med v1.5 (based on [Mistral-7B-Instruct-v0.2](https://huggingface.co/mistralai/Mistral-7B-Instruct-v0.2)) | |
| LLaVA-Med (Large Language and Vision Assistant for bioMedicine) is an open-source large vision-language model adapted for biomedical applications. Built upon LLaVA and enhanced through curriculum learning, LLaVA-Med is fine-tuned specifically for open-ended biomedical question answering tasks. | |
| This release aims to support research reproducibility for the corresponding paper, which demonstrates improved performance on biomedical VQA benchmarks such as **PathVQA** and **VQA-RAD**. | |
| π Note: For original model weights, refer to [microsoft/llava-med-v1.5-mistral-7b](https://huggingface.co/microsoft/llava-med-v1.5-mistral-7b). | |
| π Original paper: [LLaVA-Med: Training a Large Language-and-Vision Assistant for Biomedicine in One Day](https://arxiv.org/abs/2306.00890). | |
| *** | |
| # π¬ Experimental Usage in Libra's repo | |
| This model checkpoint is intended for **experimental** use and can be tested directly within the [**Libra repository**](https://github.com/X-iZhang/Libra). | |
| ## Key Modification | |
| To enable the **re-trained** vision encoder during inference, ensure the following configuration is applied: | |
| ```json | |
| "unfreeze_mm_vision_tower": true | |
| ``` | |
| ## π Learn More | |
| For a deeper dive into the methodology, theoretical insights, and performance benchmarks of the Libra framework, please see the following resources: | |
| - π **Project Website**: [Libra v1.0](https://x-izhang.github.io/Libra_v1.0/) | |
| - π **Paper**: [arXiv:2411.19378](https://arxiv.org/abs/2411.19378) | |
| - π» **Code Repository**: [X-iZhang/Libra (GitHub)](https://github.com/X-iZhang/Libra) | |
| - π· **Related Project**: [CCD β Clinical Change Detection](https://x-izhang.github.io/CCD/); see technical details in the paper [here](https://arxiv.org/abs/2509.23379). | |
| --- | |
| ### License | |
| [mistralai/Mistral-7B-Instruct-v0.2](https://huggingface.co/mistralai/Mistral-7B-Instruct-v0.2) license. | |
| --- |