CAMMA-public / rendezvous

A transformer-inspired neural network for surgical action triplet recognition from laparoscopic videos.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Code Error - Cannot Run Successfully

lihaoliu-cambridge opened this issue · comments

Thanks for sharing your code.

However, this repo is problematic. I follow your instruction to run it. The code cannot be run directly, with the following error.

Traceback (most recent call last):
File "run.py", line 417, in
header3 = "** LR Config: Init: {} | Peak: {} | Warmup Epoch: {} | Rise: {} | Decay {} | train params {} | all params {} ".format([float(f'{sch.get_last_lr()[0]:.6f}') for sch in lr_schedulers], [float(f'{v:.6f}') for v in wp_lr], warmups, power, decay_rate, pytorch_train_params, pytorch_total_params)
File "run.py", line 417, in
header3 = "
LR Config: Init: {} | Peak: {} | Warmup Epoch: {} | Rise: {} | Decay {} | train params {} | all params {} **".format([float(f'{sch.get_last_lr()[0]:.6f}') for sch in lr_schedulers], [float(f'{v:.6f}') for v in wp_lr], warmups, power, decay_rate, pytorch_train_params, pytorch_total_params)
File "/XXX/python3.7/site-packages/torch/optim/lr_scheduler.py", line 99, in get_last_lr
return self._last_lr
AttributeError: 'SequentialLR' object has no attribute '_last_lr'

When I solve it follow the instruction in #2 (comment), another print error appears.

Traceback (most recent call last):
File "run.py", line 434, in
print("Traning | lr: {} | epoch {}".format([lr.get_last_lr() for lr in lr_schedulers], epoch), end=" | ", file=open(logfile, 'a+'))
File "run.py", line 434, in
print("Traning | lr: {} | epoch {}".format([lr.get_last_lr() for lr in lr_schedulers], epoch), end=" | ", file=open(logfile, 'a+'))
File "XXX/python3.7/site-packages/torch/optim/lr_scheduler.py", line 99, in get_last_lr
return self._last_lr
AttributeError: 'SequentialLR' object has no attribute '_last_lr'