MrReplikant / AvrilAI

An attempt to create an open-source AI companion that is self-hostable
MIT License
82 stars 14 forks source link

Fatal error when attempting to use program #3

Closed Yogfan800 closed 3 years ago

Yogfan800 commented 3 years ago

Hey there. This seems like a great project, but after doing the installation I've been running into an issue every time I try execute the program. I should also mention I am currently running on manjaro linux, and had to change the module loading in gpt2.py.

original: from transformers.configuration_gpt2 import GPT2Config from transformers.modeling_gpt2 import GPT2PreTrainedModel

changed: from transformers import GPT2Config from transformers import GPT2PreTrainedModel

not sure if this is correct, but it allows the program to start.

after that It keeps running into a fatal error any time I attempt to use it. Loading a prompt from file, creating a prompt and loading a conversation. here is the error text:

Traceback (most recent call last): File "/home/userl/Project-Replikant-1.2/play.py", line 740, in gm.play_story() File "/home/user/Project-Replikant-1.2/play.py", line 679, in play_story if not self.init_story(): # Failed init File "/home/user/Project-Replikant-1.2/play.py", line 427, in init_story self.story = new_story(self.generator, self.context, self.prompt) File "/home/user/Project-Replikant-1.2/play.py", line 215, in new_story story.act(prompt) File "/home/user/Project-Replikant-1.2/storymanager.py", line 23, in act result = self.generator.generate( File "/home/user/Project-Replikant-1.2/gpt2generator.py", line 344, in generate text = self.generate_raw( File "/home/user/Project-Replikant-1.2/gpt2generator.py", line 307, in generate_raw out = self.sample_sequence( File "/home/user/Project-Replikant-1.2/gpt2generator.py", line 246, in sample_sequence out = sample_sequence( File "/home/user/Project-Replikant-1.2/gpt2generator.py", line 131, in sample_sequence logits, pasts = model(input_ids=input_ids_next, past=pasts) File "/home/user/.local/lib/python3.9/site-packages/torch/nn/modules/module.py", line 1051, in _call_impl return forward_call(*input, **kwargs) TypeError: forward() got an unexpected keyword argument 'past'

hopefully there is an easy fix for this.

MrReplikant commented 3 years ago

Which Branch are you using? Master or Experimental?

Yogfan800 commented 3 years ago

Master.

MrReplikant commented 3 years ago

Master.

That's really weird. Do you have the appropriate versions of everything? Including python?

Yogfan800 commented 3 years ago

I've certainly tried my best to configure everything correctly. Its possible my distributions package manager has versions that may not match your configuration though. When I was installing the requirements with pip, using the requirements.txt file It was not able to pull torch by the name given in the file. I needed to manually install that. So there could be another issue.

this is a hard problem to address, so It may be better for me to just watch the project for new releases and see if eventually my versions match up.

MrReplikant commented 3 years ago

I've certainly tried my best to configure everything correctly. Its possible my distributions package manager has versions that may not match your configuration though. When I was installing the requirements with pip, using the requirements.txt file It was not able to pull torch by the name given in the file. I needed to manually install that. So there could be another issue.

this is a hard problem to address, so It may be better for me to just watch the project for new releases and see if eventually my versions match up.

Tell me a bit more about your device, what are your specs, architecture, and os? This could help in diagnosing the issue more solidly

Yogfan800 commented 3 years ago

64 bit Manjaro Linux.

4 core cpu, 16GB ram, 4GB AMD graphics.

MrReplikant commented 3 years ago

64 bit Manjaro Linux.

4 core cpu, 16GB ram, 4GB AMD graphics.

Hmmm, perfectly suitable specs. What is your python version? That could possibly be the culprit. Also, apologies for the late reply, life sort of got in the way.

Yogfan800 commented 3 years ago

I'm currently running Python 3.9.6. I guess this could be causing issues. I would need to setup a separate virtual environment with the older version maybe.

No worries about the time it took to reply btw. We all got our own lives.

naeu commented 3 years ago

You can try running pyenv local 3.7.6 then export PATH="$(pyenv root)/shims:$PATH" before continuing in a venv. See: https://github.com/pyenv/pyenv#basic-github-checkout

MrReplikant commented 3 years ago

I'm currently running Python 3.9.6. I guess this could be causing issues. I would need to setup a separate virtual environment with the older version maybe.

No worries about the time it took to reply btw. We all got our own lives.

Ahhhh, there's your culprit. ~3.7 is where you need to be.