KoboldAI / KoboldAI-Client

For GGUF support, see KoboldCPP: https://github.com/LostRuins/koboldcpp
https://koboldai.com
GNU Affero General Public License v3.0
3.51k stars 758 forks source link

TypeError: emit() got an unexpected keyword argument 'broadcast' #264

Closed alekratz closed 1 year ago

alekratz commented 1 year ago

Hello, I'm really enjoying KoboldAI. I have been using the Google Colab version primarily. Earlier today, I was able to run the Colab version without a problem. However, as of writing, I get the title error on startup. I've included the stack trace at the bottom under the fold (it is quite long).

What I have tried

I did some digging on this and it appears that very recently (a few hours ago as of writing this) the python-socketio project (used by the Flask-socketio dependency) had a minor point update from 5.7 -> 5.8. I haven't looked to closely at it, but I believe this is the package where the error is originating. When I run the ipynb, the install dialog indicates that it is installing this very new version of python-socketio:

Collecting python-socketio>=5.0.2
  Downloading python_socketio-5.8.0-py3-none-any.whl (56 kB)

I believe this is the cause of the error, but I haven't gone on to install an older version and verify yet.

What I haven't tried

Stacktrace from Google Colab

``` ERROR | __main__:do_connect:4137 - An error has been caught in function 'do_connect', process 'MainProcess' (10290), thread 'MainThread' (140021992789824): Traceback (most recent call last): File "/usr/local/lib/python3.9/dist-packages/flask_socketio/__init__.py", line 824, in _handle_event ret = handler(auth) │ └ None └ File "/content/KoboldAI-Client/aiserver.py", line 592, in g return f(*a, **k) │ │ └ {} │ └ (None,) └ TypeError: do_connect() takes 0 positional arguments but 1 was given During handling of the above exception, another exception occurred: Traceback (most recent call last): File "/usr/local/lib/python3.9/dist-packages/eventlet/greenthread.py", line 221, in main result = function(*args, **kwargs) │ │ └ {} │ └ ([('127.0.0.1', 36202), , 'idle'],) └ > File "/usr/local/lib/python3.9/dist-packages/eventlet/wsgi.py", line 837, in process_request proto.__init__(conn_state, self) │ │ │ └ │ │ └ [('127.0.0.1', 36202), , 'idle'] │ └ File "/usr/local/lib/python3.9/dist-packages/eventlet/wsgi.py", line 350, in __init__ self.handle() │ └ File "/usr/local/lib/python3.9/dist-packages/eventlet/wsgi.py", line 383, in handle self.handle_one_request() │ └ File "/usr/local/lib/python3.9/dist-packages/eventlet/wsgi.py", line 459, in handle_one_request self.handle_one_response() │ └ File "/usr/local/lib/python3.9/dist-packages/eventlet/wsgi.py", line 569, in handle_one_response result = self.application(self.environ, start_response) │ │ │ │ └ .start_response at 0x7f588df89b80> │ │ │ └ {'wsgi.errors': <_io.TextIOWrapper name='' mode='w' encoding='utf-8'>, 'wsgi.version': (1, 0), 'wsgi.multithread': Tr... │ │ └ │ └ File "/usr/local/lib/python3.9/dist-packages/flask/app.py", line 2551, in __call__ return self.wsgi_app(environ, start_response) │ │ │ └ .start_response at 0x7f588df89b80> │ │ └ {'wsgi.errors': <_io.TextIOWrapper name='' mode='w' encoding='utf-8'>, 'wsgi.version': (1, 0), 'wsgi.multithread': Tr... │ └ File "/usr/local/lib/python3.9/dist-packages/flask_socketio/__init__.py", line 43, in __call__ return super(_SocketIOMiddleware, self).__call__(environ, │ │ └ {'wsgi.errors': <_io.TextIOWrapper name='' mode='w' encoding='utf-8'>, 'wsgi.version': (1, 0), 'wsgi.multithread': Tr... │ └ File "/usr/local/lib/python3.9/dist-packages/engineio/middleware.py", line 63, in __call__ return self.engineio_app.handle_request(environ, start_response) │ │ │ │ └ .start_response at 0x7f588df89b80> │ │ │ └ {'wsgi.errors': <_io.TextIOWrapper name='' mode='w' encoding='utf-8'>, 'wsgi.version': (1, 0), 'wsgi.multithread': Tr... │ │ └ │ └ File "/usr/local/lib/python3.9/dist-packages/socketio/server.py", line 607, in handle_request return self.eio.handle_request(environ, start_response) │ │ │ │ └ .start_response at 0x7f588df89b80> │ │ │ └ {'wsgi.errors': <_io.TextIOWrapper name='' mode='w' encoding='utf-8'>, 'wsgi.version': (1, 0), 'wsgi.multithread': Tr... │ │ └ │ └ File "/usr/local/lib/python3.9/dist-packages/engineio/server.py", line 430, in handle_request socket.handle_post_request(environ) │ │ └ {'wsgi.errors': <_io.TextIOWrapper name='' mode='w' encoding='utf-8'>, 'wsgi.version': (1, 0), 'wsgi.multithread': Tr... │ └ File "/usr/local/lib/python3.9/dist-packages/engineio/socket.py", line 126, in handle_post_request self.receive(pkt) │ │ └ │ └ File "/usr/local/lib/python3.9/dist-packages/engineio/socket.py", line 59, in receive self.server._trigger_event('message', self.sid, pkt.data, │ │ │ │ │ │ └ '0' │ │ │ │ │ └ │ │ │ │ └ 'A-WC4czPo1C_s6yrAAAC' │ │ │ └ │ │ └ │ └ File "/usr/local/lib/python3.9/dist-packages/engineio/server.py", line 621, in _trigger_event return self.handlers[event](*args) │ │ │ └ ('A-WC4czPo1C_s6yrAAAC', '0') │ │ └ 'message' │ └ {'connect': >, 'message': File "/usr/local/lib/python3.9/dist-packages/socketio/server.py", line 791, in _handle_eio_message self._handle_connect(eio_sid, pkt.namespace, pkt.data) │ │ │ │ │ │ └ None │ │ │ │ │ └ │ │ │ │ └ None │ │ │ └ │ │ └ 'A-WC4czPo1C_s6yrAAAC' │ └ File "/usr/local/lib/python3.9/dist-packages/socketio/server.py", line 681, in _handle_connect success = self._trigger_event( │ └ File "/usr/local/lib/python3.9/dist-packages/socketio/server.py", line 758, in _trigger_event return self.handlers[namespace][event](*args) │ │ │ │ └ ('D3tmljBsEfFbKuXiAAAD', {'wsgi.errors': <_io.TextIOWrapper name='' mode='w' encoding='utf-8'>, 'wsgi.version': (1, 0... │ │ │ └ 'connect' │ │ └ '/' │ └ {'/': {'get_model_info': , 'OAI_Key_Update': File "/usr/local/lib/python3.9/dist-packages/flask_socketio/__init__.py", line 282, in _handler return self._handle_event(handler, message, namespace, sid, │ │ │ │ │ └ 'D3tmljBsEfFbKuXiAAAD' │ │ │ │ └ '/' │ │ │ └ 'connect' │ │ └ │ └ File "/usr/local/lib/python3.9/dist-packages/flask_socketio/__init__.py", line 826, in _handle_event ret = handler() └ File "/content/KoboldAI-Client/aiserver.py", line 592, in g return f(*a, **k) │ │ └ {} │ └ () └ > File "/content/KoboldAI-Client/aiserver.py", line 4137, in do_connect ui2_connect() └ File "/content/KoboldAI-Client/aiserver.py", line 8037, in ui2_connect koboldai_vars.send_to_ui() │ └ File "/content/KoboldAI-Client/koboldai_settings.py", line 192, in send_to_ui self._model_settings.send_to_ui() │ │ └ │ └ File "/content/KoboldAI-Client/koboldai_settings.py", line 642, in send_to_ui process_variable_changes(self._socketio, self.__class__.__name__.replace("_settings", ""), name, value, None) │ │ │ │ │ │ │ └ 0 │ │ │ │ │ │ └ 'simple_randomness' │ │ │ │ │ └ │ │ │ │ └ │ │ │ └ │ │ └ │ └ File "/content/KoboldAI-Client/koboldai_settings.py", line 91, in process_variable_changes socketio.emit("var_changed", {"classname": classname, "name": name, "old_value": clean_var_for_emit(old_value), "value": clean_var_for_emit(value), "transmit_time": transmit_time}, include_self=True, broadcast=True, room=room) │ │ │ │ │ │ │ │ │ └ 'UI_2' │ │ │ │ │ │ │ │ └ '2023-03-16 23:32:34.129879' │ │ │ │ │ │ │ └ 0 │ │ │ │ │ │ └ │ │ │ │ │ └ None │ │ │ │ └ │ │ │ └ 'simple_randomness' │ │ └ 'model' │ └ File "/usr/local/lib/python3.9/dist-packages/flask_socketio/__init__.py", line 462, in emit self.server.emit(event, *args, namespace=namespace, to=to, │ │ │ │ │ │ └ 'UI_2' │ │ │ │ │ └ '/' │ │ │ │ └ ({'classname': 'model', 'name': 'simple_randomness', 'old_value': None, 'value': 0, 'transmit_time': '2023-03-16 23:32:34.129... │ │ │ └ 'var_changed' │ │ └ │ └ TypeError: emit() got an unexpected keyword argument 'broadcast' ```
henk717 commented 1 year ago

Sorry for not getting back to you sooner since you submitted this as midnight for me, but your diagnosis that python-socketio was the cause saved me going trough all the recently updated dependencies and their dependencies manually so it sped the fix up by a decent amount last night. The issue is resolved.

Kadah commented 1 year ago

I'm getting this since 219b824b9b239c1b14b1df553622a465d63f433a which changed python-socketio to 5.7.2. Somehow updating to 5.8.0 actually resolves the error for me.