jax-ml/jax

improve pjit pytree error involving Nones (and PytreeLeafs)

Open

#13,074 opened on Nov 2, 2022

 (6 comments) (3 reactions) (1 assignee)Python (3,738 forks)github user discovery
better_errorsgood first issue

Repository metrics

Stars
 (36,174 stars)
PR merge metrics
 (Avg merge 2d 19h) (439 merged PRs in 30d)

Description

When pjit's in_axis_resoures is not a pytree prefix of the corresponding arguments' pytrees, we attempt to raise a good error. But at least two things can be improved:

  • don't mention PytreeLeaf instances in the error message
  • handle None specially (since it's surprising for the error message to refer to it as a container)

Contributor guide