Add help for hugging-face-models

Signed-off-by: Harry Chen <i@harrychen.xyz>
This commit is contained in:
Harry Chen 2020-09-19 00:40:05 +08:00
parent 6fdc2990d1
commit 8b04978870
No known key found for this signature in database
GPG Key ID: 9F98D3E7C18D0378

View File

@ -0,0 +1,27 @@
---
category: help
layout: help
mirrorid: hugging-face-models
---
## Hugging Face Model Hub 预训练模型镜像使用帮助
[Hugging Face Transformers](https://github.com/huggingface/transformers) 是自然语言处理领域的重要开源项目,提供了基于通用架构(如 BERTGPT-2RoBERTa的数千个预训练模型并提供了 PyTorch 和 TensorFlow 的良好互操作性。
我们镜像了 Hugging Face Model Hub为国内用户下载预训练模型数据提供便利。
### 使用方法
注意:`transformers > 3.1.0` 的版本支持下面的 `mirror` 选项。
只需在 `from_pretrained` 函数调用中添加 `mirror` 选项,如:
```python
AutoModel.from_pretrained('bert-base-uncased', mirror='tuna')
```
目前内置的两个来源为 `tuna``bfsu`。此外,也可以显式提供镜像地址,如:
```python
AutoModel.from_pretrained('bert-base-uncased', mirror='https://mirrors.tuna.tsinghua.edu.cn/hugging-face-models')
```