Skip to content
This repository has been archived by the owner on Nov 3, 2023. It is now read-only.

Commit

Permalink
update ltm (#4156)
Browse files Browse the repository at this point in the history
  • Loading branch information
klshuster authored Nov 9, 2021
1 parent d917d48 commit 74dfeeb
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion projects/blenderbot2/agents/modules.py
Original file line number Diff line number Diff line change
Expand Up @@ -566,9 +566,11 @@ def access_long_term_memory(
indices = memory_indices.tolist()

if memory_vec is not None:
# Only look in memory_vec for batch elements with memories
memory_ids = [m for m in indices if num_memories[m] > 0]
memory_dict = {
batch_id: memory_vec[batch_id, : num_memories[mem_id]]
for batch_id, mem_id in enumerate(indices)
for batch_id, mem_id in enumerate(memory_ids)
}
if memory_decoder_vec is not None:
for batch_id in indices:
Expand Down

0 comments on commit 74dfeeb

Please sign in to comment.