Instructions to use Omarrran/Hnm_Llama3_2_Vision_lora_model with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use Omarrran/Hnm_Llama3_2_Vision_lora_model with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("image-text-to-text", model="Omarrran/Hnm_Llama3_2_Vision_lora_model") 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 AutoProcessor, AutoModelForImageTextToText processor = AutoProcessor.from_pretrained("Omarrran/Hnm_Llama3_2_Vision_lora_model") model = AutoModelForImageTextToText.from_pretrained("Omarrran/Hnm_Llama3_2_Vision_lora_model") 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?"} ] }, ] inputs = processor.apply_chat_template( messages, add_generation_prompt=True, tokenize=True, return_dict=True, return_tensors="pt", ).to(model.device) outputs = model.generate(**inputs, max_new_tokens=40) print(processor.decode(outputs[0][inputs["input_ids"].shape[-1]:])) - Notebooks
- Google Colab
- Kaggle
- Local Apps
- vLLM
How to use Omarrran/Hnm_Llama3_2_Vision_lora_model with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "Omarrran/Hnm_Llama3_2_Vision_lora_model" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "Omarrran/Hnm_Llama3_2_Vision_lora_model", "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/Omarrran/Hnm_Llama3_2_Vision_lora_model
- SGLang
How to use Omarrran/Hnm_Llama3_2_Vision_lora_model 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 "Omarrran/Hnm_Llama3_2_Vision_lora_model" \ --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": "Omarrran/Hnm_Llama3_2_Vision_lora_model", "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 "Omarrran/Hnm_Llama3_2_Vision_lora_model" \ --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": "Omarrran/Hnm_Llama3_2_Vision_lora_model", "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 new
How to use Omarrran/Hnm_Llama3_2_Vision_lora_model 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 Omarrran/Hnm_Llama3_2_Vision_lora_model 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 Omarrran/Hnm_Llama3_2_Vision_lora_model to start chatting
Using HuggingFace Spaces for Unsloth
# No setup required # Open https://huggingface.co/spaces/unsloth/studio in your browser # Search for Omarrran/Hnm_Llama3_2_Vision_lora_model to start chatting
Load model with FastModel
pip install unsloth from unsloth import FastModel model, tokenizer = FastModel.from_pretrained( model_name="Omarrran/Hnm_Llama3_2_Vision_lora_model", max_seq_length=2048, ) - Docker Model Runner
How to use Omarrran/Hnm_Llama3_2_Vision_lora_model with Docker Model Runner:
docker model run hf.co/Omarrran/Hnm_Llama3_2_Vision_lora_model
Uploaded finetuned model
- Developed by: Haq Nawaz Malik
- License: apache-2.0
- Finetuned from model : unsloth/llama-3.2-11b-vision-instruct-unsloth-bnb-4bit
Documentation: Hnm_Llama3.2_(11B)-Vision_lora_model
Overview
The Hnm_Llama3.2_(11B)-Vision_lora_model is a fine-tuned version of Llama 3.2 (11B) Vision with LoRA-based parameter-efficient fine-tuning (PEFT). It specializes in vision-language tasks, particularly for medical image captioning and understanding.
This model was fine-tuned on a Tesla T4 (Google Colab) using Unsloth, a framework designed for efficient fine-tuning of large models.
Features
- Fine-tuned on Radiology Images: Trained using the Radiology_mini dataset.
- Supports Image Captioning: Can describe medical images.
- 4-bit Quantization (QLoRA): Memory efficient, runs on consumer GPUs.
- LoRA-based PEFT: Trains only 1% of parameters, significantly reducing computational cost.
- Multi-modal Capabilities: Works with both text and image inputs.
- Supports both Vision and Language fine-tuning.
Model Details
- Base Model:
unsloth/Llama-3.2-11B-Vision-Instruct - Fine-tuning Method: LoRA + 4-bit Quantization (QLoRA)
- Dataset:
unsloth/Radiology_mini - Framework: Unsloth + Hugging Face Transformers
- Training Environment: Google Colab (Tesla T4 GPU)
2. Load the Model
from unsloth import FastVisionModel
model, tokenizer = FastVisionModel.from_pretrained(
"Hnm_Llama3.2_(11B)-Vision_lora_model",
load_in_4bit=True # Set to False for full precision
)
Usage
1. Image Captioning Example
import torch
from transformers import TextStreamer
FastVisionModel.for_inference(model) # Enable inference mode
# Load an image from dataset
dataset = load_dataset("unsloth/Radiology_mini", split="train")
image = dataset[0]["image"]
instruction = "Describe this medical image accurately."
messages = [
{"role": "user", "content": [
{"type": "image"},
{"type": "text", "text": instruction}
]}
]
input_text = tokenizer.apply_chat_template(messages, add_generation_prompt=True)
inputs = tokenizer(
image,
input_text,
add_special_tokens=False,
return_tensors="pt"
).to("cuda")
text_streamer = TextStreamer(tokenizer, skip_prompt=True)
_ = model.generate(**inputs, streamer=text_streamer, max_new_tokens=128,
use_cache=True, temperature=1.5, min_p=0.1)
Notes
- This model is optimized for vision-language tasks in the medical field but can be adapted for other applications.
- Uses LoRA adapters, meaning you can fine-tune it efficiently with very few GPU resources.
- Supports Hugging Face Model Hub for deployment and sharing.
Citation
If you use this model, please cite:
@misc{Hnm_Llama3.2_11B_Vision,
author = {Haq Nawaz Malik},
title = {Fine-tuned Llama 3.2 (11B) Vision Model},
year = {2025},
url = {https://huggingface.co/Omarrran/Hnm_Llama3_2_Vision_lora_model}
}
Contact
For any questions or support, reach out via:
- Downloads last month
- 3