自拍偷在线精品自拍偷,亚洲欧美中文日韩v在线观看不卡

沒有等來Qwen2.5,但等來了Qwen2-Math

發(fā)布于 2024-8-9 16:45
瀏覽
0收藏

Qwen2又出新作Math大模型,你值得擁有。

我沒有等來Qwen2.5,但等來了Qwen2-Math,在數(shù)學(xué)推理能力上大幅度提高,先來一張圖陣陣場子,72B模型超過GPT4-o、Claude-3.5-Sonnet和Gemini-1.5-Pro。

沒有等來Qwen2.5,但等來了Qwen2-Math-AI.x社區(qū)

Blog: https://qwenlm.github.io/blog/qwen2-math/
HF:https://huggingface.co/collections/Qwen/qwen2-6659360b33528ced941e557f

本次開源共涉及3個尺寸2個版本,分別為Qwen2-Math-1.5B、Qwen2-Math-1.5B-Instruct、Qwen2-Math-7B、Qwen2-Math-7B-Instruct、Qwen2-Math-72B和Qwen2-Math-72B-Instruct。

模型訓(xùn)練初始化采用Qwen2-1.5B、Qwen2-7B和Qwen2-72B,訓(xùn)練語料涉及高質(zhì)量的數(shù)學(xué)網(wǎng)絡(luò)文本、書籍、代碼、考試題目以及由Qwen2模型合成的數(shù)學(xué)預(yù)訓(xùn)練數(shù)據(jù)。

指令微調(diào)階段是先用Qwen2-Math-72B訓(xùn)練了一個數(shù)學(xué)專用的獎勵模型,然后利用該獎勵模型和指示模型回答問題是否正確這兩個指標(biāo)一起拒絕采用構(gòu)建SFT數(shù)據(jù)集,并利用GRPO進(jìn)一步對齊模型效果。

注意:模型在預(yù)訓(xùn)練和指令微調(diào)階段為了防止數(shù)據(jù)泄露,均進(jìn)行數(shù)據(jù)去污染除了,移除測試集中13-gram重復(fù)最長公共子序列比例大于0.6的訓(xùn)練樣本。

模型在GSM8K、MATH、Aqua、SAT Math、OlympiadBench、College Math、AIME24、AMC23多個等數(shù)據(jù)集上均取得了很好的效果。

沒有等來Qwen2.5,但等來了Qwen2-Math-AI.x社區(qū)

相較于原版Qwen2有很大的提升

HF快速使用:

from transformers import AutoModelForCausalLM, AutoTokenizer

model_name = "Qwen/Qwen2-Math-1.5B-Instruct"
device = "cuda"

model = AutoModelForCausalLM.from_pretrained(
    model_name,
    torch_dtype="auto",
    device_map="auto"
)
tokenizer = AutoTokenizer.from_pretrained(model_name)

prompt = "Find the value of $x$ that satisfies the equation $4x+5 = 6x+7$."
messages = [
    {"role": "system", "content": "You are a helpful assistant."},
    {"role": "user", "content": prompt}
]
text = tokenizer.apply_chat_template(
    messages,
    tokenize=False,
    add_generation_prompt=True
)
model_inputs = tokenizer([text], return_tensors="pt").to(device)

generated_ids = model.generate(
    **model_inputs,
    max_new_tokens=512
)
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)

最后說一下,官方表示目前的模型僅為英文模型,后續(xù)會推出中英雙語模型。

本文轉(zhuǎn)載自??NLP工作站??,作者: 劉聰NLP ????

標(biāo)簽
收藏
回復(fù)
舉報(bào)
回復(fù)
相關(guān)推薦