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

Implement distributed training save model, improve master.NewClient i… #2973

Merged
merged 2 commits into from
Jul 25, 2017

Conversation

helinwang
Copy link
Contributor

@helinwang helinwang commented Jul 19, 2017

…nterface

Fixes: #2512

Sorry this has not been tested yet, but I think it's ready to review.

@helinwang helinwang force-pushed the save_model_1 branch 2 times, most recently from c90c085 to a69230b Compare July 19, 2017 23:58
}

if need {
return 1
Copy link
Contributor

Choose a reason for hiding this comment

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

should we define const status code instead of numbers? even though this status needs to pass across language border, numbers always seem tricky.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Thanks!! Done.

@@ -142,7 +142,7 @@ func NewService(idx int, interval time.Duration, path string, client *EtcdClient
}

// InitParam initializes a parameter.
func (s *Service) InitParam(paramWithConfigs ParameterWithConfig, dummy *int) error {
func (s *Service) InitParam(paramWithConfigs ParameterWithConfig, _ *int) error {
Copy link
Contributor

Choose a reason for hiding this comment

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

cool, golang support anonymous parameter in RPC Call.

path = os.path.join(path, trainer_id)
path = os.path.join(path, "model.tar")

mkdir_p(path)
Copy link
Contributor

Choose a reason for hiding this comment

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

since mkdir_p is used once by save model, can we put it into here as an inner function?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@dzhwinter I am not familiar with Python, in Go typically this kind of function is placed like this (top level inside the file) to reduce indentation. Just curious why in Python inner function is preferred, is it because every function is public in Python?

Copy link
Contributor

Choose a reason for hiding this comment

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

No, the inner function is not the Pythonic way because more indentation is needed, only closure and factory function as an inner function is preferred.
I thought that treat system command like mkdir as public function may be not good in paddle cloud.
But as your comment mentions that, put it at the top level inside the file will reduce indentation. Both of them is fine to me.

Copy link
Contributor Author

@helinwang helinwang Jul 24, 2017

Choose a reason for hiding this comment

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

I see, thanks @dzhwinter , let's keep it this way since there is no real "public" or "private" function in Python (unless use inline function as you mentioned). Typically "public" is declared (but Python does not enforce ones that are not declared private) by __all__ = ["save_model", "load_model"], which is already in this file.

Copy link
Contributor

Choose a reason for hiding this comment

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

Oh, I see.

// paddle_request_save_model requests the master server to approve the
// caller to save the model.
//
// returns 1 if the save the model request is approved, 0 if does the
Copy link
Member

Choose a reason for hiding this comment

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

0 if does the ==> 0 if the

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Thanks!! Done.

Copy link
Contributor

@dzhwinter dzhwinter left a comment

Choose a reason for hiding this comment

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

LGTM

@helinwang helinwang merged commit 91689b6 into PaddlePaddle:develop Jul 25, 2017
@helinwang helinwang deleted the save_model_1 branch July 25, 2017 01:25
heavengate pushed a commit to heavengate/Paddle that referenced this pull request Aug 16, 2021
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.

None yet

3 participants