Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Hyperparameters sent by the client aren't passed to the Training Arguments #52

Closed
KartikKannapur opened this issue Jun 30, 2021 · 2 comments

Comments

@KartikKannapur
Copy link

Description

The hyperparameters sent by the client have an underscore in them (e.g. train_batch_size), whereas those received by the argparser have a hyphen (e.g. train-batch-size). Therefore, values do not get propagated through the train.py file.

Files

I have tested the solution on these files

  • notebooks/sagemaker/01_getting_started_pytorch/sagemaker-notebook.ipynb
  • notebooks/sagemaker/01_getting_started_pytorch/scripts/train.py

but I suspect we'll have to update train.py in the following folders as well - 05_spot_instances, 06_sagemaker_metrics

Solution (based on my observation)

In the train.py file, swap these lines -

parser.add_argument("--train-batch-size", type=int, default=32)
parser.add_argument("--eval-batch-size", type=int, default=64)

parser.add_argument("--output-data-dir", type=str, default=os.environ["SM_OUTPUT_DATA_DIR"])
parser.add_argument("--model-dir", type=str, default=os.environ["SM_MODEL_DIR"])

with these

parser.add_argument("--train_batch_size", type=int, default=32)
parser.add_argument("--eval_batch_size", type=int, default=64)

parser.add_argument("--output_data_dir", type=str, default=os.environ["SM_OUTPUT_DATA_DIR"])
parser.add_argument("--model_dir", type=str, default=os.environ["SM_MODEL_DIR"])
@KartikKannapur
Copy link
Author

@philschmid I believe this has been resolved in the latest commit - https://github.com/huggingface/notebooks/pull/62/commits

Could you review it before I close this issue?
Thanks

@philschmid
Copy link
Member

Hey, @KartikKannapur thanks for creating the issue and sorry for not seeing it. Feel free to tag me in any sagemaker related issue.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants