@@ -438,27 +438,37 @@
|
||||
<thead>
|
||||
<tr>
|
||||
<th>
|
||||
Status
|
||||
</th>
|
||||
<th>
|
||||
EpochProgress
|
||||
Training Round Progress
|
||||
</th>
|
||||
<th>
|
||||
Accuracy
|
||||
</th>
|
||||
<th>
|
||||
Status
|
||||
</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
{{ range .Defs}}
|
||||
<tr>
|
||||
<td>
|
||||
{{.Status}}
|
||||
{{.EpochProgress}}/20
|
||||
</td>
|
||||
<td>
|
||||
{{.EpochProgress}}
|
||||
{{.Accuracy}}%
|
||||
</td>
|
||||
<td>
|
||||
{{.Accuracy}}
|
||||
<td style="text-align: center;">
|
||||
{{ if (eq .Status 2) }}
|
||||
<span class="bi bi-book" style="color: green;"></span>
|
||||
{{ else if (eq .Status 3) }}
|
||||
<span class="bi bi-book-half" style="color: green;"></span>
|
||||
{{ else if (eq .Status 6) }}
|
||||
<span class="bi bi-book-half" style="color: orange;"></span>
|
||||
{{ else if (eq .Status -3) }}
|
||||
<span class="bi bi-book-half" style="color: red;"></span>
|
||||
{{ else }}
|
||||
{{.Status}}
|
||||
{{ end }}
|
||||
</td>
|
||||
</tr>
|
||||
{{ end }}
|
||||
|
||||
@@ -8,7 +8,7 @@ import requests
|
||||
|
||||
class NotifyServerCallback(tf.keras.callbacks.Callback):
|
||||
def on_epoch_end(self, epoch, log, *args, **kwargs):
|
||||
requests.get(f'http://localhost:8000/model/epoch/update?model_id={{.Model.Id}}&epoch={epoch}&accuracy={log["accuracy"]}&definition={{.DefId}}')
|
||||
requests.get(f'http://localhost:8000/model/epoch/update?model_id={{.Model.Id}}&epoch={epoch + 1}&accuracy={log["accuracy"]}&definition={{.DefId}}')
|
||||
|
||||
|
||||
DATA_DIR = "{{ .DataDir }}"
|
||||
@@ -160,7 +160,9 @@ model.compile(
|
||||
optimizer=tf.keras.optimizers.Adam(),
|
||||
metrics=['accuracy'])
|
||||
|
||||
his = model.fit(dataset, validation_data= dataset_validation, epochs={{.EPOCH_PER_RUN}}, callbacks=[NotifyServerCallback()], use_multiprocessing = True)
|
||||
his = model.fit(dataset, validation_data= dataset_validation, epochs={{.EPOCH_PER_RUN}}, callbacks=[
|
||||
NotifyServerCallback(),
|
||||
tf.keras.callbacks.EarlyStopping("loss", mode="min", patience=5)], use_multiprocessing = True)
|
||||
|
||||
acc = his.history["accuracy"]
|
||||
|
||||
@@ -169,5 +171,5 @@ f.write(str(acc[-1]))
|
||||
f.close()
|
||||
|
||||
|
||||
tf.saved_model.save(model, "model")
|
||||
model.save("model.keras")
|
||||
tf.saved_model.save(model, "{{ .SaveModelPath }}/model")
|
||||
model.save("{{ .SaveModelPath }}/model.keras")
|
||||
|
||||
Reference in New Issue
Block a user