How to use from the
Use from the
BEN2 library
import requests
from PIL import Image
from ben2 import AutoModel

url = "https://huggingface.co/datasets/mishig/sample_images/resolve/main/teapot.jpg"
image = Image.open(requests.get(url, stream=True).raw)

model = AutoModel.from_pretrained("aldigobbler/ben2_30m_test_distilled_e1")
model.to("cuda").eval()
foreground = model.inference(image)

BEN2 pruning test # 1 - distillation

Original parameters: 94,134,658

Pruned parameters: 36,275,254

Parameter reduction: 61.5%

  • Swin Transformer depths: [2, 2, 18, 2] → [2, 2, 6, 2]
  • Swin Transformer heads: [4, 8, 16, 32] → [3, 6, 12, 24]

distill loss: 0.0008

Downloads last month
5
Safetensors
Model size
36.4M params
Tensor type
I64
·
F32
·
Inference Providers NEW
This model isn't deployed by any Inference Provider. 🙋 Ask for provider support