Skip to content

Commit

Permalink
fix set reward bug
Browse files Browse the repository at this point in the history
  • Loading branch information
Wen-Tse Chen committed Dec 20, 2023
1 parent f8879b3 commit fc02030
Showing 1 changed file with 1 addition and 13 deletions.
14 changes: 1 addition & 13 deletions openrl/envs/nlp/daily_dialog_env.py
Original file line number Diff line number Diff line change
Expand Up @@ -111,21 +111,9 @@ def __init__(
self.__time_step = None
self.reward_function = None

self.set_reward()

def set_reward(self, reward_fn=None):

from openrl.envs.nlp.rewards.meteor import Meteor

meteor_config = {
"meteor_coeff": 0.5,
"test": False,
}
self.reward_function = {
"meteor": Meteor(**meteor_config),
}

# self.reward_function = reward_fn
self.reward_function = reward_fn

def step_word(self, word: str) -> Tuple[Dict[str, torch.tensor], int, bool, dict]:
action = self.tokenizer.encode(word)[1]
Expand Down

0 comments on commit fc02030

Please sign in to comment.