DrewThomasson / VoxNovel

VoxNovel: generate audiobooks giving each character a different voice actor.
MIT License
126 stars 16 forks source link

Error: Unexpected key(s) in state_dict: "bert.embeddings.position_ids". #24

Closed Tim-Salzer closed 2 months ago

Tim-Salzer commented 2 months ago

Hi, Thank you very much for the Google Colab script. I have been using it for work for about 3 works and it has been immensely helpful for my work! Since yesterday, when trying to run the the Headless Voxnovel Program, I tend to get the output which I copied-pasted below. Unfortunately, I am not familiar with the packages on which the program is based, so I am not able to figure out the origin of the error myself. Perhaps you can help. Once more thank you for that great tool!

All required booknlp files are present. No action needed. using device cuda [nltk_data] Downloading package averaged_perceptron_tagger to [nltk_data] /root/nltk_data... [nltk_data] Package averaged_perceptron_tagger is already up-to- [nltk_data] date! Enter the file path of the ebook: "...my filepath...."

{'pipeline': 'entity,quote,supersense,event,coref', 'model': 'big'} Traceback (most recent call last): File "/content/VoxNovel/headless_voxnovel.py", line 481, in process_file_headless() File "/content/VoxNovel/headless_voxnovel.py", line 465, in process_file_headless booknlp = BookNLP("en", model_params) File "/usr/local/lib/python3.10/dist-packages/booknlp/booknlp.py", line 14, in init self.booknlp=EnglishBookNLP(model_params) File "/usr/local/lib/python3.10/dist-packages/booknlp/english/english_booknlp.py", line 148, in init self.entityTagger=LitBankEntityTagger(self.entityPath, tagsetPath) File "/usr/local/lib/python3.10/dist-packages/booknlp/english/entity_tagger.py", line 22, in init self.model.load_state_dict(torch.load(model_file, map_location=device)) File "/usr/local/lib/python3.10/dist-packages/torch/nn/modules/module.py", line 2189, in load_state_dict raise RuntimeError('Error(s) in loading state_dict for {}:\n\t{}'.format( RuntimeError: Error(s) in loading state_dict for Tagger: Unexpected key(s) in state_dict: "bert.embeddings.position_ids".

DrewThomasson commented 2 months ago

I just fixed it by downgrading booknlp to -> booknlp==1.0.7.1

Should work now,

:)

Tim-Salzer commented 2 months ago

Thanks man, that is great!