{ "nbformat": 4, "nbformat_minor": 0, "metadata": { "colab": { "provenance": [], "machine_shape": "hm", "authorship_tag": "ABX9TyN6S7kyJKrM5x0OOiN+CgTc", "include_colab_link": true }, "kernelspec": { "name": "python3", "display_name": "Python 3" }, "language_info": { "name": "python" }, "gpuClass": "standard", "accelerator": "GPU" }, "cells": [ { "cell_type": "markdown", "metadata": { "id": "view-in-github", "colab_type": "text" }, "source": [ "\"Open" ] }, { "cell_type": "markdown", "source": [ "# [sgoodfriend/rl-algo-impls](https://github.com/sgoodfriend/rl-algo-impls) in Google Colaboratory\n", "## Parameters\n", "\n", "\n", "1. Wandb\n", "\n" ], "metadata": { "id": "S-tXDWP8WTLc" } }, { "cell_type": "code", "source": [ "from getpass import getpass\n", "import os\n", "os.environ[\"WANDB_API_KEY\"] = getpass(\"Wandb API key to upload metrics, videos, and models: \")" ], "metadata": { "id": "1ZtdYgxWNGwZ" }, "execution_count": null, "outputs": [] }, { "cell_type": "markdown", "source": [ "2. enjoy.py parameters" ], "metadata": { "id": "ao0nAh3MOdN7" } }, { "cell_type": "code", "source": [ "WANDB_RUN_PATH=\"sgoodfriend/rl-algo-impls-benchmarks/rd0lisee\"" ], "metadata": { "id": "jKL_NFhVOjSc" }, "execution_count": 2, "outputs": [] }, { "cell_type": "markdown", "source": [ "## Setup\n", "Clone [sgoodfriend/rl-algo-impls](https://github.com/sgoodfriend/rl-algo-impls) " ], "metadata": { "id": "bsG35Io0hmKG" } }, { "cell_type": "code", "source": [ "%%capture\n", "!git clone https://github.com/sgoodfriend/rl-algo-impls.git" ], "metadata": { "id": "k5ynTV25hdAf" }, "execution_count": 3, "outputs": [] }, { "cell_type": "markdown", "source": [ "Installing the correct packages:\n", "\n", "While conda and poetry are generally used for package management, the mismatch in Python versions (3.10 in the project file vs 3.8 in Colab) makes using the package yml files difficult to use. For now, instead I'm going to specify the list of requirements manually below:" ], "metadata": { "id": "jKxGok-ElYQ7" } }, { "cell_type": "code", "source": [ "%%capture\n", "!apt install python-opengl\n", "!apt install ffmpeg\n", "!apt install xvfb\n", "!apt install swig" ], "metadata": { "id": "nn6EETTc2Ewf" }, "execution_count": 4, "outputs": [] }, { "cell_type": "code", "source": [ "%%capture\n", "%cd /content/rl-algo-impls\n", "python -m pip install ." ], "metadata": { "id": "AfZh9rH3yQii" }, "execution_count": 5, "outputs": [] }, { "cell_type": "markdown", "source": [ "## Run Once Per Runtime" ], "metadata": { "id": "4o5HOLjc4wq7" } }, { "cell_type": "code", "source": [ "import wandb\n", "wandb.login()" ], "metadata": { "id": "PCXa5tdS2qFX" }, "execution_count": null, "outputs": [] }, { "cell_type": "markdown", "source": [ "## Restart Session beteween runs" ], "metadata": { "id": "AZBZfSUV43JQ" } }, { "cell_type": "code", "source": [ "%%capture\n", "from pyvirtualdisplay import Display\n", "\n", "virtual_display = Display(visible=0, size=(1400, 900))\n", "virtual_display.start()" ], "metadata": { "id": "VzemeQJP2NO9" }, "execution_count": 7, "outputs": [] }, { "cell_type": "code", "source": [ "%cd /content/rl-algo-impls\n", "!python enjoy.py --wandb-run-path={WANDB_RUN_PATH}" ], "metadata": { "id": "07aHYFH1zfXa" }, "execution_count": null, "outputs": [] } ] }