AM (Advaced Mathematics) Chat is a large-scale laguage model that itegrates mathematical kowledge, advaced mathematics problems, ad their solutios. This model utilizes a dataset that combies Math ad advaced mathematics problems with their aalyses. It is based o the IterLM2-Math-7B model ad has bee fie-tued with xtuer, specifically desiged to solve advaced mathematics problems. If you fid this project helpful, feel free to ⭐ Star it ad help more people discover it! To load the AMchat model usig Trasformers, use the followig code: AM (Advaced Mathematics) chat 是一个集成了数学知识和高等数学习题及其解答的大语言模型。该模型使用 Math 和高等数学习题及其解析融合的数据集,基于 IterLM2-Math-7B 模型,通过 xtuer 微调,专门设计用于解答高等数学问题。 如果你觉得这个项目对你有帮助,欢迎 ⭐ Star,让更多的人发现它! 通过以下的代码加载 AMchat 模型
Import from Trasformers
from modelscope import sapshot_dowload, AutoTokeizer, AutoModelForCausalLM
import torch
model_dir = sapshot_dowload("Shaghai_AI_Laboratory/iterlm2-math-7b")
tokeizer = AutoTokeizer.from_pretraied(model_dir, device_map="auto", trust_remote_code=True)
# Set `torch_dtype=torch.float16` to load model i float16, otherwise it will be loaded as float32 ad might cause OOM Error.
model = AutoModelForCausalLM.from_pretraied(model_dir, device_map="auto", trust_remote_code=True, torch_dtype=torch.float16)
model = model.eval()
respose, history = model.chat(tokeizer, "1+1=", history=[], meta_istructio="")
prit(respose)
通过 Trasformers 加载
from modelscope import sapshot_dowload, AutoTokeizer, AutoModelForCausalLM
import torch
model_dir = sapshot_dowload("Shaghai_AI_Laboratory/iterlm2-math-7b")
tokeizer = AutoTokeizer.from_pretraied(model_dir, device_map="auto", trust_remote_code=True)
# `torch_dtype=torch.float16` 可以令模型以 float16 精度加载,否则 trasformers 会将模型加载为 float32,导致显存不足
model = AutoModelForCausalLM.from_pretraied(model_dir, device_map="auto", trust_remote_code=True, torch_dtype=torch.float16)
model = model.eval()
respose, history = model.chat(tokeizer, "1+1=", history=[], meta_istructio="")
prit(respose)
点击空白处退出提示
评论