Skip to content

Instantly share code, notes, and snippets.

@veb-101
Created June 16, 2023 08:07
Show Gist options
  • Save veb-101/6935737da34ffb7eb04c7f9796335f36 to your computer and use it in GitHub Desktop.
Save veb-101/6935737da34ffb7eb04c7f9796335f36 to your computer and use it in GitHub Desktop.
Delete WandB run saved (uploaded) files
Display the source blob
Display the rendered blob
Raw
{
"nbformat": 4,
"nbformat_minor": 0,
"metadata": {
"colab": {
"provenance": []
},
"kernelspec": {
"name": "python3",
"display_name": "Python 3"
},
"language_info": {
"name": "python"
},
"widgets": {
"application/vnd.jupyter.widget-state+json": {
"bf51effd47094417a7c0bd5f48812091": {
"model_module": "@jupyter-widgets/controls",
"model_name": "VBoxModel",
"model_module_version": "1.5.0",
"state": {
"_dom_classes": [],
"_model_module": "@jupyter-widgets/controls",
"_model_module_version": "1.5.0",
"_model_name": "VBoxModel",
"_view_count": null,
"_view_module": "@jupyter-widgets/controls",
"_view_module_version": "1.5.0",
"_view_name": "VBoxView",
"box_style": "",
"children": [
"IPY_MODEL_77b67fd4b3e44a7cbfef71c968390d11",
"IPY_MODEL_e7bc3c3232254fe3a3054353240b3bb2"
],
"layout": "IPY_MODEL_a01fd95e915b4bb49d229c8cf735e60b"
}
},
"77b67fd4b3e44a7cbfef71c968390d11": {
"model_module": "@jupyter-widgets/controls",
"model_name": "LabelModel",
"model_module_version": "1.5.0",
"state": {
"_dom_classes": [],
"_model_module": "@jupyter-widgets/controls",
"_model_module_version": "1.5.0",
"_model_name": "LabelModel",
"_view_count": null,
"_view_module": "@jupyter-widgets/controls",
"_view_module_version": "1.5.0",
"_view_name": "LabelView",
"description": "",
"description_tooltip": null,
"layout": "IPY_MODEL_bc4d7caca23b44b1a6904ea7e8a696d6",
"placeholder": "​",
"style": "IPY_MODEL_528778eb43e545e2851cf5588173a962",
"value": "79.283 MB of 79.288 MB uploaded (0.000 MB deduped)\r"
}
},
"e7bc3c3232254fe3a3054353240b3bb2": {
"model_module": "@jupyter-widgets/controls",
"model_name": "FloatProgressModel",
"model_module_version": "1.5.0",
"state": {
"_dom_classes": [],
"_model_module": "@jupyter-widgets/controls",
"_model_module_version": "1.5.0",
"_model_name": "FloatProgressModel",
"_view_count": null,
"_view_module": "@jupyter-widgets/controls",
"_view_module_version": "1.5.0",
"_view_name": "ProgressView",
"bar_style": "",
"description": "",
"description_tooltip": null,
"layout": "IPY_MODEL_dc2946bd033049579ddeb7a69442bb41",
"max": 1,
"min": 0,
"orientation": "horizontal",
"style": "IPY_MODEL_a07d5ccd45634b96a5df25fd906cdd53",
"value": 0.9999411470232278
}
},
"a01fd95e915b4bb49d229c8cf735e60b": {
"model_module": "@jupyter-widgets/base",
"model_name": "LayoutModel",
"model_module_version": "1.2.0",
"state": {
"_model_module": "@jupyter-widgets/base",
"_model_module_version": "1.2.0",
"_model_name": "LayoutModel",
"_view_count": null,
"_view_module": "@jupyter-widgets/base",
"_view_module_version": "1.2.0",
"_view_name": "LayoutView",
"align_content": null,
"align_items": null,
"align_self": null,
"border": null,
"bottom": null,
"display": null,
"flex": null,
"flex_flow": null,
"grid_area": null,
"grid_auto_columns": null,
"grid_auto_flow": null,
"grid_auto_rows": null,
"grid_column": null,
"grid_gap": null,
"grid_row": null,
"grid_template_areas": null,
"grid_template_columns": null,
"grid_template_rows": null,
"height": null,
"justify_content": null,
"justify_items": null,
"left": null,
"margin": null,
"max_height": null,
"max_width": null,
"min_height": null,
"min_width": null,
"object_fit": null,
"object_position": null,
"order": null,
"overflow": null,
"overflow_x": null,
"overflow_y": null,
"padding": null,
"right": null,
"top": null,
"visibility": null,
"width": null
}
},
"bc4d7caca23b44b1a6904ea7e8a696d6": {
"model_module": "@jupyter-widgets/base",
"model_name": "LayoutModel",
"model_module_version": "1.2.0",
"state": {
"_model_module": "@jupyter-widgets/base",
"_model_module_version": "1.2.0",
"_model_name": "LayoutModel",
"_view_count": null,
"_view_module": "@jupyter-widgets/base",
"_view_module_version": "1.2.0",
"_view_name": "LayoutView",
"align_content": null,
"align_items": null,
"align_self": null,
"border": null,
"bottom": null,
"display": null,
"flex": null,
"flex_flow": null,
"grid_area": null,
"grid_auto_columns": null,
"grid_auto_flow": null,
"grid_auto_rows": null,
"grid_column": null,
"grid_gap": null,
"grid_row": null,
"grid_template_areas": null,
"grid_template_columns": null,
"grid_template_rows": null,
"height": null,
"justify_content": null,
"justify_items": null,
"left": null,
"margin": null,
"max_height": null,
"max_width": null,
"min_height": null,
"min_width": null,
"object_fit": null,
"object_position": null,
"order": null,
"overflow": null,
"overflow_x": null,
"overflow_y": null,
"padding": null,
"right": null,
"top": null,
"visibility": null,
"width": null
}
},
"528778eb43e545e2851cf5588173a962": {
"model_module": "@jupyter-widgets/controls",
"model_name": "DescriptionStyleModel",
"model_module_version": "1.5.0",
"state": {
"_model_module": "@jupyter-widgets/controls",
"_model_module_version": "1.5.0",
"_model_name": "DescriptionStyleModel",
"_view_count": null,
"_view_module": "@jupyter-widgets/base",
"_view_module_version": "1.2.0",
"_view_name": "StyleView",
"description_width": ""
}
},
"dc2946bd033049579ddeb7a69442bb41": {
"model_module": "@jupyter-widgets/base",
"model_name": "LayoutModel",
"model_module_version": "1.2.0",
"state": {
"_model_module": "@jupyter-widgets/base",
"_model_module_version": "1.2.0",
"_model_name": "LayoutModel",
"_view_count": null,
"_view_module": "@jupyter-widgets/base",
"_view_module_version": "1.2.0",
"_view_name": "LayoutView",
"align_content": null,
"align_items": null,
"align_self": null,
"border": null,
"bottom": null,
"display": null,
"flex": null,
"flex_flow": null,
"grid_area": null,
"grid_auto_columns": null,
"grid_auto_flow": null,
"grid_auto_rows": null,
"grid_column": null,
"grid_gap": null,
"grid_row": null,
"grid_template_areas": null,
"grid_template_columns": null,
"grid_template_rows": null,
"height": null,
"justify_content": null,
"justify_items": null,
"left": null,
"margin": null,
"max_height": null,
"max_width": null,
"min_height": null,
"min_width": null,
"object_fit": null,
"object_position": null,
"order": null,
"overflow": null,
"overflow_x": null,
"overflow_y": null,
"padding": null,
"right": null,
"top": null,
"visibility": null,
"width": null
}
},
"a07d5ccd45634b96a5df25fd906cdd53": {
"model_module": "@jupyter-widgets/controls",
"model_name": "ProgressStyleModel",
"model_module_version": "1.5.0",
"state": {
"_model_module": "@jupyter-widgets/controls",
"_model_module_version": "1.5.0",
"_model_name": "ProgressStyleModel",
"_view_count": null,
"_view_module": "@jupyter-widgets/base",
"_view_module_version": "1.2.0",
"_view_name": "StyleView",
"bar_color": null,
"description_width": ""
}
}
}
}
},
"cells": [
{
"cell_type": "code",
"execution_count": 3,
"metadata": {
"id": "LNfsesgjK_jh"
},
"outputs": [],
"source": [
"!pip install -qU wandb"
]
},
{
"cell_type": "code",
"source": [
"import wandb\n",
"wandb.login(relogin=True)"
],
"metadata": {
"colab": {
"base_uri": "https://localhost:8080/",
"height": 69
},
"id": "nXvBX1OoLF6I",
"outputId": "08f76d40-10ce-4300-97c4-f5f5afc26fef"
},
"execution_count": 1,
"outputs": [
{
"output_type": "display_data",
"data": {
"text/plain": [
"<IPython.core.display.Javascript object>"
],
"application/javascript": [
"\n",
" window._wandbApiKey = new Promise((resolve, reject) => {\n",
" function loadScript(url) {\n",
" return new Promise(function(resolve, reject) {\n",
" let newScript = document.createElement(\"script\");\n",
" newScript.onerror = reject;\n",
" newScript.onload = resolve;\n",
" document.body.appendChild(newScript);\n",
" newScript.src = url;\n",
" });\n",
" }\n",
" loadScript(\"https://cdn.jsdelivr.net/npm/postmate/build/postmate.min.js\").then(() => {\n",
" const iframe = document.createElement('iframe')\n",
" iframe.style.cssText = \"width:0;height:0;border:none\"\n",
" document.body.appendChild(iframe)\n",
" const handshake = new Postmate({\n",
" container: iframe,\n",
" url: 'https://wandb.ai/authorize'\n",
" });\n",
" const timeout = setTimeout(() => reject(\"Couldn't auto authenticate\"), 5000)\n",
" handshake.then(function(child) {\n",
" child.on('authorize', data => {\n",
" clearTimeout(timeout)\n",
" resolve(data)\n",
" });\n",
" });\n",
" })\n",
" });\n",
" "
]
},
"metadata": {}
},
{
"output_type": "stream",
"name": "stderr",
"text": [
"\u001b[34m\u001b[1mwandb\u001b[0m: Appending key for api.wandb.ai to your netrc file: /root/.netrc\n"
]
},
{
"output_type": "execute_result",
"data": {
"text/plain": [
"True"
]
},
"metadata": {},
"execution_count": 1
}
]
},
{
"cell_type": "code",
"source": [
"# !gdown 1FV5g1Tha_XNgqiXZNsGePQgsaEA7Q2bc\n",
"!unzip -qq /content/Transfer_learning.zip"
],
"metadata": {
"id": "CqXN-yqgLIAw"
},
"execution_count": 2,
"outputs": []
},
{
"cell_type": "code",
"source": [
"run_id = \"ko4bopp5\"\n",
"\n",
"run = wandb.init(project=\"Classification_Oxford_flowers102\", id=run_id, resume=\"allow\")"
],
"metadata": {
"colab": {
"base_uri": "https://localhost:8080/",
"height": 104
},
"id": "jIrQx_2PLUDz",
"outputId": "49778f89-3311-4161-84ca-e613bf9ae806"
},
"execution_count": 24,
"outputs": [
{
"output_type": "display_data",
"data": {
"text/plain": [
"<IPython.core.display.HTML object>"
],
"text/html": [
"Tracking run with wandb version 0.15.3"
]
},
"metadata": {}
},
{
"output_type": "display_data",
"data": {
"text/plain": [
"<IPython.core.display.HTML object>"
],
"text/html": [
"Run data is saved locally in <code>/content/wandb/run-20230602_222419-ko4bopp5</code>"
]
},
"metadata": {}
},
{
"output_type": "display_data",
"data": {
"text/plain": [
"<IPython.core.display.HTML object>"
],
"text/html": [
"Resuming run <strong><a href='https://wandb.ai/opencv_courses/Classification_Oxford_flowers102/runs/ko4bopp5' target=\"_blank\">fresh-valley-2</a></strong> to <a href='https://wandb.ai/opencv_courses/Classification_Oxford_flowers102' target=\"_blank\">Weights & Biases</a> (<a href='https://wandb.me/run' target=\"_blank\">docs</a>)<br/>"
]
},
"metadata": {}
},
{
"output_type": "display_data",
"data": {
"text/plain": [
"<IPython.core.display.HTML object>"
],
"text/html": [
" View project at <a href='https://wandb.ai/opencv_courses/Classification_Oxford_flowers102' target=\"_blank\">https://wandb.ai/opencv_courses/Classification_Oxford_flowers102</a>"
]
},
"metadata": {}
},
{
"output_type": "display_data",
"data": {
"text/plain": [
"<IPython.core.display.HTML object>"
],
"text/html": [
" View run at <a href='https://wandb.ai/opencv_courses/Classification_Oxford_flowers102/runs/ko4bopp5' target=\"_blank\">https://wandb.ai/opencv_courses/Classification_Oxford_flowers102/runs/ko4bopp5</a>"
]
},
"metadata": {}
}
]
},
{
"cell_type": "code",
"source": [
"api = wandb.Api()\n",
"\n",
"old_run = api.run(rf\"opencv_courses/Classification_Oxford_flowers102/runs/{run_id}\")\n",
"\n",
"# for i in old_run.files():\n",
"# print(i.name)\n",
"\n",
"for file in old_run.files():\n",
" if \".tar\" in file.name:\n",
" print(file.name)\n",
" file.delete() \n",
" print(\"File deleted successfully.\")"
],
"metadata": {
"colab": {
"base_uri": "https://localhost:8080/"
},
"id": "L_WjoNEVLr3b",
"outputId": "933886b4-6013-4a24-8378-71bc006e6d99"
},
"execution_count": 25,
"outputs": [
{
"output_type": "stream",
"name": "stdout",
"text": [
"model_checkpoint/version_2/ckpt.tar\n",
"File deleted successfully.\n"
]
}
]
},
{
"cell_type": "code",
"source": [
"import os\n",
"\n",
"wandb.save(os.path.join(os.getcwd(), f\"{run_id}\", \"ckpt.tar\"))"
],
"metadata": {
"colab": {
"base_uri": "https://localhost:8080/"
},
"id": "FsNHv_hKL_Qx",
"outputId": "3f28758f-df9e-403b-dbf1-d6fd293ca6a7"
},
"execution_count": 26,
"outputs": [
{
"output_type": "execute_result",
"data": {
"text/plain": [
"['/content/wandb/run-20230602_222419-ko4bopp5/files/ckpt.tar']"
]
},
"metadata": {},
"execution_count": 26
}
]
},
{
"cell_type": "code",
"source": [
"run.finish()"
],
"metadata": {
"colab": {
"base_uri": "https://localhost:8080/",
"height": 440,
"referenced_widgets": [
"bf51effd47094417a7c0bd5f48812091",
"77b67fd4b3e44a7cbfef71c968390d11",
"e7bc3c3232254fe3a3054353240b3bb2",
"a01fd95e915b4bb49d229c8cf735e60b",
"bc4d7caca23b44b1a6904ea7e8a696d6",
"528778eb43e545e2851cf5588173a962",
"dc2946bd033049579ddeb7a69442bb41",
"a07d5ccd45634b96a5df25fd906cdd53"
]
},
"id": "qn1uSz69MNok",
"outputId": "9c7b705a-6934-4deb-d28c-fe9f6ff02a4e"
},
"execution_count": 27,
"outputs": [
{
"output_type": "display_data",
"data": {
"text/plain": [
"<IPython.core.display.HTML object>"
],
"text/html": [
"Waiting for W&B process to finish... <strong style=\"color:green\">(success).</strong>"
]
},
"metadata": {}
},
{
"output_type": "display_data",
"data": {
"text/plain": [
"VBox(children=(Label(value='79.283 MB of 79.283 MB uploaded (0.000 MB deduped)\\r'), FloatProgress(value=1.0, m…"
],
"application/vnd.jupyter.widget-view+json": {
"version_major": 2,
"version_minor": 0,
"model_id": "bf51effd47094417a7c0bd5f48812091"
}
},
"metadata": {}
},
{
"output_type": "display_data",
"data": {
"text/plain": [
"<IPython.core.display.HTML object>"
],
"text/html": [
"<style>\n",
" table.wandb td:nth-child(1) { padding: 0 10px; text-align: left ; width: auto;} td:nth-child(2) {text-align: left ; width: 100%}\n",
" .wandb-row { display: flex; flex-direction: row; flex-wrap: wrap; justify-content: flex-start; width: 100% }\n",
" .wandb-col { display: flex; flex-direction: column; flex-basis: 100%; flex: 1; padding: 10px; }\n",
" </style>\n",
"<div class=\"wandb-row\"><div class=\"wandb-col\"><h3>Run summary:</h3><br/><table class=\"wandb\"><tr><td>acc</td><td>0.91283</td></tr><tr><td>best_valid_acc</td><td>0.89314</td></tr><tr><td>best_valid_loss</td><td>1.40355</td></tr><tr><td>epoch</td><td>49</td></tr><tr><td>loss</td><td>1.55636</td></tr><tr><td>test_acc</td><td>0.88922</td></tr><tr><td>test_loss</td><td>1.3624</td></tr><tr><td>val_acc</td><td>0.89314</td></tr><tr><td>val_loss</td><td>1.41417</td></tr></table><br/></div></div>"
]
},
"metadata": {}
},
{
"output_type": "display_data",
"data": {
"text/plain": [
"<IPython.core.display.HTML object>"
],
"text/html": [
" View run <strong style=\"color:#cdcd00\">fresh-valley-2</strong> at: <a href='https://wandb.ai/opencv_courses/Classification_Oxford_flowers102/runs/ko4bopp5' target=\"_blank\">https://wandb.ai/opencv_courses/Classification_Oxford_flowers102/runs/ko4bopp5</a><br/>Synced 3 W&B file(s), 0 media file(s), 0 artifact file(s) and 1 other file(s)"
]
},
"metadata": {}
},
{
"output_type": "display_data",
"data": {
"text/plain": [
"<IPython.core.display.HTML object>"
],
"text/html": [
"Find logs at: <code>./wandb/run-20230602_222419-ko4bopp5/logs</code>"
]
},
"metadata": {}
}
]
},
{
"cell_type": "code",
"source": [],
"metadata": {
"id": "-QVCwrYcNnDo"
},
"execution_count": null,
"outputs": []
}
]
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment