Instructions to use Xenova/tiny-random-Swin2SRModel with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers.js
How to use Xenova/tiny-random-Swin2SRModel with Transformers.js:
// npm i @huggingface/transformers import { pipeline } from '@huggingface/transformers'; // Allocate pipeline const pipe = await pipeline('image-feature-extraction', 'Xenova/tiny-random-Swin2SRModel');
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
```
β³ β `int8`: `model_int8.onnx` (added but JS-based E2E test failed)
```
/home/ubuntu/src/tjsmigration/node_modules/.pnpm/onnxruntime-node@1.21.0/node_modules/onnxruntime-node/dist/backend.js:25
__classPrivateFieldGet(this, _OnnxruntimeSessionHandler_inferenceSession, "f").loadModel(pathOrBuffer, options);
^
Error: Could not find an implementation for ConvInteger(10) node with name '/first_convolution/Conv_quant'
at new OnnxruntimeSessionHandler (/home/ubuntu/src/tjsmigration/node_modules/.pnpm/onnxruntime-node@1.21.0/node_modules/onnxruntime-node/dist/backend.js:25:92)
at Immediate.<anonymous> (/home/ubuntu/src/tjsmigration/node_modules/.pnpm/onnxruntime-node@1.21.0/node_modules/onnxruntime-node/dist/backend.js:67:29)
at process.processImmediate (node:internal/timers:485:21)
Node.js v22.16.0
```
β³ β
`uint8`: `model_uint8.onnx` (added)
β³ β
`q4`: `model_q4.onnx` (added)
β³ β
`q4f16`: `model_q4f16.onnx` (added)
β³ β
`bnb4`: `model_bnb4.onnx` (added)
### β Based on `model.onnx` *with* slimming
```
None
```
β³ β `int8`: `model_int8.onnx` (added but JS-based E2E test failed)
```
/home/ubuntu/src/tjsmigration/node_modules/.pnpm/onnxruntime-node@1.21.0/node_modules/onnxruntime-node/dist/backend.js:25
__classPrivateFieldGet(this, _OnnxruntimeSessionHandler_inferenceSession, "f").loadModel(pathOrBuffer, options);
^
Error: Could not find an implementation for ConvInteger(10) node with name '/first_convolution/Conv_quant'
at new OnnxruntimeSessionHandler (/home/ubuntu/src/tjsmigration/node_modules/.pnpm/onnxruntime-node@1.21.0/node_modules/onnxruntime-node/dist/backend.js:25:92)
at Immediate.<anonymous> (/home/ubuntu/src/tjsmigration/node_modules/.pnpm/onnxruntime-node@1.21.0/node_modules/onnxruntime-node/dist/backend.js:67:29)
at process.processImmediate (node:internal/timers:485:21)
Node.js v22.16.0
```
β³ β
`uint8`: `model_uint8.onnx` (added)
β³ β
`q4`: `model_q4.onnx` (added)
β³ β
`q4f16`: `model_q4f16.onnx` (added)
β³ β
`bnb4`: `model_bnb4.onnx` (added)
Files changed (5)
- README.md+17
- onnx/model_bnb4.onnxAdded+3
- onnx/model_q4.onnxAdded+3
- onnx/model_q4f16.onnxAdded+3
- onnx/model_uint8.onnxAdded+3
4 unmodified lines56784 unmodified lineshttps://huggingface.co/hf-tiny-model-private/tiny-random-Swin2SRModel with ONNX weights to be compatible with Transformers.js.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`).4 unmodified lines56789101112131415161718192021222324254 unmodified lineshttps://huggingface.co/hf-tiny-model-private/tiny-random-Swin2SRModel 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/@huggingface/transformers) using:```bashnpm i @huggingface/transformers```**Example:** Perform image feature extraction.```jsimport { pipeline } from '@huggingface/transformers';const image_feature_extractor = await pipeline('image-feature-extraction', 'Xenova/tiny-random-Swin2SRModel');const url = 'https://huggingface.co/datasets/huggingface/documentation-images/resolve/main/cats.png';const features = await image_feature_extractor(url);```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`).
123version https://git-lfs.github.com/spec/v1oid sha256:55b37f22ab259382b7190887df0a1bc871a5b02de3579e3a26e93299aa4d77d5size 274446123version https://git-lfs.github.com/spec/v1oid sha256:f9a6a46444f6d7012c3ac85927abd9045a1c9c82f5b249485cb0d85bfbd9563bsize 278614123version https://git-lfs.github.com/spec/v1oid sha256:b560e06726dae352e12a631ea612a04308d44e9085613a31435c6dd345f34ba2size 256148123version https://git-lfs.github.com/spec/v1oid sha256:c13d47bfe38920c600c1f4199ccaea13158bac768da0d740d446e9b9a5c6c968size 288118