ivy

Convert Machine Learning Code Between Frameworks

https://github.com/ivy-llc/ivy

Science Score: 54.0%

This score indicates how likely this project is to be science-related based on various indicators:

  • CITATION.cff file
    Found CITATION.cff file
  • codemeta.json file
    Found codemeta.json file
  • .zenodo.json file
    Found .zenodo.json file
  • DOI references
  • Academic publication links
  • Committers with academic emails
    33 of 1438 committers (2.3%) from academic institutions
  • Institutional organization owner
  • JOSS paper metadata
  • Scientific vocabulary similarity
    Low similarity (7.7%) to scientific vocabulary

Keywords

jax numpy python pytorch tensorflow

Keywords from Contributors

transformer cryptocurrency cryptography agents reinforcement-learning yolov5s mlops langchain tensors distributed
Last synced: 6 months ago · JSON representation ·

Repository

Convert Machine Learning Code Between Frameworks

Basic Info
Statistics
  • Stars: 14,234
  • Watchers: 68
  • Forks: 5,608
  • Open Issues: 981
  • Releases: 0
Topics
jax numpy python pytorch tensorflow
Created about 5 years ago · Last pushed 7 months ago
Metadata Files
Readme Contributing License Citation Codeowners

README.md



Convert Machine Learning Code Between Frameworks

Ivy enables you to convert ML models, tools and libraries between frameworks using ivy.transpile


Installation

The easiest way to install Ivy is using pip:

bash pip install ivy

From Source
You can also install Ivy from source if you want to take advantage of the latest changes: ``` bash git clone https://github.com/ivy-llc/ivy.git cd ivy pip install --user -e . ```


Supported Frameworks

These are the frameworks that ivy.transpile currently supports conversions from and to.

| Framework | Source | Target | |------------|:------:|:------:| | PyTorch | ✅ | 🚧 | | TensorFlow | 🚧 | ✅ | | JAX | 🚧 | ✅ | | 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

``` python 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

tffn = ivy.transpile(torchfn, source="torch", target="tensorflow")

tfx = tf.converttotensor([1., 2., 3.]) ret = tffn(tf_x) ```

Tracing a computational graph of any code

``` python import ivy import torch

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

torchx = torch.tensor([1., 2., 3.]) graph = ivy.tracegraph(jaxfn, to="torch", args=(torchx,)) ret = graph(torch_x) ```

How does ivy work?
Ivy\'s transpiler allows you to use code from any other framework in your own code. Feel free to head over to the docs for the full API reference, but the functions you\'d most likely want to use are: ``` python # 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 ``` python 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 ``` python import ivy import kornia import tensorflow as tf x2 = tf.random.normal((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 tensorflow 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) ```


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.




Citation

@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}
}

Owner

  • Name: ivy
  • Login: ivy-llc
  • Kind: organization

Citation (CITATION.cff)

cff-version: 1.2.0
title: >-
  Ivy: Templated deep learning for inter-framework
  portability
message: >-
  If you are using Ivy, we would really appreciate it if you
  cite it in your work!
authors:
  - given-names: Daniel
    family-names: Lenton
  - given-names: Fabio
    family-names: Pardo
  - given-names: Fabian
    family-names: Falck
  - given-names: Stephen
    family-names: James
  - given-names: Ronald
    family-names: Clark
identifiers:
  - type: doi
    value: 10.48550/arXiv.2102.02886
    description: 'arXiv preprint '
repository-code: 'https://github.com/ivy-llc/ivy'
url: 'https://unify.ai/'
repository: 'https://github.com/unifyai/'
abstract: 'We introduce Ivy, a templated Deep Learning (DL) framework which abstracts existing DL frameworks. Ivy unifies the core functions of these frameworks to exhibit consistent call signatures, syntax and input-output behaviour. New high-level framework-agnostic functions and classes, which are usable alongside framework-specific code, can then be implemented as compositions of the unified low-level Ivy functions. Ivy currently supports TensorFlow, PyTorch, MXNet, Jax and NumPy. We also release four pure-Ivy libraries for mechanics, 3D vision, robotics, and differentiable environments. Through our evaluations, we show that Ivy can significantly reduce lines of code with a runtime overhead of less than 1% in most cases. We welcome developers to join the Ivy community by writing their own functions, layers and libraries in Ivy, maximizing their audience and helping to accelerate DL research through inter-framework codebases.'
license: Apache-2.0
preferred-citation:
  type: article
  authors:
  - given-names: Daniel
    family-names: Lenton
  - given-names: Fabio
    family-names: Pardo
  - given-names: Fabian
    family-names: Falck
  - given-names: Stephen
    family-names: James
  - given-names: Ronald
    family-names: Clark
  doi: 10.48550/arXiv.2102.02886
  title: "Ivy: Templated deep learning for inter-framework portability"

