Open marcfrankel opened 1 year ago
Thanks, just had a look and found some informations i can tell:
deno info https://esm.sh/@xenova/transformers
use the denonext
target that includes urls https://esm.sh/v131/sharp@0.32.4/denonext/sharp.mjs
and https://esm.sh/v131/onnxruntime-node@1.14.0/denonext/onnxruntime-node.mjs
that are trying to import *.node
( node native module) this is not been supported by esm.sh in Deno. (this is one of the reasons why deno starts to support npm:
specifier instead of CDN)deno info https://esm.sh/@xenova/transformers?target=esnext
use onnxruntime-web
that meets the "TypeError: __Process$.hrtime is not a function"
error.i'm going to add the hrtime
method for the process polyfill may fix situation 2, for situation 1 currently there is nothing i can do.
Thanks for checking this out for me so fast. If I'm understanding you then you're saying to wait until you add the polyfill for hrtime and then option 2 may work?
Thanks for checking this out for me so fast. If I'm understanding you then you're saying to wait until you add the polyfill for hrtime and then option 2 may work?
right
for now if you just want the types, you can use the deno-types
:
// @deno-types="https://esm.sh/v131/@xenova/transformers@2.5.2/types/transformers.d.ts"
import { env, pipeline } from "https://unpkg.com/@xenova/transformers@2.5.2";
for now if you just want the types, you can use the
deno-types
:// @deno-types="https://esm.sh/v131/@xenova/transformers@2.5.2/types/transformers.d.ts" import { env, pipeline } from "https://unpkg.com/@xenova/transformers@2.5.2";
Oh my god you're my hero! I tried to get this working for like three hours yesterday!! Using that setup does give me both types and a working form of the package
Failing module
Error message
After running
deno run
I got this:Additional info
This started from trying to change the Deno import URL from jsdilvr.net to esm.sh since the jsdilvr on doesn't supply types, but esm.sh does. Code is from https://supabase.com/docs/guides/ai/quickstarts/generate-text-embeddings. They announced this as a new feature during their launch week last week.
From my research is seems to have to do with the underlying package onnxruntime-web vs onnxruntime-node
Results of deno info