@@ -59,10 +59,10 @@ def main():
5959
6060 # create model
6161 if args .pretrained :
62- print ("=> using pre-trained model '{}'" .format (args .arch ))
62+ print ("=> using pre-trained model '{}'" .format (args .arch ), flush = True )
6363 model = models .__dict__ [args .arch ](pretrained = True )
6464 else :
65- print ("=> creating model '{}'" .format (args .arch ))
65+ print ("=> creating model '{}'" .format (args .arch ), flush = True )
6666 model = models .__dict__ [args .arch ]()
6767
6868 if args .arch .startswith ('alexnet' ) or args .arch .startswith ('vgg' ):
@@ -74,15 +74,16 @@ def main():
7474 # optionally resume from a checkpoint
7575 if args .resume :
7676 if os .path .isfile (args .resume ):
77- print ("=> loading checkpoint '{}'" .format (args .resume ))
77+ print ("=> loading checkpoint '{}'" .format (args .resume ), flush = True )
7878 checkpoint = torch .load (args .resume )
7979 args .start_epoch = checkpoint ['epoch' ]
8080 best_prec1 = checkpoint ['best_prec1' ]
8181 model .load_state_dict (checkpoint ['state_dict' ])
8282 print ("=> loaded checkpoint '{}' (epoch {})"
83- .format (args .evaluate , checkpoint ['epoch' ]))
83+ .format (args .evaluate , checkpoint ['epoch' ]), flush = True )
8484 else :
85- print ("=> no checkpoint found at '{}'" .format (args .resume ))
85+ print ("=> no checkpoint found at '{}'" .format (args .resume ),
86+ flush = True )
8687
8788 cudnn .benchmark = True
8889
@@ -189,7 +190,8 @@ def train(train_loader, model, criterion, optimizer, epoch):
189190 'Prec@1 {top1.val:.3f} ({top1.avg:.3f})\t '
190191 'Prec@5 {top5.val:.3f} ({top5.avg:.3f})' .format (
191192 epoch , i , len (train_loader ), batch_time = batch_time ,
192- data_time = data_time , loss = losses , top1 = top1 , top5 = top5 ))
193+ data_time = data_time , loss = losses , top1 = top1 , top5 = top5 ),
194+ flush = True )
193195
194196
195197def validate (val_loader , model , criterion ):
@@ -228,10 +230,10 @@ def validate(val_loader, model, criterion):
228230 'Prec@1 {top1.val:.3f} ({top1.avg:.3f})\t '
229231 'Prec@5 {top5.val:.3f} ({top5.avg:.3f})' .format (
230232 i , len (val_loader ), batch_time = batch_time , loss = losses ,
231- top1 = top1 , top5 = top5 ))
233+ top1 = top1 , top5 = top5 ), flush = True )
232234
233235 print (' * Prec@1 {top1.avg:.3f} Prec@5 {top5.avg:.3f}'
234- .format (top1 = top1 , top5 = top5 ))
236+ .format (top1 = top1 , top5 = top5 ), flush = True )
235237
236238 return top1 .avg
237239
0 commit comments