Parameter to save checkpoint

I am trying to perform:

args = ParseCmdLineArguments()
# A few lines of code
path = os.path.join(, 'trained_model-%05d.ckpt' % epoch), path)

where my parameters passed to edit configuration in PyCharm are:

–batch_size 1 --dataset_pickle_file some.pkl --learning_rate 1e-4 --save ‘./’

I am getting this error:

unrecognized arguments: --save './'

Can you all please suggest how I can add the save attribute to args to save the checkpoint in the same folder? I am passing the arguments via edit configuration on PyCharm.

Try removing the single apostrophes around the ./ and setting the default type to a string when you define the args. Like this:

parser.add_argument("--save", type=str)


–batch_size 1 --dataset_pickle_file some.pkl --learning_rate 1e-4 --save ./

Hi @Dwight_Foster , Thanks for helping.

Can you please suggest where I can add:

parser.add_argument("--save", type=str)

into the IDE. I am running PyCharm. If you could suggest how you do it in your IDE I will try to find out how to do the same in PyCharm.

Thanks again!

I run pycharm too. I would suggest instead of using the ParseCmdLineArguments() you use argparse. It will allow you to set a type default and many other things. You can find a tutorial here, but for what you want to do you can just do this:

import argparse
parser = argparse.ArgumentParser()
parser.add_argument("--dataset_pickle_file", type=str)
parser.add_argument("--learning_rate", type=float)
parser.add_argument("--save", type=str)
args = parser.parse_args()