theubie / complex_memory

A KoboldAI-like memory extension for oobabooga's text-generation-webui
GNU Affero General Public License v3.0
107 stars 14 forks source link

KeyError: 'dummy' on extension load #24

Closed alabasterfox closed 7 months ago

alabasterfox commented 11 months ago

Loading of complex_memory extension throws the error:

--Unable to load complex memories for character Assistant. filename: characters/Assistant.json. Using defaults. Traceback (most recent call last): File "text-generation-webui/server.py", line 247, in create_interface() File "text-generation-webui/server.py", line 153, in create_interface extensions_module.create_extensions_block() # Extensions block File "text-generation-webui/modules/extensions.py", line 192, in create_extensions_block extension.ui() File "text-generation-webui/extensions/complex_memory/script.py", line 257, in ui [shared.gradio[k] for k in ['name1', 'name2', 'character_picture', 'greeting', 'context', 'dummy']]).then( File "text-generation-webui/extensions/complex_memory/script.py", line 257, in [shared.gradio[k] for k in ['name1', 'name2', 'character_picture', 'greeting', 'context', 'dummy']]).then( KeyError: 'dummy'

I was able to clear the error by updating the code from: [shared.gradio[k] for k in ['character_menu', 'name1', 'name2']], [shared.gradio[k] for k in ['name1', 'name2', 'character_picture', 'greeting', 'context', 'dummy']]).then( chat.redraw_html, shared.reload_inputs, shared.gradio['display']).then(pairs_loaded, None, memory_select) to: [shared.gradio[k] for k in ['character_menu', 'name1', 'name2'] if k in shared.gradio], [shared.gradio[k] for k in ['name1', 'name2', 'character_picture', 'greeting', 'context', 'dummy'] if k in shared.gradio]).then( chat.redraw_html, shared.reload_inputs, shared.gradio['display']).then(pairs_loaded, None, memory_select)

but then, on character file upload to text-generation-webui, it will throw the error:

