butchland / fastai_xla_extensions

A Python package to allow fastai to run on TPUs using Pytorch-XLA
https://butchland.github.io/fastai_xla_extensions
Apache License 2.0
36 stars 7 forks source link

batch transforms for vision are slow #5

Open butchland opened 4 years ago

butchland commented 4 years ago

Confirming that batch transforms are slow Same notebook without batch tfms - each epoch runs at 1:34 to 2:25 mins For exact same notebook with batch tfms

butchland commented 4 years ago

Focusing on affine transforms (zoom, warp, rotate) + random resize crop GPU - they seem to cause much of the slowdown. Normalize and lighting (contrast and brightness) transforms dont seem to slow it down.

Will start narrowing where the slowdown is and do some profiling on the specific tensor operations where its slow.

butchland commented 4 years ago

Will monitoring this issue filed with the pytorch-xla team as resolving it requires an update to pytorch-xla itself.

butchland commented 3 years ago

Update: as of 2020/12/14, using updated Pytorch 1.7 XLA and latest fastai (2.1.8) and fastai_xla_extensions (0.0.4) packages, training with batch transforms is still slower than training without batch transforms.

butchland commented 3 years ago

Partially mitigated by this enhancement: https://github.com/butchland/fastai_xla_extensions/issues/11

Leaving it open awaiting final action for additional lowerings in Pytorch XLA to support batch transforms