Ahsen Khaliq commited on
Commit
612374d
1 Parent(s): 07c3194

Update e4e_projection.py

Browse files
Files changed (1) hide show
  1. e4e_projection.py +8 -6
e4e_projection.py CHANGED
@@ -8,15 +8,17 @@ from argparse import Namespace
8
  from e4e.models.psp import pSp
9
  from util import *
10
 
 
 
 
 
 
 
 
11
 
12
  @ torch.no_grad()
13
  def projection(img, name, device='cuda'):
14
- model_path = 'models/e4e_ffhq_encode.pt'
15
- ckpt = torch.load(model_path, map_location='cpu')
16
- opts = ckpt['opts']
17
- opts['checkpoint_path'] = model_path
18
- opts= Namespace(**opts)
19
- net = pSp(opts, device).eval().to(device)
20
 
21
  transform = transforms.Compose(
22
  [
 
8
  from e4e.models.psp import pSp
9
  from util import *
10
 
11
+ device='cpu'
12
+ model_path = 'models/e4e_ffhq_encode.pt'
13
+ ckpt = torch.load(model_path, map_location='cpu')
14
+ opts = ckpt['opts']
15
+ opts['checkpoint_path'] = model_path
16
+ opts= Namespace(**opts)
17
+ net = pSp(opts, device).eval().to(device)
18
 
19
  @ torch.no_grad()
20
  def projection(img, name, device='cuda'):
21
+
 
 
 
 
 
22
 
23
  transform = transforms.Compose(
24
  [