--- library_name: "transformers.js" tags: - mms - feature-extraction --- https://huggingface.co/facebook/mms-300m with ONNX weights to be compatible with Transformers.js. ## Usage (Transformers.js) If you haven't already, you can install the [Transformers.js](https://huggingface.co/docs/transformers.js) JavaScript library from [NPM](https://www.npmjs.com/package/@xenova/transformers) using: ```bash npm i @xenova/transformers ``` **Example:** Load and run a `Wav2Vec2Model` for feature extraction. ```js import { AutoProcessor, AutoModel, read_audio } from '@xenova/transformers'; // Read and preprocess audio const processor = await AutoProcessor.from_pretrained('Xenova/mms-300m'); const audio = await read_audio('https://huggingface.co/datasets/Narsil/asr_dummy/resolve/main/mlk.flac', 16000); const inputs = await processor(audio); // Run model with inputs const model = await AutoModel.from_pretrained('Xenova/mms-300m'); const output = await model(inputs); // { // last_hidden_state: Tensor { // dims: [ 1, 1144, 1024 ], // type: 'float32', // data: Float32Array(1171456) [ ... ], // size: 1171456 // } // } ``` --- Note: Having a separate repo for ONNX weights is intended to be a temporary solution until WebML gains more traction. If you would like to make your models web-ready, we recommend converting to ONNX using [🤗 Optimum](https://huggingface.co/docs/optimum/index) and structuring your repo like this one (with ONNX weights located in a subfolder named `onnx`).