File "/usr/local/lib/python3.10/dist-packages/gradio/queueing.py", line 407, in call_prediction output = await route_utils.call_process_api( File "/usr/local/lib/python3.10/dist-packages/gradio/route_utils.py", line 226, in call_process_api output = await app.get_blocks().process_api( File "/usr/local/lib/python3.10/dist-packages/gradio/blocks.py", line 1550, in process_api result = await self.call_function( File "/usr/local/lib/python3.10/dist-packages/gradio/blocks.py", line 1185, in call_function prediction = await anyio.to_thread.run_sync( File "/usr/local/lib/python3.10/dist-packages/anyio/to_thread.py", line 33, in run_sync return await get_asynclib().run_sync_in_worker_thread( File "/usr/local/lib/python3.10/dist-packages/anyio/_backends/_asyncio.py", line 877, in run_sync_in_worker_thread return await future File "/usr/local/lib/python3.10/dist-packages/anyio/_backends/_asyncio.py", line 807, in run result = context.run(func, args) File "/usr/local/lib/python3.10/dist-packages/gradio/utils.py", line 661, in wrapper response = f(args, **kwargs) File "text-generation-webui/extensions/complex_memory/script.py", line 157, in load_character_complex_memory_hijack result = chat.load_character(character_menu, name1, name2, False) TypeError: load_character() takes 3 positional arguments but 4 were given

zenphyl commented 10 months ago

Similar error here. Can't load. I am on the latest Oobabooga update, without the extention everything loads fine.

--Unable to load complex memories for character Assistant. filename: characters/Assistant.json. Using defaults. Traceback (most recent call last) │ K:\OOBABOOGA\text-generation-webui\server.py:262 in │ │ │ 261 time.sleep(0.5) │ │ > 262 create_interface() │ │ 263 │ │
│ K:\OOBABOOGA\text-generation-webui\server.py:157 in create_interface

│ 156 extensions_module.create_extensions_tabs() # Extensions tabs
│ > 157 extensions_module.create_extensions_block() # Extensions block
│ 158 │ │ │ │ K:\OOBABOOGA\text-generation-webui\modules\extensions.py:197 in create_extensionsblock
│ │ │ 196 extension,
= row │ │ > 197 extension.ui() │ │ 198 │ │
│ K:\OOBABOOGA\text-generation-webui\extensions\complex_memory\script.py:257 in ui

│ 256 [shared.gradio[k] for k in ['character_menu', 'name1', 'name2']],
│ > 257 [shared.gradio[k] for k in ['name1', 'name2', 'character_picture', 'greeting
│ 258 chat.redraw_html, shared.reload_inputs, shared.gradio['display']).then(pairs

│ K:\OOBABOOGA\text-generation-webui\extensions\complex_memory\script.py:257 in

│ 256 [shared.gradio[k] for k in ['character_menu', 'name1', 'name2']],
│ > 257 [shared.gradio[k] for k in ['name1', 'name2', 'character_picture', 'greeting
│ 258 chat.redraw_html, shared.reload_inputs, shared.gradio['display']).then(pairs

KeyError: 'dummy'

D-a-r-n-o-l-d commented 10 months ago

Got the same thing, hope this can be fixed.

Sylphar commented 10 months ago

Likewise. My installation of oobabooga is standard, and this is the only extension that simply does not work. What a shame, being able to construct notebooks is one of the best feature for long conversations with chatbots...

--Unable to load complex memories for character Assistant. filename: characters/Assistant.json. Using defaults. ┌───────────────────────────────────────── Traceback (most recent call last) ─────────────────────────────────────────┐ │ C:\text-generation-webui-main\server.py:262 in │ │ │ │ 261 time.sleep(0.5) │ │ > 262 create_interface() │ │ 263 │ │ │ │ C:\text-generation-webui-main\server.py:157 in create_interface │ │ │ │ 156 extensions_module.create_extensions_tabs() # Extensions tabs │ │ > 157 extensions_module.create_extensions_block() # Extensions block │ │ 158 │ │ │ │ C:\text-generation-webui-main\modules\extensions.py:200 in create_extensionsblock │ │ │ │ 199 extension, = row │ │ > 200 extension.ui() │ │ 201 │ │ │ │ C:\text-generation-webui-main\extensions\complex_memory\script.py:257 in ui │ │ │ │ 256 [shared.gradio[k] for k in ['character_menu', 'name1', 'name2']], │ │ > 257 [shared.gradio[k] for k in ['name1', 'name2', 'character_picture', 'greeting │ │ 258 chat.redraw_html, shared.reload_inputs, shared.gradio['display']).then(pairs │ │ │ │ C:\text-generation-webui-main\extensions\complex_memory\script.py:257 in │ │ │ │ 256 [shared.gradio[k] for k in ['character_menu', 'name1', 'name2']], │ │ > 257 [shared.gradio[k] for k in ['name1', 'name2', 'character_picture', 'greeting │ │ 258 chat.redraw_html, shared.reload_inputs, shared.gradio['display']).then(pairs │ └─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┘ KeyError: 'dummy'

Edit : tried the same fix as alabaster fox, and got the same error log.

nephi-dev commented 9 months ago

same error here

exito100 commented 9 months ago

Same errors. Such a pity. This could be a very useful extension for so many use cases - not just role play. Hopefully someone can figure it out...

SomeoneSimple commented 8 months ago

Imitationman's fork seems to function with the current release of oobabooga, I appreciate the effort. From what I can tell he removed the interaction with character json's (which have since been changed to yaml), so the memories in the fork are global.

https://github.com/Imitationman/complex_memory

alabasterfox commented 7 months ago

I'm confirming that SomeoneSimple's answer is a valid workaround for this issue.

I switched the code to Imitationman's forked extension and complex_memory loaded successfully. You can find the complex-memory UI panel on the bottom of the Chat tab

justoboy commented 7 months ago

Imitationman's fork seems to function with the current release of oobabooga, I appreciate the effort. From what I can tell he removed the interaction with character json's (which have since been changed to yaml), so the memories in the fork are global.

@SomeoneSimple thanks for pointing out it was because of the switch from json to yaml. Because of that I was able to fix it by simply replacing all the usage of json with yaml in the script. Below is my fork that seems to be working while still saving the memories to specific characters.

https://github.com/justoboy/complex_memory/