8000 feat(types): support lambda function in parallel mixin by hanxiao · Pull Request #4022 · jina-ai/serve · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content
8000

feat(types): support lambda function in parallel mixin #4022

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
Dec 3, 2021

Conversation

hanxiao
Copy link
Member
@hanxiao hanxiao commented Dec 3, 2021
import onnxruntime

from jina import DocumentArray, Document

model = onnxruntime.InferenceSession('resnet.onnx')

pre_proc = lambda d: (
    d.load_uri_to_image_blob()
    .set_image_blob_shape((224, 224))
    .set_image_blob_normalization()
    .set_image_blob_channel_axis(-1, 0)
)


def post_proc(d: Document):
    return d.set_image_blob_channel_axis(0, -1).set_image_blob_inv_normalization()


docs = (
    DocumentArray.from_files('/Users/hanxiao/Downloads/left/*.jpg')[:1000]
    .apply(pre_proc)
    .apply_batch(lambda d: d.embed(model), batch_size=64)
    .apply(post_proc)
)

@github-actions github-actions bot added size/S area/core This issue/PR affects the core codebase area/docs This issue/PR affects the docs component/type labels Dec 3, 2021
@codecov
Copy link
codecov bot commented Dec 3, 2021

Codecov Report

Merging #4022 (b920e77) into master (721b179) will increase coverage by 1.96%.
The diff coverage is 16.00%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master    #4022      +/-   ##
==========================================
+ Coverage   77.46%   79.42%   +1.96%     
==========================================
  Files         183      183              
  Lines       12935    12955      +20     
==========================================
+ Hits        10020    10290     +270     
+ Misses       2915     2665     -250     
Flag Coverage Δ
daemon 43.18% <16.00%> (-0.09%) ⬇️
jina 76.26% <16.00%> (+2.82%) ⬆️

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

Impacted Files Coverage Δ
jina/types/arrays/mixins/match.py 52.83% <0.00%> (-2.62%) ⬇️
jina/types/document/mixins/sugar.py 37.50% <ø> (ø)
jina/types/arrays/mixins/parallel.py 29.82% <25.00%> (-1.13%) ⬇️
jina/jaml/__init__.py 95.47% <0.00%> (+0.41%) ⬆️
jina/peapods/networking.py 83.49% <0.00%> (+0.48%) ⬆️
jina/peapods/peas/__init__.py 79.25% <0.00%> (+0.53%) ⬆️
jina/types/document/__init__.py 75.26% <0.00%> (+0.69%) ⬆️
jina/peapods/zmq/__init__.py 86.51% <0.00%> (+0.69%) ⬆️
jina/peapods/runtimes/zmq/zed.py 88.58% <0.00%> (+0.91%) ⬆️
jina/helper.py 81.70% <0.00%> (+1.24%) ⬆️
... and 19 more

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 721b179...b920e77. Read the comment docs.

@github-actions
Copy link
github-actions bot commented Dec 3, 2021

Latency summary

Current PR yields:

  • 🐢🐢 index QPS at 1248, delta to last 2 avg.: -7%
  • 🐢🐢 query QPS at 24, delta to last 2 avg.: -13%
  • 🐢🐢 dam extend QPS at 34017, delta to last 2 avg.: -18%
  • 🐢🐢 avg flow time within 1.5307 seconds, delta to last 2 avg.: +6%
  • 😶 import jina within 0.4264 seconds, delta to last 2 avg.: +4%

Breakdown

Version Index QPS Query QPS DAM Extend QPS Avg Flow Time (s) Import Time (s)
current 1248 24 34017 1.5307 0.4264
2.5.1 1578 34 52088 1.2765 0.3381
2.5.0 1114 20 31543 1.5939 0.477

Backed by latency-tracking. Further commits will update this comment.

@hanxiao hanxiao marked this pull request as draft December 3, 2021 09:57
@github-actions github-actions bot added size/M area/setup This issue/PR affects setting up Jina area/testing This issue/PR affects testing labels Dec 3, 2021
@hanxiao hanxiao closed this Dec 3, 2021
@hanxiao hanxiao reopened this Dec 3, 2021
@hanxiao hanxiao marked this pull request as ready for review December 3, 2021 11:45
@github-actions
Copy link
github-actions bot commented Dec 3, 2021

📝 Docs are deployed on https://feat-support-lambda-in- 8000 parallel--jina-docs.netlify.app 🎉

@hanxiao hanxiao merged commit 01151e3 into master Dec 3, 2021
@hanxiao hanxiao deleted the feat-support-lambda-in-parallel branch December 3, 2021 12:19
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area/core This issue/PR affects the core codebase area/docs This issue/PR affects the docs area/setup This issue/PR affects setting up Jina area/testing This issue/PR affects testing component/resource component/type size/M size/S
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants
0