Skip to content

About adapting Tutel in fairseq #293

Description

Hi,

Thanks for the nice project.

I've been trying to integrate Tutel into a former version of fairseq (which doesn't support MoE and Tutel). And I modified the source code following the https://github.com/microsoft/Tutel/blob/main/tutel/examples/fairseq_moe/fairseq_patch.diff. But without using the system.cache() to read loss.

And in my model, I chose:
self.moe = moe_layer(
gate_type={'type': 'top', 'k': 2, 'capacity_factor': 0.0, 'fp32_gate': True, 'gate_noise': 1.0},
model_dim=self.embed_dim,
experts={
'num_experts_per_device': num_experts_per_device,
'type': 'ffn', 'hidden_size_per_expert': args.decoder_ffn_embed_dim, 'activation_fn': lambda x: self.activation_fn(x)
},
scan_expert_func = lambda name, param: setattr(param, 'expert', True), # The mask is only compatible with Fairseq based on legacy_ddp
parallel_type = "data",
)

However, I encountered this:
FloatingPointError: Fatal error: gradients are inconsistent between workers. Try --ddp-backend=legacy_ddp. Or are you mixing up different generation of GPUs in training?
grad_norm across the workers:
rank 0 = 120.00565186
rank 1 = 115.86860352'

I have already used a legacy_ddp backend. But this issue is always with me, when I tried other open-cource code for MoE. Would you help me here?

Many thanks,
Z

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions