thw1021 / Cylinder2DFlowControlGeneral

Robust active flow control over a range of Reynolds numbers using artificial neural network trained through deep reinforcement learning
MIT License
29 stars 14 forks source link

ValueError: Cannot feed value of shape (1,) for Tensor 'agent/state-input:0', which has shape '(?, 236)' #4

Closed XueminLiu111 closed 3 years ago

XueminLiu111 commented 3 years ago

Hi, I'm using your docker container to train a custom env. However, I've got an error as follows File "/usr/local/lib/python3.6/dist-packages/tensorflow/python/client/session.py", line 1128, in _run str(subfeed_t.get_shape()))) ValueError: Cannot feed value of shape (1,) for Tensor 'agent/state-input:0', which has shape '(?, 236)' Do you have any idea to solve this?

I've also tried to use a new version of tensorforce(0.6.2) to implement the parallel training. And I find a socket_environment.py file that has similar functions as RemoteEnvironmentClient. When I set the remote='socket-client' in the runner = Runner() function and also run launch_servers.py, I'll get a error like this File "train.py", line 115, in <module> runner = Runner( File "/home/xuemin/anaconda3/envs/fenicstest/lib/python3.8/site-packages/tensorforce/execution/runner.py", line 149, in __init__ environment = Environment.create( File "/home/xuemin/anaconda3/envs/fenicstest/lib/python3.8/site-packages/tensorforce/environments/environment.py", line 108, in create environment = SocketEnvironment(host=host, port=port, blocking=blocking) File "/home/xuemin/anaconda3/envs/fenicstest/lib/python3.8/site-packages/tensorforce/environments/socket_environment.py", line 156, in __init__ raise TensorforceError("Remote socket connection could not be established.") tensorforce.exception.TensorforceError: Remote socket connection could not be established. Do you have any idea about this?

The runner function is as follows: runner = Runner(agent=agent, num_parallel=number_servers, port = ports_start, host=host, remote='socket-client')

I really appreciated your help!

thw1021 commented 3 years ago

Sorry, I am not sure how to solve these two problems.

When working on this project, I got an similar error to your first one when I try to restore a model. If I remember correctly, it was solved by adding independent=True here.

For the second error, I did fail to launch the connection due to the port was not available. To solve this problem, I have to change the port number or restart the docker container. However, this may not be your case.

Could you open an issue on tensorforce repo ? The developers could do you a favor.

Best,

XueminLiu111 commented 3 years ago

The first error happens when I start training the model and I'm not sure what happens. Anyway, thanks for your reply!