Skip to content
This repository has been archived by the owner on Jun 30, 2021. It is now read-only.

New model upload format #17

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open

New model upload format #17

wants to merge 2 commits into from

Conversation

mharvan
Copy link

@mharvan mharvan commented Aug 3, 2020

Fixes #16

Model format is compatible with
https://docs.aws.amazon.com/deepracer/latest/developerguide/deepracer-troubleshooting-service-migration-errors.html

The current best way for local training seems to be:

  1. Upload model to s3
  2. Import model from s3 in AWS DeepRacer console.

Format is compatible with
  https://docs.aws.amazon.com/deepracer/latest/developerguide/deepracer-troubleshooting-service-migration-errors.html

The current best way for local training seems to be:
1. Upload model to s3
2. Import model from s3 in AWS DeepRacer console.
cp -v $MODEL_FILE checkpoint/model/
cp -v $METADATA_FILE checkpoint/model/

CHECKPOINT_FILES=$MODEL_DIR/${CHECKPOINT}*
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It seems tha according to the spec we need current checkpoint and previous one (so 2 checkpoint sets) - so the previous checkpoint should be copied or simply all checkpoints (there are two sets per last and best anyways), i.e. CHECKPOINT_FILES=$MODEL_DIR/*.ckpt.*

Copy link
Author

@mharvan mharvan Aug 6, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It works for race submission with a single checkpoint. Does something break without 2 checkpoints?

If we really need multiple checkpoints then we should upload all checkpoints.
Uploading all checkpoints takes longer, so I would only upload them all if this is really needed.

aws s3 cp $filename s3://$S3_BUCKET/$S3_PREFIX/model/
done
# Cleanup upload destination
aws s3 rm --recursive s3://$S3_BUCKET/$S3_PREFIX/
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this one is removing all other folders which makes AWS unhappy, change it to: aws s3 rm s3://$S3_BUCKET/$S3_PREFIX/model --recursive

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I forgot to include the directory upload-template. So some files were missing and that was causing issues.

I would always clean up the whole prefix to ensure that only newly uploaded files are present. Otherwise, unknown old files could be affecting the import and your model.


tar -czvf ${CHECKPOINT}-checkpoint.tar.gz checkpoint/*
# Upload files to s3
aws s3 sync checkpoint/ s3://$S3_BUCKET/$S3_PREFIX/
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

here it should be just: aws s3 sync checkpoint/model s3://$S3_BUCKET/$S3_PREFIX/model

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The goal is to always upload a complete model with all required files, not just the model files. That includes also reward_function.py and ip/hyperparameters.json.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The tar is needed to keep an archive of what was uploaded. Once a new best model is found, sagemaker deletes the old best model so you would no longer have a copy.

Add missing directory with upload template. The template includes a
generic reward function and generic hyperparameters.
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

New model upload format
3 participants