This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from tqdm.auto import tqdm | |
from jax import jit, vmap, grad, random, lax, partial | |
import jax.numpy as jnp | |
from jax.experimental import host_callback | |
def progress_bar_scan(num_samples, message=None): | |
"Progress bar for a JAX scan" | |
if message is None: | |
message = f"Running for {num_samples:,} iterations" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import jax.numpy as jnp | |
from jax import jit, vmap, grad, random, lax, partial | |
from jax.experimental import host_callback | |
# ======== | |
# define progress bar | |
def _print_consumer(arg, transform): | |
iter_num, num_samples = arg |