Automation foundation model for tiny devices: 2-bit, 8-29 MB, tool calls, ASR, structured extraction and embeddings on phones, wearables, smart homes, robots, cars and microcontrollers.
updates
HenryNdubuaku73825064b945
diff --git a/src/tpu.py b/src/tpu.pyindex ec16ac5..b82fc27 100644--- a/src/tpu.py+++ b/src/tpu.py@@ -564,6 +564,13 @@ def tpu_train(args):zone = args.zone or _detect_zone(args.name)num_workers = _get_num_workers(args.name, zone)+ # Kill any stale training processes that might be holding the TPU+ # [n] trick prevents pkill from matching its own command line+ if num_workers > 1:+ print(f"[tpu] Killing stale processes on all workers...")+ _run_all_workers(args.name, zone,+ "sudo pkill -9 -f [n]eedle.train || true")+# Pass through any extra args after the nameextra = getattr(args, "train_args", [])train_cmd = "cd ~/needle && .venv/bin/needle train"diff --git a/src/train.py b/src/train.pyindex cda9d58..2d4a142 100644--- a/src/train.py+++ b/src/train.py@@ -329,7 +329,8 @@ _MAT_FF_WIDTHS = ()_D_FF = 2048_CONTRASTIVE_WEIGHT = 0.1# Weight map: class 0=base, 1=name, 2=value, 3=key (set from CLI args at train time)-_LOSS_WEIGHT_MAP = jnp.array([1.0, 3.0, 2.0, 1.5], dtype=jnp.float32)+# Use numpy at module level to avoid initializing JAX backend before jax.distributed.initialize()+_LOSS_WEIGHT_MAP = np.array([1.0, 3.0, 2.0, 1.5], dtype=np.float32)def _clip_contrastive_loss(q_emb, t_emb, log_temp):