Skip to content

Commit

Permalink
Only initialize cider_score at the first time.
Browse files Browse the repository at this point in the history
  • Loading branch information
ruotianluo authored Oct 12, 2017
1 parent 52ec5c8 commit fd445dc
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions misc/rewards.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@

def init_cider_scorer(cached_tokens):
global CiderD_scorer
CiderD_scorer = CiderD(df=cached_tokens)
CiderD_scorer = CiderD_scorer or CiderD(df=cached_tokens)

def array_to_str(arr):
out = ''
Expand Down Expand Up @@ -59,4 +59,4 @@ def get_self_critical_reward(model, fc_feats, att_feats, data, gen_result):

rewards = np.repeat(scores[:, np.newaxis], gen_result.shape[1], 1)

return rewards
return rewards

0 comments on commit fd445dc

Please sign in to comment.