GitHub Events

Total
  • Create event: 61
  • Issues event: 21
  • Release event: 14
  • Watch event: 358
  • Delete event: 49
  • Issue comment event: 40
  • Push event: 274
  • Pull request review comment event: 3
  • Pull request review event: 5
  • Pull request event: 95
  • Fork event: 40
Last Year
  • Create event: 61
  • Issues event: 21
  • Release event: 14
  • Watch event: 358
  • Delete event: 49
  • Issue comment event: 40
  • Push event: 274
  • Pull request review comment event: 3
  • Pull request review event: 5
  • Pull request event: 95
  • Fork event: 40

Committers

Last synced: 9 months ago

All Time
  • Total Commits: 17,823
  • Total Committers: 1,438
  • Avg Commits per committer: 12.394
  • Development Distribution Score (DDS): 0.879
Past Year
  • Commits: 581
  • Committers: 24
  • Avg Commits per committer: 24.208
  • Development Distribution Score (DDS): 0.554
Top Committers
Name Email Commits
djl11 d****1@i****k 2,161
Ishtiaq Hussain 5****e 1,153
Ved Patwardhan 5****n 985
Matt m****t@h****k 800
AnnaTz 1****z 703
ivy-branch i****h@l****i 572
RashulChutani r****i@g****m 544
CatB1t s****s@g****m 429
Felix Hirwa Nshuti h****x@g****m 420
Daniel4078 4****8 358
Sam-Armstrong s****g@y****k 343
sherry30 s****0@g****m 341
Aarsh2001 a****3@s****n 337
Ved Patwardhan 5****n 306
NripeshN n****4@g****m 300
JG 6****y 295
Simone G 7****n 245
Haris Mahmood 7****4 220
MahmoudAshraf97 h****a@g****m 195
hello-fri-end s****8@g****m 172
Sai-Suraj-27 s****9@g****m 167
Saeed Ashraf s****f@g****m 167
fspyridakos f****p@y****m 166
Yusha Arif y****9@g****m 159
Ahmed Omar 4****2 150
Jiahan Xie 8****3 145
Kareem Morsy k****y@h****m 145
vaatsalya123 s****a@g****m 143
Doomdie 4****1 125
Zaeem Ansari 9****0 124
and 1,408 more...

Issues and Pull Requests

Last synced: 6 months ago

All Time
  • Total issues: 113
  • Total pull requests: 149
  • Average time to close issues: 4 months
  • Average time to close pull requests: 5 days
  • Total issue authors: 34
  • Total pull request authors: 14
  • Average comments per issue: 1.33
  • Average comments per pull request: 0.33
  • Merged pull requests: 111
  • Bot issues: 0
  • Bot pull requests: 0
Past Year
  • Issues: 14
  • Pull requests: 140
  • Average time to close issues: 4 days
  • Average time to close pull requests: 4 days
  • Issue authors: 6
  • Pull request authors: 8
  • Average comments per issue: 1.5
  • Average comments per pull request: 0.16
  • Merged pull requests: 107
  • Bot issues: 0
  • Bot pull requests: 0
Top Authors
Issue Authors
  • djl11 (67)
  • YushaArif99 (4)
  • Ajay6601 (4)
  • Sam-Armstrong (4)
  • 34j (3)
  • ghost (3)
  • DhruvSondhi (2)
  • Mac16661 (2)
  • GenghuiQu (2)
  • mattbarrett98 (2)
  • trubby22 (1)
  • Lancelot03 (1)
  • VaishnaviMudaliar (1)
  • nicolasb0 (1)
  • kotonorose (1)
