johnmalek312
commited on
Commit
·
35a21c8
1
Parent(s):
ded605e
change notes
Browse files- notes.ipynb +18 -18
notes.ipynb
CHANGED
|
@@ -6,25 +6,25 @@
|
|
| 6 |
"metadata": {},
|
| 7 |
"outputs": [],
|
| 8 |
"source": [
|
| 9 |
-
"# auto reload jupyter notebook\n",
|
| 10 |
-
"%load_ext autoreload\n",
|
| 11 |
-
"%autoreload 2\n",
|
| 12 |
"\n",
|
| 13 |
-
"import os\n",
|
| 14 |
"\n",
|
| 15 |
-
"import torch\n",
|
| 16 |
-
"from moondream2.config import MoondreamConfig\n",
|
| 17 |
-
"from moondream2.moondream import MoondreamModel\n",
|
| 18 |
-
"import torch.profiler\n",
|
| 19 |
-
"with torch.inference_mode():\n",
|
| 20 |
-
"
|
| 21 |
-
"
|
| 22 |
-
"
|
| 23 |
-
"
|
| 24 |
-
"
|
| 25 |
-
"
|
| 26 |
-
"
|
| 27 |
-
"
|
| 28 |
"\n",
|
| 29 |
"\n"
|
| 30 |
]
|
|
@@ -426,7 +426,7 @@
|
|
| 426 |
"name": "python",
|
| 427 |
"nbconvert_exporter": "python",
|
| 428 |
"pygments_lexer": "ipython3",
|
| 429 |
-
"version": "3.
|
| 430 |
}
|
| 431 |
},
|
| 432 |
"nbformat": 4,
|
|
|
|
| 6 |
"metadata": {},
|
| 7 |
"outputs": [],
|
| 8 |
"source": [
|
| 9 |
+
" # auto reload jupyter notebook\n",
|
| 10 |
+
" %load_ext autoreload\n",
|
| 11 |
+
" %autoreload 2\n",
|
| 12 |
"\n",
|
| 13 |
+
" import os\n",
|
| 14 |
"\n",
|
| 15 |
+
" import torch\n",
|
| 16 |
+
" from moondream2.config import MoondreamConfig\n",
|
| 17 |
+
" from moondream2.moondream import MoondreamModel\n",
|
| 18 |
+
" import torch.profiler\n",
|
| 19 |
+
" with torch.inference_mode():\n",
|
| 20 |
+
" config = MoondreamConfig()\n",
|
| 21 |
+
" device = \"cuda\" if torch.cuda.is_available() else \"cpu\"\n",
|
| 22 |
+
" model = MoondreamModel(config, setup_caches=False)\n",
|
| 23 |
+
" from safetensors.torch import load_model\n",
|
| 24 |
+
" weights_path = \"moondream2/model.safetensors\" # Path to your local weights file\n",
|
| 25 |
+
" state_dict = load_model(model, weights_path)\n",
|
| 26 |
+
" model = model.to(device)\n",
|
| 27 |
+
" model._setup_caches()\n",
|
| 28 |
"\n",
|
| 29 |
"\n"
|
| 30 |
]
|
|
|
|
| 426 |
"name": "python",
|
| 427 |
"nbconvert_exporter": "python",
|
| 428 |
"pygments_lexer": "ipython3",
|
| 429 |
+
"version": "3.13.3"
|
| 430 |
}
|
| 431 |
},
|
| 432 |
"nbformat": 4,
|