from sklearn.datasets import load_iris
import tensorflow as tf
import numpy as np
from clearml import Task, Logger
import argparse
def main():
parser = argparse.ArgumentParser()
parser.add_argument('--epochs', metavar='N', default=64, type=int)
args = parser.parse_args()
parsed_args = vars(args)
task = Task.init(project_name="My Workshop Examples", task_name="scikit-learn joblib example")
iris = load_iris()
data = iris.data
target = iris.target
labels = np.unique(target)
epochs = parsed_args['epochs']
task.connect(args)
model = tf.keras.models.Sequential([
tf.keras.layers.Dense(64, input_dim=4, activation='relu'),
tf.keras.layers.Dense(len(labels), activation='softmax')
])
model.compile(optimizer='adam', loss='sparse_categorical_crossentropy', metrics=['accuracy'])
model.fit(data, target, epochs=epochs)
print(model.evaluate(data, target))
if name == "main":
main()
Here's the script I'm testing with.
Here's the script I run it with.
clearml-task --project ClearML-Learn --name EpochsConnectReturns --requirements requirements.txt --script demo.py