Image-Text-to-Text
Transformers
Safetensors
gemma4
persistent-exploration
visual-search
multimodal
visual-reasoning
reinforcement-learning
tool-use
conversational
Instructions to use gsarch/Persistent-Exploration-Gemma4-E4B with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use gsarch/Persistent-Exploration-Gemma4-E4B with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("image-text-to-text", model="gsarch/Persistent-Exploration-Gemma4-E4B") 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)# pip install -U transformers accelerate # Load model directly from transformers import AutoProcessor, AutoModelForMultimodalLM processor = AutoProcessor.from_pretrained("gsarch/Persistent-Exploration-Gemma4-E4B") model = AutoModelForMultimodalLM.from_pretrained("gsarch/Persistent-Exploration-Gemma4-E4B", device_map="auto") 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=256) print(processor.decode(outputs[0][inputs["input_ids"].shape[-1]:])) - Notebooks
- Google Colab
- Kaggle
- Local Apps Settings
- vLLM
How to use gsarch/Persistent-Exploration-Gemma4-E4B with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "gsarch/Persistent-Exploration-Gemma4-E4B" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "gsarch/Persistent-Exploration-Gemma4-E4B", "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/gsarch/Persistent-Exploration-Gemma4-E4B
- SGLang
How to use gsarch/Persistent-Exploration-Gemma4-E4B 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 "gsarch/Persistent-Exploration-Gemma4-E4B" \ --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": "gsarch/Persistent-Exploration-Gemma4-E4B", "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 "gsarch/Persistent-Exploration-Gemma4-E4B" \ --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": "gsarch/Persistent-Exploration-Gemma4-E4B", "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 gsarch/Persistent-Exploration-Gemma4-E4B with Docker Model Runner:
docker model run hf.co/gsarch/Persistent-Exploration-Gemma4-E4B
Download eval/gemma4_visual_probe.json from gsarch/Persistent-Exploration-Gemma4-E4B: direct link, hf CLI and curl.
- Browser
- Download file 3.73 kB
-
https://huggingface.co/gsarch/Persistent-Exploration-Gemma4-E4B/resolve/main/eval/gemma4_visual_probe.json
- Command line
-
hf download hf://gsarch/Persistent-Exploration-Gemma4-E4B/eval/gemma4_visual_probe.json
-
curl -L -o gemma4_visual_probe.json https://huggingface.co/gsarch/Persistent-Exploration-Gemma4-E4B/resolve/main/eval/gemma4_visual_probe.json
3.73 kB
| { | |
| "format": "vero-gemma4-visual-probe-v1", | |
| "system_prompt": "You are a visual search assistant. Inspect the image carefully and answer the user's question using visible evidence.\nUse image_zoom_in_tool when a closer view would help. You may make multiple zoom calls, or answer directly when the evidence is already clear. Do not invent details that you cannot see.\nFor image_zoom_in_tool, bbox_2d is [y1, x1, y2, x2] on a 1000x1000 coordinate grid relative to the selected image dimensions: y1 and y2 are vertical positions divided by image height and multiplied by 1000; x1 and x2 are horizontal positions divided by image width and multiplied by 1000. y increases top to bottom and x increases left to right. Choose y1 < y2 and x1 < x2. label is a short description of the region. img_idx is the image index; the original image is img_idx 0. Tool-returned crops are assigned new image indices that are stated in the tool response. You may zoom into any available image index.\nWhen you have enough evidence, put your final answer in <answer>...</answer>. Inside the tags, give only a short, specific answer to the question. Do not put tool calls inside the answer tags.", | |
| "tool_schema": { | |
| "type": "function", | |
| "function": { | |
| "name": "image_zoom_in_tool", | |
| "description": "Zoom in on a region of an available image using a bounding box and a short label.", | |
| "parameters": { | |
| "type": "object", | |
| "properties": { | |
| "bbox_2d": { | |
| "type": "array", | |
| "items": { | |
| "type": "number" | |
| }, | |
| "minItems": 4, | |
| "maxItems": 4, | |
| "description": "[y1, x1, y2, x2] on a 1000x1000 grid relative to the selected image dimensions; y increases downward and x increases rightward." | |
| }, | |
| "label": { | |
| "type": "string", | |
| "description": "A short description of the region." | |
| }, | |
| "img_idx": { | |
| "type": "integer", | |
| "description": "Index of the selected image; the original is 0, and crop indices are stated in tool responses." | |
| } | |
| }, | |
| "required": [ | |
| "bbox_2d", | |
| "label", | |
| "img_idx" | |
| ] | |
| } | |
| } | |
| }, | |
| "image_indexing": "multi_index", | |
| "data": { | |
| "max_response_length": 24576 | |
| }, | |
| "multi_turn": { | |
| "max_assistant_turns": 11, | |
| "max_user_turns": 10, | |
| "max_assistant_tokens_per_turn": 4096, | |
| "max_parallel_calls": 1, | |
| "max_tool_response_length": 256, | |
| "tool_response_truncate_side": "middle", | |
| "final_answer_token_margin": 2048, | |
| "force_tool_calls_until_final_turn": false, | |
| "force_answer_on_final_turn_validation": true, | |
| "force_final_answer_think_prefill": "This is the final turn, so I need to answer from the evidence gathered so far.", | |
| "conditional_answer_retry_critic_enable_validation": true, | |
| "conditional_answer_retry_critic_decision_threshold": 0.5, | |
| "conditional_answer_retry_critic_question": "Assuming another tool round is available, should the preceding candidate be accepted or retried? In the <answer> block, output only \"A\" or \"R\".", | |
| "conditional_answer_retry_critic_assistant_prefill": "<|channel>thought\nI need to classify whether the preceding candidate should be accepted or retried.\n<channel|><answer>\n", | |
| "conditional_answer_retry_assistant_prefill": "Let’s see. I still don’t have decisive evidence, so I should inspect a substantially different region. If one area looks especially promising, I can examine it more closely, but I should look elsewhere once further zooming stops revealing new evidence." | |
| }, | |
| "chat_template_sha256": "d016739040e2f073d7505fecdab8f7239a417ba4f22919bb8abb3e4331218ceb" | |
| } | |