로딩
요청 처리 중입니다...

[pytorch]TypeError: '<' not supported between instances of 'Example' and 'Example'

 [pytorch]TypeError: '<' not supported between instances of 'Example' and 'Example'

에러 : TypeError: '<' not supported between instances of 'Example' and 'Example' 발생 원인 : torchtext sort 옵션의 기본값이 True이었고, 배치에 해당하는 값을 정렬하는 과정에서 생긴 에러이다. 처음에는 iterator 데이터가 망가진줄 알고 놀랐는데 그건 아닌것 같았다.

해결 방안 : torchtext의 iterator를 split할 때, sort옵션을 False로 명시해주었다. 기존 train_iter, valid_iter, test_iter = data.Iterator.splits((train_data, valid_data, test_data),\ batch_size=batch_size, device=device) 변경 train_iter, valid_iter, test_iter = data.Iterator.splits((train_data, valid_data, test_data), \ batch_si...

# error # pytorch # torchtext # 토치 # 파이토치