brucepro / Memoir

Memoir+ a persona extension for Text Gen Web UI. That includes memory, emotions, command handling and more.
MIT License
174 stars 21 forks source link

RAG Error: sqlite3 #22

Closed BahamutRU closed 8 months ago

BahamutRU commented 8 months ago

sqlite3.OperationalError: unable to open database file When I ask the question.

brucepro commented 8 months ago

Does the database exist in the storage folder. There is an error where when your character name has special characters it doesn't make the database in the textgen dir /extensions/Memoir/storage/sqlite

BahamutRU commented 8 months ago

Does the database exist in the storage folder. There is an error where when your character name has special characters it doesn't make the database in the textgen dir /extensions/Memoir/storage/sqlite

Thx, my fault with directories.

But next:

Traceback (most recent call last):
  File "D:\NN\text-generation-webui-gpu-12\installer_files\env\Lib\site-packages\gradio\queueing.py", line 407, in call_prediction
    output = await route_utils.call_process_api(
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "D:\NN\text-generation-webui-gpu-12\installer_files\env\Lib\site-packages\gradio\route_utils.py", line 226, in call_process_api
    output = await app.get_blocks().process_api(
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "D:\NN\text-generation-webui-gpu-12\installer_files\env\Lib\site-packages\gradio\blocks.py", line 1550, in process_api
    result = await self.call_function(
             ^^^^^^^^^^^^^^^^^^^^^^^^^
  File "D:\NN\text-generation-webui-gpu-12\installer_files\env\Lib\site-packages\gradio\blocks.py", line 1199, in call_function
    prediction = await utils.async_iteration(iterator)
                 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "D:\NN\text-generation-webui-gpu-12\installer_files\env\Lib\site-packages\gradio\utils.py", line 519, in async_iteration
    return await iterator.__anext__()
           ^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "D:\NN\text-generation-webui-gpu-12\installer_files\env\Lib\site-packages\gradio\utils.py", line 512, in __anext__
    return await anyio.to_thread.run_sync(
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "D:\NN\text-generation-webui-gpu-12\installer_files\env\Lib\site-packages\anyio\to_thread.py", line 33, in run_sync
    return await get_asynclib().run_sync_in_worker_thread(
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "D:\NN\text-generation-webui-gpu-12\installer_files\env\Lib\site-packages\anyio\_backends\_asyncio.py", line 877, in run_sync_in_worker_thread
    return await future
           ^^^^^^^^^^^^
  File "D:\NN\text-generation-webui-gpu-12\installer_files\env\Lib\site-packages\anyio\_backends\_asyncio.py", line 807, in run
    result = context.run(func, *args)
             ^^^^^^^^^^^^^^^^^^^^^^^^
  File "D:\NN\text-generation-webui-gpu-12\installer_files\env\Lib\site-packages\gradio\utils.py", line 495, in run_sync_iterator_async
    return next(iterator)
           ^^^^^^^^^^^^^^
  File "D:\NN\text-generation-webui-gpu-12\installer_files\env\Lib\site-packages\gradio\utils.py", line 649, in gen_wrapper
    yield from f(*args, **kwargs)
  File "D:\NN\text-generation-webui-gpu-12\modules\chat.py", line 405, in generate_chat_reply_wrapper
    for i, history in enumerate(generate_chat_reply(text, state, regenerate, _continue, loading_message=True, for_ui=True)):
  File "D:\NN\text-generation-webui-gpu-12\modules\chat.py", line 373, in generate_chat_reply
    for history in chatbot_wrapper(text, state, regenerate=regenerate, _continue=_continue, loading_message=loading_message, for_ui=for_ui):
  File "D:\NN\text-generation-webui-gpu-12\modules\chat.py", line 310, in chatbot_wrapper
    prompt = apply_extensions('custom_generate_chat_prompt', text, state, **kwargs)
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "D:\NN\text-generation-webui-gpu-12\modules\extensions.py", line 231, in apply_extensions
    return EXTENSION_MAP[typ](*args, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "D:\NN\text-generation-webui-gpu-12\modules\extensions.py", line 107, in _apply_custom_generate_chat_prompt
    return extension.custom_generate_chat_prompt(text, state, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "D:\NN\text-generation-webui-gpu-12\extensions\Memoir\script.py", line 440, in custom_generate_chat_prompt
    result = chat.generate_chat_prompt(user_input, state, **kwargs)
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "D:\NN\text-generation-webui-gpu-12\modules\chat.py", line 173, in generate_chat_prompt
    prompt = make_prompt(messages)
             ^^^^^^^^^^^^^^^^^^^^^
  File "D:\NN\text-generation-webui-gpu-12\modules\chat.py", line 150, in make_prompt
    prefix = apply_extensions('bot_prefix', prefix, state)
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "D:\NN\text-generation-webui-gpu-12\modules\extensions.py", line 231, in apply_extensions
    return EXTENSION_MAP[typ](*args, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "D:\NN\text-generation-webui-gpu-12\modules\extensions.py", line 89, in _apply_string_extensions
    text = func(*args, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^
  File "D:\NN\text-generation-webui-gpu-12\extensions\Memoir\script.py", line 130, in bot_prefix_modifier
    stm_polarity_data = persona.get_stm_polarity_timeframe(past_time_str)
                        ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "D:\NN\text-generation-webui-gpu-12\extensions\Memoir\persona\persona.py", line 92, in get_stm_polarity_timeframe
    average_polarity_score = polarity_score/num_rows
                             ~~~~~~~~~~~~~~^~~~~~~~~
TypeError: unsupported operand type(s) for /: 'NoneType' and 'int'
BahamutRU commented 8 months ago

Persona support cyrillic symbols? Or only latin?

brucepro commented 8 months ago

I should prolly go through and check all the string parsing. I didn't test in anything but English.

brucepro commented 8 months ago

You should be able to just set the polarity there to 0. I will work on a fix. average_polarity_score = 0

BahamutRU commented 8 months ago

You should be able to just set the polarity there to 0. I will work on a fix. average_polarity_score = 0

How should I do this?

brucepro commented 8 months ago

Edit line 92 of D:\NN\text-generation-webui-gpu-12\extensions\Memoir\persona\persona.py", line 92 change to average_polarity_score = 0

BahamutRU commented 8 months ago

Edit line 92 of D:\NN\text-generation-webui-gpu-12\extensions\Memoir\persona\persona.py", line 92 change to average_polarity_score = 0

Thanks! It's working now! Let's test… =)