Skip to main content

Website
Website
Docs
Docs
Demos
Demos
Design
Design
FAQ
FAQ


Convert Machine Learning Code Between Frameworks

Ivy enables you to:

  • Convert ML models, tools and libraries between frameworks while maintaining complete functionality using ivy.transpile
  • Create optimized graph-based models and functions in any native framework (PyTorch, TensorFlow, etc..) with ivy.trace_graph

Installing ivy

The easiest way to set up Ivy is to install it using pip:

pip install ivy
Docker Image

You can pull the Docker image for Ivy from:

docker pull ivyllc/ivy:latest
From Source

You can also install Ivy from source if you want to take advantage of the latest changes, but we can't ensure everything will work as expected 😅

git clone https://github.com/ivy-llc/ivy.git
cd ivy
pip install --user -e .

If you want to set up testing and various frameworks it's probably best to check out the Setting Up page, where OS-specific and IDE-specific instructions and video tutorials to do so are available!


Supported Frameworks

These are the frameworks that ivy.transpile currently supports conversions from and to. We're working hard on adding support for more frameworks, let us know on Discord if there are source/target frameworks that would be useful for you!

Framework Source Target
PyTorch 🚧
TensorFlow 🚧
JAX 🚧
NumPy 🚧

Getting started

Ivy's transpiler allows you convert code between different ML frameworks. Have a look at our Quickstart notebook to get a brief idea of the features!

Beyond that, based on the frameworks you want to convert code between, there are a few more examples further down this page 👇 which contain a number of models and libraries transpiled between PyTorch, JAX, TensorFlow and NumPy.


Using ivy

Here's some examples, to help you get started using Ivy! The examples page also features a wide range of demos and tutorials showcasing some more use cases for Ivy.

Transpiling any code from one framework to another
import ivy
import torch
import tensorflow as tf

def torch_fn(x):
    a = torch.mul(x, x)
    b = torch.mean(x)
    return x * a + b

tf_fn = ivy.transpile(torch_fn, source="torch", target="tensorflow")

tf_x = tf.convert_to_tensor([1., 2., 3.])
ret = tf_fn(tf_x)
Tracing a computational graph of any code
import ivy
import torch

def torch_fn(x):
    a = torch.mul(x, x)
    b = torch.mean(x)
    return x * a + b

torch_x = torch.tensor([1., 2., 3.])
graph = ivy.trace_graph(jax_fn, to="torch", args=(torch_x,))
ret = graph(torch_x)

How ivy works?

Let's take a look at how Ivy works as a transpiler in more detail to get an idea of why and where to use it.

When is Ivy's transpiler useful?

If you want to use building blocks published in other frameworks (neural networks, layers, array computing libraries, training pipelines...), you want to integrate code developed in various frameworks, or maybe straight up migrate code from one framework to another or even between versions of the same framework, the transpiler is definitely the tool for the job! You can use the converted code just as if it was code originally developed in that framework, applying framework-specific optimizations or tools, instantly exposing your project to all of the unique perks of a different framework.


Ivy's transpiler allows you to use code from any other framework (or from any other version of the same framework!) in your own code, by just adding one line of code.

This way, Ivy makes all ML-related projects available for you, independently of the framework you want to use to research, develop, or deploy systems. Feel free to head over to the docs for the full API reference, but the functions you'd most likely want to use are:

# Converts framework-specific code to a target framework of choice. See usage in the documentation
ivy.transpile()

# Traces an efficient fully-functional graph from a function, removing all wrapping and redundant code. See usage in the documentation
ivy.trace_graph()

ivy.transpile will eagerly transpile if a class or function is provided

import ivy
import torch
import tensorflow as tf

def torch_fn(x):
    x = torch.abs(x)
    return torch.sum(x)

x1 = torch.tensor([1., 2.])
x1 = tf.convert_to_tensor([1., 2.])

# Transpilation happens eagerly
tf_fn = ivy.transpile(test_fn, source="torch", target="tensorflow")

# tf_fn is now tensorflow code and runs efficiently
ret = tf_fn(x1)

ivy.transpile will lazily transpile if a module (library) is provided

