fastai / fastprogress

Simple and flexible progress bar for Jupyter Notebook and console

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Use of figsize kwarg causes error in console but not notebook

danielpcox opened this issue · comments

I have a traceback complaining of an unexpected kwarg 'figsize' when running outside of a notebook, but not when running in a notebook, or even when running in nbdev_test_nbs.

I think I can see what's up: According to these lines, the master_bar is a completely different class when running in the console versus when running in a notebook, and the update_graph method has a different signature. More precisely, it doesn't take **kwargs. My use of update_graph looks like this:

bar.update_graph(plot, figsize=(10,5))

Full traceback:

Traceback (most recent call last):
  File "/usr/local/lib/python3.7/threading.py", line 917, in _bootstrap_inner
    self.run()
  File "/usr/local/lib/python3.7/threading.py", line 865, in run
    self._target(*self._args, **self._kwargs)
  File "/app/lad/anomalies.py", line 120, in _train
    self.models[service].train(data_path=data_path, epochs=epochs, reporter=reporter)
  File "/app/lad/model.py", line 410, in train
    reporter=reporter)
  File "/app/lad/model.py", line 344, in train
    vis(mb,len_dataloader,epoch-start_epoch,i,[train_losses,val_losses])
  File "/app/lad/model.py", line 288, in vis
    bar.update_graph(plot, figsize=(10,5))
TypeError: update_graph() got an unexpected keyword argument 'figsize'

Yes, the method update_graph does not really work outside of a notebook. I guess we could add **kwargs so that it does not fail (but still does nothing).

That looks like it would solve my problem. Shall I submit a PR?

show_imgs at least has the same problem. I think I'll go compare each method signature and try to fix them all at once tomorrow.

That would be very much appreciated :)

I just took a look at the contributing guide, and I wasn't able to reach the license agreement. This link seems broken: https://www.clahub.com/agreements/fastai/fastprogress

I'm going to work on the PR now anyway, and I can sign the agreement whenever convenient.