# Callback error from train\_mnist function

**URL:** <https://community.deeplearning.ai/t/callback-error-from-train-mnist-function/100650>\
**Category:** Introduction to TF for Artificial Intelligence ...\
**Tags:** week-module-2\
**Created:** [February 18, 2022, 4:17pm UTC](https://community.deeplearning.ai/t/callback-error-from-train-mnist-function/100650 "2022-02-18T16:17:45Z")\
**Posts on this page:** 8\
**Page:** 1

<div class="post-metadata">

**Author:** ![psantillo](https://avatars.discourse-cdn.com/v4/letter/p/4da419/32.png) [@psantillo](https://community.deeplearning.ai/u/psantillo)\
**Post date:** [February 18, 2022, 4:17pm UTC](https://community.deeplearning.ai/t/callback-error-from-train-mnist-function/100650/1 "2022-02-18T16:17:45Z")

</div>

I seem to be getting an attribute error: “myCallback” object has no attribute ‘set\_model’ from the below code:

 ![image](https://global.discourse-cdn.com/dlai/original/2X/d/d11591804f438dc467449633e835be34e5c396c1.png)

---

<div class="post-metadata">

**Author:** ![balaji.ambresh](https://sea1.discourse-cdn.com/dlai/user_avatar/community.deeplearning.ai/balaji.ambresh/32/128697_2.png) [@balaji.ambresh](https://community.deeplearning.ai/u/balaji.ambresh)\
**Post date:** [February 18, 2022, 7:15pm UTC](https://community.deeplearning.ai/t/callback-error-from-train-mnist-function/100650/2 "2022-02-18T19:15:57Z")

</div>

Please click my name and send your notebook as an attachment.

---

<div class="post-metadata">

**Author:** ![psantillo](https://avatars.discourse-cdn.com/v4/letter/p/4da419/32.png) [@psantillo](https://community.deeplearning.ai/u/psantillo)\
**Post date:** [February 21, 2022, 2:15pm UTC](https://community.deeplearning.ai/t/callback-error-from-train-mnist-function/100650/4 "2022-02-21T14:15:10Z")

</div>

Thank you sending now

---

<div class="post-metadata">

**Author:** ![Jaime\_Gonzalez](https://avatars.discourse-cdn.com/v4/letter/j/c77e96/32.png) [@Jaime\_Gonzalez](https://community.deeplearning.ai/u/Jaime_Gonzalez)\
**Post date:** [March 8, 2022, 5:22pm UTC](https://community.deeplearning.ai/t/callback-error-from-train-mnist-function/100650/5 "2022-03-08T17:22:06Z")

</div>

Did you manage to fix it? I have the same problem

---

<div class="post-metadata">

**Author:** ![balaji.ambresh](https://sea1.discourse-cdn.com/dlai/user_avatar/community.deeplearning.ai/balaji.ambresh/32/128697_2.png) [@balaji.ambresh](https://community.deeplearning.ai/u/balaji.ambresh)\
**Post date:** [March 8, 2022, 5:41pm UTC](https://community.deeplearning.ai/t/callback-error-from-train-mnist-function/100650/6 "2022-03-08T17:41:20Z")

</div>

Please click my name and send your notebook as an attachment.

---

<div class="post-metadata">

**Author:** ![psantillo](https://avatars.discourse-cdn.com/v4/letter/p/4da419/32.png) [@psantillo](https://community.deeplearning.ai/u/psantillo)\
**Post date:** [March 8, 2022, 8:44pm UTC](https://community.deeplearning.ai/t/callback-error-from-train-mnist-function/100650/7 "2022-03-08T20:44:03Z")

</div>

[code reference removed]

Here’s my callback and train\_mnist function. My issue was I wasn’t inheriting from the correct class for tf.keras.callback.Callback

---

<div class="post-metadata">

**Author:** ![SHAHID\_KAMAL](https://avatars.discourse-cdn.com/v4/letter/s/df788c/32.png) [@SHAHID\_KAMAL](https://community.deeplearning.ai/u/SHAHID_KAMAL)\
**Post date:** [April 6, 2022, 6:55pm UTC](https://community.deeplearning.ai/t/callback-error-from-train-mnist-function/100650/8 "2022-04-06T18:55:25Z")

</div>

I am having the same problem . please tell me how to fix it.

---

<div class="post-metadata">

**Author:** ![balaji.ambresh](https://sea1.discourse-cdn.com/dlai/user_avatar/community.deeplearning.ai/balaji.ambresh/32/128697_2.png) [@balaji.ambresh](https://community.deeplearning.ai/u/balaji.ambresh)\
**Post date:** [April 6, 2022, 7:23pm UTC](https://community.deeplearning.ai/t/callback-error-from-train-mnist-function/100650/9 "2022-04-06T19:23:49Z")

</div>

Does your callback inherit from ` tf.keras.callbacks.Callback` ?
