Instructions to use NeilLeeNTU/PhotoGuider-explainer-nf4 with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use NeilLeeNTU/PhotoGuider-explainer-nf4 with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("image-text-to-text", model="NeilLeeNTU/PhotoGuider-explainer-nf4") 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("NeilLeeNTU/PhotoGuider-explainer-nf4") model = AutoModelForMultimodalLM.from_pretrained("NeilLeeNTU/PhotoGuider-explainer-nf4", 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 NeilLeeNTU/PhotoGuider-explainer-nf4 with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "NeilLeeNTU/PhotoGuider-explainer-nf4" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "NeilLeeNTU/PhotoGuider-explainer-nf4", "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/NeilLeeNTU/PhotoGuider-explainer-nf4
- SGLang
How to use NeilLeeNTU/PhotoGuider-explainer-nf4 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 "NeilLeeNTU/PhotoGuider-explainer-nf4" \ --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": "NeilLeeNTU/PhotoGuider-explainer-nf4", "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 "NeilLeeNTU/PhotoGuider-explainer-nf4" \ --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": "NeilLeeNTU/PhotoGuider-explainer-nf4", "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 NeilLeeNTU/PhotoGuider-explainer-nf4 with Docker Model Runner:
docker model run hf.co/NeilLeeNTU/PhotoGuider-explainer-nf4
PhotoGuider explainer base, NF4
The base model of the PhotoGuider explainer:
Qwen/Qwen2.5-VL-7B-Instruct
(revision cc594898137f460bfe9f0759e9844b3ce807cfb5) quantized once with bitsandbytes to 4-bit NF4
(bnb_4bit_compute_dtype=bfloat16, llm_int8_skip_modules=["visual", "lm_head"]), exactly the
configuration PhotoGuider applies when it loads the bf16 checkpoint. Loading these weights reads
6 GB instead of quantizing the 16 GB checkpoint on every load; the generated explanations are
identical token for token.
PhotoGuider adds its released LoRA adapter on top (tools/download_explainer.sh in the repository)
and decodes greedily. This repository contains no adapter and no training data. The model card,
license and acceptable-use terms of the base model apply unchanged.
# inside a PhotoGuider checkout
envs/explainer/venv/bin/python tools/download_explainer_nf4.py
- Downloads last month
- 34
Model tree for NeilLeeNTU/PhotoGuider-explainer-nf4
Base model
Qwen/Qwen2.5-VL-7B-Instruct