Skip to content
This repository has been archived by the owner on Feb 22, 2020. It is now read-only.

Commit

Permalink
fix(encoder): fix bug for encoder service dealing with empty doc
Browse files Browse the repository at this point in the history
  • Loading branch information
Larryjianfeng committed Jul 26, 2019
1 parent 7e43d5a commit 1dff06f
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions gnes/service/encoder.py
Expand Up @@ -41,8 +41,9 @@ def _handler_index(self, msg: 'gnes_pb2.Message'):
vecs = self._model.encode(chunks) vecs = self._model.encode(chunks)
s = 0 s = 0
for d in msg.request.index.docs: for d in msg.request.index.docs:
d.chunk_embeddings.CopyFrom(array2blob(vecs[s:(s + len(d.chunks))])) if len(d.chunks):
s += len(d.chunks) d.chunk_embeddings.CopyFrom(array2blob(vecs[s:(s + len(d.chunks))]))
s += len(d.chunks)


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

0 comments on commit 1dff06f

Please sign in to comment.