You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Hi! I need to maintain a test of a usage example of my library torchjd, showing how it can be combined with PyTorch Lightning. To keep my test outputs clean, I would like to disable all logs from PyTorch Lightning, but I can't manage to do so.
Even when passing logger=False to the Trainer, and when manually disabling logs, I can't get rid of the INFO: GPU available: [...] logs. I'm posting this as a bug since I think that passing logger=False is supposed to do precisely what I want, but maybe since a recent release it stopped working?
I only found outdated solutions on stackoverflow and in other issues. Thanks in advance for the help! :)
What version are you seeing the problem on?
v2.4
How to reproduce the bug
This reproducer is the first 4 steps of the tutorial, with 2 changes:
The first 5 lines that try to disable logging manually
The extra parameters enable_checkpointing=False, logger=False, enable_model_summary=False, enable_progress_bar=False provided to the Trainer
importlogginglogging.getLogger("lightning_fabric").propagate=Falselogging.getLogger("lightning_fabric").setLevel=Falselogging.getLogger("pytorch_lightning").propagate=Falselogging.getLogger("pytorch_lightning").setLevel=Falseimportosfromtorchimportoptim, nn, utils, Tensorfromtorchvision.datasetsimportMNISTfromtorchvision.transformsimportToTensorimportlightningasL# define any number of nn.Modules (or use your current ones)encoder=nn.Sequential(nn.Linear(28*28, 64), nn.ReLU(), nn.Linear(64, 3))
decoder=nn.Sequential(nn.Linear(3, 64), nn.ReLU(), nn.Linear(64, 28*28))
# define the LightningModuleclassLitAutoEncoder(L.LightningModule):
def__init__(self, encoder, decoder):
super().__init__()
self.encoder=encoderself.decoder=decoderdeftraining_step(self, batch, batch_idx):
# training_step defines the train loop.# it is independent of forwardx, _=batchx=x.view(x.size(0), -1)
z=self.encoder(x)
x_hat=self.decoder(z)
loss=nn.functional.mse_loss(x_hat, x)
# Logging to TensorBoard (if installed) by defaultself.log("train_loss", loss)
returnlossdefconfigure_optimizers(self):
optimizer=optim.Adam(self.parameters(), lr=1e-3)
returnoptimizer# init the autoencoderautoencoder=LitAutoEncoder(encoder, decoder)
# setup datadataset=MNIST(os.getcwd(), download=True, transform=ToTensor())
train_loader=utils.data.DataLoader(dataset)
# train the model (hint: here are some helpful Trainer arguments for rapid idea iteration)trainer=L.Trainer(limit_train_batches=100, max_epochs=1, enable_checkpointing=False, logger=False, enable_model_summary=False, enable_progress_bar=False)
trainer.fit(model=autoencoder, train_dataloaders=train_loader)
As documented, the logger parameter in Trainer is specifically for controlling experiment tracking loggers (like Tensorboard), not Python's logging system.
Bug description
Hi! I need to maintain a test of a usage example of my library torchjd, showing how it can be combined with PyTorch Lightning. To keep my test outputs clean, I would like to disable all logs from PyTorch Lightning, but I can't manage to do so.
Even when passing
logger=False
to theTrainer
, and when manually disabling logs, I can't get rid of theINFO: GPU available: [...]
logs. I'm posting this as a bug since I think that passinglogger=False
is supposed to do precisely what I want, but maybe since a recent release it stopped working?I only found outdated solutions on stackoverflow and in other issues. Thanks in advance for the help! :)
What version are you seeing the problem on?
v2.4
How to reproduce the bug
This reproducer is the first 4 steps of the tutorial, with 2 changes:
enable_checkpointing=False, logger=False, enable_model_summary=False, enable_progress_bar=False
provided to theTrainer
Error messages and logs
Output (in red in my terminal):
Environment
Current environment
- GPU:
- NVIDIA GeForce GTX 1080
- available: True
- version: 12.4
- lightning: 2.4.0
- lightning-utilities: 0.11.8
- pytorch-lightning: 2.4.0
- torch: 2.5.1
- torchjd: 0.2.2
- torchmetrics: 1.6.0
- torchvision: 0.20.1
- aiohappyeyeballs: 2.4.3
- aiohttp: 3.11.2
- aiosignal: 1.3.1
- alabaster: 0.7.16
- attrs: 24.2.0
- autocommand: 2.2.2
- babel: 2.16.0
- backports.tarfile: 1.2.0
- beautifulsoup4: 4.12.3
- blinker: 1.9.0
- certifi: 2024.8.30
- cfgv: 3.4.0
- charset-normalizer: 3.4.0
- clarabel: 0.9.0
- click: 8.1.7
- coverage: 7.6.7
- cvxpy: 1.6.0
- dash: 2.18.2
- dash-core-components: 2.0.0
- dash-html-components: 2.0.0
- dash-table: 5.0.0
- distlib: 0.3.9
- docutils: 0.21.2
- ecos: 2.0.14
- filelock: 3.16.1
- flask: 3.0.3
- frozenlist: 1.5.0
- fsspec: 2024.10.0
- furo: 2024.1.29
- identify: 2.6.2
- idna: 3.10
- imagesize: 1.4.1
- importlib-metadata: 8.5.0
- inflect: 7.3.1
- iniconfig: 2.0.0
- itsdangerous: 2.2.0
- jaraco.collections: 5.1.0
- jaraco.context: 5.3.0
- jaraco.functools: 4.0.1
- jaraco.text: 3.12.1
- jinja2: 3.1.4
- kaleido: 0.2.1
- lightning: 2.4.0
- lightning-utilities: 0.11.8
- markdown-it-py: 3.0.0
- markupsafe: 3.0.2
- mdit-py-plugins: 0.4.2
- mdurl: 0.1.2
- more-itertools: 10.3.0
- mpmath: 1.3.0
- multidict: 6.1.0
- myst-parser: 4.0.0
- nest-asyncio: 1.6.0
- networkx: 3.4.2
- nodeenv: 1.9.1
- numpy: 2.1.3
- nvidia-cublas-cu12: 12.4.5.8
- nvidia-cuda-cupti-cu12: 12.4.127
- nvidia-cuda-nvrtc-cu12: 12.4.127
- nvidia-cuda-runtime-cu12: 12.4.127
- nvidia-cudnn-cu12: 9.1.0.70
- nvidia-cufft-cu12: 11.2.1.3
- nvidia-curand-cu12: 10.3.5.147
- nvidia-cusolver-cu12: 11.6.1.9
- nvidia-cusparse-cu12: 12.3.1.170
- nvidia-nccl-cu12: 2.21.5
- nvidia-nvjitlink-cu12: 12.4.127
- nvidia-nvtx-cu12: 12.4.127
- osqp: 0.6.7.post3
- packaging: 24.2
- pillow: 11.0.0
- platformdirs: 4.3.6
- plotly: 5.24.1
- pluggy: 1.5.0
- pre-commit: 4.0.1
- propcache: 0.2.0
- pygments: 2.18.0
- pytest: 8.3.3
- pytest-cov: 6.0.0
- pytorch-lightning: 2.4.0
- pyyaml: 6.0.2
- qdldl: 0.1.7.post4
- qpsolvers: 4.4.0
- quadprog: 0.1.13
- requests: 2.32.3
- retrying: 1.3.4
- scipy: 1.14.1
- scs: 3.2.7
- setuptools: 75.6.0
- six: 1.16.0
- snowballstemmer: 2.2.0
- soupsieve: 2.6
- sphinx: 7.4.7
- sphinx-autodoc-typehints: 2.3.0
- sphinx-basic-ng: 1.0.0b2
- sphinx-design: 0.6.1
- sphinxcontrib-applehelp: 2.0.0
- sphinxcontrib-devhelp: 2.0.0
- sphinxcontrib-htmlhelp: 2.1.0
- sphinxcontrib-jsmath: 1.0.1
- sphinxcontrib-qthelp: 2.0.0
- sphinxcontrib-serializinghtml: 2.0.0
- sympy: 1.13.1
- tenacity: 9.0.0
- tomli: 2.1.0
- torch: 2.5.1
- torchjd: 0.2.2
- torchmetrics: 1.6.0
- torchvision: 0.20.1
- tqdm: 4.67.0
- triton: 3.1.0
- typeguard: 4.3.0
- typing-extensions: 4.12.2
- urllib3: 2.2.3
- virtualenv: 20.27.1
- werkzeug: 3.0.6
- wheel: 0.43.0
- yarl: 1.17.1
- zipp: 3.21.0
- OS: Linux
- architecture:
- 64bit
- ELF
- processor: x86_64
- python: 3.12.3
- release: 5.15.0-126-generic
- version: tensorboarX to tensorboardX #136~20.04.1-Ubuntu SMP Thu Nov 14 16:38:05 UTC 2024
More info
No response
The text was updated successfully, but these errors were encountered: