Train and Release #86
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: '10' | |
type: string | |
jobs: | |
train-and-visualize: | |
runs-on: ubuntu-24.04 | |
permissions: | |
contents: write | |
steps: | |
- uses: actions/checkout@v3 | |
with: | |
submodules: 'recursive' | |
- 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 | |
GIF_FILE=$(ls -t *_flight.gif | head -n1) | |
BEST_RETURN=$(grep "Best:" training.log | tail -n1 | sed 's/.*Best: //' | cut -d' ' -f1) | |
TOTAL_TIME=$(grep "Total training time:" training.log | sed 's/Total training time: //' | sed 's/ seconds//') | |
PERCENTAGE_RATE=$(grep "Rate:" training.log | tail -n1 | sed 's/.*Rate: //' | sed 's/ %\/s//') | |
echo "WEIGHTS_FILE=${WEIGHTS_FILE}" >> $GITHUB_ENV | |
echo "GIF_FILE=${GIF_FILE}" >> $GITHUB_ENV | |
echo "TIMESTAMP=$(date +'%Y-%m-%d %H:%M:%S UTC')" >> $GITHUB_ENV | |
echo "BEST_RETURN=${BEST_RETURN}" >> $GITHUB_ENV | |
echo "TOTAL_TIME=${TOTAL_TIME}" >> $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 }} | |
- ⏱️ Total Time: ${{ env.TOTAL_TIME }} seconds | |
- 📈 Final Improvement Rate: ${{ env.PERCENTAGE_RATE }} %/s | |
- ⏰ Completed: ${{ env.TIMESTAMP }} | |
files: | | |
${{ env.WEIGHTS_FILE }} | |
${{ env.GIF_FILE }} | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |