Git Product home page Git Product logo

Comments (2)

kingoflolz avatar kingoflolz commented on July 2, 2024 1

@shawwn hrm thanks for letting me know. I was trying to do CPU offload of the optimizer parameters initially to fit a bigger model on the TPU, but the better way to do that now would be to integrate part of mesh transformer jax to perform model parallel sharding within the 8 TPU devices. I think I'll leave it for now and refactor if/when I get around to it so this entire approach would be unnessasary.

from swarm-jax.

shawwn avatar shawwn commented on July 2, 2024

Some extra details, as promised.

In swarm_layer.py:

@partial(jax.jit, static_argnums=3)
def opt_jit(grad_acc, opt_state, params, optimizer):
total_grad = jax.tree_map(lambda x: jnp.mean(x, axis=0), grad_acc)
cpu_device = jax.devices("cpu")[0]
total_grad = jax.device_put(total_grad, device=cpu_device)
cpu_params = jax.device_put(jax.tree_map(lambda x: x[0], params), device=cpu_device)

I think that this code isn't functioning properly. According to skye, device_put is a no-op inside jit. So I assume that each of those calls to device_put() has no effect.

I'm not experienced enough with Jax to know the best way to fix the problem. What do you think the right solution is?

Commenting out @partial(jax.jit, static_argnums=3) seems like the most straightforward "solution." But I don't know anything about Jax's JIT (yet), so I don't know if that makes any sense, or what the tradeoffs are.

from swarm-jax.

Related Issues (1)

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.