fix max response/context/prompt len#1110
Conversation
There was a problem hiding this comment.
Pull request overview
This PR fixes the handling of max response, context, and prompt length parameters by making them more flexible and allowing None values where appropriate.
Key Changes
- Changed
rollout_max_response_lendefault from 1024 to None to avoid hardcoded defaults - Removed automatic fallback that set
rollout_max_context_lentorollout_max_response_lenwhen None - Added conditional checks before setting
rollout_max_prompt_lenand performing related assertions to handle None values gracefully
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| logger.info( | ||
| f"args.eval_max_context_len is not set. Use args.rollout_max_context_len {args.rollout_max_context_len} as default value." | ||
| ) | ||
| args.eval_max_context_len = args.rollout_max_context_len |
There was a problem hiding this comment.
After removing the fallback logic that sets rollout_max_context_len to rollout_max_response_len, the code now allows rollout_max_context_len to be None. However, this block unconditionally uses args.rollout_max_context_len in both the log message and assignment without checking if it's None. This will cause issues when eval_max_context_len is set to None, which could break downstream code that expects a valid context length value. Consider adding a None check here, or only perform this assignment when rollout_max_context_len is not None.
| logger.info( | |
| f"args.eval_max_context_len is not set. Use args.rollout_max_context_len {args.rollout_max_context_len} as default value." | |
| ) | |
| args.eval_max_context_len = args.rollout_max_context_len | |
| if args.rollout_max_context_len is not None: | |
| logger.info( | |
| f"args.eval_max_context_len is not set. Use args.rollout_max_context_len {args.rollout_max_context_len} as default value." | |
| ) | |
| args.eval_max_context_len = args.rollout_max_context_len | |
| else: | |
| raise AssertionError( | |
| "Both eval_max_context_len and rollout_max_context_len are not set. Please set at least one of them." | |
| ) |
No description provided.