ModelScope-Aget是魔搭社区推出的智能体Aget框架。ModelScope-Aget-14B是驱动该Aget框架的核心模型。模型是基于Trasformer的大语言模型, 在超大规模的预训练数据上进行训练得到。预训练数据类型多样,覆盖广泛,包括大量网络文本、专业书籍、代码等。在Qwe-14B模型的基础上,我们使用MSAget-Bech数据集训练增强其作为Aget中枢的调用AI模型,工具和利用检索知识问答的能力。 如果您想了解更多关于ModelScope-Aget的细节,我们建议您参阅ModelScope-Aget Github代码库。 运行请确保机器环境pytorch版本不低于1.12,再执行以下pip命令安装依赖库 另外,推荐安装 I additio, it is recommeded to istall the 下面我们展示了一个使用Model模型,进行多轮对话交互的样例(非流式): 我们的代码和模型权重对学术研究完全开放,并支持商用。请查看LICENSE了解具体的开源协议细节。 Our code ad checkpoits are ope to research purpose, ad they are allowed for commercial purposes. Check LICENSE for more details about the licese.ModelScope-Aget-14B
模型简介
依赖项(Depedecy)
pip istall modelscope
pip istall trasformers_stream_geerator
flash-attetio
库,以实现更高的效率和更低的显存占用。flash-attetio
library for higher efficiecy ad lower memory usage.git cloe -b v1.0.8 https://github.com/Dao-AILab/flash-attetio
cd flash-attetio && pip istall .
pip istall csrc/layer_orm
pip istall csrc/rotary
快速使用
from modelscope import AutoModelForCausalLM, AutoTokeizer
from modelscope import GeeratioCofig
tokeizer = AutoTokeizer.from_pretraied("damo/ModelScope-Aget-14B", revisio = 'v1.0.0',trust_remote_code=True)
model = AutoModelForCausalLM.from_pretraied("damo/ModelScope-Aget-14B", revisio = 'v1.0.0',device_map="auto", trust_remote_code=True,fp16=True).eval()
model.geeratio_cofig = GeeratioCofig.from_pretraied("damo/ModelScope-Aget-14B",revisio = 'v1.0.0', trust_remote_code=True) # 可指定不同的生成长度、top_p等相关超参
system = """
<|system|>:当前对话可以使用的插件信息如下,请自行判断是否需要调用插件来解决当前用户问题。若需要调用插件,则需要将插件调用请求按
照jso格式给出,必须包含api_ame、url、parameters字段,并在其前后使用<|startofthik|>和<|edofthik|>作为标志。然后你需要根据插
件API调用结果生成合理的答复;若无需调用插件,则直接给出对应回复即可:
1. {"ame": "modelscope_image-geeratio", "descriptio": "图片生成服务,针对文本输入,生成对应的图片,插图等", "parameters": [{"ame": "text", "descriptio": "用户输入的文本信息", "required": true}]}
2. {"ame": "modelscope_speech-geeratio", "descriptio": "朗读文本内容,将文本转语音服务,将文字转换为自然而逼真的语音,可配置男声/女声", "parameters": [{"ame": "iput", "descriptio": "要转成语音的文本", "required": true}, {"ame": "geder", "descriptio": "用户身份", "required": true}]}
"""
respose, history = model.chat(tokeizer, "生成一张插图,关于狐狸和猎人的。", history=Noe, system=system)
prit(respose)
respose, history = model.chat(tokeizer, "假如你是李清照,现在和我对话,你最喜欢的词是哪一首,语音回复我。", history=history, system=system)
prit(respose)
使用协议(Licese Agreemet)
点击空白处退出提示
评论