Closed mily20001 closed 4 years ago
Here you can find full example: https://github.com/mily20001/stable_baselines_unity/blob/master/example.tar.lzma It contains unity environment, python script and conda .yml file with dependencies. To run:
tar -xvf example.tar.lzma
cd example
conda env create -f env.yml
conda activate stable_baselines
python ./train_unity.py
After few seconds of training eval_callback kicks in and everything crashes.
Everything should run on any not-too-old Linux machine
If you need some other information, just let me know, I'll do my best to answer
Please attach the full training code next time so we do not have to download and extract packages :). Usually the problem can be solved by looking over the code related to stable-baselines.
Looking at the code it seems like you use LSTM policies which require same amount of environments during evaluation as used during training (mentioned in docs here).
You can find a solution here (you will need to create a custom EvalCallback
: https://github.com/hill-a/stable-baselines/issues/166#issuecomment-502350843
Probably duplicate of https://github.com/hill-a/stable-baselines/issues/714#issuecomment-592462749
Ok, now it works, thank you :)
What do you think about extending default eval callback so that it check self.model.policy.recurrent
prop and based on that it completes observations with zeros (based on value from self.model.n_envs
)? I'm open to create PR with that if you are interested
That'd alleviate headache of many users so sounds like a good suggestion :). Feel free to create a PR for it unless @araffin has anything against this.
Hi, I'm using custom environment created using
UnityEnvironment
andUnityToGymWrapper
. To create env I adjusted code fromcmd_util.py
. It looks like this:I'm using visual observations with size 84x84. I have problem when I'm using more than 1 environment (
num_env
). Training works (results are not perfect, but there is clear progress in comparison with random agent), but then if I want to evaluate model on single env (or useEvalCallback
) I get this error:This particular model was trained using 8 envs, and basically error is the same for other env count (except when using single env):
I've tried changing
SubprocVecEnv
toDummyVecEnv
, but the error was the same. I've tested same scenario using CartPole gym and it was working fine.System Info