Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

main thread is not in main loop #16

Open
ceciliadiana00 opened this issue Oct 31, 2023 · 0 comments
Open

main thread is not in main loop #16

ceciliadiana00 opened this issue Oct 31, 2023 · 0 comments

Comments

@ceciliadiana00
Copy link

ceciliadiana00 commented Oct 31, 2023

I start training the model as the documentation suggests and it suddenly stops at a random point of the training (I have run it several times and it stopped in all of them at different epochs). The error description is as follows:

train Epoch: [12][ 85/295] Time 1.469 ( 1.454) Data 0.007 ( 0.047) Loss 8.0506e-02 (1.8724e-01)
train Epoch: [12][ 86/295] Time 1.452 ( 1.454) Data 0.007 ( 0.047) Loss 1.6553e-01 (1.8699e-01)
train Epoch: [12][ 87/295] Time 1.331 ( 1.452) Data 0.007 ( 0.046) Loss 1.2983e-01 (1.8634e-01)
Exception ignored in: <function Image.del at 0x7fec55482040>
Traceback (most recent call last):
File "/home/user/.conda/envs/brats2020/lib/python3.8/tkinter/init.py", line 4017, in del
self.tk.call('image', 'delete', self.name)
RuntimeError: main thread is not in main loop

I have looked up the error on the internet and it seems to be kind of an incompatibility between tkinter and PySimpleGUI.

https://www.pysimplegui.org/en/latest/#do-not-attempt-to-call-pysimplegui-from-multiple-threads-at-least-the-tkinter-based-port-because-tkinter-is-not-threadsafe-and-has-known-issues-with-multiple-threads : "Be sure and delete your windows after you close them if you are running with multiple threads. There is a chance another thread's garbage collect will attempt to delete the window when not in the mainthread which will cause tkinter to crash."

However, I think we're not using PySimpleGUI, so from what I've read I guess this error is because of multithreading and parallelism, even though this code parallelises through PyTorch library...

Do you have an idea about how to solve this problem?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant