Skip to content
Permalink
Browse files

fix(encoder): fix bug for encoder service dealing with empty doc

  • Loading branch information...
Larryjianfeng committed Jul 26, 2019
1 parent 7e43d5a commit 1dff06f18e4ab13d416db2ec5ab173cbcf325931
Showing with 3 additions and 2 deletions.
  1. +3 −2 gnes/service/encoder.py
@@ -41,8 +41,9 @@ def _handler_index(self, msg: 'gnes_pb2.Message'):
vecs = self._model.encode(chunks)
s = 0
for d in msg.request.index.docs:
d.chunk_embeddings.CopyFrom(array2blob(vecs[s:(s + len(d.chunks))]))
s += len(d.chunks)
if len(d.chunks):
d.chunk_embeddings.CopyFrom(array2blob(vecs[s:(s + len(d.chunks))]))
s += len(d.chunks)

@handler.register(gnes_pb2.Request.TrainRequest)
def _handler_train(self, msg: 'gnes_pb2.Message'):

0 comments on commit 1dff06f

Please sign in to comment.
You can’t perform that action at this time.