Add/update the quantized ONNX model files and README.md for Transformers.js v3
Browse files## Applied Quantizations
### ❌ Based on `model.onnx` *with* slimming
```
None
```
↳ ❌ `q4f16`: `model_q4f16.onnx` (added but JS-based E2E test failed)
```
file:///home/ubuntu/src/tjsmigration/node_modules/.pnpm/@[email protected]/node_modules/@huggingface/transformers/dist/transformers.node.mjs:30853
throw Error(`\`local_files_only=true\` or \`env.allowRemoteModels=false\` and file was not found locally at "${localPath}".`);
^
Error: `local_files_only=true` or `env.allowRemoteModels=false` and file was not found locally at "/tmp/tmpq0kkv6l3/4fc37fa2e014be6ed7aa0f59139f2aaf5b7ef714/tokenizer.json".
at getModelFile (file:///home/ubuntu/src/tjsmigration/node_modules/.pnpm/@[email protected]/node_modules/@huggingface/transformers/dist/transformers.node.mjs:30853:27)
at async getModelJSON (file:///home/ubuntu/src/tjsmigration/node_modules/.pnpm/@[email protected]/node_modules/@huggingface/transformers/dist/transformers.node.mjs:30997:20)
at async Promise.all (index 0)
at async loadTokenizer (file:///home/ubuntu/src/tjsmigration/node_modules/.pnpm/@[email protected]/node_modules/@huggingface/transformers/dist/transformers.node.mjs:24010:18)
at async AutoTokenizer.from_pretrained (file:///home/ubuntu/src/tjsmigration/node_modules/.pnpm/@[email protected]/node_modules/@huggingface/transformers/dist/transformers.node.mjs:28351:50)
at async Promise.all (index 0)
at async loadItems (file:///home/ubuntu/src/tjsmigration/node_modules/.pnpm/@[email protected]/node_modules/@huggingface/transformers/dist/transformers.node.mjs:23881:5)
at async pipeline (file:///home/ubuntu/src/tjsmigration/node_modules/.pnpm/@[email protected]/node_modules/@huggingface/transformers/dist/transformers.node.mjs:23811:21)
at async file:///home/ubuntu/src/tjsmigration/src/[eval1]:8:15
Node.js v22.16.0
```
@@ -9,15 +9,15 @@ YOLOv8s-pose with ONNX weights to be compatible with Transformers.js.
|
|
9 |
|
10 |
## Usage (Transformers.js)
|
11 |
|
12 |
-
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/@
|
13 |
```bash
|
14 |
-
npm i @
|
15 |
```
|
16 |
|
17 |
**Example:** Perform pose-estimation w/ `Xenova/yolov8s-pose`.
|
18 |
|
19 |
```js
|
20 |
-
import { AutoModel, AutoProcessor, RawImage } from '@
|
21 |
|
22 |
// Load model and processor
|
23 |
const model_id = 'Xenova/yolov8s-pose';
|
@@ -57,7 +57,7 @@ for (const [xc, yc, w, h, score, ...keypoints] of permuted.tolist()) {
|
|
57 |
const y1 = (yc - h / 2) / scaledHeight * image.height;
|
58 |
const x2 = (xc + w / 2) / scaledWidth * image.width;
|
59 |
const y2 = (yc + h / 2) / scaledHeight * image.height;
|
60 |
-
results.push({ x1, x2, y1, y2, score, keypoints })
|
61 |
}
|
62 |
|
63 |
|
@@ -108,7 +108,7 @@ const filteredResults = removeDuplicates(results, iouThreshold);
|
|
108 |
|
109 |
// Display results
|
110 |
for (const { x1, x2, y1, y2, score, keypoints } of filteredResults) {
|
111 |
-
console.log(`Found person at [${x1}, ${y1}, ${x2}, ${y2}] with score ${score.toFixed(3)}`)
|
112 |
for (let i = 0; i < keypoints.length; i += 3) {
|
113 |
const label = model.config.id2label[Math.floor(i / 3)];
|
114 |
const [x, y, point_score] = keypoints.slice(i, i + 3);
|
|
|
9 |
|
10 |
## Usage (Transformers.js)
|
11 |
|
12 |
+
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/@huggingface/transformers) using:
|
13 |
```bash
|
14 |
+
npm i @huggingface/transformers
|
15 |
```
|
16 |
|
17 |
**Example:** Perform pose-estimation w/ `Xenova/yolov8s-pose`.
|
18 |
|
19 |
```js
|
20 |
+
import { AutoModel, AutoProcessor, RawImage } from '@huggingface/transformers';
|
21 |
|
22 |
// Load model and processor
|
23 |
const model_id = 'Xenova/yolov8s-pose';
|
|
|
57 |
const y1 = (yc - h / 2) / scaledHeight * image.height;
|
58 |
const x2 = (xc + w / 2) / scaledWidth * image.width;
|
59 |
const y2 = (yc + h / 2) / scaledHeight * image.height;
|
60 |
+
results.push({ x1, x2, y1, y2, score, keypoints });
|
61 |
}
|
62 |
|
63 |
|
|
|
108 |
|
109 |
// Display results
|
110 |
for (const { x1, x2, y1, y2, score, keypoints } of filteredResults) {
|
111 |
+
console.log(`Found person at [${x1}, ${y1}, ${x2}, ${y2}] with score ${score.toFixed(3)}`);
|
112 |
for (let i = 0; i < keypoints.length; i += 3) {
|
113 |
const label = model.config.id2label[Math.floor(i / 3)];
|
114 |
const [x, y, point_score] = keypoints.slice(i, i + 3);
|