model = BertForSequenceClassification.from_pretrained('./models/bert-base-chinese/', num_labels=13)
state = torch.load('./models/bert.pth',map_location=torch.device('cpu'))
model.load_state_dict(state["state_dict"])
model.to(device)
我将bert-base-chines下载到了本地直接读取,但是第一行发生了下述的错误
OSError: Unable to load weights from pytorch checkpoint file for './models/bert-base-chinese/' at './models/bert-base-chinese/pytorch_model.bin'If you tried to load a PyTorch model from a TF 2.0 checkpoint, please set from_tf=True.
我以前一直是通过联网直接加载的,但是部署的平台没办法联网
谁知道可以怎么解决吗