I have defined a fastai tabular_learner
in a .py
script. When I run the script locally, when the script reaches learn.fit_one_cycle(2, wd = 2)
the progress bar appears as plain text (not an html widget). If I understand correctly, this corresponds to the ConsoleMasterBar
and/or ConsoleProgressBar
from fastprogress
. This is good and as expected.
When I run the same script in a google colab notebook (running from a cell with contents !python filename.py
), I get output <IPython.core.display.HTML object>
where I’d expect to see some form of progress bar. I would like to see the progress bar. Any format is okay. Note that this behavior results from running the model from a script. When run directly from a cell, the html progress bar is displayed as expected.
I suspect that forcing the progress bar to follow console behavior in colab will result in a usable progress bar, so that’s been my main angle on this problem so far.
I have tried the following:
- placing the following either in the cell from which the script is executed, or within the script just after defining the learner, or both:
from fastprogress.fastprogress import force_console_behavior
master_bar, progress_bar = force_console_behavior()
The results were the same; <IPython.core.display.HTML object>
-
Following the discussion here, I tried the same but with
fastai.basic_train.master_bar, fastai.basic_train.progress_bar
. This returned errormodule 'fastai' has no attribute 'basic_train'
, and as far as I can tell. thebasic_train
versions of the bars were only fromfastai1
. -
I made sure
ipywidgets
was installed, following some suggestions. -
I’ve spent a lot of time digging through the fastai documentation and source code for references to
progress_bar
orfastprogress
ormaster_bar
. I’ve gathered that there’s probably something I can do with theprogress
callback here. And that thembar
andpbar
attributes are probably relevant. But I’m hitting a wall trying to figure out how to make those bars follow console behavior, which I suspect/hope will output correctly.
Lastly, in the meantime, I’ve just used:
with learn.no_bar():
learn.fit_one_cycle(2, wd = 2)
which is preferable to repeated lines of <IPython.core.display.HTML object>
.
Any suggestions would be appreciated!