2.14.1
版本发布时间: 2024-01-25 22:16:51
xenova/transformers.js最新发布版本:2.17.2(2024-05-29 22:36:30)
What's new?
-
Add support for Depth Anything (https://github.com/xenova/transformers.js/pull/534). See here for the list of available models.
Example: Depth estimation with
Xenova/depth-anything-small-hf
.import { pipeline } from '@xenova/transformers'; // Create depth-estimation pipeline const depth_estimator = await pipeline('depth-estimation', 'Xenova/depth-anything-small-hf'); // Predict depth map for the given image const url = 'https://huggingface.co/datasets/Xenova/transformers.js-docs/resolve/main/bread_small.png'; const output = await depth_estimator(url); // { // predicted_depth: Tensor { // dims: [350, 518], // type: 'float32', // data: Float32Array(181300) [...], // size: 181300 // }, // depth: RawImage { // data: Uint8Array(271360) [...], // width: 640, // height: 424, // channels: 1 // } // }
You can visualize the output with:
output.depth.save('depth.png');
Input image Visualized output Online demo: https://huggingface.co/spaces/Xenova/depth-anything-web
Example video:
https://github.com/xenova/transformers.js/assets/26504141/bbac3db6-8d8f-4386-a212-7e66ca616a0d
-
Fix typo in tokenizers.js (https://github.com/xenova/transformers.js/pull/518)
-
Return empty tokens array if text is empty after normalization (https://github.com/xenova/transformers.js/pull/535)
Full Changelog: https://github.com/xenova/transformers.js/compare/2.14.0...2.14.1