Skip to content

Commit

Permalink
Allow ids to have form MODEL_ID-APPEND, APPEND could be best or itera…
Browse files Browse the repository at this point in the history
…tion number. (Now if you want to use best, you have to append it.)
  • Loading branch information
ruotianluo committed Apr 27, 2019
1 parent 57ba837 commit 8bf6fdc
Showing 1 changed file with 11 additions and 3 deletions.
14 changes: 11 additions & 3 deletions eval_ensemble.py
Expand Up @@ -30,8 +30,16 @@

opt = parser.parse_args()

model_infos = [utils.pickle_load(open('log_%s/infos_%s-best.pkl' %(id, id))) for id in opt.ids]
model_paths = ['log_%s/model-best.pth' %(id) for id in opt.ids]
model_infos = []
model_paths = []
for id in opt.ids:
if '-' in id:
id, app = id.split('-')
app = '-'+app
else:
app = ''
model_infos.append(utils.pickle_load(open('log_%s/infos_%s%s.pkl' %(id, id, app))))
model_paths.append('log_%s/model%s.pth' %(id,app))

# Load one infos
infos = model_infos[0]
Expand Down Expand Up @@ -81,7 +89,7 @@
# So make sure to use the vocab in infos file.
loader.ix_to_word = infos['vocab']


opt.id = '+'.join([_+str(__) for _,__ in zip(opt.ids, opt.weights)])
# Set sample options
loss, split_predictions, lang_stats = eval_utils.eval_split(model, crit, loader,
vars(opt))
Expand Down

0 comments on commit 8bf6fdc

Please sign in to comment.