import kornia

x2 = torch.rand(5, 3, 4, 4)

# Module is provided -> transpilation happens lazily
tf_kornia = ivy.transpile(kornia, source="torch", target="tensorflow")

# The transpilation is initialized here, and this function is converted to tensorflwo
ret = tf_kornia.color.rgb_to_grayscale(x2)

# Transpilation has already occurred, the tensorflow function runs efficiently
ret = tf_kornia.color.rgb_to_grayscale(x2)

ivy.trace_graph can be used eagerly or lazily

If you pass the necessary arguments for function tracing, the graph tracing step will happen instantly (eagerly). Otherwise, the graph tracing will happen only when the returned function is first invoked.

import ivy
import jax
ivy.set_backend("jax")

# Simple JAX function to transpile
def test_fn(x):
    return jax.numpy.sum(x)

x1 = ivy.array([1., 2.])
# Arguments are available -> tracing happens eagerly
eager_graph = ivy.trace_graph(test_fn, to="jax", args=(x1,))

# eager_graph now runs efficiently
ret = eager_graph(x1)
# Arguments are not available -> tracing happens lazily
lazy_graph = ivy.trace_graph(test_fn, to="jax")

# The traced graph is initialized, tracing will happen here
ret = lazy_graph(x1)

# Tracing has already happend, traced graph runs efficiently
ret = lazy_graph(x1)

If you want to learn more, you can find more information in the Ivy as a transpiler section of the docs!


Documentation

You can find Ivy's documentation on the Docs page, which includes:

  • Motivation: This contextualizes the problem Ivy is trying to solve by going over
  • Related Work: Which paints a picture of the role Ivy plays in the ML stack, comparing it to other existing solutions in terms of functionalities and abstraction level.
  • Design: A user-focused guide about the design decision behind the architecture and the main building blocks of Ivy.
  • Deep Dive: Which delves deeper into the implementation details of Ivy and is oriented towards potential contributors to the code base.

Contributing

We believe that everyone can contribute and make a difference. Whether it's writing code, fixing bugs, or simply sharing feedback, your contributions are definitely welcome and appreciated 🙌

Check out all of our Open Tasks, and find out more info in our Contributing guide in the docs! Or to immediately dive into a useful task, look for any failing tests on our Test Dashboard!


Community



Join our growing community on a mission to make conversions between frameworks simple and accessible to all! Whether you are a seasoned developer or just starting out, you'll find a place here! Join the Ivy community on our Discord 👾 server, which is the perfect place to ask questions, share ideas, and get help from both fellow developers and the Ivy Team directly.

See you there!


Citation

If you use Ivy for your work, please don't forget to give proper credit by including the accompanying paper 📄 in your references. It's a small way to show appreciation and help to continue to support this and other open source projects 🙌

@article{lenton2021ivy,
  title={Ivy: Templated deep learning for inter-framework portability},
  author={Lenton, Daniel and Pardo, Fabio and Falck, Fabian and James, Stephen and Clark, Ronald},
  journal={arXiv preprint arXiv:2102.02886},
  year={2021}
}

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

ivy-0.0.9.9.tar.gz (15.8 MB view details)

Uploaded Source

Built Distributions

If you're not sure about the file name format, learn more about wheel file names.

ivy-0.0.9.9-cp312-cp312-win_amd64.whl (11.0 MB view details)

Uploaded CPython 3.12Windows x86-64

ivy-0.0.9.9-cp312-cp312-manylinux_2_17_x86_64.whl (11.0 MB view details)

Uploaded CPython 3.12manylinux: glibc 2.17+ x86-64

ivy-0.0.9.9-cp312-cp312-macosx_12_0_arm64.whl (16.3 MB view details)

Uploaded CPython 3.12macOS 12.0+ ARM64

ivy-0.0.9.9-cp311-cp311-win_amd64.whl (9.9 MB view details)

Uploaded CPython 3.11Windows x86-64

ivy-0.0.9.9-cp311-cp311-manylinux_2_17_x86_64.whl (9.9 MB view details)

Uploaded CPython 3.11manylinux: glibc 2.17+ x86-64

