Integration to a typescript mern stack web-app

#12
by Vonner - opened

When I do npm install xenova/transformers.js#v3

And add the imports
import { AutoTokenizer, MusicgenForConditionalGeneration } from '@xenova/transformers';

The "@xenova/transformers" module doesn't get resolved.

Do I have configure something else?

Hi there. Thanks for the reminder, I've updated the README to now use @huggingface/transformers, which is the new name for @xenova /transformers

Let me know if that works for you now!

Thank you, that works now.

Hello, I'm having trouble again this time I was following the source code for the Web demo.

I am trying to encode the generated audio to a wave file. But I am met with this error

Error | | Code

  • Property 'audio_encoder' does not exist on type 'PretrainedConfig'.ts(2339) -> const sampling_rate = model.config.audio_enconder.sampling_rate;

My setup is Vite and TypeScript. Do I have to configure tsconfig.json?

I tried looking at the docs but to no avail.

https://huggingface.co/docs/transformers/v4.51.3/en/main_classes/configuration#transformers.PretrainedConfig

there appears to be a typo:

- const sampling_rate = model.config.audio_enconder.sampling_rate;
+ const sampling_rate = model.config.audio_encoder.sampling_rate;

But also, you may just need to ts-ignore the type error since we don't specify all possibilities for pretrained configs currently.

Thanks for your continued responses, I was able to solve my issues before!

From my end, I notice that there is a significant delay in loading the model (4-5s) and generating the music(about 120s on average).
When I test the same parameters in your demo, I see that the demo is about 1.5x faster than mine. And that the progress bar updates during music generation. Why is that?

When using this model is there any configurations I can do from my end(code?)?

I run this via npm run dev

Your need to confirm your account before you can post a new comment.

Sign up or log in to comment