Upload 7 files
Browse files- spectral/notebooks/experiment_1_signal_decomposition.ipynb +79 -1
- spectral/notebooks/experiment_2_manifold_structures.ipynb +79 -1
- spectral/notebooks/experiment_3_compact_representations.ipynb +79 -1
- spectral/notebooks/experiment_4_invertible_transforms.ipynb +79 -1
- spectral/notebooks/experiment_5_matrix_decompositions.ipynb +79 -1
- spectral/notebooks/experiment_6_losses_and_anchors.ipynb +79 -1
- spectral/notebooks/experiment_7_composite_pipelines.ipynb +79 -1
spectral/notebooks/experiment_1_signal_decomposition.ipynb
CHANGED
|
@@ -47,7 +47,7 @@
|
|
| 47 |
"metadata": {},
|
| 48 |
"source": [
|
| 49 |
"# @title Install Dependencies\n",
|
| 50 |
-
"!pip install -q kymatio torch torchvision tensorboard matplotlib scikit-learn\n",
|
| 51 |
"%load_ext tensorboard\n",
|
| 52 |
"import torch\n",
|
| 53 |
"print(f\"PyTorch {torch.__version__}, CUDA available: {torch.cuda.is_available()}\")\n",
|
|
@@ -1603,6 +1603,73 @@
|
|
| 1603 |
" json.dump(self.results, f, indent=2)\n",
|
| 1604 |
"\n",
|
| 1605 |
"scoreboard = Scoreboard()\n",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1606 |
"print(\"[SHARED] GeoLIP architecture loaded \u2014 full three-domain pipeline ready.\")\n",
|
| 1607 |
""
|
| 1608 |
],
|
|
@@ -2199,6 +2266,17 @@
|
|
| 2199 |
],
|
| 2200 |
"execution_count": null,
|
| 2201 |
"outputs": []
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 2202 |
}
|
| 2203 |
]
|
| 2204 |
}
|
|
|
|
| 47 |
"metadata": {},
|
| 48 |
"source": [
|
| 49 |
"# @title Install Dependencies\n",
|
| 50 |
+
"!pip install -q kymatio torch torchvision tensorboard matplotlib scikit-learn huggingface_hub\n",
|
| 51 |
"%load_ext tensorboard\n",
|
| 52 |
"import torch\n",
|
| 53 |
"print(f\"PyTorch {torch.__version__}, CUDA available: {torch.cuda.is_available()}\")\n",
|
|
|
|
| 1603 |
" json.dump(self.results, f, indent=2)\n",
|
| 1604 |
"\n",
|
| 1605 |
"scoreboard = Scoreboard()\n",
|
| 1606 |
+
"\n",
|
| 1607 |
+
"\n",
|
| 1608 |
+
"# \u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\n",
|
| 1609 |
+
"# HUGGINGFACE UPLOAD \u2014 push TB runs + scoreboard after experiments\n",
|
| 1610 |
+
"# \u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\n",
|
| 1611 |
+
"\n",
|
| 1612 |
+
"HF_REPO = \"AbstractPhil/geolip-hypersphere-experiments\"\n",
|
| 1613 |
+
"HF_SUBDIR = \"spectral/notebooks\"\n",
|
| 1614 |
+
"\n",
|
| 1615 |
+
"def upload_runs_to_hf(notebook_name, scoreboard_path=None, runs_dir=\"runs\"):\n",
|
| 1616 |
+
" \"\"\"Upload TensorBoard runs and scoreboard to HuggingFace repo.\n",
|
| 1617 |
+
"\n",
|
| 1618 |
+
" Uploads to: {HF_REPO}/spectral/notebooks/{notebook_name}/\n",
|
| 1619 |
+
" Requires HF_TOKEN in Colab secrets or environment.\n",
|
| 1620 |
+
" \"\"\"\n",
|
| 1621 |
+
" try:\n",
|
| 1622 |
+
" from huggingface_hub import HfApi, login\n",
|
| 1623 |
+
" except ImportError:\n",
|
| 1624 |
+
" print(\"[HF] huggingface_hub not installed \u2014 skipping upload\")\n",
|
| 1625 |
+
" return None\n",
|
| 1626 |
+
"\n",
|
| 1627 |
+
" # Get token\n",
|
| 1628 |
+
" token = os.environ.get('HF_TOKEN') or os.environ.get('HUGGINGFACE_TOKEN')\n",
|
| 1629 |
+
" if token is None:\n",
|
| 1630 |
+
" try:\n",
|
| 1631 |
+
" from google.colab import userdata\n",
|
| 1632 |
+
" token = userdata.get('HF_TOKEN')\n",
|
| 1633 |
+
" except Exception:\n",
|
| 1634 |
+
" pass\n",
|
| 1635 |
+
" if token is None:\n",
|
| 1636 |
+
" print(\"[HF] No HF_TOKEN found. Set it in Colab secrets or environment.\")\n",
|
| 1637 |
+
" print(\" Colab: Settings \u2192 Secrets \u2192 Add HF_TOKEN\")\n",
|
| 1638 |
+
" return None\n",
|
| 1639 |
+
"\n",
|
| 1640 |
+
" api = HfApi(token=token)\n",
|
| 1641 |
+
" target = f\"{HF_SUBDIR}/{notebook_name}\"\n",
|
| 1642 |
+
" print(f\"[HF] Uploading to {HF_REPO}/{target} ...\")\n",
|
| 1643 |
+
"\n",
|
| 1644 |
+
" # Upload runs directory (TensorBoard logs)\n",
|
| 1645 |
+
" if os.path.exists(runs_dir) and os.listdir(runs_dir):\n",
|
| 1646 |
+
" api.upload_folder(\n",
|
| 1647 |
+
" folder_path=runs_dir,\n",
|
| 1648 |
+
" repo_id=HF_REPO,\n",
|
| 1649 |
+
" path_in_repo=f\"{target}/runs\",\n",
|
| 1650 |
+
" token=token,\n",
|
| 1651 |
+
" commit_message=f\"Upload TB runs: {notebook_name}\",\n",
|
| 1652 |
+
" )\n",
|
| 1653 |
+
" n_runs = len(os.listdir(runs_dir))\n",
|
| 1654 |
+
" print(f\"[HF] Uploaded {n_runs} TB run(s) to {target}/runs/\")\n",
|
| 1655 |
+
" else:\n",
|
| 1656 |
+
" print(f\"[HF] No runs directory found at {runs_dir}\")\n",
|
| 1657 |
+
"\n",
|
| 1658 |
+
" # Upload scoreboard JSON if provided\n",
|
| 1659 |
+
" if scoreboard_path and os.path.exists(scoreboard_path):\n",
|
| 1660 |
+
" api.upload_file(\n",
|
| 1661 |
+
" path_or_fileobj=scoreboard_path,\n",
|
| 1662 |
+
" repo_id=HF_REPO,\n",
|
| 1663 |
+
" path_in_repo=f\"{target}/scoreboard.json\",\n",
|
| 1664 |
+
" token=token,\n",
|
| 1665 |
+
" commit_message=f\"Upload scoreboard: {notebook_name}\",\n",
|
| 1666 |
+
" )\n",
|
| 1667 |
+
" print(f\"[HF] Uploaded scoreboard to {target}/scoreboard.json\")\n",
|
| 1668 |
+
"\n",
|
| 1669 |
+
" url = f\"https://huggingface.co/{HF_REPO}/tree/main/{target}\"\n",
|
| 1670 |
+
" print(f\"[HF] Done \u2192 {url}\")\n",
|
| 1671 |
+
" return url\n",
|
| 1672 |
+
"\n",
|
| 1673 |
"print(\"[SHARED] GeoLIP architecture loaded \u2014 full three-domain pipeline ready.\")\n",
|
| 1674 |
""
|
| 1675 |
],
|
|
|
|
| 2266 |
],
|
| 2267 |
"execution_count": null,
|
| 2268 |
"outputs": []
|
| 2269 |
+
},
|
| 2270 |
+
{
|
| 2271 |
+
"cell_type": "code",
|
| 2272 |
+
"metadata": {},
|
| 2273 |
+
"source": [
|
| 2274 |
+
"# @title Upload Runs to HuggingFace\n",
|
| 2275 |
+
"upload_runs_to_hf(\"experiment_1_signal_decomposition\", \"scoreboard_exp1.json\")\n",
|
| 2276 |
+
""
|
| 2277 |
+
],
|
| 2278 |
+
"execution_count": null,
|
| 2279 |
+
"outputs": []
|
| 2280 |
}
|
| 2281 |
]
|
| 2282 |
}
|
spectral/notebooks/experiment_2_manifold_structures.ipynb
CHANGED
|
@@ -39,7 +39,7 @@
|
|
| 39 |
"metadata": {},
|
| 40 |
"source": [
|
| 41 |
"# @title Install Dependencies\n",
|
| 42 |
-
"!pip install -q kymatio torch torchvision tensorboard matplotlib scikit-learn\n",
|
| 43 |
"%load_ext tensorboard\n",
|
| 44 |
"import torch\n",
|
| 45 |
"print(f\"PyTorch {torch.__version__}, CUDA available: {torch.cuda.is_available()}\")\n",
|
|
@@ -1595,6 +1595,73 @@
|
|
| 1595 |
" json.dump(self.results, f, indent=2)\n",
|
| 1596 |
"\n",
|
| 1597 |
"scoreboard = Scoreboard()\n",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1598 |
"print(\"[SHARED] GeoLIP architecture loaded \u2014 full three-domain pipeline ready.\")\n",
|
| 1599 |
""
|
| 1600 |
],
|
|
@@ -1935,6 +2002,17 @@
|
|
| 1935 |
],
|
| 1936 |
"execution_count": null,
|
| 1937 |
"outputs": []
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1938 |
}
|
| 1939 |
]
|
| 1940 |
}
|
|
|
|
| 39 |
"metadata": {},
|
| 40 |
"source": [
|
| 41 |
"# @title Install Dependencies\n",
|
| 42 |
+
"!pip install -q kymatio torch torchvision tensorboard matplotlib scikit-learn huggingface_hub\n",
|
| 43 |
"%load_ext tensorboard\n",
|
| 44 |
"import torch\n",
|
| 45 |
"print(f\"PyTorch {torch.__version__}, CUDA available: {torch.cuda.is_available()}\")\n",
|
|
|
|
| 1595 |
" json.dump(self.results, f, indent=2)\n",
|
| 1596 |
"\n",
|
| 1597 |
"scoreboard = Scoreboard()\n",
|
| 1598 |
+
"\n",
|
| 1599 |
+
"\n",
|
| 1600 |
+
"# \u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\n",
|
| 1601 |
+
"# HUGGINGFACE UPLOAD \u2014 push TB runs + scoreboard after experiments\n",
|
| 1602 |
+
"# \u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\n",
|
| 1603 |
+
"\n",
|
| 1604 |
+
"HF_REPO = \"AbstractPhil/geolip-hypersphere-experiments\"\n",
|
| 1605 |
+
"HF_SUBDIR = \"spectral/notebooks\"\n",
|
| 1606 |
+
"\n",
|
| 1607 |
+
"def upload_runs_to_hf(notebook_name, scoreboard_path=None, runs_dir=\"runs\"):\n",
|
| 1608 |
+
" \"\"\"Upload TensorBoard runs and scoreboard to HuggingFace repo.\n",
|
| 1609 |
+
"\n",
|
| 1610 |
+
" Uploads to: {HF_REPO}/spectral/notebooks/{notebook_name}/\n",
|
| 1611 |
+
" Requires HF_TOKEN in Colab secrets or environment.\n",
|
| 1612 |
+
" \"\"\"\n",
|
| 1613 |
+
" try:\n",
|
| 1614 |
+
" from huggingface_hub import HfApi, login\n",
|
| 1615 |
+
" except ImportError:\n",
|
| 1616 |
+
" print(\"[HF] huggingface_hub not installed \u2014 skipping upload\")\n",
|
| 1617 |
+
" return None\n",
|
| 1618 |
+
"\n",
|
| 1619 |
+
" # Get token\n",
|
| 1620 |
+
" token = os.environ.get('HF_TOKEN') or os.environ.get('HUGGINGFACE_TOKEN')\n",
|
| 1621 |
+
" if token is None:\n",
|
| 1622 |
+
" try:\n",
|
| 1623 |
+
" from google.colab import userdata\n",
|
| 1624 |
+
" token = userdata.get('HF_TOKEN')\n",
|
| 1625 |
+
" except Exception:\n",
|
| 1626 |
+
" pass\n",
|
| 1627 |
+
" if token is None:\n",
|
| 1628 |
+
" print(\"[HF] No HF_TOKEN found. Set it in Colab secrets or environment.\")\n",
|
| 1629 |
+
" print(\" Colab: Settings \u2192 Secrets \u2192 Add HF_TOKEN\")\n",
|
| 1630 |
+
" return None\n",
|
| 1631 |
+
"\n",
|
| 1632 |
+
" api = HfApi(token=token)\n",
|
| 1633 |
+
" target = f\"{HF_SUBDIR}/{notebook_name}\"\n",
|
| 1634 |
+
" print(f\"[HF] Uploading to {HF_REPO}/{target} ...\")\n",
|
| 1635 |
+
"\n",
|
| 1636 |
+
" # Upload runs directory (TensorBoard logs)\n",
|
| 1637 |
+
" if os.path.exists(runs_dir) and os.listdir(runs_dir):\n",
|
| 1638 |
+
" api.upload_folder(\n",
|
| 1639 |
+
" folder_path=runs_dir,\n",
|
| 1640 |
+
" repo_id=HF_REPO,\n",
|
| 1641 |
+
" path_in_repo=f\"{target}/runs\",\n",
|
| 1642 |
+
" token=token,\n",
|
| 1643 |
+
" commit_message=f\"Upload TB runs: {notebook_name}\",\n",
|
| 1644 |
+
" )\n",
|
| 1645 |
+
" n_runs = len(os.listdir(runs_dir))\n",
|
| 1646 |
+
" print(f\"[HF] Uploaded {n_runs} TB run(s) to {target}/runs/\")\n",
|
| 1647 |
+
" else:\n",
|
| 1648 |
+
" print(f\"[HF] No runs directory found at {runs_dir}\")\n",
|
| 1649 |
+
"\n",
|
| 1650 |
+
" # Upload scoreboard JSON if provided\n",
|
| 1651 |
+
" if scoreboard_path and os.path.exists(scoreboard_path):\n",
|
| 1652 |
+
" api.upload_file(\n",
|
| 1653 |
+
" path_or_fileobj=scoreboard_path,\n",
|
| 1654 |
+
" repo_id=HF_REPO,\n",
|
| 1655 |
+
" path_in_repo=f\"{target}/scoreboard.json\",\n",
|
| 1656 |
+
" token=token,\n",
|
| 1657 |
+
" commit_message=f\"Upload scoreboard: {notebook_name}\",\n",
|
| 1658 |
+
" )\n",
|
| 1659 |
+
" print(f\"[HF] Uploaded scoreboard to {target}/scoreboard.json\")\n",
|
| 1660 |
+
"\n",
|
| 1661 |
+
" url = f\"https://huggingface.co/{HF_REPO}/tree/main/{target}\"\n",
|
| 1662 |
+
" print(f\"[HF] Done \u2192 {url}\")\n",
|
| 1663 |
+
" return url\n",
|
| 1664 |
+
"\n",
|
| 1665 |
"print(\"[SHARED] GeoLIP architecture loaded \u2014 full three-domain pipeline ready.\")\n",
|
| 1666 |
""
|
| 1667 |
],
|
|
|
|
| 2002 |
],
|
| 2003 |
"execution_count": null,
|
| 2004 |
"outputs": []
|
| 2005 |
+
},
|
| 2006 |
+
{
|
| 2007 |
+
"cell_type": "code",
|
| 2008 |
+
"metadata": {},
|
| 2009 |
+
"source": [
|
| 2010 |
+
"# @title Upload Runs to HuggingFace\n",
|
| 2011 |
+
"upload_runs_to_hf(\"experiment_2_manifold_structures\", \"scoreboard_exp2.json\")\n",
|
| 2012 |
+
""
|
| 2013 |
+
],
|
| 2014 |
+
"execution_count": null,
|
| 2015 |
+
"outputs": []
|
| 2016 |
}
|
| 2017 |
]
|
| 2018 |
}
|
spectral/notebooks/experiment_3_compact_representations.ipynb
CHANGED
|
@@ -38,7 +38,7 @@
|
|
| 38 |
"metadata": {},
|
| 39 |
"source": [
|
| 40 |
"# @title Install Dependencies\n",
|
| 41 |
-
"!pip install -q kymatio torch torchvision tensorboard matplotlib scikit-learn\n",
|
| 42 |
"%load_ext tensorboard\n",
|
| 43 |
"import torch\n",
|
| 44 |
"print(f\"PyTorch {torch.__version__}, CUDA available: {torch.cuda.is_available()}\")\n",
|
|
@@ -1594,6 +1594,73 @@
|
|
| 1594 |
" json.dump(self.results, f, indent=2)\n",
|
| 1595 |
"\n",
|
| 1596 |
"scoreboard = Scoreboard()\n",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1597 |
"print(\"[SHARED] GeoLIP architecture loaded \u2014 full three-domain pipeline ready.\")\n",
|
| 1598 |
""
|
| 1599 |
],
|
|
@@ -1829,6 +1896,17 @@
|
|
| 1829 |
],
|
| 1830 |
"execution_count": null,
|
| 1831 |
"outputs": []
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1832 |
}
|
| 1833 |
]
|
| 1834 |
}
|
|
|
|
| 38 |
"metadata": {},
|
| 39 |
"source": [
|
| 40 |
"# @title Install Dependencies\n",
|
| 41 |
+
"!pip install -q kymatio torch torchvision tensorboard matplotlib scikit-learn huggingface_hub\n",
|
| 42 |
"%load_ext tensorboard\n",
|
| 43 |
"import torch\n",
|
| 44 |
"print(f\"PyTorch {torch.__version__}, CUDA available: {torch.cuda.is_available()}\")\n",
|
|
|
|
| 1594 |
" json.dump(self.results, f, indent=2)\n",
|
| 1595 |
"\n",
|
| 1596 |
"scoreboard = Scoreboard()\n",
|
| 1597 |
+
"\n",
|
| 1598 |
+
"\n",
|
| 1599 |
+
"# \u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\n",
|
| 1600 |
+
"# HUGGINGFACE UPLOAD \u2014 push TB runs + scoreboard after experiments\n",
|
| 1601 |
+
"# \u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\n",
|
| 1602 |
+
"\n",
|
| 1603 |
+
"HF_REPO = \"AbstractPhil/geolip-hypersphere-experiments\"\n",
|
| 1604 |
+
"HF_SUBDIR = \"spectral/notebooks\"\n",
|
| 1605 |
+
"\n",
|
| 1606 |
+
"def upload_runs_to_hf(notebook_name, scoreboard_path=None, runs_dir=\"runs\"):\n",
|
| 1607 |
+
" \"\"\"Upload TensorBoard runs and scoreboard to HuggingFace repo.\n",
|
| 1608 |
+
"\n",
|
| 1609 |
+
" Uploads to: {HF_REPO}/spectral/notebooks/{notebook_name}/\n",
|
| 1610 |
+
" Requires HF_TOKEN in Colab secrets or environment.\n",
|
| 1611 |
+
" \"\"\"\n",
|
| 1612 |
+
" try:\n",
|
| 1613 |
+
" from huggingface_hub import HfApi, login\n",
|
| 1614 |
+
" except ImportError:\n",
|
| 1615 |
+
" print(\"[HF] huggingface_hub not installed \u2014 skipping upload\")\n",
|
| 1616 |
+
" return None\n",
|
| 1617 |
+
"\n",
|
| 1618 |
+
" # Get token\n",
|
| 1619 |
+
" token = os.environ.get('HF_TOKEN') or os.environ.get('HUGGINGFACE_TOKEN')\n",
|
| 1620 |
+
" if token is None:\n",
|
| 1621 |
+
" try:\n",
|
| 1622 |
+
" from google.colab import userdata\n",
|
| 1623 |
+
" token = userdata.get('HF_TOKEN')\n",
|
| 1624 |
+
" except Exception:\n",
|
| 1625 |
+
" pass\n",
|
| 1626 |
+
" if token is None:\n",
|
| 1627 |
+
" print(\"[HF] No HF_TOKEN found. Set it in Colab secrets or environment.\")\n",
|
| 1628 |
+
" print(\" Colab: Settings \u2192 Secrets \u2192 Add HF_TOKEN\")\n",
|
| 1629 |
+
" return None\n",
|
| 1630 |
+
"\n",
|
| 1631 |
+
" api = HfApi(token=token)\n",
|
| 1632 |
+
" target = f\"{HF_SUBDIR}/{notebook_name}\"\n",
|
| 1633 |
+
" print(f\"[HF] Uploading to {HF_REPO}/{target} ...\")\n",
|
| 1634 |
+
"\n",
|
| 1635 |
+
" # Upload runs directory (TensorBoard logs)\n",
|
| 1636 |
+
" if os.path.exists(runs_dir) and os.listdir(runs_dir):\n",
|
| 1637 |
+
" api.upload_folder(\n",
|
| 1638 |
+
" folder_path=runs_dir,\n",
|
| 1639 |
+
" repo_id=HF_REPO,\n",
|
| 1640 |
+
" path_in_repo=f\"{target}/runs\",\n",
|
| 1641 |
+
" token=token,\n",
|
| 1642 |
+
" commit_message=f\"Upload TB runs: {notebook_name}\",\n",
|
| 1643 |
+
" )\n",
|
| 1644 |
+
" n_runs = len(os.listdir(runs_dir))\n",
|
| 1645 |
+
" print(f\"[HF] Uploaded {n_runs} TB run(s) to {target}/runs/\")\n",
|
| 1646 |
+
" else:\n",
|
| 1647 |
+
" print(f\"[HF] No runs directory found at {runs_dir}\")\n",
|
| 1648 |
+
"\n",
|
| 1649 |
+
" # Upload scoreboard JSON if provided\n",
|
| 1650 |
+
" if scoreboard_path and os.path.exists(scoreboard_path):\n",
|
| 1651 |
+
" api.upload_file(\n",
|
| 1652 |
+
" path_or_fileobj=scoreboard_path,\n",
|
| 1653 |
+
" repo_id=HF_REPO,\n",
|
| 1654 |
+
" path_in_repo=f\"{target}/scoreboard.json\",\n",
|
| 1655 |
+
" token=token,\n",
|
| 1656 |
+
" commit_message=f\"Upload scoreboard: {notebook_name}\",\n",
|
| 1657 |
+
" )\n",
|
| 1658 |
+
" print(f\"[HF] Uploaded scoreboard to {target}/scoreboard.json\")\n",
|
| 1659 |
+
"\n",
|
| 1660 |
+
" url = f\"https://huggingface.co/{HF_REPO}/tree/main/{target}\"\n",
|
| 1661 |
+
" print(f\"[HF] Done \u2192 {url}\")\n",
|
| 1662 |
+
" return url\n",
|
| 1663 |
+
"\n",
|
| 1664 |
"print(\"[SHARED] GeoLIP architecture loaded \u2014 full three-domain pipeline ready.\")\n",
|
| 1665 |
""
|
| 1666 |
],
|
|
|
|
| 1896 |
],
|
| 1897 |
"execution_count": null,
|
| 1898 |
"outputs": []
|
| 1899 |
+
},
|
| 1900 |
+
{
|
| 1901 |
+
"cell_type": "code",
|
| 1902 |
+
"metadata": {},
|
| 1903 |
+
"source": [
|
| 1904 |
+
"# @title Upload Runs to HuggingFace\n",
|
| 1905 |
+
"upload_runs_to_hf(\"experiment_3_compact_representations\", \"scoreboard_exp3.json\")\n",
|
| 1906 |
+
""
|
| 1907 |
+
],
|
| 1908 |
+
"execution_count": null,
|
| 1909 |
+
"outputs": []
|
| 1910 |
}
|
| 1911 |
]
|
| 1912 |
}
|
spectral/notebooks/experiment_4_invertible_transforms.ipynb
CHANGED
|
@@ -39,7 +39,7 @@
|
|
| 39 |
"metadata": {},
|
| 40 |
"source": [
|
| 41 |
"# @title Install Dependencies\n",
|
| 42 |
-
"!pip install -q kymatio torch torchvision tensorboard matplotlib scikit-learn\n",
|
| 43 |
"%load_ext tensorboard\n",
|
| 44 |
"import torch\n",
|
| 45 |
"print(f\"PyTorch {torch.__version__}, CUDA available: {torch.cuda.is_available()}\")\n",
|
|
@@ -1595,6 +1595,73 @@
|
|
| 1595 |
" json.dump(self.results, f, indent=2)\n",
|
| 1596 |
"\n",
|
| 1597 |
"scoreboard = Scoreboard()\n",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1598 |
"print(\"[SHARED] GeoLIP architecture loaded \u2014 full three-domain pipeline ready.\")\n",
|
| 1599 |
""
|
| 1600 |
],
|
|
@@ -1951,6 +2018,17 @@
|
|
| 1951 |
],
|
| 1952 |
"execution_count": null,
|
| 1953 |
"outputs": []
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1954 |
}
|
| 1955 |
]
|
| 1956 |
}
|
|
|
|
| 39 |
"metadata": {},
|
| 40 |
"source": [
|
| 41 |
"# @title Install Dependencies\n",
|
| 42 |
+
"!pip install -q kymatio torch torchvision tensorboard matplotlib scikit-learn huggingface_hub\n",
|
| 43 |
"%load_ext tensorboard\n",
|
| 44 |
"import torch\n",
|
| 45 |
"print(f\"PyTorch {torch.__version__}, CUDA available: {torch.cuda.is_available()}\")\n",
|
|
|
|
| 1595 |
" json.dump(self.results, f, indent=2)\n",
|
| 1596 |
"\n",
|
| 1597 |
"scoreboard = Scoreboard()\n",
|
| 1598 |
+
"\n",
|
| 1599 |
+
"\n",
|
| 1600 |
+
"# \u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\n",
|
| 1601 |
+
"# HUGGINGFACE UPLOAD \u2014 push TB runs + scoreboard after experiments\n",
|
| 1602 |
+
"# \u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\n",
|
| 1603 |
+
"\n",
|
| 1604 |
+
"HF_REPO = \"AbstractPhil/geolip-hypersphere-experiments\"\n",
|
| 1605 |
+
"HF_SUBDIR = \"spectral/notebooks\"\n",
|
| 1606 |
+
"\n",
|
| 1607 |
+
"def upload_runs_to_hf(notebook_name, scoreboard_path=None, runs_dir=\"runs\"):\n",
|
| 1608 |
+
" \"\"\"Upload TensorBoard runs and scoreboard to HuggingFace repo.\n",
|
| 1609 |
+
"\n",
|
| 1610 |
+
" Uploads to: {HF_REPO}/spectral/notebooks/{notebook_name}/\n",
|
| 1611 |
+
" Requires HF_TOKEN in Colab secrets or environment.\n",
|
| 1612 |
+
" \"\"\"\n",
|
| 1613 |
+
" try:\n",
|
| 1614 |
+
" from huggingface_hub import HfApi, login\n",
|
| 1615 |
+
" except ImportError:\n",
|
| 1616 |
+
" print(\"[HF] huggingface_hub not installed \u2014 skipping upload\")\n",
|
| 1617 |
+
" return None\n",
|
| 1618 |
+
"\n",
|
| 1619 |
+
" # Get token\n",
|
| 1620 |
+
" token = os.environ.get('HF_TOKEN') or os.environ.get('HUGGINGFACE_TOKEN')\n",
|
| 1621 |
+
" if token is None:\n",
|
| 1622 |
+
" try:\n",
|
| 1623 |
+
" from google.colab import userdata\n",
|
| 1624 |
+
" token = userdata.get('HF_TOKEN')\n",
|
| 1625 |
+
" except Exception:\n",
|
| 1626 |
+
" pass\n",
|
| 1627 |
+
" if token is None:\n",
|
| 1628 |
+
" print(\"[HF] No HF_TOKEN found. Set it in Colab secrets or environment.\")\n",
|
| 1629 |
+
" print(\" Colab: Settings \u2192 Secrets \u2192 Add HF_TOKEN\")\n",
|
| 1630 |
+
" return None\n",
|
| 1631 |
+
"\n",
|
| 1632 |
+
" api = HfApi(token=token)\n",
|
| 1633 |
+
" target = f\"{HF_SUBDIR}/{notebook_name}\"\n",
|
| 1634 |
+
" print(f\"[HF] Uploading to {HF_REPO}/{target} ...\")\n",
|
| 1635 |
+
"\n",
|
| 1636 |
+
" # Upload runs directory (TensorBoard logs)\n",
|
| 1637 |
+
" if os.path.exists(runs_dir) and os.listdir(runs_dir):\n",
|
| 1638 |
+
" api.upload_folder(\n",
|
| 1639 |
+
" folder_path=runs_dir,\n",
|
| 1640 |
+
" repo_id=HF_REPO,\n",
|
| 1641 |
+
" path_in_repo=f\"{target}/runs\",\n",
|
| 1642 |
+
" token=token,\n",
|
| 1643 |
+
" commit_message=f\"Upload TB runs: {notebook_name}\",\n",
|
| 1644 |
+
" )\n",
|
| 1645 |
+
" n_runs = len(os.listdir(runs_dir))\n",
|
| 1646 |
+
" print(f\"[HF] Uploaded {n_runs} TB run(s) to {target}/runs/\")\n",
|
| 1647 |
+
" else:\n",
|
| 1648 |
+
" print(f\"[HF] No runs directory found at {runs_dir}\")\n",
|
| 1649 |
+
"\n",
|
| 1650 |
+
" # Upload scoreboard JSON if provided\n",
|
| 1651 |
+
" if scoreboard_path and os.path.exists(scoreboard_path):\n",
|
| 1652 |
+
" api.upload_file(\n",
|
| 1653 |
+
" path_or_fileobj=scoreboard_path,\n",
|
| 1654 |
+
" repo_id=HF_REPO,\n",
|
| 1655 |
+
" path_in_repo=f\"{target}/scoreboard.json\",\n",
|
| 1656 |
+
" token=token,\n",
|
| 1657 |
+
" commit_message=f\"Upload scoreboard: {notebook_name}\",\n",
|
| 1658 |
+
" )\n",
|
| 1659 |
+
" print(f\"[HF] Uploaded scoreboard to {target}/scoreboard.json\")\n",
|
| 1660 |
+
"\n",
|
| 1661 |
+
" url = f\"https://huggingface.co/{HF_REPO}/tree/main/{target}\"\n",
|
| 1662 |
+
" print(f\"[HF] Done \u2192 {url}\")\n",
|
| 1663 |
+
" return url\n",
|
| 1664 |
+
"\n",
|
| 1665 |
"print(\"[SHARED] GeoLIP architecture loaded \u2014 full three-domain pipeline ready.\")\n",
|
| 1666 |
""
|
| 1667 |
],
|
|
|
|
| 2018 |
],
|
| 2019 |
"execution_count": null,
|
| 2020 |
"outputs": []
|
| 2021 |
+
},
|
| 2022 |
+
{
|
| 2023 |
+
"cell_type": "code",
|
| 2024 |
+
"metadata": {},
|
| 2025 |
+
"source": [
|
| 2026 |
+
"# @title Upload Runs to HuggingFace\n",
|
| 2027 |
+
"upload_runs_to_hf(\"experiment_4_invertible_transforms\", \"scoreboard_exp4.json\")\n",
|
| 2028 |
+
""
|
| 2029 |
+
],
|
| 2030 |
+
"execution_count": null,
|
| 2031 |
+
"outputs": []
|
| 2032 |
}
|
| 2033 |
]
|
| 2034 |
}
|
spectral/notebooks/experiment_5_matrix_decompositions.ipynb
CHANGED
|
@@ -39,7 +39,7 @@
|
|
| 39 |
"metadata": {},
|
| 40 |
"source": [
|
| 41 |
"# @title Install Dependencies\n",
|
| 42 |
-
"!pip install -q kymatio torch torchvision tensorboard matplotlib scikit-learn\n",
|
| 43 |
"%load_ext tensorboard\n",
|
| 44 |
"import torch\n",
|
| 45 |
"print(f\"PyTorch {torch.__version__}, CUDA available: {torch.cuda.is_available()}\")\n",
|
|
@@ -1595,6 +1595,73 @@
|
|
| 1595 |
" json.dump(self.results, f, indent=2)\n",
|
| 1596 |
"\n",
|
| 1597 |
"scoreboard = Scoreboard()\n",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1598 |
"print(\"[SHARED] GeoLIP architecture loaded \u2014 full three-domain pipeline ready.\")\n",
|
| 1599 |
""
|
| 1600 |
],
|
|
@@ -1900,6 +1967,17 @@
|
|
| 1900 |
],
|
| 1901 |
"execution_count": null,
|
| 1902 |
"outputs": []
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1903 |
}
|
| 1904 |
]
|
| 1905 |
}
|
|
|
|
| 39 |
"metadata": {},
|
| 40 |
"source": [
|
| 41 |
"# @title Install Dependencies\n",
|
| 42 |
+
"!pip install -q kymatio torch torchvision tensorboard matplotlib scikit-learn huggingface_hub\n",
|
| 43 |
"%load_ext tensorboard\n",
|
| 44 |
"import torch\n",
|
| 45 |
"print(f\"PyTorch {torch.__version__}, CUDA available: {torch.cuda.is_available()}\")\n",
|
|
|
|
| 1595 |
" json.dump(self.results, f, indent=2)\n",
|
| 1596 |
"\n",
|
| 1597 |
"scoreboard = Scoreboard()\n",
|
| 1598 |
+
"\n",
|
| 1599 |
+
"\n",
|
| 1600 |
+
"# \u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\n",
|
| 1601 |
+
"# HUGGINGFACE UPLOAD \u2014 push TB runs + scoreboard after experiments\n",
|
| 1602 |
+
"# \u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\n",
|
| 1603 |
+
"\n",
|
| 1604 |
+
"HF_REPO = \"AbstractPhil/geolip-hypersphere-experiments\"\n",
|
| 1605 |
+
"HF_SUBDIR = \"spectral/notebooks\"\n",
|
| 1606 |
+
"\n",
|
| 1607 |
+
"def upload_runs_to_hf(notebook_name, scoreboard_path=None, runs_dir=\"runs\"):\n",
|
| 1608 |
+
" \"\"\"Upload TensorBoard runs and scoreboard to HuggingFace repo.\n",
|
| 1609 |
+
"\n",
|
| 1610 |
+
" Uploads to: {HF_REPO}/spectral/notebooks/{notebook_name}/\n",
|
| 1611 |
+
" Requires HF_TOKEN in Colab secrets or environment.\n",
|
| 1612 |
+
" \"\"\"\n",
|
| 1613 |
+
" try:\n",
|
| 1614 |
+
" from huggingface_hub import HfApi, login\n",
|
| 1615 |
+
" except ImportError:\n",
|
| 1616 |
+
" print(\"[HF] huggingface_hub not installed \u2014 skipping upload\")\n",
|
| 1617 |
+
" return None\n",
|
| 1618 |
+
"\n",
|
| 1619 |
+
" # Get token\n",
|
| 1620 |
+
" token = os.environ.get('HF_TOKEN') or os.environ.get('HUGGINGFACE_TOKEN')\n",
|
| 1621 |
+
" if token is None:\n",
|
| 1622 |
+
" try:\n",
|
| 1623 |
+
" from google.colab import userdata\n",
|
| 1624 |
+
" token = userdata.get('HF_TOKEN')\n",
|
| 1625 |
+
" except Exception:\n",
|
| 1626 |
+
" pass\n",
|
| 1627 |
+
" if token is None:\n",
|
| 1628 |
+
" print(\"[HF] No HF_TOKEN found. Set it in Colab secrets or environment.\")\n",
|
| 1629 |
+
" print(\" Colab: Settings \u2192 Secrets \u2192 Add HF_TOKEN\")\n",
|
| 1630 |
+
" return None\n",
|
| 1631 |
+
"\n",
|
| 1632 |
+
" api = HfApi(token=token)\n",
|
| 1633 |
+
" target = f\"{HF_SUBDIR}/{notebook_name}\"\n",
|
| 1634 |
+
" print(f\"[HF] Uploading to {HF_REPO}/{target} ...\")\n",
|
| 1635 |
+
"\n",
|
| 1636 |
+
" # Upload runs directory (TensorBoard logs)\n",
|
| 1637 |
+
" if os.path.exists(runs_dir) and os.listdir(runs_dir):\n",
|
| 1638 |
+
" api.upload_folder(\n",
|
| 1639 |
+
" folder_path=runs_dir,\n",
|
| 1640 |
+
" repo_id=HF_REPO,\n",
|
| 1641 |
+
" path_in_repo=f\"{target}/runs\",\n",
|
| 1642 |
+
" token=token,\n",
|
| 1643 |
+
" commit_message=f\"Upload TB runs: {notebook_name}\",\n",
|
| 1644 |
+
" )\n",
|
| 1645 |
+
" n_runs = len(os.listdir(runs_dir))\n",
|
| 1646 |
+
" print(f\"[HF] Uploaded {n_runs} TB run(s) to {target}/runs/\")\n",
|
| 1647 |
+
" else:\n",
|
| 1648 |
+
" print(f\"[HF] No runs directory found at {runs_dir}\")\n",
|
| 1649 |
+
"\n",
|
| 1650 |
+
" # Upload scoreboard JSON if provided\n",
|
| 1651 |
+
" if scoreboard_path and os.path.exists(scoreboard_path):\n",
|
| 1652 |
+
" api.upload_file(\n",
|
| 1653 |
+
" path_or_fileobj=scoreboard_path,\n",
|
| 1654 |
+
" repo_id=HF_REPO,\n",
|
| 1655 |
+
" path_in_repo=f\"{target}/scoreboard.json\",\n",
|
| 1656 |
+
" token=token,\n",
|
| 1657 |
+
" commit_message=f\"Upload scoreboard: {notebook_name}\",\n",
|
| 1658 |
+
" )\n",
|
| 1659 |
+
" print(f\"[HF] Uploaded scoreboard to {target}/scoreboard.json\")\n",
|
| 1660 |
+
"\n",
|
| 1661 |
+
" url = f\"https://huggingface.co/{HF_REPO}/tree/main/{target}\"\n",
|
| 1662 |
+
" print(f\"[HF] Done \u2192 {url}\")\n",
|
| 1663 |
+
" return url\n",
|
| 1664 |
+
"\n",
|
| 1665 |
"print(\"[SHARED] GeoLIP architecture loaded \u2014 full three-domain pipeline ready.\")\n",
|
| 1666 |
""
|
| 1667 |
],
|
|
|
|
| 1967 |
],
|
| 1968 |
"execution_count": null,
|
| 1969 |
"outputs": []
|
| 1970 |
+
},
|
| 1971 |
+
{
|
| 1972 |
+
"cell_type": "code",
|
| 1973 |
+
"metadata": {},
|
| 1974 |
+
"source": [
|
| 1975 |
+
"# @title Upload Runs to HuggingFace\n",
|
| 1976 |
+
"upload_runs_to_hf(\"experiment_5_matrix_decompositions\", \"scoreboard_exp5.json\")\n",
|
| 1977 |
+
""
|
| 1978 |
+
],
|
| 1979 |
+
"execution_count": null,
|
| 1980 |
+
"outputs": []
|
| 1981 |
}
|
| 1982 |
]
|
| 1983 |
}
|
spectral/notebooks/experiment_6_losses_and_anchors.ipynb
CHANGED
|
@@ -41,7 +41,7 @@
|
|
| 41 |
"metadata": {},
|
| 42 |
"source": [
|
| 43 |
"# @title Install Dependencies\n",
|
| 44 |
-
"!pip install -q kymatio torch torchvision tensorboard matplotlib scikit-learn\n",
|
| 45 |
"%load_ext tensorboard\n",
|
| 46 |
"import torch\n",
|
| 47 |
"print(f\"PyTorch {torch.__version__}, CUDA available: {torch.cuda.is_available()}\")\n",
|
|
@@ -1597,6 +1597,73 @@
|
|
| 1597 |
" json.dump(self.results, f, indent=2)\n",
|
| 1598 |
"\n",
|
| 1599 |
"scoreboard = Scoreboard()\n",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1600 |
"print(\"[SHARED] GeoLIP architecture loaded \u2014 full three-domain pipeline ready.\")\n",
|
| 1601 |
""
|
| 1602 |
],
|
|
@@ -1845,6 +1912,17 @@
|
|
| 1845 |
],
|
| 1846 |
"execution_count": null,
|
| 1847 |
"outputs": []
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1848 |
}
|
| 1849 |
]
|
| 1850 |
}
|
|
|
|
| 41 |
"metadata": {},
|
| 42 |
"source": [
|
| 43 |
"# @title Install Dependencies\n",
|
| 44 |
+
"!pip install -q kymatio torch torchvision tensorboard matplotlib scikit-learn huggingface_hub\n",
|
| 45 |
"%load_ext tensorboard\n",
|
| 46 |
"import torch\n",
|
| 47 |
"print(f\"PyTorch {torch.__version__}, CUDA available: {torch.cuda.is_available()}\")\n",
|
|
|
|
| 1597 |
" json.dump(self.results, f, indent=2)\n",
|
| 1598 |
"\n",
|
| 1599 |
"scoreboard = Scoreboard()\n",
|
| 1600 |
+
"\n",
|
| 1601 |
+
"\n",
|
| 1602 |
+
"# \u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\n",
|
| 1603 |
+
"# HUGGINGFACE UPLOAD \u2014 push TB runs + scoreboard after experiments\n",
|
| 1604 |
+
"# \u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\n",
|
| 1605 |
+
"\n",
|
| 1606 |
+
"HF_REPO = \"AbstractPhil/geolip-hypersphere-experiments\"\n",
|
| 1607 |
+
"HF_SUBDIR = \"spectral/notebooks\"\n",
|
| 1608 |
+
"\n",
|
| 1609 |
+
"def upload_runs_to_hf(notebook_name, scoreboard_path=None, runs_dir=\"runs\"):\n",
|
| 1610 |
+
" \"\"\"Upload TensorBoard runs and scoreboard to HuggingFace repo.\n",
|
| 1611 |
+
"\n",
|
| 1612 |
+
" Uploads to: {HF_REPO}/spectral/notebooks/{notebook_name}/\n",
|
| 1613 |
+
" Requires HF_TOKEN in Colab secrets or environment.\n",
|
| 1614 |
+
" \"\"\"\n",
|
| 1615 |
+
" try:\n",
|
| 1616 |
+
" from huggingface_hub import HfApi, login\n",
|
| 1617 |
+
" except ImportError:\n",
|
| 1618 |
+
" print(\"[HF] huggingface_hub not installed \u2014 skipping upload\")\n",
|
| 1619 |
+
" return None\n",
|
| 1620 |
+
"\n",
|
| 1621 |
+
" # Get token\n",
|
| 1622 |
+
" token = os.environ.get('HF_TOKEN') or os.environ.get('HUGGINGFACE_TOKEN')\n",
|
| 1623 |
+
" if token is None:\n",
|
| 1624 |
+
" try:\n",
|
| 1625 |
+
" from google.colab import userdata\n",
|
| 1626 |
+
" token = userdata.get('HF_TOKEN')\n",
|
| 1627 |
+
" except Exception:\n",
|
| 1628 |
+
" pass\n",
|
| 1629 |
+
" if token is None:\n",
|
| 1630 |
+
" print(\"[HF] No HF_TOKEN found. Set it in Colab secrets or environment.\")\n",
|
| 1631 |
+
" print(\" Colab: Settings \u2192 Secrets \u2192 Add HF_TOKEN\")\n",
|
| 1632 |
+
" return None\n",
|
| 1633 |
+
"\n",
|
| 1634 |
+
" api = HfApi(token=token)\n",
|
| 1635 |
+
" target = f\"{HF_SUBDIR}/{notebook_name}\"\n",
|
| 1636 |
+
" print(f\"[HF] Uploading to {HF_REPO}/{target} ...\")\n",
|
| 1637 |
+
"\n",
|
| 1638 |
+
" # Upload runs directory (TensorBoard logs)\n",
|
| 1639 |
+
" if os.path.exists(runs_dir) and os.listdir(runs_dir):\n",
|
| 1640 |
+
" api.upload_folder(\n",
|
| 1641 |
+
" folder_path=runs_dir,\n",
|
| 1642 |
+
" repo_id=HF_REPO,\n",
|
| 1643 |
+
" path_in_repo=f\"{target}/runs\",\n",
|
| 1644 |
+
" token=token,\n",
|
| 1645 |
+
" commit_message=f\"Upload TB runs: {notebook_name}\",\n",
|
| 1646 |
+
" )\n",
|
| 1647 |
+
" n_runs = len(os.listdir(runs_dir))\n",
|
| 1648 |
+
" print(f\"[HF] Uploaded {n_runs} TB run(s) to {target}/runs/\")\n",
|
| 1649 |
+
" else:\n",
|
| 1650 |
+
" print(f\"[HF] No runs directory found at {runs_dir}\")\n",
|
| 1651 |
+
"\n",
|
| 1652 |
+
" # Upload scoreboard JSON if provided\n",
|
| 1653 |
+
" if scoreboard_path and os.path.exists(scoreboard_path):\n",
|
| 1654 |
+
" api.upload_file(\n",
|
| 1655 |
+
" path_or_fileobj=scoreboard_path,\n",
|
| 1656 |
+
" repo_id=HF_REPO,\n",
|
| 1657 |
+
" path_in_repo=f\"{target}/scoreboard.json\",\n",
|
| 1658 |
+
" token=token,\n",
|
| 1659 |
+
" commit_message=f\"Upload scoreboard: {notebook_name}\",\n",
|
| 1660 |
+
" )\n",
|
| 1661 |
+
" print(f\"[HF] Uploaded scoreboard to {target}/scoreboard.json\")\n",
|
| 1662 |
+
"\n",
|
| 1663 |
+
" url = f\"https://huggingface.co/{HF_REPO}/tree/main/{target}\"\n",
|
| 1664 |
+
" print(f\"[HF] Done \u2192 {url}\")\n",
|
| 1665 |
+
" return url\n",
|
| 1666 |
+
"\n",
|
| 1667 |
"print(\"[SHARED] GeoLIP architecture loaded \u2014 full three-domain pipeline ready.\")\n",
|
| 1668 |
""
|
| 1669 |
],
|
|
|
|
| 1912 |
],
|
| 1913 |
"execution_count": null,
|
| 1914 |
"outputs": []
|
| 1915 |
+
},
|
| 1916 |
+
{
|
| 1917 |
+
"cell_type": "code",
|
| 1918 |
+
"metadata": {},
|
| 1919 |
+
"source": [
|
| 1920 |
+
"# @title Upload Runs to HuggingFace\n",
|
| 1921 |
+
"upload_runs_to_hf(\"experiment_6_losses_and_anchors\", \"scoreboard_exp6.json\")\n",
|
| 1922 |
+
""
|
| 1923 |
+
],
|
| 1924 |
+
"execution_count": null,
|
| 1925 |
+
"outputs": []
|
| 1926 |
}
|
| 1927 |
]
|
| 1928 |
}
|
spectral/notebooks/experiment_7_composite_pipelines.ipynb
CHANGED
|
@@ -39,7 +39,7 @@
|
|
| 39 |
"metadata": {},
|
| 40 |
"source": [
|
| 41 |
"# @title Install Dependencies\n",
|
| 42 |
-
"!pip install -q kymatio torch torchvision tensorboard matplotlib scikit-learn\n",
|
| 43 |
"%load_ext tensorboard\n",
|
| 44 |
"import torch\n",
|
| 45 |
"print(f\"PyTorch {torch.__version__}, CUDA available: {torch.cuda.is_available()}\")\n",
|
|
@@ -1595,6 +1595,73 @@
|
|
| 1595 |
" json.dump(self.results, f, indent=2)\n",
|
| 1596 |
"\n",
|
| 1597 |
"scoreboard = Scoreboard()\n",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1598 |
"print(\"[SHARED] GeoLIP architecture loaded \u2014 full three-domain pipeline ready.\")\n",
|
| 1599 |
""
|
| 1600 |
],
|
|
@@ -1979,6 +2046,17 @@
|
|
| 1979 |
],
|
| 1980 |
"execution_count": null,
|
| 1981 |
"outputs": []
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1982 |
}
|
| 1983 |
]
|
| 1984 |
}
|
|
|
|
| 39 |
"metadata": {},
|
| 40 |
"source": [
|
| 41 |
"# @title Install Dependencies\n",
|
| 42 |
+
"!pip install -q kymatio torch torchvision tensorboard matplotlib scikit-learn huggingface_hub\n",
|
| 43 |
"%load_ext tensorboard\n",
|
| 44 |
"import torch\n",
|
| 45 |
"print(f\"PyTorch {torch.__version__}, CUDA available: {torch.cuda.is_available()}\")\n",
|
|
|
|
| 1595 |
" json.dump(self.results, f, indent=2)\n",
|
| 1596 |
"\n",
|
| 1597 |
"scoreboard = Scoreboard()\n",
|
| 1598 |
+
"\n",
|
| 1599 |
+
"\n",
|
| 1600 |
+
"# \u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\n",
|
| 1601 |
+
"# HUGGINGFACE UPLOAD \u2014 push TB runs + scoreboard after experiments\n",
|
| 1602 |
+
"# \u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\n",
|
| 1603 |
+
"\n",
|
| 1604 |
+
"HF_REPO = \"AbstractPhil/geolip-hypersphere-experiments\"\n",
|
| 1605 |
+
"HF_SUBDIR = \"spectral/notebooks\"\n",
|
| 1606 |
+
"\n",
|
| 1607 |
+
"def upload_runs_to_hf(notebook_name, scoreboard_path=None, runs_dir=\"runs\"):\n",
|
| 1608 |
+
" \"\"\"Upload TensorBoard runs and scoreboard to HuggingFace repo.\n",
|
| 1609 |
+
"\n",
|
| 1610 |
+
" Uploads to: {HF_REPO}/spectral/notebooks/{notebook_name}/\n",
|
| 1611 |
+
" Requires HF_TOKEN in Colab secrets or environment.\n",
|
| 1612 |
+
" \"\"\"\n",
|
| 1613 |
+
" try:\n",
|
| 1614 |
+
" from huggingface_hub import HfApi, login\n",
|
| 1615 |
+
" except ImportError:\n",
|
| 1616 |
+
" print(\"[HF] huggingface_hub not installed \u2014 skipping upload\")\n",
|
| 1617 |
+
" return None\n",
|
| 1618 |
+
"\n",
|
| 1619 |
+
" # Get token\n",
|
| 1620 |
+
" token = os.environ.get('HF_TOKEN') or os.environ.get('HUGGINGFACE_TOKEN')\n",
|
| 1621 |
+
" if token is None:\n",
|
| 1622 |
+
" try:\n",
|
| 1623 |
+
" from google.colab import userdata\n",
|
| 1624 |
+
" token = userdata.get('HF_TOKEN')\n",
|
| 1625 |
+
" except Exception:\n",
|
| 1626 |
+
" pass\n",
|
| 1627 |
+
" if token is None:\n",
|
| 1628 |
+
" print(\"[HF] No HF_TOKEN found. Set it in Colab secrets or environment.\")\n",
|
| 1629 |
+
" print(\" Colab: Settings \u2192 Secrets \u2192 Add HF_TOKEN\")\n",
|
| 1630 |
+
" return None\n",
|
| 1631 |
+
"\n",
|
| 1632 |
+
" api = HfApi(token=token)\n",
|
| 1633 |
+
" target = f\"{HF_SUBDIR}/{notebook_name}\"\n",
|
| 1634 |
+
" print(f\"[HF] Uploading to {HF_REPO}/{target} ...\")\n",
|
| 1635 |
+
"\n",
|
| 1636 |
+
" # Upload runs directory (TensorBoard logs)\n",
|
| 1637 |
+
" if os.path.exists(runs_dir) and os.listdir(runs_dir):\n",
|
| 1638 |
+
" api.upload_folder(\n",
|
| 1639 |
+
" folder_path=runs_dir,\n",
|
| 1640 |
+
" repo_id=HF_REPO,\n",
|
| 1641 |
+
" path_in_repo=f\"{target}/runs\",\n",
|
| 1642 |
+
" token=token,\n",
|
| 1643 |
+
" commit_message=f\"Upload TB runs: {notebook_name}\",\n",
|
| 1644 |
+
" )\n",
|
| 1645 |
+
" n_runs = len(os.listdir(runs_dir))\n",
|
| 1646 |
+
" print(f\"[HF] Uploaded {n_runs} TB run(s) to {target}/runs/\")\n",
|
| 1647 |
+
" else:\n",
|
| 1648 |
+
" print(f\"[HF] No runs directory found at {runs_dir}\")\n",
|
| 1649 |
+
"\n",
|
| 1650 |
+
" # Upload scoreboard JSON if provided\n",
|
| 1651 |
+
" if scoreboard_path and os.path.exists(scoreboard_path):\n",
|
| 1652 |
+
" api.upload_file(\n",
|
| 1653 |
+
" path_or_fileobj=scoreboard_path,\n",
|
| 1654 |
+
" repo_id=HF_REPO,\n",
|
| 1655 |
+
" path_in_repo=f\"{target}/scoreboard.json\",\n",
|
| 1656 |
+
" token=token,\n",
|
| 1657 |
+
" commit_message=f\"Upload scoreboard: {notebook_name}\",\n",
|
| 1658 |
+
" )\n",
|
| 1659 |
+
" print(f\"[HF] Uploaded scoreboard to {target}/scoreboard.json\")\n",
|
| 1660 |
+
"\n",
|
| 1661 |
+
" url = f\"https://huggingface.co/{HF_REPO}/tree/main/{target}\"\n",
|
| 1662 |
+
" print(f\"[HF] Done \u2192 {url}\")\n",
|
| 1663 |
+
" return url\n",
|
| 1664 |
+
"\n",
|
| 1665 |
"print(\"[SHARED] GeoLIP architecture loaded \u2014 full three-domain pipeline ready.\")\n",
|
| 1666 |
""
|
| 1667 |
],
|
|
|
|
| 2046 |
],
|
| 2047 |
"execution_count": null,
|
| 2048 |
"outputs": []
|
| 2049 |
+
},
|
| 2050 |
+
{
|
| 2051 |
+
"cell_type": "code",
|
| 2052 |
+
"metadata": {},
|
| 2053 |
+
"source": [
|
| 2054 |
+
"# @title Upload Runs to HuggingFace\n",
|
| 2055 |
+
"upload_runs_to_hf(\"experiment_7_composite_pipelines\", \"scoreboard_exp7.json\")\n",
|
| 2056 |
+
""
|
| 2057 |
+
],
|
| 2058 |
+
"execution_count": null,
|
| 2059 |
+
"outputs": []
|
| 2060 |
}
|
| 2061 |
]
|
| 2062 |
}
|