Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Move AdvantageBuffer to its own file and switch to tensordict #9

Merged
merged 46 commits into from
Mar 23, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
46 commits
Select commit Hold shift + click to select a range
d8f8786
Changed:
josiahls Nov 3, 2023
d09b40a
Updated:
josiahls Nov 4, 2023
784b5a8
Updated:
josiahls Nov 5, 2023
3982204
Update fastrl-docker.yml
josiahls Nov 5, 2023
f1c95e1
Update setup.py
josiahls Nov 5, 2023
9f3806a
Update fastrl-docker.yml
josiahls Nov 5, 2023
c3e7793
Update fastrl-docker.yml
josiahls Nov 5, 2023
de4bc07
Update fastrl.Dockerfile
josiahls Nov 5, 2023
0721096
Update fastrl-docker.yml
josiahls Nov 5, 2023
70138d0
Update setup.py
josiahls Nov 5, 2023
efe3b40
update docker image
josiahls Nov 22, 2023
53b4bb6
minor change
josiahls Nov 22, 2023
da8d5a9
nubir change
josiahls Nov 22, 2023
8853183
sdmall change
josiahls Nov 23, 2023
0aa031a
Workflow updates
josiahls Dec 28, 2023
1bbb880
update test workflow
josiahls Dec 28, 2023
199eb5c
Updated:
josiahls Dec 28, 2023
b872a54
smoal updates
josiahls Dec 28, 2023
9bb0733
update
josiahls Dec 28, 2023
d649f00
workflow stuff
josiahls Dec 28, 2023
f28e95b
unit test fixes
josiahls Dec 28, 2023
96ec74f
minor change
josiahls Dec 28, 2023
1a55af2
minor change
josiahls Dec 28, 2023
f1ee025
changed a lil something something
josiahls Dec 28, 2023
878b5bb
updated
josiahls Dec 28, 2023
b04e6d9
update
josiahls Dec 28, 2023
a8eb2bc
updates
josiahls Dec 28, 2023
aecdafc
Added:
josiahls Jan 7, 2024
54d8514
update
josiahls Jan 7, 2024
a97902e
Added:
josiahls Jan 7, 2024
c1442ea
Minor updates
josiahls Jan 7, 2024
b8bf80f
add mojo to docker file
josiahls Jan 20, 2024
0ceb206
Updated:
josiahls Jan 20, 2024
3440f16
quick update
josiahls Jan 20, 2024
f5dfc96
update docker since ubuntu 18 is deprecateds
josiahls Jan 20, 2024
e149404
qyuc uopdate
josiahls Jan 20, 2024
81d69bc
another one
josiahls Jan 20, 2024
93e2d24
quic updat
josiahls Jan 20, 2024
ee03446
omg another update holy shit
josiahls Jan 20, 2024
aa96976
quakl update
josiahls Jan 20, 2024
7ab9ebc
sdfg
josiahls Jan 20, 2024
81c1091
add mojo
josiahls Jan 21, 2024
2354a84
switch mojo stuff to its own package
josiahls Jan 21, 2024
02edf18
Changed:
josiahls Feb 4, 2024
41a59f8
Added:
josiahls Feb 4, 2024
dd04f5f
Still skeptical whether advantage buffer
josiahls Feb 4, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 10 additions & 7 deletions .devcontainer.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,18 +2,21 @@
"name": "fastrl_development",
"dockerComposeFile": "docker-compose.yml",
"service": "fastrl",
// "settings": {"terminal.integrated.shell.linux": "/bin/bash",
// "python.defaultInterpreterPath":"/opt/conda/bin/python"},
"customizations":{
"vscode": {
"settings": {"terminal.integrated.shell.linux": "/bin/bash"}
}
},
// "mounts": [ "source=/var/run/docker.sock,target=/var/run/docker.sock,type=bind",
// "source=/usr/bin/docker,target=/usr/bin/docker,type=bind" ],
"workspaceFolder": "/home/fastrl_user/fastrl",
// "forwardPorts": [4000, 8080],
// "appPort": [4000, 8080],
"extensions": [
"ms-python.python",
"ms-azuretools.vscode-docker",
"ms-toolsai.jupyter-renderers"
],
// "extensions": [
// "ms-python.python",
// "ms-azuretools.vscode-docker",
// "ms-toolsai.jupyter-renderers"
// ],
"runServices": ["dep_watcher", "quarto"] //,
// "postStartCommand": "pip install -e .[dev]"
}
58 changes: 37 additions & 21 deletions .github/workflows/fastrl-docker.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ on:
branches:
- main
- update_nbdev_docs
- refactor/bug-fix-api-update-and-stablize
- refactor/advantage-buffer

