# TF eager error (Executing eagerly)

**URL:** <https://discuss.ray.io/t/tf-eager-error-executing-eagerly/9157>\
**Category:** Configure Algorithm, Training, Evaluation, Scaling\
**Created:** [January 30, 2023, 7:22pm UTC](https://discuss.ray.io/t/tf-eager-error-executing-eagerly/9157 "2023-01-30T19:22:20Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![AI360](https://avatars.discourse-cdn.com/v4/letter/a/e5b9ba/32.png) [@AI360](https://discuss.ray.io/u/AI360)\
**Post date:** [January 30, 2023, 7:22pm UTC](https://discuss.ray.io/t/tf-eager-error-executing-eagerly/9157/1 "2023-01-30T19:22:21Z")

</div>

Hello,

I have trained an agent in customized environment and now when I restore the check points, I get this warning and it can not load the check points appropriately:

WARNING eager\_tf\_policy\_v2.py:695 – Cannot restore an optimizer’s state for tf eager! Keras is not able to save the v1.x optimizers (from tf.compat.v1.train) since they aren’t compatible with checkpoints.

It should be noted that when I train the agent I got this warning:

INFO algorithm\_config.py:2492 – Executing eagerly (framework=‘tf2’), with eager\_tracing=tf2. For production workloads, make sure to set eager\_tracing=True in order to match the speed of tf-static-graph (framework=‘tf’). For debugging purposes, `eager_tracing=False` is the best choice.

However, I had selected framework=‘tf2’ and eager\_tracing=True in configuration dict.

Could you help me?

---

<div class="post-metadata">

**Author:** ![sven1977](https://sea2.discourse-cdn.com/flex020/user_avatar/discuss.ray.io/sven1977/32/53_2.png) [@sven1977](https://discuss.ray.io/u/sven1977)\
**Post date:** [February 6, 2023, 7:17pm UTC](https://discuss.ray.io/t/tf-eager-error-executing-eagerly/9157/2 "2023-02-06T19:17:07Z")

</div>

Hey @AI360 , could you give us a small reproduction script that shows the error?  
Also, we would need your RLlib/Ray version information and python version.  
Thanks! 🙂

---

<div class="post-metadata">

**Author:** ![AI360](https://avatars.discourse-cdn.com/v4/letter/a/e5b9ba/32.png) [@AI360](https://discuss.ray.io/u/AI360)\
**Post date:** [February 6, 2023, 7:31pm UTC](https://discuss.ray.io/t/tf-eager-error-executing-eagerly/9157/4 "2023-02-06T19:31:02Z")

</div>

Hello,

class GDGR(gym.Env):  
def **init** (self,env\_config):  
…  
def reset(self):  
…  
def step(self, action):  
…

…  
.  
ray.init(num\_gpus=1,num\_cpus = 4)  
config = DEFAULT\_CONFIG.copy()

.  
.  
.

register\_env(“GDGR”, lambda config …)  
.  
.  
.  
config[“soft\_horizon”] = 2048  
config[“framework”] = “tf2”  
.  
.  
.  
.  
Trainer = ppo.PPOTrainer(config=config)

.  
.  
.  
.  
Training process …

For loading:

I used this:

algo = Algorithm.from\_checkpoint(path)

Python 3.10  
Ray 2.2  
tensorflow = 2.11.0

Thanks,
