the code is very huge to post as for loops and the file that i have also … i will describe my problem in the following lines
i implemented this line   _embedding = torch.stack(tokens_embedding) inside loop every time it read a sentences and got from it  the following results
size is  torch.Size([8, 768])
size is  torch.Size([9, 768])
size is  torch.Size([10, 768])
size is  torch.Size([13, 768])
size is  torch.Size([7, 768])
and so on

after it finished, i should use this line
 embeddings.append(_embedding)
but got
RuntimeError: stack expects each tensor to be equal size, but got [7, 768] at entry 0 and [8, 768] at entry 1