Close Menu
  • Home
  • AI News
  • AI Startups
  • Deep Learning
  • Interviews
  • Machine-Learning
  • Robotics

Subscribe to Updates

Get the latest creative news from FooBar about art, design and business.

What's Hot

A Detailed Implementation on Equinox with JAX Native Modules, Filtered Transforms, Stateful Layers, and Finish-to-Finish Coaching Workflows

April 22, 2026

PERCO.AI Closes $15M-Valued Angel Spherical for AI-Powered Enterprise Execution

April 22, 2026

Infisical Launches Agent Vault, Letting Engineering Groups Ship AI Brokers to Manufacturing With out Exposing Credentials

April 22, 2026
Facebook X (Twitter) Instagram
Smart Homez™
Facebook X (Twitter) Instagram Pinterest YouTube LinkedIn TikTok
SUBSCRIBE
  • Home
  • AI News
  • AI Startups
  • Deep Learning
  • Interviews
  • Machine-Learning
  • Robotics
Smart Homez™
Home»Deep Learning»A Detailed Implementation on Equinox with JAX Native Modules, Filtered Transforms, Stateful Layers, and Finish-to-Finish Coaching Workflows
Deep Learning

A Detailed Implementation on Equinox with JAX Native Modules, Filtered Transforms, Stateful Layers, and Finish-to-Finish Coaching Workflows

Editorial TeamBy Editorial TeamApril 22, 2026Updated:April 22, 2026No Comments3 Mins Read
Facebook Twitter Pinterest LinkedIn Tumblr Reddit WhatsApp Email
A Detailed Implementation on Equinox with JAX Native Modules, Filtered Transforms, Stateful Layers, and Finish-to-Finish Coaching Workflows
Share
Facebook Twitter LinkedIn Pinterest WhatsApp Email


BATCH  = 128
EPOCHS = 30
steps_per_epoch = len(X_train) // BATCH
train_losses, val_losses = [], []


t0 = time.time()
for epoch in vary(EPOCHS):
   key, sk = jax.random.cut up(key)
   perm = jax.random.permutation(sk, len(X_train))
   X_s, Y_s = X_train[perm], Y_train[perm]


   epoch_loss = 0.0
   for step in vary(steps_per_epoch):
       xb = X_s[step*BATCH:(step+1)*BATCH]
       yb = Y_s[step*BATCH:(step+1)*BATCH]
       mannequin, opt_state, loss = train_step(mannequin, opt_state, xb, yb)
       epoch_loss += loss.merchandise()


   val_loss = consider(mannequin, X_val, Y_val).merchandise()
   train_losses.append(epoch_loss / steps_per_epoch)
   val_losses.append(val_loss)


   if (epoch + 1) % 5 == 0:
       print(f"Epoch {epoch+1:3d}/{EPOCHS}  "
             f"train_loss={train_losses[-1]:.5f}  "
             f"val_loss={val_losses[-1]:.5f}")


print(f"nTotal coaching time: {time.time()-t0:.1f}s")


print("n" + "="*60)
print("SECTION 7: Save & load mannequin weights")
print("="*60)


eqx.tree_serialise_leaves("model_weights.eqx", mannequin)


key, mk2 = jax.random.cut up(key)
model_skeleton = ResNetMLP(1, 64, 1, n_blocks=4, key=mk2)
model_loaded   = eqx.tree_deserialise_leaves("model_weights.eqx", model_skeleton)


diff = jnp.max(jnp.abs(
   jax.tree_util.tree_leaves(eqx.filter(mannequin, eqx.is_array))[0]
 - jax.tree_util.tree_leaves(eqx.filter(model_loaded, eqx.is_array))[0]
))
print(f"Max weight distinction after reload: {diff:.2e}  (ought to be 0.0)")


fig, axes = plt.subplots(1, 2, figsize=(12, 4))


axes[0].plot(train_losses, label="Prepare MSE", colour="#4C72B0")
axes[0].plot(val_losses,   label="Val MSE",   colour="#DD8452", linestyle="--")
axes[0].set_xlabel("Epoch")
axes[0].set_ylabel("MSE")
axes[0].set_title("Coaching curves")
axes[0].legend()
axes[0].grid(True, alpha=0.3)


