Skip to content

Commit

Permalink
fix: crash if requested output field for inference doesn't exist in d…
Browse files Browse the repository at this point in the history
…ataset
  • Loading branch information
ividal committed Jan 15, 2025
1 parent 193b899 commit fdd7ddc
Showing 1 changed file with 9 additions and 2 deletions.
11 changes: 9 additions & 2 deletions lumigator/python/mzai/jobs/inference/inference.py
Original file line number Diff line number Diff line change
Expand Up @@ -109,10 +109,17 @@ def run_inference(config: InferenceJobConfig) -> Path:
else:
raise NotImplementedError("Inference pipeline not supported.")

# we'll keep data and any previous predictions/annotations
for k in dataset:
output[k] = dataset[k]

# Warning; if there were already predictions/annotations in the output_field column,
# we overwrite them
if config.job.output_field in dataset:
logger.warning(f"Overwriting existing predictions in column {config.job.output_field}")
# run inference
output[config.job.output_field] = predict(dataset_iterable, model_client)
output["examples"] = dataset["examples"]
output["ground_truth"] = dataset["ground_truth"]

output["model"] = output_model_name

output_path = save_outputs(config, output)
Expand Down

0 comments on commit fdd7ddc

Please sign in to comment.