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

Expert deepcopy raises PickleError #380

Open
sxontheway opened this issue Apr 23, 2024 · 0 comments
Open

Expert deepcopy raises PickleError #380

sxontheway opened this issue Apr 23, 2024 · 0 comments

Comments

@sxontheway
Copy link

  File "Megatron-DeepSpeed-main/megatron/core/transformer/deepspeed_moe/experts.py", line 15, in <listcomp>
    self.deepspeed_experts = torch.nn.ModuleList([copy.deepcopy(expert) for i in range(num_local_experts)])
  File "/opt/conda/lib/python3.8/copy.py", line 172, in deepcopy
    y = _reconstruct(x, memo, *rv)
  File "/opt/conda/lib/python3.8/copy.py", line 270, in _reconstruct
    state = deepcopy(state, memo)
  File "/opt/conda/lib/python3.8/copy.py", line 146, in deepcopy
    y = copier(x, memo)
  File "/opt/conda/lib/python3.8/copy.py", line 230, in _deepcopy_dict
    y[deepcopy(key, memo)] = deepcopy(value, memo)
  File "/opt/conda/lib/python3.8/copy.py", line 161, in deepcopy
    rv = reductor(4)
  File "/opt/conda/lib/python3.8/site-packages/torch/jit/_script.py", line 62, in _reduce
    raise pickle.PickleError("ScriptFunction cannot be pickled")

The deepcopy in this line of code self.deepspeed_experts = torch.nn.ModuleList([copy.deepcopy(expert) for i in range(num_local_experts)]) in deepspeed/moe/layer.py raises PickleError. However, removing deepcopy this problems solved.
Is this deepcopy neceaary?

Appreciate for your response!

@arashb @selfReference @AlphardWang @duli2012 @conglongli

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

No branches or pull requests

1 participant