Skip to content
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

Lightning not printing richbar (0.99.8rc1) #316

Open
Joao-L-S-Almeida opened this issue Dec 9, 2024 · 1 comment
Open

Lightning not printing richbar (0.99.8rc1) #316

Joao-L-S-Almeida opened this issue Dec 9, 2024 · 1 comment
Assignees

Comments

@Joao-L-S-Almeida
Copy link
Member

The model runs, but doesn't print the progress bar.
image

@Joao-L-S-Almeida Joao-L-S-Almeida self-assigned this Dec 9, 2024
@reproduce-bot
Copy link

The following script is generated by AI Agent to help reproduce the issue:

# terratorch/reproduce.py
import os
from lightning.pytorch.callbacks import RichProgressBar
from terratorch.cli_tools import build_lightning_cli

def test_progress_bar():
    command_list = ["fit", "-c", "tests/resources/configs/manufactured-finetune_prithvi_swin_B.yaml"]
    cli = build_lightning_cli(command_list)
    trainer = cli.trainer  # Ensure the trainer is correctly assigned
    if not any(isinstance(callback, RichProgressBar) for callback in trainer.callbacks):
        raise AssertionError("Progress bar is not displayed")
    else:
        # Check if the progress bar is actually printing to console
        import io
        import sys
        captured_output = io.StringIO()
        sys.stdout = captured_output
        trainer.fit(cli.model, cli.datamodule)
        sys.stdout = sys.__stdout__
        if "Epoch" not in captured_output.getvalue():
            raise AssertionError("Progress bar is not printing to console")

if __name__ == "__main__":
    try:
        test_progress_bar()
    except AssertionError as e:
        raise AssertionError(e)
    else:
        print("Test passed successfully with no errors!")

How to run:

python3 terratorch/reproduce.py

Expected Result:

Seed set to 42
terratorch/terratorch/models/prithvi_model_factory.py:75: UserWarning: PrithviModelFactory is deprecated. Please switch to EncoderDecoderFactory.
  warnings.warn("PrithviModelFactory is deprecated. Please switch to EncoderDecoderFactory.", stacklevel=1)
/usr/local/lib/python3.10/site-packages/lightning/pytorch/cli.py:676: `PixelwiseRegressionTask.configure_optimizers` will be overridden by `MyLightningCLI.configure_optimizers`.
GPU available: False, used: False
TPU available: False, using: 0 TPU cores
HPU available: False, using: 0 HPUs
┏━━━┳━━━━━━━━━━━━━━━┳━━━━━━━━━━━━━━━━━━┳━━━━━━━━┳━━━━━━━┓
┃   ┃ Name          ┃ Type             ┃ Params ┃ Mode  ┃
┡━━━╇━━━━━━━━━━━━━━━╇━━━━━━━━━━━━━━━━━━╇━━━━━━━━╇━━━━━━━┩
│ 0 │ model         │ PixelWiseModel   │  101 M │ train │
│ 1 │ criterion     │ RootLossWrapper  │      0 │ train │
│ 2 │ train_metrics │ MetricCollection │      0 │ train │
│ 3 │ val_metrics   │ MetricCollection │      0 │ train │
│ 4 │ test_metrics  │ MetricCollection │      0 │ train │
└───┴───────────────┴──────────────────┴────────┴───────┘
Trainable params: 14.9 M                                                        
Non-trainable params: 86.8 M                                                    
Total params: 101 M                                                             
Total estimated model params size (MB): 406                                     
Modules in train mode: 616                                                      
Modules in eval mode: 0                                                         
/usr/local/lib/python3.10/site-packages/lightning/pytorch/loops/fit_loop.py:298: The number of training batches (1) is smaller than the logging interval Trainer(log_every_n_steps=20). Set a lower value for log_every_n_steps if you want to see logs for the training epoch.
`Trainer.fit` stopped: `max_epochs=3` reached.
Epoch 2/2  ━━━━━━━━━━━━━━━━━━━━━━━━ 1/1 0:00:02 • 0:00:00 0.00it/s v_num: 12.000
/usr/local/lib/python3.10/site-packages/lightning/pytorch/callbacks/model_checkpoint.py:654: Checkpoint directory tests/all_ecos_random/version_12/checkpoints exists and is not empty.
/usr/local/lib/python3.10/site-packages/lightning/pytorch/loops/fit_loop.py:298: The number of training batches (1) is smaller than the logging interval Trainer(log_every_n_steps=20). Set a lower value for log_every_n_steps if you want to see logs for the training epoch.
`Trainer.fit` stopped: `max_epochs=3` reached.

-------------------------------------------------------------------------------
reproduce.py 24 <module>
test_progress_bar()

reproduce.py 20 test_progress_bar
raise AssertionError("Progress bar is not printing to console")

AssertionError:
Progress bar is not printing to console

-------------------------------------------------------------------------------
reproduce.py 26 <module>
raise AssertionError(e)

AssertionError:
Progress bar is not printing to console

Thank you for your valuable contribution to this project and we appreciate your feedback! Please respond with an emoji if you find this script helpful. Feel free to comment below if any improvements are needed.

Best regards from an AI Agent!
@Joao-L-S-Almeida

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

No branches or pull requests

2 participants