Printing input_dict["obs_flat"] with custom DefaultCallbacks

Question regarding standard LSTM model in:

with a custom DefaultCallbacks may I print input_dict[“obs_flat”] variables ?
What functions should I call?
I have tried:

trainer.get_policy().model.input_dict["obs_prev_action"].items()

from on_train_result but it does not work.

Hi,

You may want to look into the data stored by the Episode object.

You can access the data stored by this object in on_episode_step and on_episode_end in a callback that inherits from DefaultCallbacks. See this for an example.

Thank you @bmanczak for your help.
The problem is that this data is stored inside the model and that is the data I want to print out.
Is there any way to access the model from Episode? I had a quick look to Episode definition in:

and I do not think so…

Hey @mg64ve , could you post a short repro script here so we can run something and debug?
I’m not sure I understand what you are trying to print out. The key “obs_prev_actions” in the input dicts does not exist in RLlib. “prev_actions” and “prev_rewards” will be available if you set:

config:
    model:
        lstm_use_prev_action: True
        lstm_use_prev_reward: True

Hi @sven1977 you are right I made some confusion with variables. But concept is the same.
I have prepared the following example:

It is taken from the official FrameStacking example. The concept is that I want to print some variable in the model class. In this case it is input_dict[“prev_n_obs”].
This notebook fails with error:

AttributeError: 'Episode' object has no attribute 'input_dict'

How can I do it?

Hi @mg64ve,

The input_dict is not a member of of the policy it if a parameter of the forward function. The most straight forward way if you just want to see what they look would be to add a print statement in the code there or add a breakpoint and debug interactively.