> For the complete documentation index, see [llms.txt](https://nx.docs.scailable.net/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://nx.docs.scailable.net/nx-ai-manager-v4.x/for-data-scientists/importing-models/from-pytorch.md). Agents can also search and read this documentation through its [MCP server](https://nx.docs.scailable.net/~gitbook/mcp).

# From PyTorch

## About PyTorch

![](https://1802643978-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FMCzrCuuH2Gkf3NayKWJr%2Fuploads%2Fgit-blob-e5936a28af8bca0e9b27b0fdb92f7a3e09279974%2FUnknown-1.png?alt=media)

[PyTorch](https://pytorch.org) is a [machine learning](https://en.wikipedia.org/wiki/Machine_learning) [framework](https://en.wikipedia.org/wiki/Software_framework) based on the [Torch](https://en.wikipedia.org/wiki/Torch_\(machine_learning\)) library, used for applications such as [computer vision](https://en.wikipedia.org/wiki/Computer_vision) and [natural language processing](https://en.wikipedia.org/wiki/Natural_language_processing), originally developed by [Meta AI ](https://en.wikipedia.org/wiki/Meta_AI)and now part of the [Linux Foundation](https://en.wikipedia.org/wiki/Linux_Foundation) umbrella. It is [free and open-source software](https://en.wikipedia.org/wiki/Free_and_open-source_software) released under the [modified BSD license](https://en.wikipedia.org/wiki/Modified_BSD_license). Although the [Python](https://en.wikipedia.org/wiki/Python_\(programming_language\)) interface is more polished and the primary focus of development, PyTorch also has a [C++](https://en.wikipedia.org/wiki/C%2B%2B) interface.

## Model deployment from PyTorch

Model deployment from PyTorch is simple to achieve by exporting your PyTorch model to ONNX and subsequently using (if neccesary) the `sclblonnx` package to [clean and check the resulting graph](https://nx.docs.scailable.net/nx-ai-manager-v4.x/for-data-scientists/onnx-requirements.md#automatic-checking-using-the-sclblonnx-check-function) for an upload to the Nx AI cloud.

* You can find details on PyTorch to ONNX exports [here](https://pytorch.org/tutorials/advanced/super_resolution_with_onnxruntime.html). You can find an insightful tutorial [here](https://deci.ai/blog/how-to-convert-a-pytorch-model-to-onnx/).
* You can find an example using PyTorch and sclblonnx [here](https://github.com/scailable/sclblonnx/blob/master/examples/example_03.py).

After obtaining a [clean ONNX graph that adheres to our requirements](https://nx.docs.scailable.net/nx-ai-manager-v4.x/for-data-scientists/onnx-requirements.md), you can [upload it to the Nx AI cloud](https://nx.docs.scailable.net/nx-ai-manager-v4.x/nx-ai-cloud/upload-your-model.md) for deployment.
