Allow WASM threading for non-Android. Fix eslint for transformers.mjs

c3d04066bc75a045b9ce0ba645dde59a5c8e2040

Cohee <18619528+Cohee1207@users.noreply.github.com>

2 files changed, +11 -3Ignore whitespace
.eslintrc.js+9 -0
@@ -18,6 +18,15 @@ module.exports = {
1818 },
1919 },
2020 {
21+ files: ['src/**/*.mjs'],
22+ parserOptions: {
23+ sourceType: 'module',
24+ },
25+ env: {
26+ node: true,
27+ },
28+ },
29+ {
2130 // Browser-side files
2231 files: ['public/**/*.js'],
2332 env: {
src/transformers.mjs+2 -3
@@ -1,13 +1,12 @@
11import { pipeline, env, RawImage, Pipeline } from 'sillytavern-transformers';
22import { getConfigValue } from './util.js';
33import path from 'path';
4-import _ from 'lodash';
54
65configureTransformers();
76
87function configureTransformers() {
98 // Limit the number of threads to 1 to avoid issues on Android
109 env.backends.onnx.wasm.numThreads = process.platform === 'android' ? 1 : 0;
1110 // Use WASM from a local folder to avoid CDN connections
1211 env.backends.onnx.wasm.wasmPaths = path.join(process.cwd(), 'dist') + path.sep;
1312}
@@ -114,4 +113,4 @@ async function getPipeline(task, forceModel = '') {
114113export default {
115114 getPipeline,
116115 getRawImage,
117116};