Well, can’t you show the function that you’re passing to map? It’s pretty difficult to figure out what goes wrong otherwise.



 SMMousavi:

the sentence it generates and the number of instances it generates and returns are completely random


I guess that the return value of that function might be the culprit. The logic behind map is that it passes the current batch (which is basically a dict-like object) to the function, takes its output (which should be a dictionary with keys being feature names) and adds or replaces (if names match) key value pairs in the given batch object. So the question is how do you implement the case where multiple augmented sentences are returned by the function? Does your sentence feature become a sequence of strings? Or do you do something else?
So to reiterate, the way you’re returning multiple augmented sentences for a single input sentence might be the cause.