Skip to content

UnboundLocalError on resume #30

@visualDust

Description

@visualDust

UnboundLocalErrors occur on resume training. valid_loss and mean_IoU are obtained by code below:

in train.py:

if epoch % 10:
    valid_loss, mean_IoU, IoU_array = validate(config, testloader, model, writer_dict)

That means valid_loss and mean_IoU are calculated on each 10 steps. However, they are printed on each step. Therefore, if you make RESUME: true in configs, and your previous model was NOT on epochs that are multiples of 10, errors will occur:

UnboundLocalError: local variable 'valid_loss' referenced before assignment.
UnboundLocalError: local variable 'mean_IoU' referenced before assignment.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions