examples icon indicating copy to clipboard operation
examples copied to clipboard

CI does not test examples with latest pytorch

Open dvrogozh opened this issue 6 months ago • 5 comments

With: https://github.com/pytorch/examples/commit/8393ceb2ba2d7abb81cd9f9d573599f1b8bdc0dd

This issue is a follow up on https://github.com/pytorch/examples/pull/1327#issuecomment-2816184755. We've tried to update fast_neural_style example which required bumping up pytorch version and spotted few issues. Findings are around the fact that CI scripts run bulk install of dependencies for all examples at once. See: https://github.com/pytorch/examples/blob/8393ceb2ba2d7abb81cd9f9d573599f1b8bdc0dd/utils.sh#L26-L31 This causes downgrade of nightly torch installed by the CI:

  • torch nightly is installed here: https://github.com/pytorch/examples/blob/8393ceb2ba2d7abb81cd9f9d573599f1b8bdc0dd/.github/workflows/main_python.yml#L28
  • And gets downgraded (to torch 2.5) due to some examples pinning torchvision version. For example here: https://github.com/pytorch/examples/blob/8393ceb2ba2d7abb81cd9f9d573599f1b8bdc0dd/dcgan/requirements.txt#L2

I suggest to consider the following improvements for pytorch examples:

  • [x] Each example must have requirements.txt (some miss it as fast_neural_style does), https://github.com/pytorch/examples/pull/1330
  • [x] CI scripts must not bulk install dependencies, but respect each example individual requirements.txt, https://github.com/pytorch/examples/pull/1330
  • [x] (to discuss) CI to prepare environment for each example from scratch instead of installing next example environment on top of previous one, https://github.com/pytorch/examples/pull/1330
    • note: this requires significant change to current scripts and requires discussion
  • [ ] Examples must not pin version of pytorch packages (torch, torchvision, etc.) unless as a workaround to specific issues (which must be explicitly noted) or due to example deprecation with the future drop

Alternatively, we can consider that (UPDATE: we've dismissed this after discussion):

  • All examples must comply to the single dependency list supported on the pytorch examples repo top level

CC: @malfet, @atalman, @msaroufim

dvrogozh avatar Apr 24 '25 19:04 dvrogozh