-
Notifications
You must be signed in to change notification settings - Fork 2.9k
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
Add loading model function for train.py. #72
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good. Thanks.
deep_speech_2/train.py
Outdated
@@ -78,6 +79,11 @@ | |||
default='data/eng_vocab.txt', | |||
type=str, | |||
help="Vocabulary filepath. (default: %(default)s)") | |||
parser.add_argument( | |||
"--init_model_path", | |||
default='models/params.tar.gz', |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Set default to None (training from scratch).
deep_speech_2/train.py
Outdated
"--init_model_path", | ||
default='models/params.tar.gz', | ||
type=str, | ||
help="Model path for initialization. (default: %(default)s)") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Add e.g. "If set None, the training will start from scratch. Otherwise, the training will resume from the existing model of this path".
deep_speech_2/train.py
Outdated
if args.init_model_path is None: | ||
parameters = paddle.parameters.create(cost) | ||
else: | ||
assert os.path.isfile(args.init_model_path), "Invalid model." |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It would be better to use "raise IOError" ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Agree and done.
deep_speech_2/train.py
Outdated
@@ -78,6 +79,11 @@ | |||
default='data/eng_vocab.txt', | |||
type=str, | |||
help="Vocabulary filepath. (default: %(default)s)") | |||
parser.add_argument( | |||
"--init_model_path", | |||
default='models/params.tar.gz', |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done.
deep_speech_2/train.py
Outdated
"--init_model_path", | ||
default='models/params.tar.gz', | ||
type=str, | ||
help="Model path for initialization. (default: %(default)s)") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done.
deep_speech_2/train.py
Outdated
if args.init_model_path is None: | ||
parameters = paddle.parameters.create(cost) | ||
else: | ||
assert os.path.isfile(args.init_model_path), "Invalid model." |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Agree and done.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
fix #79