服务区里可以做多少个网站,建筑工程资质合作,济南官网,用dw制作一个网站1. 背景
使用 超算互联网 的云服务#xff0c;不能连接外网#xff0c;只能把模型下载到本地#xff0c;再上传上去到云服务。
2. 模型下载
在 模型中 https://huggingface.co/models 找到所需的模型后 点击下载 config.json pytorch_model.bin vocab.txt
3. 上传模型文…1. 背景
使用 超算互联网 的云服务不能连接外网只能把模型下载到本地再上传上去到云服务。
2. 模型下载
在 模型中 https://huggingface.co/models 找到所需的模型后 点击下载 config.json pytorch_model.bin vocab.txt
3. 上传模型文件
打开文件管理 e-file 点击 上传选择 本地上传
4. 运行代码
由原来的代码
from transformers import BertTokenizer, BertForSequenceClassificationmodel BertForSequenceClassification.from_pretrained(bert-base-chinese, num_labels2)
tokenizer BertTokenizer.from_pretrained(bert-base-chinese)改成这样的
from transformers import BertTokenizer, BertForSequenceClassificationpath_to_local_model_directory/public/home/acc5trotmy/jupyter/models/bert-base-chinesemodel BertForSequenceClassification.from_pretrained(path_to_local_model_directory, num_labels2)
tokenizer BertTokenizer.from_pretrained(path_to_local_model_directory)或者
from transformers import BertTokenizer, BertForSequenceClassification, BertConfigconfig BertConfig.from_pretrained(path_to_local_model_directory)
model BertForSequenceClassification.from_pretrained(path_to_local_model_directory, configconfig)
tokenizer BertTokenizer.from_pretrained(path_to_local_model_directory)