Upload ./example.py with huggingface_hub
Browse files- example.py +3 -2
example.py
CHANGED
@@ -2,9 +2,9 @@ from model import BrainEncodingModel
|
|
2 |
from config_utils import load_from_yaml
|
3 |
import torch
|
4 |
|
5 |
-
cfg = load_from_yaml("
|
6 |
model = BrainEncodingModel(cfg)
|
7 |
-
sd_path = '
|
8 |
sd = torch.load(sd_path)
|
9 |
model.load_state_dict(sd)
|
10 |
model.eval().cuda()
|
@@ -18,6 +18,7 @@ def transform_image(x):
|
|
18 |
x = transform_image(x)
|
19 |
x = x.cuda()
|
20 |
|
|
|
21 |
subject = 'subj01' # could be 1 of 8 subjects
|
22 |
|
23 |
with torch.no_grad():
|
|
|
2 |
from config_utils import load_from_yaml
|
3 |
import torch
|
4 |
|
5 |
+
cfg = load_from_yaml("./config.yaml")
|
6 |
model = BrainEncodingModel(cfg)
|
7 |
+
sd_path = './ckpt.pth'
|
8 |
sd = torch.load(sd_path)
|
9 |
model.load_state_dict(sd)
|
10 |
model.eval().cuda()
|
|
|
18 |
x = transform_image(x)
|
19 |
x = x.cuda()
|
20 |
|
21 |
+
|
22 |
subject = 'subj01' # could be 1 of 8 subjects
|
23 |
|
24 |
with torch.no_grad():
|