@try-works/tool-mode-runtime-onnx 0.1.0 → 0.1.1
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.
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"clear-processor.d.ts","sourceRoot":"","sources":["../src/clear-processor.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AAmBH,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,gBAAgB,CAAA;AAEzD,sDAAsD;AACtD,eAAO,MAAM,oBAAoB,kBAAkB,CAAA;AAUnD,0DAA0D;AAC1D,MAAM,WAAW,YAAY;IAC3B,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAA;IACrB,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAA;IACxB,QAAQ,CAAC,QAAQ,EAAE,MAAM,CAAA;IACzB,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAA;CACxB;AAED;;;;GAIG;AACH,wBAAgB,cAAc,IAAI,mBAAmB,CAAC,IAAI,EAAE,YAAY,CAAC,
|
|
1
|
+
{"version":3,"file":"clear-processor.d.ts","sourceRoot":"","sources":["../src/clear-processor.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AAmBH,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,gBAAgB,CAAA;AAEzD,sDAAsD;AACtD,eAAO,MAAM,oBAAoB,kBAAkB,CAAA;AAUnD,0DAA0D;AAC1D,MAAM,WAAW,YAAY;IAC3B,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAA;IACrB,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAA;IACxB,QAAQ,CAAC,QAAQ,EAAE,MAAM,CAAA;IACzB,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAA;CACxB;AAED;;;;GAIG;AACH,wBAAgB,cAAc,IAAI,mBAAmB,CAAC,IAAI,EAAE,YAAY,CAAC,CAsJxE"}
|
package/lib/clear-processor.js
CHANGED
|
@@ -53,18 +53,18 @@ export function clearProcessor() {
|
|
|
53
53
|
invoke: (request) => Effect.gen(function* () {
|
|
54
54
|
const audio = request.audio.samples;
|
|
55
55
|
if (audio.length === 0) {
|
|
56
|
-
return yield*
|
|
56
|
+
return yield* new InvalidInput({ field: 'audio_path', message: 'the audio has no samples to enhance' });
|
|
57
57
|
}
|
|
58
58
|
// Bound the work by the HOST's result budget, not by an invented fixed duration:
|
|
59
59
|
// base64 is 4/3 of the WAV, and the response must serialize within maxResultBytes.
|
|
60
60
|
const maxSamples = maxSamplesForResultBudget(request.context.limits.maxResultBytes);
|
|
61
61
|
if (maxSamples < 1) {
|
|
62
|
-
return yield*
|
|
62
|
+
return yield* new InvalidInput({
|
|
63
63
|
field: 'input',
|
|
64
64
|
message: 'the host result budget of '
|
|
65
65
|
+ String(request.context.limits.maxResultBytes)
|
|
66
66
|
+ ' bytes cannot hold an enhanced WAV',
|
|
67
|
-
})
|
|
67
|
+
});
|
|
68
68
|
}
|
|
69
69
|
const processedSamples = Math.min(audio.length, maxSamples);
|
|
70
70
|
const stft = new ClearStft();
|
|
@@ -100,26 +100,26 @@ export function clearProcessor() {
|
|
|
100
100
|
});
|
|
101
101
|
const output = outputs[request.binding.output];
|
|
102
102
|
if (output === undefined) {
|
|
103
|
-
return yield*
|
|
103
|
+
return yield* new InferenceFailed({
|
|
104
104
|
provider: PROVIDER,
|
|
105
105
|
phase: 'post',
|
|
106
106
|
message: 'the graph produced no output named ' + JSON.stringify(request.binding.output),
|
|
107
|
-
})
|
|
107
|
+
});
|
|
108
108
|
}
|
|
109
109
|
if (!(output.data instanceof Float32Array)) {
|
|
110
|
-
return yield*
|
|
110
|
+
return yield* new InferenceFailed({
|
|
111
111
|
provider: PROVIDER,
|
|
112
112
|
phase: 'post',
|
|
113
113
|
message: 'the graph output ' + JSON.stringify(request.binding.output) + ' is not a float32 tensor',
|
|
114
|
-
})
|
|
114
|
+
});
|
|
115
115
|
}
|
|
116
116
|
if (output.data.length < CLEAR_CHUNK_FRAMES * CLEAR_N_FREQ * 2) {
|
|
117
|
-
return yield*
|
|
117
|
+
return yield* new InferenceFailed({
|
|
118
118
|
provider: PROVIDER,
|
|
119
119
|
phase: 'post',
|
|
120
120
|
message: 'the graph output ' + JSON.stringify(request.binding.output) + ' has '
|
|
121
121
|
+ String(output.data.length) + ' values; a full window needs ' + String(CLEAR_CHUNK_FRAMES * CLEAR_N_FREQ * 2),
|
|
122
|
-
})
|
|
122
|
+
});
|
|
123
123
|
}
|
|
124
124
|
scatterEnhanced({
|
|
125
125
|
enhanced: output.data,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"uhm-processor.d.ts","sourceRoot":"","sources":["../src/uhm-processor.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAiBH,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,gBAAgB,CAAA;AAGzD,sDAAsD;AACtD,eAAO,MAAM,sBAAsB,oBAAoB,CAAA;AAIvD,0DAA0D;AAC1D,MAAM,WAAW,UAAU;IACzB,QAAQ,CAAC,SAAS,EAAE,MAAM,CAAA;IAC1B,QAAQ,CAAC,UAAU,EAAE,MAAM,CAAA;CAC5B;AAoDD;;;;GAIG;AACH,wBAAgB,YAAY,IAAI,mBAAmB,CAAC,SAAS,MAAM,EAAE,EAAE,UAAU,CAAC,
|
|
1
|
+
{"version":3,"file":"uhm-processor.d.ts","sourceRoot":"","sources":["../src/uhm-processor.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAiBH,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,gBAAgB,CAAA;AAGzD,sDAAsD;AACtD,eAAO,MAAM,sBAAsB,oBAAoB,CAAA;AAIvD,0DAA0D;AAC1D,MAAM,WAAW,UAAU;IACzB,QAAQ,CAAC,SAAS,EAAE,MAAM,CAAA;IAC1B,QAAQ,CAAC,UAAU,EAAE,MAAM,CAAA;CAC5B;AAoDD;;;;GAIG;AACH,wBAAgB,YAAY,IAAI,mBAAmB,CAAC,SAAS,MAAM,EAAE,EAAE,UAAU,CAAC,CAsDjF"}
|
package/lib/uhm-processor.js
CHANGED
|
@@ -101,18 +101,18 @@ export function uhmProcessor() {
|
|
|
101
101
|
});
|
|
102
102
|
const output = outputs[request.binding.outputName];
|
|
103
103
|
if (output === undefined) {
|
|
104
|
-
return yield*
|
|
104
|
+
return yield* new InferenceFailed({
|
|
105
105
|
provider: PROVIDER,
|
|
106
106
|
phase: 'post',
|
|
107
107
|
message: 'the graph produced no output named ' + JSON.stringify(request.binding.outputName),
|
|
108
|
-
})
|
|
108
|
+
});
|
|
109
109
|
}
|
|
110
110
|
if (!(output.data instanceof Float32Array)) {
|
|
111
|
-
return yield*
|
|
111
|
+
return yield* new InferenceFailed({
|
|
112
112
|
provider: PROVIDER,
|
|
113
113
|
phase: 'post',
|
|
114
114
|
message: 'the graph output ' + JSON.stringify(request.binding.outputName) + ' is not a float32 tensor',
|
|
115
|
-
})
|
|
115
|
+
});
|
|
116
116
|
}
|
|
117
117
|
runs.push({ window, data: output.data, dims: output.dims });
|
|
118
118
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@try-works/tool-mode-runtime-onnx",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.1",
|
|
4
4
|
"description": "ONNX Runtime engine for Tool Mode: an Effect OnnxSession with execution-provider negotiation and the uhm/waveform-v1 filler processor",
|
|
5
5
|
"license": "Apache-2.0",
|
|
6
6
|
"publishConfig": {
|
|
@@ -30,7 +30,7 @@
|
|
|
30
30
|
],
|
|
31
31
|
"dependencies": {
|
|
32
32
|
"@try-works/tool-mode-extension-sdk": "0.1.0",
|
|
33
|
-
"@try-works/tool-mode-runtime-core": "0.1.
|
|
33
|
+
"@try-works/tool-mode-runtime-core": "0.1.1",
|
|
34
34
|
"@try-works/tool-mode-runtime-recipes": "0.1.0",
|
|
35
35
|
"onnxruntime-node": "1.30.0"
|
|
36
36
|
},
|