GiusTex / EdgeGPT

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

[Information] Broken with most recent EdgeGPT version #13

Closed Malrama closed 1 year ago

Malrama commented 1 year ago

Hey, sorry to bother you.

Just wanted to inform you that a mayor refraction of EdgeGPT happened again and that this extension is currently broken with the most recent version of EdgeGPT.

As always, thank you very much for your efforts. I really appreciate it

GiusTex commented 1 year ago

Can you try with pip install EdgeGPT==0.8.2 ? (Or a version prior to the update that gives error). This will use a prior working version. If this doesn't work delete the EdgeGPT files in installer_files (you can follow the instructions to update it, where I describe what files to delete). Now I have exams and don't have time to update it. Also, if you can show error log + EdgeGPT version used, thanks. And, sorry for my dumb question, but with refraction do you mean an update?

Edit:

If you want you can make a pull request with the updated extension code, to use the latest EdgeGPT version

acheong08 commented 1 year ago

I will make a PR

acheong08 commented 1 year ago

For problems with the library @ me

chimera15 commented 1 year ago

Oh I didn't realize the extension was actually separate/separate developer was one of the problems, thanks!

here's where I'm stopped btw..

Traceback (most recent call last): File "L:\vicuna\text-generation-webui\modules\extensions.py", line 34, in load_extensions exec(f"import extensions.{name}.script") File "", line 1, in File "L:\vicuna\text-generation-webui\extensions\EdgeGPT\script.py", line 7, in from EdgeGPT import Chatbot, ConversationStyle ImportError: cannot import name 'Chatbot' from 'EdgeGPT' (C:\Users\lrdce\AppData\Local\Programs\Python\Python310\lib\site-packages\EdgeGPTinit.py)

acheong08 commented 1 year ago

My PR will fix it

GiusTex commented 1 year ago

Thanks, but it doesn't work for me, maybe it's the webui, for some reason now it's very slow and if I use one of your latest versions I get errors, while if I use an older one (0.8.2) it works. Some of the errors are:

Unclosed client session
client_session: <aiohttp.client.ClientSession object at 0x00000244C50F69E0>