Pull Request Authors
  • Sam-Armstrong (157)
  • YushaArif99 (8)
  • Daniel4078 (6)
  • Sanjay8602 (4)
  • muzakkirhussain011 (3)
  • Mac16661 (3)
  • xandie985 (2)
  • Azanul (2)
  • hmahmood24 (2)
  • 7908837174 (2)
  • DoudGaya (2)
  • hi-sushanta (2)
  • Nini0la (2)
  • sgalpha01 (1)
  • tagrib (1)
Top Labels
Issue Labels
Array API (43) ToDo (42) Permanent (23) Sub Task (20) PyTorch Frontend (18) hacktoberfest (15) Transpiler (5) Bug Report (4) ToDo_internal (3) Next Release (3) Ivy API Experimental (2) Feature Request (2) NumPy Frontend (2) Ivy Functional API (2) PaddlePaddle Backend (1) Suggestion (1) TensorFlow Frontend (1) JAX Frontend (1) Tracer (1) Documentation (1)
Pull Request Labels
PyTorch Frontend (11) Ivy Functional API (11) JAX Frontend (7) Paddle Frontend (6) Stale (6) TensorFlow Frontend (5) Ivy API Experimental (5) NumPy Frontend (5) Paddle Paddle Backend (4) Sub Task (2) PaddlePaddle Backend (2) Priority (2) Array API (2) hacktoberfest (1)

Packages

  • Total packages: 1
  • Total downloads:
    • pypi 14,713 last-month
  • Total dependent packages: 7
  • Total dependent repositories: 10
  • Total versions: 138
  • Total maintainers: 1
pypi.org: ivy

Convert Machine Learning Code Between Frameworks

  • Versions: 138
  • Dependent Packages: 7
  • Dependent Repositories: 10
  • Downloads: 14,713 Last month
Rankings
Forks count: 0.1%
Stargazers count: 0.1%
Dependent packages count: 1.3%
Average: 3.3%
Dependent repos count: 4.6%
Downloads: 10.5%
Maintainers (1)
Last synced: 6 months ago

Dependencies

.github/workflows/checklist_actions.yml actions
  • actions/checkout v2 composite
  • bhowell2/github-substring-action v1.0.0 composite
  • chuhlomin/render-template v1.4 composite
  • peter-evans/create-or-update-comment v2.0.0 composite
.github/workflows/det-test-coverage.yml actions
  • actions/checkout v2 composite
  • cpina/github-action-push-to-another-repository main composite
.github/workflows/dockerfile-image.yml actions
  • actions/checkout v3 composite
.github/workflows/dockerfile-push.yml actions
  • actions/checkout v3 composite
  • docker/login-action v2 composite
.github/workflows/docs.yml actions
  • JamesIves/github-pages-deploy-action 3.7.1 composite
  • actions/checkout v2 composite
.github/workflows/github_release.yml actions
  • actions/checkout v2 composite
  • actions/create-release v1 composite
.github/workflows/intelligent-tests-pr.yml actions
  • actions/checkout v2 composite
.github/workflows/intelligent-tests.yml actions
  • Tiryoh/gha-jobid-action v0 composite
  • actions/checkout v2 composite
.github/workflows/issue_comment.yml actions
  • actions/checkout v2 composite
.github/workflows/label_discussion_comment.yml actions
  • actions/checkout v2 composite
.github/workflows/lint.yml actions
  • actions/checkout v2 composite
  • actions/setup-python v3 composite
.github/workflows/manual-tests-pr.yml actions
  • Tiryoh/gha-jobid-action v0 composite
  • actions/checkout v2 composite
.github/workflows/manual-tests.yml actions
  • Tiryoh/gha-jobid-action v0 composite
  • actions/checkout v2 composite
.github/workflows/pypi.yml actions
  • actions/checkout v2 composite
.github/workflows/test-array-api.yml actions
  • BSFishy/pip-action v1 composite
  • actions/checkout v2 composite
  • actions/upload-artifact v3 composite
  • dawidd6/action-download-artifact v2 composite
.github/workflows/test-docstrings.yml actions
  • actions/checkout v2 composite
  • actions/setup-python v3 composite
.github/workflows/test-frontend-jax.yml actions
  • actions/checkout v2 composite
  • actions/upload-artifact v3 composite
  • dawidd6/action-download-artifact v2 composite
