🚀 DeepMount00/Murai-350M-v0.1-beta
這是一個用於文本生成的模型,基於transformers庫構建,具備高效的參數架構和出色的文本生成能力。
🚀 快速開始
以下是使用該模型進行文本生成的示例代碼:
from transformers import pipeline, AutoTokenizer, AutoModelForCausalLM
model_id = "DeepMount00/Murai-350M-v0.1-beta"
model = AutoModelForCausalLM.from_pretrained(model_id, trust_remote_code=True)
tokenizer = AutoTokenizer.from_pretrained(model_id)
t_pipeline = pipeline(
"text-generation",
model=model,
tokenizer=tokenizer,
device_map="auto",
return_full_text=True,
top_p = 0.95,
top_k = 50,
repetition_penalty=1.2
)
SYSTEM_PROMPT = """Sei un assistente utile."""
TEMPERATURE = 0.1
MAX_NEW_TOKENS = 250
messages = [
{"role": "system", "content": SYSTEM_PROMPT},
{"role": "user", "content": """Scrivi una funzione python che somma due numeri"""},
]
conv_template = tokenizer.apply_chat_template(
messages,
tokenize=False,
add_generation_prompt=True
)
outputs = t_pipeline(
conv_template,
max_new_tokens=MAX_NEW_TOKENS,
do_sample=True,
temperature=TEMPERATURE,
num_return_sequences=1,
)
print(outputs[0]["generated_text"])
💻 使用示例
基礎用法
from transformers import pipeline, AutoTokenizer, AutoModelForCausalLM
model_id = "DeepMount00/Murai-350M-v0.1-beta"
model = AutoModelForCausalLM.from_pretrained(model_id, trust_remote_code=True)
tokenizer = AutoTokenizer.from_pretrained(model_id)
t_pipeline = pipeline(
"text-generation",
model=model,
tokenizer=tokenizer,
device_map="auto",
return_full_text=True,
top_p = 0.95,
top_k = 50,
repetition_penalty=1.2
)
SYSTEM_PROMPT = """Sei un assistente utile."""
TEMPERATURE = 0.1
MAX_NEW_TOKENS = 250
messages = [
{"role": "system", "content": SYSTEM_PROMPT},
{"role": "user", "content": """Scrivi una funzione python che somma due numeri"""},
]
conv_template = tokenizer.apply_chat_template(
messages,
tokenize=False,
add_generation_prompt=True
)
outputs = t_pipeline(
conv_template,
max_new_tokens=MAX_NEW_TOKENS,
do_sample=True,
temperature=TEMPERATURE,
num_return_sequences=1,
)
print(outputs[0]["generated_text"])
🔧 技術細節
該模型使用了針對參數效率進行優化的深度架構:
- 採用RMSNorm的預歸一化架構
- 採用分組查詢注意力機制以提高內存效率
- 採用SwiGLU激活函數以提升性能
- 採用RoPE位置編碼以實現更好的長度泛化能力
📚 引用說明
@misc{deepmount_llm_2024,
title={Deep LLM: A 350M Parameter Language Model with 42 Layers},
author={MicheleMontebovi},
year={2025},
url={https://huggingface.co/DeepMount00/Murai-350M-v0.1-beta}
}
📄 許可證
Apache 2.0