🚀 thinkygemma-4b:普通的偽推理模型
thinkygemma-4b 是基於 Gemma-3-4b-pt 微調而來的模型,適用於結構化推理或偽誘導推理,能出色地模擬優秀推理者進行推理。
屬性 |
詳情 |
基礎模型 |
google/gemma-3-4b-pt |
任務類型 |
文本生成 |
庫名稱 |
transformers |
🚀 快速開始
安裝依賴
from transformers import AutoTokenizer, Gemma3ForConditionalGeneration, TextStreamer
import torch
加載模型和分詞器
model_id = "xsanskarx/thinkygemma-4b"
model = Gemma3ForConditionalGeneration.from_pretrained(model_id, device_map="auto").eval()
tokenizer = AutoTokenizer.from_pretrained(model_id)
定義提問函數
def ask_model(prompt: str, max_tokens=8192, temperature=0.7):
"""
Function to ask a question to the model and stream the response.
"""
messages = [
{"role": "system", "content": "You are an expert math problem solver, think and reason inside <think> tags, enclose all reasoning in <think> tags, verifying logic step by step and then return your final structured answer"},
{"role": "user", "content": prompt}
]
formatted_prompt = tokenizer.apply_chat_template(messages, tokenize=False)
inputs = tokenizer(formatted_prompt, return_tensors="pt").to(model.device)
streamer = TextStreamer(tokenizer, skip_special_tokens=True)
with torch.inference_mode():
model.generate(**inputs, max_new_tokens=max_tokens, do_sample=True, temperature=temperature, streamer=streamer)
ask_model("do 2+2")
✨ 主要特性
- 微調模型:基於 Google 的 Gemma-3-4b-it 進行微調,適用於結構化推理和偽誘導推理。
- 參數情況:訓練了 18 億個參數。
- 訓練數據:使用來自 DeepSeek R1 和 Qwen QWQ 的 25k 行經過驗證的思維鏈(CoT)軌跡進行訓練。
- 後續計劃:下一步計劃進行 GRPO。
📚 詳細文檔
模型描述
這是 Google 的 Gemma-3-4b-it 的微調版本,適用於 結構化推理 / 偽誘導推理,旨在出色地模擬優秀推理者進行推理。
訓練詳情
- 硬件:單張 NVIDIA H100 顯卡。
- 訓練時間:9 小時(1 個 epoch)。
- 訓練方法:LoRA 微調(r = 128, alpha = 256)。
- 數據集:25k 條 CoT 軌跡。
- 基礎模型:
google/gemma-3-4b-it
模型信息
📌 模型 ID:xsanskarx/thinkygemma-4b
📌 訓練的參數數量:18 億
📌 訓練數據來源:來自 DeepSeek R1 和 Qwen QWQ 的 25k 行經過驗證的思維鏈(CoT)軌跡
📌 下一步計劃:GRPO
📌 適配器倉庫:xsanskarx/thinkgemma-4b