ivy-0.0.9.9-cp311-cp311-macosx_12_0_arm64.whl (16.4 MB view details)

Uploaded CPython 3.11macOS 12.0+ ARM64

ivy-0.0.9.9-cp310-cp310-win_amd64.whl (9.8 MB view details)

Uploaded CPython 3.10Windows x86-64

ivy-0.0.9.9-cp310-cp310-manylinux_2_17_x86_64.whl (9.8 MB view details)

Uploaded CPython 3.10manylinux: glibc 2.17+ x86-64

ivy-0.0.9.9-cp310-cp310-macosx_12_0_arm64.whl (16.3 MB view details)

Uploaded CPython 3.10macOS 12.0+ ARM64

ivy-0.0.9.9-cp39-cp39-win_amd64.whl (9.9 MB view details)

Uploaded CPython 3.9Windows x86-64

ivy-0.0.9.9-cp39-cp39-manylinux_2_17_x86_64.whl (9.9 MB view details)

Uploaded CPython 3.9manylinux: glibc 2.17+ x86-64

ivy-0.0.9.9-cp38-cp38-win_amd64.whl (9.8 MB view details)

Uploaded CPython 3.8Windows x86-64

ivy-0.0.9.9-cp38-cp38-manylinux_2_17_x86_64.whl (9.8 MB view details)

Uploaded CPython 3.8manylinux: glibc 2.17+ x86-64

File details

Details for the file ivy-0.0.9.9.tar.gz.

File metadata

  • Download URL: ivy-0.0.9.9.tar.gz
  • Upload date:
  • Size: 15.8 MB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.1.1 CPython/3.10.12

File hashes

Hashes for ivy-0.0.9.9.tar.gz
Algorithm Hash digest
SHA256 97910469ff786682b5836b4e1087fa503a94836c898b100afaad74c897125ca8
MD5 14fc28a052bc1ae4df2aeaf79df29047
BLAKE2b-256 97a11c3bf5bc6e8a3bba21dedb74bfbab8a5a980d83c715904e1ce86be163685

See more details on using hashes here.

File details

Details for the file ivy-0.0.9.9-cp312-cp312-win_amd64.whl.

File metadata

  • Download URL: ivy-0.0.9.9-cp312-cp312-win_amd64.whl
  • Upload date:
  • Size: 11.0 MB
  • Tags: CPython 3.12, Windows x86-64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.1.1 CPython/3.10.12

File hashes

Hashes for ivy-0.0.9.9-cp312-cp312-win_amd64.whl
Algorithm Hash digest
SHA256 f50ffc2ecfc1b6ddc726460d885c49b6e4c73f67a6e3486a0ee1f8b0ce148a61
MD5 9687ac23ad9ef084dd857a1403452567
BLAKE2b-256 c31361a7b776eba453426dbc3d375c291a92b9fba59746d366f3eae9bc214474

See more details on using hashes here.

File details

Details for the file ivy-0.0.9.9-cp312-cp312-manylinux_2_17_x86_64.whl.

File metadata

File hashes

Hashes for ivy-0.0.9.9-cp312-cp312-manylinux_2_17_x86_64.whl
Algorithm Hash digest
SHA256 10f10e555a22a98b44e76d5a63e33b9ea7f41b9603c7d42f35ee25977d47c209
MD5 83dcfc715c2de2bb4051a248621d210b
BLAKE2b-256 2befefc7047fbfc7ff8b6830b906ce10da3a90e2efb7f8dd65411950dc4d691c

See more details on using hashes here.

File details

Details for the file ivy-0.0.9.9-cp312-cp312-macosx_12_0_arm64.whl.

File metadata

File hashes

Hashes for ivy-0.0.9.9-cp312-cp312-macosx_12_0_arm64.whl
Algorithm Hash digest
SHA256 9e94c1b927dcb974500e5ed7503ddee89a34f2f3bfba1d9eb2cca3fbacb87222
MD5 f94b6056df93ec04a15132ab4139de7c
BLAKE2b-256 ce02eb1afbb0466c549790efeca075a0088ff9c133a57c3dc0a25625e430b31e

See more details on using hashes here.

