name: cloud-train on: push: branches: [ main ] schedule: - cron: "*/30 * * * *" # every 30 minutes workflow_dispatch: jobs: train: runs-on: ubuntu-latest timeout-minutes: 60 steps: - name: checkout uses: actions/checkout@v4 - name: python uses: actions/setup-python@v5 with: python-version: "3.11" - name: cache pip uses: actions/cache@v4 with: path: ~/.cache/pip key: ${{ runner.os }}-pip-${{ hashFiles('requirements.txt') }} restore-keys: | ${{ runner.os }}-pip- - name: create venv run: | python -m venv .venv . .venv/bin/activate python -m pip install --upgrade pip wheel setuptools - name: install deps run: | . .venv/bin/activate pip install -r requirements.txt || true # ensure vendored audiocraft if [ -d vendor/audiocraft ]; then pip install -e vendor/audiocraft else pip install git+https://github.com/facebookresearch/audiocraft.git@0d9f0a9 fi - name: prepare data run: | . .venv/bin/activate mkdir -p data/raw data/music32k # if no raw files exist, add a tiny sample so the loop runs if [ ! "$(ls -A data/raw 2>/dev/null)" ]; then printf "lofi hip hop beats\n" > data/raw/sample.txt fi python tools/resample_to_32k.py data/raw data/music32k - name: train env: STEPS: "400" run: | . .venv/bin/activate python train_musicgen.py echo "done" > TRAIN_OK - name: upload checkpoints if: always() uses: actions/upload-artifact@v4 with: name: checkpoints-${{ github.run_id }} path: | checkpoints/** TRAIN_OK if-no-files-found: warn