Skip to content

Fixes #289 #480

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 9 commits into from
Apr 8, 2019
Merged

Fixes #289 #480

merged 9 commits into from
Apr 8, 2019

Conversation

vfdev-5
Copy link
Collaborator

@vfdev-5 vfdev-5 commented Apr 5, 2019

Fixes #289

Description:
Updated ProgressBar.attach API by adding supplementary args:

  • event_name=Events.ITERATION_COMPLETED
  • closing_event_name=Events.EPOCH_COMPLETED)
    to handle demanded use-case:
    n_epochs = 10
    loader = [1, 2, 3, 4, 5]
    engine = Engine(update_fn)

    pbar = ProgressBar()
    pbar.attach(engine, event_name=Events.EPOCH_STARTED, closing_event_name=Events.COMPLETED)
    engine.run(loader, max_epochs=n_epochs)
    # expected = u'Epoch: [9/10]  90%|█████████  [00:00<00:00]'
  • Custom events are not supported yet !
    • We need to order base events and custom events to prevent the cases where closing event happens before logging event
    • It is not evident how to compute length of progress bar with custom events and number of total custom events...

Check list:

  • New tests are added (if a new feature is added)
  • New doc strings: description and/or example code are in RST format
  • Documentation is updated (if required)

vfdev-5 added 3 commits April 4, 2019 19:21
- Support of logging and closing custom events is not implemented (difficult)
@vfdev-5 vfdev-5 requested a review from anmolsjoshi April 5, 2019 08:45
@vfdev-5
Copy link
Collaborator Author

vfdev-5 commented Apr 5, 2019

DO NOT MERGE YET. Forgot about #391

EDIT: Now OK

@vfdev-5
Copy link
Collaborator Author

vfdev-5 commented Apr 5, 2019

@drozzy you can check out this version if it works better for you.
Keep in mind that tqdm_notebook has some issue with the layout in some cases: tqdm/tqdm#649

@vfdev-5 vfdev-5 force-pushed the issue_289_gen_logger branch from ea85f02 to 0174d05 Compare April 5, 2019 11:55
Copy link
Contributor

@anmolsjoshi anmolsjoshi left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@vfdev-5 awesome work! The enter and exit ended up fixing the previous incorrect print outs.

  • Could you run the TextCNN example again to fix the progress bar display?
  • It might be worth it to add a note about bar_format being empty when using with a notebook.

@vfdev-5
Copy link
Collaborator Author

vfdev-5 commented Apr 7, 2019

@anmolsjoshi OK, I'll update the notebooks ASAP

@vfdev-5
Copy link
Collaborator Author

vfdev-5 commented Apr 8, 2019

@anmolsjoshi I updated TextCNN and docstring. Rendering of progressbar in the github is not better.
Just HBox ... however inside jupyter notebook we can see the widgets etc... We can leave it like this, IMO

Copy link
Contributor

@anmolsjoshi anmolsjoshi left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@vfdev-5 LGTM! I agree that we can ignore the rendering as it works correctly in terminal and notebook.

@anmolsjoshi anmolsjoshi merged commit 64e22cc into pytorch:master Apr 8, 2019
@drozzy
Copy link

drozzy commented May 1, 2019

@vfdev-5 Sorry I haven't used ignite in a while so I can't actually reproduce it. Is there a minimal working example that I can use to test this?

@vfdev-5
Copy link
Collaborator Author

vfdev-5 commented May 1, 2019

@drozzy check this one:

import torch
import time

from ignite.engine import Engine, Events
from ignite.contrib.handlers import ProgressBar

def update(engine, batch):
    time.sleep(0.5)

def run(data):
    trainer = Engine(update)
    ProgressBar(persist=True, bar_format="").attach(trainer)
    trainer.run(data, max_epochs=2)

data = [1] * 10
run(data)

@vfdev-5 vfdev-5 deleted the issue_289_gen_logger branch May 1, 2019 19:03
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[Feature Request] tqdm_logger update on every epoch instead of every iteration
3 participants