jobs:
build:
Expand All @@ -18,10 +18,21 @@ jobs:
build_type: [dev]
# build_type: [prod, dev]
steps:
- name: Maximize build space
uses: easimon/maximize-build-space@master
with:
root-reserve-mb: 35000
swap-size-mb: 1024
remove-dotnet: 'true'
remove-android: 'true'
- name: Copy This Repository Contents
uses: actions/checkout@v2
with:
submodules: recursive
# with:
# submodules: recursive
- name: Build
run: |
echo "Free space:"
df -h

- uses: actions/setup-python@v2
with:
Expand Down Expand Up @@ -54,31 +65,36 @@ jobs:
env:
BUILD_TYPE: ${{ matrix.build_type }}

- name: Cache Docker layers
if: always()
uses: actions/cache@v2
with:
path: /tmp/.buildx-cache
key: ${{ runner.os }}-buildx-${{ github.sha }}
restore-keys: |
${{ runner.os }}-buildx-
# - name: Cache Docker layers
# if: always()
# uses: actions/cache@v3
# with:
# path: /tmp/.buildx-cache
# key: ${{ runner.os }}-buildx-${{ github.sha }}
# restore-keys: |
# ${{ runner.os }}-buildx-

- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
# - name: Set up Docker Buildx
# uses: docker/setup-buildx-action@v3

- name: build and tag container
run: |
export DOCKER_BUILDKIT=1
# We need to clear the previous docker images
# docker system prune -fa
# docker pull ${IMAGE_NAME}:latest || true
docker system prune -fa
docker pull ${IMAGE_NAME}:latest || true
# docker build --build-arg BUILD=${BUILD_TYPE} \
docker buildx create --use
docker buildx build --cache-from=type=local,src=/tmp/.buildx-cache --cache-to=type=local,dest=/tmp/.buildx-cache --build-arg BUILD=${BUILD_TYPE} \
-t ${IMAGE_NAME}:latest \
-t ${IMAGE_NAME}:${VERSION} \
-t ${IMAGE_NAME}:$(date +%F) \
-f fastrl.Dockerfile .
# docker buildx create --use
# docker buildx build --cache-from=type=local,src=/tmp/.buildx-cache --cache-to=type=local,dest=/tmp/.buildx-cache --build-arg BUILD=${BUILD_TYPE} \
# -t ${IMAGE_NAME}:latest \
# -t ${IMAGE_NAME}:${VERSION} \
# -t ${IMAGE_NAME}:$(date +%F) \
# -f fastrl.Dockerfile .
docker buildx build --build-arg BUILD=${BUILD_TYPE} \
-t ${IMAGE_NAME}:latest \
-t ${IMAGE_NAME}:${VERSION} \
-t ${IMAGE_NAME}:$(date +%F) \
-f fastrl.Dockerfile .
env:
VERSION: ${{ steps.get_variables.outputs.version }}
IMAGE_NAME: ${{ steps.get_variables.outputs.image_name }}
Expand Down
27 changes: 15 additions & 12 deletions .github/workflows/fastrl-test.yml
Original file line number Diff line number Diff line change
@@ -1,33 +1,35 @@
name: Fastrl Testing
on: [push, pull_request]

env:
PIP_EXTRA_INDEX_URL: https://download.pytorch.org/whl/nightly/cu113
# env:
# PIP_EXTRA_INDEX_URL: https://download.pytorch.org/whl/nightly/cu113

jobs:
build:
test:
runs-on: ubuntu-latest
# container:
# image: 'josiahls/fastrl-dev:latest'
container:
image: 'josiahls/fastrl-dev:latest'

