This repository has been archived by the owner on Nov 17, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 6.8k
Improving documentation and error messages for Async distributed training with Gluon #11910
Merged
Merged
Changes from all commits
Commits
Show all changes
8 commits
Select commit
Hold shift + click to select a range
f593252
Add description about update on kvstore
rahul003 90e60b7
add async check for gluon
rahul003 80556a7
Merge branch 'patch-3' of https://github.com/rahul003/mxnet into asyn…
rahul003 199b0fd
only raise error if user set update_on_kvstore
rahul003 2d89104
fix condition
rahul003 e20c143
add async nightly test
rahul003 1ec36ba
fix case when no kvstore
rahul003 ad57d1e
add example for trainer creation in doc
rahul003 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
#!/usr/bin/env python | ||
|
||
# Licensed to the Apache Software Foundation (ASF) under one | ||
# or more contributor license agreements. See the NOTICE file | ||
# distributed with this work for additional information | ||
# regarding copyright ownership. The ASF licenses this file | ||
# to you under the Apache License, Version 2.0 (the | ||
# "License"); you may not use this file except in compliance | ||
# with the License. You may obtain a copy of the License at | ||
# | ||
# http://www.apache.org/licenses/LICENSE-2.0 | ||
# | ||
# Unless required by applicable law or agreed to in writing, | ||
# software distributed under the License is distributed on an | ||
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY | ||
# KIND, either express or implied. See the License for the | ||
# specific language governing permissions and limitations | ||
# under the License. | ||
|
||
# pylint: skip-file | ||
import sys | ||
sys.path.insert(0, "../../python/") | ||
import mxnet as mx | ||
|
||
kv = mx.kv.create('dist_async') | ||
my_rank = kv.rank | ||
nworker = kv.num_workers | ||
|
||
def test_gluon_trainer_type(): | ||
def check_trainer_kv_update(update_on_kv): | ||
params = mx.gluon.ParameterDict() | ||
x = params.get('x', shape=(10,1), lr_mult=1.0) | ||
params.initialize(ctx=[mx.cpu(0), mx.cpu(1)], init='zeros') | ||
try: | ||
trainer = mx.gluon.Trainer(params, 'sgd', {'learning_rate': 0.1}, kvstore=kv, update_on_kvstore=update_on_kv) | ||
trainer._init_kvstore() | ||
assert trainer._kv_initialized | ||
assert trainer._update_on_kvstore is True | ||
except ValueError: | ||
assert update_on_kv is False | ||
|
||
check_trainer_kv_update(False) | ||
check_trainer_kv_update(True) | ||
check_trainer_kv_update(None) | ||
print('worker ' + str(my_rank) + ' passed test_gluon_trainer_type') | ||
|
||
if __name__ == "__main__": | ||
test_gluon_trainer_type() |
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
If we are forcing the user to set this param, why don't we set it inside the function itself as default value?
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.
If the user does not set that variable explicitly (default way), then I set it to the right value. If the user explicitly sets it to false, then raised the error.