On first glance, it looks like your shapes aren’t right.
features is (1, D), where D=2048.  embeddings on the line = self.embed... appears to be (1, S, E) where S is sequence length, presumably 5332.
So it would seem to me that cat only works if E=D, packing works if S = lengths - 1, and self.linear requires hidden_size = D.
Given the stack trace, it seems to me that the problem is with S, or lengths.