From 17f31415d4eae3137ccb4c28bff90931ad5f628f Mon Sep 17 00:00:00 2001 From: Sarvesh Date: Tue, 9 Jun 2026 16:15:31 +0530 Subject: [PATCH] Add dynamic num2words cache override to build_stage1_model --- demo.ipynb | 20 +++++++++++++++++++- 1 file changed, 19 insertions(+), 1 deletion(-) diff --git a/demo.ipynb b/demo.ipynb index 6b2a969..8b0220c 100644 --- a/demo.ipynb +++ b/demo.ipynb @@ -183,7 +183,16 @@ " kl_weight: float = 0.0\n", " generation_max_new_tokens: int = 128\n", "\n", - "print(\"Video2LoRA imported architectures and utility functions successfully.\")" + "print(\"Video2LoRA imported architectures and utility functions successfully.\")", + "\n", + "# Force-refresh Hugging Face transformers dependency cache for num2words if installed mid-session\n", + "import importlib.util\n", + "if importlib.util.find_spec(\"num2words\") is not None:\n", + " try:\n", + " import transformers.utils.import_utils\n", + " transformers.utils.import_utils._num2words_available = True\n", + " except Exception:\n", + " pass\n" ] }, { @@ -432,6 +441,15 @@ "\n", "# 1. Initialize SmolVLM2 base model, processor, and tokenizer\n", "print(\"Loading SmolVLM2 model (2.2B-Instruct)...\")\n", + "# Force-refresh Hugging Face transformers dependency cache for num2words if installed mid-session\n", + "import importlib.util\n", + "if importlib.util.find_spec(\"num2words\") is not None:\n", + " try:\n", + " import transformers.utils.import_utils\n", + " transformers.utils.import_utils._num2words_available = True\n", + " except Exception:\n", + " pass\n", + "\n", "model, raw_model, processor, tokenizer = build_stage1_model(train_args, device=device)\n", "\n", "# 2. Load the hypernetwork weights\n",