$ in GALACTICA model causes RuntimeError: main thread is not in main loop
Describe the bug
Webui stops reacting and output
Exception ignored in: <function Image.__del__ at 0x7f165012eef0>
Traceback (most recent call last):
File "/home/fgdfgfthgr/anaconda3/envs/textgen/lib/python3.10/tkinter/__init__.py", line 4056, in __del__
self.tk.call('image', 'delete', self.name)
RuntimeError: main thread is not in main loop
when there is two $ in the input box.
Is there an existing issue for this?
- [X] I have searched the existing issues
Reproduction
- Load a GALACTICA model
- Put "What's the $7$-th" in the input box
- Press Generate
- Look at the terminal
Screenshot

Logs
Exception ignored in: <function Image.__del__ at 0x7f165012eef0>
Traceback (most recent call last):
File "/home/fgdfgfthgr/anaconda3/envs/textgen/lib/python3.10/tkinter/__init__.py", line 4056, in __del__
self.tk.call('image', 'delete', self.name)
RuntimeError: main thread is not in main loop
### System Info
```shell
CPU: Ryzen 5500
GPU: 1050ti
OS: Linux Mint 21.1
Command: python server.py --model GALACTICA-6.7b --cpu
I cannot reproduce this issue. Using the same command as yours, I get an output without any errors:

Same problem here, I've had this problem for a week though when I first downloaded the webui and Galactica. I spoke with someone on Discord back then, and told me he had the same problem so I assumed it was a known problem.

System Info
CPU: Intel 12900k
GPU: 3090TI
OS: Windows 11
Command: call python server.py --auto-devices --cai-chat --bf16 --load-in-8bit
Are you using the latest gradio version?
pip install -r requirements.txt --upgrade
Are you using the latest gradio version?
pip install -r requirements.txt --upgrade
Updated to the latest gradio, still face the same issue. My environment:
accelerate 0.18.0
aiofiles 23.1.0
aiohttp 3.8.4
aiosignal 1.3.1
altair 4.2.2
anyio 3.6.2
async-timeout 4.0.2
attrs 22.2.0
bitsandbytes 0.37.2
certifi 2022.12.7
charset-normalizer 3.1.0
click 8.1.3
cmake 3.26.0
contourpy 1.0.7
cycler 0.11.0
datasets 2.10.1
dill 0.3.6
entrypoints 0.4
fastapi 0.95.0
ffmpy 0.3.0
filelock 3.10.0
flexgen 0.1.7
fonttools 4.39.2
frozenlist 1.3.3
fsspec 2023.3.0
gradio 3.23.0
h11 0.14.0
httpcore 0.16.3
httpx 0.23.3
huggingface-hub 0.13.2
idna 3.4
Jinja2 3.1.2
jsonschema 4.17.3
kiwisolver 1.4.4
linkify-it-py 2.0.0
lit 15.0.7
Markdown 3.4.3
markdown-it-py 2.2.0
MarkupSafe 2.1.2
matplotlib 3.7.1
mdit-py-plugins 0.3.3
mdurl 0.1.2
mpmath 1.3.0
multidict 6.0.4
multiprocess 0.70.14
networkx 3.0
numpy 1.24.2
nvidia-cublas-cu11 11.10.3.66
nvidia-cuda-cupti-cu11 11.7.101
nvidia-cuda-nvrtc-cu11 11.7.99
nvidia-cuda-runtime-cu11 11.7.99
nvidia-cudnn-cu11 8.5.0.96
nvidia-cufft-cu11 10.9.0.58
nvidia-curand-cu11 10.2.10.91
nvidia-cusolver-cu11 11.4.0.1
nvidia-cusparse-cu11 11.7.4.91
nvidia-nccl-cu11 2.14.3
nvidia-nvtx-cu11 11.7.91
orjson 3.8.7
packaging 23.0
pandas 1.5.3
peft 0.2.0
Pillow 9.4.0
pip 23.0.1
psutil 5.9.4
PuLP 2.7.0
pyarrow 11.0.0
pycryptodome 3.17
pydantic 1.10.6
pydub 0.25.1
pyparsing 3.0.9
pyrsistent 0.19.3
python-dateutil 2.8.2
python-multipart 0.0.6
pytz 2022.7.1
PyYAML 6.0
quant-cuda 0.0.0
regex 2022.10.31
requests 2.28.2
responses 0.18.0
rfc3986 1.5.0
rwkv 0.7.1
safetensors 0.3.0
semantic-version 2.10.0
sentencepiece 0.1.97
setuptools 65.6.3
six 1.16.0
sniffio 1.3.0
starlette 0.26.1
sympy 1.11.1
tokenizers 0.13.2
toolz 0.12.0
torch 2.0.0
tqdm 4.65.0
transformers 4.28.0.dev0
triton 2.0.0
typing_extensions 4.5.0
uc-micro-py 1.0.1
urllib3 1.26.15
uvicorn 0.21.1
websockets 10.4
wheel 0.38.4
xxhash 3.2.0
yarl 1.8.2
Updated to the latest webui version as well as dependences again. Tried launching in both terminal and Pycharm, still the same issue.
Updated to gradio 3.24.0 version, still no improvement. Maybe it's something to do with web browser? I was using firefox.
I've this problem too, And i found a fix. in server.py add in the first line:
import matplotlib
matplotlib.use('Agg')
And it work for me :)
@DanielusG I have incorporated your fix here https://github.com/oobabooga/text-generation-webui/commit/b4af319fa2190f008bcc9b6b3f73919e9035fde1
Seems fixed indeed!