Giter Club home page Giter Club logo

Comments (18)

sri9s avatar sri9s commented on May 22, 2024 4

Error on colab, with fastai2, @ learn.fit_one_cycle(4):

AttributeError: ‘NBMasterBar’ object has no attribute ‘out’
AttributeError: ‘NBMasterBar’ object has no attribute ‘start_t’

from fastprogress.

zivanfi avatar zivanfi commented on May 22, 2024 1

@tunner007 The reason why upgrading doesn't help is that the interactive REPL prompt ignores the user's enviroment for its dependencies, so even after an upgrade it still uses the old version:

> !pip3 freeze | grep ipython
ipython==7.9.0
ipython-genutils==0.2.0
> print(IPython.version_info)
(5, 1, 0, '')

from fastprogress.

sgugger avatar sgugger commented on May 22, 2024

I can't do anything to fix this without a reproducible example. If you have some code that generates this bug, it would be most helpful.

from fastprogress.

zivanfi avatar zivanfi commented on May 22, 2024

I was just doing lesson 1 of the fast.ai course and got this error.

Even if this example does not reproduce the error for you, considering that self.out may not get initalized in every execution path, wouldn't cheking for self.out not being None before calling a method on it be a good safety measure?

from fastprogress.

sgugger avatar sgugger commented on May 22, 2024

Doing lesson 1 of the fastai course is not a reproducible example as it runs completely fine for me and many other people, so there is another reason this fails for you. Adding a check of is not None is just going to make the progress bar not be shown so it's not really a solution.

fastai always beings the iteration of the master bar before adding a child, for some reason, creating the out attribute silently fails and returns None. What does

from IPython.display import clear_output, display, HTML
out = display(HTML(some_html_code), display_id=True)

do for you?

from fastprogress.

tuner007 avatar tuner007 commented on May 22, 2024

Doing lesson 1 of the fastai course is not a reproducible example as it runs completely fine for me and many other people, so there is another reason this fails for you. Adding a check of is not None is just going to make the progress bar not be shown so it's not really a solution.

fastai always beings the iteration of the master bar before adding a child, for some reason, creating the out attribute silently fails and returns None. What does

from IPython.display import clear_output, display, HTML
out = display(HTML(some_html_code), display_id=True)

do for you?

image

from fastprogress.

tuner007 avatar tuner007 commented on May 22, 2024

I think problem is with below code, in few cases of "ZMQInteractiveShell" ipython will not generate display_id due to which "out" becomes "None" & later it cannot update. For jupyter notebook it works fine but with cloudera i was facing this issue. So for my case i simply added a check if i am not able to generate display_id isnotebook becomes False which solves my problem.

I am noob here :P so will leave rest on you guys to clear it out.

def isnotebook():
    try:
        from google import colab
        return True
    except: pass
    try:
        shell = get_ipython().__class__.__name__
        if shell == 'ZMQInteractiveShell':
            ##added check here for display_id##
            return True   # Jupyter notebook, Spyder or qtconsole
        elif shell == 'TerminalInteractiveShell':
            return False  # Terminal running IPython
        else:
            return False  # Other type (?)
    except NameError:
        return False

from fastprogress.

zivanfi avatar zivanfi commented on May 22, 2024

My experiences match the ones described by tunner007 (which is not surprising considering that our environments also seems to match). Displaying inline HTML works for me fine, both from data.show_batch (if I work around the downloading part) and also using the example code you pasted. However, out will be None in your example, which seems to indicate a bug in the environment instead of in fastprogress:

image

image

Because the bug seems to be elsewhere, I think you can safely close this issue (unless you see some trivial workaround, which may be worth adding).

Thanks to both of you for helping me find the real culprit.

from fastprogress.

sgugger avatar sgugger commented on May 22, 2024

Ok. In this case we can add a test to see if a generated out becomes None inside isnotebook. That way, the progress bar will automatically revert to the console behavior for those enviromnents. Is this what you added @tunner007 ?

from fastprogress.

tuner007 avatar tuner007 commented on May 22, 2024

s this

Yes... for me this solves the problem :)

Note: It seems to be a workaround cuz i was able to run the code but with no progress bar

from fastprogress.

zivanfi avatar zivanfi commented on May 22, 2024

I continued my investigation and found that in the affected environment IPython is rather old:

pip3 freeze | grep ipython

ipython==5.1.0
ipython-genutils==0.2.0

I checked the source code of IPython as of this version and found that unlike recent versions, it does not return a display:

This seems to be the root cause of the problem.

from fastprogress.

sgugger avatar sgugger commented on May 22, 2024

Ah ah, in that case a simple test of the ipython version should be enough. Do you know which version starts returning an output?

from fastprogress.

tuner007 avatar tuner007 commented on May 22, 2024

I continued my investigation and found that in the affected environment IPython is rather old:

pip3 freeze | grep ipython

ipython==5.1.0
ipython-genutils==0.2.0

I checked the source code of IPython as of this version and found that unlike recent versions, it does not return a display:

This seems to be the root cause of the problem.

Actually i even tried with latest version but faced same problem (versions tested ipython==7.4.0, ipython-7.9.0)

Can you please confirm if upgrading the version works for you ?

from fastprogress.

zivanfi avatar zivanfi commented on May 22, 2024

It was added in this commit, and according to the tags listed at the top, it was first released in 6.0.0.

from fastprogress.

tuner007 avatar tuner007 commented on May 22, 2024

@tunner007 The reason why upgrading doesn't help is that the interactive REPL prompt ignores the user's enviroment for its dependencies, so even after an upgrade it still uses the old version:

> !pip3 freeze | grep ipython
ipython==7.9.0
ipython-genutils==0.2.0
> print(IPython.version_info)
(5, 1, 0, '')

Got it !

from fastprogress.

sgugger avatar sgugger commented on May 22, 2024

Added the test of IPython version, which should solve the issue. Thanks for your help investigating this bug!

from fastprogress.

Vijayabhaskar96 avatar Vijayabhaskar96 commented on May 22, 2024

I'm trying to resume an epoch that was saved by the SaveModelCallback, by using start_epoch=1 but I get this error, Any solutions?

from fastprogress.

veraz00 avatar veraz00 commented on May 22, 2024

Hello, I have run
from IPython.display import clear_output, display, HTML
out = display(HTML('

Testing

'), display_id=True)
print('out', out) # here it return None !
from IPython import get_ipython
def isnotebook():
try:
from google import colab
return True
except: pass
try:
shell = get_ipython().class.name
if shell == 'ZMQInteractiveShell':
##added check here for display_id##
return True # Jupyter notebook, Spyder or qtconsole
elif shell == 'TerminalInteractiveShell':
return False # Terminal running IPython
else:
return False # Other type (?)
except NameError:
return False
print(isnotebook()) # and here return True !
I am quite new in this area; so what do I do to solve this problem ?
IPython==7.30.1, the newest one

from fastprogress.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.