So i was stuck the whole day because of segmentation faults until I found this issue:
  
      github.com/pytorch/pytorch
  
  
    
  
	  
  

  
    
      Segmentation fault in DataLoader worker in PyTorch 1.8.0 if set_num_threads is called beforehand 5
    

    
      
        opened 
        
          
        
        Mar 26, 2021
      
      


      
        
          
          zhenlin
        
      
    
  



  🐛 Bug
A segmentation fault occurs if one uses DataLoader with num_workers > 0 after calling set_num_threads with a sufficiently high value.
I...



    high priority
    module: dataloader
    triage review
    triaged


  
  
    
    
  
  


TLDR: do not use torch.set_num_threads()