xenova / transformers.js

State-of-the-art Machine Learning for the web. Run 🤗 Transformers directly in your browser, with no need for a server!
https://huggingface.co/docs/transformers.js
Apache License 2.0
10.87k stars 658 forks source link

Error running `Xenova/discogs-maest-30s-pw-73e-ts` #868

Open jca41 opened 1 month ago

jca41 commented 1 month ago

System Info

MacOS, client rendered Svelte app.

Environment/Platform

Description

Hi, i'm facing an error when trying to use Xenova/discogs-maest-30s-pw-73e-ts

Uncaught (in promise) Error: Could not locate file: "https://huggingface.co/Xenova/discogs-maest-30s-pw-73e-ts/resolve/main/preprocessor_config.json

The error is returned while creating the pipeline.

this.pipeline = await pipeline('audio-classification', 'Xenova/discogs-maest-30s-pw-73e-ts');

// run the model

const result = await this.pipeline!(this.createAudioURL());

Not really sure if it's user error or an actual bug with the uploaded model

Reproduction

this.pipeline = await pipeline('audio-classification', 'Xenova/discogs-maest-30s-pw-73e-ts');

// run the model

const result = await this.pipeline!(this.createAudioURL());

Expect not to see an error when creating the pipeline

xenova commented 1 month ago

Hi there 👋 Indeed, this is because they are using a custom feature extractor/preprocessor, which we haven't added to Transformers.js yet. From what I can tell, though, this doesn't look too difficult to add support for. Is this something you'd be interested in working on?

jca41 commented 1 month ago

Hey, thanks for the quick reply! Have no experience on this stuff but I'll give it a try 😊 I can see there's a numpy equivalent for JavaScript, that seems to be the hard part of this task

xenova commented 1 month ago

You shouldn't actually even need that (and it would be preferred if you didn't since it would introduce a huge dependency)! Take a look at the existing ASTFeatureExtractor. Most of what you need should be done already:

https://github.com/xenova/transformers.js/blob/7f5081da29c3f77ee830269ab801344776e61bcb/src/processors.js#L1769-L1856