huggingface下载模型的最正确方法

# transformsers 转onnx

import os
os.environ['HF_ENDPOINT'] = 'https://hf-mirror.com'
#加上这行之后又恢复以前的速度了!



from transformers import AutoModel, AutoConfig, AutoTokenizer
bert_model = AutoModel.from_pretrained('bert-base-uncased')
config = AutoConfig.from_pretrained('bert-base-uncased')
tokenizer = AutoTokenizer.from_pretrained('bert-base-uncased')














posted on 2023-12-27 11:31  张博的博客  阅读(237)  评论(0编辑  收藏  举报

导航