Refactor return statement replacement to use explicit newlines
Replace f-string triple-quoted approach with explicit newline characters for clearer string construction in the grpo_trainer patch.
This commit is contained in:
parent
d8c9e6aafb
commit
3aaca08a0e
1 changed files with 2 additions and 6 deletions
|
|
@ -393,12 +393,8 @@ def grpo_trainer__generate_and_score_completions(function_name, function):
|
|||
|
||||
if match:
|
||||
indent = match.group(1)
|
||||
function = function.replace(
|
||||
f"{indent}return output",
|
||||
f"""{indent}if not _was_training:
|
||||
{indent} self.model.for_inference()
|
||||
{indent}return output""",
|
||||
)
|
||||
new_code = indent + "if not _was_training:\n" + indent + " self.model.for_inference()\n" + indent + "return output"
|
||||
function = function.replace(f"{indent}return output", new_code)
|
||||
|
||||
return function
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue