Instructions to use msherry/pakflood-lora with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- PEFT
How to use msherry/pakflood-lora with PEFT:
Task type is invalid.
- Notebooks
- Google Colab
- Kaggle
Colab demo notebook
Browse files
PakFlood_LoRA_Colab_demo.ipynb
ADDED
|
@@ -0,0 +1,53 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"cells": [
|
| 3 |
+
{
|
| 4 |
+
"cell_type": "markdown",
|
| 5 |
+
"metadata": {},
|
| 6 |
+
"source": [
|
| 7 |
+
"# PakFlood-LoRA live demo (Google Colab)\n",
|
| 8 |
+
"Runs the Gradio app of the PakFlood-LoRA model (TerraMind v1 base + rank-32 LoRA + UNet, trained on GEOID-Flood) and gives a public link that stays up while this notebook runs (up to 72 h).\n",
|
| 9 |
+
"\n",
|
| 10 |
+
"Run the three cells in order. Runtime: CPU is enough (about 20 s per tile); a GPU runtime is faster."
|
| 11 |
+
]
|
| 12 |
+
},
|
| 13 |
+
{
|
| 14 |
+
"cell_type": "code",
|
| 15 |
+
"execution_count": null,
|
| 16 |
+
"metadata": {},
|
| 17 |
+
"outputs": [],
|
| 18 |
+
"source": [
|
| 19 |
+
"%pip install -q terratorch==1.1 peft==0.21.3 timm==1.0.24 rasterio==1.4.4 \"gradio>=5.0\" huggingface_hub"
|
| 20 |
+
]
|
| 21 |
+
},
|
| 22 |
+
{
|
| 23 |
+
"cell_type": "code",
|
| 24 |
+
"execution_count": null,
|
| 25 |
+
"metadata": {},
|
| 26 |
+
"outputs": [],
|
| 27 |
+
"source": [
|
| 28 |
+
"from huggingface_hub import snapshot_download\n",
|
| 29 |
+
"path = snapshot_download(\"msherry/pakflood-lora\", repo_type=\"model\")\n",
|
| 30 |
+
"print(\"downloaded to\", path)"
|
| 31 |
+
]
|
| 32 |
+
},
|
| 33 |
+
{
|
| 34 |
+
"cell_type": "code",
|
| 35 |
+
"execution_count": null,
|
| 36 |
+
"metadata": {},
|
| 37 |
+
"outputs": [],
|
| 38 |
+
"source": [
|
| 39 |
+
"import os, sys\n",
|
| 40 |
+
"os.chdir(path); sys.path.insert(0, path)\n",
|
| 41 |
+
"import app\n",
|
| 42 |
+
"app.get_model()\n",
|
| 43 |
+
"app.build_ui().launch(share=True)"
|
| 44 |
+
]
|
| 45 |
+
}
|
| 46 |
+
],
|
| 47 |
+
"metadata": {
|
| 48 |
+
"kernelspec": {"display_name": "Python 3", "language": "python", "name": "python3"},
|
| 49 |
+
"language_info": {"name": "python"}
|
| 50 |
+
},
|
| 51 |
+
"nbformat": 4,
|
| 52 |
+
"nbformat_minor": 5
|
| 53 |
+
}
|