Hi,
We put out to posts about aligning raw spans to tokens.
This one 32 has the implementation details  with considerations for padding / batching and generally dealing with longer texts.
Also, there’s a PR here 10 that provides a visualization utility so that you can visually check your alignments in a notebook.
Hope that helps