MegaModel not usable with chunking if input_embeds are used instead of input_ids
### System Info

When input_embeds are used instead of input_ids then input_ids = None.
Therefore this error happens in modeling_mega.py:

-> 1544 if self.config.use_chunking and (input_ids.size(1) > self.config.chunk_size):
   1545     print(input_ids.size(1))
   1546     if input_ids.size(1) % self.config.chunk_size != 0:

AttributeError: 'NoneType' object has no attribute 'size'

### Who can help?

 @ArthurZucker and @younesbelkada

### Information

- [ ] The official example scripts
- [X] My own modified scripts

### Tasks

- [ ] An officially supported task in the `examples` folder (such as GLUE/SQuAD, ...)
- [X] My own task or dataset (give details below)

### Reproduction

from transformers import MegaModel, MegaConfig
class MegaRegressor(nn.Module):
    def __init__(self, input_dim=4, hidden_dim=4, num_layers=2, num_heads=4):
        super().__init__()
        config = MegaConfig(
            vocab_size=4, 
            hidden_size=hidden_dim,
            num_attention_heads=num_heads,
            intermediate_size=4*hidden_dim,
            max_positions=50000,
            num_hidden_layers=num_layers,
            output_attentions=False,
            return_dict=True,
            use_chunking=True,
            chunk_size = 100
        )
        self.encoder = MegaModel(config)
        self.fc = nn.Linear(config.hidden_size, 1)
        self.dropout = nn.Dropout(config.hidden_dropout_prob)

    def forward(self, inputs_embeds):
        out = self.encoder(inputs_embeds=inputs_embeds)  # (batch_size, seq_length, hidden_size)

        output = out['last_hidden_state']
        
        output = torch.mean(output, dim=1)
        
        output = self.dropout(output)
        logits = self.fc(output).squeeze()  # (batch_size, 1)

        return logits

model = MegaRegressor().to(device)
#print(data.shape)  -->  torch.Size([8, 49800, 4])
output = model(data)

### Expected behavior

Model should not raise AttributeError: 'NoneType' object has no attribute 'size'
Good catch, the error is pretty straightforward, we should check with either size. 