GiusTex / EdgeGPT

Extension for Text Generation Webui based on EdgeGPT, a reverse engineered API of Microsoft's Bing Chat AI
125 stars 5 forks source link

Error when beginning chats #19

Closed RandomInternetPreson closed 1 year ago

RandomInternetPreson commented 1 year ago

Hello, I'm really interested in using your extension!! I can load it properly, have done the requirments.txt stuff, but when I begin a chat this is the error I'm getting:

To create a public link, set share=True in launch(). 2023-07-04 11:09:13 INFO:Loading WizardLM-33B-V1.0-Uncensored-SuperHOT-8K-GPTQ... 2023-07-04 11:09:21 INFO:Loading the universal LLaMA tokenizer from models\oobabooga_llama-tokenizer... 2023-07-04 11:09:21 INFO:Loaded the model in 7.36 seconds.

Traceback (most recent call last): File "F:\oobaboogaJune30Alt\oobabooga_windows\installer_files\env\lib\site-packages\gradio\routes.py", line 427, in run_predict output = await app.get_blocks().process_api( File "F:\oobaboogaJune30Alt\oobabooga_windows\installer_files\env\lib\site-packages\gradio\blocks.py", line 1323, in process_api result = await self.call_function( File "F:\oobaboogaJune30Alt\oobabooga_windows\installer_files\env\lib\site-packages\gradio\blocks.py", line 1067, in call_function prediction = await utils.async_iteration(iterator) File "F:\oobaboogaJune30Alt\oobabooga_windows\installer_files\env\lib\site-packages\gradio\utils.py", line 336, in async_iteration return await iterator.anext() File "F:\oobaboogaJune30Alt\oobabooga_windows\installer_files\env\lib\site-packages\gradio\utils.py", line 329, in anext return await anyio.to_thread.run_sync( File "F:\oobaboogaJune30Alt\oobabooga_windows\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 "F:\oobaboogaJune30Alt\oobabooga_windows\installer_files\env\lib\site-packages\anyio_backends_asyncio.py", line 877, in run_sync_in_worker_thread return await future File "F:\oobaboogaJune30Alt\oobabooga_windows\installer_files\env\lib\site-packages\anyio_backends_asyncio.py", line 807, in run result = context.run(func, *args) File "F:\oobaboogaJune30Alt\oobabooga_windows\installer_files\env\lib\site-packages\gradio\utils.py", line 312, in run_sync_iterator_async return next(iterator) File "F:\oobaboogaJune30Alt\oobabooga_windows\text-generation-webui\modules\chat.py", line 304, in generate_chat_reply_wrapper for i, history in enumerate(generate_chat_reply(text, state, regenerate, _continue, loading_message=True)): File "F:\oobaboogaJune30Alt\oobabooga_windows\text-generation-webui\modules\chat.py", line 289, in generate_chat_reply for history in chatbot_wrapper(text, state, regenerate=regenerate, _continue=_continue, loading_message=loading_message): File "F:\oobaboogaJune30Alt\oobabooga_windows\text-generation-webui\modules\chat.py", line 205, in chatbot_wrapper prompt = apply_extensions('custom_generate_chat_prompt', text, state, **kwargs) File "F:\oobaboogaJune30Alt\oobabooga_windows\text-generation-webui\modules\extensions.py", line 199, in apply_extensions

RandomInternetPreson commented 1 year ago

I should note, it's not just the beginning of chats, I can start a chat, then activate the extension, and get the same error.

GiusTex commented 1 year ago

Uhm, in the log I don't see problems related to EdgeGpt nor its dependencies...

I also don't see the INFO:EdgeGPT extension loaded part

RandomInternetPreson commented 1 year ago

Sorry about that, yes I do have the latest version of webui. Yes, the webui works without the extension. Yes, I have updated the extension.

Here is the error I'm getting, I think I might not have copied everything the fist time:

2023-07-04 15:18:05 INFO:Loading the extension "gallery"... 2023-07-04 15:18:05 INFO:Loading the extension "EdgeGPT"... acheong08 EdgeGPT core script: 0.11.8

Thanks for using the EdgeGPT extension! If you encounter any bug or you have some nice idea to add, write it on the issue page here: https://github.com/GiusTex/EdgeGPT/issues Starting streaming server at ws://127.0.0.1:5005/api/v1/stream Starting API at http://127.0.0.1:5000/api Running on local URL: http://127.0.0.1:7860

To create a public link, set share=True in launch(). Traceback (most recent call last): File "F:\oobaboogaJuly4\oobabooga_windows\installer_files\env\lib\site-packages\gradio\routes.py", line 427, in run_predict output = await app.get_blocks().process_api( File "F:\oobaboogaJuly4\oobabooga_windows\installer_files\env\lib\site-packages\gradio\blocks.py", line 1323, in process_api result = await self.call_function( File "F:\oobaboogaJuly4\oobabooga_windows\installer_files\env\lib\site-packages\gradio\blocks.py", line 1067, in call_function prediction = await utils.async_iteration(iterator) File "F:\oobaboogaJuly4\oobabooga_windows\installer_files\env\lib\site-packages\gradio\utils.py", line 336, in async_iteration return await iterator.anext() File "F:\oobaboogaJuly4\oobabooga_windows\installer_files\env\lib\site-packages\gradio\utils.py", line 329, in anext return await anyio.to_thread.run_sync( File "F:\oobaboogaJuly4\oobabooga_windows\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 "F:\oobaboogaJuly4\oobabooga_windows\installer_files\env\lib\site-packages\anyio_backends_asyncio.py", line 877, in run_sync_in_worker_thread return await future File "F:\oobaboogaJuly4\oobabooga_windows\installer_files\env\lib\site-packages\anyio_backends_asyncio.py", line 807, in run result = context.run(func, *args) File "F:\oobaboogaJuly4\oobabooga_windows\installer_files\env\lib\site-packages\gradio\utils.py", line 312, in run_sync_iterator_async return next(iterator) File "F:\oobaboogaJuly4\oobabooga_windows\text-generation-webui\modules\chat.py", line 304, in generate_chat_reply_wrapper for i, history in enumerate(generate_chat_reply(text, state, regenerate, _continue, loading_message=True)): File "F:\oobaboogaJuly4\oobabooga_windows\text-generation-webui\modules\chat.py", line 289, in generate_chat_reply for history in chatbot_wrapper(text, state, regenerate=regenerate, _continue=_continue, loading_message=loading_message): File "F:\oobaboogaJuly4\oobabooga_windows\text-generation-webui\modules\chat.py", line 205, in chatbot_wrapper prompt = apply_extensions('custom_generate_chat_prompt', text, state, *kwargs) File "F:\oobaboogaJuly4\oobabooga_windows\text-generation-webui\modules\extensions.py", line 199, in apply_extensions return EXTENSION_MAP[typ](args, kwargs) File "F:\oobaboogaJuly4\oobabooga_windows\text-generation-webui\modules\extensions.py", line 86, in _apply_custom_generate_chat_prompt return extension.custom_generate_chat_prompt(text, state, kwargs) File "F:\oobaboogaJuly4\oobabooga_windows\text-generation-webui\extensions\EdgeGPT\script.py", line 131, in custom_generate_chat_prompt history = kwargs.get('history', shared.history)['internal'] AttributeError: module 'modules.shared' has no attribute 'history'

RandomInternetPreson commented 1 year ago

I think it might be related to this update:

https://old.reddit.com/r/oobaboogazz/comments/14q3v2y/news_added_sessions_basic_multiuser_support/

GiusTex commented 1 year ago

Are you using notebook mode? It isn't supported that one

RandomInternetPreson commented 1 year ago

Nope, I'm using chat mode, I've tried a few different modes and couldn't get it to work. I'm getting errors with other extensions, like bark_tts.

AttributeError: module 'modules.shared' has no attribute 'character' = issue with EdgeGPT

AttributeError: module 'modules.shared' has no attribute 'history' = issue with bark_tts

I think it has to do with the change to oobabooga with the implementation of saved sessions.

GiusTex commented 1 year ago

I'll look into it after the exams, sorry, maybe I can before, but I don't guarantee. For now you can use an older commit, yesterday or the day before it worked

RandomInternetPreson commented 1 year ago

I understand, and thank you for the suggestion and your time. A previous version does work with your awesome extension :3, it looks like the latest update broke stuff.

RandomInternetPreson commented 1 year ago

Yup, it looks like it is an issue with the latest version of webui, straight from oobabooga themself:

https://old.reddit.com/r/oobaboogazz/comments/14q3v2y/news_added_sessions_basic_multiuser_support/jqoj08u/

GiusTex commented 1 year ago

Thanks for the post, I see he mentioned global variables and history and character, maybe looking at them is a starting point (for me, to understand how to fix/update the extension)

RandomInternetPreson commented 1 year ago

I was looking to see what changed between the version that is working and the the version that is not working, it looks like this is when EdgeGPT stopped working with oobabooga:

https://github.com/oobabooga/text-generation-webui/commit/4b1804a4385e0fbcbd179518c3db7e6699e9d524#diff-15faa364afc7fd40ccc1e6a38893b2dac62c846715710dfbe44f25fb65205440

The history and character variables are removed from the shared.py file and the extensions.py file (https://github.com/oobabooga/text-generation-webui/commit/4b1804a4385e0fbcbd179518c3db7e6699e9d524#diff-9557b7523edffd1a07709d5409741791239e953340b12071cb78b909d529eaa4) has a new variable called "state"

I tried editing the shared.py file to include the removed lines, and EdgeGPT made it further in the newest version of oobabooga but gave me an error with the extensions.py file, saying it was missing an input, I suspect it was this "state" variable.

GiusTex commented 1 year ago

I think there might be some new/different lines in generate_chat_prompt in chat.py, I use that part very much. The first thing I would do would be checking my custom_generate_chat_prompt and the generate_chat_prompt of the webui, to make sure custom_generate_chat_prompt is updated and include all the new global variables etc. If there are new parts or functions that needs to be imported they can be imported with the lines at the top (from file import function/thing)

GiusTex commented 1 year ago

I updated the extension, now it should work, tell me if it works for you too. If you get a captcha error you can try writing something on bing.com to complete the captcha, and if you still get the error you can use the cookies option (after writing something on bing.com)