Closed
Description
System Info
deno 2.2.9
https://cdn.jsdelivr.net/npm/@huggingface/transformers
Windows 11
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
I have seen the issue #741
It didn't help at all.
My code:
import {
env,
pipeline,
} from "https://cdn.jsdelivr.net/npm/@huggingface/transformers";
// Preparation for Deno runtime
env.useBrowserCache = false;
env.allowLocalModels = false;
export const test= async (text: string) => {
const answerer = await pipeline(
"question-answering",
"Xenova/distilbert-base-uncased-distilled-squad"
);
const question = "Who's a nice puppet?";
const context = "Jim Henson was a nice puppet.";
const output = await answerer(question, context);
return output;
};
I followed multiple tutorials including this one
https://supabase.com/blog/hugging-face-supabase
that says edge functions and deno support the transformers.js library
I successfully made the same code work with node but I can't make it work with deno or with the supabase edge function
I have the error
error: TypeError: Cannot read properties of undefined (reading 'create')
at _ (https://cdn.jsdelivr.net/npm/@huggingface/transformers:1:454916)
at https://cdn.jsdelivr.net/npm/@huggingface/transformers:1:507508
at eventLoopTick (ext:core/01_core.js:178:7)
at async Promise.all (index 0)
at async L (https://cdn.jsdelivr.net/npm/@huggingface/transformers:1:504311)
at async Promise.all (index 0)
at async st.from_pretrained (https://cdn.jsdelivr.net/npm/@huggingface/transformers:1:518423)
at async pu.from_pretrained (https://cdn.jsdelivr.net/npm/@huggingface/transformers:1:563218)
at async Promise.all (index 1)
at async https://cdn.jsdelivr.net/npm/@huggingface/transformers:1:670826
Reproduction
- Create deno app
- Run the function test
- Enjoy the error