Open CognitiveDiffusion opened 1 year ago
I have the same problem on Debian11: --Unable to load complex memories for character AI. filename: characters/AI.json. Using defaults. Traceback (most recent call last): File "/home/olly/miniconda3/envs/textgen/lib/python3.10/site-packages/gradio/routes.py", line 427, in run_predict output = await app.get_blocks().process_api( File "/home/olly/miniconda3/envs/textgen/lib/python3.10/site-packages/gradio/blocks.py", line 1323, in process_api result = await self.call_function( File "/home/olly/miniconda3/envs/textgen/lib/python3.10/site-packages/gradio/blocks.py", line 1051, in call_function prediction = await anyio.to_thread.run_sync( File "/home/olly/miniconda3/envs/textgen/lib/python3.10/site-packages/anyio/to_thread.py", line 33, in run_sync return await get_async_backend().run_sync_in_worker_thread( File "/home/olly/miniconda3/envs/textgen/lib/python3.10/site-packages/anyio/_backends/_asyncio.py", line 2106, in run_sync_in_worker_thread return await future File "/home/olly/miniconda3/envs/textgen/lib/python3.10/site-packages/anyio/_backends/_asyncio.py", line 833, in run result = context.run(func, *args) File "/home/olly/Dokumente/oobabooga_linux/text-generation-webui/extensions/complex_memory/script.py", line 195, in update_pairs save_pairs() File "/home/olly/Dokumente/oobabooga_linux/text-generation-webui/extensions/complex_memory/script.py", line 56, in save_pairs filename = f"characters/{shared.character}.json" AttributeError: module 'modules.shared' has no attribute 'character'
pip show gradio Name: gradio Version: 3.33.1 Summary: Python library for easily interacting with trained machine learning models Home-page: Author: Author-email: Abubakar Abid team@gradio.app, Ali Abid team@gradio.app, Ali Abdalla team@gradio.app, Dawood Khan team@gradio.app, Ahsen Khaliq team@gradio.app, Pete Allen team@gradio.app, Ömer Faruk Özdemir team@gradio.app License: Location: /home/olly/miniconda3/envs/textgen/lib/python3.10/site-packages Requires: aiofiles, aiohttp, altair, fastapi, ffmpy, gradio-client, httpx, huggingface-hub, jinja2, markdown-it-py, markupsafe, matplotlib, mdit-py-plugins, numpy, orjson, pandas, pillow, pydantic, pydub, pygments, python-multipart, pyyaml, requests, semantic-version, typing-extensions, uvicorn, websockets Required-by:
Same problem on Windows 11.
Have found some problems:
Suggested fixes for problems 1 & 2:
56 filename = f"characters/{shared.settings['character']}.json"
62 with open(filename, 'r', encoding='utf-8') as f:
72 with open(filename, 'w', encoding='utf-8') as f:
88 with open(f"extensions/complex_memory/{filename}", 'rb', encoding='utf-8') as f:
107 with open(filename, 'r', encoding='utf-8') as f:
133 with open(filename, 'w', encoding='utf-8') as f:
142 with open(filename, 'r', encoding='utf-8') as f:
These changes allow the module to load without error messages and YAML Character files to be opened without crashing Python/WebUI.
Support for YAML character files is out of scope for this quick bug fix.
I was able to make some additional minor changes to the script to work around the YAML character file change. If after making the changes indicated by @PaulCoddington you make the following four changes, it separates the memory from the character file. While this breaks the ease of movement for characters, it allows the extension to work with both json and yaml characters. Existing characters would need a one-time migration which is as simple as copying the character.json file into the new directory. The line 212 change adds the extension name to the accordion header and is not needed for the yaml character fix/change.
Make a new directory inside the complex memory directory.
mkdir extensions/complex_memory/characters
Line 56, change
filename = f"characters/{shared.settings['character']}.json"
filename = f"extensions/complex_memory/characters/{shared.settings['character']}.json"
Line 102, change
filename = f"characters/{shared.settings['character']}.json"
filename = f"extensions/complex_memory/characters/{shared.settings['character']}.json"
Line 212, change
with gr.Accordion("", open=True):
with gr.Accordion("Complex Memory", open=True):
So it seems like the bug is back (maybe Ooba was changed again?).
File "E:\StableDiffusion\text-generation-webui\text-generation-webui\extensions\complex_memory\script.py", line 56, in save_pairs filename = f"characters/{shared.character}.json" AttributeError: module 'modules.shared' has no attribute 'character'