I've had a problem. But when I was describing it here it was solved.
Maybe it will help someone. I use pytorch and training accidentally freezes after weights uploading by trains. Don't know exactly what's wrong, but it was somehow connected with multithreding in pytorch dataloaders and cv2. These magic lines have solved the problem