LSTM variable sequence length

hello,
i want to use LSTM for below data structure. i want to predict next rating of review.
first: business and rating (1-5 stars)
Business_1 = [1, 3, 4, 5, 2, 4, 1, 1, 4, 5, 2, 1] => length = 12
Business_2 = [3, 3, 2, 2, 1, 5, 4] => length = 7
Business_3 = [1, 3] => length = 2

how I can use nn.LSTM when the length of data is different? if I set L= 3 for Business_3 is not ok!!

i have 2 problems.

  1. set L for LSTM
  2. different length of data for each business. i want to use one LSTM model for all business.

my second project is like it but with emotion.( 5 categorial emotion = [happy, sad, neutral , angry, fear]
Business_1 =
{review1: happy:0.4, sad:0.1, fear:0.0, angry:0.2, neutral: 0.3
review2: happy:0.0, sad:0.1, fear:0.0, angry:0.1, neutral: 0.7
review3: happy:0.6, sad:0.0, fear:0.0, angry:0.2, neutral: 0.2
}
Business_2=
{review1: happy:0.4, sad:0.1, fear:0.0, angry:0.2, neutral: 0.3
review2: happy:0.3, sad:0.5, fear:0.1, angry:0.1, neutral: 0.0
review3: happy:0.4, sad:0.0, fear:0.1, angry:0.1, neutral: 0.4
}

i want to predict the type of emotion and the amount of it for next review.

thank you very much for your response from now.

You can check out this post. You can either pad all shorter sequence in batch, or ensure that each batch contains only sequences of the same length – or a combination of both approaches.