Skip to content

DOC: fix spelling and grammar in tqdm_logger#3779

Merged
vfdev-5 merged 15 commits into
pytorch:masterfrom
importstring:doc/fix-tqdm-spelling
Jun 9, 2026
Merged

DOC: fix spelling and grammar in tqdm_logger#3779
vfdev-5 merged 15 commits into
pytorch:masterfrom
importstring:doc/fix-tqdm-spelling

Conversation

@importstring

Copy link
Copy Markdown
Contributor

Found and fixed several spelling and grammar errors in comments and docstrings in tqdm_logger.py. No logic or behaviour was changed.

One example:

# Before
progress bar will looks like

# After  
progress bar will look like

Found these issues while working on #3118.

Spelling and grammar suggestions were assisted by an AI tool; all changes were manually reviewed and hand-typed.

cc @vfdev-5

@github-actions github-actions Bot added the module: handlers Core Handlers module label Jun 8, 2026

@vfdev-5 vfdev-5 left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Thanks for the PR @importstring
I left comments to revert some unnecessary changes

Comment thread ignite/handlers/tqdm_logger.py Outdated
Comment thread ignite/handlers/tqdm_logger.py Outdated
pbar.attach(trainer, ['loss'])

# Progress bar will looks like

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Let's remove the new line

Suggested change

@importstring importstring Jun 8, 2026

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

There are three instances of this.

Previously

Simple progress bar

.. code-block:: python

    trainer = create_supervised_trainer(model, optimizer, loss)

    pbar = ProgressBar()
    pbar.attach(trainer)

    # Progress bar will looks like
    # Epoch [2/50]: [64/128]  50%|█████      [06:17<12:34]

Log output to a file instead of stderr (tqdm's default output)

.. code-block:: python

    trainer = create_supervised_trainer(model, optimizer, loss)

    log_file = open("output.log", "w")
    pbar = ProgressBar(file=log_file)
    pbar.attach(trainer)

Attach metrics that already have been computed at :attr:`~ignite.engine.events.Events.ITERATION_COMPLETED`
(such as :class:`~ignite.metrics.RunningAverage`)

.. code-block:: python

    trainer = create_supervised_trainer(model, optimizer, loss)

    RunningAverage(output_transform=lambda x: x).attach(trainer, 'loss')

    pbar = ProgressBar()
    pbar.attach(trainer, ['loss'])

    # Progress bar will looks like
    # Epoch [2/50]: [64/128]  50%|█████      , loss=0.123 [06:17<12:34]

Directly attach the engine's output

.. code-block:: python

    trainer = create_supervised_trainer(model, optimizer, loss)

    pbar = ProgressBar()
    pbar.attach(trainer, output_transform=lambda x: {'loss': x})

    # Progress bar will looks like
    # Epoch [2/50]: [64/128]  50%|█████      , loss=0.123 [06:17<12:34]

I think the version history got a bit messed up which is why it shows I deleted the line instead showing the grammar edit.

Would you like me to remove all # Progress bar will looks like, keep them all, or just remove that one?

For now I've fixed the spelling of all three and kept all three. Let me know what you'd prefer.

Comment thread ignite/handlers/tqdm_logger.py
Comment thread ignite/handlers/tqdm_logger.py
Comment thread ignite/handlers/tqdm_logger.py Outdated
Comment thread tests/ignite/handlers/test_visdom_logger.py Outdated
Comment thread ignite/handlers/tqdm_logger.py Outdated
Comment thread ignite/handlers/tqdm_logger.py Outdated
@importstring

Copy link
Copy Markdown
Contributor Author

Thanks for the review, @vfdev-5. I’ve applied all your suggestions (reverted the unnecessary formatting/capitalization changes and the extra test file) and kept only the focused spelling/grammar fixes in tqdm_logger.py. Happy to tweak further if needed.

@aaishwarymishra

Copy link
Copy Markdown
Collaborator

@importstring hi, one of you string update broke an tests regrex, specifically tests/ignite/handlers/test_tqdm_logger.py::test_pbar_errors

@importstring

Copy link
Copy Markdown
Contributor Author

Hi @aaishwarymishra
I'll look into that right now. I'll keep you posted.

@importstring

importstring commented Jun 8, 2026

Copy link
Copy Markdown
Contributor Author

It's coming from this test case because we changed contrib module to submodule:
CleanShot 2026-06-08 at 13 43 58

try:
    from tqdm.autonotebook import tqdm
except ImportError:
    raise ModuleNotFoundError(
        "This submodule requires tqdm to be installed. Please install it with the command: \n pip install tqdm"
    )

I can either change it back to

"This contrib module requires tqdm to be installed. Please install it with command: \n pip install tqdm"

or I can update the tests but then the scope would be greater. Happy to do whichever you prefer.

For now I've updated the test to match the new error message @vfdev-5 requested.
"This submodule requires tqdm to be installed. Please install it with the command: \n pip install tqdm"

importstring and others added 3 commits June 8, 2026 13:47
vfdev-5 suggested I change the error string for accuracy but this introduced a bug only found when testing. This fixes the test.
@vfdev-5
vfdev-5 added this pull request to the merge queue Jun 9, 2026
Merged via the queue into pytorch:master with commit 97d4aab Jun 9, 2026
21 of 24 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

module: handlers Core Handlers module

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants