MCPcopy Index your code
hub / github.com/WooJin-Cho/Hyper-LR-PINN

github.com/WooJin-Cho/Hyper-LR-PINN @main

Chat with this repo
repository ↗ · DeepWiki ↗ · + Follow
27 symbols 222 edges 15 files 3 documented · 11%
What it actually does AI analysis from the code graph — generated when you open this
loading…
README

Hypernetwork-based Meta-Learning for Low-Rank Physics-Informed Neural Networks (NeurIPS 2023)

Introduction

This repository contains pytorch implementation for our NeurIPS 2023 (spotlight) paper:

Hypernetwork-based Meta-Learning for Low-Rank Physics-Informed Neural Networks

Experimental environment settings.

Run the following code before starting the experiment.

conda env create -f env.yaml
conda activate meta

Data generation

You can generate dataset for train / validation / test. Run code in the folder "data_gen".

     [ Code ]                   [ Description of code ]

python gen_conv.py : Code for generating convection equation data
python gen_diff.py : Code for generating diffusion equation data
python gen_reac.py : Code for generating reaction equatinon data
python gen_cd.py   : Code for generating Convection-Diffusion equation data
python gen_rd.py   : Code for generating Reaction-Diffusion equation data
python gen_cdr.py  : Code for generating Convection-Diffusion-Reaction data

Set the initial condition using "u0_str" parser. (you can select following option : sin_1, gauss, gauss_pi_2, etc...)

[ u0_str ]

sin_1       : 1+sin(x)
gauss       : Gaussian distribution with STD=pi/4.
gauss_pi_2  : Gaussian distribution with STD=pi/2.

Train

Run the following code for Hyper-LR-PINN training / testing.

     [ Code ]              [ Description of code ]

python train_meta.py    : Code for Hyper-LR-PINN training [phase1]
python train_full.py    : Code for Hyper-LR-PINN (Full rank) training [phase2]
python train_adap.py    : Code for Hyper-LR-PINN (Adaptive rank) training [phase2]

Detailed settings can be changed in config.py

For example, if you run the following code,

python train_meta.py --epoch 20000 --pde_type convection --init_cond sin_1 --start_coeff_1 1 --end_coeff_1 20
python train_adap.py --epoch 10000 --pde_type convection --init_cond sin_1 --start_coeff_1 1 --end_coeff_1 20 --target_coeff_1 10
python train_full.py --epoch 10000 --pde_type convection --init_cond sin_1 --start_coeff_1 1 --end_coeff_1 20 --target_coeff_1 10

You can train/test the Hyper-LR-PINNs in the setting below.

[ Experimental setting ]

phase1 : 20000 epoch \ phase2 : 10000 epoch \ pde type : convection equation, \ initial condition : 1+sin(x), \ target equation : beta=10 (convection equation), \ meta-learning range : beta $\in$ [1, 20]

Test

In additaon, we attach checkpoint of Hyper-LR-PINN (.pt file) If you want to check it quickly, run the following code below.

     [ Code ]                   [ Description of code ]

python test.py  : Code for testing Hyper-LR-PINN (Adaptive) (30~40 range, convection equation)

For example, if you run the following code,

python test.py --pde_type convection --init_cond sin_1 --start_coeff_1 30 --end_coeff_1 40 --target_coeff_1 40

You can test the Hyper-LR-PINN (Adaptive rank) quickly. (beta=40)

Other code

Brief description of the other code files.

    [ Code ]        [ Description of code ]

    model.py   :  Hyper-LR-PINN model. (phase1, phase2)
    utils.py   :  PDE residual loss

Core symbols most depended-on inside this repo

orthogonality_reg
called by 12
utils.py
get_config
called by 9
config.py
reaction_solution
called by 6
data_gen/systems.py
reaction_diffusion_discrete_solution
called by 6
data_gen/systems.py
sample_random
called by 6
data_gen/utils.py
get_params
called by 4
utils.py
function
called by 4
data_gen/systems.py
convection_diffusion_discrete_solution
called by 4
data_gen/systems.py

Shape

Function 21
Method 4
Class 2

Languages

Python100%

Modules by API surface

data_gen/systems.py8 symbols
model.py6 symbols
utils.py5 symbols
data_gen/utils.py3 symbols
train_meta.py1 symbols
train_full.py1 symbols
train_adap.py1 symbols
test.py1 symbols
config.py1 symbols

For agents

$ claude mcp add Hyper-LR-PINN \
  -- python -m otcore.mcp_server <graph>

⬇ download graph artifact