🐛 fixes for transformers.js compatibility

This commit is contained in:
Nate Sesti 2024-05-11 16:19:06 -07:00
parent 31226a31cc
commit 2cac5c8fc1
4 changed files with 6 additions and 7 deletions

View file

@ -2,7 +2,7 @@ import {
PipelineType,
env,
pipeline,
} from "../../vendor/modules/@xenova/transformers";
} from "../../vendor/modules/@xenova/transformers/src/transformers";
import path from "path";
import BaseEmbeddingsProvider from "./BaseEmbeddingsProvider";

View file

@ -18,6 +18,6 @@
"noEmitOnError": false,
"types": ["jest", "node"]
},
"include": ["./**/*.ts", "./**/*.js"],
"include": ["./**/*.ts", "./**/*.js", "./**/*.d.ts"],
"exclude": ["test", "dist"]
}

View file

@ -20,6 +20,6 @@
"declaration": true,
"declarationMap": true
},
"include": ["./**/*.ts", "**/*.js"],
"include": ["./**/*.ts", "**/*.js", "./**/*.d.ts"],
"exclude": ["test", "dist"]
}

View file

@ -24,7 +24,6 @@
import fs from 'fs';
import path from 'path';
import url from 'url';
import { ONNX } from './backends/onnx.js';
const { env: onnx_env } = ONNX;
@ -38,9 +37,9 @@ const PATH_AVAILABLE = !isEmpty(path); // check if path is available
const RUNNING_LOCALLY = FS_AVAILABLE && PATH_AVAILABLE;
const __dirname = RUNNING_LOCALLY
? path.dirname(path.dirname(url.fileURLToPath(import.meta.url)))
: './';
// const __dirname = RUNNING_LOCALLY
// ? path.dirname(path.dirname(url.fileURLToPath(import.meta.url)))
// : './';
// Only used for environments with access to file system
const DEFAULT_CACHE_DIR = RUNNING_LOCALLY