Riccorl / transformers-embedder

Redundant list comprehension can be replaced using generator PYL-R1728
Performance
Minor
a year agoa year old
Consider using a generator instead 'max(w for w in word_offsets if w is not None)'
249                    for w in word_offsets[sep_index + 1 :]
250                ]
251                # update again the sep_offset
252                sep_offset_value = max([w for w in word_offsets if w is not None]) + 1253                # replace first None occurrence with sep_offset, it should be the last SEP
254                sep_index = word_offsets.index(None)
255                word_offsets[sep_index] = sep_offset_value
Consider using a generator instead 'max(w for w in word_offsets[:sep_index] if w is not None)'
233
234            # here we retrieve the max offset for the sample, which will be used as SEP offset
235            # and also as padding value for the offsets
236            sep_offset_value = max([w for w in word_offsets[:sep_index] if w is not None]) + 1237
238            word_offsets[sep_index] = sep_offset_value
239            # if there is a text pair, we need to adjust the offsets for the second text