Skip to main content

Indie game storeFree gamesFun gamesHorror games
Game developmentAssetsComics
SalesBundles
Jobs
TagsGame Engines

GodAI

Immerse yourself in an AI-driven literary universe where anything can happen. · By AWK

Error in AI console: 'add-prefix_space'

A topic by TheOverlord created Dec 08, 2020 Views: 2,491 Replies: 3
Viewing posts 1 to 3

I downloaded the latest Windows version (0.0.14) and ran the game, everything seems to have been installed and configured properly using the gpt2-xl model. But when trying to call the AI it fails with the following stacktrace on the console:


Error in connection handler
Traceback (most recent call last):
  File "F:\AI\GodAI\APIs\TransformersAPI\miniconda\envs\godai\lib\site-packages\websockets\server.py", line 191, in handler
    await self.ws_handler(self, path)
  File "F:\AI\GodAI\APIs\TransformersAPI\server.py", line 138, in hello
    replace_tokens = token_encode(["<|endoftext|>"])
  File "F:\AI\GodAI\APIs\TransformersAPI\server.py", line 66, in token_encode
    tokens = tokenizer.encode(text, add_special_tokens = False, add_prefix_space = True)
  File "F:\AI\GodAI\APIs\TransformersAPI\miniconda\envs\godai\lib\site-packages\transformers\tokenization_utils_base.py", line 2091, in encode
    encoded_inputs = self.encode_plus(
  File "F:\AI\GodAI\APIs\TransformersAPI\miniconda\envs\godai\lib\site-packages\transformers\tokenization_utils_base.py", line 2407, in encode_plus
    return self._encode_plus(
  File "F:\AI\GodAI\APIs\TransformersAPI\miniconda\envs\godai\lib\site-packages\transformers\models\gpt2\tokenization_gpt2_fast.py", line 169, in _encode_plus
    return super()._encode_plus(*args, **kwargs)
  File "F:\AI\GodAI\APIs\TransformersAPI\miniconda\envs\godai\lib\site-packages\transformers\tokenization_utils_fast.py", line 446, in _encode_plus
    batched_output = self._batch_encode_plus(
  File "F:\AI\GodAI\APIs\TransformersAPI\miniconda\envs\godai\lib\site-packages\transformers\models\gpt2\tokenization_gpt2_fast.py", line 159, in _batch_encode_plus
    return super()._batch_encode_plus(*args, **kwargs)
TypeError: _batch_encode_plus() got an unexpected keyword argument 'add_prefix_space'
Client Connected
---
Awaiting for input

Looks like the game isn't compatible with the latest transformers library. While the game isn't fixed, looks like you can get it to work by making it install an older version of the library.

The way I got it to work was to first, delete the ~/godai/miniconda3 folder (that's on Linux, not sure where it would be on Windows, maybe somewhere inside %appdata%\ ?), to make the game reinstall the dependencies next launch. And then inside the GodAI install folder, go into  the APIs folder, and then in the TransformersAPI folder, and in there open the godai.yml file in a text editor (notepad or whatever) and change the last line from:

        - transformers

Into:

        - transformers==3.5.1

And make sure to make a backup before editing it just in case. And actually, just rename that folder I told you delete as well instead of outright deleting it just in case.


But like I said up top, this is just a sorta hacky way to get it to run; the ideal would be for the devs to update the code to be compatible with more modern versions of the transformers library.


ps: I've only tested this in Linux, dunno if there are any different steps required under Windows.

Thanks for the tip, changing the version of the transformers library worked like a charm!

:)