Skip to content

Commit

Permalink
Added actions for linting and an example
Browse files Browse the repository at this point in the history
  • Loading branch information
jw3il committed Feb 7, 2024
1 parent 45d6e53 commit e04c836
Show file tree
Hide file tree
Showing 2 changed files with 49 additions and 0 deletions.
22 changes: 22 additions & 0 deletions .github/workflows/lint.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
name: Lint
on:
workflow_dispatch:
push:
paths:
- '**.py'
pull_request:
paths:
- '**.py'

jobs:
lint:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
with:
python-version: '3.9'
cache: 'pip'
- name: Install flake8 and black
run: pip install flake8==6.0.0 black==22.12.0 flake8-black
- run: flake8 .
27 changes: 27 additions & 0 deletions .github/workflows/train-example.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
name: Train Example
on:
workflow_dispatch:
push:
paths:
- '**.py'
pull_request:
paths:
- '**.py'

jobs:
train-example:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
with:
python-version: '3.9'
cache: 'pip'
- name: Install dependencies
run: |
pip3 install torch torchvision torchaudio --index-url https://download.pytorch.org/whl/cpu
pip install -e .
- name: Train agent and check result
run: |
python src/main.py --model=dqn --hidden-dim=8 --random-topology=1 --mini-batch-size=32 --device=cpu --episode-steps=1 --eval-episode-steps=1 --lr=0.001 --tau=0.01 --netmon --netmon-encoder-dim=4 --hidden-dim=4 --netmon-dim=2 --netmon-iterations=1 --sequence-length=1 --step-before-train=1_000 --capacity=10_000 --eval-episodes=100 --total-steps=5_000 --env-type=simple --epsilon=0.1 --epsilon-decay=1.0 --seed=0 --disable-progress | tee -a train.txt
cat train.txt | grep "\"reward_mean\": 1.0"

0 comments on commit e04c836

Please sign in to comment.