@omote/core 0.6.4 → 0.6.6
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.d.mts +44 -21
- package/dist/index.d.ts +44 -21
- package/dist/index.js +26 -16
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +26 -16
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
package/dist/index.mjs
CHANGED
|
@@ -2194,7 +2194,7 @@ async function getOnnxRuntimeForPreference(preference = "auto") {
|
|
|
2194
2194
|
const ort = await getOnnxRuntime(backend);
|
|
2195
2195
|
return { ort, backend };
|
|
2196
2196
|
}
|
|
2197
|
-
function getSessionOptions(backend) {
|
|
2197
|
+
function getSessionOptions(backend, config) {
|
|
2198
2198
|
if (backend === "webgpu") {
|
|
2199
2199
|
return {
|
|
2200
2200
|
executionProviders: [
|
|
@@ -2210,7 +2210,7 @@ function getSessionOptions(backend) {
|
|
|
2210
2210
|
if (isIOS()) {
|
|
2211
2211
|
return {
|
|
2212
2212
|
executionProviders: ["wasm"],
|
|
2213
|
-
graphOptimizationLevel: "basic",
|
|
2213
|
+
graphOptimizationLevel: config?.iosDisableOptimization ? "disabled" : "basic",
|
|
2214
2214
|
enableCpuMemArena: false,
|
|
2215
2215
|
enableMemPattern: false
|
|
2216
2216
|
};
|
|
@@ -2477,7 +2477,7 @@ var _Wav2Vec2Inference = class _Wav2Vec2Inference {
|
|
|
2477
2477
|
logger3.info("ONNX Runtime loaded", { backend: this._backend });
|
|
2478
2478
|
const modelUrl = this.config.modelUrl;
|
|
2479
2479
|
const dataUrl = this.config.externalDataUrl !== false ? typeof this.config.externalDataUrl === "string" ? this.config.externalDataUrl : `${modelUrl}.data` : null;
|
|
2480
|
-
const sessionOptions = getSessionOptions(this._backend);
|
|
2480
|
+
const sessionOptions = getSessionOptions(this._backend, { iosDisableOptimization: true });
|
|
2481
2481
|
let isCached = false;
|
|
2482
2482
|
if (isIOS()) {
|
|
2483
2483
|
logger3.info("iOS: passing model URLs directly to ORT (low-memory path)", {
|
|
@@ -7320,10 +7320,11 @@ function createA2E(config = {}) {
|
|
|
7320
7320
|
useCpu = false;
|
|
7321
7321
|
logger12.info("Forcing GPU A2E model (Wav2Vec2)");
|
|
7322
7322
|
} else {
|
|
7323
|
-
useCpu =
|
|
7324
|
-
logger12.info("Auto-detected A2E model", {
|
|
7325
|
-
|
|
7326
|
-
|
|
7323
|
+
useCpu = false;
|
|
7324
|
+
logger12.info("Auto-detected A2E model: trying GPU first (fp16 external data)", {
|
|
7325
|
+
isSafari: isSafari(),
|
|
7326
|
+
isIOS: isIOS(),
|
|
7327
|
+
fallbackOnError
|
|
7327
7328
|
});
|
|
7328
7329
|
}
|
|
7329
7330
|
if (useCpu) {
|
|
@@ -7385,6 +7386,7 @@ var A2EWithFallback = class {
|
|
|
7385
7386
|
}
|
|
7386
7387
|
}
|
|
7387
7388
|
async fallbackToCpu(reason) {
|
|
7389
|
+
console.error("[A2EWithFallback] GPU\u2192CPU FALLBACK TRIGGERED. Reason:", reason);
|
|
7388
7390
|
logger12.warn("GPU model load failed, falling back to CPU model", { reason });
|
|
7389
7391
|
try {
|
|
7390
7392
|
await this.implementation.dispose();
|
|
@@ -10253,10 +10255,7 @@ var EmotionResolver = class {
|
|
|
10253
10255
|
if (upper[i] > 1) upper[i] = 1;
|
|
10254
10256
|
if (lower[i] > 1) lower[i] = 1;
|
|
10255
10257
|
}
|
|
10256
|
-
return {
|
|
10257
|
-
upper: new Float32Array(upper),
|
|
10258
|
-
lower: new Float32Array(lower)
|
|
10259
|
-
};
|
|
10258
|
+
return { upper, lower };
|
|
10260
10259
|
}
|
|
10261
10260
|
};
|
|
10262
10261
|
|
|
@@ -10279,6 +10278,7 @@ var FaceCompositor = class {
|
|
|
10279
10278
|
constructor(config) {
|
|
10280
10279
|
this.emotionResolver = new EmotionResolver();
|
|
10281
10280
|
// Pre-allocated buffers
|
|
10281
|
+
this.outputBuffer = new Float32Array(52);
|
|
10282
10282
|
this.smoothedUpper = new Float32Array(52);
|
|
10283
10283
|
this.smoothedLower = new Float32Array(52);
|
|
10284
10284
|
this.lifeBuffer = new Float32Array(52);
|
|
@@ -10296,10 +10296,12 @@ var FaceCompositor = class {
|
|
|
10296
10296
|
*
|
|
10297
10297
|
* @param base - A2E raw output (Float32Array[52], LAM_BLENDSHAPES order)
|
|
10298
10298
|
* @param input - Per-frame input (deltaTime, emotion, life layer params)
|
|
10299
|
-
* @
|
|
10299
|
+
* @param target - Optional pre-allocated output buffer (avoids per-frame allocation).
|
|
10300
|
+
* When omitted, an internal buffer is used (valid until next compose() call).
|
|
10301
|
+
* @returns Blendshapes (Float32Array[52] clamped [0,1]) and head rotation deltas
|
|
10300
10302
|
*/
|
|
10301
|
-
compose(base, input) {
|
|
10302
|
-
const out =
|
|
10303
|
+
compose(base, input, target) {
|
|
10304
|
+
const out = target ?? this.outputBuffer;
|
|
10303
10305
|
out.set(base);
|
|
10304
10306
|
const emotion = input.emotion ?? this.stickyEmotion;
|
|
10305
10307
|
if (emotion) {
|
|
@@ -10321,7 +10323,14 @@ var FaceCompositor = class {
|
|
|
10321
10323
|
out[i] *= 1 + this.smoothedLower[i] * bilabialSuppress;
|
|
10322
10324
|
}
|
|
10323
10325
|
}
|
|
10324
|
-
this.lifeLayer.
|
|
10326
|
+
const lifeResult = this.lifeLayer.update(input.deltaTime, input);
|
|
10327
|
+
this.lifeBuffer.fill(0);
|
|
10328
|
+
for (const [name, value] of Object.entries(lifeResult.blendshapes)) {
|
|
10329
|
+
const idx = BS_INDEX2.get(name);
|
|
10330
|
+
if (idx !== void 0) {
|
|
10331
|
+
this.lifeBuffer[idx] = value;
|
|
10332
|
+
}
|
|
10333
|
+
}
|
|
10325
10334
|
for (let i = 0; i < 52; i++) {
|
|
10326
10335
|
if (IS_EYE_CHANNEL[i]) {
|
|
10327
10336
|
out[i] = this.lifeBuffer[i];
|
|
@@ -10336,7 +10345,7 @@ var FaceCompositor = class {
|
|
|
10336
10345
|
if (out[i] < 0) out[i] = 0;
|
|
10337
10346
|
else if (out[i] > 1) out[i] = 1;
|
|
10338
10347
|
}
|
|
10339
|
-
return out;
|
|
10348
|
+
return { blendshapes: out, headDelta: lifeResult.headDelta };
|
|
10340
10349
|
}
|
|
10341
10350
|
/**
|
|
10342
10351
|
* Set sticky emotion (used when input.emotion is not provided).
|
|
@@ -10623,6 +10632,7 @@ var VoicePipeline = class extends EventEmitter {
|
|
|
10623
10632
|
new Promise((r) => setTimeout(() => r("timeout"), timeoutMs))
|
|
10624
10633
|
]);
|
|
10625
10634
|
if (lamLoadResult === "timeout") {
|
|
10635
|
+
console.error(`[VoicePipeline] LAM TIMEOUT after ${timeoutMs}ms \u2014 forcing CPU fallback`);
|
|
10626
10636
|
logger19.warn(`LAM GPU load timed out after ${timeoutMs}ms, falling back to CPU`);
|
|
10627
10637
|
await lam.dispose();
|
|
10628
10638
|
lam = createA2E({
|