Allow WASM threading for non-Android. Fix eslint for transformers.mjs
| @@ -18,6 +18,15 @@ module.exports = { | ||
| 18 | 18 | }, |
| 19 | 19 | }, |
| 20 | 20 | { |
| 21 | + files: ['src/**/*.mjs'], | |
| 22 | + parserOptions: { | |
| 23 | + sourceType: 'module', | |
| 24 | + }, | |
| 25 | + env: { | |
| 26 | + node: true, | |
| 27 | + }, | |
| 28 | + }, | |
| 29 | + { | |
| 21 | 30 | // Browser-side files |
| 22 | 31 | files: ['public/**/*.js'], |
| 23 | 32 | env: { |
| @@ -1,13 +1,12 @@ | ||
| 1 | 1 | import { pipeline, env, RawImage, Pipeline } from 'sillytavern-transformers'; |
| 2 | 2 | import { getConfigValue } from './util.js'; |
| 3 | 3 | import path from 'path'; |
| 4 | -import _ from 'lodash'; | |
| 5 | 4 | |
| 6 | 5 | configureTransformers(); |
| 7 | 6 | |
| 8 | 7 | function configureTransformers() { |
| 9 | 8 | // Limit the number of threads to 1 to avoid issues on Android |
| 10 | 9 | env.backends.onnx.wasm.numThreads = process.platform === 'android' ? 1 : 0; |
| 11 | 10 | // Use WASM from a local folder to avoid CDN connections |
| 12 | 11 | env.backends.onnx.wasm.wasmPaths = path.join(process.cwd(), 'dist') + path.sep; |
| 13 | 12 | } |
| @@ -114,4 +113,4 @@ async function getPipeline(task, forceModel = '') { | ||
| 114 | 113 | export default { |
| 115 | 114 | getPipeline, |
| 116 | 115 | getRawImage, |
| 117 | 116 | }; |