daidedou commited on
Commit
9c8ad66
·
1 Parent(s): 6cc6bd1

cpu option

Browse files
Files changed (2) hide show
  1. app.py +1 -3
  2. zero_shot.py +2 -1
app.py CHANGED
@@ -267,8 +267,6 @@ if __name__ == "__main__":
267
  parser.add_argument('--share', action="store_true")
268
  args = parser.parse_args()
269
  cfg = OmegaConf.load(args.config)
270
- device = torch.device("cuda:0" if torch.cuda.is_available() else "cpu")
271
- print(f"Using device: {device}")
272
- matcher = zero_shot.Matcher(cfg, device)
273
  datadicts = None
274
  demo.launch(share=args.share)
 
267
  parser.add_argument('--share', action="store_true")
268
  args = parser.parse_args()
269
  cfg = OmegaConf.load(args.config)
270
+ matcher = zero_shot.Matcher(cfg)
 
 
271
  datadicts = None
272
  demo.launch(share=args.share)
zero_shot.py CHANGED
@@ -101,9 +101,10 @@ class Matcher(object):
101
  def __init__(self, cfg):
102
  self.cfg = cfg
103
  self.device = torch.device(f'cuda:{cfg["gpu"]}' if torch.cuda.is_available() else 'cpu')
 
104
  self.diffusion_model = None
105
  if self.cfg.get("sds", False):
106
- self.diffusion_model = DiffModel(cfg["sds_conf"])
107
  self.n_fmap = self.cfg["deepfeat_conf"]["fmap"]["n_fmap"]
108
  self.n_loop = 0
109
  if self.cfg.get("optimize", False):
 
101
  def __init__(self, cfg):
102
  self.cfg = cfg
103
  self.device = torch.device(f'cuda:{cfg["gpu"]}' if torch.cuda.is_available() else 'cpu')
104
+ print(f"Using device: {self.device}")
105
  self.diffusion_model = None
106
  if self.cfg.get("sds", False):
107
+ self.diffusion_model = DiffModel(cfg["sds_conf"], self.device)
108
  self.n_fmap = self.cfg["deepfeat_conf"]["fmap"]["n_fmap"]
109
  self.n_loop = 0
110
  if self.cfg.get("optimize", False):