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

Add NNCG to optimizers submodule #1661

Open
wants to merge 11 commits into
base: master
Choose a base branch
from

Conversation

pratikrathore8
Copy link

No description provided.

@lululxvi
Copy link
Owner

Format the code using black https://github.com/psf/black

@pratikrathore8
Copy link
Author

I've formatted the code with black in the latest commit!

@lululxvi
Copy link
Owner

If this only supports pytorch, then it should be in https://github.com/lululxvi/deepxde/tree/master/deepxde/optimizers/pytorch

@pratikrathore8
Copy link
Author

Moved to the right folder!

@pratikrathore8
Copy link
Author

Made the formatting changes. I noticed there are other lines in the code with > 88 chars per line. Would you like for me to fix those?

@lululxvi
Copy link
Owner

lululxvi commented Mar 3, 2024

Made the formatting changes. I noticed there are other lines in the code with > 88 chars per line. Would you like for me to fix those?

Yes.

Could you also fix the Codacy issues?

@pratikrathore8
Copy link
Author

pratikrathore8 commented Mar 4, 2024

The formatting has been fixed.

There are still some Codacy issues, but these are mainly due to "too many local variables" and the __init__ function in the optimizer, which is just following PyTorch conventions.

What do we need do next to further integrate NNCG into the codebase?

@lululxvi
Copy link
Owner

lululxvi commented Mar 5, 2024

@pratikrathore8
Copy link
Author

I've added NNCG to optimizers.py and NNCG_options to config.py

@pratikrathore8
Copy link
Author

Fixed!

@pratikrathore8
Copy link
Author

Fixed!

@lululxvi
Copy link
Owner

Have you tried using NNCG in some demo examples?

@pratikrathore8
Copy link
Author

A quick update:

I've started thinking about how to make a demo example that uses NNCG. The plan would be to modify some of the existing examples (e.g. Burgers.py) and add on NNCG after Adam and L-BFGS.

I'll have to make some modifications to model.py to full integrate NNCG into the training pipeline. I'm aiming to have an example fully working by the end of next week!

@pratikrathore8
Copy link
Author

pratikrathore8 commented Apr 8, 2024

I've added a demo Burgers_NNCG.py in examples that uses NNCG. NNCG consistently lowers the loss after Adam+L-BFGS, although there is variance in the amount of improvement (which is probably due to not setting the random seed). Please let me know if you see the improvements on your end too!

To fully integrate NNCG into the codebase, I added a function called _train_pytorch_nncg to model.py. I've left comments in _train_pytorch_nncg to describe my thought process.

Let me know what changes need to be made! I'm also happy to add more demos if you have suggestions.

@pratikrathore8
Copy link
Author

@lululxvi Any updates on the pull request?

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.

None yet

2 participants