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

Add loading model function for train.py. #72

Merged
merged 2 commits into from
Jun 8, 2017

Conversation

pkuyym
Copy link
Contributor

@pkuyym pkuyym commented Jun 5, 2017

fix #79

@pkuyym pkuyym requested a review from xinghai-sun June 5, 2017 13:01
Copy link
Contributor

@xinghai-sun xinghai-sun left a comment

Choose a reason for hiding this comment

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

Good. Thanks.

@@ -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',
Copy link
Contributor

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).

"--init_model_path",
default='models/params.tar.gz',
type=str,
help="Model path for initialization. (default: %(default)s)")
Copy link
Contributor

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".

if args.init_model_path is None:
parameters = paddle.parameters.create(cost)
else:
assert os.path.isfile(args.init_model_path), "Invalid model."
Copy link
Contributor

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" ?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Agree and done.

@@ -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',
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Done.

"--init_model_path",
default='models/params.tar.gz',
type=str,
help="Model path for initialization. (default: %(default)s)")
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Done.

if args.init_model_path is None:
parameters = paddle.parameters.create(cost)
else:
assert os.path.isfile(args.init_model_path), "Invalid model."
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Agree and done.

Copy link
Contributor

@xinghai-sun xinghai-sun left a comment

Choose a reason for hiding this comment

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

LGTM

@xinghai-sun xinghai-sun merged commit 992e3be into PaddlePaddle:develop Jun 8, 2017
@pkuyym pkuyym deleted the fix-2372 branch June 20, 2017 02:27
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

Successfully merging this pull request may close these issues.

Add loading model function for train.py
2 participants