0
$\begingroup$

I prepared a lstm model using tensorflow which has a max_sequence_length of 5000 and I'm padding the small sentences with 0's. I then deployed and tested the model with multiple calls at a time. I then encountered a memory error because the max_sequence_length is consuming a lot of memory.

Is there is any alternative to writing the model more efficiently using some thing as an alternative to padding?

$\endgroup$

1 Answer 1

1
$\begingroup$

Assuming you have tried alternatives like storing it in csr matrices in scipy, you can move away from padding to avoid memory issues by declaring your batch_size=1 and may be create batches using a groupby for equal length sequences. If you are using keras, then please check Masking.

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.