Esempio n. 1
0
 def set_batch(self, keys, vectors):
     with self.db.begin(write=True) as txn:
         for i, key in enumerate(keys):
             vector = vectors[i]
             txn.put(key.encode("utf-8"), data_utils.serialize_embedding(vector))
             if vector is None:
                 print(key, 'corresponding vector is None when lmdb set batch')
Esempio n. 2
0
 def set_batch(self, generator):
     with self.db.begin(write=True) as txn:
         for key, vector in generator:
             txn.put(key.encode("utf-8"), data_utils.serialize_embedding(vector))
             print(key, self.get(key))
Esempio n. 3
0
 def set(self, key, vector):
     with self.db.begin(write=True) as txn:
         txn.put(key.encode("utf-8"), data_utils.serialize_embedding(vector))
Esempio n. 4
0
 def set(self, key, vector):
     with self.db.begin(write=True) as txn:
         txn.put(key.encode("utf-8"), data_utils.serialize_embedding(vector))
     if vector is None:
         print(key, 'corresponding vector is None when lmdb set value')