Image-Text-to-Text
Transformers
Safetensors
English
ad_copilot
anomaly-detection
vision-language-model
qwen2.5-vl
conversational
custom_code
Instructions to use jiang-cc/AD-Copilot with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use jiang-cc/AD-Copilot with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("image-text-to-text", model="jiang-cc/AD-Copilot", trust_remote_code=True) 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 AutoModelForImageTextToText model = AutoModelForImageTextToText.from_pretrained("jiang-cc/AD-Copilot", trust_remote_code=True, device_map="auto") - Notebooks
- Google Colab
- Kaggle
- Local Apps Settings
- vLLM
How to use jiang-cc/AD-Copilot with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "jiang-cc/AD-Copilot" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "jiang-cc/AD-Copilot", "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/jiang-cc/AD-Copilot
- SGLang
How to use jiang-cc/AD-Copilot 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 "jiang-cc/AD-Copilot" \ --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": "jiang-cc/AD-Copilot", "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 "jiang-cc/AD-Copilot" \ --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": "jiang-cc/AD-Copilot", "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 jiang-cc/AD-Copilot with Docker Model Runner:
docker model run hf.co/jiang-cc/AD-Copilot
fix: fallback import for Qwen2RMSNorm compatibility across transformers versions
Browse files- modeling_ad_copilot.py +5 -2
modeling_ad_copilot.py
CHANGED
|
@@ -8,10 +8,13 @@ from transformers import Qwen2_5_VLForConditionalGeneration, AutoModelForImageTe
|
|
| 8 |
from transformers.models.qwen2_5_vl.modeling_qwen2_5_vl import (
|
| 9 |
Qwen2_5_VisionTransformerPretrainedModel,
|
| 10 |
Qwen2_5_VLModel,
|
| 11 |
-
Qwen2RMSNorm,
|
| 12 |
Qwen2_5_VLMLP,
|
| 13 |
-
ALL_ATTENTION_FUNCTIONS
|
| 14 |
)
|
|
|
|
|
|
|
|
|
|
|
|
|
| 15 |
from transformers.image_utils import ImageInput
|
| 16 |
from transformers.tokenization_utils import TextInput, PreTokenizedInput
|
| 17 |
from transformers.video_utils import VideoInput
|
|
|
|
| 8 |
from transformers.models.qwen2_5_vl.modeling_qwen2_5_vl import (
|
| 9 |
Qwen2_5_VisionTransformerPretrainedModel,
|
| 10 |
Qwen2_5_VLModel,
|
|
|
|
| 11 |
Qwen2_5_VLMLP,
|
| 12 |
+
ALL_ATTENTION_FUNCTIONS,
|
| 13 |
)
|
| 14 |
+
try:
|
| 15 |
+
from transformers.models.qwen2_5_vl.modeling_qwen2_5_vl import Qwen2RMSNorm
|
| 16 |
+
except ImportError:
|
| 17 |
+
from transformers.models.qwen2.modeling_qwen2 import Qwen2RMSNorm
|
| 18 |
from transformers.image_utils import ImageInput
|
| 19 |
from transformers.tokenization_utils import TextInput, PreTokenizedInput
|
| 20 |
from transformers.video_utils import VideoInput
|