# C2W1 Assignment create\_model errors out

**URL:** <https://community.deeplearning.ai/t/c2w1-assignment-create-model-errors-out/256304>\
**Category:** Convolutional Neural Networks in TensorFlow\
**Tags:** week-module-1\
**Created:** [January 13, 2023, 12:17am UTC](https://community.deeplearning.ai/t/c2w1-assignment-create-model-errors-out/256304 "2023-01-13T00:17:59Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Edwin\_Ortega](https://avatars.discourse-cdn.com/v4/letter/e/f17d59/32.png) [@Edwin\_Ortega](https://community.deeplearning.ai/u/Edwin_Ortega)\
**Post date:** [January 13, 2023, 12:17am UTC](https://community.deeplearning.ai/t/c2w1-assignment-create-model-errors-out/256304/1 "2023-01-13T00:17:59Z")

</div>

After defining the model it is failing at the model.compile:

```auto
model.compile(loss=RMSprop(learning_rate=X),
                optimizer='binary_crossentropy',
                metrics=['accuracy']) 

```

where X is the learning rate value chosen by me

with error being:

```auto
ValueError: Unknown optimizer: binary_crossentropy. Please ensure this object is passed to the `custom_objects` argument. See https://www.tensorflow.org/guide/keras/save_and_serialize#registering_the_custom_object for details.

```

I checked stack overflow but nothing, has someone else ran into this issue?

---

<div class="post-metadata">

**Author:** ![Edwin\_Ortega](https://avatars.discourse-cdn.com/v4/letter/e/f17d59/32.png) [@Edwin\_Ortega](https://community.deeplearning.ai/u/Edwin_Ortega)\
**Post date:** [January 13, 2023, 1:45am UTC](https://community.deeplearning.ai/t/c2w1-assignment-create-model-errors-out/256304/2 "2023-01-13T01:45:08Z")

</div>

I fixed this by changing:

```auto
model.compile(loss=RMSprop(learning_rate=X),
                optimizer='binary_crossentropy',
                metrics=['accuracy']) 

```

to the below:

```auto
model.summary()
  
  model.compile(optimizer=RMSprop(learning_rate=X),
                loss='binary_crossentropy',
                metrics = ['accuracy'])

```

not sure why this worked…

---

<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:** [January 13, 2023, 5:17am UTC](https://community.deeplearning.ai/t/c2w1-assignment-create-model-errors-out/256304/3 "2023-01-13T05:17:28Z")

</div>

Please look at the lectures again. It helps to know the difference between loss function and optimizer. If you’re interested in digging deeper, deep learning specialization is a great place to start.
