feng2022 commited on
Commit
5abfde7
1 Parent(s): 5a16b15

Update download.py

Browse files
Files changed (1) hide show
  1. download.py +6 -0
download.py CHANGED
@@ -9,4 +9,10 @@ config_path = 'D:/Transformers-Bert/bert-base-chinese/config.json' # 用户下
9
  # config = BertConfig.from_pretrained(model_path)
10
  config = BertConfig.from_pretrained(config_path)
11
 
 
 
 
 
 
 
12
 
 
9
  # config = BertConfig.from_pretrained(model_path)
10
  config = BertConfig.from_pretrained(config_path)
11
 
12
+ from transformers import BertTokenizer,BertModel
13
+ model_name = 'hfl/chinese-roberta-wwm-ext'
14
+ config = BertConfig.from_pretrained(model_name) # 这个方法会自动从官方的s3数据库下载模型配置、参数等信息(代码中已配置好位置)
15
+ tokenizer = BertTokenizer.from_pretrained(model_name) # 这个方法会自动从官方的s3数据库读取文件下的vocab.txt文件
16
+ model = BertModel.from_pretrained(model_name) # 这个方法会自动从官方的s3数据库下载模型信息
17
+
18