gigo-team / bev_lane_det

228 stars 67 forks source link

Failed to resume training #30

Open hitbuyi opened 7 months ago

hitbuyi commented 7 months ago

When I trained the model at the 25th epoch, it halted for mannual stopping, I rewite the code in train_openlane.py

# TODO template config file.
if __name__ == '__main__':
    import warnings
    warnings.filterwarnings("ignore")
    #openlane_cfg_path= os.getcwd()+'/openlane_config.py'
    openlane_cfg_path= os.path.abspath(os.path.dirname(__file__)) + '/openlane_config.py'
    ckpt_path = '/media/hitbuyi/E8E4A23EE4A20F3E/dataset/openlane1.2/model/BEV_LaneDet/ep025.pth'
    #worker_function('./openlane_config.py', gpu_id=[4, 5, 6, 7])
    #worker_function(openlane_cfg_path, gpu_id=[0])
    worker_function(openlane_cfg_path, gpu_id=[0],checkpoint_path = ckpt_path)

thus

    if checkpoint_path:
        if getattr(configs, "load_optimizer", True):
            resume_training(checkpoint_path, model.module, optimizer, scheduler)
        else:
            load_checkpoint(checkpoint_path, model.module, None)

was called, but the code failed, it prompted the error in load_model.py

def load_checkpoint(checkpoint, net, optimizer=None, map_loc="cuda"):
    sd = torch.load(checkpoint, map_location=map_loc)
    net.load_state_dict(sd['models'])
    if optimizer and sd['optimizer']:
        optimizer.load_state_dict(sd['optimizer'])
    return sd

How to solve this issue?

shupinghu commented 4 months ago

Hello, I am a new researcher of 3D-BEV-LaneDet, could you please share the source code with me? My Email hushp3@qq.com