explaingit

unifyai/ivy

14,192PythonAudience · researcherComplexity · 3/5Setup · easy

TLDR

Ivy converts machine learning code between PyTorch, TensorFlow, JAX, and NumPy so you can run models in a different framework without rewriting them by hand.

Mindmap

mindmap
  root((ivy))
    What it does
      Framework conversion
      Code transpilation
      Graph tracing
    Supported frameworks
      PyTorch as source
      TensorFlow target
      JAX and NumPy targets
    Key functions
      ivy.transpile
      ivy.trace_graph
    Use cases
      Port ML models
      Cross-framework research
      Remove framework overhead
    Audience
      ML researchers
      Data scientists
Click or tap to explore — scroll the page freely

Code map

Detail Auto

An interactive map of this repo's files and how they connect — its source is parsed live in your browser. Click Visualize to build it.

filefunction / class

Things people build with this

USE CASE 1

Convert a PyTorch model to TensorFlow so it can be deployed on a TensorFlow Serving stack without rewriting it

USE CASE 2

Translate a research codebase from JAX to PyTorch to run experiments in your preferred framework

USE CASE 3

Use ivy.trace_graph to strip framework overhead and produce a leaner computation graph from existing model code

USE CASE 4

Port a machine learning library written for one framework so it works with another framework's data pipelines

Tech stack

PythonPyTorchTensorFlowJAXNumPy

Getting it running

Difficulty · easy Time to first run · 30min

Install with pip install ivy, transpiling complex libraries may require additional dependencies for the target framework to be installed separately.

In plain English

Ivy is a Python tool for converting machine learning code from one framework to another. In machine learning, a framework is a software toolkit that people use to build and run models. PyTorch, TensorFlow, JAX, and NumPy are four popular ones, and code written for one of them does not normally run on the others. Ivy aims to bridge that gap. The central feature is a function called ivy.transpile. You give it code written for a source framework and tell it which target framework you want, and it produces equivalent code for that target. The README shows a small example: a function written with PyTorch is passed to ivy.transpile with source set to torch and target set to tensorflow, and the result is a TensorFlow version of the same function that you can then run on TensorFlow data. The README notes that PyTorch is currently supported as a source, while TensorFlow, JAX, and NumPy are supported as targets. There is a second function, ivy.trace_graph, which records the underlying steps a piece of code performs and builds a streamlined version with the extra wrapping removed. According to the docs, transpile can work in two ways: it converts a single function or class right away, and for a whole library it converts pieces only when they are actually used. Installing Ivy is done with a normal pip install ivy command, or from source by cloning the repository. The README also includes examples, a pointer to fuller documentation and demos, a contributing guide for people who want to help, and a citation for the academic paper behind the project. The practical point of Ivy is portability: if you have model code tied to one framework and need it in another, this tool tries to do that translation for you instead of rewriting everything by hand.

Copy-paste prompts

Prompt 1
I have a PyTorch model class. Show me how to use ivy.transpile to convert it to a TensorFlow version I can run with tf.function.
Prompt 2
Walk me through using ivy.trace_graph on a PyTorch function and explain what the resulting traced graph looks like compared to the original.
Prompt 3
I want to run a JAX-based machine learning library on PyTorch tensors. How do I use Ivy to transpile the library functions?
Prompt 4
Install Ivy from pip and write a short test that takes a simple PyTorch tensor operation and confirms the TensorFlow transpiled version produces the same numerical output.
Open on GitHub → Explain another repo

← unifyai on gitmyhub — every repo by this author, as a profile.

Verify against the repo before relying on details.