From 00116ce4b469b6baa20a44a36de6d170af6e8150 Mon Sep 17 00:00:00 2001 From: ZiniuYu Date: Tue, 21 Feb 2023 11:45:00 +0800 Subject: [PATCH 01/26] fix: onnx package conflict during setup --- server/setup.py | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/server/setup.py b/server/setup.py index 7d850fabf..246323785 100644 --- a/server/setup.py +++ b/server/setup.py @@ -51,11 +51,10 @@ ], extras_require={ 'onnx': [ - 'onnxruntime', 'onnx', 'onnxmltools', ] - + (['onnxruntime-gpu>=1.8.0'] if sys.platform != 'darwin' else []), + + (['onnxruntime-gpu>=1.8.0'] if sys.platform != 'darwin' else ['onnxruntime']), 'tensorrt': ['nvidia-tensorrt'], 'transformers': ['transformers>=4.16.2'], 'search': ['annlite>=0.3.10'], From b9dcde389b802ac67f1e3cbcd7fb11ac6354cfe5 Mon Sep 17 00:00:00 2001 From: ZiniuYu Date: Tue, 21 Feb 2023 12:03:53 +0800 Subject: [PATCH 02/26] fix: broken test image --- tests/test_asyncio.py | 2 +- tests/test_helper.py | 16 +++++++++------- tests/test_ranker.py | 24 ++++++++++++++---------- tests/test_search.py | 8 ++++++-- tests/test_server.py | 12 ++++++------ tests/test_simple.py | 10 ++++++---- tests/test_tensorrt.py | 10 +++++++--- 7 files changed, 49 insertions(+), 33 deletions(-) diff --git a/tests/test_asyncio.py b/tests/test_asyncio.py index cf3618be4..45d0e3669 100644 --- a/tests/test_asyncio.py +++ b/tests/test_asyncio.py @@ -26,7 +26,7 @@ async def test_async_encode(make_flow): DocumentArray( [ Document( - uri='https://docarray.jina.ai/_static/favicon.png', + uri='https://raw.githubusercontent.com/jina-ai/clip-as-service/main/docs/_static/favicon.png', text='hello, world', ), ] diff --git a/tests/test_helper.py b/tests/test_helper.py index acce92ad2..41ae76a64 100644 --- a/tests/test_helper.py +++ b/tests/test_helper.py @@ -32,10 +32,10 @@ def test_numpy_softmax(shape, axis): Document(text='goodbye, world'), Document( text='hello, world', - uri='https://docarray.jina.ai/_static/favicon.png', + uri='https://raw.githubusercontent.com/jina-ai/clip-as-service/main/docs/_static/favicon.png', ), Document( - uri='https://docarray.jina.ai/_static/favicon.png', + uri='https://raw.githubusercontent.com/jina-ai/clip-as-service/main/docs/_static/favicon.png', ), ] ), @@ -47,14 +47,14 @@ def test_numpy_softmax(shape, axis): Document(text='hello, world'), Document(tensor=np.array([0, 1, 2])), Document( - uri='https://docarray.jina.ai/_static/favicon.png' + uri='https://raw.githubusercontent.com/jina-ai/clip-as-service/main/docs/_static/favicon.png' ).load_uri_to_blob(), Document( tensor=np.array([0, 1, 2]), - uri='https://docarray.jina.ai/_static/favicon.png', + uri='https://raw.githubusercontent.com/jina-ai/clip-as-service/main/docs/_static/favicon.png', ), Document( - uri='https://docarray.jina.ai/_static/favicon.png', + uri='https://raw.githubusercontent.com/jina-ai/clip-as-service/main/docs/_static/favicon.png', ), ] ), @@ -64,7 +64,9 @@ def test_numpy_softmax(shape, axis): DocumentArray( [ Document(text='hello, world'), - Document(uri='https://docarray.jina.ai/_static/favicon.png'), + Document( + uri='https://raw.githubusercontent.com/jina-ai/clip-as-service/main/docs/_static/favicon.png' + ), ] ), (1, 1), @@ -86,7 +88,7 @@ def test_split_img_txt_da(inputs): DocumentArray( [ Document( - uri='https://docarray.jina.ai/_static/favicon.png', + uri='https://raw.githubusercontent.com/jina-ai/clip-as-service/main/docs/_static/favicon.png', ).load_uri_to_blob(), ] ) diff --git a/tests/test_ranker.py b/tests/test_ranker.py index 70f8165b3..ffe682619 100644 --- a/tests/test_ranker.py +++ b/tests/test_ranker.py @@ -68,14 +68,14 @@ async def test_torch_executor_rank_text2imgs(encoder_class): [ [ Document( - uri='https://docarray.jina.ai/_static/favicon.png', + uri='https://raw.githubusercontent.com/jina-ai/clip-as-service/main/docs/_static/favicon.png', matches=[ Document(text='hello, world'), Document(text='goodbye, world'), ], ), Document( - uri='https://docarray.jina.ai/_static/favicon.png', + uri='https://raw.githubusercontent.com/jina-ai/clip-as-service/main/docs/_static/favicon.png', matches=[ Document(text='hello, world'), Document(text='goodbye, world'), @@ -85,14 +85,14 @@ async def test_torch_executor_rank_text2imgs(encoder_class): DocumentArray( [ Document( - uri='https://docarray.jina.ai/_static/favicon.png', + uri='https://raw.githubusercontent.com/jina-ai/clip-as-service/main/docs/_static/favicon.png', matches=[ Document(text='hello, world'), Document(text='goodbye, world'), ], ), Document( - uri='https://docarray.jina.ai/_static/favicon.png', + uri='https://raw.githubusercontent.com/jina-ai/clip-as-service/main/docs/_static/favicon.png', matches=[ Document(text='hello, world'), Document(text='goodbye, world'), @@ -102,7 +102,7 @@ async def test_torch_executor_rank_text2imgs(encoder_class): ), lambda: ( Document( - uri='https://docarray.jina.ai/_static/favicon.png', + uri='https://raw.githubusercontent.com/jina-ai/clip-as-service/main/docs/_static/favicon.png', matches=[ Document(text='hello, world'), Document(text='goodbye, world'), @@ -115,7 +115,9 @@ async def test_torch_executor_rank_text2imgs(encoder_class): Document( text='hello, world', matches=[ - Document(uri='https://docarray.jina.ai/_static/favicon.png'), + Document( + uri='https://raw.githubusercontent.com/jina-ai/clip-as-service/main/docs/_static/favicon.png' + ), Document( uri=f'{os.path.dirname(os.path.abspath(__file__))}/img/00000.jpg' ), @@ -144,7 +146,7 @@ def test_docarray_inputs(make_flow, inputs): [ [ Document( - uri='https://docarray.jina.ai/_static/favicon.png', + uri='https://raw.githubusercontent.com/jina-ai/clip-as-service/main/docs/_static/favicon.png', matches=[ Document(text='hello, world'), Document(text='goodbye, world'), @@ -154,7 +156,7 @@ def test_docarray_inputs(make_flow, inputs): DocumentArray( [ Document( - uri='https://docarray.jina.ai/_static/favicon.png', + uri='https://raw.githubusercontent.com/jina-ai/clip-as-service/main/docs/_static/favicon.png', matches=[ Document(text='hello, world'), Document(text='goodbye, world'), @@ -164,7 +166,7 @@ def test_docarray_inputs(make_flow, inputs): ), lambda: ( Document( - uri='https://docarray.jina.ai/_static/favicon.png', + uri='https://raw.githubusercontent.com/jina-ai/clip-as-service/main/docs/_static/favicon.png', matches=[ Document(text='hello, world'), Document(text='goodbye, world'), @@ -177,7 +179,9 @@ def test_docarray_inputs(make_flow, inputs): Document( text='hello, world', matches=[ - Document(uri='https://docarray.jina.ai/_static/favicon.png'), + Document( + uri='https://raw.githubusercontent.com/jina-ai/clip-as-service/main/docs/_static/favicon.png' + ), Document( uri=f'{os.path.dirname(os.path.abspath(__file__))}/img/00000.jpg' ), diff --git a/tests/test_search.py b/tests/test_search.py index 52dd15e4c..f9a32128b 100644 --- a/tests/test_search.py +++ b/tests/test_search.py @@ -15,7 +15,9 @@ lambda: (Document(text='hello, world') for _ in range(10)), DocumentArray( [ - Document(uri='https://docarray.jina.ai/_static/favicon.png'), + Document( + uri='https://raw.githubusercontent.com/jina-ai/clip-as-service/main/docs/_static/favicon.png' + ), Document( uri=f'{os.path.dirname(os.path.abspath(__file__))}/img/00000.jpg' ), @@ -52,7 +54,9 @@ def test_index_search(make_search_flow, inputs, limit): lambda: (Document(text='hello, world') for _ in range(10)), DocumentArray( [ - Document(uri='https://docarray.jina.ai/_static/favicon.png'), + Document( + uri='https://raw.githubusercontent.com/jina-ai/clip-as-service/main/docs/_static/favicon.png' + ), Document( uri=f'{os.path.dirname(os.path.abspath(__file__))}/img/00000.jpg' ), diff --git a/tests/test_server.py b/tests/test_server.py index b5046baf0..66144566e 100644 --- a/tests/test_server.py +++ b/tests/test_server.py @@ -10,7 +10,7 @@ def test_server_download(tmpdir): download_model( - url='https://docarray.jina.ai/_static/favicon.png', + url='https://raw.githubusercontent.com/jina-ai/clip-as-service/main/docs/_static/favicon.png', target_folder=tmpdir, md5sum='66ea4817d73514888dcf6c7d2b00016d', with_resume=False, @@ -27,7 +27,7 @@ def test_server_download(tmpdir): os.remove(target_path) download_model( - url='https://docarray.jina.ai/_static/favicon.png', + url='https://raw.githubusercontent.com/jina-ai/clip-as-service/main/docs/_static/favicon.png', target_folder=tmpdir, md5sum='66ea4817d73514888dcf6c7d2b00016d', with_resume=True, @@ -40,7 +40,7 @@ def test_server_download(tmpdir): def test_server_download_md5(tmpdir, md5): if md5 != 'ABC': download_model( - url='https://docarray.jina.ai/_static/favicon.png', + url='https://raw.githubusercontent.com/jina-ai/clip-as-service/main/docs/_static/favicon.png', target_folder=tmpdir, md5sum=md5, with_resume=False, @@ -48,7 +48,7 @@ def test_server_download_md5(tmpdir, md5): else: with pytest.raises(Exception): download_model( - url='https://docarray.jina.ai/_static/favicon.png', + url='https://raw.githubusercontent.com/jina-ai/clip-as-service/main/docs/_static/favicon.png', target_folder=tmpdir, md5sum=md5, with_resume=False, @@ -58,7 +58,7 @@ def test_server_download_md5(tmpdir, md5): def test_server_download_not_regular_file(tmpdir): with pytest.raises(Exception): download_model( - url='https://docarray.jina.ai/_static/favicon.png', + url='https://raw.githubusercontent.com/jina-ai/clip-as-service/main/docs/_static/favicon.png', target_folder=tmpdir, md5sum='', with_resume=False, @@ -87,7 +87,7 @@ def test_make_onnx_flow_wrong_name_path(): 'image_uri', [ f'{os.path.dirname(os.path.abspath(__file__))}/img/00000.jpg', - 'https://docarray.jina.ai/_static/favicon.png', + 'https://raw.githubusercontent.com/jina-ai/clip-as-service/main/docs/_static/favicon.png', ], ) @pytest.mark.parametrize('size', [224, 288, 384, 448]) diff --git a/tests/test_simple.py b/tests/test_simple.py index 8611395f4..24f874b2e 100644 --- a/tests/test_simple.py +++ b/tests/test_simple.py @@ -35,7 +35,7 @@ def test_protocols(port_generator, protocol, jit, pytestconfig): ('hello, world', 'goodbye, world'), lambda: ('hello, world' for _ in range(10)), [ - 'https://docarray.jina.ai/_static/favicon.png', + 'https://raw.githubusercontent.com/jina-ai/clip-as-service/main/docs/_static/favicon.png', f'{os.path.dirname(os.path.abspath(__file__))}/img/00000.jpg', 'hello, world', ], @@ -58,7 +58,9 @@ def test_plain_inputs(make_flow, inputs): lambda: (Document(text='hello, world') for _ in range(10)), DocumentArray( [ - Document(uri='https://docarray.jina.ai/_static/favicon.png'), + Document( + uri='https://raw.githubusercontent.com/jina-ai/clip-as-service/main/docs/_static/favicon.png' + ), Document( uri=f'{os.path.dirname(os.path.abspath(__file__))}/img/00000.jpg' ), @@ -90,7 +92,7 @@ def test_docarray_inputs(make_flow, inputs): DocumentArray( [ Document( - uri='https://docarray.jina.ai/_static/favicon.png', + uri='https://raw.githubusercontent.com/jina-ai/clip-as-service/main/docs/_static/favicon.png', text='hello, world', ), ] @@ -117,7 +119,7 @@ def test_docarray_preserve_original_inputs(make_flow, inputs): DocumentArray( [ Document( - uri='https://docarray.jina.ai/_static/favicon.png', + uri='https://raw.githubusercontent.com/jina-ai/clip-as-service/main/docs/_static/favicon.png', text='hello, world', ), ] diff --git a/tests/test_tensorrt.py b/tests/test_tensorrt.py index 7752073bb..2dc7a529d 100644 --- a/tests/test_tensorrt.py +++ b/tests/test_tensorrt.py @@ -17,7 +17,9 @@ lambda: (Document(text='hello, world') for _ in range(10)), DocumentArray( [ - Document(uri='https://docarray.jina.ai/_static/favicon.png'), + Document( + uri='https://raw.githubusercontent.com/jina-ai/clip-as-service/main/docs/_static/favicon.png' + ), Document( uri=f'{os.path.dirname(os.path.abspath(__file__))}/img/00000.jpg' ), @@ -47,13 +49,15 @@ def test_docarray_inputs(make_trt_flow, inputs): 'd', [ Document( - uri='https://docarray.jina.ai/_static/favicon.png', + uri='https://raw.githubusercontent.com/jina-ai/clip-as-service/main/docs/_static/favicon.png', matches=[Document(text='hello, world'), Document(text='goodbye, world')], ), Document( text='hello, world', matches=[ - Document(uri='https://docarray.jina.ai/_static/favicon.png'), + Document( + uri='https://raw.githubusercontent.com/jina-ai/clip-as-service/main/docs/_static/favicon.png' + ), Document( uri=f'{os.path.dirname(os.path.abspath(__file__))}/img/00000.jpg' ), From 93a0aa942ebccca63f7a7f1dfdc18d7c450dcefa Mon Sep 17 00:00:00 2001 From: ZiniuYu Date: Tue, 21 Feb 2023 12:15:46 +0800 Subject: [PATCH 03/26] fix: broken test image --- tests/test_asyncio.py | 2 +- tests/test_helper.py | 16 +++++++--------- tests/test_ranker.py | 20 ++++++++++---------- tests/test_search.py | 8 ++------ tests/test_server.py | 12 ++++++------ tests/test_simple.py | 10 ++++------ tests/test_tensorrt.py | 10 +++------- 7 files changed, 33 insertions(+), 45 deletions(-) diff --git a/tests/test_asyncio.py b/tests/test_asyncio.py index 45d0e3669..67bbbd2e7 100644 --- a/tests/test_asyncio.py +++ b/tests/test_asyncio.py @@ -26,7 +26,7 @@ async def test_async_encode(make_flow): DocumentArray( [ Document( - uri='https://raw.githubusercontent.com/jina-ai/clip-as-service/main/docs/_static/favicon.png', + uri='https://clip-as-service.jina.ai/_static/favicon.png', text='hello, world', ), ] diff --git a/tests/test_helper.py b/tests/test_helper.py index 41ae76a64..3494d0583 100644 --- a/tests/test_helper.py +++ b/tests/test_helper.py @@ -32,10 +32,10 @@ def test_numpy_softmax(shape, axis): Document(text='goodbye, world'), Document( text='hello, world', - uri='https://raw.githubusercontent.com/jina-ai/clip-as-service/main/docs/_static/favicon.png', + uri='https://clip-as-service.jina.ai/_static/favicon.png', ), Document( - uri='https://raw.githubusercontent.com/jina-ai/clip-as-service/main/docs/_static/favicon.png', + uri='https://clip-as-service.jina.ai/_static/favicon.png', ), ] ), @@ -47,14 +47,14 @@ def test_numpy_softmax(shape, axis): Document(text='hello, world'), Document(tensor=np.array([0, 1, 2])), Document( - uri='https://raw.githubusercontent.com/jina-ai/clip-as-service/main/docs/_static/favicon.png' + uri='https://clip-as-service.jina.ai/_static/favicon.png' ).load_uri_to_blob(), Document( tensor=np.array([0, 1, 2]), - uri='https://raw.githubusercontent.com/jina-ai/clip-as-service/main/docs/_static/favicon.png', + uri='https://clip-as-service.jina.ai/_static/favicon.png', ), Document( - uri='https://raw.githubusercontent.com/jina-ai/clip-as-service/main/docs/_static/favicon.png', + uri='https://clip-as-service.jina.ai/_static/favicon.png', ), ] ), @@ -64,9 +64,7 @@ def test_numpy_softmax(shape, axis): DocumentArray( [ Document(text='hello, world'), - Document( - uri='https://raw.githubusercontent.com/jina-ai/clip-as-service/main/docs/_static/favicon.png' - ), + Document(uri='https://clip-as-service.jina.ai/_static/favicon.png'), ] ), (1, 1), @@ -88,7 +86,7 @@ def test_split_img_txt_da(inputs): DocumentArray( [ Document( - uri='https://raw.githubusercontent.com/jina-ai/clip-as-service/main/docs/_static/favicon.png', + uri='https://clip-as-service.jina.ai/_static/favicon.png', ).load_uri_to_blob(), ] ) diff --git a/tests/test_ranker.py b/tests/test_ranker.py index ffe682619..450f66530 100644 --- a/tests/test_ranker.py +++ b/tests/test_ranker.py @@ -68,14 +68,14 @@ async def test_torch_executor_rank_text2imgs(encoder_class): [ [ Document( - uri='https://raw.githubusercontent.com/jina-ai/clip-as-service/main/docs/_static/favicon.png', + uri='https://clip-as-service.jina.ai/_static/favicon.png', matches=[ Document(text='hello, world'), Document(text='goodbye, world'), ], ), Document( - uri='https://raw.githubusercontent.com/jina-ai/clip-as-service/main/docs/_static/favicon.png', + uri='https://clip-as-service.jina.ai/_static/favicon.png', matches=[ Document(text='hello, world'), Document(text='goodbye, world'), @@ -85,14 +85,14 @@ async def test_torch_executor_rank_text2imgs(encoder_class): DocumentArray( [ Document( - uri='https://raw.githubusercontent.com/jina-ai/clip-as-service/main/docs/_static/favicon.png', + uri='https://clip-as-service.jina.ai/_static/favicon.png', matches=[ Document(text='hello, world'), Document(text='goodbye, world'), ], ), Document( - uri='https://raw.githubusercontent.com/jina-ai/clip-as-service/main/docs/_static/favicon.png', + uri='https://clip-as-service.jina.ai/_static/favicon.png', matches=[ Document(text='hello, world'), Document(text='goodbye, world'), @@ -102,7 +102,7 @@ async def test_torch_executor_rank_text2imgs(encoder_class): ), lambda: ( Document( - uri='https://raw.githubusercontent.com/jina-ai/clip-as-service/main/docs/_static/favicon.png', + uri='https://clip-as-service.jina.ai/_static/favicon.png', matches=[ Document(text='hello, world'), Document(text='goodbye, world'), @@ -116,7 +116,7 @@ async def test_torch_executor_rank_text2imgs(encoder_class): text='hello, world', matches=[ Document( - uri='https://raw.githubusercontent.com/jina-ai/clip-as-service/main/docs/_static/favicon.png' + uri='https://clip-as-service.jina.ai/_static/favicon.png' ), Document( uri=f'{os.path.dirname(os.path.abspath(__file__))}/img/00000.jpg' @@ -146,7 +146,7 @@ def test_docarray_inputs(make_flow, inputs): [ [ Document( - uri='https://raw.githubusercontent.com/jina-ai/clip-as-service/main/docs/_static/favicon.png', + uri='https://clip-as-service.jina.ai/_static/favicon.png', matches=[ Document(text='hello, world'), Document(text='goodbye, world'), @@ -156,7 +156,7 @@ def test_docarray_inputs(make_flow, inputs): DocumentArray( [ Document( - uri='https://raw.githubusercontent.com/jina-ai/clip-as-service/main/docs/_static/favicon.png', + uri='https://clip-as-service.jina.ai/_static/favicon.png', matches=[ Document(text='hello, world'), Document(text='goodbye, world'), @@ -166,7 +166,7 @@ def test_docarray_inputs(make_flow, inputs): ), lambda: ( Document( - uri='https://raw.githubusercontent.com/jina-ai/clip-as-service/main/docs/_static/favicon.png', + uri='https://clip-as-service.jina.ai/_static/favicon.png', matches=[ Document(text='hello, world'), Document(text='goodbye, world'), @@ -180,7 +180,7 @@ def test_docarray_inputs(make_flow, inputs): text='hello, world', matches=[ Document( - uri='https://raw.githubusercontent.com/jina-ai/clip-as-service/main/docs/_static/favicon.png' + uri='https://clip-as-service.jina.ai/_static/favicon.png' ), Document( uri=f'{os.path.dirname(os.path.abspath(__file__))}/img/00000.jpg' diff --git a/tests/test_search.py b/tests/test_search.py index f9a32128b..b9645e96e 100644 --- a/tests/test_search.py +++ b/tests/test_search.py @@ -15,9 +15,7 @@ lambda: (Document(text='hello, world') for _ in range(10)), DocumentArray( [ - Document( - uri='https://raw.githubusercontent.com/jina-ai/clip-as-service/main/docs/_static/favicon.png' - ), + Document(uri='https://clip-as-service.jina.ai/_static/favicon.png'), Document( uri=f'{os.path.dirname(os.path.abspath(__file__))}/img/00000.jpg' ), @@ -54,9 +52,7 @@ def test_index_search(make_search_flow, inputs, limit): lambda: (Document(text='hello, world') for _ in range(10)), DocumentArray( [ - Document( - uri='https://raw.githubusercontent.com/jina-ai/clip-as-service/main/docs/_static/favicon.png' - ), + Document(uri='https://clip-as-service.jina.ai/_static/favicon.png'), Document( uri=f'{os.path.dirname(os.path.abspath(__file__))}/img/00000.jpg' ), diff --git a/tests/test_server.py b/tests/test_server.py index 66144566e..d073c0b65 100644 --- a/tests/test_server.py +++ b/tests/test_server.py @@ -10,7 +10,7 @@ def test_server_download(tmpdir): download_model( - url='https://raw.githubusercontent.com/jina-ai/clip-as-service/main/docs/_static/favicon.png', + url='https://clip-as-service.jina.ai/_static/favicon.png', target_folder=tmpdir, md5sum='66ea4817d73514888dcf6c7d2b00016d', with_resume=False, @@ -27,7 +27,7 @@ def test_server_download(tmpdir): os.remove(target_path) download_model( - url='https://raw.githubusercontent.com/jina-ai/clip-as-service/main/docs/_static/favicon.png', + url='https://clip-as-service.jina.ai/_static/favicon.png', target_folder=tmpdir, md5sum='66ea4817d73514888dcf6c7d2b00016d', with_resume=True, @@ -40,7 +40,7 @@ def test_server_download(tmpdir): def test_server_download_md5(tmpdir, md5): if md5 != 'ABC': download_model( - url='https://raw.githubusercontent.com/jina-ai/clip-as-service/main/docs/_static/favicon.png', + url='https://clip-as-service.jina.ai/_static/favicon.png', target_folder=tmpdir, md5sum=md5, with_resume=False, @@ -48,7 +48,7 @@ def test_server_download_md5(tmpdir, md5): else: with pytest.raises(Exception): download_model( - url='https://raw.githubusercontent.com/jina-ai/clip-as-service/main/docs/_static/favicon.png', + url='https://clip-as-service.jina.ai/_static/favicon.png', target_folder=tmpdir, md5sum=md5, with_resume=False, @@ -58,7 +58,7 @@ def test_server_download_md5(tmpdir, md5): def test_server_download_not_regular_file(tmpdir): with pytest.raises(Exception): download_model( - url='https://raw.githubusercontent.com/jina-ai/clip-as-service/main/docs/_static/favicon.png', + url='https://clip-as-service.jina.ai/_static/favicon.png', target_folder=tmpdir, md5sum='', with_resume=False, @@ -87,7 +87,7 @@ def test_make_onnx_flow_wrong_name_path(): 'image_uri', [ f'{os.path.dirname(os.path.abspath(__file__))}/img/00000.jpg', - 'https://raw.githubusercontent.com/jina-ai/clip-as-service/main/docs/_static/favicon.png', + 'https://clip-as-service.jina.ai/_static/favicon.png', ], ) @pytest.mark.parametrize('size', [224, 288, 384, 448]) diff --git a/tests/test_simple.py b/tests/test_simple.py index 24f874b2e..8dab51322 100644 --- a/tests/test_simple.py +++ b/tests/test_simple.py @@ -35,7 +35,7 @@ def test_protocols(port_generator, protocol, jit, pytestconfig): ('hello, world', 'goodbye, world'), lambda: ('hello, world' for _ in range(10)), [ - 'https://raw.githubusercontent.com/jina-ai/clip-as-service/main/docs/_static/favicon.png', + 'https://clip-as-service.jina.ai/_static/favicon.png', f'{os.path.dirname(os.path.abspath(__file__))}/img/00000.jpg', 'hello, world', ], @@ -58,9 +58,7 @@ def test_plain_inputs(make_flow, inputs): lambda: (Document(text='hello, world') for _ in range(10)), DocumentArray( [ - Document( - uri='https://raw.githubusercontent.com/jina-ai/clip-as-service/main/docs/_static/favicon.png' - ), + Document(uri='https://clip-as-service.jina.ai/_static/favicon.png'), Document( uri=f'{os.path.dirname(os.path.abspath(__file__))}/img/00000.jpg' ), @@ -92,7 +90,7 @@ def test_docarray_inputs(make_flow, inputs): DocumentArray( [ Document( - uri='https://raw.githubusercontent.com/jina-ai/clip-as-service/main/docs/_static/favicon.png', + uri='https://clip-as-service.jina.ai/_static/favicon.png', text='hello, world', ), ] @@ -119,7 +117,7 @@ def test_docarray_preserve_original_inputs(make_flow, inputs): DocumentArray( [ Document( - uri='https://raw.githubusercontent.com/jina-ai/clip-as-service/main/docs/_static/favicon.png', + uri='https://clip-as-service.jina.ai/_static/favicon.png', text='hello, world', ), ] diff --git a/tests/test_tensorrt.py b/tests/test_tensorrt.py index 2dc7a529d..395413f0e 100644 --- a/tests/test_tensorrt.py +++ b/tests/test_tensorrt.py @@ -17,9 +17,7 @@ lambda: (Document(text='hello, world') for _ in range(10)), DocumentArray( [ - Document( - uri='https://raw.githubusercontent.com/jina-ai/clip-as-service/main/docs/_static/favicon.png' - ), + Document(uri='https://clip-as-service.jina.ai/_static/favicon.png'), Document( uri=f'{os.path.dirname(os.path.abspath(__file__))}/img/00000.jpg' ), @@ -49,15 +47,13 @@ def test_docarray_inputs(make_trt_flow, inputs): 'd', [ Document( - uri='https://raw.githubusercontent.com/jina-ai/clip-as-service/main/docs/_static/favicon.png', + uri='https://clip-as-service.jina.ai/_static/favicon.png', matches=[Document(text='hello, world'), Document(text='goodbye, world')], ), Document( text='hello, world', matches=[ - Document( - uri='https://raw.githubusercontent.com/jina-ai/clip-as-service/main/docs/_static/favicon.png' - ), + Document(uri='https://clip-as-service.jina.ai/_static/favicon.png'), Document( uri=f'{os.path.dirname(os.path.abspath(__file__))}/img/00000.jpg' ), From 43666018af27f30f2d9a5f88d621c5233db0fdcc Mon Sep 17 00:00:00 2001 From: ZiniuYu Date: Tue, 21 Feb 2023 12:24:49 +0800 Subject: [PATCH 04/26] fix: broken test image --- tests/test_server.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/test_server.py b/tests/test_server.py index d073c0b65..81d6b6c95 100644 --- a/tests/test_server.py +++ b/tests/test_server.py @@ -36,7 +36,7 @@ def test_server_download(tmpdir): assert not os.path.exists(part_path) -@pytest.mark.parametrize('md5', ['ABC', None, '66ea4817d73514888dcf6c7d2b00016d']) +@pytest.mark.parametrize('md5', ['ABC', None, '43104e468ddd23c55bc662d84c87a7f8']) def test_server_download_md5(tmpdir, md5): if md5 != 'ABC': download_model( From 6ab6c113af21306d973f1b0dbd312c3b8fd56462 Mon Sep 17 00:00:00 2001 From: ZiniuYu Date: Tue, 21 Feb 2023 12:31:29 +0800 Subject: [PATCH 05/26] fix: broken test image --- tests/test_server.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tests/test_server.py b/tests/test_server.py index 81d6b6c95..56efa742f 100644 --- a/tests/test_server.py +++ b/tests/test_server.py @@ -12,7 +12,7 @@ def test_server_download(tmpdir): download_model( url='https://clip-as-service.jina.ai/_static/favicon.png', target_folder=tmpdir, - md5sum='66ea4817d73514888dcf6c7d2b00016d', + md5sum='43104e468ddd23c55bc662d84c87a7f8', with_resume=False, ) target_path = os.path.join(tmpdir, 'favicon.png') @@ -29,7 +29,7 @@ def test_server_download(tmpdir): download_model( url='https://clip-as-service.jina.ai/_static/favicon.png', target_folder=tmpdir, - md5sum='66ea4817d73514888dcf6c7d2b00016d', + md5sum='43104e468ddd23c55bc662d84c87a7f8', with_resume=True, ) assert os.path.getsize(target_path) == file_size From fb0528329a4f0cc80365f20821f071b29594a806 Mon Sep 17 00:00:00 2001 From: ZiniuYu Date: Tue, 21 Feb 2023 13:53:59 +0800 Subject: [PATCH 06/26] fix: revert --- server/setup.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/server/setup.py b/server/setup.py index 246323785..8ec24ba68 100644 --- a/server/setup.py +++ b/server/setup.py @@ -53,8 +53,9 @@ 'onnx': [ 'onnx', 'onnxmltools', + 'onnxruntime', ] - + (['onnxruntime-gpu>=1.8.0'] if sys.platform != 'darwin' else ['onnxruntime']), + + (['onnxruntime-gpu>=1.8.0'] if sys.platform != 'darwin' else []), 'tensorrt': ['nvidia-tensorrt'], 'transformers': ['transformers>=4.16.2'], 'search': ['annlite>=0.3.10'], From 1fff6f55621902b3e75f5a480da3dfcc404f333e Mon Sep 17 00:00:00 2001 From: ZiniuYu Date: Tue, 21 Feb 2023 14:16:54 +0800 Subject: [PATCH 07/26] fix: re-revert --- server/setup.py | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/server/setup.py b/server/setup.py index 8ec24ba68..246323785 100644 --- a/server/setup.py +++ b/server/setup.py @@ -53,9 +53,8 @@ 'onnx': [ 'onnx', 'onnxmltools', - 'onnxruntime', ] - + (['onnxruntime-gpu>=1.8.0'] if sys.platform != 'darwin' else []), + + (['onnxruntime-gpu>=1.8.0'] if sys.platform != 'darwin' else ['onnxruntime']), 'tensorrt': ['nvidia-tensorrt'], 'transformers': ['transformers>=4.16.2'], 'search': ['annlite>=0.3.10'], From c37403f043117559889ffadc5425ab5826178c96 Mon Sep 17 00:00:00 2001 From: ZiniuYu Date: Tue, 21 Feb 2023 17:40:18 +0800 Subject: [PATCH 08/26] fix: fix onnxruntime version --- server/setup.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/server/setup.py b/server/setup.py index 246323785..8ea0258ea 100644 --- a/server/setup.py +++ b/server/setup.py @@ -54,7 +54,11 @@ 'onnx', 'onnxmltools', ] - + (['onnxruntime-gpu>=1.8.0'] if sys.platform != 'darwin' else ['onnxruntime']), + + ( + ['onnxruntime-gpu==1.13.1'] + if sys.platform != 'darwin' + else ['onnxruntime==1.13.1'] + ), 'tensorrt': ['nvidia-tensorrt'], 'transformers': ['transformers>=4.16.2'], 'search': ['annlite>=0.3.10'], From 2db7a7ffc113958417defd6395b225e3fb9a3fb2 Mon Sep 17 00:00:00 2001 From: ZiniuYu Date: Tue, 21 Feb 2023 18:08:40 +0800 Subject: [PATCH 09/26] fix: revert again --- server/setup.py | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/server/setup.py b/server/setup.py index 8ea0258ea..c0226b14b 100644 --- a/server/setup.py +++ b/server/setup.py @@ -53,12 +53,13 @@ 'onnx': [ 'onnx', 'onnxmltools', - ] - + ( - ['onnxruntime-gpu==1.13.1'] - if sys.platform != 'darwin' - else ['onnxruntime==1.13.1'] - ), + 'onnxruntime==1.13.1', + ], + # + ( + # ['onnxruntime-gpu==1.13.1'] + # if sys.platform != 'darwin' + # else ['onnxruntime==1.13.1'] + # ), 'tensorrt': ['nvidia-tensorrt'], 'transformers': ['transformers>=4.16.2'], 'search': ['annlite>=0.3.10'], From 704e493b69c2c5cfcde36af2f2f8fbdeaa48a7a9 Mon Sep 17 00:00:00 2001 From: ZiniuYu Date: Tue, 21 Feb 2023 18:53:37 +0800 Subject: [PATCH 10/26] fix: test --- .github/workflows/ci.yml | 57 +++++++++++++++++++++++++++++++++++++--- server/setup.py | 15 +++++------ 2 files changed, 61 insertions(+), 11 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 38d773dc0..20ad1a9eb 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -136,7 +136,7 @@ jobs: fail_ci_if_error: false token: ${{ secrets.CODECOV_TOKEN }} # not required for public repos - gpu-test: + trt-gpu-test: needs: prep-testbed runs-on: [self-hosted, x64, gpu, linux] strategy: @@ -158,7 +158,6 @@ jobs: python -m pip install wheel pytest pytest-cov nvidia-pyindex pip install -e "client/[test]" pip install -e "server/[tensorrt]" - pip install -e "server/[onnx]" pip install -e "server/[transformers]" { pip install -e "server/[flash-attn]" @@ -173,6 +172,58 @@ jobs: -v -s -m "gpu" ./tests/test_tensorrt.py pytest --suppress-no-test-exit-code --cov=clip_client --cov=clip_server --cov-report=xml \ -v -s -m "gpu" ./tests/test_simple.py + echo "::set-output name=codecov_flag::cas" + timeout-minutes: 30 + env: + # fix re-initialized torch runtime error on cuda device + JINA_MP_START_METHOD: spawn + - name: Check codecov file + id: check_files + uses: andstor/file-existence-action@v1 + with: + files: "coverage.xml" + - name: Upload coverage from test to Codecov + uses: codecov/codecov-action@v3 + if: steps.check_files.outputs.files_exists == 'true' && ${{ matrix.python-version }} == '3.7' + with: + file: coverage.xml + name: gpu-related-codecov + flags: ${{ steps.test.outputs.codecov_flag }} + fail_ci_if_error: false + token: ${{ secrets.CODECOV_TOKEN }} # not required for public repos + + gpu-model-test: + needs: prep-testbed + runs-on: [ self-hosted, x64, gpu, linux ] + strategy: + fail-fast: false + matrix: + python-version: [ 3.7 ] + steps: + - uses: actions/checkout@v2 + with: + # For coverage builds fetch the whole history + fetch-depth: 0 + - name: Set up Python ${{ matrix.python-version }} + uses: actions/setup-python@v2 + with: + python-version: ${{ matrix.python-version }} + - name: Prepare enviroment + run: | + python -m pip install --upgrade pip + python -m pip install wheel pytest pytest-cov nvidia-pyindex + pip install -e "client/[test]" + pip install -e "server/[onnx]" + pip install -e "server/[transformers]" + { + pip install -e "server/[flash-attn]" + } || { + echo "flash attention was not installed." + } + pip install --no-cache-dir "server/[cn_clip]" + - name: Test + id: test + run: | pytest --suppress-no-test-exit-code --cov=clip_client --cov=clip_server --cov-report=xml \ -v -s -m "gpu" ./tests/test_model.py echo "::set-output name=codecov_flag::cas" @@ -197,7 +248,7 @@ jobs: # just for blocking the merge until all parallel core-test are successful success-all-test: - needs: [commit-lint, core-test, gpu-test] + needs: [commit-lint, core-test, trt-gpu-test, gpu-model-test] if: always() runs-on: ubuntu-latest steps: diff --git a/server/setup.py b/server/setup.py index c0226b14b..48c725263 100644 --- a/server/setup.py +++ b/server/setup.py @@ -53,14 +53,13 @@ 'onnx': [ 'onnx', 'onnxmltools', - 'onnxruntime==1.13.1', - ], - # + ( - # ['onnxruntime-gpu==1.13.1'] - # if sys.platform != 'darwin' - # else ['onnxruntime==1.13.1'] - # ), - 'tensorrt': ['nvidia-tensorrt'], + ] + + ( + ['onnxruntime-gpu==1.13.1'] + if sys.platform != 'darwin' + else ['onnxruntime==1.13.1'] + ), + 'tensorrt': ['onnx', 'onnxmltools', 'onnxruntime==1.13.1', 'nvidia-tensorrt'], 'transformers': ['transformers>=4.16.2'], 'search': ['annlite>=0.3.10'], 'flash-attn': ['flash-attn'], From ba3d229e0fea66345002b992e02626fc15f876d7 Mon Sep 17 00:00:00 2001 From: ZiniuYu Date: Tue, 21 Feb 2023 19:18:43 +0800 Subject: [PATCH 11/26] fix: test --- server/setup.py | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/server/setup.py b/server/setup.py index 48c725263..20585ac9c 100644 --- a/server/setup.py +++ b/server/setup.py @@ -59,7 +59,12 @@ if sys.platform != 'darwin' else ['onnxruntime==1.13.1'] ), - 'tensorrt': ['onnx', 'onnxmltools', 'onnxruntime==1.13.1', 'nvidia-tensorrt'], + 'tensorrt': [ + 'onnx', + 'onnxmltools', + 'onnxruntime-gpu==1.13.1', + 'nvidia-tensorrt', + ], 'transformers': ['transformers>=4.16.2'], 'search': ['annlite>=0.3.10'], 'flash-attn': ['flash-attn'], From 6be9fd51d8c3db4ca43487f5aff163f0714e8b83 Mon Sep 17 00:00:00 2001 From: ZiniuYu Date: Tue, 21 Feb 2023 19:29:02 +0800 Subject: [PATCH 12/26] fix: trt ci --- server/setup.py | 1 + 1 file changed, 1 insertion(+) diff --git a/server/setup.py b/server/setup.py index 20585ac9c..3ed1ddcff 100644 --- a/server/setup.py +++ b/server/setup.py @@ -62,6 +62,7 @@ 'tensorrt': [ 'onnx', 'onnxmltools', + 'onnxruntime==1.13.1', 'onnxruntime-gpu==1.13.1', 'nvidia-tensorrt', ], From 096450d9a4dcbdb99a3836c41a26cac50ad904b3 Mon Sep 17 00:00:00 2001 From: ZiniuYu Date: Tue, 21 Feb 2023 19:48:46 +0800 Subject: [PATCH 13/26] fix: trt ci --- server/setup.py | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/server/setup.py b/server/setup.py index 3ed1ddcff..c0d1fd3d3 100644 --- a/server/setup.py +++ b/server/setup.py @@ -60,11 +60,10 @@ else ['onnxruntime==1.13.1'] ), 'tensorrt': [ + 'nvidia-tensorrt', + 'onnxruntime==1.13.1', 'onnx', 'onnxmltools', - 'onnxruntime==1.13.1', - 'onnxruntime-gpu==1.13.1', - 'nvidia-tensorrt', ], 'transformers': ['transformers>=4.16.2'], 'search': ['annlite>=0.3.10'], From 0cf8cc933ac78d531cd0a4fd3446ffdefb415e83 Mon Sep 17 00:00:00 2001 From: ZiniuYu Date: Wed, 22 Feb 2023 12:26:13 +0800 Subject: [PATCH 14/26] fix: trt ci --- .github/workflows/ci.yml | 1 + server/setup.py | 6 +++--- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 20ad1a9eb..ab7d9b26c 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -158,6 +158,7 @@ jobs: python -m pip install wheel pytest pytest-cov nvidia-pyindex pip install -e "client/[test]" pip install -e "server/[tensorrt]" + pip install -e "server/[onnx]" pip install -e "server/[transformers]" { pip install -e "server/[flash-attn]" diff --git a/server/setup.py b/server/setup.py index c0d1fd3d3..0e6bd8683 100644 --- a/server/setup.py +++ b/server/setup.py @@ -61,9 +61,9 @@ ), 'tensorrt': [ 'nvidia-tensorrt', - 'onnxruntime==1.13.1', - 'onnx', - 'onnxmltools', + # 'onnxruntime==1.13.1', + # 'onnx', + # 'onnxmltools', ], 'transformers': ['transformers>=4.16.2'], 'search': ['annlite>=0.3.10'], From a4d7e05b311a719229ca4847a7bbe3074c1ca27c Mon Sep 17 00:00:00 2001 From: ZiniuYu Date: Wed, 22 Feb 2023 12:43:41 +0800 Subject: [PATCH 15/26] fix: trt ci --- server/setup.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/server/setup.py b/server/setup.py index 0e6bd8683..b85bacb71 100644 --- a/server/setup.py +++ b/server/setup.py @@ -61,7 +61,7 @@ ), 'tensorrt': [ 'nvidia-tensorrt', - # 'onnxruntime==1.13.1', + 'onnxruntime==1.13.1', # 'onnx', # 'onnxmltools', ], From 54bd2866bad2f1c60ece15a2c4cb3046354bcd5e Mon Sep 17 00:00:00 2001 From: ZiniuYu Date: Wed, 22 Feb 2023 13:23:43 +0800 Subject: [PATCH 16/26] fix: trt ci --- server/setup.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/server/setup.py b/server/setup.py index b85bacb71..70e351f29 100644 --- a/server/setup.py +++ b/server/setup.py @@ -53,15 +53,16 @@ 'onnx': [ 'onnx', 'onnxmltools', + 'onnxruntime==1.13.1', ] + ( ['onnxruntime-gpu==1.13.1'] if sys.platform != 'darwin' - else ['onnxruntime==1.13.1'] + else [] ), 'tensorrt': [ 'nvidia-tensorrt', - 'onnxruntime==1.13.1', + # 'onnxruntime==1.13.1', # 'onnx', # 'onnxmltools', ], From 393f17adccf31bc9742277f92f79cb8044516002 Mon Sep 17 00:00:00 2001 From: ZiniuYu Date: Wed, 22 Feb 2023 13:25:45 +0800 Subject: [PATCH 17/26] fix: trt ci --- server/setup.py | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/server/setup.py b/server/setup.py index 70e351f29..03f85dc08 100644 --- a/server/setup.py +++ b/server/setup.py @@ -55,11 +55,7 @@ 'onnxmltools', 'onnxruntime==1.13.1', ] - + ( - ['onnxruntime-gpu==1.13.1'] - if sys.platform != 'darwin' - else [] - ), + + (['onnxruntime-gpu==1.13.1'] if sys.platform != 'darwin' else []), 'tensorrt': [ 'nvidia-tensorrt', # 'onnxruntime==1.13.1', From 169a36fbdd015bf39ed9dcec6c3d7296e6383af8 Mon Sep 17 00:00:00 2001 From: ZiniuYu Date: Wed, 22 Feb 2023 13:41:29 +0800 Subject: [PATCH 18/26] fix: trt ci --- server/setup.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/server/setup.py b/server/setup.py index 03f85dc08..70f3c788c 100644 --- a/server/setup.py +++ b/server/setup.py @@ -51,9 +51,9 @@ ], extras_require={ 'onnx': [ + 'onnxruntime==1.13.1', 'onnx', 'onnxmltools', - 'onnxruntime==1.13.1', ] + (['onnxruntime-gpu==1.13.1'] if sys.platform != 'darwin' else []), 'tensorrt': [ From 0c60d603a7235d0174ca407aa530afa23ed9279f Mon Sep 17 00:00:00 2001 From: ZiniuYu Date: Wed, 22 Feb 2023 14:58:30 +0800 Subject: [PATCH 19/26] fix: trt ci --- server/setup.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/server/setup.py b/server/setup.py index 70f3c788c..08aca4384 100644 --- a/server/setup.py +++ b/server/setup.py @@ -51,11 +51,11 @@ ], extras_require={ 'onnx': [ - 'onnxruntime==1.13.1', 'onnx', 'onnxmltools', - ] - + (['onnxruntime-gpu==1.13.1'] if sys.platform != 'darwin' else []), + 'onnxruntime==1.13.1', + ], + # + (['onnxruntime-gpu==1.13.1'] if sys.platform != 'darwin' else []), 'tensorrt': [ 'nvidia-tensorrt', # 'onnxruntime==1.13.1', From db3473b7cfabe5d54939ae1e04e1b4e720cf452a Mon Sep 17 00:00:00 2001 From: ZiniuYu Date: Wed, 22 Feb 2023 15:14:09 +0800 Subject: [PATCH 20/26] fix: trt ci --- server/setup.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/server/setup.py b/server/setup.py index 08aca4384..4573e6baf 100644 --- a/server/setup.py +++ b/server/setup.py @@ -57,7 +57,7 @@ ], # + (['onnxruntime-gpu==1.13.1'] if sys.platform != 'darwin' else []), 'tensorrt': [ - 'nvidia-tensorrt', + 'nvidia-tensorrt==8.4.1.5', # 'onnxruntime==1.13.1', # 'onnx', # 'onnxmltools', From cf41768fd47b7060a1b07660d6cba1c843fe3bdb Mon Sep 17 00:00:00 2001 From: ZiniuYu Date: Wed, 22 Feb 2023 15:42:50 +0800 Subject: [PATCH 21/26] fix: trt ci --- server/setup.py | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/server/setup.py b/server/setup.py index 4573e6baf..2586d32bc 100644 --- a/server/setup.py +++ b/server/setup.py @@ -53,9 +53,13 @@ 'onnx': [ 'onnx', 'onnxmltools', - 'onnxruntime==1.13.1', - ], - # + (['onnxruntime-gpu==1.13.1'] if sys.platform != 'darwin' else []), + # 'onnxruntime==1.13.1', + ] + + ( + ['onnxruntime-gpu==1.13.1'] + if sys.platform != 'darwin' + else ['onnxruntime==1.13.1'] + ), 'tensorrt': [ 'nvidia-tensorrt==8.4.1.5', # 'onnxruntime==1.13.1', From dcf4f30a64735e5221146548d4cfcc2e28b585ad Mon Sep 17 00:00:00 2001 From: ZiniuYu Date: Wed, 22 Feb 2023 15:59:15 +0800 Subject: [PATCH 22/26] fix: trt ci --- server/setup.py | 4 ---- 1 file changed, 4 deletions(-) diff --git a/server/setup.py b/server/setup.py index 2586d32bc..315ce27e3 100644 --- a/server/setup.py +++ b/server/setup.py @@ -53,7 +53,6 @@ 'onnx': [ 'onnx', 'onnxmltools', - # 'onnxruntime==1.13.1', ] + ( ['onnxruntime-gpu==1.13.1'] @@ -62,9 +61,6 @@ ), 'tensorrt': [ 'nvidia-tensorrt==8.4.1.5', - # 'onnxruntime==1.13.1', - # 'onnx', - # 'onnxmltools', ], 'transformers': ['transformers>=4.16.2'], 'search': ['annlite>=0.3.10'], From be8f83e90b7465970776c51377629cb74122dde0 Mon Sep 17 00:00:00 2001 From: ZiniuYu Date: Wed, 22 Feb 2023 15:59:52 +0800 Subject: [PATCH 23/26] fix: onnx version --- server/setup.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/server/setup.py b/server/setup.py index 315ce27e3..b59f8b6a1 100644 --- a/server/setup.py +++ b/server/setup.py @@ -55,9 +55,9 @@ 'onnxmltools', ] + ( - ['onnxruntime-gpu==1.13.1'] + ['onnxruntime-gpu<=1.13.1'] if sys.platform != 'darwin' - else ['onnxruntime==1.13.1'] + else ['onnxruntime<=1.13.1'] ), 'tensorrt': [ 'nvidia-tensorrt==8.4.1.5', From ca1274aee1b6baf0bd6b264769c43119a17a3f93 Mon Sep 17 00:00:00 2001 From: ZiniuYu Date: Wed, 22 Feb 2023 16:31:42 +0800 Subject: [PATCH 24/26] fix: onnx version --- server/setup.py | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/server/setup.py b/server/setup.py index b59f8b6a1..1f7d81d29 100644 --- a/server/setup.py +++ b/server/setup.py @@ -54,11 +54,7 @@ 'onnx', 'onnxmltools', ] - + ( - ['onnxruntime-gpu<=1.13.1'] - if sys.platform != 'darwin' - else ['onnxruntime<=1.13.1'] - ), + + (['onnxruntime-gpu'] if sys.platform != 'darwin' else ['onnxruntime']), 'tensorrt': [ 'nvidia-tensorrt==8.4.1.5', ], From bcd824c496df2eade6f522a48d20e77c22a94f4c Mon Sep 17 00:00:00 2001 From: ZiniuYu Date: Wed, 22 Feb 2023 17:08:34 +0800 Subject: [PATCH 25/26] fix: onnx version --- server/setup.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/server/setup.py b/server/setup.py index 1f7d81d29..b59f8b6a1 100644 --- a/server/setup.py +++ b/server/setup.py @@ -54,7 +54,11 @@ 'onnx', 'onnxmltools', ] - + (['onnxruntime-gpu'] if sys.platform != 'darwin' else ['onnxruntime']), + + ( + ['onnxruntime-gpu<=1.13.1'] + if sys.platform != 'darwin' + else ['onnxruntime<=1.13.1'] + ), 'tensorrt': [ 'nvidia-tensorrt==8.4.1.5', ], From f029cb2aa536b18a86753fd9aaabd20b5eb399fb Mon Sep 17 00:00:00 2001 From: ZiniuYu Date: Wed, 22 Feb 2023 17:53:38 +0800 Subject: [PATCH 26/26] docs: update docker usage --- docs/user-guides/server.md | 26 +++++++++++++++++++++++++- 1 file changed, 25 insertions(+), 1 deletion(-) diff --git a/docs/user-guides/server.md b/docs/user-guides/server.md index ec0384d9a..4a1d5a574 100644 --- a/docs/user-guides/server.md +++ b/docs/user-guides/server.md @@ -591,9 +591,21 @@ The build argument `--build-arg GROUP_ID=$(id -g ${USER}) --build-arg USER_ID=$( ### Run +````{tab} PyTorch ```bash docker run -p 51009:51000 -v $HOME/.cache:/home/cas/.cache --gpus all jinaai/clip-server ``` +```` +````{tab} ONNX +```bash +docker run -p 51009:51000 -v $HOME/.cache:/home/cas/.cache --gpus all jinaai/clip-server:master-onnx onnx-flow.yml +``` +```` +````{tab} TensorRT +```bash +docker run -p 51009:51000 -v $HOME/.cache:/home/cas/.cache --gpus all jinaai/clip-server:master-tensorrt tensorrt-flow.yml +``` +```` Here, `51009` is the public port on the host and `51000` is the {ref}`in-container port defined inside YAML`. The argument `-v $HOME/.cache:/home/cas/.cache` leverages host's cache and prevents you to download the same model next time on start. @@ -601,11 +613,23 @@ Due to the limitation of the terminal inside Docker container, you will **not** To pass a YAML config from the host, one can do: +````{tab} PyTorch ```bash cat my.yml | docker run -i -p 51009:51000 -v $HOME/.cache:/home/cas/.cache --gpus all jinaai/clip-server -i ``` +```` +````{tab} ONNX +```bash +cat my.yml | docker run -i -p 51009:51000 -v $HOME/.cache:/home/cas/.cache --gpus all jinaai/clip-server:master-onnx -i +``` +```` +````{tab} TensorRT +```bash +cat my.yml | docker run -i -p 51009:51000 -v $HOME/.cache:/home/cas/.cache --gpus all jinaai/clip-server:master-tensorrt -i +``` +```` -The CLI usage is the same {ref}`as described here `. +The CLI usage is the same {ref}`as described here `. ```{tip} You can enable debug logging via: `docker run --env JINA_LOG_LEVEL=debug ...`