pike-vibe / src /model.py
naboosie's picture
skip pretrained download on inference
5ae7409
Raw
History Blame Contribute Delete
788 Bytes
import torch
import torch.nn as nn
from transformers import ViTMAEModel, ViTMAEConfig
class VibeMAE(nn.Module):
def __init__(self, pretrained=False): # changed default to False
super().__init__()
if pretrained:
self.mae = ViTMAEModel.from_pretrained("facebook/vit-mae-base")
else:
# Just set up the architecture, weights loaded from .pth
config = ViTMAEConfig()
self.mae = ViTMAEModel(config)
self.vibe_head = nn.Sequential(
nn.Linear(768, 256),
nn.ReLU(),
nn.Linear(256, 3),
nn.Sigmoid()
)
def forward(self, x):
outputs = self.mae(x)
latent = outputs.last_hidden_state[:, 0, :]
return self.vibe_head(latent)