Transformers.js 3.0.1
running in node 18 using CommonJS
Environment/Platform
[ ] Website/web-app
[ ] Browser extension
[X] Server-side (e.g., Node.js, Deno, Bun)
[ ] Desktop app (e.g., Electron)
[ ] Other (e.g., VSCode extension)
Description
When using transformers.js in a common-js based node application, I'm running into an error message when loading a model. It cannot be written to a local cache.
The reason for this is that somehow the file transformers.cjs has the default path to the cache directory hard-coded to an absolute directory path in DEFAULT_CACHE_DIR, it's set to this path: /home/runner/work/transformers.js/transformers.js/.cache/.
Hi there! Thanks for the report. This seems to be an issue with our webpack setup for building the project in GitHub actions (hence the name). Will look into this.
System Info
Transformers.js 3.0.1 running in node 18 using CommonJS
Environment/Platform
Description
When using transformers.js in a common-js based node application, I'm running into an error message when loading a model. It cannot be written to a local cache.
The reason for this is that somehow the file
transformers.cjs
has the default path to the cache directory hard-coded to an absolute directory path inDEFAULT_CACHE_DIR
, it's set to this path:/home/runner/work/transformers.js/transformers.js/.cache/
.Reproduction
Getting this error message:
The same error does not happen when using the dynamic import instead.
That's because in that case
transformers.mjs
is used instead oftransformers.cjs
and the former does not have the cache path hard-coded