@omote/core 0.4.1 → 0.4.2

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.
package/dist/index.mjs CHANGED
@@ -2678,12 +2678,23 @@ var Wav2Vec2Inference = class {
2678
2678
  logger2.debug("Running warmup inference to initialize GPU context");
2679
2679
  const warmupStart = performance.now();
2680
2680
  const silentAudio = new Float32Array(16e3);
2681
- await this.infer(silentAudio, 0);
2681
+ const WARMUP_TIMEOUT_MS = 15e3;
2682
+ const warmupResult = await Promise.race([
2683
+ this.infer(silentAudio, 0).then(() => "ok"),
2684
+ new Promise((r) => setTimeout(() => r("timeout"), WARMUP_TIMEOUT_MS))
2685
+ ]);
2682
2686
  const warmupTimeMs = performance.now() - warmupStart;
2683
- logger2.info("Warmup inference complete", {
2684
- warmupTimeMs: Math.round(warmupTimeMs),
2685
- backend: this._backend
2686
- });
2687
+ if (warmupResult === "timeout") {
2688
+ logger2.warn("Warmup inference timed out \u2014 GPU may be unresponsive. Continuing without warmup.", {
2689
+ timeoutMs: WARMUP_TIMEOUT_MS,
2690
+ backend: this._backend
2691
+ });
2692
+ } else {
2693
+ logger2.info("Warmup inference complete", {
2694
+ warmupTimeMs: Math.round(warmupTimeMs),
2695
+ backend: this._backend
2696
+ });
2697
+ }
2687
2698
  telemetry?.recordHistogram("omote.model.warmup_time", warmupTimeMs, {
2688
2699
  model: "wav2vec2",
2689
2700
  backend: this._backend
@@ -3739,20 +3750,21 @@ var LipSyncWithFallback = class {
3739
3750
  try {
3740
3751
  return await this.implementation.load();
3741
3752
  } catch (error) {
3742
- logger6.warn("GPU model load failed, falling back to CPU model", {
3743
- error: error instanceof Error ? error.message : String(error)
3744
- });
3745
- try {
3746
- await this.implementation.dispose();
3747
- } catch {
3748
- }
3749
- this.implementation = new Wav2ArkitCpuInference({
3750
- modelUrl: this.config.cpuModelUrl
3751
- });
3752
- this.hasFallenBack = true;
3753
- logger6.info("Fallback to Wav2ArkitCpuInference successful");
3754
- return await this.implementation.load();
3753
+ return this.fallbackToCpu(error instanceof Error ? error.message : String(error));
3754
+ }
3755
+ }
3756
+ async fallbackToCpu(reason) {
3757
+ logger6.warn("GPU model load failed, falling back to CPU model", { reason });
3758
+ try {
3759
+ await this.implementation.dispose();
3760
+ } catch {
3755
3761
  }
3762
+ this.implementation = new Wav2ArkitCpuInference({
3763
+ modelUrl: this.config.cpuModelUrl
3764
+ });
3765
+ this.hasFallenBack = true;
3766
+ logger6.info("Fallback to Wav2ArkitCpuInference successful");
3767
+ return await this.implementation.load();
3756
3768
  }
3757
3769
  async infer(audioSamples, identityIndex) {
3758
3770
  return this.implementation.infer(audioSamples, identityIndex);