breadbread1984 / FuturesEnvironment

This project implements an tf-agent environment of futures market
3 stars 1 forks source link

TypeError: 'JointDistributionSequential' object is not iterable #1

Closed Bigous closed 3 years ago

Bigous commented 3 years ago

Hi, I'm learning tf and tf-agents and saw you creating a custom environment for futures with data from metatrader. It's really awesome.

I'm trying to run it on my machine but I'm getting the following:

Traceback (most recent call last):
  File ".\baseline1_train.py", line 162, in <module>
    main();
  File ".\baseline1_train.py", line 97, in main
    lambda_value = 0.95
  File "C:\Users\bigou\Anaconda3\envs\EnvFutures\lib\site-packages\gin\config.py", line 1069, in gin_wrapper
    utils.augment_exception_message_and_reraise(e, err_str)
  File "C:\Users\bigou\Anaconda3\envs\EnvFutures\lib\site-packages\gin\utils.py", line 41, in augment_exception_message_and_reraise
    raise proxy.with_traceback(exception.__traceback__) from None
  File "C:\Users\bigou\Anaconda3\envs\EnvFutures\lib\site-packages\gin\config.py", line 1046, in gin_wrapper
    return fn(*new_args, **new_kwargs)
  File "C:\Users\bigou\Anaconda3\envs\EnvFutures\lib\site-packages\tf_agents\agents\ppo\ppo_agent.py", line 303, in __init__
    actor_net.create_variables(time_step_spec.observation)
  File "C:\Users\bigou\Anaconda3\envs\EnvFutures\lib\site-packages\tf_agents\networks\network.py", line 226, in create_variables
    **kwargs)
  File "C:\Users\bigou\Anaconda3\envs\EnvFutures\lib\site-packages\tf_agents\networks\network.py", line 426, in __call__
    outputs, new_state = super(Network, self).__call__(**normalized_kwargs)
  File "C:\Users\bigou\Anaconda3\envs\EnvFutures\lib\site-packages\tensorflow_probability\python\distributions\distribution.py", line 880, in __iter__
    raise TypeError('{!r} object is not iterable'.format(type(self).__name__))
TypeError: 'JointDistributionSequential' object is not iterable
  In call to configurable 'PPOAgent' (<class 'tf_agents.agents.ppo.ppo_agent.PPOAgent'>)

Basically it's saying that JointDistributuinSequence is not iterable. Can you give me some hint on what can I do to fix it? or the versions of TensorFlow and tf-agents that you are using?

tks in advance.

breadbread1984 commented 3 years ago

this project is obsolete. I recommend you another my project https://github.com/breadbread1984/Quantitative-Trading-Demo/tree/master/vnpy/ppo . this project adopts tf agent to do quantitative trade with vnpy.

Bigous commented 3 years ago

Ok, tks

Bigous commented 3 years ago

ok, I saw your project, but you are using another services and frameworks over there, and I'd like to learn tf-agents. So, it's too much to put a lot of new things together. tks anyway... I really wanna make this one works with simple and effective CSV file from metatrader without lots of other stuffs.