Image-Text-to-Text
Transformers
Safetensors
vision-encoder-decoder
image-captioning
vision-language
vit-gpt2
chest-xray
healthcare
axamine
finetuned
nlpconnect/vit-gpt2-image-captioning
Instructions to use Henil1/vit-axavision-2-ChestX with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use Henil1/vit-axavision-2-ChestX with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("image-text-to-text", model="Henil1/vit-axavision-2-ChestX")# Load model directly from transformers import AutoTokenizer, AutoModelForImageTextToText tokenizer = AutoTokenizer.from_pretrained("Henil1/vit-axavision-2-ChestX") model = AutoModelForImageTextToText.from_pretrained("Henil1/vit-axavision-2-ChestX") - Notebooks
- Google Colab
- Kaggle
- Local Apps
- vLLM
How to use Henil1/vit-axavision-2-ChestX with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "Henil1/vit-axavision-2-ChestX" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "Henil1/vit-axavision-2-ChestX", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }'Use Docker
docker model run hf.co/Henil1/vit-axavision-2-ChestX
- SGLang
How to use Henil1/vit-axavision-2-ChestX 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 "Henil1/vit-axavision-2-ChestX" \ --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": "Henil1/vit-axavision-2-ChestX", "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 "Henil1/vit-axavision-2-ChestX" \ --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": "Henil1/vit-axavision-2-ChestX", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }' - Docker Model Runner
How to use Henil1/vit-axavision-2-ChestX with Docker Model Runner:
docker model run hf.co/Henil1/vit-axavision-2-ChestX
Vit-Axavision-2-ChestX 🩺
This model is a fine-tuned version of nlpconnect/vit-gpt2-image-captioning on a chest X-ray dataset. It is developed as part of the Axamine AI research efforts to explore medical vision-language applications. The model takes chest X-ray images as input and generates descriptive captions that may help in automated reporting, healthcare research, or AI-assisted diagnostics.
Model Details
- Base model: nlpconnect/vit-gpt2-image-captioning
- Architecture: VisionEncoderDecoderModel (ViT encoder + GPT2 decoder)
- Fine-tuned on dataset: Shrey-1329/cxiu_hf_dataset
- Model size: ~250M parameters
- Developed by: Henilsinh Raj (Axamine AI)
Use Cases
Intended Use
- Chest X-ray image captioning
- Healthcare research
- Medical AI experiments
- Educational purposes
Limitations
- This model does not provide medical diagnosis.
- Captions are purely descriptive and may not fully reflect clinical accuracy.
Usage
Here’s how you can use the model for inference:
from transformers import VisionEncoderDecoderModel, ViTImageProcessor, AutoTokenizer
from PIL import Image
import torch
import requests
# Load model
model_id = "Henil1/vit-axavision-2-ChestX"
model = VisionEncoderDecoderModel.from_pretrained(model_id)
feature_extractor = ViTImageProcessor.from_pretrained(model_id)
tokenizer = AutoTokenizer.from_pretrained(model_id)
device = torch.device("cuda" if torch.cuda.is_available() else "cpu")
model.to(device)
# Preprocess image
image = Image.open("your_image_path.jpg").convert("RGB")
pixel_values = feature_extractor(images=image, return_tensors="pt").pixel_values.to(device)
# Generate caption
output_ids = model.generate(pixel_values, max_length=64, num_beams=4)
caption = tokenizer.decode(output_ids[0], skip_special_tokens=True)
print("Generated caption:", caption)
Citation
If you use this model, please cite:
@misc{henil2025axavision,
author = {Henilsinh Raj},
title = {Vit-Axavision-2-ChestX: Vision-Language Model for Chest X-Ray Captioning},
year = {2025},
publisher = {Hugging Face},
url = {https://huggingface.co/Henil1/vit-axavision-2-ChestX}
}
- Downloads last month
- 1
Inference Providers NEW
This model isn't deployed by any Inference Provider. 🙋 Ask for provider support