Open TimOgden opened 2 years ago
(venv) D:\pyworkspace\tensor2tensor>python tensor2tensor\bin\t2t_trainer.py --registry_help
Traceback (most recent call last):
File "tensor2tensor\bin\t2t_trainer.py", line 24, in <module>
from tensor2tensor import models # pylint: disable=unused-import
File "D:\pyworkspace\tensor2tensor\tensor2tensor\models\__init__.py", line 51, in <module>
from tensor2tensor.models.research import rl
File "D:\pyworkspace\tensor2tensor\tensor2tensor\models\research\rl.py", line 27, in <module>
from tensor2tensor.envs import tic_tac_toe_env
File "D:\pyworkspace\tensor2tensor\tensor2tensor\envs\__init__.py", line 23, in <module>
from tensor2tensor.envs import tic_tac_toe_env
File "D:\pyworkspace\tensor2tensor\tensor2tensor\envs\tic_tac_toe_env.py", line 244, in <module>
register()
File "D:\pyworkspace\tensor2tensor\tensor2tensor\envs\tic_tac_toe_env.py", line 240, in register
"tensor2tensor.envs.tic_tac_toe_env:TicTacToeEnv", version="v0")
File "D:\pyworkspace\tensor2tensor\tensor2tensor\rl\gym_utils.py", line 360, in register_gym_env
return env_name, gym.make(env_name)
File "D:\pyworkspace\tensorflow-demo\venv\lib\site-packages\gym\envs\registration.py", line 610, in make
_kwargs = spec_.kwargs.copy()
AttributeError: 'NoneType' object has no attribute 'copy'
The same error, when change the function parameter like this:
register_gym_env(class_entry_point, version="v0", **kwargs):
It works fine!!! 👍
I faced this issue as well.
@hawkinsp or someone else at Google, kindly consider accepting this merge request.
fixes #1922
Seems helpful. Any update?
Nice @fengtony686 !
@fengtony686 can you please merge this pull request.
The issue is still there? Can it be merged please?
sorry has it been merged yet? facing the same issue.
When running the t2t_decoder.py script from magenta, this line of code will result in this traceback:
The tensor2tensor.rl library is automatically being imported at the start of the script, which calls the register_gym_env function in gym_utils.py with the optional kwargs argument not being supplied. Thus when gym is registering the environment,
self.kwargs.copy()
will throw an errors since kwargs is None.This pull request changes the optional parameter into the more pythonic **kwargs argument that will be an empty dictionary if not supplied. This has been tested and does indeed fix the issue with magenta.