Run this model with HF Jobs

Run OzzyGT/ben2_custom_blocks on Hugging Face's managed compute, monitor its progress, and retrieve the results when it's done.

Paste one of these prompts into your coding agent:

Fine-tune on my dataset

Use HF Jobs to fine-tune https://huggingface.co/OzzyGT/ben2_custom_blocks. Ask me which dataset to train on, then push the fine-tuned model to a new model repo. Run `hf jobs --help` first to learn the CLI.

Run batch inference

Use HF Jobs to run batch inference with https://huggingface.co/OzzyGT/ben2_custom_blocks on the inputs in a mounted HF Bucket. Ask me which Bucket to use, then write the outputs back to it and keep each input ID. Run `hf jobs --help` first to learn the CLI.

BEN2 Modular Diffusers

Modular Diffusers blocks for BEN2 (Background Erase Network 2) by Prama LLC: remove an image's background as a soft alpha matte that keeps hair and fine edges. The blocks ship the model code and load the weights from OzzyGT/ben2_diffusers.

Usage

import torch
from diffusers import ModularPipelineBlocks


blocks = ModularPipelineBlocks.from_pretrained("OzzyGT/ben2_custom_blocks", trust_remote_code=True)
pipe = blocks.init_pipeline()
pipe.load_components(dtype=torch.float32)
pipe.to("cuda")

state = pipe(image="photo.jpg")
state.get("images")[0].save("cut_out.png")  # RGBA
state.get("matte").save("matte.png")  # the alpha matte alone

image is a path or a PIL image. On CUDA the model runs in float16 autocast, as the original does.

Licensing

The blocks are Apache-2.0. ben2_model.py and matte.py are adapted from BEN2, MIT: its notice is in LICENSE-BEN2. The weights are MIT too, see the model repository.

Downloads last month
44
Inference Providers NEW
This model isn't deployed by any Inference Provider. ๐Ÿ™‹ Ask for provider support

Model tree for OzzyGT/ben2_custom_blocks

Base model

PramaLLC/BEN2
Finetuned
(3)
this model