Skip to content

Commit

Permalink
feat(neuralop): support paddle
Browse files Browse the repository at this point in the history
  • Loading branch information
xiaoyewww committed Dec 12, 2024
1 parent 43c76a4 commit 1ab0890
Show file tree
Hide file tree
Showing 125 changed files with 9,087 additions and 4,482 deletions.
47 changes: 46 additions & 1 deletion README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,52 @@


===============
Neural Operator
Neural Operator(Paddle backend)
===============

.. image:: doc/_static/paddle_logo.png

.. important::

This branch(paddle) experimentally integrates `Paddle backend <https://www.paddlepaddle.org.cn/en/install/quick?docurl=/documentation/docs/en/develop/install/pip/linux-pip_en.html>`_ to Neural Operator.
It was developed from version 0.3.0 of Neural Operator. It is recommended to install **nightly-build(develop)** Paddle before running any code in this branch.
It was verified on Ubuntu 20.04. It may meet some problems if you are using other environment.

Installation
------------

.. code::
# install nightly-build paddlepaddle
python -m pip install --pre paddlepaddle-gpu -i https://www.paddlepaddle.org.cn/packages/nightly/cu118/
# triton
pip install -U --index-url https://aiinfra.pkgs.visualstudio.com/PublicPackages/_packaging/Triton-Nightly/pypi/simple/ triton-nightly
# install paddle_harmonics
git clone https://github.com/co63oc/PaddleScience.git
cd PaddleScience
git checkout fix2
cd jointContribution/paddle_harmonics
pip install -e . -i https://pypi.tuna.tsinghua.edu.cn/simple
export PYTHONPATH=</path to/PaddleScience/jointContribution/paddle_harmonics>:$PYTHONPATH
# install nightly-build ppsci
python -m pip install https://paddle-qa.bj.bcebos.com/PaddleScience/whl/latest/dist/paddlesci-0.0.0-py3-none-any.whl -i https://pypi.tuna.tsinghua.edu.cn/simple
# install neuraloperator
cd neuraloperator
pip install -e . -i https://pypi.tuna.tsinghua.edu.cn/simple
Unit Test
------------

.. code::
cd neuraloperator/example
pytest
Below is Neural Operator's original README
===============

``neuraloperator`` is a comprehensive library for
Expand Down
4 changes: 2 additions & 2 deletions config/burgers_config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ default: &DEFAULT

# Dataset related
data:
folder: '/home/ubuntu/data/burgers/burgers.npz'
folder: '/home/ubuntu/data/burgers/burgers.npz'
batch_size: 16
n_train: 800
test_batch_sizes: [16]
Expand Down Expand Up @@ -92,4 +92,4 @@ default: &DEFAULT
entity: "" # put your username here
sweep: False
log_output: True
log_test_interval: 1
log_test_interval: 1
4 changes: 2 additions & 2 deletions config/burgers_pino_config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ default: &DEFAULT

# Dataset related
data:
folder: '/home/ubuntu/data/burgers/burgers.npz'
folder: '/home/ubuntu/data/burgers/burgers.npz'
batch_size: 16
n_train: 800
test_batch_sizes: [16]
Expand Down Expand Up @@ -97,4 +97,4 @@ default: &DEFAULT
entity: "" # put your username here
sweep: False
log_output: True
log_test_interval: 1
log_test_interval: 1
4 changes: 2 additions & 2 deletions config/darcy_config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ default: &DEFAULT
implementation: 'factorized'
separable: 0
preactivation: 0

use_mlp: 1
mlp:
expansion: 0.5
Expand Down Expand Up @@ -82,7 +82,7 @@ default: &DEFAULT
wandb:
log: False
name: None # If None, config will be used but you can override it here
group: ''
group: ''
project: ""
entity: "" # put your username here
sweep: False
Expand Down
13 changes: 6 additions & 7 deletions config/default_config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ default: &DEFAULT
norm: None
skip: 'soft-gating'
implementation: 'reconstructed'

use_mlp: 1
mlp_expansion: 0.5
mlp_dropout: 0
Expand Down Expand Up @@ -66,7 +66,7 @@ default: &DEFAULT
n_train: 10000
train_resolution: 128
n_tests: [2000, 1000, 1000] #, 1000]
test_resolutions: [128, 256, 512] #, 1024]
test_resolutions: [128, 256, 512] #, 1024]
test_batch_sizes: [16, 8, 4] #, 1]
positional_encoding: True

Expand All @@ -86,7 +86,7 @@ default: &DEFAULT
wandb:
log: True
name: None # If None, config will be used but you can override it here
group: 'super-resolution'
group: 'super-resolution'
project: "Refactored-TFNO"
entity: "nvr-ai-algo" # put your username here
sweep: False
Expand All @@ -107,7 +107,7 @@ original_fno:
fft_norm: 'forward'
norm: None
skip: 'linear'

use_mlp: 0
mlp:
expansion: 0.5
Expand All @@ -122,8 +122,8 @@ original_fno:
log: False
name: None # If None, config will be used but you can override it here
group: 'wandb_group'


distributed_mg_tucker:
tfno2d:
factorization: Tucker
Expand All @@ -141,4 +141,3 @@ distributed_mg_tucker:
levels: 1
padding: 16
stitching: True

4 changes: 2 additions & 2 deletions config/test_config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ default: &DEFAULT
norm: None
skip: 'soft-gating'
implementation: 'factorized'

