Safetensors
qwen2

尝试在glhf.chat中运行失败

#1
by anrgct - opened

我尝试在glhf网站跑这个模型,报错提示“model.safetensors.index.json in FuseAI/FuseO1-QwQ-DeepSeekR1-LightR1-32B is invalid: missing key 'total_size'”。
我下载量化版本q6_k在lmstudio中运行,模型的响应没有<think>开头,而且有奇怪的<|box_end|>符号作为</think>结束标记

Q:你好
A:好的,用户发来了“你好”,看起来是想打招呼或者开始对话。我需要回应友好,同时保持专业和自然。\n\n首先,回复“你好”是最直接的回应,这样可以立即让用户感受到被接待。接下来,应该表达愿意提供帮助的态度,比如“有什么我可以帮你的吗?”这样的话语能鼓励用户进一步说明需求。\n\n还要注意语气要亲切,避免使用过于正式或生硬的语言。保持简洁明了,不让用户感到压力或者困惑。同时,准备好根据用户的后续问题调整回应方式,确保能够有效解决问题。\n\n总的来说,就是要通过简短而温暖的回复,让用户感受到支持和帮助的热情。\n<|box_end|>\n\n你好!有什么我可以帮你的吗?
lmstudio中设置的jinjia模板
{%- if tools %}  
    {{- '<|im_start|>system\n' }}  
    {%- if messages[0]['role'] == 'system' %}  
        {{- messages[0]['content'] }}  
    {%- else %}  
        {{- '' }}  
    {%- endif %}  
    {{- "\n\n# Tools\n\nYou may call one or more functions to assist with the user query.\n\nYou are provided with function signatures within <tools></tools> XML tags:\n<tools>" }}  
    {%- for tool in tools %}  
        {{- "\n" }}  
        {{- tool | tojson }}  
    {%- endfor %}  
    {{- "\n</tools>\n\nFor each function call, return a json object with function name and arguments within <tool_call></tool_call> XML tags:\n<tool_call>\n{\"name\": <function-name>, \"arguments\": <args-json-object>}\n</tool_call><|im_end|>\n" }}  
{%- else %}  
    {%- if messages[0]['role'] == 'system' %}  
        {{- '<|im_start|>system\n' + messages[0]['content'] + '<|im_end|>\n' }}  
    {%- endif %}  
{%- endif %}  
{%- for message in messages %}  
    {%- if (message.role == "user") or (message.role == "system" and not loop.first) %}  
        {{- '<|im_start|>' + message.role + '\n' + message.content + '<|im_end|>' + '\n' }}  
    {%- elif message.role == "assistant" and not message.tool_calls %}  
        {%- set content = (message.content.split('</think>')|last).lstrip('\n') %}  
        {{- '<|im_start|>' + message.role + '\n' + content + '<|im_end|>' + '\n' }}  
    {%- elif message.role == "assistant" %}  
        {%- set content = (message.content.split('</think>')|last).lstrip('\n') %}  
        {{- '<|im_start|>' + message.role }}  
        {%- if message.content %}  
            {{- '\n' + content }}  
        {%- endif %}  
        {%- for tool_call in message.tool_calls %}  
            {%- if tool_call.function is defined %}  
                {%- set tool_call = tool_call.function %}  
            {%- endif %}  
            {{- '\n<tool_call>\n{"name": "' }}  
            {{- tool_call.name }}  
            {{- '", "arguments": ' }}  
            {{- tool_call.arguments | tojson }}  
            {{- '}\n</tool_call>' }}  
        {%- endfor %}  
        {{- '<|im_end|>\n' }}  
    {%- elif message.role == "tool" %}  
        {%- if (loop.index0 == 0) or (messages[loop.index0 - 1].role != "tool") %}  
            {{- '<|im_start|>user' }}  
        {%- endif %}  
        {{- '\n<tool_response>\n' }}  
        {{- message.content }}  
        {{- '\n</tool_response>' }}  
        {%- if loop.last or (messages[loop.index0 + 1].role != "tool") %}  
            {{- '<|im_end|>\n' }}  
        {%- endif %}  
    {%- endif %}  
{%- endfor %}  
{%- if add_generation_prompt %}  
    {{- '<|im_start|>assistant\n<think>\n' }}  
{%- endif %}

我发现替换模板思考标签<think></think> 为 <|box_start|><|box_end|> 可以在lmstudio中正常使用

{%- if tools %}  
    {{- '<|im_start|>system\n' }}  
    {%- if messages[0]['role'] == 'system' %}  
        {{- messages[0]['content'] }}  
    {%- else %}  
        {{- '' }}  
    {%- endif %}  
    {{- "\n\n# Tools\n\nYou may call one or more functions to assist with the user query.\n\nYou are provided with function signatures within <tools></tools> XML tags:\n<tools>" }}  
    {%- for tool in tools %}  
        {{- "\n" }}  
        {{- tool | tojson }}  
    {%- endfor %}  
    {{- "\n</tools>\n\nFor each function call, return a json object with function name and arguments within <tool_call></tool_call> XML tags:\n<tool_call>\n{\"name\": <function-name>, \"arguments\": <args-json-object>}\n</tool_call><|im_end|>\n" }}  
{%- else %}  
    {%- if messages[0]['role'] == 'system' %}  
        {{- '<|im_start|>system\n' + messages[0]['content'] + '<|im_end|>\n' }}  
    {%- endif %}  
{%- endif %}  
{%- for message in messages %}  
    {%- if (message.role == "user") or (message.role == "system" and not loop.first) %}  
        {{- '<|im_start|>' + message.role + '\n' + message.content + '<|im_end|>' + '\n' }}  
    {%- elif message.role == "assistant" and not message.tool_calls %}  
        {%- set content = (message.content.split('<|box_end|>')|last).lstrip('\n') %}  
        {{- '<|im_start|>' + message.role + '\n' + content + '<|im_end|>' + '\n' }}  
    {%- elif message.role == "assistant" %}  
        {%- set content = (message.content.split('<|box_end|>')|last).lstrip('\n') %}  
        {{- '<|im_start|>' + message.role }}  
        {%- if message.content %}  
            {{- '\n' + content }}  
        {%- endif %}  
        {%- for tool_call in message.tool_calls %}  
            {%- if tool_call.function is defined %}  
                {%- set tool_call = tool_call.function %}  
            {%- endif %}  
            {{- '\n<tool_call>\n{"name": "' }}  
            {{- tool_call.name }}  
            {{- '", "arguments": ' }}  
            {{- tool_call.arguments | tojson }}  
            {{- '}\n</tool_call>' }}  
        {%- endfor %}  
        {{- '<|im_end|>\n' }}  
    {%- elif message.role == "tool" %}  
        {%- if (loop.index0 == 0) or (messages[loop.index0 - 1].role != "tool") %}  
            {{- '<|im_start|>user' }}  
        {%- endif %}  
        {{- '\n<tool_response>\n' }}  
        {{- message.content }}  
        {{- '\n</tool_response>' }}  
        {%- if loop.last or (messages[loop.index0 + 1].role != "tool") %}  
            {{- '<|im_end|>\n' }}  
        {%- endif %}  
    {%- endif %}  
{%- endfor %}  
{%- if add_generation_prompt %}  
    {{- '<|im_start|>assistant\n<|box_start|>' }}  
{%- endif %}

@bartowski , can you upload a gguf model of imatrix? Use the template I provided above.

Your need to confirm your account before you can post a new comment.

Sign up or log in to comment