Skip to content

Commit 2aa5847

Browse files
authored
[Evals] Fix issue with reading from system prompt in file (#104)
`model_config.system_prompt` can be a string or a `StringInFile` object...Before passing it to the task handler, we need to read the string from the file/ get the underlying `_string` atttribute from StringInFile
1 parent 10081a6 commit 2aa5847

3 files changed

Lines changed: 5 additions & 2 deletions

File tree

scripts/response_rewrite.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -507,7 +507,7 @@ def main():
507507
variants_dataset, ["fcs", "fcs_plus1", "fcs_reflection"], llm
508508
)
509509

510-
system_prompt = ModelConfig.from_model_id(args.target_model).system_prompt
510+
system_prompt = str(ModelConfig.from_model_id(args.target_model).system_prompt)
511511

512512
# Generate conversation format for each variant, which can be used in SimPO/DPO/etc.
513513
fcs_convo = make_preference_conversations(final_dataset, "fcs", system_prompt)

skythought/evals/inference_and_check.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -237,7 +237,7 @@ def generate_responses_for_dataset(
237237
# Prepare conversations
238238
conversations = handler.make_conversations(
239239
remaining_data,
240-
model_config.system_prompt,
240+
str(model_config.system_prompt),
241241
model_config.user_template,
242242
model_config.assistant_prefill,
243243
)

skythought/evals/models/base.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,9 @@ def validate_and_extract_string(self):
2828
def string(self):
2929
return self._string
3030

31+
def __str__(self) -> str:
32+
return self._string
33+
3134

3235
def read_yaml(path: str):
3336
with open(path, "r") as f:

0 commit comments

Comments
 (0)