x_plot  = jnp.linspace(-1, 1, 300).reshape(-1, 1)
y_true  = jnp.sin(2 * jnp.pi * x_plot)
y_pred  = jax.vmap(mannequin)(x_plot)


axes[1].scatter(X_val[:100], Y_val[:100], s=10, alpha=0.4, colour="grey", label="Information")
axes[1].plot(x_plot, y_true, colour="#4C72B0",  linewidth=2, label="True f(x)")
axes[1].plot(x_plot, y_pred, colour="#DD8452", linewidth=2, linestyle="--", label="Predicted")
axes[1].set_xlabel("x")
axes[1].set_ylabel("y")
axes[1].set_title("Sine regression match")
axes[1].legend()
axes[1].grid(True, alpha=0.3)


plt.tight_layout()
plt.savefig("equinox_tutorial.png", dpi=150)
plt.present()
print("nDone! Plot saved to equinox_tutorial.png")


print("n" + "="*60)
print("BONUS: eqx.filter_jit + form inference debug tip")
print("="*60)


jaxpr = jax.make_jaxpr(jax.vmap(mannequin))(x_plot)
n_eqns = len(jaxpr.jaxpr.eqns)
print(f"Compiled ResNetMLP jaxpr has {n_eqns} equations (ops) for batch enter {x_plot.form}")
BATCH  = 128
EPOCHS = 30
steps_per_epoch = len(X_train) // BATCH
train_losses, val_losses = [], []


t0 = time.time()
for epoch in vary(EPOCHS):
   key, sk = jax.random.cut up(key)
   perm = jax.random.permutation(sk, len(X_train))
   X_s, Y_s = X_train[perm], Y_train[perm]


   epoch_loss = 0.0
   for step in vary(steps_per_epoch):
       xb = X_s[step*BATCH:(step+1)*BATCH]
       yb = Y_s[step*BATCH:(step+1)*BATCH]
       mannequin, opt_state, loss = train_step(mannequin, opt_state, xb, yb)
       epoch_loss += loss.merchandise()


   val_loss = consider(mannequin, X_val, Y_val).merchandise()
   train_losses.append(epoch_loss / steps_per_epoch)
   val_losses.append(val_loss)


   if (epoch + 1) % 5 == 0:
       print(f"Epoch {epoch+1:3d}/{EPOCHS}  "
             f"train_loss={train_losses[-1]:.5f}  "
             f"val_loss={val_losses[-1]:.5f}")


print(f"nTotal coaching time: {time.time()-t0:.1f}s")


print("n" + "="*60)
print("SECTION 7: Save & load mannequin weights")
print("="*60)


eqx.tree_serialise_leaves("model_weights.eqx", mannequin)


key, mk2 = jax.random.cut up(key)
model_skeleton = ResNetMLP(1, 64, 1, n_blocks=4, key=mk2)
model_loaded   = eqx.tree_deserialise_leaves("model_weights.eqx", model_skeleton)


diff = jnp.max(jnp.abs(
   jax.tree_util.tree_leaves(eqx.filter(mannequin, eqx.is_array))[0]
 - jax.tree_util.tree_leaves(eqx.filter(model_loaded, eqx.is_array))[0]
))
print(f"Max weight distinction after reload: {diff:.2e}  (ought to be 0.0)")


fig, axes = plt.subplots(1, 2, figsize=(12, 4))


axes[0].plot(train_losses, label="Prepare MSE", colour="#4C72B0")
axes[0].plot(val_losses,   label="Val MSE",   colour="#DD8452", linestyle="--")
axes[0].set_xlabel("Epoch")
axes[0].set_ylabel("MSE")
axes[0].set_title("Coaching curves")
axes[0].legend()
axes[0].grid(True, alpha=0.3)


x_plot  = jnp.linspace(-1, 1, 300).reshape(-1, 1)
y_true  = jnp.sin(2 * jnp.pi * x_plot)
y_pred  = jax.vmap(mannequin)(x_plot)


axes[1].scatter(X_val[:100], Y_val[:100], s=10, alpha=0.4, colour="grey", label="Information")
axes[1].plot(x_plot, y_true, colour="#4C72B0",  linewidth=2, label="True f(x)")
axes[1].plot(x_plot, y_pred, colour="#DD8452", linewidth=2, linestyle="--", label="Predicted")
axes[1].set_xlabel("x")
axes[1].set_ylabel("y")
axes[1].set_title("Sine regression match")
axes[1].legend()
axes[1].grid(True, alpha=0.3)