File details

Details for the file ivy-0.0.9.9-cp311-cp311-win_amd64.whl.

File metadata

  • Download URL: ivy-0.0.9.9-cp311-cp311-win_amd64.whl
  • Upload date:
  • Size: 9.9 MB
  • Tags: CPython 3.11, Windows x86-64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.1.1 CPython/3.10.12

File hashes

Hashes for ivy-0.0.9.9-cp311-cp311-win_amd64.whl
Algorithm Hash digest
SHA256 683bfebf105a9145abc41722b07eeb89858c6416a3127dabd67f1983d30057d7
MD5 93ddf01a2e744b1366399a7f5cc9d169
BLAKE2b-256 68ca9da64765f30ad62f02ea63fdabaa87c11b73bfecc051794f6c40aba316e9

See more details on using hashes here.

File details

Details for the file ivy-0.0.9.9-cp311-cp311-manylinux_2_17_x86_64.whl.

File metadata

File hashes

Hashes for ivy-0.0.9.9-cp311-cp311-manylinux_2_17_x86_64.whl
Algorithm Hash digest
SHA256 3c9dbe59ab1654acadaa60ecae7b95b8bd0e02540705292a607cff423350ce72
MD5 03b5b8aca94afc19921760daece3e03a
BLAKE2b-256 905632733a15e5b065ad244de60bdedd0d7c80df05a718495dfbeffc0b99c06f

See more details on using hashes here.

File details

Details for the file ivy-0.0.9.9-cp311-cp311-macosx_12_0_arm64.whl.

File metadata

File hashes

Hashes for ivy-0.0.9.9-cp311-cp311-macosx_12_0_arm64.whl
Algorithm Hash digest
SHA256 eb61910c4ac72b88a940c88cf8672cf9d1824de09d5a4608971158243c747183
MD5 39974e8a6a3b35742ab886dc7599c139
BLAKE2b-256 db9ad8db2102b7e0893465d4a49b40a34669d5966bacb86df59016fcbad68fc2

See more details on using hashes here.

File details

Details for the file ivy-0.0.9.9-cp310-cp310-win_amd64.whl.

File metadata

  • Download URL: ivy-0.0.9.9-cp310-cp310-win_amd64.whl
  • Upload date:
  • Size: 9.8 MB
  • Tags: CPython 3.10, Windows x86-64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.1.1 CPython/3.10.12

File hashes

Hashes for ivy-0.0.9.9-cp310-cp310-win_amd64.whl
Algorithm Hash digest
SHA256 9432c169d8d83206b6112aed6e5dcfccb6ed0060693c90ebfc00aac41b1b4283
MD5 d11c5bfea3b4b05f479a708e12e26f4f
BLAKE2b-256 4404bdbcc355e046ac2f00b543507a725bd01a496438beb43fdaa431cd0c3567

See more details on using hashes here.

File details

Details for the file ivy-0.0.9.9-cp310-cp310-manylinux_2_17_x86_64.whl.

File metadata

File hashes

Hashes for ivy-0.0.9.9-cp310-cp310-manylinux_2_17_x86_64.whl
Algorithm Hash digest
SHA256 bcc6a0ca18d497afd2a139ac35683d087e15e154f8f6e1a7a96fe68e8543598a
MD5 82dd305d03aabf3b4f5fac6ce0bdc011
BLAKE2b-256 493ed182463e57e51c92eff5b5b9699da7fef289b931f1bffd380d58780f4711

See more details on using hashes here.

File details

Details for the file ivy-0.0.9.9-cp310-cp310-macosx_12_0_arm64.whl.

File metadata

File hashes

Hashes for ivy-0.0.9.9-cp310-cp310-macosx_12_0_arm64.whl
Algorithm Hash digest
SHA256 fac663538934580b2177e8632c705f991e9cd6bd73fc6ce9aa9e278cd4020cb5
MD5 6ec81273206e0a4097bcab6ea5733459
BLAKE2b-256 cad6c1817a36e6042fe6f3e660ba86cae6bd30ed6de1b2548b064c2ae97f5f08

See more details on using hashes here.

File details

