Fetching metadata from the HF Docker repository...
-
Update matanyone_fixed/utils/get_default_model.py
-
Update matanyone_fixed/utils/get_default_model.py
-
Create __init__.py
-
Create matanyone_fixed/utils/get_default_model.py
"""
Fixed MatAnyone Model Interface
Simplified and reliable model loading
"""
import torch
import torch.nn as nn
from typing import Union, Optional
from pathlib import Path
class SimpleMatteModel(nn.Module):
"""
Simplified matting model that ensures proper tensor handling
"""
def __init__(self, backbone_channels: int = 3):
super().__init__()
# Simple encoder-decoder architecture
self.encoder = nn.Sequential(
# Initial conv
nn.Conv2d(backbone_channels, 64, 7, padding=3),
nn.ReLU(inplace=True),
nn.Conv2d(64, 64, 3, padding=1),
nn.ReLU(inplace=True),
# Downsampling blocks
nn.Conv2d(64, 128, 3, stride=2, padding=1),
nn.ReLU(inplace=True),
nn.Conv2d(128, 128, 3, padding=1),
nn.ReLU(inplace=True),
nn.Conv2d(128, 256, 3, stride=2, padding=1),
nn.ReLU(inplace=True),
… -
Create matanyone_fixed/utils/tensor_utils.py