mirror of
https://github.com/SakanaAI/doc-to-lora.git
synced 2026-07-23 17:01:04 +02:00
Add dynamic num2words cache override to build_stage1_model
This commit is contained in:
parent
4e42b8a1d8
commit
17f31415d4
1 changed files with 19 additions and 1 deletions
20
demo.ipynb
20
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",
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue