Open idtaichangle opened 5 months ago
您使用的 'model': 'qwen1.5_1.8b' 我在ollama上找不到(只能找到 'qwen:1.8b'),请问是自行制作的版本吗?
我这边测试 'qwen:1.8b',会触发调用工具的操作(虽然工具入参写得不太对。。)
您使用的 'model': 'qwen1.5_1.8b' 我在ollama上找不到(只能找到 'qwen:1.8b'),请问是自行制作的版本吗?
我这边测试 'qwen:1.8b',会触发调用工具的操作(虽然工具入参写得不太对。。) @JianxinMa 我从https://www.modelscope.cn/models/qwen/Qwen1.5-1.8B-Chat 这里下载的模型,然后ollama部署的。
您使用的 'model': 'qwen1.5_1.8b' 我在ollama上找不到(只能找到 'qwen:1.8b'),请问是自行制作的版本吗?
我这边测试 'qwen:1.8b',会触发调用工具的操作(虽然工具入参写得不太对。。)
@JianxinMa 我调试了一下。不管是调用qwen-max还是本地部署的qwen:1.8b,在准备prompt阶段都生成了一样的prompt。但是返回结果不一样。qwen-max返回了function call,列出了要调用的函数名称。本地部署的qwen1.5_1.8b没有返回要调用的函数名称。
prompt如下:
[{'role': 'system', 'content': '你扮演一个天气预报助手,你具有查询天气和画图能力。你需要查询相应地区的天气。
# 工具
## 你拥有如下工具:
### my_image_gen
my_image_gen: AI绘画(图像生成)服务,输入文本描述和图像分辨率,返回根据文本信息绘制的图片URL。 输入参数:[{name: prompt, type: string, description: 详细描述了希望生成的图像具有什么内容,例如人物、环境、动作等细节描述,使用英文, required: true}] 此工具的输入应为JSON对象。
### amap_weather
amap_weather: 获取对应城市的天气数据 输入参数:[{name: location, type: string, description: get temperature for a specific location, required: true}] 此工具的输入应为JSON对象。
## 你可以在回复中插入零次、一次或多次以下命令以调用工具:
✿FUNCTION✿: 工具名称,必须是[my_image_gen,amap_weather]之一。
✿ARGS✿: 工具输入
✿RESULT✿: 工具结果,需将图片用 根据工具结果进行回复'}, {'role': 'user', 'content': '2024.04.28北京市天气'}]
您使用的 'model': 'qwen1.5_1.8b' 我在ollama上找不到(只能找到 'qwen:1.8b'),请问是自行制作的版本吗? 我这边测试 'qwen:1.8b',会触发调用工具的操作(虽然工具入参写得不太对。。)
@JianxinMa 我调试了一下。不管是调用qwen-max还是本地部署的qwen:1.8b,在准备prompt阶段都生成了一样的prompt。但是返回结果不一样。qwen-max返回了function call,列出了要调用的函数名称。本地部署的qwen1.5_1.8b没有返回要调用的函数名称。
prompt如下:
[{'role': 'system', 'content': '你扮演一个天气预报助手,你具有查询天气和画图能力。你需要查询相应地区的天气。 # 工具 ## 你拥有如下工具: ### my_image_gen my_image_gen: AI绘画(图像生成)服务,输入文本描述和图像分辨率,返回根据文本信息绘制的图片URL。 输入参数:[{name: prompt, type: string, description: 详细描述了希望生成的图像具有什么内容,例如人物、环境、动作等细节描述,使用英文, required: true}] 此工具的输入应为JSON对象。 ### amap_weather amap_weather: 获取对应城市的天气数据 输入参数:[{name: location, type: string, description: get temperature for a specific location, required: true}] 此工具的输入应为JSON对象。 ## 你可以在回复中插入零次、一次或多次以下命令以调用工具: ✿FUNCTION✿: 工具名称,必须是[my_image_gen,amap_weather]之一。 ✿ARGS✿: 工具输入 ✿RESULT✿: 工具结果,需将图片用 根据工具结果进行回复'}, {'role': 'user', 'content': '2024.04.28北京市天气'}]
方便用ollama官方提供的1.8b测试下吗?ollama run qwen:1.8b
之类的。我目前不太确定modelscope提供的是否有问题。我其实不太熟悉怎么用ollama load modelscope提供的ckpt —— 您是拉取了modelscope的gguf,然后用ollama load吗?
方便用ollama官方提供的1.8b测试下吗?
ollama run qwen:1.8b
之类的。 @JianxinMa
ollama run qwen:1.8b 拉下来的模型可以。。。为啥本地部署的不行。 我本地部署的步骤如下:
cd ~
git clone https://www.modelscope.cn/models/qwen/Qwen1.5-1.8B-Chat
git clone https://github.com/ggerganov/llama.cpp
python llama.cpp/convert-hf-to-gguf.py ~/Qwen1.5-1.8B-Chat #生成ggml-model-f16.gguf
创建ollama的Modelfile:
FROM ~/Qwen1.5-1.8B-Chat/ggml-model-f16.gguf
...
然后启动ollama
convert-hf-to-gguf.py
请问您的convert-hf-to-gguf.py是最新版本的吗?我印象里第一版是有bug的,后面修复了。
convert-hf-to-gguf.py
请问您的convert-hf-to-gguf.py是最新版本的吗?我印象里第一版是有bug的,后面修复了。
@JianxinMa 是最新版的。前几天下载的,今天又update了。
怀疑是“创建ollama的Modelfile”这一步操作不对,可能不仅仅要提供gguf,还需要提供chat template等等其他信息。(但我也不懂ollama的modelfile怎么创建其实,ollama上的qwen好像是ollama的人帮忙弄的。)
@JianxinMa 这个是完整的Modelfile
FROM ~/llm-study/Qwen1.5-1.8B-Chat/ggml-model-f16.gguf
# set the temperature to 1 [higher is more creative, lower is more coherent]
PARAMETER temperature 0.7
PARAMETER top_p 0.8
PARAMETER repeat_penalty 1.05
PARAMETER top_k 20
TEMPLATE """{{ if and .First .System }}<|im_start|>system
{{ .System }}<|im_end|>
{{ end }}<|im_start|>user
{{ .Prompt }}<|im_end|>
<|im_start|>assistant
{{ .Response }}"""
# set the system message
SYSTEM """
You are a helpful assistant.
"""
看着没什么问题,1.8b的超参数稍有不同,check generation_config。我测了q4_k_m的gguf,也是正常输出agent的内容。
FROM <path_to_gguf>
TEMPLATE """{{ if .System }}<|im_start|>system
{{ .System }}<|im_end|>
{{ end }}{{ if .Prompt }}<|im_start|>user
{{ .Prompt }}<|im_end|>
{{ end }}<|im_start|>assistant
"""
SYSTEM """You are a helpful assistant"""
PARAMETER stop <|im_start|>
PARAMETER stop <|im_end|>
PARAMETER stop <|endoftext|>
PARAMETER top_p 0.8
PARAMETER temperature 1.1
以Qwen-Agent/examples/assistant_weather_bot.py为例。 用qwen-max模型,提问是:2024.04.25北京市的天气。可以调用天气api,正常返回结果。配置如下:
我在本地用ollama部署了qwen1.5_1.8B。 使用以下配置:
同样的提问,模型返回的结果是: 抱歉,我无法提供北京市当前(2024年4月25日)的天气信息。.....