glenn-jocher commited on
Commit
4984cf5
·
unverified ·
1 Parent(s): e8c5237

train.py GPU memory fix (#3590)

Browse files

* train.py GPU memory fix

* ema

* cuda

* cuda

* zeros input

* to device

* batch index 0

Files changed (1) hide show
  1. train.py +1 -1
train.py CHANGED
@@ -335,7 +335,7 @@ def train(hyp, opt, device, tb_writer=None):
335
  if tb_writer and ni == 0:
336
  with warnings.catch_warnings():
337
  warnings.simplefilter('ignore') # suppress jit trace warning
338
- tb_writer.add_graph(torch.jit.trace(de_parallel(model), imgs, strict=False), []) # graph
339
  elif plots and ni == 10 and wandb_logger.wandb:
340
  wandb_logger.log({'Mosaics': [wandb_logger.wandb.Image(str(x), caption=x.name) for x in
341
  save_dir.glob('train*.jpg') if x.exists()]})
 
335
  if tb_writer and ni == 0:
336
  with warnings.catch_warnings():
337
  warnings.simplefilter('ignore') # suppress jit trace warning
338
+ tb_writer.add_graph(torch.jit.trace(de_parallel(model), imgs[0:1], strict=False), [])
339
  elif plots and ni == 10 and wandb_logger.wandb:
340
  wandb_logger.log({'Mosaics': [wandb_logger.wandb.Image(str(x), caption=x.name) for x in
341
  save_dir.glob('train*.jpg') if x.exists()]})