Views
No views yet




docker run -it --gpus all kwaikeye/kwai-keye-vl:keye_vl_v2_30b_a3b1# SGLang (custom branch)
2git clone -b keye-vl-v2-30b-release https://github.com/Kwai-Keye/sglang.git
3cd sglang
4pip install -e python[all]
5cd ..
6
7# DeepGEMM (Keye support branch)
8git clone -b keye_support https://github.com/Kwai-Keye/DeepGEMM.git
9cd DeepGEMM
10bash install.sh
11cd ..
12
13# EffectiveKernels
14git clone https://github.com/Kwai-Keye/EffectiveKernels.git
15cd EffectiveKernels
16pip install -e . --no-deps --no-build-isolation
17cd ..1python3 -m sglang.launch_server \
2 --model-path=MODEL_NAME \
3 --tp-size=2 \
4 --trust-remote-code \
5 --mem-fraction-static=0.8temperature, top_k, and others, are provided for demonstration purposes only and should not be treated as recommended settings. Users are encouraged to experiment with and adjust these parameters based on their own needs.min_pixels and max_pixels can be used to set the lower and upper token limits for each frame, while video_total_pixels can be used to limit the total token budget of the entire video input.fps is not specified, the default value is 2.0.1import json
2import requests
3
4BASE_URL = "http://MASTER_NODE_IP:8000"
5
6def generate(messages):
7 payload = {
8 "model": "",
9 "messages": messages,
10 "n": 1,
11 "temperature": 0.0,
12 "max_tokens": 256,
13 "top_k": 1,
14 "ignore_eos": False,
15 "skip_special_tokens": True,
16 }
17 resp = requests.post(
18 f"{BASE_URL}/v1/chat/completions",
19 headers={"Content-Type": "application/json"},
20 data=json.dumps(payload),
21 timeout=1800,
22 )
23 resp.raise_for_status()
24 return resp.json()
25
26# Example: image + text
27messages = [
28 {
29 "role": "user",
30 "content": [
31 {
32 "type": "image_url",
33 "image_url": {"url": "https://raw.githubusercontent.com/sgl-project/sglang/main/assets/logo.png"},
34 },
35 {"type": "text", "text": "Describe this image in detail."},
36 ],
37 }
38]
39
40result = generate(messages)
41print(result["choices"][0]["message"]["content"])1import json
2import requests
3
4BASE_URL = "http://MASTER_NODE_IP:8000"
5
6def generate(messages):
7 payload = {
8 "model": "",
9 "messages": messages,
10 "n": 1,
11 "temperature": 0.1,
12 "max_tokens": 32760,
13 "top_p": 0.001,
14 "ignore_eos": False,
15 "skip_special_tokens": True,
16 }
17 resp = requests.post(
18 f"{BASE_URL}/v1/chat/completions",
19 headers={"Content-Type": "application/json"},
20 data=json.dumps(payload),
21 timeout=1800,
22 )
23 resp.raise_for_status()
24 return resp.json()
25
26# Example: Video + text
27messages = [
28 {
29 "role": "user",
30 "content": [
31 {
32 "type": "video_url",
33 "video_url": {
34 "url": video_url,
35 "preprocess_kwargs": {
36 "fps": 2.0,
37 "min_pixels": 128*28*28,
38 "max_pixels": 512*28*28,
39 "video_total_pixels":180*1024*28*28,
40 }
41 },
42 },
43 {"type": "text", "text": "Describe this video."},
44 ],
45 },
46]
47
48result = generate(messages)
49print(result["choices"][0]["message"]["content"])