train-model: Shakespeare Text Gen @ EC2 Spot #6
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 GPT-Shakespear on AWS | |
on: | |
workflow_dispatch: | |
inputs: | |
number_of_heads: | |
description: 'The number of attention heads per self attention module.' | |
required: true | |
type: string | |
default: '12' | |
number_of_blocks: | |
description: 'The number of transformer blocks.' | |
required: true | |
type: string | |
default: '2' | |
coordinates: | |
description: 'The word embedding dimension.' | |
required: true | |
type: string | |
default: '9' | |
words: | |
description: 'The number of tokens in the input sequence.' | |
required: true | |
type: string | |
default: '11' | |
bias: | |
description: 'Whether to use bias in the linear layers.' | |
required: true | |
type: string | |
default: 'False' | |
batch_size: | |
description: 'The batch size.' | |
required: true | |
type: string | |
default: '32' | |
number_of_batches: | |
description: 'The number of batches.' | |
required: true | |
type: string | |
default: '32' | |
number_of_epochs: | |
description: 'The number of epochs.' | |
required: true | |
type: string | |
default: '20' | |
instance_type: | |
description: 'The instance type.' | |
required: true | |
type: string | |
default: 'c5n.xlarge' | |
permissions: | |
contents: read | |
jobs: | |
training: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Set up Python | |
uses: actions/setup-python@v2 | |
with: | |
python-version: '3.10' | |
- name: Install Dependencies | |
run: | | |
python -m pip install --upgrade pip | |
pip install awscli boto3==1.34.8 pydantic==2.5.3 pydantic-settings==2.1.0 mlflow==2.9.2 tiktoken | |
- name: Babysit Experiment | |
run: | | |
export MLFLOW_TRACKING_URI=${{ secrets.MLFLOW_TRACKING_URI }} | |
export MLFLOW_TRACKING_USERNAME=${{ secrets.MLFLOW_TRACKING_USERNAME }} | |
export MLFLOW_TRACKING_PASSWORD=${{ secrets.MLFLOW_TRACKING_PASSWORD }} | |
export MLFLOW_EXPERIMENT_ID=4 | |
export AWS_ACCESS_KEY_ID=${{ secrets.AWS_ACCESS_KEY_ID }} | |
export AWS_SECRET_ACCESS_KEY=${{ secrets.AWS_SECRET_ACCESS_KEY }} | |
export REGION_NAME=eu-west-2 | |
export INSTANCE_TYPE=${{ github.event.inputs.instance_type }} | |
export COORDINATES=${{ github.event.inputs.coordinates }} | |
export WORDS=${{ github.event.inputs.words }} | |
export NUMBER_OF_BLOCKS=${{ github.event.inputs.number_of_blocks }} | |
export NUMBER_OF_HEADS=${{ github.event.inputs.number_of_heads }} | |
export BIAS=${{ github.event.inputs.bias }} | |
export BATCH_SIZE=${{ github.event.inputs.batch_size }} | |
export NUMBER_OF_BATCHES=${{ github.event.inputs.number_of_batches }} | |
export NUMBER_OF_EPOCHS=${{ github.event.inputs.number_of_epochs }} | |
cd gpt_shakespear | |
python train_main.py |