2020-04-21 11:19:42 -04:00
|
|
|
---
|
|
|
|
id: 5e8f2f13c4cdbe86b5c72da2
|
2020-04-24 05:52:42 -05:00
|
|
|
title: 'Natural Language Processing With RNNs: Training the Model'
|
2020-04-21 11:19:42 -04:00
|
|
|
challengeType: 11
|
|
|
|
videoId: hEUiK7j9UI8
|
2021-01-13 03:31:00 +01:00
|
|
|
dashedName: natural-language-processing-with-rnns-training-the-model
|
2020-04-21 11:19:42 -04:00
|
|
|
---
|
|
|
|
|
2020-11-27 19:02:05 +01:00
|
|
|
# --question--
|
2020-04-21 11:19:42 -04:00
|
|
|
|
2020-11-27 19:02:05 +01:00
|
|
|
## --text--
|
2020-04-21 11:19:42 -04:00
|
|
|
|
2020-11-27 19:02:05 +01:00
|
|
|
Fill in the blanks below to save your model's checkpoints in the `./checkpoints` directory and call the latest checkpoint for training:
|
2020-05-28 22:40:36 +09:00
|
|
|
|
2020-11-27 19:02:05 +01:00
|
|
|
```py
|
|
|
|
checkpoint_dir = __A__
|
|
|
|
checkpoint_prefix = os.path.join(checkpoint_dir, 'ckpt_{epoch}')
|
2020-05-28 22:40:36 +09:00
|
|
|
|
2020-11-27 19:02:05 +01:00
|
|
|
checkpoint_callback = tf.keras.callbacks.__B__(
|
|
|
|
filepath=checkpoint_prefix,
|
|
|
|
save_weights_only=True
|
|
|
|
)
|
2020-05-28 22:40:36 +09:00
|
|
|
|
2020-11-27 19:02:05 +01:00
|
|
|
history = model.fit(data, epochs=2, callbacks=[__C__])
|
|
|
|
```
|
2020-05-28 22:40:36 +09:00
|
|
|
|
2020-11-27 19:02:05 +01:00
|
|
|
## --answers--
|
2020-05-28 22:40:36 +09:00
|
|
|
|
2020-11-27 19:02:05 +01:00
|
|
|
A: `'./training_checkpoints'`
|
2020-05-28 22:40:36 +09:00
|
|
|
|
2020-11-27 19:02:05 +01:00
|
|
|
B: `ModelCheckpoint`
|
2020-05-28 22:40:36 +09:00
|
|
|
|
2020-11-27 19:02:05 +01:00
|
|
|
C: `checkpoint_prefix`
|
2020-05-28 22:40:36 +09:00
|
|
|
|
2020-11-27 19:02:05 +01:00
|
|
|
---
|
2020-05-28 22:40:36 +09:00
|
|
|
|
2020-11-27 19:02:05 +01:00
|
|
|
A: `'./checkpoints'`
|
2020-05-28 22:40:36 +09:00
|
|
|
|
2020-11-27 19:02:05 +01:00
|
|
|
B: `ModelCheckpoint`
|
|
|
|
|
|
|
|
C: `checkpoint_callback`
|
|
|
|
|
|
|
|
---
|
|
|
|
|
|
|
|
A: `'./checkpoints'`
|
|
|
|
|
|
|
|
B: `BaseLogger`
|
|
|
|
|
|
|
|
C: `checkpoint_callback`
|
|
|
|
|
|
|
|
## --video-solution--
|
2020-04-21 11:19:42 -04:00
|
|
|
|
2020-11-27 19:02:05 +01:00
|
|
|
2
|
2020-04-21 11:19:42 -04:00
|
|
|
|