CronKGQA
CronKGQA copied to clipboard
ImportError: cannot import name 'SAVE_STATE_WARNING' from 'torch.optim.lr_scheduler'
Following the directions in README carefully, I encountered this error.
/home/jae/Dropbox/USC/Fall2022/KG/CronKGQA/cronkgqa_env/lib/python3.8/site-packages/tqdm/auto.py:22: TqdmWarning: IProgress not found. Please update jupyter and ipywidgets. See https://ipywidgets.readthedocs.io/en/stable/user_install.html
from .autonotebook import tqdm as notebook_tqdm
Output exceeds the [size limit](command:workbench.action.openSettings?[). Open the full output data [in a text editor](command:workbench.action.openLargeOutput?2f3f0869-f0a7-4cdc-a791-d967ccf96ea7)
---------------------------------------------------------------------------
ImportError Traceback (most recent call last)
Cell In [1], line 9
6 import pickle
7 import numpy as np
----> 9 from qa_models import QA_model, QA_model_Only_Embeddings, QA_model_BERT, QA_model_EaE, QA_model_EmbedKGQA, QA_model_EaE_replace, QA_model_EmbedKGQA_complex
10 from qa_datasets import QA_Dataset, QA_Dataset_model1, QA_Dataset_EaE, QA_Dataset_EmbedKGQA, QA_Dataset_EaE_replace
11 from torch.utils.data import Dataset, DataLoader
File ~/Dropbox/USC/Fall2022/KG/CronKGQA/qa_models.py:6
4 import numpy as np
5 from tkbc.models import TComplEx
----> 6 from transformers import RobertaModel
7 from transformers import BertModel
8 from transformers import DistilBertModel
File ~/Dropbox/USC/Fall2022/KG/CronKGQA/cronkgqa_env/lib/python3.8/site-packages/transformers/__init__.py:626
614 from .optimization import (
615 Adafactor,
616 AdamW,
(...)
622 get_polynomial_decay_schedule_with_warmup,
623 )
625 # Trainer
--> 626 from .trainer import Trainer
...
---> 40 from torch.optim.lr_scheduler import SAVE_STATE_WARNING
42 logger = logging.get_logger(__name__)
45 def torch_pad_and_concatenate(tensor1, tensor2, padding_index=-100):
ImportError: cannot import name 'SAVE_STATE_WARNING' from 'torch.optim.lr_scheduler' (/home/jae/Dropbox/USC/Fall2022/KG/CronKGQA/cronkgqa_env/lib/python3.8/site-packages/torch/optim/lr_scheduler.py)
pytorch==1.12.1 transformers==4.0.0 py3.8_cuda11.3_cudnn8.3.2_0
Can you please try with an older version of pytorch? This post suggests pytorch 1.4 https://stackoverflow.com/questions/66590981/transformer-error-importing-packages-importerror-cannot-import-name-save-st
The error above is resolved. Pytorch after 1.4.0 (>=1.5.0) does not have SAVE_STATE_WARNING anymore.
However, I have encountered a new error while trying with
pytorch==1.4.0
transformers==4.0.0
ipython==8.4.0
and the jupyter kernel panicks.
Can you please share the text output from running
conda list -n cronkgqa_env > package_list.txt
so that I can reinstall all the packages by doing
conda create -n cronkgqa_env --file package-list.txt
There are too many package conflicts that are preventing me from trying out this repo. Thank you for your help!
@micxael can you please share how you resolved the issue?
@micxael can you please share how you resolved the issue?
Sorry, it's been a minute and I don't exactly recall how the kernel panic issue was resolved. As far as I remember, finding the right pytorch version eventually resolved all the issues. Best,