ms-swift icon indicating copy to clipboard operation
ms-swift copied to clipboard

如何添加一个自定义模型的支持可以给个详细的文档么?

Open samaritan1998 opened this issue 1 year ago • 9 comments

Describe the feature Please describe the feature requested here(请在这里描述需求)

Paste any useful information Paste any useful information, including papers, github links, etc.(请在这里描述其他有用的信息,比如相关的论文地址,github链接等)

Additional context Add any other context or information here(其他信息可以写在这里)

samaritan1998 avatar Jan 20 '25 12:01 samaritan1998

可以先参考这里

https://github.com/modelscope/ms-swift/tree/main/examples/custom

Jintao-Huang avatar Jan 20 '25 12:01 Jintao-Huang

是看的这里 但是不知道是干嘛的

samaritan1998 avatar Jan 20 '25 13:01 samaritan1998

https://github.com/modelscope/ms-swift/blob/main/examples/custom/model.py 主要关注这个文件,这个是注册新模型的流程

tastelikefeet avatar Feb 04 '25 08:02 tastelikefeet

已增加文档

Jintao-Huang avatar Feb 09 '25 15:02 Jintao-Huang

https://github.com/modelscope/ms-swift/blob/main/examples/custom/model.py 主要关注这个文件,这个是注册新模型的流程

@Jintao-Huang 您好~看这里还是注册开源模型?请教下如果是想自定义模型结构,比如在开源模型结构上修改,应该如何实现可以给个指引吗,非常感谢

Sarahtorekryo avatar Aug 02 '25 04:08 Sarahtorekryo

https://github.com/modelscope/ms-swift/blob/main/examples/custom/model.py 主要关注这个文件,这个是注册新模型的流程

@Jintao-Huang 您好~看这里还是注册开源模型?请教下如果是想自定义模型结构,比如在开源模型结构上修改,应该如何实现可以给个指引吗,非常感谢

+1

Milesld avatar Dec 17 '25 08:12 Milesld

https://github.com/modelscope/ms-swift/blob/main/examples/custom/model.py 主要关注这个文件,这个是注册新模型的流程

@Jintao-Huang 您好~看这里还是注册开源模型?请教下如果是想自定义模型结构,比如在开源模型结构上修改,应该如何实现可以给个指引吗,非常感谢

@Sarahtorekryo 请教下,你搞明白这个怎么添加了吗?

Milesld avatar Dec 17 '25 08:12 Milesld

自定义模型 修改 modeling_xxx文件,和swift框架没关系的

只需要保证可以使用AutoModelForCausalLM加载就行了

Jintao-Huang avatar Dec 17 '25 08:12 Jintao-Huang

自定义模型 修改 modeling_xxx文件,和swift框架没关系的

只需要保证可以使用AutoModelForCausalLM加载就行了

@Jintao-Huang 哦那实际就是在transformers里边添加模型,然后通过AutoModelForCausalLM来加载就行吗?这种方式走的后端就是transformers了吗?这个支持开那些并行策略吗?

Milesld avatar Dec 17 '25 08:12 Milesld