steps:
- uses: actions/checkout@v1
- uses: actions/setup-python@v1
with:
python-version: '3.7'
architecture: 'x64'
# - uses: actions/setup-python@v1
# with:
# python-version: '3.7'
# architecture: 'x64'
- name: Install the library
run: |
pip install -e .["dev"]
sudo mkdir -p /github/home
sudo pip install -e .["dev"]
# - name: Read all notebooks
# run: |
# nbdev_read_nbs
- name: Check if all notebooks are cleaned
run: |
sudo git config --global --add safe.directory /__w/fastrl/fastrl
echo "Check we are starting with clean git checkout"
if [ -n "$(git status -uno -s)" ]; then echo "git status is not clean"; false; fi
echo "Trying to strip out notebooks"
nbdev_clean
sudo nbdev_clean
echo "Check that strip out was unnecessary"
git status -s # display the status to see which nbs need cleaning up
if [ -n "$(git status -uno -s)" ]; then echo -e "!!! Detected unstripped out notebooks\n!!!Remember to run nbdev_install_hooks"; false; fi
Expand All @@ -37,7 +39,8 @@ jobs:
# if [ -n "$(nbdev_diff_nbs)" ]; then echo -e "!!! Detected difference between the notebooks and the library"; false; fi
- name: Run tests
run: |
pip show torchdata torch
pip3 show torchdata torch
sudo pip3 install -e .
cd nbs
xvfb-run -s "-screen 0 1400x900x24" fastrl_nbdev_test --n_workers 12 --one2one
- name: Run Doc Build Test
Expand Down
6 changes: 2 additions & 4 deletions .github/workflows/quarto_deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,13 +10,11 @@ env:
jobs:
deploy:
runs-on: ubuntu-latest
container:
image: 'josiahls/fastrl-dev:latest'

steps:
- uses: actions/checkout@v3
- uses: actions/setup-python@v1
with:
python-version: '3.7'
architecture: 'x64'
- name: Install Dependencies
shell: bash
run: |
Expand Down
12 changes: 8 additions & 4 deletions docker-compose.yml
Original file line number Diff line number Diff line change
@@ -1,12 +1,16 @@
version: "3"
version: "3.8"
services:
fastrl: &fastrl
restart: unless-stopped
working_dir: /home/fastrl_user/fastrl
fastrl_build:
build:
dockerfile: fastrl.Dockerfile
context: .
image: josiahls/fastrl-dev:latest
profiles: ["build"]

fastrl: &fastrl
restart: unless-stopped
working_dir: /home/fastrl_user/fastrl
image: josiahls/fastrl-dev:latest
deploy:
resources:
reservations:
Expand Down
1 change: 1 addition & 0 deletions extra/pip_requirements.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
gymnasium>=0.27.1
tensordict
pyopengl
pyglet
tensorboard
Expand Down
31 changes: 22 additions & 9 deletions fastrl.Dockerfile
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# FROM pytorch/pytorch:1.10.0-cuda11.3-cudnn8-runtime
# FROM pytorch/pytorch:1.12.1-cuda11.3-cudnn8-runtime
FROM nvidia/cuda:11.7.1-cudnn8-runtime-ubuntu18.04
FROM nvidia/cuda:12.0.0-runtime-ubuntu20.04
# RUN conda install python=3.8

ENV CONTAINER_USER fastrl_user
Expand All @@ -12,13 +12,13 @@ RUN addgroup --gid $CONTAINER_UID $CONTAINER_GROUP && \
# && \
# mkdir -p /opt/conda && chown $CONTAINER_USER /opt/conda

RUN apt-get update && apt-get install -y software-properties-common rsync curl
RUN apt-get update && apt-get install -y software-properties-common rsync curl gcc g++
#RUN apt-key adv --keyserver keyserver.ubuntu.com --recv-key C99B11DEB97541F0 && apt-add-repository https://cli.github.com/packages

RUN curl -fsSL https://cli.github.com/packages/githubcli-archive-keyring.gpg | gpg --dearmor -o /usr/share/keyrings/githubcli-archive-keyring.gpg
RUN echo "deb [arch=$(dpkg --print-architecture) signed-by=/usr/share/keyrings/githubcli-archive-keyring.gpg] https://cli.github.com/packages stable main" | tee /etc/apt/sources.list.d/github-cli.list > /dev/null

RUN apt-get install -y python3.8-dev python3.8-distutils
RUN apt-get install -y build-essential python3.8-dev python3.8-distutils
RUN update-alternatives --install /usr/bin/python python /usr/bin/python3.8 2 && update-alternatives --config python
RUN curl https://bootstrap.pypa.io/get-pip.py -o get-pip.py && python3.8 get-pip.py

