From 2a85b3ebf29a98958b8ecf670997b05e0118ff8e Mon Sep 17 00:00:00 2001 From: Rex Cheng Date: Sat, 31 Aug 2024 23:01:25 -0500 Subject: [PATCH] fix prepend --- cutie/inference/kv_memory_store.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/cutie/inference/kv_memory_store.py b/cutie/inference/kv_memory_store.py index e50b794..7d04974 100644 --- a/cutie/inference/kv_memory_store.py +++ b/cutie/inference/kv_memory_store.py @@ -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 @@ -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.