-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #7 from jina-ai/refactor-migration-jina3
refactor: change folder
- Loading branch information
Showing
17 changed files
with
45 additions
and
3 deletions.
There are no files selected for viewing
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
jtype: MeshDataEncoder | ||
metas: | ||
py_modules: | ||
- __init__.py | ||
- executor/__init__.py |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
from .encoder import MeshDataEncoder |
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Empty file.
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
import numpy as np | ||
import pytest | ||
from jina import DocumentArray, Flow | ||
|
||
from executor import MeshDataEncoder | ||
|
||
|
||
@pytest.mark.parametrize('model_name', ['pointconv', 'pointnet']) | ||
def test_integration(model_name: str): | ||
docs = DocumentArray.empty(5) | ||
docs.tensors = np.random.random((5, 1024, 3)) | ||
with Flow(return_results=True).add( | ||
uses=MeshDataEncoder, | ||
uses_with={'pretrained_model': None, 'default_model_name': model_name}, | ||
) as flow: | ||
resp = flow.post( | ||
on='/index', | ||
inputs=docs, | ||
return_results=True, | ||
) | ||
|
||
for doc in resp: | ||
assert doc.embedding is not None | ||
assert doc.embedding.shape == (1024,) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
pytest |
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
import numpy as np | ||
import pytest | ||
from jina import Document, DocumentArray | ||
|
||
from executor import MeshDataEncoder | ||
|
||
|
||
@pytest.mark.parametrize('model_name', ['pointconv', 'pointnet']) | ||
def test_encoder(model_name): | ||
encoder = MeshDataEncoder(pretrained_model=None, default_model_name=model_name) | ||
|
||
docs = DocumentArray(Document(tensor=np.random.random((1024, 3)))) | ||
|
||
encoder.encode(docs) | ||
|
||
assert docs[0].embedding is not None | ||
assert docs[0].embedding.shape == (1024,) |