Skip to content

Commit

Permalink
fix prepend
Browse files Browse the repository at this point in the history
  • Loading branch information
hkchengrex committed Sep 1, 2024
1 parent b002b5b commit 2a85b3e
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion cutie/inference/kv_memory_store.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,10 @@ def _add_last_dim(dictionary, key, new_value, prepend=False):
# if the key does not exist, put the new value in
# append by default
if key in dictionary:
dictionary[key] = torch.cat([dictionary[key], new_value], -1)
if prepend:
dictionary[key] = torch.cat([new_value, dictionary[key]], -1)
else:
dictionary[key] = torch.cat([dictionary[key], new_value], -1)
else:
dictionary[key] = new_value

Expand All @@ -18,6 +21,7 @@ class KeyValueMemoryStore:
Works for key/value pairs type storage
e.g., working and long-term memory
"""

def __init__(self, save_selection: bool = False, save_usage: bool = False):
"""
We store keys and values of objects that first appear in the same frame in a bucket.
Expand Down

0 comments on commit 2a85b3e

Please sign in to comment.