Skip to content

Conversation

@yuranpereira
Copy link

Problem

In certain Jupyter environments (like VS Code and some local JupyterLab setups), calling learn.fine_tune() in fastai crashes with:

AttributeError: 'NBMasterBar' object has no attribute 'out'

This occurs because show() is called during the before_fit event (via write()), which happens before on_iter_begin() initializes self.out.

This patch adds hasattr(self, 'out') check before calling self.out.update() in the show() method which is consistent with how on_iter_end() and on_interrupt() already handle this attribute.

Current workarounds

Users currently work around this by:

  • Using with learn.no_bar(): learn.fine_tune(1)
  • Or by completely disabling progress callbacks

This fix eliminates the need for these workarounds.

I tested this locally in Jupyter environment with fastai/fastbook Chapter 1 where it previously crashed. After applying this fix, the progress bars display correctly.

…ized

Problem
In certain Jupyter environments (like VS Code and some local JupyterLab setups), calling `learn.fine_tune()` in fastai crashes with:
```
AttributeError: 'NBMasterBar' object has no attribute 'out'
```

This occurs because `show()` is called during the `before_fit` event (via `write()`), which happens before `on_iter_begin()` initializes `self.out`.

This patch adds `hasattr(self, 'out')` check before calling `self.out.update()` in the `show()` method which is consistent with how `on_iter_end()` and `on_interrupt()` already handle this attribute.

Current workarounds

Users currently work around this by:
- Using `with learn.no_bar(): learn.fine_tune(1)`
- Or by completely disabling progress callbacks

This fix eliminates the need for these workarounds.

I tested this locally in Jupyter environment with fastai/fastbook Chapter 1 where it previously crashed. After applying this fix, the progress bars display correctly.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant