diff --git a/sdk/python/foundation-models/system/import/import_model_into_registry.ipynb b/sdk/python/foundation-models/system/import/import_model_into_registry.ipynb index 5f373c0025..357c0f5efc 100644 --- a/sdk/python/foundation-models/system/import/import_model_into_registry.ipynb +++ b/sdk/python/foundation-models/system/import/import_model_into_registry.ipynb @@ -298,6 +298,29 @@ "TOKEN = None" ] }, + { + "cell_type": "code", + "execution_count": null, + "id": "4208871d", + "metadata": {}, + "outputs": [], + "source": [ + "# Check if the MODEL_ID passed is a valid HuggingFace ID\n", + "from huggingface_hub import HfApi, ModelFilter\n", + "\n", + "hf_api = HfApi()\n", + "model_infos = hf_api.list_models(filter=ModelFilter(model_name=MODEL_ID))\n", + "model_info = [info for info in model_infos if info.modelId == MODEL_ID]\n", + "valid_hf_id = False\n", + "if model_info and model_info[0].modelId == MODEL_ID:\n", + " valid_hf_id = True\n", + "\n", + "if not valid_hf_id:\n", + " raise ValueError(\n", + " \"Found invalid HF ID. Please select the correct HF ID and try again.\"\n", + " )" + ] + }, { "cell_type": "code", "execution_count": null,