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

[ZeRO Infinity] Allow Init to take a dict for the deepspeed config #983

Merged
merged 6 commits into from
Apr 20, 2021
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 4 additions & 2 deletions deepspeed/runtime/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -521,8 +521,10 @@ def write_config(self, filename):
class DeepSpeedConfig(object):
def __init__(self, json_file, mpu=None, param_dict=None):
super(DeepSpeedConfig, self).__init__()

if param_dict is None:
if isinstance(json_file, dict):
Copy link
Contributor

@tjruwase tjruwase Apr 20, 2021

Choose a reason for hiding this comment

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

I think typing json_file as a dict is confusing, rather we should pass dict as param_dict. So ideally this file should be unchanged for this PR. Instead the following should be modified to optionally pass param_dict as appropriate.
Call 1
Call 2

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Much cleaner, just made the change!

# Assume json file has been loaded
self._param_dict = json_file
elif param_dict is None:
self._param_dict = json.load(
open(json_file,
'r'),
Expand Down
2 changes: 1 addition & 1 deletion deepspeed/runtime/zero/partition_parameters.py
Original file line number Diff line number Diff line change
Expand Up @@ -291,7 +291,7 @@ def __init__(self,
pin_memory (bool, optional): Potentially increase performance by
using pinned memory for model weights. ``remote_device`` must be
``"cpu"``. Defaults to ``False``.
deepspeed_config (``json file``, optional): If provided, provides configuration
deepspeed_config (``json file`` or dict, optional): If provided, provides configuration
for swapping fp16 params to NVMe.
enabled (bool, optional): If ``False``, this context has no
effect. Defaults to ``True``.
Expand Down