Details for the file ivy-0.0.9.9-cp39-cp39-win_amd64.whl.

File metadata

  • Download URL: ivy-0.0.9.9-cp39-cp39-win_amd64.whl
  • Upload date:
  • Size: 9.9 MB
  • Tags: CPython 3.9, Windows x86-64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.1.1 CPython/3.10.12

File hashes

Hashes for ivy-0.0.9.9-cp39-cp39-win_amd64.whl
Algorithm Hash digest
SHA256 b175bac3ae246ab58cd878c16d39fdf024e0da6b5d01fd6a0383ce6f18b3b99c
MD5 0c3a206f75c692ce342c029b26bd9444
BLAKE2b-256 ea6cedc42b2d3e8a492a834cb785d253ca8aa1759876d976367c6592e274abc6

See more details on using hashes here.

File details

Details for the file ivy-0.0.9.9-cp39-cp39-manylinux_2_17_x86_64.whl.

File metadata

File hashes

Hashes for ivy-0.0.9.9-cp39-cp39-manylinux_2_17_x86_64.whl
Algorithm Hash digest
SHA256 14e5041bb0bf6cd5bd27a61a99ea9d70959093cda04afc6f2f2aa41454ba0022
MD5 603ba5d297860c5d38c3a65ff3fa56ac
BLAKE2b-256 5b218db51d4a75f856738d49454f964b9a08bc439278c8afa077e8a22cf224ba

See more details on using hashes here.

File details

Details for the file ivy-0.0.9.9-cp38-cp38-win_amd64.whl.

File metadata

  • Download URL: ivy-0.0.9.9-cp38-cp38-win_amd64.whl
  • Upload date:
  • Size: 9.8 MB
  • Tags: CPython 3.8, Windows x86-64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.1.1 CPython/3.10.12

File hashes

Hashes for ivy-0.0.9.9-cp38-cp38-win_amd64.whl
Algorithm Hash digest
SHA256 e3f6499d8972e04e0690a661ffebd55465234657eeee5825ef42032f02d7305d
MD5 29cc8f5f4f5ae5d96b2b8988055464db
BLAKE2b-256 9d7f4835e98981a45879c40a1e2c627982c989c40b1d894bbb3f2e4195e1e727

See more details on using hashes here.

File details

Details for the file ivy-0.0.9.9-cp38-cp38-manylinux_2_17_x86_64.whl.

File metadata

File hashes

Hashes for ivy-0.0.9.9-cp38-cp38-manylinux_2_17_x86_64.whl
Algorithm Hash digest
SHA256 1490ab87a3aa0160c2c996706c814f21089ad85bcef1634014af37ecce660658
MD5 57b06f7b01a3f73a4a3a6c31a4883eef
BLAKE2b-256 0dee3bc4bef89b87fca3f6f021818129627ab6ff1b42dc6406b318b8906c6b16

See more details on using hashes here.

Release history Release notifications | RSS feed

1.0.0.5

2 files

1.0.0.4

2 files

1.0.0.3

2 files

1.0.0.2

2 files

1.0.0.1

17 files

1.0.0.0

17 files

0.0.9.17

17 files

0.0.9.16

17 files

0.0.9.15

17 files

0.0.9.14

17 files

0.0.9.13

14 files

0.0.9.12

14 files

0.0.9.10

14 files

This release

0.0.9.9 This release

14 files

0.0.9.8

14 files

0.0.9.7

11 files

0.0.9.6

11 files

0.0.9.5

11 files

0.0.9.4

11 files

0.0.9.3

11 files

0.0.9.2

11 files

0.0.9.1

11 files

0.0.9.0

11 files

0.0.8.0

11 files

0.0.7.5

11 files

0.0.7.4

11 files

0.0.7.3

11 files

0.0.7.2

11 files

0.0.7.1

11 files

0.0.7.0

11 files

0.0.6.2

7 files

0.0.6.1

7 files

0.0.6.0

7 files

0.0.5.1

7 files

0.0.5.0

7 files

0.0.4.0

2 files

0.0.3.0

2 files

0.0.2.0

2 files

0.0.1.0

2 files

0.0.0

4 files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page