Computer/이게 왜 안되지?
[이왜안] EOFError: EOF when reading a line
벼랑끝과학자
2025. 6. 23. 13:54
PyTorch의 DataLoader는 num_workers > 0일 때,
데이터 로딩을 별도의 subprocess(자식 프로세스) 로 실행하는데
그런데 그 subprocess에서는 input() 같은 interactivity가 불가능함
DataLoader의 num_wokrers 옵션을 0이 아닌 값을 주고 data class의 내부에 input() 함수를 사용했다면 EOFError: EOF when reading a line에러를 보게된다.
해결은 간단하다 DataLoader 코드에 num_workers 옵션을 0을 주면 된다.