Spaces:
Runtime error
Runtime error
Create new file
Browse files- download.py +12 -0
download.py
ADDED
@@ -0,0 +1,12 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
from transformers import BertConfig
|
2 |
+
|
3 |
+
model_name = 'bert-base-chinese' # bert版本名称
|
4 |
+
model_path = 'D:/Transformers-Bert/bert-base-chinese/' # 用户下载的预训练bert文件存放地址
|
5 |
+
config_path = 'D:/Transformers-Bert/bert-base-chinese/config.json' # 用户下载的预训练bert文件config.json存放地址
|
6 |
+
|
7 |
+
# 载入config 文件可以采取三种方式:bert名称、bert文件夹地址、config文件地址
|
8 |
+
# config = BertConfig.from_pretrained(model_name) # 这个方法会自动从官方的s3数据库下载模型配置、参数等信息(代码中已配置好位置)
|
9 |
+
# config = BertConfig.from_pretrained(model_path)
|
10 |
+
config = BertConfig.from_pretrained(config_path)
|
11 |
+
|
12 |
+
|