Model CRONKGQA implements pit avoidance records (more ing)

First follow the Github prompts to create an environment

cd CronKGQA
conda create --prefix ./cronkgqa_env python=3.8
conda activate ./cronkgqa_env

Version mismatch Reinstall pytorch of 1.7.1:

conda install pytorch==1.7.1 torchvision==0.8.2 cudatoolkit=11.0 -c pytorch

cronkgqa_testing.ipynb

Can be used to test the model's response to any textual question. (a list of entities and times is also given in the question)

1. RuntimeError: Error(s) in loading state_dict for Model: Missing key(s) in state_dict

Revise:

qa_model.load_state_dict(torch.load(filename), False)

The official description of the parameters of the load_state_dict method The strict parameter defaults to true, which means whether to strictly require the keys in the state_dict to match the keys returned by the module's keys. If strict is set to false, then the error report can be ignored, please note that it is ignored.

Reference: blog

2. Output exceeds the size limit. Open the full output data in a text editor

Note

Use the warnings module to ignore warnings

import warnings
warnings.filterwarnings("ignore")#程序中
python -W ignore xx.py # 命令行

Guess you like

Origin blog.csdn.net/weixin_43629813/article/details/127829433