Allow WASM threading for non-Android. Fix eslint for transformers.mjs
This commit is contained in:
parent
921297f1e5
commit
c3d04066bc
|
@ -17,6 +17,15 @@ module.exports = {
|
|||
node: true,
|
||||
},
|
||||
},
|
||||
{
|
||||
files: ['src/**/*.mjs'],
|
||||
parserOptions: {
|
||||
sourceType: 'module',
|
||||
},
|
||||
env: {
|
||||
node: true,
|
||||
},
|
||||
},
|
||||
{
|
||||
// Browser-side files
|
||||
files: ['public/**/*.js'],
|
||||
|
|
|
@ -1,13 +1,12 @@
|
|||
import { pipeline, env, RawImage, Pipeline } from 'sillytavern-transformers';
|
||||
import { getConfigValue } from './util.js';
|
||||
import path from 'path';
|
||||
import _ from 'lodash';
|
||||
|
||||
configureTransformers();
|
||||
|
||||
function configureTransformers() {
|
||||
// Limit the number of threads to 1 to avoid issues on Android
|
||||
env.backends.onnx.wasm.numThreads = 1;
|
||||
env.backends.onnx.wasm.numThreads = process.platform === 'android' ? 1 : 0;
|
||||
// Use WASM from a local folder to avoid CDN connections
|
||||
env.backends.onnx.wasm.wasmPaths = path.join(process.cwd(), 'dist') + path.sep;
|
||||
}
|
||||
|
@ -114,4 +113,4 @@ async function getPipeline(task, forceModel = '') {
|
|||
export default {
|
||||
getPipeline,
|
||||
getRawImage,
|
||||
}
|
||||
};
|
||||
|
|
Loading…
Reference in New Issue