Expand All @@ -29,17 +29,21 @@ RUN apt-get update && apt-get install -y git libglib2.0-dev graphviz libxext6 \

WORKDIR /home/$CONTAINER_USER
# Install Primary Pip Reqs
ENV PIP_EXTRA_INDEX_URL=https://download.pytorch.org/whl/nightly/cu117
# ENV PIP_EXTRA_INDEX_URL=https://download.pytorch.org/whl/nightly/cu117
COPY --chown=$CONTAINER_USER:$CONTAINER_GROUP extra/requirements.txt /home/$CONTAINER_USER/extra/requirements.txt
# Since we are using a custom fork of torchdata, we install torchdata as part of a submodule.
# RUN pip3 install -r extra/requirements.txt --pre --upgrade
RUN pip3 install torch>=2.0.0 --pre --upgrade
RUN pip3 install torch>=2.0.0
# --pre --upgrade
RUN pip3 show torch


COPY --chown=$CONTAINER_USER:$CONTAINER_GROUP extra/pip_requirements.txt /home/$CONTAINER_USER/extra/pip_requirements.txt
RUN pip3 install -r extra/pip_requirements.txt

WORKDIR /home/$CONTAINER_USER/fastrl
RUN git clone https://github.com/josiahls/data.git \
&& cd data && pip3 install -e .
WORKDIR /home/$CONTAINER_USER

# Install Dev Reqs
COPY --chown=$CONTAINER_USER:$CONTAINER_GROUP extra/dev_requirements.txt /home/$CONTAINER_USER/extra/dev_requirements.txt
Expand Down Expand Up @@ -74,7 +78,7 @@ RUN /bin/bash -c "if [[ $BUILD == 'dev' ]] ; then nbdev_install_quarto ; fi"
# ENV LD_LIBRARY_PATH /home/$CONTAINER_USER/.mujoco/mujoco210/bin:${LD_LIBRARY_PATH}
# ENV LD_LIBRARY_PATH /usr/local/nvidia/lib64:${LD_LIBRARY_PATH}

RUN ln -s /usr/lib/x86_64-linux-gnu/libGL.so.1 /usr/lib/x86_64-linux-gnu/libGL.so
# RUN ln -s /usr/lib/x86_64-linux-gnu/libGL.so.1 /usr/lib/x86_64-linux-gnu/libGL.so

USER $CONTAINER_USER
WORKDIR /home/$CONTAINER_USER
Expand All @@ -84,9 +88,18 @@ ENV PATH="/home/$CONTAINER_USER/.local/bin:${PATH}"
RUN pip install setuptools==60.7.0
COPY --chown=$CONTAINER_USER:$CONTAINER_GROUP . fastrl

RUN sudo apt-get -y install cmake
RUN sudo apt-get -y install cmake python3.8-venv

# RUN curl https://get.modular.com | sh - && \
# modular auth mut_9b52dfea7b05427385fdeddc85dd3a64 && \
# modular install mojo

RUN BASHRC=$( [ -f "$HOME/.bash_profile" ] && echo "$HOME/.bash_profile" || echo "$HOME/.bashrc" ) && \
echo 'export MODULAR_HOME="/home/fastrl_user/.modular"' >> "$BASHRC" && \
echo 'export PATH="/home/fastrl_user/.modular/pkg/packages.modular.com_mojo/bin:$PATH"' >> "$BASHRC" && \
source "$BASHRC"

RUN /bin/bash -c "if [[ $BUILD == 'dev' ]] ; then echo \"Development Build\" && cd fastrl/data && mv pyproject.toml pyproject.toml_tmp && pip install -e . --no-dependencies && mv pyproject.toml_tmp pyproject.toml && cd ../; fi"
# RUN /bin/bash -c "if [[ $BUILD == 'dev' ]] ; then echo \"Development Build\" && cd fastrl/data && mv pyproject.toml pyproject.toml_tmp && pip install -e . --no-dependencies && mv pyproject.toml_tmp pyproject.toml && cd ../; fi"

RUN /bin/bash -c "if [[ $BUILD == 'prod' ]] ; then echo \"Production Build\" && cd fastrl && pip install . --no-dependencies; fi"
RUN /bin/bash -c "if [[ $BUILD == 'dev' ]] ; then echo \"Development Build\" && cd fastrl && pip install -e \".[dev]\" --no-dependencies ; fi"
Expand Down
Loading
Loading