-
Notifications
You must be signed in to change notification settings - Fork 2.3k
Support async reward functions and parallelize call to reward functions. #4567
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: main
Are you sure you want to change the base?
Support async reward functions and parallelize call to reward functions. #4567
Conversation
|
The docs for this PR live here. All of your documentation changes will be reflected on that endpoint. The docs are available until 30 days after the last update. |
|
On revision I think it might be more prudent to use |
I think I agree with this. I don't have a big background with asyncio though |
|
Done! Runs each synchronous reward function in its own thread now. |
|
I think the implementation looks good. However, I'm still wondering if we should constraint the reward function to be synchronous. If execution is parallelized, we should achieve the same performance, no? |
There aren't any constraints the reward function can sync or async. Sync functions use ThreadPoolExecutor, async functions use async.gather. Perhaps I'm misunderstanding you? The test case added also tests for this by including one sync and one async function. |
What does this PR do?
nn.ModuleFixes #4130
Before submitting
Pull Request section?
to it if that's the case.
Who can review?
Anyone in the community is free to review the PR once the tests have passed. Feel free to tag
members/contributors who may be interested in your PR.