plt.tight_layout()
plt.savefig("equinox_tutorial.png", dpi=150)
plt.present()
print("nDone! Plot saved to equinox_tutorial.png")


print("n" + "="*60)
print("BONUS: eqx.filter_jit + form inference debug tip")
print("="*60)


jaxpr = jax.make_jaxpr(jax.vmap(mannequin))(x_plot)
n_eqns = len(jaxpr.jaxpr.eqns)
print(f"Compiled ResNetMLP jaxpr has {n_eqns} equations (ops) for batch enter {x_plot.form}")



Supply hyperlink

Editorial Team
  • Website

Related Posts

A Coding Implementation to Construct a Conditional Bayesian Hyperparameter Optimization Pipeline with Hyperopt, TPE, and Early Stopping

April 22, 2026

A Coding Implementation on Microsoft’s Phi-4-Mini for Quantized Inference Reasoning Device Use RAG and LoRA Nice-Tuning

April 21, 2026

OpenAI Scales Trusted Entry for Cyber Protection With GPT-5.4-Cyber: a High quality-Tuned Mannequin Constructed for Verified Safety Defenders

April 20, 2026
Misa
Trending
Deep Learning

A Detailed Implementation on Equinox with JAX Native Modules, Filtered Transforms, Stateful Layers, and Finish-to-Finish Coaching Workflows

By Editorial TeamApril 22, 20260

BATCH = 128 EPOCHS = 30 steps_per_epoch = len(X_train) // BATCH train_losses, val_losses = [],…

PERCO.AI Closes $15M-Valued Angel Spherical for AI-Powered Enterprise Execution

April 22, 2026

Infisical Launches Agent Vault, Letting Engineering Groups Ship AI Brokers to Manufacturing With out Exposing Credentials

April 22, 2026

Developer Launches First Work Platform The place Brokers Are Full Customers

April 22, 2026
Stay In Touch
  • Facebook
  • Twitter
  • Pinterest
  • Instagram
  • YouTube
  • Vimeo
Our Picks

A Detailed Implementation on Equinox with JAX Native Modules, Filtered Transforms, Stateful Layers, and Finish-to-Finish Coaching Workflows

April 22, 2026

PERCO.AI Closes $15M-Valued Angel Spherical for AI-Powered Enterprise Execution

April 22, 2026

Infisical Launches Agent Vault, Letting Engineering Groups Ship AI Brokers to Manufacturing With out Exposing Credentials

April 22, 2026

Developer Launches First Work Platform The place Brokers Are Full Customers

April 22, 2026

Subscribe to Updates

Get the latest creative news from SmartMag about art & design.

The Ai Today™ Magazine is the first in the middle east that gives the latest developments and innovations in the field of AI. We provide in-depth articles and analysis on the latest research and technologies in AI, as well as interviews with experts and thought leaders in the field. In addition, The Ai Today™ Magazine provides a platform for researchers and practitioners to share their work and ideas with a wider audience, help readers stay informed and engaged with the latest developments in the field, and provide valuable insights and perspectives on the future of AI.

Our Picks

A Detailed Implementation on Equinox with JAX Native Modules, Filtered Transforms, Stateful Layers, and Finish-to-Finish Coaching Workflows

April 22, 2026

PERCO.AI Closes $15M-Valued Angel Spherical for AI-Powered Enterprise Execution

April 22, 2026

Infisical Launches Agent Vault, Letting Engineering Groups Ship AI Brokers to Manufacturing With out Exposing Credentials

April 22, 2026
Trending

Developer Launches First Work Platform The place Brokers Are Full Customers

April 22, 2026

A Coding Implementation to Construct a Conditional Bayesian Hyperparameter Optimization Pipeline with Hyperopt, TPE, and Early Stopping

April 22, 2026

GEOGrow.ai Unveils Subsequent-Degree AI Visibility Platform at LEADSCON Las Vegas

April 21, 2026
Facebook X (Twitter) Instagram YouTube LinkedIn TikTok
  • About Us
  • Advertising Solutions
  • Privacy Policy
  • Terms
  • Podcast
Copyright © The Ai Today™ , All right reserved.

Type above and press Enter to search. Press Esc to cancel.