-
Notifications
You must be signed in to change notification settings - Fork 54
Fix max_out_len handling for multi-turn ShareGPT conversations #243
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||||||
|---|---|---|---|---|---|---|---|---|---|---|
|
|
@@ -106,9 +106,9 @@ async def infer_last(self, data: dict, session: aiohttp.ClientSession): | |||||||||
| output = RequestOutput(self.perf_mode) | ||||||||||
| output.turn_id, output.uuid = turn_id, uid | ||||||||||
|
|
||||||||||
| max_out_len = max_out_len[-1] if isinstance(max_out_len, list) else max_out_len | ||||||||||
| cur_max_out_len = max_out_len[-1] if isinstance(max_out_len, list) else max_out_len | ||||||||||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The current logic for determining
Suggested change
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. When
Suggested change
|
||||||||||
| await self.status_counter.post() | ||||||||||
| await self.model.generate(history, max_out_len, output, session=session, **data) | ||||||||||
| await self.model.generate(history, cur_max_out_len, output, session=session, **data) | ||||||||||
| if output.success: | ||||||||||
| await self.status_counter.rev() | ||||||||||
| else: | ||||||||||
|
|
@@ -140,9 +140,9 @@ async def infer_every(self, data: dict, session: aiohttp.ClientSession): | |||||||||
| history = await asyncio.to_thread(self.model.parse_template, PromptList(left_prompt + chat[:i] + right_prompt), mode="gen") | ||||||||||
| output = RequestOutput(self.perf_mode) | ||||||||||
| output.turn_id, output.uuid = turn_id, uid | ||||||||||
| max_out_len = max_out_len[turn_id] if isinstance(max_out_len, list) else max_out_len | ||||||||||
| cur_max_out_len = max_out_len[turn_id] if isinstance(max_out_len, list) else max_out_len | ||||||||||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. While using
Suggested change
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Similar to
Suggested change
|
||||||||||
| await self.status_counter.post() | ||||||||||
| await self.model.generate(history, max_out_len, output, session=session, **data) | ||||||||||
| await self.model.generate(history, cur_max_out_len, output, session=session, **data) | ||||||||||
| turn_id += 1 | ||||||||||
| if output.success: | ||||||||||
| await self.status_counter.rev() | ||||||||||
|
|
@@ -180,9 +180,9 @@ async def infer_every_with_gt(self, data: dict, session: aiohttp.ClientSession): | |||||||||
| history = await asyncio.to_thread(self.model.parse_template, PromptList(left_prompt + chat[:i] + right_prompt), mode="gen") | ||||||||||
| output = RequestOutput(self.perf_mode) | ||||||||||
| output.turn_id, output.uuid = turn_id, uid | ||||||||||
| max_out_len = max_out_len[turn_id] if isinstance(max_out_len, list) else max_out_len | ||||||||||
| cur_max_out_len = max_out_len[turn_id] if isinstance(max_out_len, list) else max_out_len | ||||||||||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Similar to the
Suggested change
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Similar to
Suggested change
|
||||||||||
| await self.status_counter.post() | ||||||||||
| await self.model.generate(history, max_out_len, output, session=session, **data) | ||||||||||
| await self.model.generate(history, cur_max_out_len, output, session=session, **data) | ||||||||||
| turn_id += 1 | ||||||||||
| if output.success: | ||||||||||
| await self.status_counter.rev() | ||||||||||
|
|
||||||||||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
这涉及到对官方数据集的接口更改,不具备通用性,可单独实现一个自定义的多轮对话数据集,兼容对max_out_len字段的实现,并在资料中体现