Instructions to use carlesonielfa/ReXVQA-SDFT-gemma-4-E2B with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- PEFT
How to use carlesonielfa/ReXVQA-SDFT-gemma-4-E2B with PEFT:
from peft import PeftModel from transformers import AutoModelForCausalLM base_model = AutoModelForCausalLM.from_pretrained("unsloth/gemma-4-E2B-it") model = PeftModel.from_pretrained(base_model, "carlesonielfa/ReXVQA-SDFT-gemma-4-E2B") - Transformers
How to use carlesonielfa/ReXVQA-SDFT-gemma-4-E2B with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("image-text-to-text", model="carlesonielfa/ReXVQA-SDFT-gemma-4-E2B") 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 AutoModel model = AutoModel.from_pretrained("carlesonielfa/ReXVQA-SDFT-gemma-4-E2B", dtype="auto") - Notebooks
- Google Colab
- Kaggle
- Local Apps Settings
- vLLM
How to use carlesonielfa/ReXVQA-SDFT-gemma-4-E2B with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "carlesonielfa/ReXVQA-SDFT-gemma-4-E2B" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "carlesonielfa/ReXVQA-SDFT-gemma-4-E2B", "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/carlesonielfa/ReXVQA-SDFT-gemma-4-E2B
- SGLang
How to use carlesonielfa/ReXVQA-SDFT-gemma-4-E2B 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 "carlesonielfa/ReXVQA-SDFT-gemma-4-E2B" \ --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": "carlesonielfa/ReXVQA-SDFT-gemma-4-E2B", "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 "carlesonielfa/ReXVQA-SDFT-gemma-4-E2B" \ --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": "carlesonielfa/ReXVQA-SDFT-gemma-4-E2B", "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" } } ] } ] }' - Unsloth Studio
How to use carlesonielfa/ReXVQA-SDFT-gemma-4-E2B with Unsloth Studio:
Install Unsloth Studio (macOS, Linux, WSL)
curl -fsSL https://unsloth.ai/install.sh | sh # Run unsloth studio unsloth studio -H 0.0.0.0 -p 8888 # Then open http://localhost:8888 in your browser # Search for carlesonielfa/ReXVQA-SDFT-gemma-4-E2B to start chatting
Install Unsloth Studio (Windows)
irm https://unsloth.ai/install.ps1 | iex # Run unsloth studio unsloth studio -H 0.0.0.0 -p 8888 # Then open http://localhost:8888 in your browser # Search for carlesonielfa/ReXVQA-SDFT-gemma-4-E2B to start chatting
Using HuggingFace Spaces for Unsloth
# No setup required # Open https://huggingface.co/spaces/unsloth/studio in your browser # Search for carlesonielfa/ReXVQA-SDFT-gemma-4-E2B to start chatting
Load model with FastModel
pip install unsloth from unsloth import FastModel model, tokenizer = FastModel.from_pretrained( model_name="carlesonielfa/ReXVQA-SDFT-gemma-4-E2B", max_seq_length=2048, ) - Docker Model Runner
How to use carlesonielfa/ReXVQA-SDFT-gemma-4-E2B with Docker Model Runner:
docker model run hf.co/carlesonielfa/ReXVQA-SDFT-gemma-4-E2B
ReXVQA-SDFT-gemma-4-E2B
ReXVQA-SDFT-gemma-4-E2B is a LoRA/PEFT adapter trained on the ReXVQA dataset using Self Distillation Fine-Tuning (SDFT) for Gemma 4 E2B. It is intended for chest X-ray visual question answering and image interpretation experiments.
The adapter shows greatly improved performance on chest X-ray image interpretation, placing 2nd on the ReXrank Challenge V2.0 (rexrank.ai) with a score near 0.89. This run has not yet been submitted for official validation.
Model Details
- Adapter type: LoRA
- Base model:
unsloth/gemma-4-E2B-it - Task: Chest X-ray visual question answering / image-text-to-text generation
- Training method: Self Distillation Fine-Tuning (SDFT)
- Training data: ReXVQA
- PEFT version: 0.19.1
- License: Apache 2.0
This repository contains adapter weights and tokenizer/processor configuration. It does not contain the full base model weights.
Intended Use
This adapter is intended for research and demonstration of multimodal chest X-ray interpretation with Gemma 4 E2B. It can be loaded with the base model through transformers and peft.
It is not intended for clinical diagnosis, medical decision-making, triage, or any use where model output could directly affect patient care. Outputs should be reviewed by qualified clinicians and treated as experimental.
Evaluation
Current informal challenge result:
- Benchmark: ReXrank Challenge V2.0
- Rank: 2nd
- Score: approximately 0.89
- Validation status: not yet submitted for official validation
Additional details will be added after formal validation and reproducible evaluation artifacts are available.
Loading
import torch
from peft import PeftModel
from transformers import AutoProcessor, Gemma4ForConditionalGeneration
base_model_id = "unsloth/gemma-4-E2B-it"
adapter_id = "carlesonielfa/ReXVQA-SDFT-gemma-4-E2B"
processor = AutoProcessor.from_pretrained(adapter_id)
model = Gemma4ForConditionalGeneration.from_pretrained(
base_model_id,
torch_dtype=torch.bfloat16,
device_map="auto",
)
model = PeftModel.from_pretrained(model, adapter_id)
model.eval()
Limitations
- The model may produce incorrect, incomplete, or overconfident medical statements.
- Performance outside the ReXVQA/ReXrank setting has not been fully characterized.
- Dataset composition, imaging protocol differences, and prompt wording may affect output quality.
- This adapter inherits limitations and safety considerations from the base Gemma 4 E2B model.
Citation
If you use this adapter, please cite the relevant ReXVQA/ReXrank resources and the Gemma base model according to their respective citation guidance.
- Downloads last month
- 61