diff --git a/.github/workflows/train.yml b/.github/workflows/train.yml new file mode 100644 index 0000000..4317deb --- /dev/null +++ b/.github/workflows/train.yml @@ -0,0 +1,27 @@ +name: train-model +on: + workflow-dispatch: + inputs: + epochs: + description: 'Number of epochs for training' + required: true + default: '1' +jobs: + train: + runs-on: ubuntu-latest + steps: + - name: Checkout repo + uses: actions/checkout@v2 + + - name: Use Docker action + id: train + uses: ./ + with: + epochs: 1 + + - name: Archive + uses: action/upload-artifact@v3 + with: + name: model + path: model.keras + diff --git a/train-entrypoint.sh b/train-entrypoint.sh new file mode 100644 index 0000000..6c02373 --- /dev/null +++ b/train-entrypoint.sh @@ -0,0 +1,5 @@ +#!/bin/sh + +cd /ium/src +python3 tf_train.py "$1" +cp /ium/src/model.keras /github/workspace/ diff --git a/train.dockerfile b/train.dockerfile new file mode 100644 index 0000000..28441db --- /dev/null +++ b/train.dockerfile @@ -0,0 +1,17 @@ +FROM ubuntu:22.04 + +RUN apt update && apt install -y vim make python3 python3-pip python-is-python3 gcc g++ golang wget unzip git +RUN pip install pandas matplotlib scikit-learn tensorflow + +RUN mkdir /ium +COPY . /ium + +WORKDIR /ium/src/ + +RUN wget https://bendun.students.wmi.amu.edu.pl/stop_times.train.tsv +RUN wget https://bendun.students.wmi.amu.edu.pl/stop_times.valid.tsv +RUN wget https://bendun.students.wmi.amu.edu.pl/stop_times.categories.tsv + +VOLUME /github/workspace/ + +ENTRYPOINT ["/ium/train-entrypoint.sh"] diff --git a/train.yml b/train.yml new file mode 100644 index 0000000..329be13 --- /dev/null +++ b/train.yml @@ -0,0 +1,12 @@ +name: Train +description: 'Train model' +inputs: + epochs: + description: 'Number of epochs' + required: true + default: '2' +runs: + using: 'docker' + image: 'train.dockerfile' + args: + - ${{ inputs.epochs }}