-
Notifications
You must be signed in to change notification settings - Fork 1k
Closed
Labels
bugSomething isn't workingSomething isn't working
Description
System Info
Transformers.js 3.0.1
running in node 18 using CommonJS
Environment/Platform
- Website/web-app
- Browser extension
- 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/.
Reproduction
import { pipeline } from '@huggingface/transformers';
const pipe = await pipeline('zero-shot-classification', 'MoritzLaurer/mDeBERTa-v3-base-xnli-multilingual-nli-2mil7', { dtype: 'q8'});
Getting this error message:
errno: -2,
code: 'ENOENT',
syscall: 'mkdir',
path: '/home/runner'
}
The same error does not happen when using the dynamic import instead.
const pipeline = (await import('@huggingface/transformers')).pipeline;
That's because in that case transformers.mjs is used instead of transformers.cjs and the former does not have the cache path hard-coded
Metadata
Metadata
Assignees
Labels
bugSomething isn't workingSomething isn't working