首页
学习
活动
专区
工具
TVP
发布
精选内容/技术社群/优惠产品,尽在小程序
立即前往

QwQ-32B开源!欲与DeepSeek-R1-671B试比高

模型介绍

QwQ-32B 在一系列基准测试中进行了评估,测试了数学推理、编程能力和通用能力。以下结果展示了 QwQ-32B 与其他领先模型的性能对比,包括 DeepSeek-R1-Distilled-Qwen-32B、DeepSeek-R1-Distilled-Llama-70B、o1-mini 以及原始的 DeepSeek-R1。

在测试数学能力的 AIME24 评测集上,以及评估代码能力的 LiveCodeBench 中,千问 QwQ-32B 表现与DeepSeek-R1相当,远胜于 o1-mini 及相同尺寸的R1 蒸馏模型;在由Meta首席科学家杨立昆领衔的“最难LLMs评测榜” LiveBench、谷歌等提出的指令遵循能力IFEval评测集、由加州大学伯克利分校等提出的评估准确调用函数或工具方面的BFCL测试中,千问 QwQ-32B 的得分均超越了 DeepSeek- R1。

模型推理

Transformers

from modelscope import AutoModelForCausalLM, AutoTokenizer

model_name = "Qwen/QwQ-32B"

model = AutoModelForCausalLM.from_pretrained(

  model_name,

  torch_dtype="auto",

  device_map="auto"

)

tokenizer = AutoTokenizer.from_pretrained(model_name)

prompt = "How many r's are in the word \"strawberry\""

messages = [

  {"role": "user", "content": prompt}

]

text = tokenizer.apply_chat_template(

  messages,

  tokenize=False,

  add_generation_prompt=True

)

model_inputs = tokenizer([text], return_tensors="pt").to(model.device)

generated_ids = model.generate(

  **model_inputs,

  max_new_tokens=32768

)

generated_ids = [

  output_ids[len(input_ids):] for input_ids, output_ids in zip(model_inputs.input_ids, generated_ids)

]

response = tokenizer.batch_decode(generated_ids, skip_special_tokens=True)[0]

print(response)

api调用

from openai import OpenAI

client = OpenAI(

  base_url='https://api-inference.modelscope.cn/v1/',

  api_key='<MODELSCOPE_SDK_TOKEN>', # ModelScope Token

)

response = client.chat.completions.create(

  model='Qwen/QwQ-32B', # ModelScope Model-Id

  messages=[

      {

          'role': 'system',

          'content': 'You are a helpful assistant.'

      },

      {

          'role': 'user',

          'content': '你好'

      }

  ],

  stream=True

)

done_reasoning = False

for chunk in response:

  reasoning_chunk = chunk.choices[0].delta.reasoning_content

  answer_chunk = chunk.choices[0].delta.content

  if reasoning_chunk != '':

      print(reasoning_chunk, end='',flush=True)

  elif answer_chunk != '':

      if not done_reasoning:

          print('\n\n === Final Answer ===\n')

          done_reasoning = True

      print(answer_chunk, end='',flush=True)

GGUF版本

可以直接在下方链接下载

模型微调

ms-swift已经支持了QwQ-32B的训练到部署。ms-swift是魔搭社区官方提供的大模型与多模态大模型训练部署框架。

  • 发表于:
  • 原文链接https://page.om.qq.com/page/O29By1Dug954eKBSNjutmRmA0
  • 腾讯「腾讯云开发者社区」是腾讯内容开放平台帐号(企鹅号)传播渠道之一,根据《腾讯内容开放平台服务协议》转载发布内容。
  • 如有侵权,请联系 cloudcommunity@tencent.com 删除。

扫码

添加站长 进交流群

领取专属 10元无门槛券

私享最新 技术干货

扫码加入开发者社群
领券