Instructions to use wonfy/BiRefNet-ONNX-webgpu with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers.js
How to use wonfy/BiRefNet-ONNX-webgpu with Transformers.js:
// npm i @huggingface/transformers import { pipeline } from '@huggingface/transformers'; // Allocate pipeline const pipe = await pipeline('image-segmentation', 'wonfy/BiRefNet-ONNX-webgpu');
File size: 403 Bytes
041c6b2 | 1 2 3 4 5 6 7 8 9 10 11 12 13 | import sys
import time
import onnxruntime as ort
source, target = sys.argv[1], sys.argv[2]
options = ort.SessionOptions()
options.graph_optimization_level = ort.GraphOptimizationLevel.ORT_ENABLE_BASIC
options.optimized_model_filepath = target
started = time.time()
ort.InferenceSession(source, options, providers=["CPUExecutionProvider"])
print(f"folded in {time.time() - started:.1f} s -> {target}")
|