From 6f2fd5daea8ee4dfc9d97124bc1841d97d1dad62 Mon Sep 17 00:00:00 2001 From: Chime Ogbuji Date: Tue, 19 Mar 2024 22:42:03 -0400 Subject: [PATCH] Add mlx-lm version information to HF model card (#596) * Add mlx-lm version informatiohn to HF model card * Update llms/mlx_lm/utils.py Co-authored-by: Awni Hannun * Reverted indentation * Pre-commit formatting --------- Co-authored-by: Awni Hannun --- llms/mlx_lm/utils.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/llms/mlx_lm/utils.py b/llms/mlx_lm/utils.py index 739dafd9..5f2a2f8c 100644 --- a/llms/mlx_lm/utils.py +++ b/llms/mlx_lm/utils.py @@ -440,12 +440,14 @@ def upload_to_hub(path: str, upload_repo: str, hf_path: str): from huggingface_hub import HfApi, ModelCard, logging + from . import __version__ + card = ModelCard.load(hf_path) card.data.tags = ["mlx"] if card.data.tags is None else card.data.tags + ["mlx"] card.text = dedent( f""" # {upload_repo} - This model was converted to MLX format from [`{hf_path}`](). + This model was converted to MLX format from [`{hf_path}`]() using mlx-lm version **{__version__}**. Refer to the [original model card](https://huggingface.co/{hf_path}) for more details on the model. ## Use with mlx