7

Transformers 模型上传和共享 | 五

 4 years ago
source link: https://segmentfault.com/a/1190000022180008
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.
neoserver,ios ssh client

作者|huggingface

编译|VK

来源|Github

v2.2.2 开始,你可以使用库中内置的CLI上传与社区共享你的微调模型。

首先,在以下网址上创建一个帐户。

https://huggingface.co/join

然后:

transformers-cli login
# 使用与huggingface.co上相同的凭据登录

上传你的模型:

transformers-cli upload ./path/to/pretrained_model/

# 上传一个文件夹包含weights/tokenizer/config
# 通过`.save_pretrained()`保存

transformers-cli upload ./config.json [--filename folder/foobar.json]

# 上传单个文件
# (你可以选择覆盖其文件名,该文件名可以嵌套在文件夹中)

然后,可以通过其标识符,用户名和上面的文件夹名称的组合来访问模型:

"username/pretrained_model"

请在 model_cards/ 文件夹下添加README.md到仓库中,其中 model_cards/ 包括:模型描述,训练参数(数据集,预处理,超参数),评估结果,预期用途和限制等。

现在你的模型现在在havingface.co/models上有一个页面:fire:

任何人都可以从代码中加载它:

tokenizer = AutoTokenizer.from_pretrained("username/pretrained_model")
model = AutoModel.from_pretrained("username/pretrained_model")

列出你在S3上的所有文件:

transformers-cli s3 ls

你还可以删除不需要的文件:

transformers-cli s3 rm …

原文链接: https://huggingface.co/transf...

欢迎关注磐创AI博客站:

http://panchuang.net/

OpenCV中文官方文档:

http://woshicver.com/

欢迎关注磐创博客资源汇总站:

http://docs.panchuang.net/

About Joyk


Aggregate valuable and interesting links.
Joyk means Joy of geeK