Skip to content

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

HenryNdubuaku0603ca0c5276
diff --git a/src/cli.py b/src/cli.py
index 2d5c840..2103e2e 100644
--- a/src/cli.py
+++ b/src/cli.py
@@ -4,8 +4,6 @@ import re
import sys
import threading
-from .data import DEFAULT_MAX_ENC_LEN, DEFAULT_MAX_DEC_LEN, DEFAULT_MAX_GEN_LEN
-
HELP = """Check the readme"""
@@ -95,6 +93,18 @@ def _install_xla_log_filter():
t = threading.Thread(target=pump, daemon=True, name="xla-log-filter")
t.start()
+
+# Install the stderr filter BEFORE importing anything that might transitively
+# initialize jax/XLA. In particular, `.data` imports `datasets`, which probes
+# for jax at import time and fully loads it if present — that initializes XLA's
+# C++ absl logging and captures fd 2 before we get a chance to redirect it.
+os.environ.setdefault("TF_CPP_MIN_LOG_LEVEL", "2")
+os.environ.setdefault("GRPC_VERBOSITY", "ERROR")
+_install_xla_log_filter()
+
+from .data import DEFAULT_MAX_ENC_LEN, DEFAULT_MAX_DEC_LEN, DEFAULT_MAX_GEN_LEN
+
+
def main():
if len(sys.argv) < 2 or sys.argv[1] in ("-h", "--help", "help"):
print(HELP)
@@ -339,18 +349,12 @@ def main():
from .tokenize_data import tokenize
tokenize(args)
elif args.command == "pretrain":
- os.environ.setdefault("TF_CPP_MIN_LOG_LEVEL", "2")
- os.environ.setdefault("GRPC_VERBOSITY", "ERROR")
- _install_xla_log_filter()
import jax
if os.path.exists("/dev/accel0"):
jax.distributed.initialize()
from .pretrain import pretrain
pretrain(args)
elif args.command == "train":
- os.environ.setdefault("TF_CPP_MIN_LOG_LEVEL", "2")
- os.environ.setdefault("GRPC_VERBOSITY", "ERROR")
- _install_xla_log_filter()
import jax
if os.path.exists("/dev/accel0"):
jax.distributed.initialize()