neuraloperator


Nameneuraloperator JSON
Version 1.0.2 PyPI version JSON
download
home_pageNone
SummaryNeuralOperator: Learning in Infinite Dimensions
upload_time2024-12-30 21:00:53
maintainerNone
docs_urlNone
authorNone
requires_python>=3.9
licenseMIT
keywords
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            .. image:: https://img.shields.io/pypi/v/neuraloperator
   :target: https://pypi.org/project/neuraloperator/
   :alt: PyPI

.. image:: https://github.com/NeuralOperator/neuraloperator/actions/workflows/test.yml/badge.svg
   :target: https://github.com/NeuralOperator/neuraloperator/actions/workflows/test.yml


===============================================
NeuralOperator: Learning in Infinite Dimensions
===============================================

``neuraloperator`` is a comprehensive library for 
learning neural operators in PyTorch.
It is the official implementation for Fourier Neural Operators 
and Tensorized Neural Operators.

Unlike regular neural networks, neural operators
enable learning mapping between function spaces, and this library
provides all of the tools to do so on your own data.

Neural operators are also resolution invariant, 
so your trained operator can be applied on data of any resolution.


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

Just clone the repository and install locally (in editable mode so changes in the code are 
immediately reflected without having to reinstall):

.. code::

  git clone https://github.com/NeuralOperator/neuraloperator
  cd neuraloperator
  pip install -e .
  pip install -r requirements.txt

You can also just pip install the most recent stable release of the library 
on `PyPI <https://pypi.org/project/neuraloperator/>`_:


.. code::
  
  pip install neuraloperator

Quickstart
----------

After you've installed the library, you can start training operators seamlessly:


.. code-block:: python

   from neuralop.models import FNO

   operator = FNO(n_modes=(16, 16), hidden_channels=64,
                   in_channels=3, out_channels=1)

Tensorization is also provided out of the box: you can improve the previous models
by simply using a Tucker Tensorized FNO with just a few parameters:

.. code-block:: python

   from neuralop.models import TFNO

   operator = TFNO(n_modes=(16, 16), hidden_channels=64,
                   in_channels=3, 
                   out_channels=1,
                   factorization='tucker',
                   implementation='factorized',
                   rank=0.05)

This will use a Tucker factorization of the weights. The forward pass
will be efficient by contracting directly the inputs with the factors
of the decomposition. The Fourier layers will have 5% of the parameters
of an equivalent, dense Fourier Neural Operator!

Checkout the `documentation <https://neuraloperator.github.io/dev/index.html>`_ for more!

Using with weights and biases
-----------------------------

Create a file in ``neuraloperator/config`` called ``wandb_api_key.txt`` and paste your Weights and Biases API key there.
You can configure the project you want to use and your username in the main yaml configuration files.

===============
Contributing
===============

NeuralOperator is 100% open-source, and we welcome all contributions from the community! 
If you spot a bug or a typo in the documentation, or have an idea for a feature you'd like to see,
please report it on our `issue tracker <https://github.com/neuraloperator/neuraloperator/issues>`_, 
or even better, open a Pull-Request on `GitHub <https://github.com/neuraloperator/neuraloperator>`_. 

NeuralOperator has additional dependencies for development, which can be found in ``requirements_dev.txt``:

.. code::
   
   pip install -r requirements_dev.txt

Code formatting
----------------

Before you submit your changes, you should make sure your code adheres to our style-guide. The
easiest way to do this is with ``black``:

.. code::

   black .

Running the tests
------------------

Testing and documentation are an essential part of this package and all
functions come with unit-tests and documentation. The tests are run using the
pytest package. 
    
To run the tests, simply run, in the terminal:

.. code::

    pytest -v neuralop

Building documentation
-----------------------
The HTML for our documentation website is built using ``sphinx``. The documentation
is built from inside the ``doc`` folder. 

.. code::

   cd doc
   make html

This will build the docs in ``./doc/build/html``.

Note that the documentation requires other dependencies installable from ``./doc/requirements_doc.txt``. 

To view the documentation locally, run:

.. code::

   cd doc/build/html
   python -m http.server [PORT_NUM]

The docs will then be viewable at ``localhost:PORT_NUM``.

    
Citing
------

If you use NeuralOperator in an academic paper, please cite [1]_, [2]_::

   @misc{kossaifi2024neural,
      title={A Library for Learning Neural Operators}, 
      author={Jean Kossaifi and Nikola Kovachki and 
      Zongyi Li and Davit Pitt and 
      Miguel Liu-Schiaffini and Robert Joseph George and 
      Boris Bonev and Kamyar Azizzadenesheli and 
      Julius Berner and Anima Anandkumar},
      year={2024},
      eprint={2412.10354},
      archivePrefix={arXiv},
      primaryClass={cs.LG}
   }

   @article{kovachki2021neural,
      author    = {Nikola B. Kovachki and
                     Zongyi Li and
                     Burigede Liu and
                     Kamyar Azizzadenesheli and
                     Kaushik Bhattacharya and
                     Andrew M. Stuart and
                     Anima Anandkumar},
      title     = {Neural Operator: Learning Maps Between Function Spaces},
      journal   = {CoRR},
      volume    = {abs/2108.08481},
      year      = {2021},
   }


