Running with console progress bar in jupyter notebook

Does anyone know how to train with console like progress bar in jupyter notebook? The previous version I used (below) even after I updated the path to new location of things, stopped working:

 import fastai
 from fastprogress import force_console_behavior
 import fastprogress
 fastprogress.fastprogress.NO_BAR = True
 master_bar, progress_bar = force_console_behavior()
 fastai.basic_train.master_bar, fastai.basic_train.progress_bar = master_bar, progress_bar

Being able to do this can be quite useful - without disabling the progress bar upon disconnecting to the kernel after a while (say running training overnight), the notebook is overwhelmed with updates and does not update properly.

1 Like

I’ll look into it (maybe tomorrow) but it shouldn’t have stopped working.

1 Like

Sorry for the false alarm - I made changes to the code yesterday (for not showing the progress bar) to work with current master but I didn’t get anywhere (despite not getting an error the progress bar was still showing). But I think I got it now :slight_smile:

Here is the slightly changed code for disabling the progress bar in jupyter notebook that works with current master:

from fastprogress import force_console_behavior
import fastprogress
fastprogress.fastprogress.NO_BAR = True
master_bar, progress_bar = force_console_behavior()
fastai.core.master_bar, fastai.core.progress_bar = master_bar, progress_bar

and here is a self contained example for testing the behavior - with uncommenting the code, the progress bar is no longer displayed

1 Like

Ah yes, it must be the changes we did in the import structure. Glad it works out!

1 Like

Hi! What worked for me is this code:

import fastprogress
fastai.basic_train.master_bar, fastai.basic_train.progress_bar = fastprogress.force_console_behavior()

written right before the fit() function. Although, I do not see the progress bars, I can still see the train/validation losses.

My use case is something like:

for k in range(many)
    model.fit(...)

So you can imagine that any useful info that I print during the for loop is lost (Lost to my eyes, at least).

Is there a more elegant way to disable the output of the fit() function? (and their kind)
Thank you!

1 Like