DeepSpeed icon indicating copy to clipboard operation
DeepSpeed copied to clipboard

[REQUEST] Dict input and output of Pipeline Parallelism

Open x54-729 opened this issue 3 years ago • 1 comments

Hi I found it confusing when handling multiple inputs of a layer in pipeline parallelism. The lack of flexbility make it difficult to use tuple input. Is there any plans to use dict input?

e.g.

class Layer1(nn.Module):
    ...
    def forward(self, input_ids, attention_mask):
        ...
        return {"hidden_states": h, "position_ids": pos_ids}

class Layer2(nn.Module):
    ...
    def forward(self, hidden_states, position_ids):
        ...
        return {"hidden_states": h}

Also use can set some parameters with default values in forward to use them alternatively.

x54-729 avatar Jun 12 '23 06:06 x54-729

maybe this helps, it's a PR that allows multi-variable inputs on pipeline's LayerSpec: https://github.com/microsoft/DeepSpeed/pull/4766

brunomaga avatar Dec 04 '23 14:12 brunomaga