Instructions to use Mike0021/MiniCPM5-1B-ONNX-Web with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers.js
How to use Mike0021/MiniCPM5-1B-ONNX-Web with Transformers.js:
// npm i @huggingface/transformers import { pipeline } from '@huggingface/transformers'; // Allocate pipeline const pipe = await pipeline('text-generation', 'Mike0021/MiniCPM5-1B-ONNX-Web');
File size: 1,058 Bytes
b2e7e17 | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 | ---
license: apache-2.0
library_name: transformers.js
pipeline_tag: text-generation
base_model: openbmb/MiniCPM5-1B
tags:
- transformers.js
- onnx
- onnxruntime-web
- llama
- minicpm5
- text-generation
- browser
- webgpu
---
# MiniCPM5-1B ONNX Web
Transformers.js q4 ONNX export of `openbmb/MiniCPM5-1B` for browser text generation.
## Files
- `onnx/model_q4.onnx`: ONNX Runtime 4-bit MatMul quantized decoder with KV cache.
- `config.json`: includes `transformers.js_config.dtype = "q4"` so Transformers.js loads the q4 artifact by default.
- tokenizer and generation config files copied from the source model export.
## Usage
```js
import { pipeline } from "@huggingface/transformers";
const generator = await pipeline("text-generation", "Mike0021/MiniCPM5-1B-ONNX-Web", {
dtype: "q4",
device: "webgpu",
});
const output = await generator("Briefly introduce yourself.", {
max_new_tokens: 64,
temperature: 0.2,
do_sample: true,
});
console.log(output[0].generated_text);
```
If WebGPU is unavailable, use `device: "wasm"` in the browser.
|