alibaba / AliceMind

ALIbaba's Collection of Encoder-decoders from MinD (Machine IntelligeNce of Damo) Lab
Apache License 2.0
1.98k stars 291 forks source link

The past_key_value in MPLUG doesn't seem to work. #94

Open lizhou-cs opened 3 months ago

lizhou-cs commented 3 months ago

I change the code like this, and it didn't work.

        kv_cache = None
        prev_tokens = set()
        max_length = int(max_length)
        for step in range(max_length):
            dec_feat_seq = self.model(alive_seq,
                                         encoder_hidden_states = src_features,
                                         encoder_attention_mask = attention_mask,
                                         past_key_values = None,
                                         use_cache = False,
                                         return_dict = True,
                                         reduction = 'none')
            kv_cache = dec_feat_seq.past_key_values