Closed hchaozhe closed 1 year ago
Thank you for sharing this nice work! I have a question regarding the tg_act.py. I encounter error when trying to run the
train_act.py
script. I encountered error points towards the following two lines.File "xxx/trafficgen/trafficgen/act/model/tg_act.py", line 105, in training_step loss_dict = {'train/' + k: v for k, v in loss.items()} AttributeError: 'Tensor' object has no attribute 'items'
Seems to me that
loss
is a tensor that indeed does not have.items
field, and theloss_dict
is already returned by theact_loss
function.I commented out these two lines and I was able to run the script. I wonder if these two lines are redundant?
Hello, have you resolved the problem? There are “items()” in dict in Python, and I guess the “loss. items()” here should be “loss_ dict. items()”, but I'm not sure. But after I made the changes, the code did run successfully.
Hi, thanks for asking.
There's a bug with these two lines of code, just make sure you are logging a dict with pytorch-lightning. You are doing it correctly!
Thank you for sharing this nice work! I have a question regarding the tg_act.py. I encounter error when trying to run the
train_act.py
script. I encountered error points towards the following two lines.Seems to me that
loss
is a tensor that indeed does not have.items
field, and theloss_dict
is already returned by theact_loss
function.I commented out these two lines and I was able to run the script. I wonder if these two lines are redundant?
https://github.com/metadriverse/trafficgen/blob/162add314dc0a1f63a4e39c2d51159349df8baef/trafficgen/act/model/tg_act.py#L105
https://github.com/metadriverse/trafficgen/blob/162add314dc0a1f63a4e39c2d51159349df8baef/trafficgen/act/model/tg_act.py#L112