AI4Finance-Foundation / FinRL

FinRL: Financial Reinforcement Learning. 🔥
https://ai4finance.org
MIT License
10.19k stars 2.45k forks source link

CSI_300_TICKER--- ValueError: The parameter loc has invalid values #183

Closed nkchem09 closed 3 years ago

nkchem09 commented 3 years ago

Thanks for your great work.

I found a bug when running main.py on windows 10 using "CSI_300_TICKER" or other stocks.

The error is showing as follows:

Traceback (most recent call last): File "D:/worksPool/works2020/adair2020_W/some/S72/FinRL-Library-master/main.py", line 58, in main() File "D:/worksPool/works2020/adair2020_W/some/S72/FinRL-Library-master/main.py", line 38, in main finrl.autotrain.training.train_one() File "D:\worksPool\works2020\adair2020_W\some\S72\FinRL-Library-master\finrl\autotrain\training.py", line 109, in train_one model=model_sac, tb_log_name="sac", total_timesteps=80000 File "D:\worksPool\works2020\adair2020_W\some\S72\FinRL-Library-master\finrl\model\models.py", line 124, in train_model model = model.learn(total_timesteps=total_timesteps, tb_log_name=tb_log_name) File "D:\py_envs\S72P2\lib\site-packages\stable_baselines3\sac\sac.py", line 291, in learn reset_num_timesteps=reset_num_timesteps, File "D:\py_envs\S72P2\lib\site-packages\stable_baselines3\common\off_policy_algorithm.py", line 273, in learn log_interval=log_interval, File "D:\py_envs\S72P2\lib\site-packages\stable_baselines3\common\off_policy_algorithm.py", line 469, in collect_rollouts action, buffer_action = self._sample_action(learning_starts, action_noise) File "D:\py_envs\S72P2\lib\site-packages\stable_baselines3\common\off_policy_algorithm.py", line 321, in _sample_action unscaledaction, = self.predict(self._last_obs, deterministic=False) File "D:\py_envs\S72P2\lib\site-packages\stable_baselines3\common\base_class.py", line 497, in predict return self.policy.predict(observation, state, mask, deterministic) File "D:\py_envs\S72P2\lib\site-packages\stable_baselines3\common\policies.py", line 276, in predict actions = self._predict(observation, deterministic=deterministic) File "D:\py_envs\S72P2\lib\site-packages\stable_baselines3\sac\policies.py", line 361, in _predict return self.actor(observation, deterministic) File "D:\py_envs\S72P2\lib\site-packages\torch\nn\modules\module.py", line 889, in _call_impl result = self.forward(*input, kwargs) File "D:\py_envs\S72P2\lib\site-packages\stable_baselines3\sac\policies.py", line 184, in forward return self.action_dist.actions_from_params(mean_actions, log_std, deterministic=deterministic, kwargs) File "D:\py_envs\S72P2\lib\site-packages\stable_baselines3\common\distributions.py", line 178, in actions_from_params self.proba_distribution(mean_actions, log_std) File "D:\py_envs\S72P2\lib\site-packages\stable_baselines3\common\distributions.py", line 210, in proba_distribution super(SquashedDiagGaussianDistribution, self).proba_distribution(mean_actions, log_std) File "D:\py_envs\S72P2\lib\site-packages\stable_baselines3\common\distributions.py", line 152, in proba_distribution self.distribution = Normal(mean_actions, action_std) File "D:\py_envs\S72P2\lib\site-packages\torch\distributions\normal.py", line 50, in init super(Normal, self).init(batch_shape, validate_args=validate_args) File "D:\py_envs\S72P2\lib\site-packages\torch\distributions\distribution.py", line 53, in init raise ValueError("The parameter {} has invalid values".format(param)) ValueError: The parameter loc has invalid values

I am wondering, why the "DOW_30_TICKER" data can run, while other data can not.

Thank you for your help.

anuragsingh31 commented 3 years ago

Hello nkchem09 I'm getting the same error, were you able to solve it ?

nkchem09 commented 3 years ago

Hi there, No, I am still can not solve it.

At 2021-04-19 02:37:16, "anuragsingh31" @.***> wrote:

Hello nkchem09 I'm getting the same error, were you able to solve it ?

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub, or unsubscribe.

malcolm1232 commented 3 years ago

you can solve it by using

!pip install torch==1.4.0

Reason: If you ran !pip install git+https://github.com/AI4Finance-LLC/FinRL-Library.git you will see: torch>=1.4.0; as of 4 May 2021, torch version is ~1.8.0 (compatability issues, so u need to backtrack the pytorch installation)

Hope it helps1

nkchem09 commented 3 years ago

Hello nkchem09 I'm getting the same error, were you able to solve it ?

you can solve it by using

!pip install torch==1.4.0

Reason: If you ran !pip install git+https://github.com/AI4Finance-LLC/FinRL-Library.git you will see: torch>=1.4.0; as of 4 May 2021, torch version is ~1.8.0 (compatability issues, so u need to backtrack the pytorch installation)

Hope it helps1

Thank you very much.

Best wishes.