.github/workflows/test-frontend-numpy.yml actions
  • actions/checkout v2 composite
  • actions/upload-artifact v3 composite
  • dawidd6/action-download-artifact v2 composite
.github/workflows/test-frontend-tensorflow.yml actions
  • actions/checkout v2 composite
  • actions/upload-artifact v3 composite
  • dawidd6/action-download-artifact v2 composite
.github/workflows/test-frontend-torch.yml actions
  • actions/checkout v2 composite
  • actions/upload-artifact v3 composite
  • dawidd6/action-download-artifact v2 composite
.github/workflows/test-ivy-core.yml actions
  • BSFishy/pip-action v1 composite
  • actions/checkout v2 composite
  • actions/upload-artifact v3 composite
  • dawidd6/action-download-artifact v2 composite
.github/workflows/test-ivy-cron.yml actions
  • Tiryoh/gha-jobid-action v0 composite
  • actions/checkout v2 composite
.github/workflows/test-ivy-experimental-core.yml actions
  • BSFishy/pip-action v1 composite
  • actions/checkout v2 composite
  • actions/upload-artifact v3 composite
  • dawidd6/action-download-artifact v2 composite
.github/workflows/test-ivy-experimental-nn.yml actions
  • BSFishy/pip-action v1 composite
  • actions/checkout v2 composite
  • actions/upload-artifact v3 composite
  • dawidd6/action-download-artifact v2 composite
.github/workflows/test-ivy-nn.yml actions
  • BSFishy/pip-action v1 composite
  • actions/checkout v2 composite
  • actions/upload-artifact v3 composite
  • dawidd6/action-download-artifact v2 composite
.github/workflows/test-ivy-stateful.yml actions
  • BSFishy/pip-action v1 composite
  • actions/checkout v2 composite
  • actions/upload-artifact v3 composite
  • dawidd6/action-download-artifact v2 composite
docker/Dockerfile docker
  • ubuntu 20.04 build
requirements/optional.txt pypi
  • coverage *
  • dm-haiku ==0.0.6
  • functorch ==0.1.1
  • h5py ==3.7.0
  • hypothesis ==6.55.0
  • jax ==0.3.14
  • jaxlib ==0.3.14
  • matplotlib ==3.5.2
  • networkx ==2.8.4
  • opencv-python ==4.6.0.66
  • pydriller *
  • pymongo ==4.3.3
  • pytest ==7.1.2
  • redis ==4.3.4
  • scipy ==1.8.1
  • tensorflow ==2.9.1
  • tensorflow-addons ==0.17.1
  • tensorflow-probability ==0.17.0
  • torch ==1.11.0
  • torch-scatter ==2.0.9
  • tqdm *
requirements/requirements.txt pypi
  • colorama ==0.4.5
  • cython ==0.29.33
  • einops ==0.4.1
  • flask ==2.2.2
  • numpy ==1.23.0
  • nvidia-ml-py <=11.495.46
  • packaging ==21.3
  • psutil ==5.9.1
  • termcolor ==1.1.0
setup.py pypi
  • for *
  • strip *
.github/workflows/array-api-det-coverage.yml actions
  • actions/checkout v2 composite
  • cpina/github-action-push-to-another-repository main composite
.github/workflows/array-api-intelligent-tests-pr.yml actions
  • actions/checkout v2 composite
.github/workflows/array-api-intelligent-tests.yml actions
  • Tiryoh/gha-jobid-action v0 composite
  • actions/checkout v2 composite
.github/workflows/binaries.yml actions
.github/workflows/dockerfile-multicuda-push.yml actions
  • actions/checkout v3 composite
  • docker/login-action v2 composite
.github/workflows/dockerfile-multiversion-push.yml actions
  • actions/checkout v3 composite
  • docker/login-action v2 composite
.github/workflows/duplication.yml actions
  • actions/checkout v2 composite
.github/workflows/lint-bot.yml actions
.github/workflows/pr-lint-bot.yml actions
.github/workflows/pre-release.yml actions
  • Tiryoh/gha-jobid-action v0 composite
  • actions/checkout v3 composite
.github/workflows/release.yml actions
.github/workflows/run-all-tests.yml actions
  • Tiryoh/gha-jobid-action v0 composite
  • actions/checkout v3 composite
  • actions/download-artifact v3 composite
  • actions/upload-artifact v3 composite
.github/workflows/synchronize-db.yml actions
  • actions/checkout v3 composite
.github/workflows/test-ivy-cron-gpu.yml actions
  • Tiryoh/gha-jobid-action v0 composite
  • actions/checkout v2 composite
.github/workflows/test-ivy-cron-multi-version.yml actions
  • Tiryoh/gha-jobid-action v0 composite
  • actions/checkout v2 composite
.github/workflows/welcome-message.yml actions
  • actions/first-interaction v1 composite
  • mtfoley/pr-compliance-action v0.5.0 composite
ivy/engines/XLA/rust_api/Cargo.toml cargo
  • anyhow 1.0 development
  • clap 4.2.4 development
  • fancy-regex 0.11.0 development
  • rand 0.8.5 development
  • serde_json 1.0.96 development
  • half 2.3.1
  • libc 0.2
  • ndarray 0.15.6
  • num-derive 0.3
  • num-traits 0.2
  • numpy 0.19.0
  • pyo3 0.19.1
  • thiserror 1
  • zip 0.6.4
docker/multiversion_testing_requirements.txt pypi
  • autoflake * test
  • colorama * test
  • coverage * test
  • cryptography * test
  • dill * test
  • diskcache * test
  • einops * test
  • google-auth * test
  • h5py ==3.7.0 test
  • hypothesis ==6.55.0 test
  • jsonpickle * test
  • matplotlib ==3.5.2 test
  • ml_dtypes * test
  • networkx ==2.8.4 test
  • nvidia-ml-py <=11.495.46 test
  • opencv-python ==4.6.0.66 test
  • packaging * test
  • paddle-bfloat * test
  • pandas * test
  • psutil * test
  • pydriller * test
  • pymongo ==4.3.3 test
  • pyspark * test
  • pytest ==7.1.2 test
  • pyvis * test
  • redis ==4.3.4 test
  • requests * test
  • scikit-learn * test
  • scipy ==1.8.1 test
  • snakeviz * test
  • termcolor * test
  • tqdm * test
ivy/engines/XLA/rust_api/pyproject.toml pypi
requirements/optional_apple_silicon_1.txt pypi
  • h5py *
  • hypothesis *
  • jax *
  • jaxlib *
  • matplotlib *
  • networkx *
  • opencv-python *
  • paddlepaddle *
  • pymongo *
  • pytest *
  • redis *
  • tensorflow-macos *
  • tensorflow-probability *
  • torch *
requirements/optional_apple_silicon_2.txt pypi
  • autoflake *
  • coverage *
  • dm-haiku *
  • flax *
  • functorch *
  • pandas *
  • protobuf *
  • pydriller *
  • pyspark *
  • scikit-learn *
  • scipy *
  • snakeviz *
  • torch-scatter *
  • tqdm *
requirements/optional_apple_silicon_gpu_1.txt pypi
  • h5py *
  • hypothesis *
  • jax *
  • jax-metal *
  • jaxlib *
  • matplotlib *
  • networkx *
  • opencv-python *
  • paddlepaddle *
  • pymongo *
  • pytest *
  • redis *
  • tensorflow-macos *
  • tensorflow-metal *
  • tensorflow-probability *
  • torch *
requirements/optional_applied.txt pypi
  • accelerate *
  • botorch *
  • datasets *
  • diffusers *
  • fastai *
  • flax *
  • flower *
  • gpytorch *
  • gradslam *
  • kornia *
  • pytorch-lightning *
  • rllib *
  • seaborn *
  • tensorly *
  • thinc *
  • timm *
  • torch-geometric *
  • transformers *
  • validators *
requirements/optional_gpu.txt pypi
  • autoflake *
  • coverage *
  • dm-haiku *
  • flax *
  • functorch *
  • h5py *
  • hypothesis *
  • jax *
  • jaxlib *
  • matplotlib *
  • networkx *
  • opencv-python *
  • pandas *
  • pydriller *
  • pymongo *
  • pyspark *
  • pytest *
  • redis *
  • scikit-learn *
  • scipy *
  • snakeviz *
  • tensorflow *
  • tensorflow-probability *
  • torch *
  • torch-scatter *
  • tqdm *