Upload folder using huggingface_hub
Browse files- inference.py +8 -3
- model.safetensors +3 -0
inference.py
CHANGED
@@ -3,12 +3,17 @@ import torch.nn.functional as F
|
|
3 |
from PIL import Image
|
4 |
import numpy as np
|
5 |
import torchvision.transforms as T
|
|
|
6 |
from unet import UNet
|
7 |
|
8 |
# Define model
|
9 |
-
model = UNet(in_channels=1, out_channels=3)
|
10 |
-
state_dict = torch.load("unet_epoch20.pth", map_location="cpu")
|
11 |
-
model.load_state_dict(state_dict)
|
|
|
|
|
|
|
|
|
12 |
model.eval()
|
13 |
|
14 |
transform = T.Compose([
|
|
|
3 |
from PIL import Image
|
4 |
import numpy as np
|
5 |
import torchvision.transforms as T
|
6 |
+
from transformers import AutoModel, AutoConfig
|
7 |
from unet import UNet
|
8 |
|
9 |
# Define model
|
10 |
+
# model = UNet(in_channels=1, out_channels=3)
|
11 |
+
# state_dict = torch.load("unet_epoch20.pth", map_location="cpu")
|
12 |
+
# model.load_state_dict(state_dict)
|
13 |
+
# model.eval()
|
14 |
+
|
15 |
+
config = AutoConfig.from_pretrained(".")
|
16 |
+
model = AutoModel.from_pretrained(".", config=config)
|
17 |
model.eval()
|
18 |
|
19 |
transform = T.Compose([
|
model.safetensors
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:2d55b7f5fa42bb65e4c951a034f5ea7cf10a22e8776eee9b1e46c65d872db921
|
3 |
+
size 124231028
|