Skip to content

Commit e0139ac

Browse files
SangChengCsangchengmenghiworldwzj
authored
[add]add tokens_num api (#798)
Co-authored-by: sangchengmeng <sangchengmeng@sensetime.com> Co-authored-by: hiworldwzj <30762946+hiworldwzj@users.noreply.github.com>
1 parent d872211 commit e0139ac

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

lightllm/server/multimodal_params.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,12 @@ def preload(self):
3333
img_data = ret.content
3434
elif self._type == "base64":
3535
img_data = base64.b64decode(self._data)
36+
elif self._type == "image_size":
37+
# image_size 代表直接传入图片的 width,height,主要是用于一些场景
38+
# 的 token 计数判断, 所以只需要图片长宽信息,不需要具体图片的内容信息
39+
self.image_w = self._data[0]
40+
self.image_h = self._data[1]
41+
return
3642
else:
3743
raise ValueError(f"cannot read image which type is {self._type}!")
3844

0 commit comments

Comments
 (0)