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

DDP and hydra model #51

Closed
maxreciprocate opened this issue Oct 20, 2022 · 6 comments
Closed

DDP and hydra model #51

maxreciprocate opened this issue Oct 20, 2022 · 6 comments
Labels
bug Something isn't working

Comments

@maxreciprocate
Copy link
Collaborator

🐛 Describe the bug

Hydra model doesn't play nicely with ddp

  File "examples/ppo_sentiments.py", line 18, in <module>
    model = trlx.train(
  File "/trlx/trlx/trlx.py", line 92, in train
    model.learn()
  File "/trlx/trlx/model/accelerate_base_model.py", line 209, in learn
    loss, stats = self.loss(batch)
  File "/trlx/trlx/model/accelerate_ppo_model.py", line 112, in loss
    logits, _, vpred = self.model(
  File "/trlx/.env/lib64/python3.8/site-packages/torch/nn/modules/module.py", line 1130, in _call_impl
    return forward_call(*input, **kwargs)
  File "/trlx/.env/lib64/python3.8/site-packages/torch/nn/parallel/distributed.py", line 994, in forward
    if torch.is_grad_enabled() and self.reducer._rebuild_buckets():
RuntimeError: Expected to have finished reduction in the prior iteration before starting a new one. This error indicates that your module has parameters that were not used in producing loss. You can enable unused parameter detection by
passing the keyword argument `find_unused_parameters=True` to `torch.nn.parallel.DistributedDataParallel`, and by
making sure all `forward` function outputs participate in calculating loss.
If you already have done the above, then the distributed data parallel module wasn't able to locate the output tensors in the return value of your module's `forward` function. Please include the loss function and the structure of the
return value of `forward` of your module when reporting this issue (e.g. list, dict, iterable).
Parameter indices which did not receive grad for rank 0: 31 32 33
 In addition, you can set the environment variable TORCH_DISTRIBUTED_DEBUG to either INFO or DETAIL to print out information about which particular parameters did not receive gradient on this rank as part of this error
compute_environment: LOCAL_MACHINE
deepspeed_config: {}
distributed_type: MULTI_GPU
downcast_bf16: 'no'
fsdp_config: {}
machine_rank: 0
main_process_ip: null
main_process_port: null
main_training_function: main
mixed_precision: 'no'
num_machines: 1
num_processes: 2
use_cpu: false

accelerate launch --num_processes 2 --num_machines 1 --config_file ddp.yaml examples/ppo_sentiments.py

This is a relevant discussion
pytorch/pytorch#43259

Which trlX version are you using?

stage-api @ 8057d16

Additional system and package information

No response

@maxreciprocate maxreciprocate added the bug Something isn't working label Oct 20, 2022
@LouisCastricato
Copy link
Contributor

@Dahoas

@Dahoas
Copy link
Collaborator

Dahoas commented Oct 20, 2022

Hmm I'll look into it. I've only been testing with deepspeed. Is there ever a reason we would want to use ddp vs deepspeed?

@LouisCastricato
Copy link
Contributor

I'm not sure there's a need for DDP

@LouisCastricato
Copy link
Contributor

I would say lets close this issue. I don't think DDP is worth the effort.

@Dahoas
Copy link
Collaborator

Dahoas commented Oct 21, 2022

Let's just make clear we only support deepspeed.

@LouisCastricato
Copy link
Contributor

Ok so I think the solution is to update the readme/docs and leave it at that. Lets close this issue.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

3 participants