The notes here may be helpful for using the packing functions https://github.com/pytorch/pytorch/releases/tag/v0.1.10 60
Depending on your use case, the torchtext 7 library may be helpful with creating an iterable dataset object containing your sentences; let me know if you have issues with using it (documentation is in the code’s docstrings).