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.

changes

HenryNdubuaku52a2f0f81535
diff --git a/src/cli.py b/src/cli.py
index e0d8e3c..dfc6398 100644
--- a/src/cli.py
+++ b/src/cli.py
@@ -156,6 +156,8 @@ def main():
tp.add_argument("--type", dest="accel_type", type=str, default="v6e-8")
tp.add_argument("--version", type=str, default=None,
help="Software version (auto-detected from --type if omitted)")
+ tp.add_argument("--preemptible", action="store_true", default=False,
+ help="Create a preemptible (spot) TPU VM")
tp = tpu_sub.add_parser("connect", add_help=False)
tp.add_argument("name", type=str)
diff --git a/src/tpu.py b/src/tpu.py
index f8fe0f5..e1702f6 100644
--- a/src/tpu.py
+++ b/src/tpu.py
@@ -177,18 +177,22 @@ def _setup_git_on_instance(name, zone, git_name, git_email):
def tpu_create(args):
version = _resolve_version(args.accel_type, args.version)
- print(f"[tpu] Accelerator: {args.accel_type}, software version: {version}")
+ preemptible = getattr(args, "preemptible", False)
+ print(f"[tpu] Accelerator: {args.accel_type}, software version: {version}"
+ f"{', preemptible' if preemptible else ''}")
git_name, git_email = _collect_git_config()
for zone in ZONES:
print(f"[tpu] Trying {zone}...")
- result = _run(
- ["gcloud", "compute", "tpus", "tpu-vm", "create", args.name,
+ cmd = ["gcloud", "compute", "tpus", "tpu-vm", "create", args.name,
"--zone", zone,
"--accelerator-type", args.accel_type,
"--version", version,
- "--project", PROJECT],
+ "--project", PROJECT]
+ if preemptible:
+ cmd.append("--preemptible")
+ result = _run(cmd,
check=False, capture=True,
)
if result.returncode == 0: