Skip to content

Commit 48d8f8b

Browse files
author
David Thrower
committed
Try to put mlflow on sqlite.
1 parent 635b0d3 commit 48d8f8b

File tree

1 file changed

+16
-16
lines changed

1 file changed

+16
-16
lines changed

train_a_generative_llm_docker.py

Lines changed: 16 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -85,17 +85,17 @@
8585

8686
# If you don't want Mlflow, just add `-e MLFLOW_PORT=0` to `docker run`
8787
if MLFLOW_PORT != 0:
88-
mlflow_artifacts_path = f"{ARTIFACTS_FOLDER}/mlflow-artifacts"
88+
mlflow_artifacts_path = f"{ARTIFACTS_FOLDER}/mlflow-artifacts-{meta_trial_number}"
8989
Path(mlflow_artifacts_path).mkdir(parents=True, exist_ok=True)
90-
mlflow_backend_path = f"{ARTIFACTS_FOLDER}/mlruns"
91-
Path(mlflow_backend_path).mkdir(parents=True, exist_ok=True)
90+
mlflow_db_path= f"{ARTIFACTS_FOLDER}/mlruns-{meta_trial_number}"
91+
Path(mlflow_db_path).mkdir(parents=True, exist_ok=True)
9292

9393
cmd = "".join([
9494
"mlflow server ",
9595
"--host 0.0.0.0 ",
9696
f"--port {str(MLFLOW_PORT)} ",
97-
f"--default-artifact-root {str(mlflow_artifacts_path)} ",
98-
f"--backend-store-uri {str(mlflow_backend_path)} &"
97+
f"--default-artifact-root {mlflow_artifacts_path} ",
98+
f"--backend-store-uri sqlite:////{mlflow_db_path} &" # NOTE THE 4 SLASHES
9999
])
100100

101101
answer = subprocess.run(cmd, shell=True)
@@ -560,18 +560,18 @@
560560
train_data_dtype=tf.int32,
561561
merging_strategy='concatenate') # "mhc")
562562

563-
experiment = mlflow.get_experiment_by_name(MLFLOW_EXPERIMENT_NAME)
564-
if experiment:
565-
experiment_id = experiment.experiment_id
566-
else:
567-
# Handle the case where the experiment doesn't exist, e.g., create it
568-
experiment_id = mlflow.create_experiment(MLFLOW_EXPERIMENT_NAME)
569-
570-
print(f"Attempting to start run in Experiment ID: {experiment_id}")
571-
print(f"Current Tracking URI: {mlflow.get_tracking_uri()}")
572-
os.environ.pop("MLFLOW_RUN_ID", None) # The fix
563+
# experiment = mlflow.get_experiment_by_name(MLFLOW_EXPERIMENT_NAME)
564+
# if experiment:
565+
# experiment_id = experiment.experiment_id
566+
# else:
567+
# # Handle the case where the experiment doesn't exist, e.g., create it
568+
# experiment_id = mlflow.create_experiment(MLFLOW_EXPERIMENT_NAME)
569+
#
570+
# print(f"Attempting to start run in Experiment ID: {experiment_id}")
571+
# print(f"Current Tracking URI: {mlflow.get_tracking_uri()}")
572+
# os.environ.pop("MLFLOW_RUN_ID", None) # The fix
573573

574-
with mlflow.start_run(experiment_id=experiment_id):
574+
with mlflow.start_run(): # experiment_id=experiment_id):
575575
mlflow.log_params(PARAMS)
576576
cerebros_t0 = time.time()
577577
phase_i_a_result_0 = cerebros_automl.run_random_search()

0 commit comments

Comments
 (0)