(I got the Bing output with the error above, so it's a webui error); or:

File "C:\Users\wgius\Desktop\TextGenerationWebui\NewTextGenerationWebui\installer_files\env\lib\site-packages\EdgeGPT\chathub.py", line 163, in ask_stream
    raise Exception(
Exception: InvalidRequest: Culture is not supported. (Parameter 'name')
Italian-Italy is an invalid culture identifier.

here I asked "What hour is now, in Italy?", and this time no character answer nor Bing's one. I tried uninstalling the old files (but I could find only EdgeGPT.version folder). I don't know if installing the webui again can fix it, when I have time I'll try; @acheong08 did your fix work in the webui on your computer? And on your webui/computer, @chimera15 ? If two people can use acheong08's fix it must be an error of mine, but I need feedbacks for now

chimera15 commented 1 year ago

Yes I had that same error with the python file that acheong08 made of unclosed client session.

Should I just try to reinstall or git pull it?

GiusTex commented 1 year ago

I changed some things: I updated the way the script generates the prompt for the character, since the webui has been updated too, and set the EdgeGPT version to 0.8.2, the last working one from my tests. You can git pull (to download my changes) and then do pip install EdgeGPT==0.8.2, you don't need to delete the old code files

chimera15 commented 1 year ago

I did a git pull, and updated everything, still stuck at.

ERROR:Failed to load the extension "EdgeGPT". Traceback (most recent call last): File "K:\oobabooga-windows\oobabooga_windows\text-generation-webui\modules\extensions.py", line 34, in load_extensions exec(f"import extensions.{name}.script") File "", line 1, in File "K:\oobabooga-windows\oobabooga_windows\text-generation-webui\extensions\EdgeGPT\script.py", line 7, in from EdgeGPT import Chatbot, ConversationStyle ImportError: cannot import name 'Chatbot' from 'EdgeGPT' (K:\oobabooga-windows\oobabooga_windows\installer_files\env\lib\site-packages\EdgeGPT__init__.py)

Ok, i'll try .8.2

no difference, fails to load. i think my git pull updated it all the requirements were already installed. You're able to load the extension it sounds like? Did I do something wrong,?

GiusTex commented 1 year ago

can you type conda list EdgeGPT ? To check the version, just in case

chimera15 commented 1 year ago

hmm...

there's no data there?

GiusTex commented 1 year ago

You have to sue cmd_windows.bat and should get something like this: edgegpt 0.8.2 pypi_0 pypi. If you have no data (strange?) do pip install EdgeGPT==0.8.2, but you said you already did it..

chimera15 commented 1 year ago

I'm on windows...

GiusTex commented 1 year ago

me too, good. Can you recap the steps you took? Files used to run commands, how you updated the things, ecc

chimera15 commented 1 year ago

the git pull wouldnt have worked if it wasn't installed?

GiusTex commented 1 year ago

you should have received an error I think

chimera15 commented 1 year ago

K:\oobabooga-windows\oobabooga_windows\text-generation-webui\extensions\EdgeGPT>conda list edgeGPT

packages in environment at C:\Users\Madderhatter\anaconda3:

#

Name Version Build Channel

K:\oobabooga-windows\oobabooga_windows\text-generation-webui\extensions\EdgeGPT>git pull Already up to date.

chimera15 commented 1 year ago

is there a conda component im missing?

GiusTex commented 1 year ago

Try deleting this file, it has part of the core EdgeGPT function by Archeon TextGenerationWebui\installer_files\env\Lib\site-packages\EdgeGPT. Then you need to do pip install EdgeGPT==0.8.2, this will install again the folder with the archeon script

chimera15 commented 1 year ago

ok i need to find that, cause mines in a different directory right.

chimera15 commented 1 year ago

i think its this right? c:\users\madderhatter\appdata\local\packages\pythonsoftwarefoundation.python.3.10_qbz5n2kfra8p0\localcache\local-packages\python310\site-packages

GiusTex commented 1 year ago

yes, it's inside site-packages. But I had 2 folders with 2 site-packages, you need to find the one with the EdgeGPT folder

chimera15 commented 1 year ago

there's a folder in extensions but that's not where edgegpt.py is, its not in that site package, i had it on my other system...actually its in my error message i think, one sec this? K:\oobabooga-windows\oobabooga_windows\installer_files\env\lib\site-packages\EdgeGPTinit.py

GiusTex commented 1 year ago

I couldn't find EdgeGPT.py, but I switched versions different times without deleting files, so if you don't find something it should be a problem, maybe. Try that. When you did pip install etc were you inside the text-gen env?

chimera15 commented 1 year ago

yeah ok that's it, so delete that folder right

GiusTex commented 1 year ago

Cause if you delete the files but pip install them outside the webui env, conda list can't find them. When I use cmd_windows.bat I have this: (C:\Users\wgius\Desktop\TextGenerationWebui\NewTextGenerationWebui\installer_files\env) C:\Users\wgius\Desktop\TextGenerationWebui\NewTextGenerationWebui>), and the usual command is pip install EdgeGPT==0.8.2, then conda list EdgeGPT to check if it's in the webui env

chimera15 commented 1 year ago

it says its open in another folder hmm i shut down my ooba but still cant delete it...

I deleted everything in the folder, still cant delete the folder...interesting

GiusTex commented 1 year ago

Can you tell me what you have when you use cmd_windows.bat? maybe you installed the things in the wrong place; anyway I don't think deleting files is vital, for me it wasn't

chimera15 commented 1 year ago

from where, the ooba install?

GiusTex commented 1 year ago

yes

chimera15 commented 1 year ago

(K:\oobabooga-windows\oobabooga_windows\installer_files\env) K:\oobabooga-windows\oobabooga_windows>

GiusTex commented 1 year ago

good, type the commands again: pip install EdgeGPT==0.8.2, then conda list EdgeGPT to check if it's in the webui env

chimera15 commented 1 year ago

pip install?

chimera15 commented 1 year ago

oic ok #

Name Version Build Channel

edgegpt 0.8.2 pypi_0 pypi

GiusTex commented 1 year ago

glorious

chimera15 commented 1 year ago

ok try to launch ooba then?

GiusTex commented 1 year ago

yeah. If you git pulled before it should work fine. Slow (for me), but fine

chimera15 commented 1 year ago

Oh I got it! Closing server running on port: 7860 INFO:Loading the extension "gallery"... INFO:Loading the extension "EdgeGPT"...

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

i didn't know about the cmd bat thing..what is that? is that conda?

chimera15 commented 1 year ago

ok so you need to see if its slow, let me load my model then thanks so much!

GiusTex commented 1 year ago

Yes, it's a useful script that starts automatically the conda console inside the webui env. So when you install files they are in the right place, probably now you have some EdgeGPT files in your computer, in the default conda env, the don't weight much anyway. Try also making some searches, just in case, to check if everything works well. (The slow part for me is the text generation, not the Bing search, anyway). You're welcome! 👍🏻

chimera15 commented 1 year ago

ahhh, interesting.

Any suggestions what I should ask I havent used it before...ask what time it is or osmething. lol

GiusTex commented 1 year ago

Yeah I ask every time "What time is now, here?", where here is your Country, otherwise it says you another Country. You can turn on print Bing output, in print/debug options

chimera15 commented 1 year ago

oop lots of errors

Traceback (most recent call last): File "K:\oobabooga-windows\oobabooga_windows\installer_files\env\lib\site-packages\gradio\routes.py", line 414, in run_predict output = await app.get_blocks().process_api( File "K:\oobabooga-windows\oobabooga_windows\installer_files\env\lib\site-packages\gradio\blocks.py", line 1323, in process_api result = await self.call_function( File "K:\oobabooga-windows\oobabooga_windows\installer_files\env\lib\site-packages\gradio\blocks.py", line 1067, in call_function prediction = await utils.async_iteration(iterator) File "K:\oobabooga-windows\oobabooga_windows\installer_files\env\lib\site-packages\gradio\utils.py", line 339, in async_iteration return await iterator.anext() File "K:\oobabooga-windows\oobabooga_windows\installer_files\env\lib\site-packages\gradio\utils.py", line 332, in anext return await anyio.to_thread.run_sync( File "K:\oobabooga-windows\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 "K:\oobabooga-windows\oobabooga_windows\installer_files\env\lib\site-packages\anyio_backends_asyncio.py", line 877, in run_sync_in_worker_thread return await future File "K:\oobabooga-windows\oobabooga_windows\installer_files\env\lib\site-packages\anyio_backends_asyncio.py", line 807, in run result = context.run(func, *args) File "K:\oobabooga-windows\oobabooga_windows\installer_files\env\lib\site-packages\gradio\utils.py", line 315, in run_sync_iterator_async return next(iterator) File "K:\oobabooga-windows\oobabooga_windows\text-generation-webui\modules\chat.py", line 332, in generate_chat_reply_wrapper for i, history in enumerate(generate_chat_reply(text, shared.history, state, regenerate, _continue, loading_message=True)): File "K:\oobabooga-windows\oobabooga_windows\text-generation-webui\modules\chat.py", line 321, in generate_chat_reply for history in chatbot_wrapper(text, history, state, regenerate=regenerate, _continue=_continue, loading_message=loading_message): File "K:\oobabooga-windows\oobabooga_windows\text-generation-webui\modules\chat.py", line 230, in chatbot_wrapper prompt = apply_extensions('custom_generate_chat_prompt', text, state, *kwargs) File "K:\oobabooga-windows\oobabooga_windows\text-generation-webui\modules\extensions.py", line 193, in apply_extensions return EXTENSION_MAP[typ](args, kwargs) File "K:\oobabooga-windows\oobabooga_windows\text-generation-webui\modules\extensions.py", line 80, in _apply_custom_generate_chat_prompt return extension.custom_generate_chat_prompt(text, state, kwargs) File "K:\oobabooga-windows\oobabooga_windows\text-generation-webui\extensions\EdgeGPT\script.py", line 199, in custom_generate_chat_prompt asyncio.run(EdgeGPT()) File "K:\oobabooga-windows\oobabooga_windows\installer_files\env\lib\asyncio\runners.py", line 44, in run return loop.run_until_complete(main) File "K:\oobabooga-windows\oobabooga_windows\installer_files\env\lib\asyncio\base_events.py", line 649, in run_until_complete return future.result() File "K:\oobabooga-windows\oobabooga_windows\text-generation-webui\extensions\EdgeGPT\script.py", line 179, in EdgeGPT response = await bot.ask(prompt=UserInput, conversation_style=ConversationStyle.creative) File "K:\oobabooga-windows\oobabooga_windows\installer_files\env\lib\site-packages\EdgeGPT.py", line 756, in ask async for final, response in self.chat_hub.ask_stream( File "K:\oobabooga-windows\oobabooga_windows\installer_files\env\lib\site-packages\EdgeGPT.py", line 661, in ask_stream raise Exception( Exception: InvalidRequest: Culture is not supported. (Parameter 'name') English-United States is an invalid culture identifier.

GiusTex commented 1 year ago

Uhm that's caused by archeon merge. Tell me what you have at line 7 of my extension script. You should have this, inside script.py: from EdgeGPT import Chatbot, ConversationStyle

chimera15 commented 1 year ago

ok in the edge folder in extensions right?

GiusTex commented 1 year ago

yeah. I feel like I'm using whatsapp. Strange but nice

chimera15 commented 1 year ago

from EdgeGPT import Chatbot, ConversationStyle

GiusTex commented 1 year ago

Uhm, can you do again conda list EdgeGPT?

chimera15 commented 1 year ago

same? edgegpt 0.8.2 pypi_0 pypi

GiusTex commented 1 year ago

Can you delete this file ? K:\oobabooga-windows\oobabooga_windows\installer_files\env\lib\site-packages\EdgeGPT.py. Maybe some files haven't been updated. After that you need to pip install EdgeGPT==0.8.2 again, to download the older file. Try deleting every EdgeGPT folder you find, before pip installing again