Skip to content

2.14.1

Compare
Choose a tag to compare
@xenova xenova released this 25 Jan 14:16
· 590 commits to main since this release

What's new?

  • Add support for Depth Anything (#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
    image image

    Online demo: https://huggingface.co/spaces/Xenova/depth-anything-web

    Example video:

    depth-anything-demo-final.mp4
  • Fix typo in tokenizers.js (#518)

  • Return empty tokens array if text is empty after normalization (#535)

Full Changelog: 2.14.0...2.14.1