你好,我在运行bash train_mimic.sh 文件时遇到下面的错误:
Traceback (most recent call last):
File "/home/liyh/PromptMRG/main_train.py", line 134, in
main()
File "/home/liyh/PromptMRG/main_train.py", line 130, in main
trainer = Trainer(model, criterion_cls, base_probs, metrics, args, train_dataloader, val_dataloader, test_dataloader, device, utils.is_main_process)
File "/home/liyh/PromptMRG/modules/trainer.py", line 107, in init
super(Trainer, self).init(model, criterion_cls, base_probs, metric_ftns, args, device, is_main_process)
File "/home/liyh/PromptMRG/modules/trainer.py", line 22, in init
self.chexbert_metrics = CheXbertMetrics('./checkpoints/stanford/chexbert/chexbert.pth', args.batch_size, device)
File "/home/liyh/PromptMRG/modules/metrics_clinical.py", line 34, in init
self.chexbert = CheXbert(self.checkpoint_path, self.device,).to(self.device)
File "/home/liyh/PromptMRG/modules/chexbert.py", line 43, in init
self.load_state_dict(new_state_dict)
File "/home/liyh/anaconda3/envs/promptmrg/lib/python3.10/site-packages/torch/nn/modules/module.py", line 2153, in load_state_dict
raise RuntimeError('Error(s) in loading state_dict for {}:\n\t{}'.format(
RuntimeError: Error(s) in loading state_dict for CheXbert:
Unexpected key(s) in state_dict: "bert.embeddings.position_ids".
你好,我在运行bash train_mimic.sh 文件时遇到下面的错误: Traceback (most recent call last): File "/home/liyh/PromptMRG/main_train.py", line 134, in
main()
File "/home/liyh/PromptMRG/main_train.py", line 130, in main
trainer = Trainer(model, criterion_cls, base_probs, metrics, args, train_dataloader, val_dataloader, test_dataloader, device, utils.is_main_process)
File "/home/liyh/PromptMRG/modules/trainer.py", line 107, in init
super(Trainer, self).init(model, criterion_cls, base_probs, metric_ftns, args, device, is_main_process)
File "/home/liyh/PromptMRG/modules/trainer.py", line 22, in init
self.chexbert_metrics = CheXbertMetrics('./checkpoints/stanford/chexbert/chexbert.pth', args.batch_size, device)
File "/home/liyh/PromptMRG/modules/metrics_clinical.py", line 34, in init
self.chexbert = CheXbert(self.checkpoint_path, self.device,).to(self.device)
File "/home/liyh/PromptMRG/modules/chexbert.py", line 43, in init
self.load_state_dict(new_state_dict)
File "/home/liyh/anaconda3/envs/promptmrg/lib/python3.10/site-packages/torch/nn/modules/module.py", line 2153, in load_state_dict
raise RuntimeError('Error(s) in loading state_dict for {}:\n\t{}'.format(
RuntimeError: Error(s) in loading state_dict for CheXbert:
Unexpected key(s) in state_dict: "bert.embeddings.position_ids".