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
LLaVA-Med v1.5 (based on 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.
📃 Original paper: LLaVA-Med: Training a Large Language-and-Vision Assistant for Biomedicine in One Day.
🔬 Experimental Usage in Libra's repo
This model checkpoint is intended for experimental use and can be tested directly within the Libra repository.
Key Modification
To enable the re-trained vision encoder during inference, ensure the following configuration is applied:
"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
- 📄 Paper: arXiv:2411.19378
- 💻 Code Repository: X-iZhang/Libra (GitHub)
- 📷 Related Project: CCD – Clinical Change Detection; see technical details in the paper here.
License
mistralai/Mistral-7B-Instruct-v0.2 license.
- Downloads last month
- 283