Skip to content

Commit

Permalink
fix(server): remove embeddings to save bandwidth
Browse files Browse the repository at this point in the history
  • Loading branch information
hanxiao committed May 23, 2022
1 parent 2d2da14 commit 42ef75b
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion server/clip_server/executors/helper.py
@@ -1,10 +1,11 @@
from typing import Tuple, List, Callable

import numpy as np
from clip_server.model import clip
from docarray import Document, DocumentArray
from docarray.math.distance.numpy import cosine

from clip_server.model import clip


def numpy_softmax(x: 'np.ndarray', axis: int = -1) -> 'np.ndarray':
max = np.max(x, axis=axis, keepdims=True)
Expand Down Expand Up @@ -93,4 +94,6 @@ def set_rank(docs, _logit_scale=np.exp(4.60517)):
_candidates, key=lambda _m: _m.scores['clip_score'].value, reverse=True
)

final.embeddings = None # remove embedding to save bandwidth

q.matches = final

0 comments on commit 42ef75b

Please sign in to comment.