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

Non-intrusive reduced order models using artificial neural networks #1001

Merged
merged 57 commits into from Jul 16, 2020

Conversation

HenKlei
Copy link
Member

@HenKlei HenKlei commented Jul 7, 2020

This PR adds a simple approach for reduced order modeling based on neural networks.

The implementation employs PyTorch as package for neural network training and can be used with arbitrary external solvers.

@HenKlei
Copy link
Member Author

@HenKlei HenKlei commented Jul 7, 2020

At the moment, there are still problems with the plots, see also #966.

If we can not fix this soon, I will switch to 2d examples here.

@renefritze renefritze added the pr:new-feature label Jul 7, 2020
@pymor-lab-hub-bridge
Copy link

@pymor-lab-hub-bridge pymor-lab-hub-bridge bot commented Jul 7, 2020

Hey @HenKlei it looks like this PR touches our CI config, therefore I am not starting a gitlab-ci build for it and it will not be mergeable.

@renefritze
Copy link
Member

@renefritze renefritze commented Jul 7, 2020

Pytorch needs special casing for installation since the non-GPU version is not available via pypi. For the docker infrastructure this is here: pymor/docker@9dab7d3
Since this needs a non-default index URL we cannot put this in our dependencies (due to various tool incompatibilities). There we'll use the unqualified "torch" and leave it to the user to install a fitting torch version. We cannot put version requirements on this, since the non-default versions are tagged via the version string (pip install torch==${PYTORCH_VERSION}+cpu ). I've updated the docker tags for this, but it will take a few hours for the images to be available.

@renefritze
Copy link
Member

@renefritze renefritze commented Jul 7, 2020

And I guess I'll need to teach my bot to accept a safelist for certain contributors 🙄

@renefritze
Copy link
Member

@renefritze renefritze commented Jul 7, 2020

And I guess I'll need to teach my bot to accept a safelist for certain contributors

Did that and tested in #1003

@HenKlei
Copy link
Member Author

@HenKlei HenKlei commented Jul 7, 2020

Did that and tested in #1003

Great, thanks!

Copy link
Member

@sdrave sdrave left a comment

Very nice work! I have mostly minor remarks ..

docs/source/bibliography.rst Outdated Show resolved Hide resolved
docs/source/tutorial_mor_with_anns.rst Outdated Show resolved Hide resolved
docs/source/tutorial_mor_with_anns.rst Outdated Show resolved Hide resolved
docs/source/tutorial_mor_with_anns.rst Show resolved Hide resolved
docs/source/tutorial_mor_with_anns.rst Outdated Show resolved Hide resolved
src/pymor/reductors/neural_network.py Outdated Show resolved Hide resolved
src/pymor/reductors/neural_network.py Outdated Show resolved Hide resolved
src/pymor/reductors/neural_network.py Outdated Show resolved Hide resolved
src/pymor/reductors/neural_network.py Outdated Show resolved Hide resolved
src/pymor/reductors/neural_network.py Outdated Show resolved Hide resolved
@sdrave sdrave added this to the 2020.1 milestone Jul 7, 2020
@HenKlei
Copy link
Member Author

@HenKlei HenKlei commented Jul 8, 2020

@sdrave First of all, thank you very much for taking so much time and putting so much effort in reviewing this stuff! I already had a short look into your suggestions and they all look absolutely reasonable. I will apply them and ask further questions where necessary.

src/pymordemos/neural_networks.py Outdated Show resolved Hide resolved
src/pymordemos/neural_networks_fenics.py Outdated Show resolved Hide resolved
src/pymortests/demos.py Outdated Show resolved Hide resolved
@renefritze
Copy link
Member

@renefritze renefritze commented Jul 8, 2020

If the CI now goes through my last two commits can be squashed. Otherwise expect another 'fixme'.

@renefritze
Copy link
Member

@renefritze renefritze commented Jul 9, 2020

@renefritze renefritze mentioned this pull request Jul 9, 2020
5 tasks
@HenKlei HenKlei requested a review from sdrave Jul 13, 2020
sdrave
sdrave approved these changes Jul 14, 2020
Copy link
Member

@sdrave sdrave left a comment

LGTM!

@renefritze
Copy link
Member

@renefritze renefritze commented Jul 14, 2020

@renefritze
Copy link
Member

@renefritze renefritze commented Jul 14, 2020

@HenKlei https://github.com/pymor/pymor/blob/master/src/pymortests/demos.py#L184

These should actually be re-raised/not xfailed if DOCKER_PYMOR is in the env, but that's for another PR.

@HenKlei
Copy link
Member Author

@HenKlei HenKlei commented Jul 14, 2020

@renefritze As far as I can see, the fails in the pipelines are not directly related to the neural network code, right?

@renefritze
Copy link
Member

@renefritze renefritze commented Jul 14, 2020

@renefritze As far as I can see, the fails in the pipelines are not directly related to the neural network code, right?

Indeed. Those are the same issues #1012 suffers from.

pmli
pmli approved these changes Jul 14, 2020
Copy link
Member

@pmli pmli left a comment

Just a couple of minor remarks.

docs/source/tutorial_mor_with_anns.rst Outdated Show resolved Hide resolved
docs/source/tutorial_mor_with_anns.rst Show resolved Hide resolved
HenKlei and others added 22 commits Jul 16, 2020
Co-authored-by: Stephan Rave <stephanrave@uni-muenster.de>
Co-authored-by: Stephan Rave <stephanrave@uni-muenster.de>
Co-authored-by: Stephan Rave <stephanrave@uni-muenster.de>
Co-authored-by: Stephan Rave <stephanrave@uni-muenster.de>
to avoid collisions with new random handling
Co-authored-by: Petar Mlinarić <mlinaric@mpi-magdeburg.mpg.de>
@renefritze
Copy link
Member

@renefritze renefritze commented Jul 16, 2020

This PR now already contains commits from #1012 to get CI green, so it should only be merged after #1012 .

@codecov
Copy link

@codecov codecov bot commented Jul 16, 2020

Codecov Report

Merging #1001 into master will increase coverage by 0.23%.
The diff coverage is 88.88%.

Impacted Files Coverage Δ
src/pymor/core/exceptions.py 80.64% <60.00%> (-3.98%) ⬇️
src/pymor/models/neural_network.py 88.09% <88.09%> (ø)
src/pymor/reductors/neural_network.py 90.00% <90.00%> (ø)
src/pymor/parameters/base.py 80.08% <0.00%> (+0.43%) ⬆️
src/pymor/vectorarrays/interface.py 82.50% <0.00%> (+0.83%) ⬆️

@sdrave sdrave merged commit b164884 into pymor:master Jul 16, 2020
9 checks passed
@HenKlei HenKlei deleted the neural-networks branch Jul 16, 2020
@pmli pmli mentioned this pull request Aug 9, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
pr:new-feature
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants