Giter VIP home page Giter VIP logo

tjax's Introduction

Tools for JAX

PyPI - Version PyPI - Python Version

This repository implements a variety of tools for the differential programming library JAX.

Major components

Tjax's major components are:

  • A dataclass decorator dataclass that facilitates defining structured JAX objects (so-called "pytrees"), which benefits from:
    • the ability to mark fields as static (not available in chex.dataclass), and
    • a display method that produces formatted text according to the tree structure.
  • A fixed_point finding library heavily based on fax. Our library
    • supports stochastic iterated functions, and
    • uses dataclasses instead of closures to avoid leaking JAX tracers.
  • A shim for the gradient transformation library optax that supports:
    • easy differentiation and vectorization of “gradient transformation” (learning rule) parameters,
    • gradient transformation objects that can be passed dynamically to jitted functions, and
    • generic type annotations.
  • A pretty printer print_generic for aggregate and vector types, including dataclasses. (See display.) It features:
    • support for traced values,
    • colorized tree output for aggregate structures, and
    • formatted tabular output for arrays (or statistics when there's no room for tabular output).

Minor components

Tjax also includes:

  • Versions of custom_vjp and custom_jvp that support being used on methods: custom_vjp_method and custom_vjp_method (See shims.)
  • Tools for working with cotangents. (See cotangent_tools.)
  • JAX tree registration for NetworkX graph types. (See graph.)
  • Leaky integration leaky_integrate and Ornstein-Uhlenbeck process iteration diffused_leaky_integrate. (See leaky_integral.)
  • An improved version of jax.tree_util.Partial. (See partial.)
  • A testing function assert_tree_allclose that automatically produces testing code. And, a related function tree_allclose. (See testing.)
  • Basic tools like divide_where. (See tools.)

Contribution guidelines

  • Conventions: PEP8.
  • How to run tests: pytest .
  • How to clean the source:
    • ruff .
    • pyright
    • mypy
    • isort .
    • pylint tjax tests

tjax's People

Contributors

neilgirdhar avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

tjax's Issues

Optimizers and other pytree libraries

Hey @NeilGirdhar !

I have a keen interest on having Pytree ecosystem in JAX as IMO it makes many things simpler without loosing too much generality.

I've created this library called Treeo which is somewhat similar to your dataclass implementation, while it also support dataclasses, it has some additional features.

Would like to know if you are interested in collaborating on these topics, I am specially interested in Pytree Optimizers that could integrate with Treex and Elegy. Happy to have a chat if you have the time.

Incompatible dependencies with tensorflow

tjax requires numpy>=1.21 which seems to conflict with tensorflow's requirement of numpy~=1.19.2. I don't think needing both jax and tensorflow together is an uncommon use case. Jax functions can be converted to tensorflow (e.g., jax.experimental.jax2tf) which allows the use of, amongst other things, tensorflow's model saving/loading machinery.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.