Views
No views yet
1pip install "sglang[all]>=0.4.9"
2
3python3 -m sglang.launch_server --model Zhihu-ai/Zhi-Create-Qwen3-32B --speculative-algorithm EAGLE3 --speculative-draft-model-path Zhihu-ai/Zhi-Create-Qwen3-32B-Eagle3 --speculative-num-steps 3 --speculative-eagle-topk 2 --speculative-num-draft-tokens 8 --tp 2 --port 8000 --dtype bfloat16 --reasoning-parser deepseek-r1 --served-model-name Zhi-Create-Qwen3-32B
4
5# send request
6curl http://localhost:8000/v1/completions \
7 -H "Content-Type: application/json" \
8 -d '{
9 "model": "Zhi-Create-Qwen3-32B",
10 "prompt": "请你以鲁迅的口吻,写一篇介绍西湖醋鱼的文章",
11 "max_tokens": 4096,
12 "temperature": 0.6,
13 "top_p": 0.95
14 }'1# Alternative: Using OpenAI API
2from openai import OpenAI
3openai_api_key = "empty"
4openai_api_base = "http://127.0.0.1:8000/v1"
5
6client = OpenAI(
7 api_key=openai_api_key,
8 base_url=openai_api_base
9)
10
11def get_answer(messages):
12 response = client.chat.completions.create(
13 messages=messages,
14 model="Zhi-Create-Qwen3-32B",
15 max_tokens=4096,
16 temperature=0.3,
17 top_p=0.95,
18 stream=True,
19 extra_body = {"chat_template_kwargs": {"enable_thinking": True}}
20 )
21 answer = ""
22 reasoning_content_all = ""
23 for each in response:
24 each_content = each.choices[0].delta.content
25 if hasattr(each.choices[0].delta, "content"):
26 each_content = each.choices[0].delta.content
27 else:
28 each_content = None
29 if hasattr(each.choices[0].delta, "reasoning_content"):
30 reasoning_content = each.choices[0].delta.reasoning_content
31 else:
32 reasoning_content = None
33 if each_content is not None:
34 answer += each_content
35 print(each_content, end="", flush=True)
36 if reasoning_content is not None:
37 reasoning_content_all += reasoning_content
38 print(reasoning_content, end="", flush=True)
39 return answer, reasoning_content_all
40
41prompt = "请你以鲁迅的口吻,写一篇介绍西湖醋鱼的文章"
42messages = [
43 {"role": "user", "content": prompt}
44]
45
46answer, reasoning_content_all = get_answer(messages)