0

I am following a tutorial for Jupyter but I´m getting some errors. The code is in https://github.com/nicknochnack/Reinforcement-Learning-for-Trading-Custom-Signals/blob/main/Custom%20Signals.ipynb

At some point it says:

from stable_baselines.common.vec_env import DummyVecEnv
from stable_baselines import A2C

I get this error:

Input In [85], in <cell line: 7>()
      5 # Stable baselines - rl stuff
      6 from stable_baselines.common.vec_env import DummyVecEnv
----> 7 from stable_baselines import A2C

I read that stable_baselines was not used and that the current one is stable_baselines3. So I installed and changed the code to

from stable_baselines3.common.vec_env import DummyVecEnv
from stable_baselines3 import A2C

but then it says:

ValueError                                Traceback (most recent call last)
Input In [84], in <cell line: 1>()
----> 1 model = A2C('MlpLstmPolicy', env, verbose=1) 
      2 model.learn(total_timesteps=1000000)

File /Applications/Anaconda/anaconda3/lib/python3.9/site-packages/stable_baselines3/a2c/a2c.py:85, in A2C.__init__(self, policy, env, learning_rate, n_steps, gamma, gae_lambda, ent_coef, vf_coef, max_grad_norm, rms_prop_eps, use_rms_prop, use_sde, sde_sample_freq, normalize_advantage, tensorboard_log, create_eval_env, policy_kwargs, verbose, seed, device, _init_setup_model)
     60 def __init__(
     61     self,
     62     policy: Union[str, Type[ActorCriticPolicy]],
   (...)
     82     _init_setup_model: bool = True,
     83 ):
---> 85     super().__init__(
desertnaut
  • 57,590
  • 26
  • 140
  • 166
Unagi71
  • 1
  • 3

1 Answers1

0

There is no support for LSTM/RNN policies in stable_baselines3, yet. You need to use stable_baselines. If you can change your question in a way, that we can see what the error was while importing stable_baselines, maybe we can get it to work.

desertnaut
  • 57,590
  • 26
  • 140
  • 166
Noltibus
  • 1,300
  • 3
  • 12
  • 34
  • I don´t know what I did but I changed model = A2C('MlpLstmPolicy', env, verbose=1) to model = A2C("MlpPolicy", env, verbose=1) And it seems to work. Thank you anyway :) – Unagi71 Sep 13 '22 at 18:07