Giter Club home page Giter Club logo

Comments (11)

codermrrob avatar codermrrob commented on June 3, 2024 1

@elisgrahn I also reverted ipywidgets, but I can verify both the ipywidgets 7.7.* and 8 work fine; I can import and run and successfully display widgets in notebooks that I have tried. fastprogress is working in console mode, of course, but not in notebooks in vscode.

makes working through the fastai courses problematic with local setup, which is disappointing because I want to utilize my GPU (which I have successfully set up, which is the trickier part). But now I've hit this wall.

from fastprogress.

aisbergg avatar aisbergg commented on June 3, 2024 1

Same issue here. Just started with the course and was wondering why I don't get any output. I played around and found out that with a short sleep between the display.update() calls in the show method of the progress bar it actually outputs something. Might be a race condition somewhere.

Here is my code snippet (I only inserted some time.sleep(), the rest is basically unchanged):

# workaround for displaying progress bar in notebook
import time
from fastai.vision.all import *
from fastprogress.fastprogress import NBMasterBar, NBProgressBar

class NBMasterBarPatched(NBMasterBar):
    def on_iter_begin(self):
        super().on_iter_begin()
        time.sleep(0.01)

    def show(self):
        time.sleep(0.01)
        super().show()

class NBProgressBarPatched(NBProgressBar):
    def on_iter_begin(self):
        super().on_iter_begin()
        time.sleep(0.01)

    def show(self):
        time.sleep(0.01)
        super().show()

class ProgressCallbackPatched(ProgressCallback):
    def before_fit(self):
        if self.create_mbar: self.mbar = NBMasterBarPatched(list(range(self.n_epoch)))
        assert hasattr(self.learn, 'recorder')
        if self.learn.logger != noop:
            self.old_logger,self.learn.logger = self.logger,self._write_stats
            self._write_stats(self.recorder.metric_names)
        else: self.old_logger = noop

    def _launch_pbar(self):
        self.pbar = NBProgressBarPatched(self.dl, parent=getattr(self, 'mbar', None), leave=False)
        self.pbar.update(0)

defaults.callbacks = [TrainEvalCallback, Recorder, ProgressCallbackPatched]

# now do your learning
learn...

from fastprogress.

elisgrahn avatar elisgrahn commented on June 3, 2024

I have the exact same problem. Discovered something was wrong since fastai wasn't displaying any bars. Tqdm for instance, still works in notebooks.

I have also tried to revert to Jan 2023 vscode and also reverted ipywidgets to 7.7.* instead of 8 without any further luck.

from fastprogress.

peterbull avatar peterbull commented on June 3, 2024

Also having this issue. In the meantime, if anyone like myself is still early in the learning process and just needs the epoch data, there is a quick workaround. Add cbs=CSVLogger() to your learner, and then create a quick function to display it. Example:

def train_res():
    train_data = pd.read_csv('history.csv')
    return train_data.head(n=50)

learn = tabular_learner(dls, layers=[500, 250], n_out=1, y_range=(-11,11), loss_func=F.mse_loss, cbs=CSVLogger())

learn.fit_one_cycle(1, 1e-2)
train_res()

from fastprogress.

elisgrahn avatar elisgrahn commented on June 3, 2024

Nice workaround! Just want to share that the solution I've currently settled on is to add a TensorBoardCallback() in order to view the models in Tensorboard. Might be a bit overkill, but I felt it was useful to learn how to use it.

cbs=[TensorBoardCallback(n_preds=8)]

from fastprogress.

bosmart avatar bosmart commented on June 3, 2024

Same issue here - no progress bars in vscode :(

from fastprogress.

bosmart avatar bosmart commented on June 3, 2024

Ok, I tried a few different versions of the Jupyter extension and:
v2022.11.1003412109 - working, ShowGraphCallback works too
v2023.1.2000312134 - working, ShowGraphCallback doesn’t (plot disappears)
v2023.1.2010391206 - working, ShowGraphCallback doesn’t (plot disappears)
v2023.2.1000592019 - not working, ShowGraphCallback works again
v2023.2.1200692131 - not working, ShowGraphCallback works again

from fastprogress.

codermrrob avatar codermrrob commented on June 3, 2024

@bosmart thanks for the effort there, I hadn't been aware it was so easy to revert extension versions in vscode now.

from fastprogress.

bosmart avatar bosmart commented on June 3, 2024

@codermrrob I've opened the following: microsoft/vscode-jupyter#13163

from fastprogress.

adam-matic avatar adam-matic commented on June 3, 2024

Another workaround from an older issue, forcing text output for the progress bar:

from fastprogress.fastprogress import master_bar, progress_bar
from fastprogress.fastprogress import force_console_behavior
master_bar, progress_bar = force_console_behavior()

from fastprogress.

pounde avatar pounde commented on June 3, 2024

Same issue here. Reverted jupyter extension and it seems to be working. I'll add a comment to the vs-code jupyter issue as well.

EDIT:
Should have looked at the jupyter issue first. Looks like it was merged two days ago. Guessing we'll see it in the next release.

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.