Views
No views yet
1import torch
2from huggingface_hub import hf_hub_download
3
4# Download model
5model_path = hf_hub_download(
6 repo_id="PentesterPriyanshu/colored-polygon-unet",
7 filename="best_model.pth"
8)
9
10# Load checkpoint
11checkpoint = torch.load(model_path, map_location='cpu')
12
13# Initialize model (you'll need the model architecture code)
14model = ConditionalUNet(
15 in_channels=3,
16 out_channels=3,
17 features=64,
18 num_colors=8,
19 color_embed_dim=32
20)
21model.load_state_dict(checkpoint['model_state_dict'])
22model.eval()