8000 feat: update example models for better running versions by maximilianwerk · Pull Request #2561 · jina-ai/serve · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

feat: update example models for better running versions #2561

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 2 commits into from
Jun 4, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 15 additions & 5 deletions .github/pages/hello-world.md
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,9 @@ docker run -v "$(pwd)/j:/j" jinaai/jina hello fashion --workdir /j && open j/hel


</details>
This downloads the Fashion-MNIST training and test dataset and tells Jina to index 60,000 images from the training set. Then it randomly samples images from the test set as queries and asks Jina to retrieve relevant results. The whole process takes about 1 minute.
This downloads the Fashion-MNIST training and test dataset and tells Jina to index 60,000 images from the training set.
Then it randomly samples images from the test set as queries and asks Jina to retrieve relevant results.
The whole process takes about 1 minute.


## 🤖 Covid-19 Chatbot
Expand All @@ -40,14 +42,17 @@ This downloads the Fashion-MNIST training and test dataset and tells Jina to ind
<img align="right" width="25%" src="https://github.com/jina-ai/jina/blob/master/.github/images/helloworld-chatbot.gif?raw=true" />
</a>

For NLP engineers, we provide a simple chatbot demo for answering Covid-19 questions. To run that:
For NLP engineers, we provide a simple chatbot demo for answering Covid-19 questions.
To run that:
```bash
pip install --pre "jina[chatbot]"

jina hello chatbot
```

This downloads [CovidQA dataset](https://www.kaggle.com/xhlulu/covidqa) and tells Jina to index 418 question-answer pairs with DistilBERT. The index process takes about 1 minute on CPU. Then it opens a web page where you can input questions and ask Jina.
This downloads [CovidQA dataset](https://www.kaggle.com/xhlulu/covidqa) and tells Jina to index 418 question-answer pairs with MPNet.
The index process takes about 1 minute on CPU.
Then it opens a web page where you can input questions and ask Jina.

<br><br><br><br>

Expand All @@ -57,11 +62,16 @@ This downloads [CovidQA dataset](https://www.kaggle.com/xhlulu/covidqa) and tell
<img align="right" width="25%" src="https://github.com/jina-ai/jina/blob/master/.github/images/helloworld-multimodal.gif?raw=true" />
</a>

A multimodal-document contains multiple data types, e.g. a PDF document often contains figures and text. Jina lets you build a multimodal search solution in just minutes. To run our minimum multimodal document search demo:
A multimodal-document contains multiple data types, e.g. a PDF document often contains figures and text.
Jina lets you build a multimodal search solution in just minutes.
To run our minimum multimodal document search demo:
```bash
pip install --pre "jina[multimodal]"

jina hello multimodal
```

This downloads [people image dataset](https://www.kaggle.com/ahmadahmadzada/images2000) and tells Jina to index 2,000 image-caption pairs with MobileNet and DistilBERT. The index process takes about 3 minute on CPU. Then it opens a web page where you can query multimodal documents. We have prepared [a YouTube tutorial](https://youtu.be/B_nH8GCmBfc) to walk you through this demo.
This downloads [people image dataset](https://www.kaggle.com/ahmadahmadzada/images2000) and tells Jina to index 2,000 image-caption pairs with MobileNet and MPNet.
The index process takes about 3 minute on CPU.
Then it opens a web page where you can query multimodal documents.
We have prepared [a YouTube tutorial](https://youtu.be/B_nH8GCmBfc) to walk you through this demo.
2 changes: 1 addition & 1 deletion jina/helloworld/chatbot/executors.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ class MyTransformer(Executor):

def __init__(
self,
pretrained_model_name_or_path: str = 'sentence-transformers/distilbert-base-nli-stsb-mean-tokens',
pretrained_model_name_or_path: str = 'sentence-transformers/paraphrase-mpnet-base-v2',
base_tokenizer_model: Optional[str] = None,
pooling_strategy: str = 'mean',
layer_index: int = -1,
Expand Down
2 changes: 1 addition & 1 deletion jina/helloworld/multimodal/executors.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ class TextEncoder(Executor):

def __init__(
self,
pretrained_model_name_or_path: str = 'sentence-transformers/distilbert-base-nli-stsb-mean-tokens',
pretrained_model_name_or_path: str = 'sentence-transformers/paraphrase-mpnet-base-v2',
base_tokenizer_model: Optional[str] = None,
pooling_strategy: str = 'mean',
layer_index: int = -1,
Expand Down
4 changes: 3 additions & 1 deletion tests/system/chatbot/test_chatbot.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ def post_uri():

@pytest.fixture
def expected_result():
return '''no evidence from the outbreak that eating garlic, sipping water every 15 minutes or taking vitamin C will protect people from the new coronavirus.'''
return '''It's not completely up to you.'''


@pytest.fixture(autouse=True)
Expand All @@ -43,4 +43,6 @@ def test_chatbot(payload, post_uri, expected_result):
"""Regression test for chatbot example."""
resp = requests.post(post_uri, json=payload)
assert resp.status_code == 200
print('-------------------------1111111----')
print(resp.text)
assert expected_result in resp.text
0