Waiting for simulators error, using bonsai_gym

%3CLINGO-SUB%20id%3D%22lingo-sub-2006047%22%20slang%3D%22en-US%22%3EWaiting%20for%20simulators%20error%2C%20using%20bonsai_gym%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-2006047%22%20slang%3D%22en-US%22%3E%3CP%3EI%20am%20trying%20to%20train%20a%20brain%20for%20%3CSTRONG%3ECarRacing-v0%20%3C%2FSTRONG%3Eenvironment%20from%20gym%20library%2C%20using%20the%20bonsai-gym%20interface.%3C%2FP%3E%3CP%3EI%20was%20able%20to%20train%20for%20the%20sample%20programs%20provided%20in%20the%20bonsai-gym%20library%2C%20but%20when%20I%20am%20trying%20this%20car%20racing%20environment%20which%20gives%20input%20state%20as%20an%20image(96X96X3)%20and%20action%20space%20with%20%5B%3CSPAN%3Esteer%2C%20gas%2C%20brake%5D%20each%20value%20being%20a%20continuous%20value%20between%20%5B-1%20to%201%2C%200%20to%201%2C%200%20to%201%5D.%20But%20when%20I%20am%20trying%20with%20Soft%20Actor-Critic(SAC)%20algorithm%2C%20I%20am%20unable%20to%20run%20it%20as%20it%20is%20getting%20stuck%20at%20Waiting%20for%20simulators.%3C%2FSPAN%3E%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-2034005%22%20slang%3D%22en-US%22%3ERe%3A%20Waiting%20for%20simulators%20error%2C%20using%20bonsai_gym%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-2034005%22%20slang%3D%22en-US%22%3E%3CP%3Ehey%26nbsp%3B%3CA%20href%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fuser%2Fviewprofilepage%2Fuser-id%2F905067%22%20target%3D%22_blank%22%3E%40avenkatakrishna%3C%2FA%3E%26nbsp%3B!%20thanks%20for%20your%20question%20and%20for%20using%20the%20bonsai_gym%20library.%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3EAs%20you%20have%20noticed%2C%20the%20CarRacing-v0%20environment%20uses%20images%20for%20its%20observation%20space.%20Bonsai%20doesn't%20currently%20ingest%20images%20directly%2C%20so%20you'll%20have%20to%20convert%20that%20into%20a%20support%20datatype.%20A%20list%20of%20supported%20data-types%20are%20listed%20here%20(%3CA%20href%3D%22https%3A%2F%2Fdocs.microsoft.com%2Fen-us%2Fbonsai%2Finkling%2Ftypes%2F%22%20target%3D%22_blank%22%20rel%3D%22noopener%20noreferrer%22%3Ehttps%3A%2F%2Fdocs.microsoft.com%2Fen-us%2Fbonsai%2Finkling%2Ftypes%2F%3C%2FA%3E).%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3EI%20took%20a%20quick%20shot%20at%20using%20a%20pretrained%20model%20to%20featurize%20the%20input%20image%20into%20a%20lower%20dimensional%20(512%20dimensional)%20vector%3A%26nbsp%3B%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3E%3CA%20href%3D%22https%3A%2F%2Fgithub.com%2Fmicrosoft%2Fbonsai-gym%2Fblob%2Falizaidi%2Fracer-example%2Fsamples%2Fgym-carracing-sample%2Fracer_simulator.py%22%20target%3D%22_blank%22%20rel%3D%22noopener%20noreferrer%22%3Ehttps%3A%2F%2Fgithub.com%2Fmicrosoft%2Fbonsai-gym%2Fblob%2Falizaidi%2Fracer-example%2Fsamples%2Fgym-carracing-sample%2Fracer_simulator.py%3C%2FA%3E%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3EFeel%20free%20to%20reuse%20this%20and%20let%20me%20know%20if%20that%20works.%20Thanks!%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-2069854%22%20slang%3D%22en-US%22%3ERe%3A%20Waiting%20for%20simulators%20error%2C%20using%20bonsai_gym%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-2069854%22%20slang%3D%22en-US%22%3E%3CP%3E%3CA%20href%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fuser%2Fviewprofilepage%2Fuser-id%2F665745%22%20target%3D%22_blank%22%3E%40alizaidi%3C%2FA%3E%26nbsp%3B%20Yes%20it's%20working%2C%20but%20many%20times%20simulator%20is%20getting%20connecting%20and%20disconnecting%2C%20this%20is%20happening%20very%20frequently.%26nbsp%3B%3C%2FP%3E%3C%2FLINGO-BODY%3E
New Contributor

I am trying to train a brain for CarRacing-v0 environment from gym library, using the bonsai-gym interface.

I was able to train for the sample programs provided in the bonsai-gym library, but when I am trying this car racing environment which gives input state as an image(96X96X3) and action space with [steer, gas, brake] each value being a continuous value between [-1 to 1, 0 to 1, 0 to 1]. But when I am trying with Soft Actor-Critic(SAC) algorithm, I am unable to run it as it is getting stuck at Waiting for simulators.

2 Replies

hey @avenkatakrishna ! thanks for your question and for using the bonsai_gym library.

 

As you have noticed, the CarRacing-v0 environment uses images for its observation space. Bonsai doesn't currently ingest images directly, so you'll have to convert that into a support datatype. A list of supported data-types are listed here (https://docs.microsoft.com/en-us/bonsai/inkling/types/).

 

I took a quick shot at using a pretrained model to featurize the input image into a lower dimensional (512 dimensional) vector: 

 

https://github.com/microsoft/bonsai-gym/blob/alizaidi/racer-example/samples/gym-carracing-sample/rac...

 

Feel free to reuse this and let me know if that works. Thanks!

@alizaidi  Thanks for the reply.

Yes, it's working, but many times simulator is connecting and disconnecting, this is happening very frequently.