Skip to content

Commit

Permalink
Update disttest.py
Browse files Browse the repository at this point in the history
  • Loading branch information
erfect2020 authored Nov 17, 2024
1 parent 9d6d675 commit d133eb0
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions disttest.py
Original file line number Diff line number Diff line change
Expand Up @@ -46,8 +46,6 @@
device_id = torch.cuda.current_device()
resume_state = torch.load(opt['path']['resume_state'],
map_location=lambda storage, loc: storage.cuda(device_id))
logger.info('Resuming training from epoch: {}.'.format(
resume_state['epoch']))

def corresponding_load(pre_name, state_dict):
sub_statedict = {}
Expand All @@ -56,12 +54,14 @@ def corresponding_load(pre_name, state_dict):
sub_statedict[k.replace(pre_name, "")] = v
return sub_statedict

resume_state['state_dict'] = corresponding_load('module.', resume_state['state_dict'])
# resume_state['state_dict'] = corresponding_load('module.', resume_state['state_dict'])

model.load_state_dict(resume_state['state_dict'])


model = model.cuda()


# testing
max_steps = len(test_loader)

Expand Down

0 comments on commit d133eb0

Please sign in to comment.