No Moondream1ForConditionalGeneration export.

#7
by Tsardoz - opened

SyntaxError: The requested module '@xenova/transformers' does not provide an export named 'Moondream1ForConditionalGeneration'

Have I done something wrong? I am pretty new to this and just followed the guide provided.
Node.js v18.20.3

Perhaps it's Moondream2?

Thanks. I should have added I ran this

import * as Transformers from '@xenova/transformers';
console.log(Transformers);

which listed a ton bt none starting with moon

node inspect.mjs | grep moon*

nothing. Even with Moon not moon.

Owner

Can you please check which version of Transformers.js you are running? As stated in the README, moondream2 requires you to install transformers.js from the v3 development branch.

npm install xenova/transformers.js#v3

OK I must have installed the wrong version. I now have the correct version installed I hope.

tsardoz@tsardoz-X670-AORUS-ELITE-AX:~/moondreamONNX$ npm list 

@xenova

	/transformers
moondreamonnx@1.0.0 /home/tsardoz/moondreamONNX
└── 

@xenova

	/transformers@3.0.0-alpha.0 (git+ssh://git@github.com/xenova/transformers.js.git#dce32670bdee993975afb098b1b4f7f84a1d4698)

but I get a different error:

tsardoz@tsardoz-X670-AORUS-ELITE-AX:~/moondreamONNX$ node index.mjs
node:internal/errors:496
    ErrorCaptureStackTrace(err);
    ^

Error [ERR_PACKAGE_PATH_NOT_EXPORTED]: Package subpath './webgpu' is not defined by "exports" in /home/tsardoz/moondreamONNX/node_modules/onnxruntime-web/package.json imported from /home/tsardoz/moondreamONNX/node_modules/@xenova/transformers/src/backends/onnx.js
    at new NodeError (node:internal/errors:405:5)
    at exportsNotFound (node:internal/modules/esm/resolve:366:10)
    at packageExportsResolve (node:internal/modules/esm/resolve:656:13)
    at packageResolve (node:internal/modules/esm/resolve:899:14)
    at moduleResolve (node:internal/modules/esm/resolve:973:20)
    at defaultResolve (node:internal/modules/esm/resolve:1193:11)
    at ModuleLoader.defaultResolve (node:internal/modules/esm/loader:404:12)
    at ModuleLoader.resolve (node:internal/modules/esm/loader:373:25)
    at ModuleLoader.getModuleJob (node:internal/modules/esm/loader:250:38)
    at ModuleWrap.<anonymous> (node:internal/modules/esm/module_job:76:39) {
  code: 'ERR_PACKAGE_PATH_NOT_EXPORTED'
}

Node.js v18.20.3

It seems you're trying to run it in Node.js. I'm guessing that's not supported yet? The demo is in the browser after all.

Owner

Right, WebGPU isn't yet supported in Node.js, but a better error message would be nice.

Correct. That is what I was trying to do. Thanks for the clarification.
I am not very familiar with the way javascript works.

Can you please check which version of Transformers.js you are running? As stated in the README, moondream2 requires you to install transformers.js from the v3 development branch.

npm install xenova/transformers.js#v3

Glad to see v3 is coming!

But when I tried to install v3, I got an error "no matches found: xenova/transformers.js#v3".
Did I install it incorrectly? Or something I missed?

git clone -b v3 https://github.com/xenova/transformers.js.git
cd transformers.js
npm i; npm run build

it will generate into a subfolder called dist

git clone -b v3 https://github.com/xenova/transformers.js.git
cd transformers.js
npm i; npm run build

it will generate into a subfolder called dist

Got it. Appreciate it.

Sign up or log in to comment