use_mlp: 1
mlp:
expansion: 0.5
Expand All @@ -32,7 +32,7 @@ default: &DEFAULT
joint_factorization: False
fno_block_precision: 'full' #or 'half', 'mixed'
stabilizer: None #or 'tanh'

data:
batch_size: 4
n_train: 10
Expand Down
Binary file added doc/_static/paddle_logo.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
6 changes: 3 additions & 3 deletions doc/requirements_doc.txt
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
sphinx
numpydoc
matplotlib
sphinx-gallery
myst-nb
numpydoc
sphinx
sphinx-gallery
tensorly_sphinx_theme
2 changes: 1 addition & 1 deletion doc/source/compress_images.sh
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# Adapted from https://stackoverflow.com/questions/59111396/loop-through-the-directories-to-get-the-image-files
# Usage
# Usage
# chmod 755 compress_images.bash
# bash compress_images.sh ./_static/images

Expand Down
65 changes: 34 additions & 31 deletions doc/source/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,15 +16,18 @@


# -- Project information -----------------------------------------------------

project = 'neuraloperator'
from datetime import datetime

import neuralop

project = "neuraloperator"


year = datetime.now().year
copyright = f'{year}, Jean Kossaifi, Nikola Kovachki, Zongyi Li and Anima Anandkumar'
author = 'Jean Kossaifi, Nikola Kovachki, Zongyi Li and Anima Anandkumar'
copyright = f"{year}, Jean Kossaifi, Nikola Kovachki, Zongyi Li and Anima Anandkumar"
author = "Jean Kossaifi, Nikola Kovachki, Zongyi Li and Anima Anandkumar"

# The full version, including alpha/beta/rc tags
import neuralop
release = neuralop.__version__


Expand All @@ -34,78 +37,78 @@
# extensions coming with Sphinx (named 'sphinx.ext.*') or your custom
# ones.
extensions = [
'sphinx.ext.autodoc',
'sphinx.ext.autosummary',
'sphinx.ext.todo',
'sphinx.ext.viewcode',
'sphinx.ext.githubpages',
'sphinx.ext.mathjax', #'sphinx.ext.imgmath',
'numpydoc.numpydoc',
'sphinx_gallery.gen_gallery',
"sphinx.ext.autodoc",
"sphinx.ext.autosummary",
"sphinx.ext.todo",
"sphinx.ext.viewcode",
"sphinx.ext.githubpages",
"sphinx.ext.mathjax", # 'sphinx.ext.imgmath',
"numpydoc.numpydoc",
"sphinx_gallery.gen_gallery",
]

sphinx_gallery_conf = {
'examples_dirs': '../../examples', # path to your example scripts
'gallery_dirs': 'auto_examples', # path to where to save gallery generated output
"examples_dirs": "../../examples", # path to your example scripts
"gallery_dirs": "auto_examples", # path to where to save gallery generated output
}


# Add any paths that contain templates here, relative to this directory.
templates_path = ['_templates']
templates_path = ["_templates"]

# List of patterns, relative to source directory, that match files and
# directories to ignore when looking for source files.
# This pattern also affects html_static_path and html_extra_path.
exclude_patterns = []

# NumPy
# NumPy
numpydoc_class_members_toctree = False
numpydoc_show_class_members = True
numpydoc_show_inherited_class_members = False

# generate autosummary even if no references
autosummary_generate = True
autodoc_member_order = 'bysource'
autodoc_default_flags = ['members']
autodoc_member_order = "bysource"
autodoc_default_flags = ["members"]

# Napoleon
napoleon_google_docstring = False
napoleon_use_rtype = False

# imgmath/mathjax
imgmath_image_format = 'svg'
imgmath_image_format = "svg"

# List of patterns, relative to source directory, that match files and
# directories to ignore when looking for source files.
# This pattern also affects html_static_path and html_extra_path.
exclude_patterns = ['_build', 'Thumbs.db', '.DS_Store']
exclude_patterns = ["_build", "Thumbs.db", ".DS_Store"]


# -- Options for HTML output -------------------------------------------------

# The theme to use for HTML and HTML Help pages. See the documentation for
# a list of builtin themes.
#
html_theme = 'tensorly_sphinx_theme'
html_logo = '_static/logos/neuraloperator_logo.png'
html_theme = "tensorly_sphinx_theme"
html_logo = "_static/logos/neuraloperator_logo.png"
html_show_sphinx = False

html_theme_options = {
'github_url': 'https://github.com/neuraloperator/neuraloperator',
"github_url": "https://github.com/neuraloperator/neuraloperator",
# 'google_analytics' : 'G-QSPLEF75VT',
'nav_links' : [('Install', 'install'),
('User Guide', 'user_guide/index'),
('API', 'modules/api'),
('Examples', 'auto_examples/index')
],
"nav_links": [
("Install", "install"),
("User Guide", "user_guide/index"),
("API", "modules/api"),
("Examples", "auto_examples/index"),
],
# 'external_nav_links' : [('TensorLy', 'http://tensorly.org/dev')]
}

# Add any paths that contain custom static files (such as style sheets) here,
# relative to this directory. They are copied after the builtin static files,
# so a file named "default.css" will overwrite the builtin "default.css".
html_static_path = ['_static']
html_static_path = ["_static"]

# Remove the permalinks ("¶" symbols)
html_permalinks_icon = ""

Loading

0 comments on commit 1ab0890

Please sign in to comment.