Skip to content
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

feat: add multimodal set #1385

Merged
merged 5 commits into from
Dec 2, 2020
Merged

Conversation

JoanFM
Copy link
Member

@JoanFM JoanFM commented Dec 2, 2020

No description provided.

@JoanFM JoanFM requested a review from a team as a code owner December 2, 2020 16:04
@JoanFM JoanFM changed the title Fix integration test feat: add multimodal set Dec 2, 2020
@jina-bot jina-bot added size/M area/core This issue/PR affects the core codebase area/helper This issue/PR affects the helper functionality area/testing This issue/PR affects testing component/driver component/type labels Dec 2, 2020
@JoanFM JoanFM changed the base branch from master to feat-add-multimodal-document December 2, 2020 16:07
Copy link
Member

@bwanglzu bwanglzu left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtm, I'll figure out a better way to ensure a callback is called (if exist) (also CI failed)

@codecov
Copy link

codecov bot commented Dec 2, 2020

Codecov Report

Merging #1385 (1bf3a98) into feat-add-multimodal-document (1d8e34c) will decrease coverage by 0.50%.
The diff coverage is 100.00%.

Impacted file tree graph

@@                       Coverage Diff                        @@
##           feat-add-multimodal-document    #1385      +/-   ##
================================================================
- Coverage                         83.75%   83.25%   -0.51%     
================================================================
  Files                               104      104              
  Lines                              6921     6884      -37     
================================================================
- Hits                               5797     5731      -66     
- Misses                             1124     1153      +29     
Impacted Files Coverage Δ
jina/types/document/multimodal.py 100.00% <ø> (ø)
jina/drivers/multimodal.py 91.42% <100.00%> (+0.25%) ⬆️
jina/types/sets/document_set.py 86.36% <100.00%> (-11.89%) ⬇️
jina/docker/hubapi.py 70.31% <0.00%> (-5.47%) ⬇️
jina/docker/hubio.py 65.71% <0.00%> (-5.20%) ⬇️
jina/types/document/__init__.py 96.95% <0.00%> (-0.44%) ⬇️
jina/peapods/pod.py 82.89% <0.00%> (-0.30%) ⬇️
jina/types/message/__init__.py 87.56% <0.00%> (-0.20%) ⬇️
jina/peapods/container.py 91.30% <0.00%> (-0.19%) ⬇️
... and 4 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 1d8e34c...7728cdc. Read the comment docs.

@bwanglzu bwanglzu merged commit 04e20f3 into feat-add-multimodal-document Dec 2, 2020
@bwanglzu bwanglzu deleted the fix-integration-test branch December 2, 2020 17:39
JoanFM added a commit that referenced this pull request Dec 2, 2020
* feat: draft multimodal document

* feat: add draft multimodal document

* feat: add multimodal document

* feat: add multimodal document

* feat: add multimodal document

* feat: add multimodal document

* feat: add from chunks classmethod

* feat: add from chunks classmethod

* feat: add from chunks classmethod

* feat: add from chunks classmethod

* feat: add multimodal document

* feat: add multimodal document

* feat: add multimodal document

* feat: add multimodal document

* feat: add multimodal set (#1385)

* feat: add multimodal set

* test: move conftest

* test: fix unit test for multimodal driver

Co-authored-by: Joan Fontanals <joan.martinez@jina.ai>
@@ -88,3 +88,21 @@ def build(self):

def sort(self, *args, **kwargs):
self._docs_proto.sort(*args, **kwargs)


class MultiModalDocumentSet(DocumentSet):
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@JoanFM We need a consistent naming here. MultiModalDocumentSet and MultimodalDocument is not a good choice.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oh yes I will change it, what is preferred?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Personally, MultimodalDocumentSet is prefered because multimodal is one word.

Copy link
Member

@maximilianwerk maximilianwerk Dec 3, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In case, we might have a CrossModalDocumentSet in the future, I'd prefer MultiModalDocumentSet. But the cross-modal thingy might not make to much sense.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think there will not be a CrossModalDocumentSet

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Opened a PR to fix this #1390

def validate_response(resp):
is_callback_called._callback_called = True
Copy link
Member

@maximilianwerk maximilianwerk Dec 3, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is overkill and not the right way. We should use the build in and standardized way of doing it. There are two ways. Either we use unittest.mock.Mock like:

response_mock = Mock(wraps=validate_response)
index_gt_flow.index(input_fn=multimodal_all_types_documents, output_fn=response_mock)
mock.assert_called()

Or we add pytest-mock as a dependency and do:

def test_multimodal_all_types_parallel(multimodal_all_types_documents, mocker):
    ...
    response_mock = mocker.Mock(wraps=validate_response)
    index_gt_flow.index(input_fn=multimodal_all_types_documents, output_fn=response_mock)
    mock.assert_called()

I'd prefer using unittest.mock.Mock.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I am working on it in general in another PR will try to implement ur suggestions, is there a way to have it easily included in the tests?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It is exactly as easy as I wrote. just mock the callback function and test with mock.assert_called() if the callback was called.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yes, yes. I mean something more automatic without much effort, But I think there isnot. About to change in #1391

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/helper This issue/PR affects the helper functionality area/testing This issue/PR affects testing component/driver component/type size/S
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

5 participants