Allow training the normalizing flow on a different JAX device

Open
#368 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Assessment

Difficulty
3/5
Estimated time
1-2 days
Newbie friendliness
58/100
Issue type
Feature
Clarity
Mostly clear
Activity status
Active
Tech stack
python

Research direction

Start by locating with_transform_adapt and tracing how flow training and per-gradient evaluation choose their JAX devices. The issue gives the expected call shape and reports a 1.6x per-epoch speedup in one prototype; compare behavior with and without train_device and check that training uses the requested device while gradient evaluation stays on the CPU.

Written by the indexing model from the issue text.

Description

normalizing-flows

with_transform_adapt should take a device for training the flow, so training can run on a GPU while the per-gradient flow evaluation stays on the CPU next to the compiled logp. Gradient evaluations are single-point calls, and training works on batches of draws. A prototype that trains on an Apple GPU through jax-graft was 1.6x faster per epoch at 200 dimensions with an 8-layer flow.

compiled = compiled.with_transform_adapt(train_device=jax.devices("mtl")[0])
Dominant language
Python
Stars
214
Forks
31
PR merge metrics
No merged PRs in 30d

Getting set up

This project ships no dev container, Dockerfile or contributing guide, so setting up is up to you: start from its README, and see our first-contribution guide for the general steps.

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from pymc-devs/nutpie

All issues in pymc-devs/nutpie

Similar issues

More Python issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.