Instructions to use gghfez/amoral-gemma3-12B-vision with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use gghfez/amoral-gemma3-12B-vision with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("image-text-to-text", model="gghfez/amoral-gemma3-12B-vision") 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("gghfez/amoral-gemma3-12B-vision") model = AutoModelForImageTextToText.from_pretrained("gghfez/amoral-gemma3-12B-vision") 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 Settings
- vLLM
How to use gghfez/amoral-gemma3-12B-vision with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "gghfez/amoral-gemma3-12B-vision" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "gghfez/amoral-gemma3-12B-vision", "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/gghfez/amoral-gemma3-12B-vision
- SGLang
How to use gghfez/amoral-gemma3-12B-vision 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 "gghfez/amoral-gemma3-12B-vision" \ --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": "gghfez/amoral-gemma3-12B-vision", "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 "gghfez/amoral-gemma3-12B-vision" \ --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": "gghfez/amoral-gemma3-12B-vision", "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 gghfez/amoral-gemma3-12B-vision with Docker Model Runner:
docker model run hf.co/gghfez/amoral-gemma3-12B-vision
gghfez/amoral-gemma3-12B-vision
soob3123/amoral-gemma3-12B with the vision encoder reattached
Inference code
from transformers import AutoProcessor, Gemma3ForConditionalGeneration
from PIL import Image
import requests
import torch
model_id = "gghfez/amoral-gemma3-12B-vision"
model = Gemma3ForConditionalGeneration.from_pretrained(
model_id, device_map="auto"
).eval()
processor = AutoProcessor.from_pretrained(model_id)
messages = [
{
"role": "system",
"content": [{"type": "text", "text": "You are a helpful assistant."}]
},
{
"role": "user",
"content": [
{"type": "image", "image": "https://huggingface.co/datasets/huggingface/documentation-images/resolve/main/bee.jpg"},
{"type": "text", "text": "Describe this image in detail."}
]
}
]
inputs = processor.apply_chat_template(
messages, add_generation_prompt=True, tokenize=True,
return_dict=True, return_tensors="pt"
).to(model.device, dtype=torch.bfloat16)
input_len = inputs["input_ids"].shape[-1]
with torch.inference_mode():
generation = model.generate(**inputs, max_new_tokens=500, do_sample=False)
generation = generation[0][input_len:]
decoded = processor.decode(generation, skip_special_tokens=True)
print(decoded)
Output
Here's a detailed description of the image:
Overall Impression: The image is a close-up shot of a vibrant garden scene, focusing on pink cosmos flowers and a busy bumblebee. The composition is well-balanced, with the flowers and bee as the main subjects against a backdrop of greenery and other plants.
Flowers: The primary focus is on the pink cosmos flowers. They have delicate, slightly ruffled petals in shades of pink, with a bright yellow center. Some of the flowers are in full bloom, while others appear to be past their prime, with dried or wilted petals. The flowers are clustered together, creating a sense of abundance and natural beauty.
Bumblebee: A bumblebee is prominently featured on one of the cosmos flowers. It's positioned in the center of the frame, actively collecting nectar or pollen. The bee has a fuzzy, black and yellow body, and its wings are slightly blurred due to its movement.
Background: The background consists of a mix of green foliage, including large leaves and smaller plants. There are also some dried or faded flowers in the background, adding texture and depth to the image. A few red flowers are visible in the lower right corner, providing a pop of color.
Lighting and Color: The image is well-lit, with natural light illuminating the scene. The colors are vibrant and saturated, particularly the pink of the cosmos flowers and the yellow of the bumblebee. The overall effect is one of warmth and vitality.
I tested it with other images as well, I like the results! A lot more detailed than google/gemma-3-12b-it
- Downloads last month
- 8
Model tree for gghfez/amoral-gemma3-12B-vision
Base model
google/gemma-3-12b-pt