OSError: [Errno 24] Too many open files:

Hello,

I have tried to use tensorboard pytorch to plot loss graphs and accuracy.
I have used Summary Writer here.

But, as I run my training loop, I face the following error at the end of first epoch.

Following snippet shows the error:

Following is the python code containing summary writer for reference:

I also want to plot confusion matrix in tensorboard, please can I have some insights in this as well.

Any help is most appreciated!
Thank you in advance.

Based on the error message your OS runs into the file handler limitation so you would either need to close files (unsure, if Tensorboard opens files without closing them) or could try to increase the file handle limitation.

PS: you can post code snippets or logs by wrapping them into three backticks ```, which makes debugging easier.