Untitled
unknown
plain_text
2 years ago
733 B
4
Indexable
import mlflow import json def get_artifact_from_run(run_id, artifact_path="string_indexer/string_indxerer.json"): """ Download an artifact from an MLFlow run and return it as a dictionary. Parameters: - run_id (str): The ID of the MLFlow run. - artifact_path (str): The path to the artifact within the run. Default is "string_indexer/string_indxerer.json". Returns: dict: The JSON artifact parsed as a dictionary. """ # Download the artifact local_path = mlflow.artifacts.download_artifacts(run_id, artifact_path) # Read the JSON and return as dictionary with open(local_path, 'r') as f: data = json.load(f) return data
Editor is loading...