get chat_end_index after env init#184
Merged
tyler-griggs merged 1 commit intoNovaSky-AI:mainfrom Aug 22, 2025
Merged
Conversation
Contributor
There was a problem hiding this comment.
Code Review
This pull request correctly moves the calculation of chat_end_index to be after the call to env.init. As the description points out, env.init can modify the chat_history by adding messages like a system prompt. By calculating chat_end_index after this modification, you ensure it accurately reflects the length of the initial chat history, which should resolve the assertion error mentioned. The change is logical and well-contained.
Member
|
Great catch, thanks |
tyler-griggs
approved these changes
Aug 22, 2025
dzorlu
referenced
this pull request
in fleet-ai/SkyRL
Feb 4, 2026
This PR moves the `chat_end_index` to after the `chat_history` has been modified by the `env.init` function, to get the right number. In our use case, we are injecting the system prompt in addition to the user message in the `env.init`, so the length changes before and after. In this case the `chat_end_index` is 1 instead of 2. We think it might be causing some bugs down the line, leading to this assertion error: ``` AssertionError: Response ids and loss masks must have the same length, for sample 0 got 27 and 50 ``` Resolves #183
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This PR moves the
chat_end_indexto after thechat_historyhas been modified by theenv.initfunction, to get the right number.In our use case, we are injecting the system prompt in addition to the user message in the
env.init, so the length changes before and after.In this case the
chat_end_indexis 1 instead of 2. We think it might be causing some bugs down the line, leading to this assertion error:Resolves #183