cfdonnx


Namecfdonnx JSON
Version 2.0.1 PyPI version JSON
download
home_pagehttps://github.com/simzero/cfdonnx
SummaryConverting ML-CFD models to ONNX
upload_time2023-07-04 21:16:46
maintainer
docs_urlNone
authorCarlos Pena Monferrer
requires_python
licenseMIT
keywords cfd ml onnx
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            # cfdonnx

A Python module for exporting pre-trained CFD models to ONNX, making them interoperable with other ML frameworks and compatible with browsers.

It currently supports U-Net architecture and PyTorch models, but it will be soon extended to other frameworks and architectures.

Reproducible examples can be found at [openfoam-cfd-rom](https://github.com/simzero/openfoam-ml-rom) usign [DeepCFD](https://github.com/mdribeiro/DeepCFD).

## Installation

The module can be installed with:

```
pip3 install cfdonnx
```

## Usage

```
Usage:  python3 -m cfdonnx [OPTIONS]

Options:
    -n, --net           TEXT  network architecture: UNetEx or AutoEncoder (default: UNetEx)
    -i, --input         PATH  checkpoint (default: checkpoint.pt)
    -o, --output        PATH  ONNX output file (default: checkpoint.onnx)
    -k, --kernel-size   INT   kernel size (optional, read from state_dict['kernel_size] by default )
    -f, --filters       TEXT  filter size, e.g. 8,16,32,32 (optional, read from state_dict['filters'] by default)
    -c  --channels      INT   number of channels (optional, read from state_dict['input_shape'] by default)
    -x  --nx            INT   X dimension (optional, read from state_dict['input_shape'] by default)
    -y  --ny            INT   Y dimension (optional, read from state_dict['input_shape'] by default )
    -o, --output        PATH  Save model path (default: mymodel.pt)

Example:

python3 -m cfdonnx \
        --net UNetEx \
        --input flowAroundObstacles.pt \
        --output flowAroundObstacles.onnx
```

You can use your CFD ONNX models on runtime in Babylon.js as showcased at https://play.simzero.com/#D3SFTH#6 for the [flowAroundObstacles](https://github.com/simzero/openfoam-ml-rom/tree/main/OpenFOAM/incompressible/simpleFoam/flowAroundObstacles) example.

A generic template for using ONNX is also available at https://play.simzero.com/#WIB297#1.



            

Raw data

            {
    "_id": null,
    "home_page": "https://github.com/simzero/cfdonnx",
    "name": "cfdonnx",
    "maintainer": "",
    "docs_url": null,
    "requires_python": "",
    "maintainer_email": "",
    "keywords": "cfd ml onnx",
    "author": "Carlos Pena Monferrer",
    "author_email": "",
    "download_url": "https://files.pythonhosted.org/packages/db/63/da3c5c60e697c1b732f9e8dd7d2da52a8eb40f38de29c3b3d65afdb86f00/cfdonnx-2.0.1.tar.gz",
    "platform": null,
    "description": "# cfdonnx\n\nA Python module for exporting pre-trained CFD models to ONNX, making them interoperable with other ML frameworks and compatible with browsers.\n\nIt currently supports U-Net architecture and PyTorch models, but it will be soon extended to other frameworks and architectures.\n\nReproducible examples can be found at [openfoam-cfd-rom](https://github.com/simzero/openfoam-ml-rom) usign [DeepCFD](https://github.com/mdribeiro/DeepCFD).\n\n## Installation\n\nThe module can be installed with:\n\n```\npip3 install cfdonnx\n```\n\n## Usage\n\n```\nUsage:  python3 -m cfdonnx [OPTIONS]\n\nOptions:\n    -n, --net           TEXT  network architecture: UNetEx or AutoEncoder (default: UNetEx)\n    -i, --input         PATH  checkpoint (default: checkpoint.pt)\n    -o, --output        PATH  ONNX output file (default: checkpoint.onnx)\n    -k, --kernel-size   INT   kernel size (optional, read from state_dict['kernel_size] by default )\n    -f, --filters       TEXT  filter size, e.g. 8,16,32,32 (optional, read from state_dict['filters'] by default)\n    -c  --channels      INT   number of channels (optional, read from state_dict['input_shape'] by default)\n    -x  --nx            INT   X dimension (optional, read from state_dict['input_shape'] by default)\n    -y  --ny            INT   Y dimension (optional, read from state_dict['input_shape'] by default )\n    -o, --output        PATH  Save model path (default: mymodel.pt)\n\nExample:\n\npython3 -m cfdonnx \\\n        --net UNetEx \\\n        --input flowAroundObstacles.pt \\\n        --output flowAroundObstacles.onnx\n```\n\nYou can use your CFD ONNX models on runtime in Babylon.js as showcased at https://play.simzero.com/#D3SFTH#6 for the [flowAroundObstacles](https://github.com/simzero/openfoam-ml-rom/tree/main/OpenFOAM/incompressible/simpleFoam/flowAroundObstacles) example.\n\nA generic template for using ONNX is also available at https://play.simzero.com/#WIB297#1.\n\n\n",
    "bugtrack_url": null,
    "license": "MIT",
    "summary": "Converting ML-CFD models to ONNX",
    "version": "2.0.1",
    "project_urls": {
        "Homepage": "https://github.com/simzero/cfdonnx"
    },
    "split_keywords": [
        "cfd",
        "ml",
        "onnx"
    ],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "4ff3b2afcd5d89e6cb453c8fed9599bcde387ebcc9e32315b847aabc62f61c5f",
                "md5": "3e229a44dc363eedcc7ca81b5af22ff9",
                "sha256": "784690635f6fedb4f4a5bcf98b170f434a60ad5ffe7da4428dba94745fa32c73"
            },
            "downloads": -1,
            "filename": "cfdonnx-2.0.1-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "3e229a44dc363eedcc7ca81b5af22ff9",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": null,
            "size": 9668,
            "upload_time": "2023-07-04T21:16:44",
            "upload_time_iso_8601": "2023-07-04T21:16:44.953653Z",
            "url": "https://files.pythonhosted.org/packages/4f/f3/b2afcd5d89e6cb453c8fed9599bcde387ebcc9e32315b847aabc62f61c5f/cfdonnx-2.0.1-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "db63da3c5c60e697c1b732f9e8dd7d2da52a8eb40f38de29c3b3d65afdb86f00",
                "md5": "c46e66b8f34246c8da605f552d69c354",
                "sha256": "c27302268541e9c1ffd703dd4b4e1b21ed93e3e453225be6843c48063d325216"
            },
            "downloads": -1,
            "filename": "cfdonnx-2.0.1.tar.gz",
            "has_sig": false,
            "md5_digest": "c46e66b8f34246c8da605f552d69c354",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": null,
            "size": 8355,
            "upload_time": "2023-07-04T21:16:46",
            "upload_time_iso_8601": "2023-07-04T21:16:46.519581Z",
            "url": "https://files.pythonhosted.org/packages/db/63/da3c5c60e697c1b732f9e8dd7d2da52a8eb40f38de29c3b3d65afdb86f00/cfdonnx-2.0.1.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2023-07-04 21:16:46",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "simzero",
    "github_project": "cfdonnx",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": false,
    "requirements": [],
    "lcname": "cfdonnx"
}
        
Elapsed time: 0.09045s