Image Segmentation
Transformers
Safetensors
English
layer decomposition
image segmentation
image matting
design
custom_code
Instructions to use cyberagent/layerd-birefnet with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use cyberagent/layerd-birefnet with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("image-segmentation", model="cyberagent/layerd-birefnet", trust_remote_code=True)# Load model directly from transformers import AutoModelForImageSegmentation model = AutoModelForImageSegmentation.from_pretrained("cyberagent/layerd-birefnet", trust_remote_code=True, dtype="auto") - Notebooks
- Google Colab
- Kaggle
Fix transformers>=4.56 compatibility
#7
by kyamagu - opened
- birefnet.py +2 -0
birefnet.py
CHANGED
|
@@ -7,6 +7,8 @@ from transformers import PretrainedConfig
|
|
| 7 |
|
| 8 |
class Config(PretrainedConfig):
|
| 9 |
def __init__(self) -> None:
|
|
|
|
|
|
|
| 10 |
# PATH settings
|
| 11 |
self.sys_home_dir = os.path.expanduser('~') # Make up your file system as: SYS_HOME_DIR/codes/dis/BiRefNet, SYS_HOME_DIR/datasets/dis/xx, SYS_HOME_DIR/weights/xx
|
| 12 |
|
|
|
|
| 7 |
|
| 8 |
class Config(PretrainedConfig):
|
| 9 |
def __init__(self) -> None:
|
| 10 |
+
self.is_encoder_decoder = False
|
| 11 |
+
|
| 12 |
# PATH settings
|
| 13 |
self.sys_home_dir = os.path.expanduser('~') # Make up your file system as: SYS_HOME_DIR/codes/dis/BiRefNet, SYS_HOME_DIR/datasets/dis/xx, SYS_HOME_DIR/weights/xx
|
| 14 |
|