mirror of https://github.com/vladmandic/human
add config option wasmPlatformFetch
parent
7ce0aaf8b4
commit
51246d43f8
|
@ -9,7 +9,10 @@
|
||||||
|
|
||||||
## Changelog
|
## Changelog
|
||||||
|
|
||||||
### **HEAD -> main** 2022/02/07 mandic00@live.com
|
### **2.6.3** 2022/02/10 mandic00@live.com
|
||||||
|
|
||||||
|
|
||||||
|
### **origin/main** 2022/02/10 mandic00@live.com
|
||||||
|
|
||||||
|
|
||||||
### **2.6.2** 2022/02/07 mandic00@live.com
|
### **2.6.2** 2022/02/07 mandic00@live.com
|
||||||
|
|
|
@ -221,6 +221,12 @@ export interface Config {
|
||||||
*/
|
*/
|
||||||
wasmPath: string,
|
wasmPath: string,
|
||||||
|
|
||||||
|
/** Force WASM loader to use platform fetch
|
||||||
|
*
|
||||||
|
* default: auto-detects to link to CDN `jsdelivr` when running in browser
|
||||||
|
*/
|
||||||
|
wasmPlatformFetch: false,
|
||||||
|
|
||||||
/** Print debug statements to console
|
/** Print debug statements to console
|
||||||
*
|
*
|
||||||
* default: `true`
|
* default: `true`
|
||||||
|
@ -295,6 +301,7 @@ const config: Config = {
|
||||||
modelBasePath: '',
|
modelBasePath: '',
|
||||||
cacheModels: true,
|
cacheModels: true,
|
||||||
wasmPath: '',
|
wasmPath: '',
|
||||||
|
wasmPlatformFetch: false,
|
||||||
debug: true,
|
debug: true,
|
||||||
async: true,
|
async: true,
|
||||||
warmup: 'full',
|
warmup: 'full',
|
||||||
|
|
|
@ -77,7 +77,7 @@ export async function check(instance: Human, force = false) {
|
||||||
// customize wasm
|
// customize wasm
|
||||||
if (instance.config.backend === 'wasm') {
|
if (instance.config.backend === 'wasm') {
|
||||||
if (instance.config.debug) log('wasm path:', instance.config.wasmPath);
|
if (instance.config.debug) log('wasm path:', instance.config.wasmPath);
|
||||||
if (typeof tf?.setWasmPaths !== 'undefined') await tf.setWasmPaths(instance.config.wasmPath);
|
if (typeof tf?.setWasmPaths !== 'undefined') await tf.setWasmPaths(instance.config.wasmPath, instance.config.wasmPlatformFetch);
|
||||||
else throw new Error('backend error: attempting to use wasm backend but wasm path is not set');
|
else throw new Error('backend error: attempting to use wasm backend but wasm path is not set');
|
||||||
const simd = await tf.env().getAsync('WASM_HAS_SIMD_SUPPORT');
|
const simd = await tf.env().getAsync('WASM_HAS_SIMD_SUPPORT');
|
||||||
const mt = await tf.env().getAsync('WASM_HAS_MULTITHREAD_SUPPORT');
|
const mt = await tf.env().getAsync('WASM_HAS_MULTITHREAD_SUPPORT');
|
||||||
|
|
|
@ -167,6 +167,11 @@ export declare interface Config {
|
||||||
* default: auto-detects to link to CDN `jsdelivr` when running in browser
|
* default: auto-detects to link to CDN `jsdelivr` when running in browser
|
||||||
*/
|
*/
|
||||||
wasmPath: string;
|
wasmPath: string;
|
||||||
|
/** Force WASM loader to use platform fetch
|
||||||
|
*
|
||||||
|
* default: auto-detects to link to CDN `jsdelivr` when running in browser
|
||||||
|
*/
|
||||||
|
wasmPlatformFetch: false;
|
||||||
/** Print debug statements to console
|
/** Print debug statements to console
|
||||||
*
|
*
|
||||||
* default: `true`
|
* default: `true`
|
||||||
|
|
Loading…
Reference in New Issue