Eager execution disabled while saving

Hi, am new to the class API of tensorflow but when I was coding a modified version of transformers- I came across this weird issue: model was training without errors but while using saving using model.save() or ModelCheckpoint() callback, code started giving errors.

Upon checking, the error originated from the fact that I used a .numpy() call for data conversion from Tensor to numpy array for nltk library call. It showed that Tensor has no .numpy() function but I had been using it in eager execution and training was going without any hassle.

When I gave a print statement to check whether it was running eagerly, I noticed that it returned True for training but gave weird errors while saving. Is this normal? What should i do if I need to convert Tensor to numpy for function call? Since if I use .eval(), training gives error and .numpy() gives error during saving.


Please share standalone code to reproduce the issue reported above? Thank you