jina-ai / clip-as-service

🏄 Scalable embedding, reasoning, ranking for images and sentences with CLIP
https://clip-as-service.jina.ai
Other
12.48k stars 2.07k forks source link

fix: check dtype when loading models #872

Closed ZiniuYu closed 1 year ago

ZiniuYu commented 1 year ago

The dtype is automatically set to torch.float16 when running on GPU. This pr fixes dtype checking logics to unblock torch.float16

codecov[bot] commented 1 year ago

Codecov Report

Merging #872 (e38c854) into main (1eebdd7) will increase coverage by 10.34%. The diff coverage is 100.00%.

@@             Coverage Diff             @@
##             main     #872       +/-   ##
===========================================
+ Coverage   70.69%   81.04%   +10.34%     
===========================================
  Files          22       22               
  Lines        1498     1498               
===========================================
+ Hits         1059     1214      +155     
+ Misses        439      284      -155     
Flag Coverage Δ
cas 81.04% <100.00%> (+10.34%) :arrow_up:

Flags with carried forward coverage won't be shown. Click here to find out more.

Impacted Files Coverage Δ
server/clip_server/model/model.py 75.09% <100.00%> (ø)
server/clip_server/model/trt_utils.py 56.04% <0.00%> (+56.04%) :arrow_up:
server/clip_server/model/clip_trt.py 69.38% <0.00%> (+69.38%) :arrow_up:
server/clip_server/executors/clip_tensorrt.py 94.59% <0.00%> (+94.59%) :arrow_up:

Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here.