wiseodd / controlled-text-generation

Reproducing Hu, et. al., ICML 2017's "Toward Controlled Generation of Text"
BSD 3-Clause "New" or "Revised" License
242 stars 63 forks source link

How to handle inputs with variable length #23

Open JianboGuo opened 6 years ago

JianboGuo commented 6 years ago

Hi @wiseodd, thanks for your open-source code. I find the forward_encoder_embed function in the model.py module cannot support inputs with variable length. In your code, it seems that you assume that each of the input sentences is of length max_sent_len 15, as you alway use the last hidden state to encode the paded sentence.

ZiweiG commented 3 years ago

Hi @wiseodd, thanks for your open-source code. I find the forward_encoder_embed function in the model.py module cannot support inputs with variable length. In your code, it seems that you assume that each of the input sentences is of length max_sent_len 15, as you alway use the last hidden state to encode the paded sentence.

Hi! Have you figured out how to handle inputs with variable length? I run into the same problem.