.. [1] Kossaifi, J., Kovachki, N., Li, Z., Pitt, D., Liu-Schiaffini, M., George, R., Bonev, B., Azizzadenesheli, K., Berner, J., and Anandkumar, A., "A Library for Learning Neural Operators", ArXiV, 2024. doi:10.48550/arXiv.2412.10354.


.. [2] Kovachki, N., Li, Z., Liu, B., Azizzadenesheli, K., Bhattacharya, K., Stuart, A., and Anandkumar A., “Neural Operator: Learning Maps Between Function Spaces”, JMLR, 2021. doi:10.48550/arXiv.2108.08481.

            

Raw data

            {
    "_id": null,
    "home_page": null,
    "name": "neuraloperator",
    "maintainer": null,
    "docs_url": null,
    "requires_python": ">=3.9",
    "maintainer_email": null,
    "keywords": null,
    "author": null,
    "author_email": "\"Jean Kossaifi <jean.kossaifi@gmail.com>, David Pitt <david.h.pitt@gmail.com>, Nik Kovachki, Zongyi Li\" <david.h.pitt@gmail.com>",
    "download_url": "https://files.pythonhosted.org/packages/49/2c/7909d8e713deba174f754164f0874e4a4f15cf7a550738b2e501415ea32b/neuraloperator-1.0.2.tar.gz",
    "platform": null,
    "description": ".. image:: https://img.shields.io/pypi/v/neuraloperator\n   :target: https://pypi.org/project/neuraloperator/\n   :alt: PyPI\n\n.. image:: https://github.com/NeuralOperator/neuraloperator/actions/workflows/test.yml/badge.svg\n   :target: https://github.com/NeuralOperator/neuraloperator/actions/workflows/test.yml\n\n\n===============================================\nNeuralOperator: Learning in Infinite Dimensions\n===============================================\n\n``neuraloperator`` is a comprehensive library for \nlearning neural operators in PyTorch.\nIt is the official implementation for Fourier Neural Operators \nand Tensorized Neural Operators.\n\nUnlike regular neural networks, neural operators\nenable learning mapping between function spaces, and this library\nprovides all of the tools to do so on your own data.\n\nNeural operators are also resolution invariant, \nso your trained operator can be applied on data of any resolution.\n\n\nInstallation\n------------\n\nJust clone the repository and install locally (in editable mode so changes in the code are \nimmediately reflected without having to reinstall):\n\n.. code::\n\n  git clone https://github.com/NeuralOperator/neuraloperator\n  cd neuraloperator\n  pip install -e .\n  pip install -r requirements.txt\n\nYou can also just pip install the most recent stable release of the library \non `PyPI <https://pypi.org/project/neuraloperator/>`_:\n\n\n.. code::\n  \n  pip install neuraloperator\n\nQuickstart\n----------\n\nAfter you've installed the library, you can start training operators seamlessly:\n\n\n.. code-block:: python\n\n   from neuralop.models import FNO\n\n   operator = FNO(n_modes=(16, 16), hidden_channels=64,\n                   in_channels=3, out_channels=1)\n\nTensorization is also provided out of the box: you can improve the previous models\nby simply using a Tucker Tensorized FNO with just a few parameters:\n\n.. code-block:: python\n\n   from neuralop.models import TFNO\n\n   operator = TFNO(n_modes=(16, 16), hidden_channels=64,\n                   in_channels=3, \n                   out_channels=1,\n                   factorization='tucker',\n                   implementation='factorized',\n                   rank=0.05)\n\nThis will use a Tucker factorization of the weights. The forward pass\nwill be efficient by contracting directly the inputs with the factors\nof the decomposition. The Fourier layers will have 5% of the parameters\nof an equivalent, dense Fourier Neural Operator!\n\nCheckout the `documentation <https://neuraloperator.github.io/dev/index.html>`_ for more!\n\nUsing with weights and biases\n-----------------------------\n\nCreate a file in ``neuraloperator/config`` called ``wandb_api_key.txt`` and paste your Weights and Biases API key there.\nYou can configure the project you want to use and your username in the main yaml configuration files.\n\n===============\nContributing\n===============\n\nNeuralOperator is 100% open-source, and we welcome all contributions from the community! \nIf you spot a bug or a typo in the documentation, or have an idea for a feature you'd like to see,\nplease report it on our `issue tracker <https://github.com/neuraloperator/neuraloperator/issues>`_, \nor even better, open a Pull-Request on `GitHub <https://github.com/neuraloperator/neuraloperator>`_. \n\nNeuralOperator has additional dependencies for development, which can be found in ``requirements_dev.txt``:\n\n.. code::\n   \n   pip install -r requirements_dev.txt\n\nCode formatting\n----------------\n\nBefore you submit your changes, you should make sure your code adheres to our style-guide. The\neasiest way to do this is with ``black``:\n\n.. code::\n\n   black .\n\nRunning the tests\n------------------\n\nTesting and documentation are an essential part of this package and all\nfunctions come with unit-tests and documentation. The tests are run using the\npytest package. \n    \nTo run the tests, simply run, in the terminal:\n\n.. code::\n\n    pytest -v neuralop\n\nBuilding documentation\n-----------------------\nThe HTML for our documentation website is built using ``sphinx``. The documentation\nis built from inside the ``doc`` folder. \n\n.. code::\n\n   cd doc\n   make html\n\nThis will build the docs in ``./doc/build/html``.\n\nNote that the documentation requires other dependencies installable from ``./doc/requirements_doc.txt``. \n\nTo view the documentation locally, run:\n\n.. code::\n\n   cd doc/build/html\n   python -m http.server [PORT_NUM]\n\nThe docs will then be viewable at ``localhost:PORT_NUM``.\n\n    \nCiting\n------\n\nIf you use NeuralOperator in an academic paper, please cite [1]_, [2]_::\n\n   @misc{kossaifi2024neural,\n      title={A Library for Learning Neural Operators}, \n      author={Jean Kossaifi and Nikola Kovachki and \n      Zongyi Li and Davit Pitt and \n      Miguel Liu-Schiaffini and Robert Joseph George and \n      Boris Bonev and Kamyar Azizzadenesheli and \n      Julius Berner and Anima Anandkumar},\n      year={2024},\n      eprint={2412.10354},\n      archivePrefix={arXiv},\n      primaryClass={cs.LG}\n   }\n\n   @article{kovachki2021neural,\n      author    = {Nikola B. Kovachki and\n                     Zongyi Li and\n                     Burigede Liu and\n                     Kamyar Azizzadenesheli and\n                     Kaushik Bhattacharya and\n                     Andrew M. Stuart and\n                     Anima Anandkumar},\n      title     = {Neural Operator: Learning Maps Between Function Spaces},\n      journal   = {CoRR},\n      volume    = {abs/2108.08481},\n      year      = {2021},\n   }\n\n\n.. [1] Kossaifi, J., Kovachki, N., Li, Z., Pitt, D., Liu-Schiaffini, M., George, R., Bonev, B., Azizzadenesheli, K., Berner, J., and Anandkumar, A., \"A Library for Learning Neural Operators\", ArXiV, 2024. doi:10.48550/arXiv.2412.10354.\n\n\n.. [2] Kovachki, N., Li, Z., Liu, B., Azizzadenesheli, K., Bhattacharya, K., Stuart, A., and Anandkumar A., \u201cNeural Operator: Learning Maps Between Function Spaces\u201d, JMLR, 2021. doi:10.48550/arXiv.2108.08481.\n",
    "bugtrack_url": null,
    "license": "MIT",
    "summary": "NeuralOperator: Learning in Infinite Dimensions",
    "version": "1.0.2",
    "project_urls": null,
    "split_keywords": [],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "f48089e861a294878927376dee6ab4dacb2ad63461cde557721234fcb1d0c683",
                "md5": "2f9d4deeaa027aa9b2be688581387058",
                "sha256": "9a416ac81cb027d95c2351862c569053bef849f480b8ffb07fe78338523d4a5e"
            },
            "downloads": -1,
            "filename": "neuraloperator-1.0.2-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "2f9d4deeaa027aa9b2be688581387058",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": ">=3.9",
            "size": 186926,
            "upload_time": "2024-12-30T21:00:50",
            "upload_time_iso_8601": "2024-12-30T21:00:50.793196Z",
            "url": "https://files.pythonhosted.org/packages/f4/80/89e861a294878927376dee6ab4dacb2ad63461cde557721234fcb1d0c683/neuraloperator-1.0.2-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "492c7909d8e713deba174f754164f0874e4a4f15cf7a550738b2e501415ea32b",
                "md5": "fb9ac238bb1a54752461dac23fa7976d",
                "sha256": "9c52ebb00575dd726bae0e7c2fa712a5e2485e30cd134a01eefb887902fdda80"
            },
            "downloads": -1,
            "filename": "neuraloperator-1.0.2.tar.gz",
            "has_sig": false,
            "md5_digest": "fb9ac238bb1a54752461dac23fa7976d",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.9",
            "size": 143481,
            "upload_time": "2024-12-30T21:00:53",
            "upload_time_iso_8601": "2024-12-30T21:00:53.953014Z",
            "url": "https://files.pythonhosted.org/packages/49/2c/7909d8e713deba174f754164f0874e4a4f15cf7a550738b2e501415ea32b/neuraloperator-1.0.2.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2024-12-30 21:00:53",
    "github": false,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "lcname": "neuraloperator"
}
        
Elapsed time: 1.06598s