Open Embedding opened 2 years ago
Run the following command on CPU machine:
python3 finetune/run_classifier.py --pretrained_model_path models/book_review_model.bin \ --vocab_path models/google_zh_vocab.txt \ --config_path models/bert/base_config.json \ --train_path datasets/douban_book_review/train.tsv \ --dev_path datasets/douban_book_review/dev.tsv \ --test_path datasets/douban_book_review/test.tsv \ --epochs_num 3 --batch_size 32
RuntimeError: Attempting to deserialize object on a CUDA device but torch.cuda.is_available() is False. If you are running on a CPU-only machine, please use torch.load with map_location=torch.device('cpu') to map your storages to the CPU.
我用pycharm运行也是需要修改这个地方 model.load_state_dict(torch.load(args.pretrained_model_path, map_location='cuda:0'), strict=False)
Run the following command on CPU machine:
RuntimeError: Attempting to deserialize object on a CUDA device but torch.cuda.is_available() is False. If you are running on a CPU-only machine, please use torch.load with map_location=torch.device('cpu') to map your storages to the CPU.