apps/pretrained_protein/tape/data_gen.py
def sequence_sample_reader(filenames, label_name):
    """
    DataLoader for sequence classification tasks.
    """
    def __reader__():
        for filename in filenames:
            data = np.load(filename)
            token_ids = data['token_ids']
            labels = data[label_name]
            lengths = data['lengths']

            offset = 0
            for i in range(lengths.size):
                tokens = token_ids[offset:offset + lengths[i]].reshape(lengths[i], 1)
                pos = np.arange(lengths[i]).reshape(lengths[i], 1)
                label = labels[offset:offset + lengths[i]].reshape(lengths[i], 1)
                yield (tokens, pos, label)
                offset += lengths[i]
    return __reader__

    DataLoader for sequence classification tasks.
    
DataLoader for sequence classification tasks.
DataLoader for sequence classification tasks .
def sequence_sample_reader(filenames, label_name):
    def __reader__():
        for filename in filenames:
            data = np.load(filename)
            token_ids = data['token_ids']
            labels = data[label_name]
            lengths = data['lengths']
            offset = 0
            for i in range(lengths.size):
                tokens = token_ids[offset:offset + lengths[i]].reshape(lengths[i], 1)
                pos = np.arange(lengths[i]).reshape(lengths[i], 1)
                label = labels[offset:offset + lengths[i]].reshape(lengths[i], 1)
                yield (tokens, pos, label)
                offset += lengths[i]
    return __reader__
def sequence_sample_reader ( filenames , label_name ) : def __reader__ ( ) : for filename in filenames : data = np . load ( filename ) token_ids = data [ 'token_ids' ] labels = data [ label_name ] lengths = data [ 'lengths' ] offset = 0 for i in range ( lengths . size ) : tokens = token_ids [ offset : offset + lengths [ i ] ] . reshape ( lengths [ i ] , 1 ) pos = np . arange ( lengths [ i ] ) . reshape ( lengths [ i ] , 1 ) label = labels [ offset : offset + lengths [ i ] ] . reshape ( lengths [ i ] , 1 ) yield ( tokens , pos , label ) offset += lengths [ i ] return __reader__
DataLoader for sequence classification tasks.
DataLoader for sequence classification tasks .
"""
    DataLoader for sequence classification tasks.
    """
filenames
label_name