Skip to content

TypeError: Cannot read properties of undefined (reading 'create') #1332

Closed
@A-Ghattas

Description

@A-Ghattas

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

  1. Create deno app
  2. Run the function test
  3. Enjoy the error

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

      pFad - Phonifier reborn

      Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

      Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


      Alternative Proxies:

      Alternative Proxy

      pFad Proxy

      pFad v3 Proxy

      pFad v4 Proxy