Spaces:
Runtime error
Runtime error
Commit
·
7652cfe
1
Parent(s):
77cc74c
update online
Browse files- trainer.py +11 -1
trainer.py
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
|
|
| 1 |
import numpy as np
|
| 2 |
import pandas as pd
|
| 3 |
import os
|
|
@@ -67,11 +68,20 @@ model = tf.keras.models.Sequential([
|
|
| 67 |
])
|
| 68 |
|
| 69 |
model.compile(optimizer='adam', loss='sparse_categorical_crossentropy', metrics=['accuracy'])
|
| 70 |
-
model.fit(train_images, train_labels, epochs=
|
| 71 |
|
| 72 |
# Evaluate the model
|
| 73 |
model.evaluate(test_images, test_labels)
|
| 74 |
|
| 75 |
# save the model
|
| 76 |
model.save("model.keras")
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 77 |
|
|
|
|
| 1 |
+
from huggingface_hub import push_to_hub_keras
|
| 2 |
import numpy as np
|
| 3 |
import pandas as pd
|
| 4 |
import os
|
|
|
|
| 68 |
])
|
| 69 |
|
| 70 |
model.compile(optimizer='adam', loss='sparse_categorical_crossentropy', metrics=['accuracy'])
|
| 71 |
+
model.fit(train_images, train_labels, epochs=2, validation_split=0.1)
|
| 72 |
|
| 73 |
# Evaluate the model
|
| 74 |
model.evaluate(test_images, test_labels)
|
| 75 |
|
| 76 |
# save the model
|
| 77 |
model.save("model.keras")
|
| 78 |
+
push_to_hub_keras(model,
|
| 79 |
+
"okeowo1014/trainingsample",
|
| 80 |
+
"trainingsample",
|
| 81 |
+
"optional commit message"
|
| 82 |
+
include_optimizer = True,
|
| 83 |
+
tags = ["object-detection", "some_other_tag"],
|
| 84 |
+
**model_save_kwargs,
|
| 85 |
+
)
|
| 86 |
+
|
| 87 |
|