From b193a9230ed05150a97dd33727b10d7f35cc988e Mon Sep 17 00:00:00 2001 From: Robert Bendun Date: Wed, 24 May 2023 00:08:42 +0200 Subject: [PATCH] let's go --- .github/workflows/train.yml | 27 +++++++++++++++++++++++++++ train-entrypoint.sh | 5 +++++ train.dockerfile | 17 +++++++++++++++++ train.yml | 12 ++++++++++++ 4 files changed, 61 insertions(+) create mode 100644 .github/workflows/train.yml create mode 100644 train-entrypoint.sh create mode 100644 train.dockerfile create mode 100644 train.yml 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 }}