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
2 changes: 1 addition & 1 deletion swift/pipelines/sampling/distill_sampler.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ def infer(
for infer_request in infer_requests:
completion = self.client.chat.completions.create(
model=self.model,
messages=infer_request['messages'],
messages=infer_request.messages,
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

critical

This change from dictionary-style access (infer_request['messages']) to attribute-style access (infer_request.messages) will cause a runtime AttributeError. The infer_requests list passed to this infer method is populated with dictionaries in DistillSampler.generate, not InferRequest objects. As infer_request is a dictionary, attribute access is not possible.

Please revert this change to use infer_request['messages'] to avoid breaking the code.

Suggested change
messages=infer_request.messages,
messages=infer_request['messages'],

temperature=request_config.temperature,
top_p=request_config.top_p,
max_tokens=request_config.max_tokens,
Expand Down