omnius 1.0.980 → 1.0.981

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -3286,6 +3286,15 @@ var init_model_store = __esm({
3286
3286
  }
3287
3287
  });
3288
3288
 
3289
+ // packages/execution/dist/tools/cuda-device-filter.js
3290
+ var init_cuda_device_filter = __esm({
3291
+ "packages/execution/dist/tools/cuda-device-filter.js"() {
3292
+ "use strict";
3293
+ init_process_async();
3294
+ init_gpu_selection2();
3295
+ }
3296
+ });
3297
+
3289
3298
  // packages/execution/dist/process-kill.js
3290
3299
  var IS_WINDOWS;
3291
3300
  var init_process_kill = __esm({
@@ -3419,15 +3428,6 @@ var init_playwright_download = __esm({
3419
3428
  }
3420
3429
  });
3421
3430
 
3422
- // packages/execution/dist/tools/cuda-device-filter.js
3423
- var init_cuda_device_filter = __esm({
3424
- "packages/execution/dist/tools/cuda-device-filter.js"() {
3425
- "use strict";
3426
- init_process_async();
3427
- init_gpu_selection2();
3428
- }
3429
- });
3430
-
3431
3431
  // packages/execution/dist/tools/camera-capture.js
3432
3432
  var DEFAULT_CAMERA_PROFILE, CAMERA_PROFILES;
3433
3433
  var init_camera_capture = __esm({
@@ -248932,6 +248932,104 @@ var OCR_JETSON_NATIVE_PROVIDERS = Object.freeze({
248932
248932
  // packages/execution/dist/python-cuda-runtime-async.js
248933
248933
  init_process_async();
248934
248934
 
248935
+ // packages/execution/dist/luxtts-device-policy.js
248936
+ init_cuda_device_filter();
248937
+ var LUX_TTS_DEVICE_POLICY_PREAMBLE = String.raw`
248938
+ # OMNIUS_LUXTTS_DEVICE_POLICY_V1
248939
+ import gc, json, os, signal, time
248940
+ _POLICY = json.loads(os.environ.get("OMNIUS_LUXTTS_DEVICE_POLICY", "{}"))
248941
+ _DEVICE = str(_POLICY.get("device") or "cpu")
248942
+ _GPU_TOKEN = str(_POLICY.get("gpuUuid") or "")
248943
+ _CPU_CAP = max(0.01, float(_POLICY.get("cpuPercent") or 80) / 100.0)
248944
+ _CPU_THREADS = max(1, min(8, int(_POLICY.get("cpuThreads") or 1)))
248945
+ if _DEVICE == "cuda":
248946
+ if _GPU_TOKEN and not _POLICY.get("brokerManaged"):
248947
+ os.environ["CUDA_VISIBLE_DEVICES"] = _GPU_TOKEN
248948
+ os.environ["HIP_VISIBLE_DEVICES"] = "-1"
248949
+ os.environ["ROCR_VISIBLE_DEVICES"] = "-1"
248950
+ os.environ.pop("NVIDIA_VISIBLE_DEVICES", None)
248951
+ else:
248952
+ os.environ["CUDA_VISIBLE_DEVICES"] = "-1"
248953
+ os.environ["HIP_VISIBLE_DEVICES"] = "-1"
248954
+ os.environ["ROCR_VISIBLE_DEVICES"] = "-1"
248955
+ os.environ["NVIDIA_VISIBLE_DEVICES"] = "none"
248956
+
248957
+ _YIELD_REQUESTED = False
248958
+ _CPU_BUDGET = {"wall": None, "cpu": None}
248959
+
248960
+ def _handle_voice_stop(_signum, _frame):
248961
+ global _YIELD_REQUESTED
248962
+ _YIELD_REQUESTED = True
248963
+
248964
+ try:
248965
+ signal.signal(signal.SIGTERM, _handle_voice_stop)
248966
+ except Exception:
248967
+ pass
248968
+
248969
+ def _yield_requested():
248970
+ if _YIELD_REQUESTED or _POLICY.get("yieldRequested"):
248971
+ return True
248972
+ drain = os.environ.get("OMNIUS_LUXTTS_DRAIN_FILE", "")
248973
+ return bool(drain and os.path.exists(drain))
248974
+
248975
+ def _acknowledge_yield():
248976
+ ack = os.environ.get("OMNIUS_LUXTTS_DRAIN_ACK", "")
248977
+ if not ack:
248978
+ return
248979
+ try:
248980
+ with open(ack, "w") as handle:
248981
+ handle.write("yielded")
248982
+ except Exception:
248983
+ pass
248984
+
248985
+ def _mark_runtime_ready(ready=True):
248986
+ path = os.environ.get("OMNIUS_LUXTTS_READY_FILE", "")
248987
+ if not path:
248988
+ return
248989
+ try:
248990
+ if ready:
248991
+ with open(path, "w") as handle:
248992
+ handle.write("ready")
248993
+ elif os.path.exists(path):
248994
+ os.unlink(path)
248995
+ except Exception:
248996
+ pass
248997
+
248998
+ def _cpu_cap_begin():
248999
+ _CPU_BUDGET["wall"] = time.monotonic()
249000
+ _CPU_BUDGET["cpu"] = time.process_time()
249001
+
249002
+ def _cpu_cap_settle():
249003
+ wall_started = _CPU_BUDGET.get("wall")
249004
+ cpu_started = _CPU_BUDGET.get("cpu")
249005
+ _CPU_BUDGET["wall"] = None
249006
+ _CPU_BUDGET["cpu"] = None
249007
+ if wall_started is None or cpu_started is None:
249008
+ return
249009
+ wall = max(0.001, time.monotonic() - wall_started)
249010
+ cpu = max(0.0, time.process_time() - cpu_started)
249011
+ required_wall = cpu / _CPU_CAP
249012
+ debt = required_wall - wall
249013
+ if debt > 0:
249014
+ time.sleep(min(debt, 600.0))
249015
+
249016
+ def _drop_luxtts_model():
249017
+ for _name in ("tts", "prompt_cache"):
249018
+ globals().pop(_name, None)
249019
+ gc.collect()
249020
+ try:
249021
+ import torch
249022
+ if torch.cuda.is_available():
249023
+ torch.cuda.synchronize()
249024
+ torch.cuda.empty_cache()
249025
+ except Exception:
249026
+ pass
249027
+ `;
249028
+
249029
+ // packages/execution/dist/luxtts-gpu-lease.js
249030
+ init_process_async();
249031
+ init_model_broker();
249032
+
248935
249033
  // packages/execution/dist/broker-mediated-backend.js
248936
249034
  init_model_broker();
248937
249035
 
@@ -300333,6 +300431,32 @@ init_process_async();
300333
300431
  init_hf_media_models();
300334
300432
  init_cuda_device_filter();
300335
300433
  init_model_store();
300434
+ var _luxttsDaemon = null;
300435
+ var _luxttsStartingWorker = null;
300436
+ var _luxttsRuntimeLease = null;
300437
+ async function releaseLuxTtsRuntimeLease() {
300438
+ const lease = _luxttsRuntimeLease;
300439
+ _luxttsRuntimeLease = null;
300440
+ if (!lease)
300441
+ return;
300442
+ lease.signalRelease?.();
300443
+ if (lease.settleRelease)
300444
+ await lease.settleRelease();
300445
+ else
300446
+ await lease.release();
300447
+ }
300448
+ process.once("exit", () => {
300449
+ const workers = [_luxttsDaemon, _luxttsStartingWorker, _misottsDaemon];
300450
+ for (const worker of workers) {
300451
+ if (!worker)
300452
+ continue;
300453
+ try {
300454
+ worker.kill("SIGKILL");
300455
+ } catch {
300456
+ }
300457
+ }
300458
+ void releaseLuxTtsRuntimeLease();
300459
+ });
300336
300460
  var SUPERTONIC_INFER_PY = String.raw`
300337
300461
  import json, sys, traceback
300338
300462
  try:
@@ -300365,27 +300489,41 @@ except Exception as exc:
300365
300489
  sys.exit(1)
300366
300490
  `;
300367
300491
  var LUXTTS_DAEMON_PY = String.raw`
300368
- import json, os, sys, traceback, wave
300369
- # OMNIUS_LUXTTS_CPU_ONLY_V1
300370
- os.environ["CUDA_VISIBLE_DEVICES"] = "-1"
300371
- os.environ["HIP_VISIBLE_DEVICES"] = "-1"
300372
- os.environ["ROCR_VISIBLE_DEVICES"] = "-1"
300492
+ # OMNIUS_LUXTTS_DEVICE_POLICY_V1
300493
+ ${LUX_TTS_DEVICE_POLICY_PREAMBLE}
300494
+ import traceback, wave
300373
300495
  import numpy as np
300374
300496
  import torch
300497
+ try:
300498
+ torch.set_num_threads(_CPU_THREADS)
300499
+ except Exception:
300500
+ pass
300375
300501
  repo = os.environ.get("LUXTTS_REPO_PATH") or ""
300376
300502
  if repo:
300377
300503
  sys.path.insert(0, repo)
300378
300504
  from zipvoice.luxvoice import LuxTTS
300379
- device = "cpu"
300380
- tts = LuxTTS(model_path="YatharthS/LuxTTS", device=device, threads=4)
300381
- print(json.dumps({"type": "ready", "device": device}), flush=True)
300505
+ tts = LuxTTS(model_path="YatharthS/LuxTTS", device=_DEVICE, threads=_CPU_THREADS)
300506
+ _mark_runtime_ready(True)
300507
+ print(json.dumps({"type": "ready", "device": _DEVICE}), flush=True)
300382
300508
  for line in sys.stdin:
300509
+ if _yield_requested():
300510
+ _drop_luxtts_model()
300511
+ _acknowledge_yield()
300512
+ _mark_runtime_ready(False)
300513
+ print(json.dumps({"type": "yielded", "device": _DEVICE}), flush=True)
300514
+ break
300383
300515
  if not line.strip():
300384
300516
  continue
300385
300517
  req = json.loads(line)
300386
- if req.get("action") == "quit":
300518
+ if req.get("action") in ("quit", "yield", "release"):
300519
+ if req.get("action") != "quit":
300520
+ _drop_luxtts_model()
300521
+ _acknowledge_yield()
300522
+ _mark_runtime_ready(False)
300523
+ print(json.dumps({"type": "yielded", "id": req.get("id"), "device": _DEVICE}), flush=True)
300387
300524
  break
300388
300525
  rid = req.get("id")
300526
+ _cpu_cap_begin()
300389
300527
  try:
300390
300528
  text = str(req.get("text") or "").strip()
300391
300529
  clone_ref = str(req.get("clone_ref") or "")
@@ -300402,6 +300540,8 @@ for line in sys.stdin:
300402
300540
  print(json.dumps({"type": "result", "id": rid, "path": output}), flush=True)
300403
300541
  except Exception as exc:
300404
300542
  print(json.dumps({"type": "error", "id": rid, "error": str(exc), "trace": traceback.format_exc(limit=3)}), flush=True)
300543
+ finally:
300544
+ _cpu_cap_settle()
300405
300545
  `;
300406
300546
  var MISO_DAEMON_PY = String.raw`
300407
300547
  import json, os, sys, traceback
@@ -300452,6 +300592,7 @@ for line in sys.stdin:
300452
300592
  except Exception as exc:
300453
300593
  print(json.dumps({"type": "error", "id": rid, "error": str(exc), "trace": traceback.format_exc(limit=3)}), flush=True)
300454
300594
  `;
300595
+ var _misottsDaemon = null;
300455
300596
 
300456
300597
  // packages/execution/dist/tools/sdr-scan.js
300457
300598
  init_process_async();
package/dist/index.js CHANGED
@@ -1,4 +1,4 @@
1
1
  [diffend] Oversized file quarantined before diffing.
2
2
  name: package/dist/index.js
3
- size: 43182037 bytes
4
- sha256: 2753641ed383be32ea0977ece6e1ae8ed8b1ee169a18b7119b8309b72f5d41cf
3
+ size: 43212504 bytes
4
+ sha256: d5f8bdd1c7fd4130e47eb6abe55729ee6f7986661288d1205198da3c9f52fb40