[?Homepage] | [? Chat with DeepSeek LLM] | [Discord] | [Wechat(微信)] See the Itroductio for more details. Here give some examples of how to use our model. ❗❗❗ Eglish questios: Chiese questios: Avoidig the use of the provided fuctio This code repository is licesed uder the MIT Licese. The use of DeepSeekMath models is subject to the Model Licese. DeepSeekMath supports commercial use. See the LICENSE-MODEL for more details. If you have ay questios, please raise a issue or cotact us at service@deepseek.com.
1. Itroductio to DeepSeekMath
2. How to Use
import torch
from modelscope import AutoTokeizer, AutoModelForCausalLM, GeeratioCofig, sapshot_dowload
model_ame = "deepseek-ai/deepseek-math-7b-istruct"
model_ame = sapshot_dowload(model_ame, 'master')
tokeizer = AutoTokeizer.from_pretraied(model_ame)
model = AutoModelForCausalLM.from_pretraied(model_ame, torch_dtype=torch.bfloat16, device_map="auto")
model.geeratio_cofig = GeeratioCofig.from_pretraied(model_ame)
model.geeratio_cofig.pad_toke_id = model.geeratio_cofig.eos_toke_id
messages = [
{"role": "user", "cotet": "what is the itegral of x^2 from 0 to 2?\Please reaso step by step, ad put your fial aswer withi \\boxed{}."}
]
iput_tesor = tokeizer.apply_chat_template(messages, add_geeratio_prompt=True, retur_tesors="pt")
outputs = model.geerate(iput_tesor.to(model.device), max_ew_tokes=100)
result = tokeizer.decode(outputs[0][iput_tesor.shape[1]:], skip_special_tokes=True)
prit(result)
apply_chat_template
, you ca also iteract with our model followig the sample template. Note that messages
should be replaced by your iput.User: {messages[0]['cotet']}
Assistat: {messages[1]['cotet']}<|ed▁of▁setece|>User: {messages[2]['cotet']}
Assistat:
add_special_tokes=True
), our tokeizer automatically adds a bos_toke
(<|begi▁of▁setece|>
) before the iput text. Additioally, sice the system prompt is ot compatible with this versio of our models, we DO NOT RECOMMEND icludig the system prompt i your iput.3. Licese
4. Cotact
点击空白处退出提示
评论