Code Monkey home page Code Monkey logo

Comments (5)

jacanchaplais avatar jacanchaplais commented on July 28, 2024 2

When using TorchMetrics (written by the same developers are PyTorch Lightning), the metrics are automatically distributed between devices during steps, and collected at the end of each step and epoch. These are made available in the hooks for those events, see TorchMetrics in PyTorch Lightning. I don't know why they don't populate the same trainer.callback_metrics dictionary in either case, might be an error on their part, but perhaps it could be solved by writing monitored metrics to a property of the model?

from optuna-examples.

jacanchaplais avatar jacanchaplais commented on July 28, 2024

Closed because I noticed it's a duplicate of optuna/optuna#1417

from optuna-examples.

nzw0301 avatar nzw0301 commented on July 28, 2024

Let me summarise the points -- thank you @jacanchaplais for pointing out them.

  1. The multi-GPUs training does not work due to this error -- I suppose rank 0 has only the attribute val_acc and the others do not. If a machine has multi-GPUs, pytorch_lightining_simple.py uses all GPUs according to this line, so this error happens always on a machine with multi-GPUs.
  2. Are there any issues with PyTorch-lightning with DDP training? If so, it would be great to mention it as comments in the example code or the callback page.

from optuna-examples.

jacanchaplais avatar jacanchaplais commented on July 28, 2024

I suppose rank 0 has only the attribute val_acc and the others do not.

Also, I don't think the issue is due to which device the metrics are stored to, as the line which tries to access trainer.callback_metrics['val_acc'] is after the trainer.fit() method has completed execution, so I would have thought that the data would not be partitioned to specific devices (although I am new to GPU parallelism, so let me know if I'm wrong).

from optuna-examples.

jacanchaplais avatar jacanchaplais commented on July 28, 2024

Submitted failure to populate callback_metrics as an issue to PyTorch Lightning, as I implemented with Ray[Tune] and ran into the same problem.

from optuna-examples.

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.