-
Notifications
You must be signed in to change notification settings - Fork 1.1k
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
Implements set_env_attr and get_env_attr for vector environments #478
Conversation
What's up with the failed profile check? I don't see where the segmentation fault could come from :(. Apart from that, how does it look? |
not sure what's going wrong. I ran this test locally and it can successfully pass the check without segfault, maybe something went wrong in github container? |
I found the cause: it is because torch==1.10.0 |
@@ -106,7 +106,7 @@ def test_set_attr(data): | |||
|
|||
def test_numpy_torch_convert(data): | |||
"""Test conversion between numpy and torch.""" | |||
for _ in np.arange(1e5): | |||
for _ in np.arange(1e4): # not sure what's wrong in torch==1.10.0 |
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.
here
Awesome! Thanks for the quick review and the polishing 👍 |
I have my own env worker here: https://github.com/microsoft/nni/blob/1eced0a7bff9d4de22487e7cfa45d41ce1f66605/nni/retiarii/strategy/_rl_impl.py#L25 But now it's broken because I need to implement two new methods. I tried to update my code and delete the How can I implement an env worker that works with both versions of tianshou? Implement both of My workaround here: |
how about try...except ? |
Not a good idea. Part of environment is user code. I don't want getattr to be run twice or catch unwanted errors. |
Also a small request: can we have a unit test for your nni integration? |
Sure. The related test code is here: https://github.com/microsoft/nni/blob/d50b46650bdc9e86aec8b2e0c07204c599310c9d/test/ut/retiarii/test_strategy.py#L144 I'm not sure whether it's handy right now because you need to install NNI from source (instead of from pip) for the tests. Or maybe tianshou can have a built-in support for Multi-thread env worker? |
I'm experiencing issues as my CI upgrading to tianshou 0.4.6 breaks my env worker again. It looks like another interface change.
I understand that EnvWorker might not be considered as a public API. But as I'm implementing a 3rd-party env worker, it becomes a burden for me to be always compatible with all kinds of versions. I've already written 3 different version of env worker for tianshou 0.4.4 and 0.4.5 and 0.4.6, and unfortunately they are not compatible with each other. |
Could you please upgrade to the newest version regardless of previous one? I'm super sorry about that happens but actually there's no CI that can secure this thing would never happen again. |
This is in EnvPool |
I've sent a patch. It's currently going through our CI. |
Looks like yet another framework under intense development. :) |
I can make a post version tmr to fix this issue. (Also I just found another issue of consistency and it's critical to be fixed) |
fixed in #536 |
* loose constrains * fix nni issue (#478) * fix coverage
* loose constrains * fix nni issue (thu-ml#478) * fix coverage
make format
(required)make commit-checks
(required)This pull request aims to implement the features outlined in issue #473
get_env_attr
,set_env_attr
for each worker classget_env_attr
,set_env_attr
for vector environments