Views
No views yet
1from transformers import AutoModelForCausalLM, AutoTokenizer
2from transformers.generation import GenerationConfig
3
4tokenizer = AutoTokenizer.from_pretrained("kwaikeg/kagentlms_qwen_7b_mat", trust_remote_code=True)
5
6model = AutoModelForCausalLM.from_pretrained(
7 "kwaikeg/kagentlms_qwen_7b_mat",
8 device_map="auto",
9 trust_remote_code=True
10).eval()
11
12response, history = model.chat(tokenizer, "你好", history=None)
13print(response)1pip install vllm
2pip install "fschat[model_worker,webui]"python -m fastchat.serve.controllerpython -m fastchat.serve.vllm_worker --model-path $model_path --trust-remote-code$model_path is the local path of the model downloaded. If the GPU does not support Bfloat16, you can add --dtype half to the command line.python -m fastchat.serve.openai_api_server --host localhost --port 88881curl http://localhost:8888/v1/chat/completions \
2-H "Content-Type: application/json" \
3-d '{"model": "kagentlms_qwen_7b_mat", "messages": [{"role": "user", "content": "Who is Andy Lau"}]}'1pip install "llama-cpp-python[server]"
2python3 -m llama_cpp.server --model kagentlms_qwen_7b_mat_gguf/ggml-model-q4_0.gguf --chat_format chatml --port 8888@article{pan2023kwaiagents,
author = {Haojie Pan and
Zepeng Zhai and
Hao Yuan and
Yaojia Lv and
Ruiji Fu and
Ming Liu and
Zhongyuan Wang and
Bing Qin
},
title = {KwaiAgents: Generalized Information-seeking Agent System with Large Language Models},
journal = {CoRR},
volume = {abs/2312.04889},
year = {2023}
}