-
Notifications
You must be signed in to change notification settings - Fork 3
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
Packaging core routines #1
Conversation
This looks really good! I am going to start going through it |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I like this direction!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looking good!
I was able to produce accurate results for 1DBurger's using the updated packages/files added here. Nice contribution! |
This PR provides a skeleton for python packaging the repository. Currently it is implemented based on 1D burger's equation example. If there are additional features in other examples, they will be added in future PRs.
I intend this PR to be an initial groundwork, not necessarily completing everything in this one PR, so that we keep the amount of PRs smaller, easier for review.
In pip installation, current version is set as
2.0.0dev
. The current official release will be marked as1.0.0
in the repository.pyproject.toml
pyproject.toml
file specifies the configuration for installation. All prerequisites and the core modules can be installed viaat the repository.
lasdi
. Although this repository only has GPLasDI, I'm hoping to set this as a placeholder for all variations of LasDI. I'm open for other suggestions though.lasdi
will also provide an executablelasdi
, which will provide the workflow interface with FOM simulations outside this package. For details, see Executable for the main workflow below.Running an example
Currently input file/postprocess of burgers 1d equation is provided at
examples
directory. Once pip installation is finished, run the example on the terminal to generate data/train the model:Postprocess and visualization is demonstrated on jupyter notebook
examples/burgers1d.ipynb
.NOTE: Currently most post-process/visualization routines are copy-pasted from the legacy code. There will be a significant refactoring in future.
Prerequisites updated
Updated prerequisites are specified in
pyproject.toml
as below:Core routines of GPLasDI
The legacy code has been provided specific to each physics example, and the users had to revise the code according to their applications. We intend to store some core routines that are common to all applications:
Each file in
src
directory can be imported as a python module, once installed via pip. For example,src/lasdi/gplasdi.py
can be imported asFollowing are the main modules for the training:
lasdi.sindy
: routines related to SInDy training/prediction.lasdi.latent_space
: routines related to latent space autoencoders.Autoencoder
class is included here.lasdi.interp
: routines for interpolation of sindy coefficients in parameter space.lasdi.gplasdi
: routines for GPLasDI training.BayesianGLasDI
class is included here.lasdi.physics
: routines for built-in physics simulations. For now, onlylasdi.physics.burgers1d
module is provided. The 4 examples in the legacy code will be incorporated into this module in future.lasdi.workflow
: routines for training workflow and interface with offline FOM simulation. for details, see Executable for the main workflow below.lasdi.postprocess
: routines for post-processing/visualization. There will be significant refactorings on this module in future.Executable for the main workflow
For production runs, the training workflow needs to be combined with offline FOM simulations for sampling. This means that we cannot run the entire workflow within a single python
for
-loop: we run each step of the training iterations, and decide at some point to run a FOM simulation outside the python framework, and come back after collecting FOM snapshot.The executable
lasdi
is developed with the intention for interfacing the python training routine and the offline FOM simulation. All related functions are stored insrc/lasdi/workflow.py
:main
function is the routine that is run by the executablelasdi
. It reads a config yaml file that specifies the required inputs for the entire workflow. The inputs include those options ingenerate_data.py
andtrain_model1.py
of the legacy code. It runsstep
function based on the input file.step
function runs various stages of the training workflow, depending on the previous output ofNextStep
andResult
. These enumerations are stored insrc/lasdi/enums.py
.Currently, this only supports the 1D burger's equation, with the entire workflow fully run on python. The example config file for this is stored in
examples/burgers1d.yml
. The more generalized workflow will be provided in future PRs.Legacy codes
The existing codes for 4 examples (1d/2d burgers equation, rising bubble and vlasov equation) remain the same. They are still under the old prerequisites for version 1.0.0. They are also not included in the pip installation procedure as mentioned above. Users can still use them with old pre-requisites, as they have done before. In future, they will be all incorporated into the core modules, with the updated pre-requisites.