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: robust imports with fallbacks for transformers version compatibility
Browse files- modeling_ad_copilot.py +21 -5
modeling_ad_copilot.py
CHANGED
|
@@ -15,13 +15,29 @@ 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 |
-
|
| 19 |
-
from transformers.
|
| 20 |
-
|
| 21 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 22 |
|
| 23 |
from transformers import Qwen2_5_VLProcessor, Qwen2_5_VLConfig
|
| 24 |
-
|
|
|
|
|
|
|
|
|
|
| 25 |
|
| 26 |
class ADCopilotConfig(Qwen2_5_VLConfig):
|
| 27 |
model_type = "ad_copilot"
|
|
|
|
| 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 |
+
try:
|
| 19 |
+
from transformers.image_utils import ImageInput
|
| 20 |
+
except ImportError:
|
| 21 |
+
ImageInput = Any
|
| 22 |
+
try:
|
| 23 |
+
from transformers.tokenization_utils import TextInput, PreTokenizedInput
|
| 24 |
+
except ImportError:
|
| 25 |
+
TextInput = str
|
| 26 |
+
PreTokenizedInput = list
|
| 27 |
+
try:
|
| 28 |
+
from transformers.video_utils import VideoInput
|
| 29 |
+
except ImportError:
|
| 30 |
+
VideoInput = Any
|
| 31 |
+
try:
|
| 32 |
+
from transformers.feature_extraction_utils import BatchFeature
|
| 33 |
+
except ImportError:
|
| 34 |
+
from transformers import BatchFeature
|
| 35 |
|
| 36 |
from transformers import Qwen2_5_VLProcessor, Qwen2_5_VLConfig
|
| 37 |
+
try:
|
| 38 |
+
from transformers.models.qwen2_5_vl.processing_qwen2_5_vl import Qwen2_5_VLProcessorKwargs
|
| 39 |
+
except ImportError:
|
| 40 |
+
Qwen2_5_VLProcessorKwargs = dict
|
| 41 |
|
| 42 |
class ADCopilotConfig(Qwen2_5_VLConfig):
|
| 43 |
model_type = "ad_copilot"
|