Skip to content

Commit

Permalink
Better logging + fix for oai system message
Browse files Browse the repository at this point in the history
Signed-off-by: Igor Gitman <[email protected]>
  • Loading branch information
Kipok committed Dec 14, 2024
1 parent 38fe7f1 commit f16ad00
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 6 deletions.
2 changes: 1 addition & 1 deletion nemo_skills/evaluation/metrics/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ def read_predictions(predictions, line_idx, file_handles):
try:
prediction_dict = json.loads(prediction)
except Exception as e:
LOG.error(f"Error reading line %s in file %s: %s", line_idx, file_handles[file_idx].name, e)
LOG.error(f"Error reading line %s in file %s: %s", line_idx + 1, file_handles[file_idx].name, e)
raise
data.append(prediction_dict)

Expand Down
16 changes: 11 additions & 5 deletions nemo_skills/prompt/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -266,14 +266,20 @@ def fill(
return prompt_string
else:
if multi_turn_key is None:
messages = [
{"role": "system", "content": self.config.system},
{"role": "user", "content": self.build_user_message(input_dict)},
]
if self.config.system:
messages = [
{"role": "system", "content": self.config.system},
]
else:
messages = []
messages.append({"role": "user", "content": self.build_user_message(input_dict)})
if generation and include_generation:
messages.append({"role": "assistant", "content": generation})
else:
messages = [{"role": "system", "content": self.config.system}]
if self.config.system:
messages = [{"role": "system", "content": self.config.system}]
else:
messages = []
for turn in input_dict[multi_turn_key][:-1]:
messages.append({"role": "user", "content": self.build_user_message(turn)})
messages.append({"role": "assistant", "content": turn["assistant"]})
Expand Down

0 comments on commit f16ad00

Please sign in to comment.