Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions swift/template/templates/stepfun.py
Original file line number Diff line number Diff line change
Expand Up @@ -316,6 +316,7 @@ def _encode(self, inputs: StdTemplateInputs) -> Dict[str, Any]:
input_ids = encoded['input_ids']
labels = encoded['labels']
loss_scale = encoded.get('loss_scale', None)
image_inputs = {}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

critical

This initialization of image_inputs is critical. Without it, image_inputs would be undefined if inputs.images is empty, leading to a NameError when encoded.update(image_inputs) is called later in the function. This change correctly addresses the bug for text-only requests.


images = inputs.images
if images:
Expand Down