Skip to content

Commit

Permalink
Updating colab to use poetry
Browse files Browse the repository at this point in the history
  • Loading branch information
lucapericlp authored Mar 18, 2024
1 parent af516be commit 2fb4194
Showing 1 changed file with 26 additions and 9 deletions.
35 changes: 26 additions & 9 deletions colab_demo.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -45,8 +45,25 @@
},
"outputs": [],
"source": [
"!pip install -r requirements.txt\n",
"!pip install --upgrade torch torchaudio"
"!sudo apt install pipx\n",
"!pipx install poetry\n",
"!pipx run poetry install && pipx run poetry run pip install torch==2.2.1 torchaudio==2.2.1\n",
"!pipx run poetry env list | sed 's/ (Activated)//' > poetry_env.txt"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {
"vscode": {
"languageId": "plaintext"
}
},
"outputs": [],
"source": [
"import sys, pathlib\n",
"venv = pathlib.Path(\"poetry_env.txt\").read_text().strip(\"\\n\")\n",
"sys.path.append(f\"/root/.cache/pypoetry/virtualenvs/{venv}/lib/python3.10/site-packages\")"
]
},
{
Expand Down Expand Up @@ -91,19 +108,19 @@
}
],
"metadata": {
"accelerator": "GPU",
"colab": {
"provenance": [],
"gpuType": "T4"
"gpuType": "T4",
"provenance": []
},
"kernelspec": {
"name": "python3",
"display_name": "Python 3"
"display_name": "Python 3",
"name": "python3"
},
"language_info": {
"name": "python"
},
"accelerator": "GPU"
}
},
"nbformat": 4,
"nbformat_minor": 2
}
}

0 comments on commit 2fb4194

Please sign in to comment.