Skip to content

Commit 0bcbe29

Browse files
committed
Update for latest Comet SDK version
1 parent fb8bcab commit 0bcbe29

File tree

5 files changed

+24
-34
lines changed

5 files changed

+24
-34
lines changed

comet_for_mlflow/cli.py

+3-3
Original file line numberDiff line numberDiff line change
@@ -65,10 +65,10 @@ def main():
6565
help="set the directory to store prepared runs; only relevant with --no-upload",
6666
)
6767
parser.add_argument(
68-
"--force-reupload",
68+
"--force-upload",
6969
action="store_true",
7070
default=False,
71-
help="Force reupload of prepared experiments that were previously uploaded",
71+
help="Force the upload of prepared experiments even if they were previously uploaded",
7272
)
7373
command_group = parser.add_mutually_exclusive_group()
7474
command_group.add_argument(
@@ -98,7 +98,7 @@ def main():
9898
args.upload,
9999
args.api_key,
100100
args.output_dir,
101-
args.force_reupload,
101+
args.force_upload,
102102
args.mlflow_store_uri,
103103
args.answer,
104104
args.email,

comet_for_mlflow/comet_for_mlflow.py

+3-3
Original file line numberDiff line numberDiff line change
@@ -97,7 +97,7 @@ def __init__(
9797
upload_experiment,
9898
api_key,
9999
output_dir,
100-
force_reupload,
100+
force_upload,
101101
mlflow_store_uri,
102102
answer,
103103
email,
@@ -146,7 +146,7 @@ def __init__(
146146

147147
self.upload_experiment = upload_experiment
148148
self.output_dir = output_dir
149-
self.force_reupload = force_reupload
149+
self.force_upload = force_upload
150150
self.mlflow_store_uri = mlflow_store_uri
151151

152152
def prepare(self):
@@ -486,7 +486,7 @@ def upload(self, prepared_data):
486486
upload_single_offline_experiment(
487487
archive_path,
488488
self.api_key,
489-
force_reupload=self.force_reupload,
489+
force_upload=self.force_upload,
490490
display_level="debug",
491491
)
492492

examples/keras-example/run.py

+8-13
Original file line numberDiff line numberDiff line change
@@ -3,17 +3,15 @@
33
"""Trains and evaluate a simple MLP
44
on the Reuters newswire topic classification task.
55
"""
6-
from __future__ import print_function
7-
8-
import keras
9-
import mlflow.keras
6+
import mlflow
107
import numpy as np
11-
from keras.datasets import reuters
12-
from keras.layers import Activation, Dense, Dropout
13-
from keras.models import Sequential
14-
from keras.preprocessing.text import Tokenizer
8+
from tensorflow import keras
9+
from tensorflow.keras.datasets import reuters
10+
from tensorflow.keras.layers import Activation, Dense, Dropout
11+
from tensorflow.keras.models import Sequential
12+
from tensorflow.keras.preprocessing.text import Tokenizer
1513

16-
mlflow.keras.autolog()
14+
mlflow.tensorflow.autolog()
1715

1816
max_words = 1000
1917
batch_size = 32
@@ -38,8 +36,7 @@
3836
print("x_test shape:", x_test.shape)
3937

4038
print(
41-
"Convert class vector to binary class matrix "
42-
"(for use with categorical_crossentropy)"
39+
"Convert class vector to binary class matrix (for use with categorical_crossentropy)"
4340
)
4441
y_train = keras.utils.to_categorical(y_train, num_classes)
4542
y_test = keras.utils.to_categorical(y_test, num_classes)
@@ -67,5 +64,3 @@
6764
score = model.evaluate(x_test, y_test, batch_size=batch_size, verbose=1)
6865
print("Test score:", score[0])
6966
print("Test accuracy:", score[1])
70-
71-
mlflow.keras.log_model(model, "models")

examples/model-registry-example/run.py

+9-14
Original file line numberDiff line numberDiff line change
@@ -1,24 +1,20 @@
11
#!/usr/bin/env python
22
# -*- coding: utf-8 -*-
3+
34
"""Trains and evaluate a simple MLP
45
on the Reuters newswire topic classification task.
56
"""
6-
from __future__ import print_function
7-
8-
import keras
9-
import mlflow.keras
7+
import mlflow
108
import numpy as np
11-
from keras.datasets import reuters
12-
from keras.layers import Activation, Dense, Dropout
13-
from keras.models import Sequential
14-
from keras.preprocessing.text import Tokenizer
9+
from tensorflow import keras
10+
from tensorflow.keras.datasets import reuters
11+
from tensorflow.keras.layers import Activation, Dense, Dropout
12+
from tensorflow.keras.models import Sequential
13+
from tensorflow.keras.preprocessing.text import Tokenizer
1514

1615
mlflow.set_tracking_uri("sqlite:///db.sqlite")
1716

18-
19-
mlflow.keras.autolog()
20-
21-
mlflow.log_param("Test", "FOO")
17+
mlflow.tensorflow.autolog()
2218

2319
max_words = 1000
2420
batch_size = 32
@@ -43,8 +39,7 @@
4339
print("x_test shape:", x_test.shape)
4440

4541
print(
46-
"Convert class vector to binary class matrix "
47-
"(for use with categorical_crossentropy)"
42+
"Convert class vector to binary class matrix (for use with categorical_crossentropy)"
4843
)
4944
y_train = keras.utils.to_categorical(y_train, num_classes)
5045
y_test = keras.utils.to_categorical(y_test, num_classes)

setup.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
with open("HISTORY.md") as history_file:
1212
history = history_file.read()
1313

14-
requirements = ["mlflow", "comet_ml>=3.1.1", "tabulate", "tqdm", "typing"]
14+
requirements = ["mlflow", "comet_ml>=3.39.0", "tabulate", "tqdm", "typing"]
1515

1616

1717
setup(

0 commit comments

Comments
 (0)