Skip to content

Commit

Permalink
revert login and clean up
Browse files Browse the repository at this point in the history
  • Loading branch information
tcapelle committed Sep 22, 2023
1 parent a61318e commit cb9a32d
Show file tree
Hide file tree
Showing 107 changed files with 976 additions and 1,205 deletions.
140 changes: 43 additions & 97 deletions .github/nb_scripts/fix_login.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"cells": [
{
"cell_type": "code",
"execution_count": 51,
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
Expand All @@ -13,16 +13,28 @@
},
{
"cell_type": "code",
"execution_count": 52,
"execution_count": null,
"metadata": {},
"outputs": [],
"outputs": [
{
"data": {
"text/plain": [
"152"
]
},
"execution_count": null,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"nbs_paths = find_nbs(Path.cwd())"
"nbs_paths = find_nbs(\"../../\")\n",
"len(nbs_paths)"
]
},
{
"cell_type": "code",
"execution_count": 53,
"execution_count": null,
"metadata": {},
"outputs": [
{
Expand All @@ -31,36 +43,28 @@
"Path('/Users/tcapelle/work/examples/colabs/boosting/Credit_Scorecards_with_XGBoost_and_W&B.ipynb')"
]
},
"execution_count": 53,
"execution_count": null,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"nb_path = nbs_paths[3]\n",
"nb_path"
"nb_path\n"
]
},
{
"cell_type": "code",
"execution_count": 54,
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"def idx_login_cell(nb, delete_line=True):\n",
" for i, cell in enumerate(nb[\"cells\"]):\n",
" if cell[\"cell_type\"] == \"code\":\n",
" if \"login\" in cell[\"source\"]:\n",
" if delete_line:\n",
" cell_content = cell[\"source\"].split(\"\\n\")\n",
" cell_content = [line for line in cell_content if \"login\" not in line]\n",
" cell[\"source\"] = \"\\n\".join(cell_content) \n",
" return i"
"wandb.login()"
]
},
{
"cell_type": "code",
"execution_count": 55,
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
Expand All @@ -69,72 +73,34 @@
},
{
"cell_type": "code",
"execution_count": 56,
"metadata": {},
"outputs": [],
"source": [
"cell = nb[\"cells\"][1]"
]
},
{
"cell_type": "code",
"execution_count": 57,
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"nbformat.notebooknode.NotebookNode"
]
},
"execution_count": 57,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"type(cell)"
]
},
{
"cell_type": "code",
"execution_count": 58,
"execution_count": null,
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"{'attachments': {},\n",
" 'cell_type': 'markdown',\n",
" 'metadata': {},\n",
" 'source': '<img src=\"http://wandb.me/logo-im-png\" width=\"400\" alt=\"Weights & Biases\" /><br>\\n\\n<!--- @wandbcode{xgboost_vehicle_loan_default} -->\\n\\n<img src=\"http://wandb.me/mini-diagram\" width=\"600\" alt=\"Weights & Biases\" />'}"
"18"
]
},
"execution_count": 58,
"execution_count": null,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"cell"
"login_idx = idx_login_cell(nb, delete_line=False)\n",
"login_idx"
]
},
{
"cell_type": "code",
"execution_count": 59,
"metadata": {},
"outputs": [],
"source": [
"login_idx = idx_login_cell(nb)"
]
},
{
"cell_type": "code",
"execution_count": 60,
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"def insert_login_cell(nb, idx, code=\"!wandb login\"):\n",
"login_code = \"wandb.login()\" # or !wandb login\n",
"\n",
"def insert_login_cell(nb, idx, code=login_code, replace=True):\n",
" n_cells = len(nb[\"cells\"])\n",
" login_cell = nbformat.v4.new_code_cell(source=code)\n",
" nb[\"cells\"].insert(idx+1, login_cell)\n",
Expand All @@ -143,7 +109,7 @@
},
{
"cell_type": "code",
"execution_count": 61,
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
Expand All @@ -152,7 +118,7 @@
},
{
"cell_type": "code",
"execution_count": 62,
"execution_count": null,
"metadata": {},
"outputs": [
{
Expand All @@ -162,10 +128,10 @@
" 'execution_count': None,\n",
" 'metadata': {},\n",
" 'outputs': [],\n",
" 'source': \"import wandb\\n\\nWANDB_PROJECT ='vehicle_loan_default'\"}"
" 'source': '!wandb login'}"
]
},
"execution_count": 62,
"execution_count": null,
"metadata": {},
"output_type": "execute_result"
}
Expand All @@ -176,7 +142,7 @@
},
{
"cell_type": "code",
"execution_count": 63,
"execution_count": null,
"metadata": {},
"outputs": [
{
Expand All @@ -190,7 +156,7 @@
" 'outputs': []}"
]
},
"execution_count": 63,
"execution_count": null,
"metadata": {},
"output_type": "execute_result"
}
Expand All @@ -201,7 +167,7 @@
},
{
"cell_type": "code",
"execution_count": 64,
"execution_count": null,
"metadata": {},
"outputs": [
{
Expand All @@ -213,7 +179,7 @@
" 'source': '## Vehicle Loan Dataset\\n\\nWe will be using a simplified version of the [Vehicle Loan Default Prediction dataset](https://www.kaggle.com/sneharshinde/ltfs-av-data) from L&T which has been stored in W&B Artifacts. '}"
]
},
"execution_count": 64,
"execution_count": null,
"metadata": {},
"output_type": "execute_result"
}
Expand All @@ -224,7 +190,7 @@
},
{
"cell_type": "code",
"execution_count": 65,
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
Expand All @@ -241,7 +207,7 @@
},
{
"cell_type": "code",
"execution_count": 66,
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
Expand All @@ -251,7 +217,7 @@
},
{
"cell_type": "code",
"execution_count": 67,
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
Expand All @@ -267,34 +233,14 @@
" nbformat.validate(nb)\n",
" nbformat.write(nb, nb_path)"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": []
}
],
"metadata": {
"kernelspec": {
"display_name": "nbdev2",
"language": "python",
"name": "python3"
},
"language_info": {
"codemirror_mode": {
"name": "ipython",
"version": 3
},
"file_extension": ".py",
"mimetype": "text/x-python",
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.10.6"
},
"orig_nbformat": 4
}
},
"nbformat": 4,
"nbformat_minor": 2
Expand Down
51 changes: 6 additions & 45 deletions colabs/audiocraft/AudioCraft.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,7 @@
{
"attachments": {},
"cell_type": "markdown",
"metadata": {
"id": "W-26KlXuiXul"
},
"metadata": {},
"source": [
"<img src=\"https://wandb.me/logo-im-png\" width=\"400\" alt=\"Weights & Biases\" />\n",
"<!--- @wandbcode{audiocraft} -->\n",
Expand All @@ -24,15 +22,7 @@
{
"cell_type": "code",
"execution_count": null,
"metadata": {
"cellView": "form",
"colab": {
"base_uri": "https://localhost:8080/",
"height": 1000
},
"id": "EZU3hg4B1om6",
"outputId": "3311a45d-35c3-49e8-cbd5-4618386fa2a1"
},
"metadata": {},
"outputs": [],
"source": [
"# @title Install AudioCraft + WandB\n",
Expand All @@ -43,10 +33,7 @@
{
"cell_type": "code",
"execution_count": null,
"metadata": {
"cellView": "form",
"id": "RerQaiZt14r8"
},
"metadata": {},
"outputs": [],
"source": [
"# @title\n",
Expand All @@ -71,15 +58,7 @@
{
"cell_type": "code",
"execution_count": null,
"metadata": {
"cellView": "form",
"colab": {
"base_uri": "https://localhost:8080/",
"height": 162
},
"id": "3MTX8GoE7AzN",
"outputId": "ebe733d0-3a21-47e5-d217-89a622cafc62"
},
"metadata": {},
"outputs": [],
"source": [
"# @title ## Audio Generation Configs\n",
Expand Down Expand Up @@ -182,14 +161,7 @@
{
"cell_type": "code",
"execution_count": null,
"metadata": {
"cellView": "form",
"colab": {
"base_uri": "https://localhost:8080/"
},
"id": "SfM8rhVX7ES9",
"outputId": "a935173b-382a-4514-97fc-eec12e188379"
},
"metadata": {},
"outputs": [],
"source": [
"# @title Generate Audio using MusicGen\n",
Expand Down Expand Up @@ -266,15 +238,7 @@
{
"cell_type": "code",
"execution_count": null,
"metadata": {
"cellView": "form",
"colab": {
"base_uri": "https://localhost:8080/",
"height": 104
},
"id": "_n-1RthFVPYN",
"outputId": "ac7bbc70-8114-4ef7-ef64-ecae9ba898cf"
},
"metadata": {},
"outputs": [],
"source": [
"# @title Log Audio to Weights & Biases Dashboard\n",
Expand Down Expand Up @@ -421,9 +385,6 @@
"kernelspec": {
"display_name": "Python 3",
"name": "python3"
},
"language_info": {
"name": "python"
}
},
"nbformat": 4,
Expand Down
Loading

0 comments on commit cb9a32d

Please sign in to comment.