Image-Text-to-Text
Transformers
Safetensors
qwen3_5_moe
qwen
qwen3
vlm
Mixture of Experts
dpo
uncensored
abliterated
refusal-ablation
fp16
vision
conversational
Instructions to use lxz8798/qwen3.6-35b-moe-kuato-base with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use lxz8798/qwen3.6-35b-moe-kuato-base with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("image-text-to-text", model="lxz8798/qwen3.6-35b-moe-kuato-base") 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, AutoModelForMultimodalLM processor = AutoProcessor.from_pretrained("lxz8798/qwen3.6-35b-moe-kuato-base") model = AutoModelForMultimodalLM.from_pretrained("lxz8798/qwen3.6-35b-moe-kuato-base", 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=40) print(processor.decode(outputs[0][inputs["input_ids"].shape[-1]:])) - Notebooks
- Google Colab
- Kaggle
- Local Apps Settings
- vLLM
How to use lxz8798/qwen3.6-35b-moe-kuato-base with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "lxz8798/qwen3.6-35b-moe-kuato-base" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "lxz8798/qwen3.6-35b-moe-kuato-base", "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/lxz8798/qwen3.6-35b-moe-kuato-base
- SGLang
How to use lxz8798/qwen3.6-35b-moe-kuato-base 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 "lxz8798/qwen3.6-35b-moe-kuato-base" \ --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": "lxz8798/qwen3.6-35b-moe-kuato-base", "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 "lxz8798/qwen3.6-35b-moe-kuato-base" \ --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": "lxz8798/qwen3.6-35b-moe-kuato-base", "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 lxz8798/qwen3.6-35b-moe-kuato-base with Docker Model Runner:
docker model run hf.co/lxz8798/qwen3.6-35b-moe-kuato-base
Update handler.py
Browse files- handler.py +16 -1
handler.py
CHANGED
|
@@ -1,9 +1,24 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
import torch
|
| 2 |
from transformers import AutoModelForCausalLM, AutoTokenizer
|
| 3 |
|
| 4 |
class EndpointHandler:
|
| 5 |
def __init__(self, path=""):
|
| 6 |
-
# 1.
|
| 7 |
self.tokenizer = AutoTokenizer.from_pretrained(path, trust_remote_code=True)
|
| 8 |
self.model = AutoModelForCausalLM.from_pretrained(
|
| 9 |
path,
|
|
|
|
| 1 |
+
import subprocess
|
| 2 |
+
import sys
|
| 3 |
+
|
| 4 |
+
# 🚀 强制在代码运行最开始,从 PyPI 热升级 transformers 和 accelerate 到最新版本
|
| 5 |
+
try:
|
| 6 |
+
print("Starting hot-upgrade of transformers and accelerate...")
|
| 7 |
+
subprocess.run(
|
| 8 |
+
[sys.executable, "-m", "pip", "install", "--upgrade", "transformers", "accelerate", "--user"],
|
| 9 |
+
check=True
|
| 10 |
+
)
|
| 11 |
+
print("Hot-upgrade completed successfully!")
|
| 12 |
+
except Exception as e:
|
| 13 |
+
print(f"Warning during hot-upgrade: {e}")
|
| 14 |
+
|
| 15 |
+
# ----------------- 升级完成后再导入库 -----------------
|
| 16 |
import torch
|
| 17 |
from transformers import AutoModelForCausalLM, AutoTokenizer
|
| 18 |
|
| 19 |
class EndpointHandler:
|
| 20 |
def __init__(self, path=""):
|
| 21 |
+
# 1. 使用 trust_remote_code=True 加载 Tokenizer 和 Model
|
| 22 |
self.tokenizer = AutoTokenizer.from_pretrained(path, trust_remote_code=True)
|
| 23 |
self.model = AutoModelForCausalLM.from_pretrained(
|
| 24 |
path,
|