Train and Release #107
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Train and Release | |
on: | |
workflow_dispatch: | |
inputs: | |
epochs: | |
description: 'Number of epochs' | |
required: true | |
default: '5000' | |
type: string | |
jobs: | |
train-and-visualize: | |
runs-on: ubuntu-24.04 | |
permissions: | |
contents: write | |
steps: | |
- uses: actions/checkout@v3 | |
with: | |
submodules: 'recursive' | |
- name: Install Dependencies | |
run: | | |
sudo apt-get update | |
sudo apt-get install -y libwebp-dev | |
- name: Setup and Train | |
run: | | |
make reinforce.out visualize.out | |
./reinforce.out ${{ github.event.inputs.epochs }} | tee training.log | |
WEIGHTS_FILE=$(ls -t *_policy.bin | head -n1) | |
./visualize.out $WEIGHTS_FILE | |
WEBP_FILE=$(ls -t *_flight.webp | head -n1) | |
BEST_RETURN=$(grep "Best:" training.log | tail -n1 | awk '{print $9}') | |
FINAL_DISTANCE=$(grep "Distance:" training.log | tail -n1 | awk '{print $4}') | |
PERCENTAGE_RATE=$(grep "Rate:" training.log | tail -n1 | awk '{print $NF}') | |
echo "WEIGHTS_FILE=${WEIGHTS_FILE}" >> $GITHUB_ENV | |
echo "WEBP_FILE=${WEBP_FILE}" >> $GITHUB_ENV | |
echo "TIMESTAMP=$(date +'%Y-%m-%d %H:%M:%S UTC')" >> $GITHUB_ENV | |
echo "BEST_RETURN=${BEST_RETURN}" >> $GITHUB_ENV | |
echo "FINAL_DISTANCE=${FINAL_DISTANCE}" >> $GITHUB_ENV | |
echo "PERCENTAGE_RATE=${PERCENTAGE_RATE}" >> $GITHUB_ENV | |
- name: Create Release | |
uses: softprops/action-gh-release@v1 | |
with: | |
tag_name: run-${{ github.run_number }} | |
name: "π Quadcopter Training #${{ github.run_number }}" | |
body: | | |
## β¨ Training Details | |
- π Epochs: ${{ github.event.inputs.epochs }} | |
- π― Best Return: ${{ env.BEST_RETURN }} | |
- π Final Training Distance: ${{ env.FINAL_DISTANCE }} meters | |
- π Final Improvement Rate: ${{ env.PERCENTAGE_RATE }} %/s | |
- β° Completed: ${{ env.TIMESTAMP }} | |
files: | | |
${{ env.WEIGHTS_FILE }} | |
${{ env.WEBP_FILE }} | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |