ztxz16 / fastllm

纯c++的全平台llm加速库,支持python调用,chatglm-6B级模型单卡可达10000+token / s,支持glm, llama, moss基座,手机端流畅运行
Apache License 2.0
3.28k stars 332 forks source link

报告一个chatGLM3 function_call的bugs #408

Closed aofengdaxia closed 7 months ago

aofengdaxia commented 7 months ago

在chatGLM调用function call的时候,除了返回调用代码以后,还返回了一个<|observation|>标签。然后在chatGLM的官方代码中,他们使用了以下代码进行了过滤

response = tokenizer.decode(output_ids)
        if response and response[-1] != "�":
            response, stop_found = apply_stopping_strings(response, ["<|observation|>"])

            yield {
                "text": response,
                "usage": {
                    "prompt_tokens": input_echo_len,
                    "completion_tokens": total_len - input_echo_len,
                    "total_tokens": total_len,
                },
                "finish_reason": "function_call" if stop_found else None,
            }

            if stop_found:
                break

在使用fastllm的时候,返回的结果中,貌似把<|observation|>标签给过滤掉了。

aofengdaxia commented 7 months ago

使用stop_token_ids已经解决