Showing preview only (630K chars total). Download the full file or copy to clipboard to get everything.
Repository: jina-ai/clip-as-service
Branch: main
Commit: 03410570d439
Files: 104
Total size: 598.7 KB
Directory structure:
gitextract_i8arbao_/
├── .dockerignore
├── .github/
│ ├── README-exec/
│ │ ├── onnx.readme.md
│ │ └── torch.readme.md
│ ├── codecov.yml
│ ├── labeler.yml
│ ├── release-template.ejs
│ └── workflows/
│ ├── cd.yml
│ ├── ci.yml
│ ├── force-docker-build-cas.yml
│ ├── force-docker-build.yml
│ ├── force-docs-build.yml
│ ├── force-hub-push.yml
│ ├── force-release.yml
│ ├── label-pr.yml
│ └── tag.yml
├── .gitignore
├── .pre-commit-config.yaml
├── CHANGELOG.md
├── Dockerfiles/
│ ├── base.Dockerfile
│ ├── cuda.Dockerfile
│ ├── server.Dockerfile
│ └── tensorrt.Dockerfile
├── LICENSE
├── README.md
├── client/
│ ├── clip_client/
│ │ ├── __init__.py
│ │ ├── client.py
│ │ └── helper.py
│ └── setup.py
├── docs/
│ ├── Makefile
│ ├── _static/
│ │ ├── cas-grafana.json
│ │ ├── demo-embed.html
│ │ ├── demo-text-rank.html
│ │ └── main.css
│ ├── _templates/
│ │ ├── page.html
│ │ └── sidebar/
│ │ ├── brand.html
│ │ └── navigation.html
│ ├── changelog/
│ │ └── index.md
│ ├── conf.py
│ ├── hosting/
│ │ ├── by-jina.md
│ │ ├── cas-on-colab.ipynb
│ │ ├── colab.md
│ │ └── on-jcloud.md
│ ├── html_extra/
│ │ └── robots.txt
│ ├── index.md
│ ├── makedoc.sh
│ ├── playground/
│ │ ├── embedding.md
│ │ ├── reasoning.md
│ │ └── searching.md
│ ├── requirements.txt
│ └── user-guides/
│ ├── benchmark.rst
│ ├── client.md
│ ├── faq.md
│ ├── finetuner.md
│ ├── retriever.md
│ └── server.md
├── scripts/
│ ├── MANIFEST.in
│ ├── benchmark.py
│ ├── black.sh
│ ├── docstrings_lint.sh
│ ├── get-all-test-paths.sh
│ ├── get-last-release-note.py
│ ├── get-requirements.py
│ ├── onnx_helper.py
│ ├── release.sh
│ └── setup.py
├── server/
│ ├── MANIFEST.in
│ ├── clip_server/
│ │ ├── __init__.py
│ │ ├── __main__.py
│ │ ├── executors/
│ │ │ ├── __init__.py
│ │ │ ├── clip_onnx.py
│ │ │ ├── clip_tensorrt.py
│ │ │ ├── clip_torch.py
│ │ │ └── helper.py
│ │ ├── helper.py
│ │ ├── model/
│ │ │ ├── __init__.py
│ │ │ ├── clip.py
│ │ │ ├── clip_model.py
│ │ │ ├── clip_onnx.py
│ │ │ ├── clip_trt.py
│ │ │ ├── cnclip_model.py
│ │ │ ├── flash_attention.py
│ │ │ ├── mclip_model.py
│ │ │ ├── model.py
│ │ │ ├── openclip_model.py
│ │ │ ├── pretrained_models.py
│ │ │ ├── simple_tokenizer.py
│ │ │ ├── tokenization.py
│ │ │ └── trt_utils.py
│ │ ├── onnx-flow.yml
│ │ ├── tensorrt-flow.yml
│ │ └── torch-flow.yml
│ └── setup.py
└── tests/
├── __init__.py
├── conftest.py
├── test_asyncio.py
├── test_client.py
├── test_helper.py
├── test_model.py
├── test_ranker.py
├── test_search.py
├── test_server.py
├── test_simple.py
├── test_tensorrt.py
└── test_tokenization.py
================================================
FILE CONTENTS
================================================
================================================
FILE: .dockerignore
================================================
.git
.github
scripts
docs
================================================
FILE: .github/README-exec/onnx.readme.md
================================================
# CLIPOnnxEncoder
**CLIPOnnxEncoder** is the executor implemented in [CLIP-as-service](https://github.com/jina-ai/clip-as-service).
The various `CLIP` models implemented in the [OpenAI](https://github.com/openai/CLIP) and [OpenCLIP](https://github.com/mlfoundations/open_clip) are supported with ONNX runtime (🚀 **3x** speed up).
The introduction of the CLIP model [can be found here](https://openai.com/blog/clip/).
- 🔀 **Automatic**: Auto-detect image and text documents depending on their content.
- ⚡ **Efficiency**: Faster CLIP model inference on CPU and GPU via ONNX runtime.
- 📈 **Observability**: Monitoring the serving via Prometheus and Grafana (see [Usage Guide](https://docs.jina.ai/how-to/monitoring/#deploying-locally)).
## Model support
`ViT-B-32::openai` is used as the default model. To use specific pretrained models provided by `open_clip`, please use `::` to separate model name and pretrained weight name, e.g. `ViT-B-32::laion2b_e16`. Please also note that **different models give different sizes of output dimensions**.
| Model | ONNX | Output dimension |
|---------------------------------------|------|------------------|
| RN50 | ✅ | 1024 |
| RN101 | ✅ | 512 |
| RN50x4 | ✅ | 640 |
| RN50x16 | ✅ | 768 |
| RN50x64 | ✅ | 1024 |
| ViT-B-32 | ✅ | 512 |
| ViT-B-16 | ✅ | 512 |
| ViT-B-16-plus-240 | ✅ | 640 |
| ViT-L-14 | ✅ | 768 |
| ViT-L-14-336 | ✅ | 768 |
| ViT-H-14 | ✅ | 1024 |
| ViT-g-14 | ✅ | 1024 |
| M-CLIP/XLM_Roberta-Large-Vit-B-32 | ✅ | 512 |
| M-CLIP/XLM-Roberta-Large-Vit-L-14 | ✅ | 768 |
| M-CLIP/XLM-Roberta-Large-Vit-B-16Plus | ✅ | 640 |
| M-CLIP/LABSE-Vit-L-14 | ✅ | 768 |
✅ = First class support
Full list of open_clip models and weights can be found [here](https://github.com/mlfoundations/open_clip#pretrained-model-interface).
```{note}
For model definition with `-quickgelu` postfix, please use non `-quickgelu` model name.
```
## Usage
### Use in Jina Flow
- **via Docker image (recommended)**
```python
from jina import Flow
from docarray import Document
import numpy as np
f = Flow().add(
uses='jinahub+docker://CLIPOnnxEncoder',
)
```
- **via source code**
```python
from jina import Flow
from docarray import Document
import numpy as np
f = Flow().add(
uses='jinahub://CLIPOnnxEncoder',
)
```
You can set the following parameters via `with`:
| Parameter | Description |
|-----------|-------------------------------------------------------------------------------------------------------------------------------|
| `name` | Model weights, default is `ViT-B/32`. Support all OpenAI released pretrained models. |
| `num_worker_preprocess` | The number of CPU workers for image & text prerpocessing, default 4. |
| `minibatch_size` | The size of a minibatch for CPU preprocessing and GPU encoding, default 16. Reduce the size of it if you encounter OOM on GPU. |
| `device` | `cuda` or `cpu`. Default is `None` means auto-detect. |
### Encoding
Encoding here means getting the fixed-length vector representation of a sentence or image.
```python
from jina import Flow
from docarray import Document, DocumentArray
da = DocumentArray(
[
Document(text='she smiled, with pain'),
Document(uri='apple.png'),
Document(uri='apple.png').load_uri_to_image_tensor(),
Document(blob=open('apple.png', 'rb').read()),
Document(uri='https://clip-as-service.jina.ai/_static/favicon.png'),
Document(
uri='data:image/gif;base64,R0lGODlhEAAQAMQAAORHHOVSKudfOulrSOp3WOyDZu6QdvCchPGolfO0o/XBs/fNwfjZ0frl3/zy7////wAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAACH5BAkAABAALAAAAAAQABAAAAVVICSOZGlCQAosJ6mu7fiyZeKqNKToQGDsM8hBADgUXoGAiqhSvp5QAnQKGIgUhwFUYLCVDFCrKUE1lBavAViFIDlTImbKC5Gm2hB0SlBCBMQiB0UjIQA7'
),
]
)
f = Flow().add(
uses='jinahub+docker://CLIPOnnxEncoder',
)
with f:
f.post(on='/', inputs=da)
da.summary()
```
From the output, you will see all the text and image docs have `embedding` attached.
```text
╭──────────────────────────── Documents Summary ─────────────────────────────╮
│ │
│ Length 6 │
│ Homogenous Documents False │
│ 4 Documents have attributes ('id', 'mime_type', 'uri', 'embedding') │
│ 1 Document has attributes ('id', 'mime_type', 'text', 'embedding') │
│ 1 Document has attributes ('id', 'embedding') │
│ │
╰────────────────────────────────────────────────────────────────────────────╯
╭────────────────────── Attributes Summary ───────────────────────╮
│ │
│ Attribute Data type #Unique values Has empty value │
│ ───────────────────────────────────────────────────────────── │
│ embedding ('ndarray',) 6 False │
│ id ('str',) 6 False │
│ mime_type ('str',) 5 False │
│ text ('str',) 2 False │
│ uri ('str',) 4 False │
│ │
╰─────────────────────────────────────────────────────────────────╯
```
👉 Access the embedding playground in **CLIP-as-service** [doc](https://clip-as-service.jina.ai/playground/embedding), type sentence or image URL and see **live embedding**!
### Ranking
One can also rank cross-modal matches via `/rank` endpoint.
First construct a *cross-modal* Document where the root contains an image and `.matches` contain sentences to rerank.
```python
from docarray import Document
d = Document(
uri='rerank.png',
matches=[
Document(text=f'a photo of a {p}')
for p in (
'control room',
'lecture room',
'conference room',
'podium indoor',
'television studio',
)
],
)
```
Then send the request via `/rank` endpoint:
```python
f = Flow().add(
uses='jinahub+docker://CLIPOnnxEncoder',
)
with f:
r = f.post(on='/rank', inputs=[d])
print(r['@m', ['text', 'scores__clip_score__value']])
```
Finally, in the return you can observe the matches are re-ranked according to `.scores['clip_score']`:
```bash
[['a photo of a television studio', 'a photo of a conference room', 'a photo of a lecture room', 'a photo of a control room', 'a photo of a podium indoor'],
[0.9920725226402283, 0.006038925610482693, 0.0009973491542041302, 0.00078492151806131, 0.00010626466246321797]]
```
One can also construct `text-to-image` rerank as below:
```python
from docarray import Document
d = Document(
text='a photo of conference room',
matches=[
Document(uri='https://picsum.photos/300'),
Document(uri='https://picsum.photos/id/331/50'),
Document(uri='https://clip-as-service.jina.ai/_static/favicon.png'),
],
)
```
👉 Access the ranking playground in **CLIP-as-service** [doc](https://clip-as-service.jina.ai/playground/reasoning/). Just input the reasoning texts as prompts, the server will rank the prompts and return sorted prompts with scores.
================================================
FILE: .github/README-exec/torch.readme.md
================================================
# CLIPTorchEncoder
**CLIPTorchEncoder** is the executor implemented in [CLIP-as-service](https://github.com/jina-ai/clip-as-service).
The various `CLIP` models implemented in the [OpenAI](https://github.com/openai/CLIP), [OpenCLIP](https://github.com/mlfoundations/open_clip), and [MultilingualCLIP](https://github.com/FreddeFrallan/Multilingual-CLIP) are supported with PyTorch runtime.
The introduction of the CLIP model [can be found here](https://openai.com/blog/clip/).
- 🔀 **Automatic**: Auto-detect image and text documents depending on their content.
- ⚡ **Efficiency**: Faster CLIP model inference on CPU and GPU via leveraging the best practices.
- 📈 **Observability**: Monitoring the serving via Prometheus and Grafana (see [Usage Guide](https://docs.jina.ai/how-to/monitoring/#deploying-locally)).
With advances of ONNX runtime, you can use `CLIPOnnxEncoder` (see [link](https://cloud.jina.ai/executor/2a7auwg2)) instead to achieve **3x** model inference speed up.
## Model support
`ViT-B-32::openai` is used as the default model. To use specific pretrained models provided by `open_clip`, please use `::` to separate model name and pretrained weight name, e.g. `ViT-B-32::laion2b_e16`. Please also note that **different models give different sizes of output dimensions**.
| Model | PyTorch | Output dimension |
|---------------------------------------|---------|------------------|
| RN50 | ✅ | 1024 |
| RN101 | ✅ | 512 |
| RN50x4 | ✅ | 640 |
| RN50x16 | ✅ | 768 |
| RN50x64 | ✅ | 1024 |
| ViT-B-32 | ✅ | 512 |
| ViT-B-16 | ✅ | 512 |
| ViT-B-16-plus-240 | ✅ | 640 |
| ViT-L-14 | ✅ | 768 |
| ViT-L-14-336 | ✅ | 768 |
| ViT-H-14 | ✅ | 1024 |
| ViT-g-14 | ✅ | 1024 |
| M-CLIP/XLM_Roberta-Large-Vit-B-32 | ✅ | 512 |
| M-CLIP/XLM-Roberta-Large-Vit-L-14 | ✅ | 768 |
| M-CLIP/XLM-Roberta-Large-Vit-B-16Plus | ✅ | 640 |
| M-CLIP/LABSE-Vit-L-14 | ✅ | 768 |
✅ = First class support
Full list of open_clip models and weights can be found [here](https://github.com/mlfoundations/open_clip#pretrained-model-interface).
```{note}
For model definition with `-quickgelu` postfix, please use non `-quickgelu` model name.
```
## Usage
### Use in Jina Flow
- **via Docker image (recommended)**
```python
from jina import Flow
from docarray import Document
import numpy as np
f = Flow().add(
uses='jinahub+docker://CLIPTorchEncoder',
)
```
- **via source code**
```python
from jina import Flow
from docarray import Document
import numpy as np
f = Flow().add(
uses='jinahub://CLIPTorchEncoder',
)
```
You can set the following parameters via `with`:
| Parameter | Description |
|-------------------------|--------------------------------------------------------------------------------------------------------------------------------|
| `name` | Model weights, default is `ViT-B/32`. Support all OpenAI released pretrained models. |
| `num_worker_preprocess` | The number of CPU workers for image & text prerpocessing, default 4. |
| `minibatch_size` | The size of a minibatch for CPU preprocessing and GPU encoding, default 32. Reduce the size of it if you encounter OOM on GPU. |
| `device` | `cuda` or `cpu`. Default is `None` means auto-detect. |
| `jit` | If to enable Torchscript JIT, default is `False`. |
### Encoding
Encoding here means getting the fixed-length vector representation of a sentence or image.
```python
from jina import Flow
from docarray import Document, DocumentArray
da = DocumentArray(
[
Document(text='she smiled, with pain'),
Document(uri='apple.png'),
Document(uri='apple.png').load_uri_to_image_tensor(),
Document(blob=open('apple.png', 'rb').read()),
Document(uri='https://clip-as-service.jina.ai/_static/favicon.png'),
Document(
uri='data:image/gif;base64,R0lGODlhEAAQAMQAAORHHOVSKudfOulrSOp3WOyDZu6QdvCchPGolfO0o/XBs/fNwfjZ0frl3/zy7////wAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAACH5BAkAABAALAAAAAAQABAAAAVVICSOZGlCQAosJ6mu7fiyZeKqNKToQGDsM8hBADgUXoGAiqhSvp5QAnQKGIgUhwFUYLCVDFCrKUE1lBavAViFIDlTImbKC5Gm2hB0SlBCBMQiB0UjIQA7'
),
]
)
f = Flow().add(
uses='jinahub+docker://CLIPTorchEncoder',
)
with f:
f.post(on='/', inputs=da)
da.summary()
```
From the output, you will see all the text and image docs have `embedding` attached.
```text
╭──────────────────────────── Documents Summary ─────────────────────────────╮
│ │
│ Length 6 │
│ Homogenous Documents False │
│ 4 Documents have attributes ('id', 'mime_type', 'uri', 'embedding') │
│ 1 Document has attributes ('id', 'mime_type', 'text', 'embedding') │
│ 1 Document has attributes ('id', 'embedding') │
│ │
╰────────────────────────────────────────────────────────────────────────────╯
╭────────────────────── Attributes Summary ───────────────────────╮
│ │
│ Attribute Data type #Unique values Has empty value │
│ ───────────────────────────────────────────────────────────── │
│ embedding ('ndarray',) 6 False │
│ id ('str',) 6 False │
│ mime_type ('str',) 5 False │
│ text ('str',) 2 False │
│ uri ('str',) 4 False │
│ │
╰─────────────────────────────────────────────────────────────────╯
```
👉 Access the embedding playground in **CLIP-as-service** [doc](https://clip-as-service.jina.ai/playground/embedding), type sentence or image URL and see **live embedding**!
### Ranking
One can also rank cross-modal matches via `/rank` endpoint.
First construct a *cross-modal* Document where the root contains an image and `.matches` contain sentences to rerank.
```python
from docarray import Document
d = Document(
uri='rerank.png',
matches=[
Document(text=f'a photo of a {p}')
for p in (
'control room',
'lecture room',
'conference room',
'podium indoor',
'television studio',
)
],
)
```
Then send the request via `/rank` endpoint:
```python
f = Flow().add(
uses='jinahub+docker://CLIPTorchEncoder',
)
with f:
r = f.post(on='/rank', inputs=[d])
print(r['@m', ['text', 'scores__clip_score__value']])
```
Finally, you can observe the matches are re-ranked based on `.scores['clip_score']`:
```bash
[['a photo of a television studio', 'a photo of a conference room', 'a photo of a lecture room', 'a photo of a control room', 'a photo of a podium indoor'],
[0.9920725226402283, 0.006038925610482693, 0.0009973491542041302, 0.00078492151806131, 0.00010626466246321797]]
```
One can also construct `text-to-image` rerank as below:
```python
from docarray import Document
d = Document(
text='a photo of conference room',
matches=[
Document(uri='https://picsum.photos/300'),
Document(uri='https://picsum.photos/id/331/50'),
Document(uri='https://clip-as-service.jina.ai/_static/favicon.png'),
],
)
```
👉 Access the ranking playground in **CLIP-as-service** [doc](https://clip-as-service.jina.ai/playground/reasoning/). Just input the reasoning texts as prompts, the server will rank the prompts and return sorted prompts with scores.
================================================
FILE: .github/codecov.yml
================================================
codecov:
# https://docs.codecov.io/docs/comparing-commits
allow_coverage_offsets: true
coverage:
status:
project:
default:
informational: true
target: auto # auto compares coverage to the previous base commit
comment:
layout: "reach, diff, flags, files"
behavior: default
require_changes: false # if true: only post the comment if coverage changes
branches: # branch names that can post comment
- "main"
================================================
FILE: .github/labeler.yml
================================================
# Add 'label1' to any changes within 'example' folder or any subfolders
area/docs:
- docs/**/*
- ./*.md
area/testing:
- tests/**/*
area/setup:
- setup.py
- requirements.txt
- MANIFEST.in
area/housekeeping:
- .github/**/*
- ./.gitignore
- ./*.yaml
- ./*.yml
area/cicd:
- .github/workflows/**/*
area/docker:
- Dockerfiles/**/*
- ./.dockerignore
area/script:
- script/**/*
component/client:
- client/**/*
component/server:
- server/**/*
================================================
FILE: .github/release-template.ejs
================================================
<% var groupCommits = [
{
name: 'breaking',
show: true,
list: []
}, {
name: 'feat',
show: true,
list: []
}, {
name: 'perf',
show: true,
list: []
}, {
name: 'fix',
show: true,
list: []
}, {
name: 'refactor',
show: true,
list: []
}, {
name: 'docs',
show: true,
list: []
}, {
name: 'test',
show: true,
list: []
}, {
name: 'other',
show: true,
list: []
}
]
var all_titles = {};
var all_commiters = {};
var commitHref = "https://github.com/jina-ai/clip-as-service/commit/"
commits.forEach(function (commit) {
var result = (commit.title).match(/^(\w*)(\((.*)\))?\: (.*)$/);
var type = result && result[1];
var scope = result && result[3];
var title = result && result[4];
var committer = commit.authorName
if (!(committer in all_commiters)) {
all_commiters[committer] = 1
}
if (!(title in all_titles)) {
all_titles[title] = 1
if( title != null && (title.indexOf('💥')>-1 || title.indexOf(':boom:')>-1) ){
groupCommits.find(item => item.name === 'breaking').list.push({
type: type,
scope: scope,
title: title,
commit: commit
})
} else if(type == 'fix' || type == 'fixed'){
groupCommits.find(item => item.name === 'fix').list.push({
type: type,
scope: scope,
title: title,
commit: commit
})
} else if(type == 'perf' || type == 'performance'){
groupCommits.find(item => item.name === 'perf').list.push({
type: type,
scope: scope,
title: title,
commit: commit
})
} else if(type == 'feat' || type == 'feature'){
groupCommits.find(item => item.name === 'feat').list.push({
type: type,
scope: scope,
title: title,
commit: commit
})
} else if(type == 'refactor'){
groupCommits.find(item => item.name === 'refactor').list.push({
type: type,
scope: scope,
title: title,
commit: commit
})
} else if(type == 'docs' || type == 'doc'){
groupCommits.find(item => item.name === 'docs').list.push({
type: type,
scope: scope,
title: title,
commit: commit
})
} else if(type == 'test' || type == 'tests' || type == 'ci'){
groupCommits.find(item => item.name === 'test').list.push({
type: type,
scope: scope,
title: title,
commit: commit
})
} else {
groupCommits.find(item => item.name === 'other').list.push({
type: type,
scope: scope,
title: title,
commit: commit
})
}
}
});
var listCommits = function(list, key){
list.forEach(function (ct) {
var type = ct.type;
var scope = ct.scope;
var title = '';
var commit = ct.commit;
if(type){
if(key != 'other'){
title = (scope? '__'+scope+'__: ':'') + ct.title;
}else{
title = '__' + type + (scope? '('+scope+')':'') + '__ : ' + ct.title;
}
}else{
title = commit.title;
}
%> - <% if(typeof commitHref === 'undefined' || commitHref === '') { %>[```<%=commit.sha1.slice(0,8)%>```]<% } else { %>[[```<%=commit.sha1.slice(0,8)%>```](<%=commitHref%><%=commit.sha1%>)]<%}%> __-__ <%=title%> (*<%= commit.authorName %>*)
<% })} %>
🙇 We'd like to thank all contributors for this new release! In particular,
<% Object.keys(all_commiters).forEach(function (key) { %> <%= key %>, <% }) %> 🙇
<%
for(var i of groupCommits){
if(i.list.length == 0) continue;
if (i.name === 'breaking' && i.show) { %>
### 💥 Breaking changes
<% } else if (i.name === 'fix' && i.show) { %>
### 🐞 Bug fixes
<% } else if( i.name === 'feat' && i.show) { %>
### 🆕 New Features
<% } else if(i.name === 'perf' && i.show) { %>
### ⚡ Performance Improvements
<% } else if(i.name === 'refactor' && i.show) { %>
### 🧼 Code Refactoring
<% } else if(i.name === 'docs' && i.show) { %>
### 📗 Documentation
<% } else if(i.name === 'test' && i.show) { %>
### 🏁 Unit Test and CICD
<% } else if (i.name === 'other' && i.show) { %>
### 🍹 Other Improvements
<% }
i.show && listCommits(i.list, i);
} %>
================================================
FILE: .github/workflows/cd.yml
================================================
name: CD
on:
push:
branches:
- main
jobs:
prep-testbed:
if: |
!startsWith(github.event.head_commit.message, 'chore') &&
!startsWith(github.event.head_commit.message, 'build: hotfix') &&
!endsWith(github.event.head_commit.message, 'reformatted by jina-dev-bot')
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- id: set-matrix
run: |
sudo apt-get install jq
echo "::set-output name=matrix::$(bash scripts/get-all-test-paths.sh)"
outputs:
matrix: ${{ steps.set-matrix.outputs.matrix }}
core-test:
needs: prep-testbed
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
python-version: [3.7]
test-path: ${{fromJson(needs.prep-testbed.outputs.matrix)}}
steps:
- uses: actions/checkout@v2
- 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
pip install --no-cache-dir "client/[test]"
pip install --no-cache-dir "server/[onnx]"
pip install --no-cache-dir "server/[transformers]"
pip install --no-cache-dir "server/[search]"
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 "not gpu" ${{ matrix.test-path }}
echo "::set-output name=codecov_flag::cas"
timeout-minutes: 30
- 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@v2
if: steps.check_files.outputs.files_exists == 'true' && ${{ matrix.python-version }} == '3.7'
with:
file: coverage.xml
flags: ${{ steps.test.outputs.codecov_flag }}
fail_ci_if_error: false
token: ${{ secrets.CODECOV_TOKEN }} # not required for public repos
gpu-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/[tensorrt]"
- 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_tensorrt.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
prerelease:
needs: [core-test, gpu-test]
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
with:
fetch-depth: 100
- name: Pre-release (.devN)
run: |
git fetch --depth=1 origin +refs/tags/*:refs/tags/*
pip install twine wheel
./scripts/release.sh
env:
TWINE_USERNAME: ${{ secrets.TWINE_USERNAME }}
TWINE_PASSWORD: ${{ secrets.TWINE_PASSWORD }}
- name: Pre-release docker (.devN)
uses: benc-uk/workflow-dispatch@v1
with:
workflow: Manual Docker Build
inputs: '{ "release_token": "${{ env.release_token }}", "triggered_by": "CD"}'
token: ${{ secrets.JINA_DEV_BOT }}
env:
release_token: ${{ secrets.CAS_RELEASE_TOKEN }}
- uses: benc-uk/workflow-dispatch@v1
with:
workflow: Manual CAS Docker Build
inputs: '{ "release_token": "${{ env.release_token }}", "triggered_by": "CD"}'
token: ${{ secrets.JINA_DEV_BOT }}
env:
release_token: ${{ secrets.CAS_RELEASE_TOKEN }}
- name: Pre-release hub (.devN)
uses: benc-uk/workflow-dispatch@v1
with:
workflow: Manual Hub Push
inputs: '{ "release_token": "${{ env.release_token }}", "triggered_by": "CD"}'
token: ${{ secrets.JINA_DEV_BOT }}
env:
release_token: ${{ secrets.CAS_RELEASE_TOKEN }}
================================================
FILE: .github/workflows/ci.yml
================================================
name: CI
on:
pull_request:
jobs:
commit-lint:
runs-on: ubuntu-latest
steps:
- name: find the prev warning if exist
uses: peter-evans/find-comment@v1
id: fc
with:
issue-number: ${{ github.event.pull_request.number }}
comment-author: "github-actions[bot]"
body-includes: "bad commit message"
- name: Delete comment if exist
if: ${{ steps.fc.outputs.comment-id != 0 }}
uses: actions/github-script@v3
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
script: |
github.issues.deleteComment({
owner: context.repo.owner,
repo: context.repo.repo,
comment_id: ${{ steps.fc.outputs.comment-id }},
})
- uses: actions/checkout@v2.5.0
with:
fetch-depth: 0
- run: 'echo "module.exports = {extends: [''@commitlint/config-conventional'']}" > commitlint.config.js'
- uses: wagoid/commitlint-github-action@v4
env:
GITHUB_TOKEN: "${{ secrets.GITHUB_TOKEN }}"
- name: if lint failed
if: ${{ failure() }}
uses: peter-evans/create-or-update-comment@v1
with:
issue-number: ${{ github.event.pull_request.number }}
body: |
Thanks for your contribution :heart:
:broken_heart: Unfortunately, this PR has one or more **bad commit messages**, it can not be merged. To fix this problem, please refer to:
- [Commit Message Guideline for the First Time Contributor](https://github.com/jina-ai/jina/issues/553)
- [Contributing Guideline](https://github.com/jina-ai/jina/blob/master/CONTRIBUTING.md)
This message will be deleted automatically when the commit messages get fixed.
reaction-type: "eyes"
lint-flake-8:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Set up Python 3.7
uses: actions/setup-python@v2
with:
python-version: 3.7
- name: Lint with flake8
run: |
pip install flake8
# stop the build if there are Python syntax errors or undefined names
flake8 . --count --select=E9,F63,F7,F82 --show-source --statistics --exclude .git,__pycache__,docs/source/conf.py,old,build,dist,tests/,jina/resources/
# exit-zero treats all errors as warnings. The GitHub editor is 127 chars wide
flake8 . --count --exit-zero --max-complexity=10 --max-line-length=127 --statistics --exclude .git,__pycache__,docs/source/conf.py,old,build,dist,tests/,jina/resources/
check-black:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
with:
fetch-depth: 0
- name: Set up Python 3.7
uses: actions/setup-python@v2
with:
python-version: 3.7
- id: file_changes
uses: Ana06/get-changed-files@v1.2
- name: check black
run: ./scripts/black.sh
env:
CHANGED_FILES: ${{ steps.file_changes.outputs.added_modified }}
prep-testbed:
runs-on: ubuntu-latest
needs: [lint-flake-8, check-black]
steps:
- uses: actions/checkout@v2
- id: set-matrix
run: |
sudo apt-get install jq
echo "::set-output name=matrix::$(bash scripts/get-all-test-paths.sh)"
outputs:
matrix: ${{ steps.set-matrix.outputs.matrix }}
core-test:
needs: prep-testbed
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
python-version: [3.7]
test-path: ${{fromJson(needs.prep-testbed.outputs.matrix)}}
steps:
- uses: actions/checkout@v2
- 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
pip install --no-cache-dir "client/[test]"
pip install --no-cache-dir "server/[onnx]"
pip install --no-cache-dir "server/[transformers]"
pip install --no-cache-dir "server/[search]"
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 ${{ matrix.test-path }}
echo "::set-output name=codecov_flag::cas"
timeout-minutes: 30
- 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: ${{ matrix.test-path }}-codecov
flags: ${{ steps.test.outputs.codecov_flag }}
fail_ci_if_error: false
token: ${{ secrets.CODECOV_TOKEN }} # not required for public repos
trt-gpu-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 pip==23.0.1
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]"
} || {
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_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 pip==23.0.1
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"
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
# just for blocking the merge until all parallel core-test are successful
success-all-test:
needs: [commit-lint, core-test, trt-gpu-test, gpu-model-test]
if: always()
runs-on: ubuntu-latest
steps:
- uses: technote-space/workflow-conclusion-action@v2
- name: Check Failure
if: env.WORKFLOW_CONCLUSION == 'failure'
run: exit 1
- name: Success
if: ${{ success() }}
run: echo "All Done"
================================================
FILE: .github/workflows/force-docker-build-cas.yml
================================================
name: Manual CAS Docker Build
on:
workflow_dispatch:
inputs:
release_token:
description: 'Your release token'
required: true
triggered_by:
description: 'CD | TAG | MANUAL'
required: false
default: MANUAL
jobs:
token-check:
runs-on: ubuntu-latest
steps:
- run: echo "success!"
if: "${{ github.event.inputs.release_token }} == ${{ env.release_token }}"
env:
release_token: ${{ secrets.CAS_RELEASE_TOKEN }}
regular-release:
needs: token-check
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
pip_tag: [ "", "onnx", "tensorrt"] # default: "" = core
steps:
- uses: actions/checkout@v2
- name: Set envs and versions
run: |
VCS_REF=${{ github.ref }}
echo "VCS_REF=$VCS_REF" >> $GITHUB_ENV
echo "Will build $VCS_REF"
echo "BUILD_DATE=$(date -u +'%Y-%m-%dT%H:%M:%SZ')" >> $GITHUB_ENV
if [[ "${{ matrix.pip_tag }}" == "perf" ]]; then
echo "JINA_PIP_INSTALL_PERF=1" >> $GITHUB_ENV
fi
if [[ "${{ matrix.pip_tag }}" == "" ]]; then
echo "JINA_PIP_INSTALL_CORE=1" >> $GITHUB_ENV
fi
JINA_VERSION=$(sed -n '/^__version__/p' ./server/clip_server/__init__.py | cut -d \' -f2)
V_JINA_VERSION=v${JINA_VERSION}
JINA_MINOR_VERSION=${JINA_VERSION%.*}
JINA_MAJOR_VERSION=${JINA_MINOR_VERSION%.*}
PY_TAG=${{matrix.py_version}}
if [ -n "${PY_TAG}" ]; then
PY_TAG=-py${PY_TAG//./}
fi
PIP_TAG=${{ matrix.pip_tag }}
if [ -n "${PIP_TAG}" ]; then
PIP_TAG=-${PIP_TAG}
fi
if [[ "${{ github.event.inputs.triggered_by }}" == "CD" ]]; then
if [[ "${{ matrix.py_version }}" == "$DEFAULT_PY_VERSION" ]]; then
echo "TAG_ALIAS=\
jinaai/clip-server:master${PY_TAG}${PIP_TAG}, \
jinaai/clip-server:master${PIP_TAG}" \
>> $GITHUB_ENV
else
# on every CD
echo "TAG_ALIAS=\
jinaai/clip-server:master${PY_TAG}${PIP_TAG}" \
>> $GITHUB_ENV
fi
elif [[ "${{ github.event.inputs.triggered_by }}" == "TAG" ]]; then
# on every tag release
if [[ "${{ matrix.py_version }}" == "$DEFAULT_PY_VERSION" ]]; then
echo "TAG_ALIAS=\
jinaai/clip-server:latest${PY_TAG}${PIP_TAG}, \
jinaai/clip-server:${JINA_VERSION}${PY_TAG}${PIP_TAG}, \
jinaai/clip-server:${JINA_MINOR_VERSION}${PY_TAG}${PIP_TAG}, \
jinaai/clip-server:${JINA_MAJOR_VERSION}${PY_TAG}${PIP_TAG}, \
jinaai/clip-server:latest${PIP_TAG}, \
jinaai/clip-server:${JINA_VERSION}${PIP_TAG}, \
jinaai/clip-server:${JINA_MINOR_VERSION}${PIP_TAG}, \
jinaai/clip-server:${JINA_MAJOR_VERSION}${PIP_TAG} \
" >> $GITHUB_ENV
else
echo "TAG_ALIAS=\
jinaai/clip-server:latest${PY_TAG}${PIP_TAG}, \
jinaai/clip-server:${JINA_VERSION}${PY_TAG}${PIP_TAG}, \
jinaai/clip-server:${JINA_MINOR_VERSION}${PY_TAG}${PIP_TAG}, \
jinaai/clip-server:${JINA_MAJOR_VERSION}${PY_TAG}${PIP_TAG} \
" >> $GITHUB_ENV
fi
elif [[ "${{ github.event.inputs.triggered_by }}" == "MANUAL" ]]; then
# on every manual release
if [[ "${{ matrix.py_version }}" == "$DEFAULT_PY_VERSION" ]]; then
echo "TAG_ALIAS=\
jinaai/clip-server:${JINA_VERSION}${PIP_TAG}, \
jinaai/clip-server:${JINA_VERSION}${PY_TAG}${PIP_TAG} \
" >> $GITHUB_ENV
else
echo "TAG_ALIAS=\
jinaai/clip-server:${JINA_VERSION}${PY_TAG}${PIP_TAG} \
" >> $GITHUB_ENV
fi
else
echo "Bad triggered_by: ${{ github.event.inputs.triggered_by }}!"
exit 1
fi
echo "JINA_VERSION=${JINA_VERSION}" >> $GITHUB_ENV
- name: Set up Docker Buildx
id: buildx
uses: docker/setup-buildx-action@v1
with:
install: true
- name: Login to DockerHub
uses: docker/login-action@v1
with:
username: ${{ secrets.DOCKERHUB_DEVBOT_USER }}
password: ${{ secrets.DOCKERHUB_DEVBOT_TOKEN }}
- run: |
# https://github.com/docker/buildx/issues/464#issuecomment-741507760
# https://github.com/kubernetes-sigs/azuredisk-csi-driver/pull/808/files
docker run --privileged --rm tonistiigi/binfmt --uninstall qemu-aarch64
docker run --rm --privileged tonistiigi/binfmt --install all
- name: Build and push
uses: docker/build-push-action@v2
with:
context: .
file: Dockerfiles/server.Dockerfile
platforms: linux/amd64
push: true
tags: ${{env.TAG_ALIAS}}
build-args: |
BUILD_DATE=${{env.BUILD_DATE}}
JINA_VERSION=${{env.JINA_VERSION}}
VCS_REF=${{env.VCS_REF}}
PIP_INSTALL_CORE=${{env.JINA_PIP_INSTALL_CORE}}
PIP_INSTALL_PERF=${{env.JINA_PIP_INSTALL_PERF}}
PIP_TAG=${{matrix.pip_tag}}
================================================
FILE: .github/workflows/force-docker-build.yml
================================================
name: Manual Docker Build
on:
workflow_dispatch:
inputs:
release_token:
description: 'Your release token'
required: true
triggered_by:
description: 'CD | TAG | MANUAL'
required: false
default: MANUAL
jobs:
token-check:
runs-on: ubuntu-latest
steps:
- run: echo "success!"
if: "${{ github.event.inputs.release_token }} == ${{ env.release_token }}"
env:
release_token: ${{ secrets.CAS_RELEASE_TOKEN }}
docker-release:
needs: token-check
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
pip_tag: ["", "onnx", "tensorrt"] # default: "" = torch
engine_tag: ["", "cuda"] # default: "" = cpu
steps:
- uses: actions/checkout@v2
- name: Set envs and versions
run: |
VCS_REF=${{ github.ref }}
echo "VCS_REF=$VCS_REF" >> $GITHUB_ENV
echo "Will build $VCS_REF"
echo "BUILD_DATE=$(date -u +'%Y-%m-%dT%H:%M:%SZ')" >> $GITHUB_ENV
echo "BUILD_TARGET=clip_executor" >> $GITHUB_ENV
CAS_VERSION=$(sed -n '/^__version__/p' ./server/clip_server/__init__.py | cut -d \' -f2)
V_CAS_VERSION=v${CAS_VERSION}
CAS_MINOR_VERSION=${CAS_VERSION%.*}
CAS_MAJOR_VERSION=${CAS_MINOR_VERSION%.*}
ENGINE_TAG=${{matrix.engine_tag}}
if [ -n "${ENGINE_TAG}" ]; then
ENGINE_TAG=-${ENGINE_TAG//./}
fi
PIP_TAG=${{ matrix.pip_tag }}
BACKEND_TAG=torch
if [ -n "${PIP_TAG}" ]; then
BACKEND_TAG=${PIP_TAG}
PIP_TAG=-${PIP_TAG}
fi
if [[ "${{ github.event.inputs.triggered_by }}" == "CD" ]]; then
# on every CD release
echo "TAG_ALIAS=\
jinaai/clip_executor:master${PIP_TAG}${ENGINE_TAG}" \
>> $GITHUB_ENV
elif [[ "${{ github.event.inputs.triggered_by }}" == "TAG" ]]; then
# on every tag release
echo "TAG_ALIAS=\
jinaai/clip_executor:latest${PIP_TAG}${ENGINE_TAG}, \
jinaai/clip_executor:${CAS_VERSION}${PIP_TAG}${ENGINE_TAG}, \
jinaai/clip_executor:${CAS_MINOR_VERSION}${PIP_TAG}${ENGINE_TAG} \
" >> $GITHUB_ENV
elif [[ "${{ github.event.inputs.triggered_by }}" == "MANUAL" ]]; then
# on every manual release
echo "TAG_ALIAS=\
jinaai/clip_executor:${CAS_VERSION}${PIP_TAG}${ENGINE_TAG} \
" >> $GITHUB_ENV
else
echo "Bad triggered_by: ${{ github.event.inputs.triggered_by }}!"
exit 1
fi
echo "CAS_VERSION=${CAS_VERSION}" >> $GITHUB_ENV
echo "BACKEND_TAG=${BACKEND_TAG}" >> $GITHUB_ENV
- name: Set up Docker Buildx
id: buildx
uses: docker/setup-buildx-action@v2
with:
install: true
- name: Login to DockerHub
uses: docker/login-action@v2
with:
username: ${{ secrets.DOCKERHUB_DEVBOT_USER }}
password: ${{ secrets.DOCKERHUB_DEVBOT_TOKEN }}
- run: |
# https://github.com/docker/buildx/issues/464#issuecomment-741507760
# https://github.com/kubernetes-sigs/azuredisk-csi-driver/pull/808/files
docker run --privileged --rm tonistiigi/binfmt --uninstall qemu-aarch64
docker run --rm --privileged tonistiigi/binfmt --install all
- name: CPU Build and push
id: base_docker_build
if: ${{ matrix.engine_tag == '' && matrix.pip_tag != 'tensorrt' }}
uses: docker/build-push-action@v2
with:
context: server
file: Dockerfiles/base.Dockerfile
platforms: linux/amd64
cache-from: type=registry,ref=jinaai/clip_executor:latest
cache-to: type=inline
push: true
tags: ${{env.TAG_ALIAS}}
build-args: |
BUILD_DATE=${{env.BUILD_DATE}}
CAS_VERSION=${{env.CAS_VERSION}}
VCS_REF=${{env.VCS_REF}}
BACKEND_TAG=${{env.BACKEND_TAG}}
- name: CUDA Build and push
id: cuda_docker_build
if: ${{ matrix.engine_tag == 'cuda' }}
uses: docker/build-push-action@v2
with:
context: server
file: Dockerfiles/cuda.Dockerfile
platforms: linux/amd64
cache-from: type=registry,ref=jinaai/clip_executor:latest-cuda
cache-to: type=inline
push: true
tags: ${{env.TAG_ALIAS}}
build-args: |
BUILD_DATE=${{env.BUILD_DATE}}
CAS_VERSION=${{env.CAS_VERSION}}
VCS_REF=${{env.VCS_REF}}
BACKEND_TAG=${{env.BACKEND_TAG}}
================================================
FILE: .github/workflows/force-docs-build.yml
================================================
name: Manual Docs Build
on:
workflow_dispatch:
inputs:
release_token:
description: 'Your release token'
required: true
triggered_by:
description: 'CD | TAG | MANUAL'
required: false
default: MANUAL
jobs:
token-check:
runs-on: ubuntu-latest
steps:
- run: echo "success!"
if: "${{ github.event.inputs.release_token }} == ${{ env.release_token }}"
env:
release_token: ${{ secrets.CAS_RELEASE_TOKEN }}
release-docs:
needs: token-check
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
with:
fetch-depth: 0
- uses: actions/setup-python@v2
with:
python-version: 3.7
- name: Build doc and push to gh-pages
run: |
git config --local user.email "dev-bot@jina.ai"
git config --local user.name "Jina Dev Bot"
pip install --no-cache-dir client/
pip install --no-cache-dir server/
mkdir gen-html
cd docs
pip install -r requirements.txt
pip install --pre -U furo
bash makedoc.sh
cd ./_build/dirhtml/
cp -r ./ ../../../gen-html
cd - # back to ./docs
cd ..
git checkout -f gh-pages
git rm -rf ./docs
mkdir -p docs
cd gen-html
cp -r ./ ../docs
cd ../docs
ls -la
touch .nojekyll
cp 404/index.html 404.html
sed -i 's/href="\.\./href="/' 404.html # fix asset urls that needs to be updated in 404.html
echo clip-as-service.jina.ai > CNAME
cd ..
git add docs
git status
git commit -m "chore(docs): update docs due to ${{github.event_name}} on ${{github.repository}}"
git push --force origin gh-pages
================================================
FILE: .github/workflows/force-hub-push.yml
================================================
name: Manual Hub Push
on:
workflow_dispatch:
inputs:
release_token:
description: 'Your release token'
required: true
triggered_by:
description: 'CD | TAG | MANUAL'
required: false
default: MANUAL
#on:
# pull_request:
jobs:
token-check:
runs-on: ubuntu-latest
steps:
- run: echo "success!"
if: "${{ github.event.inputs.release_token }} == ${{ env.release_token }}"
env:
release_token: ${{ secrets.CAS_RELEASE_TOKEN }}
hub-release:
needs: token-check
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Set envs and versions
run: |
VCS_REF=${{ github.ref }}
echo "VCS_REF=$VCS_REF" >> $GITHUB_ENV
echo "Will push $VCS_REF"
CAS_VERSION=$(sed -n '/^__version__/p' ./server/clip_server/__init__.py | cut -d \' -f2)
V_CAS_VERSION=v${CAS_VERSION}
CAS_MINOR_VERSION=${CAS_VERSION%.*}
CAS_MAJOR_VERSION=${CAS_MINOR_VERSION%.*}
if [[ "${{ github.event.inputs.triggered_by }}" == "CD" ]]; then
# on every CD release
echo "TAG_ALIAS=\
-t latest \
" >> $GITHUB_ENV
echo "GPU_TAG_ALIAS=\
-t latest-gpu \
" >> $GITHUB_ENV
elif [[ "${{ github.event.inputs.triggered_by }}" == "TAG" ]]; then
# on every tag release
echo "TAG_ALIAS=\
-t latest \
-t ${CAS_VERSION} \
-t ${CAS_MINOR_VERSION} \
" >> $GITHUB_ENV
echo "GPU_TAG_ALIAS=\
-t latest-gpu \
-t ${CAS_VERSION}-gpu \
-t ${CAS_MINOR_VERSION}-gpu \
" >> $GITHUB_ENV
elif [[ "${{ github.event.inputs.triggered_by }}" == "MANUAL" ]]; then
# on every manual release
echo "TAG_ALIAS=\
-t ${CAS_VERSION} \
" >> $GITHUB_ENV
echo "GPU_TAG_ALIAS=\
-t ${CAS_VERSION}-gpu \
" >> $GITHUB_ENV
else
echo "TAG_ALIAS=\
-t latest \
" >> $GITHUB_ENV
echo "GPU_TAG_ALIAS=\
-t latest-gpu \
" >> $GITHUB_ENV
fi
echo "CAS_VERSION=${CAS_VERSION}" >> $GITHUB_ENV
- name: Prepare enviroment
run: |
python -m pip install --upgrade jina yq
- name: Push Torch Executor
id: push_torch_executor
run: |
# FIX the import issue
echo -e "\
__version__ = '$CAS_VERSION'
from .executors.clip_torch import CLIPEncoder\n\
" > server/clip_server/__init__.py
echo -e "\
jtype: CLIPEncoder\n\
metas:\n\
py_modules:\n\
- clip_server/__init__.py\n\
" > server/config.yml
echo -e "\
manifest_version: 1\n\
name: CLIPTorchEncoder\n\
description: Embed images and sentences into fixed-length vectors with CLIP\n\
url: https://github.com/jina-ai/clip-as-service\n\
keywords: [clip, clip-model, clip-as-service, pytorch]\n\
" > server/manifest.yml
python scripts/get-requirements.py "" server/requirements.txt
cp .github/README-exec/torch.readme.md server/README.md
exec_name=`yq -r .name server/manifest.yml`
echo executor name is $exec_name
cp Dockerfiles/base.Dockerfile server/Dockerfile
JINA_AUTH_TOKEN=${{secrets.JINAHUB_TOKEN}} jina hub push --force $exec_name --secret ${{secrets.TORCH_EXEC_SECRET}} server ${{env.TAG_ALIAS}}
cp Dockerfiles/cuda.Dockerfile server/Dockerfile
JINA_AUTH_TOKEN=${{secrets.JINAHUB_TOKEN}} jina hub push --force $exec_name --secret ${{secrets.TORCH_EXEC_SECRET}} server ${{env.GPU_TAG_ALIAS}}
- name: Push Onnx Executor
id: push_onnx_executor
run: |
# FIX the import issue
echo -e "\
__version__ = '$CAS_VERSION'
from .executors.clip_onnx import CLIPEncoder\n\
" > server/clip_server/__init__.py
echo -e "\
jtype: CLIPEncoder\n\
metas:\n\
py_modules:\n\
- clip_server/__init__.py\n\
" > server/config.yml
echo -e "\
manifest_version: 1\n\
name: CLIPOnnxEncoder\n\
description: Embed images and sentences into fixed-length vectors with CLIP\n\
url: https://github.com/jina-ai/clip-as-service\n\
keywords: [clip, clip-model, clip-as-service, onnx, onnx-runtime]\n\
" > server/manifest.yml
python scripts/get-requirements.py onnx server/requirements.txt
cp .github/README-exec/onnx.readme.md server/README.md
exec_name=`yq -r .name server/manifest.yml`
echo executor name is $exec_name
cp Dockerfiles/base.Dockerfile server/Dockerfile
sed -i 's/ARG BACKEND_TAG=torch/ARG BACKEND_TAG=onnx/g' server/Dockerfile
JINA_AUTH_TOKEN=${{secrets.JINAHUB_TOKEN}} jina hub push --force $exec_name --secret ${{secrets.ONNX_EXEC_SECRET}} server ${{env.TAG_ALIAS}}
cp Dockerfiles/cuda.Dockerfile server/Dockerfile
sed -i 's/ARG BACKEND_TAG=torch/ARG BACKEND_TAG=onnx/g' server/Dockerfile
JINA_AUTH_TOKEN=${{secrets.JINAHUB_TOKEN}} jina hub push --force $exec_name --secret ${{secrets.ONNX_EXEC_SECRET}} server ${{env.GPU_TAG_ALIAS}}
- name: Push TensorRT Executor
id: push_tensorrt_executor
run: |
# FIX the import issue
echo -e "\
__version__ = '$CAS_VERSION'
from .executors.clip_tensorrt import CLIPEncoder\n\
" > server/clip_server/__init__.py
echo -e "\
jtype: CLIPEncoder\n\
metas:\n\
py_modules:\n\
- clip_server/__init__.py\n\
" > server/config.yml
echo -e "\
manifest_version: 1\n\
name: CLIPTensorRTEncoder\n\
description: Embed images and sentences into fixed-length vectors with CLIP\n\
url: https://github.com/jina-ai/clip-as-service\n\
keywords: [clip, clip-model, clip-as-service, onnx, tensorrt]\n\
" > server/manifest.yml
python scripts/get-requirements.py tensorrt server/requirements.txt
cp Dockerfiles/tensorrt.Dockerfile server/Dockerfile
exec_name=`yq -r .name server/manifest.yml`
echo executor name is $exec_name
# FIXME: disable uploading at debugging
# JINA_AUTH_TOKEN=${{secrets.JINAHUB_TOKEN}} jina hub push --force $exec_name --secret ${{secrets.TENSORRT_EXEC_SECRET}} server ${{env.TAG_ALIAS}}
================================================
FILE: .github/workflows/force-release.yml
================================================
name: Manual Release
on:
workflow_dispatch:
inputs:
release_token:
description: 'Your release token'
required: true
release_reason:
description: 'Short reason for this manual release'
required: true
jobs:
token-check:
runs-on: ubuntu-latest
steps:
- run: echo "success!"
if: "${{ github.event.inputs.release_token }} == ${{ env.release_token }}"
env:
release_token: ${{ secrets.CAS_RELEASE_TOKEN }}
regular-release:
needs: token-check
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
with:
token: ${{ secrets.JINA_DEV_BOT }}
fetch-depth: 100 # means max contribute history is limited to 100 lines
# submodules: true
- uses: actions/setup-python@v2
with:
python-version: 3.7
- run: |
git fetch --depth=1 origin +refs/tags/*:refs/tags/*
npm install git-release-notes
pip install twine wheel
./scripts/release.sh final "${{ github.event.inputs.release_reason }}" "${{github.actor}}"
env:
TWINE_USERNAME: ${{ secrets.TWINE_USERNAME }}
TWINE_PASSWORD: ${{ secrets.TWINE_PASSWORD }}
- if: failure()
run: echo "nothing to release"
- name: bumping master version
uses: ad-m/github-push-action@v0.6.0
with:
github_token: ${{ secrets.JINA_DEV_BOT }}
tags: true
branch: main
================================================
FILE: .github/workflows/label-pr.yml
================================================
name: PR
on:
pull_request:
jobs:
assign-label-to-pr:
runs-on: ubuntu-latest
if: ${{ !github.event.pull_request.head.repo.fork }}
steps:
- uses: codelytv/pr-size-labeler@v1
with:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
xs_max_size: '10'
s_max_size: '100'
m_max_size: '500'
l_max_size: '1000'
fail_if_xl: 'false'
- uses: actions/labeler@v3
with:
repo-token: "${{ secrets.GITHUB_TOKEN }}"
- id: docs_updated
if: contains( github.event.pull_request.labels.*.name, 'area/docs')
run: echo '::set-output name=docs::true'
outputs:
docs: ${{ steps.docs_updated.outputs.docs }}
deploy-to-netlify:
runs-on: ubuntu-latest
needs: [assign-label-to-pr]
if: ${{ needs.assign-label-to-pr.outputs.docs == 'true' }}
steps:
- run: |
echo "BRANCH_NAME=${{ github.head_ref }}" >> $GITHUB_ENV
- uses: actions/checkout@v2
with:
repository: jina-ai/clip-as-service
ref: ${{ env.BRANCH_NAME }}
- uses: actions/setup-python@v2
with:
python-version: 3.7
- uses: actions/setup-node@v2
with:
node-version: '14'
- name: Build and Deploy
run: |
npm i -g netlify-cli
python -m pip install --upgrade pip
pip install -r requirements.txt
git fetch origin
export NUM_RELEASES=2 # only 2 last tags to save build time
bash makedoc.sh development
netlify deploy --dir=_build/dirhtml --alias="ft-${{ env.BRANCH_NAME }}" --message="Deploying docs to ${{ env.BRANCH_NAME }} branch"
env:
NETLIFY_AUTH_TOKEN: ${{ secrets.NETLIFY_AUTH_TOKEN1 }}
NETLIFY_SITE_ID: ${{ secrets.NETLIFY_SITE_ID }}
working-directory: docs
- name: Find the prev comment if exists
uses: peter-evans/find-comment@v1
id: fc
with:
issue-number: ${{ github.event.pull_request.number }}
comment-author: 'github-actions[bot]'
body-includes: 'Docs are deployed'
- name: Delete comment if exists
if: ${{ steps.fc.outputs.comment-id != 0 && !github.event.pull_request.head.repo.fork }}
uses: actions/github-script@v3
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
script: |
github.issues.deleteComment({
owner: context.repo.owner,
repo: context.repo.repo,
comment_id: ${{ steps.fc.outputs.comment-id }},
})
- name: Add or update comment
uses: peter-evans/create-or-update-comment@v1
with:
issue-number: ${{ github.event.pull_request.number }}
body: |
:memo: Docs are deployed on https://ft-${{ env.BRANCH_NAME }}--jina-docs.netlify.app :tada:
================================================
FILE: .github/workflows/tag.yml
================================================
name: Release CD
on:
push:
tags:
- "v*" # push to version tags trigger the build
jobs:
update-doc:
runs-on: ubuntu-latest
steps:
- uses: benc-uk/workflow-dispatch@v1
with:
workflow: Manual Docs Build
token: ${{ secrets.JINA_DEV_BOT }}
inputs: '{ "release_token": "${{ env.release_token }}", "triggered_by": "TAG"}'
env:
release_token: ${{ secrets.CAS_RELEASE_TOKEN }}
update-docker:
needs: update-doc
runs-on: ubuntu-latest
steps:
- name: CAS Docker Build
uses: benc-uk/workflow-dispatch@v1
with:
workflow: Manual CAS Docker Build
inputs: '{ "release_token": "${{ env.release_token }}", "triggered_by": "TAG"}'
token: ${{ secrets.JINA_DEV_BOT }}
env:
release_token: ${{ secrets.CAS_RELEASE_TOKEN }}
- name: Helm Executor Build
uses: benc-uk/workflow-dispatch@v1
with:
workflow: Manual Docker Build
inputs: '{ "release_token": "${{ env.release_token }}", "triggered_by": "TAG"}'
token: ${{ secrets.JINA_DEV_BOT }}
env:
release_token: ${{ secrets.CAS_RELEASE_TOKEN }}
- name: Hub Executor Build
uses: benc-uk/workflow-dispatch@v1
with:
workflow: Manual Hub Push
inputs: '{ "release_token": "${{ env.release_token }}", "triggered_by": "TAG"}'
token: ${{ secrets.JINA_DEV_BOT }}
env:
release_token: ${{ secrets.CAS_RELEASE_TOKEN }}
create-release:
needs: update-doc
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v2
with:
ref: 'main'
- uses: actions/setup-python@v2
with:
python-version: 3.7
- run: |
python scripts/get-last-release-note.py
- name: Create Release
id: create_release
uses: actions/create-release@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} # This token is provided by Actions, you do not need to create your own token
with:
tag_name: ${{ github.ref }}
release_name: 💫 Patch ${{ github.ref }}
body_path: 'tmp.md'
draft: false
prerelease: false
================================================
FILE: .gitignore
================================================
# Initially taken from Github's Python gitignore file
# Byte-compiled / optimized / DLL files
__pycache__/
*.py[cod]
*$py.class
# C extensions
*.so
# Distribution / packaging
.Python
build/
develop-eggs/
dist/
downloads/
eggs/
.eggs/
lib/
lib64/
parts/
sdist/
var/
wheels/
*.egg-info/
.installed.cfg
*.egg
MANIFEST
# PyInstaller
# Usually these files are written by a python script from a template
# before PyInstaller builds the exe, so as to inject date/other infos into it.
*.manifest
*.spec
# Installer logs
pip-log.txt
pip-delete-this-directory.txt
# Unit test / coverage reports
htmlcov/
.tox/
.nox/
.coverage
.coverage.*
.cache
nosetests.xml
coverage.xml
*.cover
.hypothesis/
.pytest_cache/
# Translations
*.mo
*.pot
# Django stuff:
*.log
local_settings.py
db.sqlite3
# Flask stuff:
instance/
.webassets-cache
# Scrapy stuff:
.scrapy
# Sphinx documentation
docs/_build/
docs/api/
# PyBuilder
target/
# Jupyter Notebook
.ipynb_checkpoints
# IPython
profile_default/
ipython_config.py
# pyenv
docs/.python-version
# celery beat schedule file
celerybeat-schedule
# SageMath parsed files
*.sage.py
# Environments
.venv
env/
venv/
ENV/
env.bak/
venv.bak/
# Spyder project settings
.spyderproject
.spyproject
# Rope project settings
.ropeproject
# mkdocs documentation
/site
# mypy
.mypy_cache/
.dmypy.json
dmypy.json
# Pyre type checker
.pyre/
.idea/
toy*.py
.DS_Store
post/
toy*.ipynb
data/
*.c
.nes_cache
toy*.yml
*.tmp
shell/jina-wizard.sh
/junit/
/tests/junit/
/docs/chapters/proto/docs.md
/tests/.pytest-kind
# IntelliJ IDEA
*.iml
.idea
# VSCode
.vscode
# test with config in resources
tests/integration/crud/simple/simple_indexer/
# latency tracking
latency
MyIndexer/
MyMemMap/
original/
output/
# kubernetes testing
.pytest-kind
.kube
================================================
FILE: .pre-commit-config.yaml
================================================
repos:
- repo: https://github.com/ambv/black
rev: 22.3.0
hooks:
- id: black
types: [python]
exclude: ^(docs/|server/clip_server/resources/)
args:
- -S
- repo: https://github.com/asottile/blacken-docs
rev: v1.12.1
hooks:
- id: blacken-docs
args:
- -S
================================================
FILE: CHANGELOG.md
================================================
<a name=release-note-0-0-3></a>
## Release Note (`0.0.3`)
> Release time: 2022-03-23 21:42:16
🙇 We'd like to thank all contributors for this new release! In particular,
Han Xiao, Dmitry Kan, varshaneya, Ilya Usvyatsky, Nicko van Someren, George Gkotsis, Jhang, Changrui Zhang, DomHudson, Filip Bednárik, 🙇
### 🍹 Other Improvements
- [[```378d82b5```](https://github.com/jina-ai/clip-as-service/commit/378d82b5d20a627a7a32239ebd9b47cbd12a5f7a)] __-__ fix setup and release script (*Han Xiao*)
- [[```372de00f```](https://github.com/jina-ai/clip-as-service/commit/372de00f286565750cab51d6e33ca4d9471a2934)] __-__ fix workflow yaml config (*Han Xiao*)
- [[```11822f60```](https://github.com/jina-ai/clip-as-service/commit/11822f6050096a4ed1ca7bb9ee3c082deec56fb4)] __-__ fix image (*Han Xiao*)
- [[```78a6a8b9```](https://github.com/jina-ai/clip-as-service/commit/78a6a8b9de9cab353be63311facce670212de08d)] __-__ first commit (*Han Xiao*)
- [[```f5e42383```](https://github.com/jina-ai/clip-as-service/commit/f5e4238397ab76a1539bb6f22d5735f563ff187e)] __-__ update readme (*Han Xiao*)
- [[```c4790fbe```](https://github.com/jina-ai/clip-as-service/commit/c4790fbef902e8d3509d1229788cb81abcdc33d6)] __-__ modified the port 8001->8081 to match Vue.js demo (*Dmitry Kan*)
- [[```749c8e45```](https://github.com/jina-ai/clip-as-service/commit/749c8e45d301967dcaa8744ef846190ac86d2932)] __-__ update readme header (*Han Xiao*)
<a name=release-note-0-0-4></a>
## Release Note (`0.0.4`)
> Release time: 2022-03-23 21:45:59
🙇 We'd like to thank all contributors for this new release! In particular,
Han Xiao, Jina Dev Bot, 🙇
### 🍹 Other Improvements
- [[```f8936108```](https://github.com/jina-ai/clip-as-service/commit/f89361085bbe2715fd0d1c2d769389e0a46dc860)] __-__ fix setup and release script (*Han Xiao*)
- [[```d2e4cfbf```](https://github.com/jina-ai/clip-as-service/commit/d2e4cfbf1977db1cf0fee433600b48b0c3626312)] __-__ __version__: the next version will be 0.0.4 (*Jina Dev Bot*)
<a name=release-note-0-0-5></a>
## Release Note (`0.0.5`)
> Release time: 2022-03-23 22:09:18
🙇 We'd like to thank all contributors for this new release! In particular,
Han Xiao, Jina Dev Bot, 🙇
### 🍹 Other Improvements
- [[```7ed4643c```](https://github.com/jina-ai/clip-as-service/commit/7ed4643cc471a6433ee6cc8699617ae61978bcdb)] __-__ fix doc setup (*Han Xiao*)
- [[```fe09c32c```](https://github.com/jina-ai/clip-as-service/commit/fe09c32c8629b20ea9f677b7097556e33091876f)] __-__ __version__: the next version will be 0.0.5 (*Jina Dev Bot*)
- [[```f8936108```](https://github.com/jina-ai/clip-as-service/commit/f89361085bbe2715fd0d1c2d769389e0a46dc860)] __-__ fix setup and release script (*Han Xiao*)
<a name=release-note-0-0-6></a>
## Release Note (`0.0.6`)
> Release time: 2022-03-23 22:42:28
🙇 We'd like to thank all contributors for this new release! In particular,
Han Xiao, Jina Dev Bot, 🙇
### 🍹 Other Improvements
- [[```f7044fb2```](https://github.com/jina-ai/clip-as-service/commit/f7044fb2f9c81f5dbfb7fec7c12c6a3b0dd54fa6)] __-__ fix doc setup (*Han Xiao*)
- [[```c04eb30e```](https://github.com/jina-ai/clip-as-service/commit/c04eb30e8e09c89b1dd7061d0cb044286a1c5fc2)] __-__ __version__: the next version will be 0.0.6 (*Jina Dev Bot*)
<a name=release-note-0-0-7></a>
## Release Note (`0.0.7`)
> Release time: 2022-03-24 07:04:50
🙇 We'd like to thank all contributors for this new release! In particular,
Han Xiao, Jina Dev Bot, 🙇
### 🍹 Other Improvements
- [[```e8aa643a```](https://github.com/jina-ai/clip-as-service/commit/e8aa643a802fca900f2111407093107f22f08917)] __-__ update docs and license (*Han Xiao*)
- [[```7245f67a```](https://github.com/jina-ai/clip-as-service/commit/7245f67adf76e600762d8dbdbaee747764c0677c)] __-__ __version__: the next version will be 0.0.7 (*Jina Dev Bot*)
- [[```f7044fb2```](https://github.com/jina-ai/clip-as-service/commit/f7044fb2f9c81f5dbfb7fec7c12c6a3b0dd54fa6)] __-__ fix doc setup (*Han Xiao*)
<a name=release-note-0-1-0></a>
## Release Note (`0.1.0`)
> Release time: 2022-03-24 08:19:14
🙇 We'd like to thank all contributors for this new release! In particular,
Han Xiao, Jina Dev Bot, 🙇
### 📗 Documentation
- [[```fa9d50c2```](https://github.com/jina-ai/clip-as-service/commit/fa9d50c2395ea1e1e60a2a0fc9c0105df472bcdb)] __-__ fix readme (#656) (*Han Xiao*)
### 🍹 Other Improvements
- [[```1a2a2af9```](https://github.com/jina-ai/clip-as-service/commit/1a2a2af932717cc0da12667453cd00c58e6ee443)] __-__ bump version (*Han Xiao*)
- [[```44f4e52e```](https://github.com/jina-ai/clip-as-service/commit/44f4e52eba72d903883a827e115fb8dead69111f)] __-__ update docstring (*Han Xiao*)
- [[```12bf98aa```](https://github.com/jina-ai/clip-as-service/commit/12bf98aa5b098f9017af186642990d9f854c54d7)] __-__ __version__: the next version will be 0.0.8 (*Jina Dev Bot*)
- [[```e8aa643a```](https://github.com/jina-ai/clip-as-service/commit/e8aa643a802fca900f2111407093107f22f08917)] __-__ update docs and license (*Han Xiao*)
<a name=release-note-0-1-1></a>
## Release Note (`0.1.1`)
> Release time: 2022-03-24 09:03:13
🙇 We'd like to thank all contributors for this new release! In particular,
Han Xiao, Wang Bo, Jina Dev Bot, 🙇
### 🐞 Bug fixes
- [[```dd4cb3c3```](https://github.com/jina-ai/clip-as-service/commit/dd4cb3c3e142a8b8f702c4eee57a251aab7a10d5)] __-__ url description and keywords in setup (#657) (*Wang Bo*)
### 🍹 Other Improvements
- [[```1b679cdc```](https://github.com/jina-ai/clip-as-service/commit/1b679cdc8c657e872833f1344f19ed7d6bb57b0a)] __-__ fix banner (*Han Xiao*)
- [[```9e0a1058```](https://github.com/jina-ai/clip-as-service/commit/9e0a1058b77f33508a3dbdffabaacf3bb0c53cb4)] __-__ __version__: the next version will be 0.1.1 (*Jina Dev Bot*)
- [[```1a2a2af9```](https://github.com/jina-ai/clip-as-service/commit/1a2a2af932717cc0da12667453cd00c58e6ee443)] __-__ bump version (*Han Xiao*)
<a name=release-note-0-1-2></a>
## Release Note (`0.1.2`)
> Release time: 2022-03-24 10:57:53
🙇 We'd like to thank all contributors for this new release! In particular,
Han Xiao, Alex Cureton-Griffiths, Wang Bo, Jina Dev Bot, 🙇
### 🧼 Code Refactoring
- [[```715e8ba9```](https://github.com/jina-ai/clip-as-service/commit/715e8ba90faf1c58daed608cd02340404484a018)] __-__ remove unused main unify keywords (#658) (*Wang Bo*)
### 📗 Documentation
- [[```ff16ce1d```](https://github.com/jina-ai/clip-as-service/commit/ff16ce1db88bbac14cb19c05266b1286c224e65d)] __-__ __readme__: polish (#660) (*Alex Cureton-Griffiths*)
### 🍹 Other Improvements
- [[```0ec1fac2```](https://github.com/jina-ai/clip-as-service/commit/0ec1fac2a4f0c02a0cc704da9b2361e1d22108fa)] __-__ fix setup deps (*Han Xiao*)
- [[```59b154a7```](https://github.com/jina-ai/clip-as-service/commit/59b154a7358cfdf1449fab8a2855599b657ddf24)] __-__ __version__: the next version will be 0.1.2 (*Jina Dev Bot*)
- [[```1b679cdc```](https://github.com/jina-ai/clip-as-service/commit/1b679cdc8c657e872833f1344f19ed7d6bb57b0a)] __-__ fix banner (*Han Xiao*)
<a name=release-note-0-1-3></a>
## Release Note (`0.1.3`)
> Release time: 2022-03-24 13:03:30
🙇 We'd like to thank all contributors for this new release! In particular,
Han Xiao, Wang Bo, Jina Dev Bot, 🙇
### 🧼 Code Refactoring
- [[```ae4d0bac```](https://github.com/jina-ai/clip-as-service/commit/ae4d0bacbfadb57e1cb1de8a5f6adca5426e62d3)] __-__ remove inference model pytorch from onnx (#661) (*Wang Bo*)
### 🍹 Other Improvements
- [[```dece9dd0```](https://github.com/jina-ai/clip-as-service/commit/dece9dd0695bc418fc13fe9ed95ef52ba9f8f19d)] __-__ fix setup file (*Han Xiao*)
- [[```3d04e695```](https://github.com/jina-ai/clip-as-service/commit/3d04e69511098490b1e56e15640a6378df89ff04)] __-__ __version__: the next version will be 0.1.3 (*Jina Dev Bot*)
- [[```0ec1fac2```](https://github.com/jina-ai/clip-as-service/commit/0ec1fac2a4f0c02a0cc704da9b2361e1d22108fa)] __-__ fix setup deps (*Han Xiao*)
<a name=release-note-0-1-5></a>
## Release Note (`0.1.5`)
> Release time: 2022-03-24 19:17:54
🙇 We'd like to thank all contributors for this new release! In particular,
Han Xiao, Jina Dev Bot, 🙇
### 🍹 Other Improvements
- [[```989a706a```](https://github.com/jina-ai/clip-as-service/commit/989a706aa53271d9018ce48d9241e37887572025)] __-__ hide top-level setup (*Han Xiao*)
- [[```f07e0f57```](https://github.com/jina-ai/clip-as-service/commit/f07e0f57ab795688100d07c09564fe3680031a83)] __-__ __version__: the next version will be 0.1.4 (*Jina Dev Bot*)
- [[```dece9dd0```](https://github.com/jina-ai/clip-as-service/commit/dece9dd0695bc418fc13fe9ed95ef52ba9f8f19d)] __-__ fix setup file (*Han Xiao*)
<a name=release-note-0-1-6></a>
## Release Note (`0.1.6`)
> Release time: 2022-03-29 07:02:26
🙇 We'd like to thank all contributors for this new release! In particular,
Han Xiao, felix-wang, Jina Dev Bot, 🙇
### 🐞 Bug fixes
- [[```b4624dd4```](https://github.com/jina-ai/clip-as-service/commit/b4624dd408e0ee3908f57b7e5e598e5631de3d95)] __-__ __client__: raise value when embedding is empty (#666) (*Han Xiao*)
### 🍹 Other Improvements
- [[```16f8c403```](https://github.com/jina-ai/clip-as-service/commit/16f8c403a274961c3acd1ecddbef823dcea488b2)] __-__ fix typo (#664) (*felix-wang*)
- [[```da1dd85c```](https://github.com/jina-ai/clip-as-service/commit/da1dd85cba6bc72c4ff83fd0c00c2651eef56075)] __-__ hide top-level setup (*Han Xiao*)
- [[```fe22c3f2```](https://github.com/jina-ai/clip-as-service/commit/fe22c3f21ee180c7f74e1a996572b0eb04a36a6d)] __-__ __version__: the next version will be 0.1.6 (*Jina Dev Bot*)
<a name=release-note-0-1-7></a>
## Release Note (`0.1.7`)
> Release time: 2022-03-30 11:40:37
🙇 We'd like to thank all contributors for this new release! In particular,
Han Xiao, Roshan Jossy, Jina Dev Bot, 🙇
### 🆕 New Features
- [[```d56b1463```](https://github.com/jina-ai/clip-as-service/commit/d56b146392c16d7f917b3a6baeba9d6b77121249)] __-__ __client__: more comprehensive progressbar (#667) (*Han Xiao*)
### 🐞 Bug fixes
- [[```b4624dd4```](https://github.com/jina-ai/clip-as-service/commit/b4624dd408e0ee3908f57b7e5e598e5631de3d95)] __-__ __client__: raise value when embedding is empty (#666) (*Han Xiao*)
### 📗 Documentation
- [[```cfaba711```](https://github.com/jina-ai/clip-as-service/commit/cfaba7119c334d87a5f7860cc4df65a52f19c750)] __-__ __tracking__: add scarf tracking (#665) (*Roshan Jossy*)
### 🍹 Other Improvements
- [[```9e276744```](https://github.com/jina-ai/clip-as-service/commit/9e27674447d041c21078082478acc234d5c0e3f7)] __-__ fix readme (*Han Xiao*)
- [[```1c2de8da```](https://github.com/jina-ai/clip-as-service/commit/1c2de8da0ac3cfa7fa7304f6c55b4979747f22a5)] __-__ __version__: the next version will be 0.1.7 (*Jina Dev Bot*)
<a name=release-note-0-1-8></a>
## Release Note (`0.1.8`)
> Release time: 2022-03-30 14:30:36
🙇 We'd like to thank all contributors for this new release! In particular,
Han Xiao, Jina Dev Bot, 🙇
### 🆕 New Features
- [[```d56b1463```](https://github.com/jina-ai/clip-as-service/commit/d56b146392c16d7f917b3a6baeba9d6b77121249)] __-__ __client__: more comprehensive progressbar (#667) (*Han Xiao*)
### 🧼 Code Refactoring
- [[```065d6a91```](https://github.com/jina-ai/clip-as-service/commit/065d6a910e44a31718463a51ba0e3c29ca926d1c)] __-__ __client__: use docarray pbar (#668) (*Han Xiao*)
### 🍹 Other Improvements
- [[```dd61bdce```](https://github.com/jina-ai/clip-as-service/commit/dd61bdce6f6e908a6a583106d1c51ca5725b1ad4)] __-__ update readme (*Han Xiao*)
- [[```be5fff81```](https://github.com/jina-ai/clip-as-service/commit/be5fff8129628d069e8d2992705f5f8b4681e040)] __-__ __version__: the next version will be 0.1.8 (*Jina Dev Bot*)
<a name=release-note-0-1-9></a>
## Release Note (`0.1.9`)
> Release time: 2022-03-30 23:20:09
🙇 We'd like to thank all contributors for this new release! In particular,
Han Xiao, Jina Dev Bot, 🙇
### ⚡ Performance Improvements
- [[```88123432```](https://github.com/jina-ai/clip-as-service/commit/8812343211701fd93b75dab9f5b86bd5bc9e6819)] __-__ __server__: use map_batch to overlap cpu gpu (#669) (*Han Xiao*)
### 🍹 Other Improvements
- [[```41b93773```](https://github.com/jina-ai/clip-as-service/commit/41b937732a4f241e22ef9089071e9c7b611a6674)] __-__ fix readme (*Han Xiao*)
- [[```da3227d3```](https://github.com/jina-ai/clip-as-service/commit/da3227d3b3df984a2816dbea283c209020b0815a)] __-__ update readme (*Han Xiao*)
- [[```431d4635```](https://github.com/jina-ai/clip-as-service/commit/431d46353c3382ff954fc05bc8397f3e560a7ac7)] __-__ __version__: the next version will be 0.1.9 (*Jina Dev Bot*)
<a name=release-note-0-1-10></a>
## Release Note (`0.1.10`)
> Release time: 2022-03-31 10:31:26
🙇 We'd like to thank all contributors for this new release! In particular,
Han Xiao, Jina Dev Bot, 🙇
### ⚡ Performance Improvements
- [[```962a1b5c```](https://github.com/jina-ai/clip-as-service/commit/962a1b5ce92249d98e4850e0af003d63b95a3f9d)] __-__ __server__: reuse the preprocessing pool (#670) (*Han Xiao*)
- [[```88123432```](https://github.com/jina-ai/clip-as-service/commit/8812343211701fd93b75dab9f5b86bd5bc9e6819)] __-__ __server__: use map_batch to overlap cpu gpu (#669) (*Han Xiao*)
### 🍹 Other Improvements
- [[```f0dfc34a```](https://github.com/jina-ai/clip-as-service/commit/f0dfc34adca3c3d7b9879ac518735dd929074e80)] __-__ __version__: the next version will be 0.1.10 (*Jina Dev Bot*)
<a name=release-note-0-1-11></a>
## Release Note (`0.1.11`)
> Release time: 2022-04-01 15:46:07
🙇 We'd like to thank all contributors for this new release! In particular,
Han Xiao, Jina Dev Bot, 🙇
### ⚡ Performance Improvements
- [[```962a1b5c```](https://github.com/jina-ai/clip-as-service/commit/962a1b5ce92249d98e4850e0af003d63b95a3f9d)] __-__ __server__: reuse the preprocessing pool (#670) (*Han Xiao*)
### 📗 Documentation
- [[```257f0393```](https://github.com/jina-ai/clip-as-service/commit/257f03931d28a0d9020a3381495a41df1185fd9c)] __-__ add http endpoint explain (#671) (*Han Xiao*)
### 🍹 Other Improvements
- [[```2e9e212f```](https://github.com/jina-ai/clip-as-service/commit/2e9e212f0d9501c7d55d0fd8dd82c180a067ca89)] __-__ add demo server (*Han Xiao*)
- [[```99133924```](https://github.com/jina-ai/clip-as-service/commit/991339248bb3d7e9b6a741f2cf456f7f8bade154)] __-__ __version__: the next version will be 0.1.11 (*Jina Dev Bot*)
<a name=release-note-0-1-12></a>
## Release Note (`0.1.12`)
> Release time: 2022-04-07 02:20:52
🙇 We'd like to thank all contributors for this new release! In particular,
felix-wang, samsja, Han Xiao, Jina Dev Bot, 🙇
### 🆕 New Features
- [[```ffc4bdc4```](https://github.com/jina-ai/clip-as-service/commit/ffc4bdc4e2414fa0aff67bb5cbaffd4077a7c8f4)] __-__ gitignore (#673) (*samsja*)
### 🐞 Bug fixes
- [[```aeb64c08```](https://github.com/jina-ai/clip-as-service/commit/aeb64c082d4819ab9330ba65f57f13ba2a868268)] __-__ ignore onnxruntime-gpu on macos (#675) (*felix-wang*)
### 📗 Documentation
- [[```257f0393```](https://github.com/jina-ai/clip-as-service/commit/257f03931d28a0d9020a3381495a41df1185fd9c)] __-__ add http endpoint explain (#671) (*Han Xiao*)
### 🍹 Other Improvements
- [[```e2b2ae8b```](https://github.com/jina-ai/clip-as-service/commit/e2b2ae8bb96ce8602f9808c01e9a1712b7cdf7ac)] __-__ update readme (*Han Xiao*)
- [[```d7aa1615```](https://github.com/jina-ai/clip-as-service/commit/d7aa161503ed72e662f8efe477af702e8759375e)] __-__ __version__: the next version will be 0.1.12 (*Jina Dev Bot*)
<a name=release-note-0-1-13></a>
## Release Note (`0.1.13`)
> Release time: 2022-04-11 08:02:20
🙇 We'd like to thank all contributors for this new release! In particular,
Han Xiao, Jina Dev Bot, felix-wang, 🙇
### 🆕 New Features
- [[```8b800eea```](https://github.com/jina-ai/clip-as-service/commit/8b800eea5d40d02417a4368fcc38ac58dc2d651d)] __-__ __server__: allow client sending tensor document (#678) (*Han Xiao*)
### 🐞 Bug fixes
- [[```aeb64c08```](https://github.com/jina-ai/clip-as-service/commit/aeb64c082d4819ab9330ba65f57f13ba2a868268)] __-__ ignore onnxruntime-gpu on macos (#675) (*felix-wang*)
### 📗 Documentation
- [[```b6f9d849```](https://github.com/jina-ai/clip-as-service/commit/b6f9d849e5693d6c40744feebd5d309dbeed1cb3)] __-__ __server__: docs document tensor (#679) (*Han Xiao*)
### 🍹 Other Improvements
- [[```fa42dc50```](https://github.com/jina-ai/clip-as-service/commit/fa42dc50f6c766c60fe246802ecc8c15e37fbdf4)] __-__ update docs (*Han Xiao*)
- [[```c91fa4d1```](https://github.com/jina-ai/clip-as-service/commit/c91fa4d16fd01ba8cc571041919201bbb1a76e31)] __-__ __version__: the next version will be 0.1.13 (*Jina Dev Bot*)
<a name=release-note-0-1-14></a>
## Release Note (`0.1.14`)
> Release time: 2022-04-14 02:39:16
🙇 We'd like to thank all contributors for this new release! In particular,
felix-wang, Jina Dev Bot, Han Xiao, 🙇
### 🐞 Bug fixes
- [[```8286eeed```](https://github.com/jina-ai/clip-as-service/commit/8286eeed13e65b7414e7bff0ace689daac103101)] __-__ tensor input document (#681) (*felix-wang*)
### 📗 Documentation
- [[```b6f9d849```](https://github.com/jina-ai/clip-as-service/commit/b6f9d849e5693d6c40744feebd5d309dbeed1cb3)] __-__ __server__: docs document tensor (#679) (*Han Xiao*)
### 🍹 Other Improvements
- [[```ef6ea254```](https://github.com/jina-ai/clip-as-service/commit/ef6ea254b48d2675364184c3cfcb787819e8433a)] __-__ __version__: the next version will be 0.1.14 (*Jina Dev Bot*)
<a name=release-note-0-1-15></a>
## Release Note (`0.1.15`)
> Release time: 2022-04-18 04:07:21
🙇 We'd like to thank all contributors for this new release! In particular,
felix-wang, Han Xiao, Jina Dev Bot, 🙇
### ⚡ Performance Improvements
- [[```10d53eb4```](https://github.com/jina-ai/clip-as-service/commit/10d53eb4c4b84c95412b5f904de705cc01d7ba89)] __-__ scalable benchmark (#680) (*felix-wang*)
### 🐞 Bug fixes
- [[```8286eeed```](https://github.com/jina-ai/clip-as-service/commit/8286eeed13e65b7414e7bff0ace689daac103101)] __-__ tensor input document (#681) (*felix-wang*)
### 🍹 Other Improvements
- [[```fb229ae8```](https://github.com/jina-ai/clip-as-service/commit/fb229ae81f708d00f01af2d791de6eb67174e1c7)] __-__ add jcloud logo (*Han Xiao*)
- [[```a3891eed```](https://github.com/jina-ai/clip-as-service/commit/a3891eedfa88e92f4a730f94b897da79ec28848d)] __-__ fix readme (*Han Xiao*)
- [[```bfd04706```](https://github.com/jina-ai/clip-as-service/commit/bfd047061d7465877503caa3f11f77065718cbc4)] __-__ __version__: the next version will be 0.1.15 (*Jina Dev Bot*)
<a name=release-note-0-2-0></a>
## Release Note (`0.2.0`)
> Release time: 2022-04-18 04:27:56
🙇 We'd like to thank all contributors for this new release! In particular,
numb3r3, Jina Dev Bot, felix-wang, 🙇
### ⚡ Performance Improvements
- [[```10d53eb4```](https://github.com/jina-ai/clip-as-service/commit/10d53eb4c4b84c95412b5f904de705cc01d7ba89)] __-__ scalable benchmark (#680) (*felix-wang*)
### 🍹 Other Improvements
- [[```67226f5c```](https://github.com/jina-ai/clip-as-service/commit/67226f5c8ec7d652f5d47ed0ab21dc8d14fc49c8)] __-__ bump version (*numb3r3*)
- [[```5dc64878```](https://github.com/jina-ai/clip-as-service/commit/5dc6487819483ee680cf6e4c6a5fd1c0c27e2b54)] __-__ __version__: the next version will be 0.1.16 (*Jina Dev Bot*)
<a name=release-note-0-2-1></a>
## Release Note (`0.2.1`)
> Release time: 2022-04-21 15:32:35
🙇 We'd like to thank all contributors for this new release! In particular,
felix-wang, Han Xiao, Jina Dev Bot, numb3r3, 🙇
### 🐞 Bug fixes
- [[```2558d738```](https://github.com/jina-ai/clip-as-service/commit/2558d7388a6ebdbfa99e489d9d005d9e1c22c33a)] __-__ pass extra_search path (#687) (*felix-wang*)
- [[```71e9ebc8```](https://github.com/jina-ai/clip-as-service/commit/71e9ebc89a27b9ed64def3b6968b78c4ea1c3256)] __-__ remove process backend (#685) (*felix-wang*)
- [[```65ad956d```](https://github.com/jina-ai/clip-as-service/commit/65ad956dab7e4f011568ac14357d636312dd4f5e)] __-__ use one iteration step (#683) (*felix-wang*)
### 🍹 Other Improvements
- [[```e3d4e918```](https://github.com/jina-ai/clip-as-service/commit/e3d4e9181b645dfebd23620e153d86c563d38c9b)] __-__ update readme (*Han Xiao*)
- [[```ec3a700c```](https://github.com/jina-ai/clip-as-service/commit/ec3a700c632dba97c01529c0049c383d68636aa8)] __-__ update docs (#684) (*felix-wang*)
- [[```11487cee```](https://github.com/jina-ai/clip-as-service/commit/11487ceec184fbcf93c0c1debedbf22d097d9254)] __-__ __version__: the next version will be 0.2.1 (*Jina Dev Bot*)
- [[```67226f5c```](https://github.com/jina-ai/clip-as-service/commit/67226f5c8ec7d652f5d47ed0ab21dc8d14fc49c8)] __-__ bump version (*numb3r3*)
<a name=release-note-0-2-2></a>
## Release Note (`0.2.2`)
> Release time: 2022-04-24 07:28:34
🙇 We'd like to thank all contributors for this new release! In particular,
felix-wang, Jina Dev Bot, 🙇
### 🐞 Bug fixes
- [[```3bd74641```](https://github.com/jina-ai/clip-as-service/commit/3bd74641e52a48d9b1bac15554c8e42050d47094)] __-__ download with resume (#689) (*felix-wang*)
- [[```2558d738```](https://github.com/jina-ai/clip-as-service/commit/2558d7388a6ebdbfa99e489d9d005d9e1c22c33a)] __-__ pass extra_search path (#687) (*felix-wang*)
### 🍹 Other Improvements
- [[```6eadbfba```](https://github.com/jina-ai/clip-as-service/commit/6eadbfbac798c72b0319071b3f9c8480f97155d8)] __-__ __version__: the next version will be 0.2.2 (*Jina Dev Bot*)
<a name=release-note-0-2-3></a>
## Release Note (`0.2.3`)
> Release time: 2022-04-25 11:42:51
🙇 We'd like to thank all contributors for this new release! In particular,
Han Xiao, Jina Dev Bot, felix-wang, 🙇
### 🆕 New Features
- [[```0ebc4c03```](https://github.com/jina-ai/clip-as-service/commit/0ebc4c0363aa182d2992bbc11bbcf676aeaf69df)] __-__ __server__: add rank endpoint (#694) (*Han Xiao*)
### 🐞 Bug fixes
- [[```3bd74641```](https://github.com/jina-ai/clip-as-service/commit/3bd74641e52a48d9b1bac15554c8e42050d47094)] __-__ download with resume (#689) (*felix-wang*)
### 🍹 Other Improvements
- [[```22cfffaf```](https://github.com/jina-ai/clip-as-service/commit/22cfffaffbd73d1d15afd87d08e2bb62bb2acbdc)] __-__ __version__: the next version will be 0.2.3 (*Jina Dev Bot*)
<a name=release-note-0-3-0></a>
## Release Note (`0.3.0`)
> Release time: 2022-04-25 15:13:21
🙇 We'd like to thank all contributors for this new release! In particular,
Han Xiao, Jina Dev Bot, 🙇
### 🆕 New Features
- [[```b7270862```](https://github.com/jina-ai/clip-as-service/commit/b7270862e353b73531cd8bff4735d537c905a312)] __-__ __client__: add rank endpoint (#695) (*Han Xiao*)
- [[```0ebc4c03```](https://github.com/jina-ai/clip-as-service/commit/0ebc4c0363aa182d2992bbc11bbcf676aeaf69df)] __-__ __server__: add rank endpoint (#694) (*Han Xiao*)
### 🍹 Other Improvements
- [[```8600286c```](https://github.com/jina-ai/clip-as-service/commit/8600286cf53755c127cf258af918b6bdf3e86691)] __-__ update readme (*Han Xiao*)
- [[```5e1dd607```](https://github.com/jina-ai/clip-as-service/commit/5e1dd607e47a94265f48cbb2a70406c5057b86fa)] __-__ __version__: the next version will be 0.2.4 (*Jina Dev Bot*)
<a name=release-note-0-3-1></a>
## Release Note (`0.3.1`)
> Release time: 2022-04-26 08:03:08
🙇 We'd like to thank all contributors for this new release! In particular,
Han Xiao, Jina Dev Bot, 🙇
### 🆕 New Features
- [[```ca5f3021```](https://github.com/jina-ai/clip-as-service/commit/ca5f30211d87fc324e9cfffb3fcc89682a233ba8)] __-__ __helper__: add version check for client and server (#696) (*Han Xiao*)
### 🍹 Other Improvements
- [[```234650f4```](https://github.com/jina-ai/clip-as-service/commit/234650f48a1e59cd274748f98ae84f6648b811af)] __-__ __version__: the next version will be 0.3.1 (*Jina Dev Bot*)
- [[```8600286c```](https://github.com/jina-ai/clip-as-service/commit/8600286cf53755c127cf258af918b6bdf3e86691)] __-__ update readme (*Han Xiao*)
<a name=release-note-0-3-2></a>
## Release Note (`0.3.2`)
> Release time: 2022-04-26 09:16:04
🙇 We'd like to thank all contributors for this new release! In particular,
Han Xiao, Jina Dev Bot, 🙇
### 🆕 New Features
- [[```f5ba35ab```](https://github.com/jina-ai/clip-as-service/commit/f5ba35abf37a5d140f2e8491cb0dcab13c25869f)] __-__ __helper__: add version check for client and server (*Han Xiao*)
- [[```ca5f3021```](https://github.com/jina-ai/clip-as-service/commit/ca5f30211d87fc324e9cfffb3fcc89682a233ba8)] __-__ __helper__: add version check for client and server (#696) (*Han Xiao*)
### 🍹 Other Improvements
- [[```27ffd856```](https://github.com/jina-ai/clip-as-service/commit/27ffd85623407033de72ad259a725848b3412822)] __-__ __version__: the next version will be 0.3.2 (*Jina Dev Bot*)
<a name=release-note-0-3-3></a>
## Release Note (`0.3.3`)
> Release time: 2022-04-26 09:38:17
🙇 We'd like to thank all contributors for this new release! In particular,
Han Xiao, Jina Dev Bot, 🙇
### 🆕 New Features
- [[```076d6537```](https://github.com/jina-ai/clip-as-service/commit/076d65378b3653dc9f1213f398d1d70824e67513)] __-__ __helper__: add version check for client and server (*Han Xiao*)
### 🍹 Other Improvements
- [[```9bcbb1f9```](https://github.com/jina-ai/clip-as-service/commit/9bcbb1f9147aa3dda857a5a130b531e88f27baf2)] __-__ __version__: the next version will be 0.3.3 (*Jina Dev Bot*)
<a name=release-note-0-3-4></a>
## Release Note (`0.3.4`)
> Release time: 2022-04-30 15:17:02
🙇 We'd like to thank all contributors for this new release! In particular,
Han Xiao, Jina Dev Bot, 🙇
### 🆕 New Features
- [[```076d6537```](https://github.com/jina-ai/clip-as-service/commit/076d65378b3653dc9f1213f398d1d70824e67513)] __-__ __helper__: add version check for client and server (*Han Xiao*)
### 🐞 Bug fixes
- [[```8ac2e9bb```](https://github.com/jina-ai/clip-as-service/commit/8ac2e9bb68b96d1421f7e2ae6b01cec95aad3183)] __-__ __torch__: fix oom in rerank endpoint (#699) (*Han Xiao*)
### 🍹 Other Improvements
- [[```dd508167```](https://github.com/jina-ai/clip-as-service/commit/dd5081672718a12e7aeede0400432e8f6a01a744)] __-__ __version__: the next version will be 0.3.4 (*Jina Dev Bot*)
<a name=release-note-0-3-5></a>
## Release Note (`0.3.5`)
> Release time: 2022-04-30 18:55:10
🙇 We'd like to thank all contributors for this new release! In particular,
Han Xiao, Jina Dev Bot, 🙇
### 🐞 Bug fixes
- [[```8ac2e9bb```](https://github.com/jina-ai/clip-as-service/commit/8ac2e9bb68b96d1421f7e2ae6b01cec95aad3183)] __-__ __torch__: fix oom in rerank endpoint (#699) (*Han Xiao*)
### 🧼 Code Refactoring
- [[```050c34e0```](https://github.com/jina-ai/clip-as-service/commit/050c34e0906f9593aee054ac37a0a830478a3a3b)] __-__ use packaging instead of distutil (#700) (*Han Xiao*)
### 🍹 Other Improvements
- [[```d2c2c872```](https://github.com/jina-ai/clip-as-service/commit/d2c2c8729e0872b0c5e299916ae8cf58be7ec516)] __-__ __version__: the next version will be 0.3.5 (*Jina Dev Bot*)
<a name=release-note-0-4-0></a>
## Release Note (`0.4.0`)
> Release time: 2022-04-30 20:25:29
🙇 We'd like to thank all contributors for this new release! In particular,
Han Xiao, Jina Dev Bot, 🙇
### 🆕 New Features
- [[```33efcb00```](https://github.com/jina-ai/clip-as-service/commit/33efcb00414f6cbf5f860bafe7cc183773e08241)] __-__ add async rerank (#701) (*Han Xiao*)
- [[```12d33c49```](https://github.com/jina-ai/clip-as-service/commit/12d33c49d5ac4d55a7351a442335f25218661dc8)] __-__ add async rerank (*Han Xiao*)
### 🧼 Code Refactoring
- [[```050c34e0```](https://github.com/jina-ai/clip-as-service/commit/050c34e0906f9593aee054ac37a0a830478a3a3b)] __-__ use packaging instead of distutil (#700) (*Han Xiao*)
### 🍹 Other Improvements
- [[```20e66b95```](https://github.com/jina-ai/clip-as-service/commit/20e66b953af17480e062a8e84719b5a6823ba648)] __-__ __version__: the next version will be 0.3.6 (*Jina Dev Bot*)
<a name=release-note-0-4-1></a>
## Release Note (`0.4.1`)
> Release time: 2022-05-04 17:38:48
🙇 We'd like to thank all contributors for this new release! In particular,
felix-wang, Han Xiao, Jina Dev Bot, 🙇
### 🆕 New Features
- [[```f66b145b```](https://github.com/jina-ai/clip-as-service/commit/f66b145be9a19b64e6404665fce8ff5c14b9552b)] __-__ add ranker endpoint for all backends (#707) (*felix-wang*)
- [[```f7b9af40```](https://github.com/jina-ai/clip-as-service/commit/f7b9af40c3bb693ca70faddfcbc49d07d287df62)] __-__ add tensorrt support (#688) (*felix-wang*)
- [[```33efcb00```](https://github.com/jina-ai/clip-as-service/commit/33efcb00414f6cbf5f860bafe7cc183773e08241)] __-__ add async rerank (#701) (*Han Xiao*)
### 🐞 Bug fixes
- [[```618dbdb2```](https://github.com/jina-ai/clip-as-service/commit/618dbdb2cfe7a765c3748708bf6b16560175ca51)] __-__ cd workflow (#706) (*felix-wang*)
### 🍹 Other Improvements
- [[```3f34d46d```](https://github.com/jina-ai/clip-as-service/commit/3f34d46d662998ae39f7bfe50aface9a9582bb0c)] __-__ __docs__: add cas async usage to readme (*Han Xiao*)
- [[```0f941660```](https://github.com/jina-ai/clip-as-service/commit/0f941660a78879a8eea5846ecb4f7c2dabf0f34c)] __-__ __version__: the next version will be 0.4.1 (*Jina Dev Bot*)
<a name=release-note-0-4-2></a>
## Release Note (`0.4.2`)
> Release time: 2022-05-09 05:32:39
🙇 We'd like to thank all contributors for this new release! In particular,
felix-wang, Han Xiao, Jina Dev Bot, 🙇
### 🆕 New Features
- [[```f66b145b```](https://github.com/jina-ai/clip-as-service/commit/f66b145be9a19b64e6404665fce8ff5c14b9552b)] __-__ add ranker endpoint for all backends (#707) (*felix-wang*)
### 🐞 Bug fixes
- [[```835eb13f```](https://github.com/jina-ai/clip-as-service/commit/835eb13fcb84d126b6a35e18b2fe0ef9d8b835b7)] __-__ use cosine as the rank score (#708) (*felix-wang*)
### 🍹 Other Improvements
- [[```706fa624```](https://github.com/jina-ai/clip-as-service/commit/706fa624cb567857e6bc024f52c93a10ab410651)] __-__ __docs__: update readme (*Han Xiao*)
- [[```7fd04d2d```](https://github.com/jina-ai/clip-as-service/commit/7fd04d2d65dc033ccdec3b970046692816a84880)] __-__ __docs__: add cas async usage to readme (*Han Xiao*)
- [[```90bb4c5c```](https://github.com/jina-ai/clip-as-service/commit/90bb4c5c70c5e51a1c29bf5aed2906d284c077f7)] __-__ __version__: the next version will be 0.4.2 (*Jina Dev Bot*)
<a name=release-note-0-4-3></a>
## Release Note (`0.4.3`)
> Release time: 2022-05-09 10:23:15
🙇 We'd like to thank all contributors for this new release! In particular,
felix-wang, Roshan Jossy, Han Xiao, Jina Dev Bot, 🙇
### 🐞 Bug fixes
- [[```bb520d14```](https://github.com/jina-ai/clip-as-service/commit/bb520d14b6c5172fce9a971b51c4125b60418119)] __-__ keep logit_scale on same device (#710) (*felix-wang*)
- [[```835eb13f```](https://github.com/jina-ai/clip-as-service/commit/835eb13fcb84d126b6a35e18b2fe0ef9d8b835b7)] __-__ use cosine as the rank score (#708) (*felix-wang*)
### 📗 Documentation
- [[```da87d13a```](https://github.com/jina-ai/clip-as-service/commit/da87d13a753cdb394fe24a00af7e02f0dcc5fa00)] __-__ __tracking__: update external links' source (#711) (*Roshan Jossy*)
### 🍹 Other Improvements
- [[```099e2218```](https://github.com/jina-ai/clip-as-service/commit/099e2218a47bacb73afed2a7739b58f4e56c7c68)] __-__ __docs__: update readme (*Han Xiao*)
- [[```ce5806d3```](https://github.com/jina-ai/clip-as-service/commit/ce5806d33ccad1ef83106900b44da3e85eb0ce64)] __-__ update index html (#709) (*felix-wang*)
- [[```a1651079```](https://github.com/jina-ai/clip-as-service/commit/a16510799b648beb29bd422cdddc1e5dee5db061)] __-__ __version__: the next version will be 0.4.3 (*Jina Dev Bot*)
<a name=release-note-0-4-4></a>
## Release Note (`0.4.4`)
> Release time: 2022-05-11 12:00:46
🙇 We'd like to thank all contributors for this new release! In particular,
Han Xiao, felix-wang, Jina Dev Bot, 🙇
### 🆕 New Features
- [[```edf0d862```](https://github.com/jina-ai/clip-as-service/commit/edf0d862228fb69ed7aa25e6ac71a322494c3c29)] __-__ add dockerfiles and cd workflow (#712) (*felix-wang*)
### 🐞 Bug fixes
- [[```bb520d14```](https://github.com/jina-ai/clip-as-service/commit/bb520d14b6c5172fce9a971b51c4125b60418119)] __-__ keep logit_scale on same device (#710) (*felix-wang*)
### 🧼 Code Refactoring
- [[```59c06986```](https://github.com/jina-ai/clip-as-service/commit/59c06986387b59c0f536af08d0f6abed71cd7a41)] __-__ __server__: remove redundant logics of rank (#715) (*Han Xiao*)
### 🍹 Other Improvements
- [[```72d69c75```](https://github.com/jina-ai/clip-as-service/commit/72d69c75be20cc8126f9c406cb621d349b87ba3c)] __-__ __docs__: update readme (*Han Xiao*)
- [[```f898c8ce```](https://github.com/jina-ai/clip-as-service/commit/f898c8ce73ea3884037b900ca45fda4a477efdce)] __-__ __version__: the next version will be 0.4.4 (*Jina Dev Bot*)
<a name=release-note-0-4-5></a>
## Release Note (`0.4.5`)
> Release time: 2022-05-11 12:10:29
🙇 We'd like to thank all contributors for this new release! In particular,
Han Xiao, Jina Dev Bot, 🙇
### 🐞 Bug fixes
- [[```6ed4c484```](https://github.com/jina-ai/clip-as-service/commit/6ed4c484346e16846e0076d7bf99388c858581be)] __-__ convert distance to score (*Han Xiao*)
### 🧼 Code Refactoring
- [[```59c06986```](https://github.com/jina-ai/clip-as-service/commit/59c06986387b59c0f536af08d0f6abed71cd7a41)] __-__ __server__: remove redundant logics of rank (#715) (*Han Xiao*)
### 🍹 Other Improvements
- [[```d565d31f```](https://github.com/jina-ai/clip-as-service/commit/d565d31f80e4a289529477159eba07161c6c6066)] __-__ __version__: the next version will be 0.4.5 (*Jina Dev Bot*)
<a name=release-note-0-4-6></a>
## Release Note (`0.4.6`)
> Release time: 2022-05-11 15:10:52
🙇 We'd like to thank all contributors for this new release! In particular,
Han Xiao, Jina Dev Bot, 🙇
### ⚡ Performance Improvements
- [[```cda93fdd```](https://github.com/jina-ai/clip-as-service/commit/cda93fdd648a64f16bd9f194079e3e9220629af2)] __-__ __server__: use await gather in rank function (*Han Xiao*)
### 🐞 Bug fixes
- [[```6ed4c484```](https://github.com/jina-ai/clip-as-service/commit/6ed4c484346e16846e0076d7bf99388c858581be)] __-__ convert distance to score (*Han Xiao*)
### 🍹 Other Improvements
- [[```06fcd07b```](https://github.com/jina-ai/clip-as-service/commit/06fcd07bcf208753de15f051339fd48a0e8186f9)] __-__ __version__: the next version will be 0.4.6 (*Jina Dev Bot*)
<a name=release-note-0-4-7></a>
## Release Note (`0.4.7`)
> Release time: 2022-05-11 16:25:08
🙇 We'd like to thank all contributors for this new release! In particular,
Han Xiao, Jina Dev Bot, 🙇
### ⚡ Performance Improvements
- [[```72f1bc4a```](https://github.com/jina-ai/clip-as-service/commit/72f1bc4af0bc6ad01e645a889fd8ee505f986b42)] __-__ __server__: use await gather in rank function (#716) (*Han Xiao*)
- [[```cda93fdd```](https://github.com/jina-ai/clip-as-service/commit/cda93fdd648a64f16bd9f194079e3e9220629af2)] __-__ __server__: use await gather in rank function (*Han Xiao*)
### 🍹 Other Improvements
- [[```66b14fc6```](https://github.com/jina-ai/clip-as-service/commit/66b14fc6f7e8abd3322d0a9e8e0bdfe942d187d3)] __-__ __version__: the next version will be 0.4.7 (*Jina Dev Bot*)
<a name=release-note-0-4-8></a>
## Release Note (`0.4.8`)
> Release time: 2022-05-13 09:24:42
🙇 We'd like to thank all contributors for this new release! In particular,
Han Xiao, numb3r3, felix-wang, Jina Dev Bot, 🙇
### ⚡ Performance Improvements
- [[```72f1bc4a```](https://github.com/jina-ai/clip-as-service/commit/72f1bc4af0bc6ad01e645a889fd8ee505f986b42)] __-__ __server__: use await gather in rank function (#716) (*Han Xiao*)
### 🐞 Bug fixes
- [[```65991a3f```](https://github.com/jina-ai/clip-as-service/commit/65991a3f9126b19c99f21e44cd3dd4227cbe80c7)] __-__ __client__: fix https args to tls (#722) (*Han Xiao*)
- [[```1002a913```](https://github.com/jina-ai/clip-as-service/commit/1002a9132120dbf52a0dd4700c740692c959a422)] __-__ docker release cd (#717) (*felix-wang*)
- [[```71d2c867```](https://github.com/jina-ai/clip-as-service/commit/71d2c867b5d45c8dfe42872b7e5697793be79f4b)] __-__ docker build push (#714) (*felix-wang*)
### 🏁 Unit Test and CICD
- [[```38043676```](https://github.com/jina-ai/clip-as-service/commit/3804367632cccdc1f7fa1f5fc998f3530e1ee05c)] __-__ fix force release (*numb3r3*)
### 🍹 Other Improvements
- [[```0da311e4```](https://github.com/jina-ai/clip-as-service/commit/0da311e4113b0afb60cb16779d86c48399c86f24)] __-__ __docs__: change http to https (*Han Xiao*)
- [[```741ad796```](https://github.com/jina-ai/clip-as-service/commit/741ad796be93df808a634a41105f2860751afc2d)] __-__ __docs__: add playground (*Han Xiao*)
- [[```a2b6d337```](https://github.com/jina-ai/clip-as-service/commit/a2b6d33738f3cea55e429db21691534c62c08320)] __-__ __version__: the next version will be 0.4.8 (*Jina Dev Bot*)
<a name=release-note-0-4-9></a>
## Release Note (`0.4.9`)
> Release time: 2022-05-23 15:13:23
🙇 We'd like to thank all contributors for this new release! In particular,
Han Xiao, numb3r3, felix-wang, Jina Dev Bot, 🙇
### 🐞 Bug fixes
- [[```a7311fbf```](https://github.com/jina-ai/clip-as-service/commit/a7311fbf6ae6e988b78924fea239a9c8236dd8ff)] __-__ __server__: recover original contents of the input da (#726) (*Han Xiao*)
- [[```42ef75b1```](https://github.com/jina-ai/clip-as-service/commit/42ef75b185369c1ffd64f8ea5a7b0fca8c8656b2)] __-__ __server__: remove embeddings to save bandwidth (*Han Xiao*)
- [[```2d2da147```](https://github.com/jina-ai/clip-as-service/commit/2d2da147c3781233dc3812e2e7dfebbcbeb5f20e)] __-__ docker push cd (*numb3r3*)
- [[```994635fa```](https://github.com/jina-ai/clip-as-service/commit/994635fabc84293b05adff123263a0d276812202)] __-__ k8s dockerize (#725) (*felix-wang*)
- [[```d12c5115```](https://github.com/jina-ai/clip-as-service/commit/d12c5115c946497b4ddf03a759a63c4040bcf8c7)] __-__ docker file (#719) (*felix-wang*)
- [[```65991a3f```](https://github.com/jina-ai/clip-as-service/commit/65991a3f9126b19c99f21e44cd3dd4227cbe80c7)] __-__ __client__: fix https args to tls (#722) (*Han Xiao*)
### 🍹 Other Improvements
- [[```b6adcf8b```](https://github.com/jina-ai/clip-as-service/commit/b6adcf8be6a087d446e833478a0ac05a7900c24b)] __-__ __docs__: add multi gpu setting (*Han Xiao*)
- [[```3d8c552a```](https://github.com/jina-ai/clip-as-service/commit/3d8c552a721a52fb374f73fcc9725f7d06e2383f)] __-__ __version__: the next version will be 0.4.9 (*Jina Dev Bot*)
<a name=release-note-0-4-10></a>
## Release Note (`0.4.10`)
> Release time: 2022-05-24 07:46:48
🙇 We'd like to thank all contributors for this new release! In particular,
Han Xiao, Jina Dev Bot, 🙇
### 🐞 Bug fixes
- [[```0054b47c```](https://github.com/jina-ai/clip-as-service/commit/0054b47cf12043b0bf493424ec22defa9448a9be)] __-__ __server__: fix content assignment (#727) (*Han Xiao*)
- [[```a7311fbf```](https://github.com/jina-ai/clip-as-service/commit/a7311fbf6ae6e988b78924fea239a9c8236dd8ff)] __-__ __server__: recover original contents of the input da (#726) (*Han Xiao*)
### 🍹 Other Improvements
- [[```926621bc```](https://github.com/jina-ai/clip-as-service/commit/926621bc97972694caff79700c5b70031a2677c1)] __-__ __version__: the next version will be 0.4.10 (*Jina Dev Bot*)
<a name=release-note-0-4-11></a>
## Release Note (`0.4.11`)
> Release time: 2022-05-27 07:44:46
🙇 We'd like to thank all contributors for this new release! In particular,
samsja, Shubham Goel, Han Xiao, Ziniu Yu, Roshan Jossy, Jina Dev Bot, 🙇
### 🆕 New Features
- [[```60a986a0```](https://github.com/jina-ai/clip-as-service/commit/60a986a07921b2374fdc64dccde7e1ec1e728cdb)] __-__ add monitoring (#674) (*samsja*)
### 🐞 Bug fixes
- [[```59f48e60```](https://github.com/jina-ai/clip-as-service/commit/59f48e60a286344f66f37aea46b0b1b148ca90f4)] __-__ windows file name conflict (#729) (*Ziniu Yu*)
- [[```0054b47c```](https://github.com/jina-ai/clip-as-service/commit/0054b47cf12043b0bf493424ec22defa9448a9be)] __-__ __server__: fix content assignment (#727) (*Han Xiao*)
### 📗 Documentation
- [[```2f3a2077```](https://github.com/jina-ai/clip-as-service/commit/2f3a207734c829e6baa94dfa5715dc8d5c3f12de)] __-__ __tracking__: remove utm source in links (#728) (*Roshan Jossy*)
### 🍹 Other Improvements
- [[```c7c96251```](https://github.com/jina-ai/clip-as-service/commit/c7c9625163d97ca3a6ad2b845309bad9e34e5d87)] __-__ Corrected replicas indentation in server.md (#731) (*Shubham Goel*)
- [[```8d112275```](https://github.com/jina-ai/clip-as-service/commit/8d1122754dc53c75bce75e313ee74796bd9614e7)] __-__ fix docs (*Han Xiao*)
- [[```7323d99e```](https://github.com/jina-ai/clip-as-service/commit/7323d99edd7814ece9ed8f5c0adce949047c987d)] __-__ __version__: the next version will be 0.4.11 (*Jina Dev Bot*)
<a name=release-note-0-4-12></a>
## Release Note (`0.4.12`)
> Release time: 2022-06-01 08:28:41
🙇 We'd like to thank all contributors for this new release! In particular,
felix-wang, Ziniu Yu, Jina Dev Bot, samsja, 🙇
### 🆕 New Features
- [[```60a986a0```](https://github.com/jina-ai/clip-as-service/commit/60a986a07921b2374fdc64dccde7e1ec1e728cdb)] __-__ add monitoring (#674) (*samsja*)
### 🐞 Bug fixes
- [[```bb8c4ce0```](https://github.com/jina-ai/clip-as-service/commit/bb8c4ce01de76d2be63444a517e90b530422110e)] __-__ better monitoring (#738) (*felix-wang*)
- [[```751cf9de```](https://github.com/jina-ai/clip-as-service/commit/751cf9de0d8bb727c44ecaf7950a3658b868399d)] __-__ does not require port (#735) (*Ziniu Yu*)
### 📗 Documentation
- [[```5e06667a```](https://github.com/jina-ai/clip-as-service/commit/5e06667ac9afef335b98b72a58ba0d28985d9b18)] __-__ update monitoring feature (#737) (*felix-wang*)
### 🍹 Other Improvements
- [[```b523c624```](https://github.com/jina-ai/clip-as-service/commit/b523c62468dd6088095b00b5335160c57a1cb25e)] __-__ __version__: the next version will be 0.4.12 (*Jina Dev Bot*)
<a name=release-note-0-4-13></a>
## Release Note (`0.4.13`)
> Release time: 2022-06-09 04:42:07
🙇 We'd like to thank all contributors for this new release! In particular,
felix-wang, Ziniu Yu, Han Xiao, Jina Dev Bot, 🙇
### 🆕 New Features
- [[```d675148b```](https://github.com/jina-ai/clip-as-service/commit/d675148b4305338e9d17d449e42ab7c142896c06)] __-__ add clip_hg executor (#740) (*Ziniu Yu*)
### 🧼 Code Refactoring
- [[```5eb5d7e8```](https://github.com/jina-ai/clip-as-service/commit/5eb5d7e8ed6f924c6560bb850edb08bbd809ff09)] __-__ monitor (#743) (*felix-wang*)
### 📗 Documentation
- [[```130108c1```](https://github.com/jina-ai/clip-as-service/commit/130108c1aaf993bebc8215527c47d98c7e2169c5)] __-__ add JCloud deployment docs (#739) (*Ziniu Yu*)
- [[```5e06667a```](https://github.com/jina-ai/clip-as-service/commit/5e06667ac9afef335b98b72a58ba0d28985d9b18)] __-__ update monitoring feature (#737) (*felix-wang*)
### 🍹 Other Improvements
- [[```4b88e992```](https://github.com/jina-ai/clip-as-service/commit/4b88e99263a29903312f52bae01465b44b7a0cce)] __-__ fix docs (*Han Xiao*)
- [[```b130d645```](https://github.com/jina-ai/clip-as-service/commit/b130d645409b044df6f1e0bcda78b42e79cb98d9)] __-__ add grafana dashboard (#741) (*felix-wang*)
- [[```12ede839```](https://github.com/jina-ai/clip-as-service/commit/12ede83996f62af8c549a1d6621ae1dd32b7de7d)] __-__ __version__: the next version will be 0.4.13 (*Jina Dev Bot*)
<a name=release-note-0-4-14></a>
## Release Note (`0.4.14`)
> Release time: 2022-06-09 13:39:46
🙇 We'd like to thank all contributors for this new release! In particular,
felix-wang, Jina Dev Bot, 🙇
### 🐞 Bug fixes
- [[```752202f8```](https://github.com/jina-ai/clip-as-service/commit/752202f8b730d0ab8785a703fc719dacfbe2993b)] __-__ monitor documentation (#745) (*felix-wang*)
### 🧼 Code Refactoring
- [[```5eb5d7e8```](https://github.com/jina-ai/clip-as-service/commit/5eb5d7e8ed6f924c6560bb850edb08bbd809ff09)] __-__ monitor (#743) (*felix-wang*)
### 🍹 Other Improvements
- [[```06097f20```](https://github.com/jina-ai/clip-as-service/commit/06097f2098190b5a8a40fc82354b642730e617e0)] __-__ __version__: the next version will be 0.4.14 (*Jina Dev Bot*)
<a name=release-note-0-4-15></a>
## Release Note (`0.4.15`)
> Release time: 2022-06-13 13:06:16
🙇 We'd like to thank all contributors for this new release! In particular,
Han Xiao, felix-wang, Ziniu Yu, Jina Dev Bot, 🙇
### 🆕 New Features
- [[```e022bd46```](https://github.com/jina-ai/clip-as-service/commit/e022bd46c8c1773620f635148cb999e23ff7167e)] __-__ add traversal paths (#750) (*felix-wang*)
- [[```4fe5a1b1```](https://github.com/jina-ai/clip-as-service/commit/4fe5a1b1dc9672be98638ba57023936b5ed69a6c)] __-__ add traversal paths (#748) (*felix-wang*)
### 🐞 Bug fixes
- [[```752202f8```](https://github.com/jina-ai/clip-as-service/commit/752202f8b730d0ab8785a703fc719dacfbe2993b)] __-__ monitor documentation (#745) (*felix-wang*)
### 🍹 Other Improvements
- [[```dab8341e```](https://github.com/jina-ai/clip-as-service/commit/dab8341e9ffb0716eb8c17477534ef91f19d8c5d)] __-__ add cas on colab section (*Han Xiao*)
- [[```29bd68a4```](https://github.com/jina-ai/clip-as-service/commit/29bd68a4bc1f17c34016d45901858c65c8cf5623)] __-__ add replicas field in all yamls (*Han Xiao*)
- [[```d5be8c2f```](https://github.com/jina-ai/clip-as-service/commit/d5be8c2f85e47fcafa7587f3e75b76fbc42300e5)] __-__ Revert "feat: add traversal paths (#748)" (#749) (*Han Xiao*)
- [[```7f2d8fe8```](https://github.com/jina-ai/clip-as-service/commit/7f2d8fe88643ae71e5d8b38547faa32570886e46)] __-__ update links in docs (#747) (*Ziniu Yu*)
- [[```52a8b0a6```](https://github.com/jina-ai/clip-as-service/commit/52a8b0a6c62204d37556f31fd79fd1ee621b45e3)] __-__ __version__: the next version will be 0.4.15 (*Jina Dev Bot*)
<a name=release-note-0-4-16></a>
## Release Note (`0.4.16`)
> Release time: 2022-06-14 08:52:07
🙇 We'd like to thank all contributors for this new release! In particular,
felix-wang, Ziniu Yu, Han Xiao, Jina Dev Bot, 🙇
### 🐞 Bug fixes
- [[```eca1e700```](https://github.com/jina-ai/clip-as-service/commit/eca1e700493d59f475714aa5f49ccd33247cb983)] __-__ add integerate test for client (#753) (*felix-wang*)
- [[```b5c339fe```](https://github.com/jina-ai/clip-as-service/commit/b5c339feda8ed89538b92d59624a781a8725f304)] __-__ fix client concurrent issue (#752) (*Ziniu Yu*)
### 🍹 Other Improvements
- [[```e5ab22f5```](https://github.com/jina-ai/clip-as-service/commit/e5ab22f58ea8888aef0ead6902d2412301e9e5fc)] __-__ update slack (*Han Xiao*)
- [[```5503becb```](https://github.com/jina-ai/clip-as-service/commit/5503becb5308ca34062bc611a4a431815de5383c)] __-__ fix docs (*Han Xiao*)
- [[```909cdb11```](https://github.com/jina-ai/clip-as-service/commit/909cdb110ff27f811e5ed718bb99291f454af03a)] __-__ add cas on colab section (*Han Xiao*)
- [[```3d3ef936```](https://github.com/jina-ai/clip-as-service/commit/3d3ef9363c9a322660fe84e94a2e610a24be0f0e)] __-__ __version__: the next version will be 0.4.16 (*Jina Dev Bot*)
<a name=release-note-0-4-17></a>
## Release Note (`0.4.17`)
> Release time: 2022-06-20 10:56:12
🙇 We'd like to thank all contributors for this new release! In particular,
Han Xiao, Ziniu Yu, numb3r3, felix-wang, Jina Dev Bot, 🙇
### 🆕 New Features
- [[```03541dd7```](https://github.com/jina-ai/clip-as-service/commit/03541dd765849ec453b501c83dbf4071b317bce1)] __-__ add cas server dockerfile (#757) (*Han Xiao*)
- [[```4d069a84```](https://github.com/jina-ai/clip-as-service/commit/4d069a84ac0414059acce322f00815bf0cd12536)] __-__ upload torch executor (#723) (*Ziniu Yu*)
### 🐞 Bug fixes
- [[```eca1e700```](https://github.com/jina-ai/clip-as-service/commit/eca1e700493d59f475714aa5f49ccd33247cb983)] __-__ add integerate test for client (#753) (*felix-wang*)
### 📗 Documentation
- [[```7c2faae2```](https://github.com/jina-ai/clip-as-service/commit/7c2faae270e276bfc36f4c51e4abe101194f1799)] __-__ update jcloud docs (#754) (*Ziniu Yu*)
- [[```9d872f2e```](https://github.com/jina-ai/clip-as-service/commit/9d872f2e20e53e988a6d13dff191a42fa6e7e0d2)] __-__ add disk usage / memory usage benchmark table (#751) (*Ziniu Yu*)
### 🍹 Other Improvements
- [[```9e469bf7```](https://github.com/jina-ai/clip-as-service/commit/9e469bf70f4cd314353bde9c1ca8dfbda45fa532)] __-__ fix readme (*Han Xiao*)
- [[```4c4e74b2```](https://github.com/jina-ai/clip-as-service/commit/4c4e74b2d5ebcede408d49b6455e1a13293edf95)] __-__ upload executor in cd workflow (*numb3r3*)
- [[```96923f12```](https://github.com/jina-ai/clip-as-service/commit/96923f12a33e2c30dc55dc993648d9758f96a132)] __-__ fix docker cd (#755) (*felix-wang*)
- [[```1869e61f```](https://github.com/jina-ai/clip-as-service/commit/1869e61f3e0c46a7322abc42be6983e951d5806d)] __-__ add visual reasoning to docs (*Han Xiao*)
- [[```2083f097```](https://github.com/jina-ai/clip-as-service/commit/2083f0970985a2260a7b6fbbaaaa8b1210036765)] __-__ __version__: the next version will be 0.4.17 (*Jina Dev Bot*)
<a name=release-note-0-4-18></a>
## Release Note (`0.4.18`)
> Release time: 2022-06-20 11:21:16
🙇 We'd like to thank all contributors for this new release! In particular,
Han Xiao, Jina Dev Bot, 🙇
### 🍹 Other Improvements
- [[```a0c2661b```](https://github.com/jina-ai/clip-as-service/commit/a0c2661bc4764a74ff8737744b0d47fac4c1a5e9)] __-__ fix tag docker build job (*Han Xiao*)
- [[```23f738ec```](https://github.com/jina-ai/clip-as-service/commit/23f738ecabebf906d001f83481f8cd10b89f5fb0)] __-__ __version__: the next version will be 0.4.18 (*Jina Dev Bot*)
- [[```9e469bf7```](https://github.com/jina-ai/clip-as-service/commit/9e469bf70f4cd314353bde9c1ca8dfbda45fa532)] __-__ fix readme (*Han Xiao*)
<a name=release-note-0-4-19></a>
## Release Note (`0.4.19`)
> Release time: 2022-06-20 16:32:32
🙇 We'd like to thank all contributors for this new release! In particular,
Han Xiao, Jina Dev Bot, 🙇
### 🆕 New Features
- [[```6902d2df```](https://github.com/jina-ai/clip-as-service/commit/6902d2dffc04b57e7a49f308139b27775a2193fa)] __-__ read config from stdin to allow pipe (#758) (*Han Xiao*)
### 📗 Documentation
- [[```6e054db8```](https://github.com/jina-ai/clip-as-service/commit/6e054db893fcff4a2fe6c86073dd049e1c13f954)] __-__ read config from stdin to allow pipe (*Han Xiao*)
### 🍹 Other Improvements
- [[```4a298d4f```](https://github.com/jina-ai/clip-as-service/commit/4a298d4f9fcbe342855f234d59c8e920e6918659)] __-__ add docker image docs (*Han Xiao*)
- [[```1e931e8b```](https://github.com/jina-ai/clip-as-service/commit/1e931e8b2d2d8e5429c69e25df95ab15cb84ab66)] __-__ __version__: the next version will be 0.4.19 (*Jina Dev Bot*)
- [[```a0c2661b```](https://github.com/jina-ai/clip-as-service/commit/a0c2661bc4764a74ff8737744b0d47fac4c1a5e9)] __-__ fix tag docker build job (*Han Xiao*)
<a name=release-note-0-4-20></a>
## Release Note (`0.4.20`)
> Release time: 2022-06-21 15:45:06
🙇 We'd like to thank all contributors for this new release! In particular,
Han Xiao, Jina Dev Bot, 🙇
### 🐞 Bug fixes
- [[```79e85eed```](https://github.com/jina-ai/clip-as-service/commit/79e85eed7c89f31c16399bfcc1bb098f0ae5c920)] __-__ miscalling clip_server in clip_client (*Han Xiao*)
### 📗 Documentation
- [[```6e054db8```](https://github.com/jina-ai/clip-as-service/commit/6e054db893fcff4a2fe6c86073dd049e1c13f954)] __-__ read config from stdin to allow pipe (*Han Xiao*)
### 🍹 Other Improvements
- [[```c3e75133```](https://github.com/jina-ai/clip-as-service/commit/c3e751336722b415aa88992794119f32b7ddee77)] __-__ __version__: the next version will be 0.4.20 (*Jina Dev Bot*)
<a name=release-note-0-5-0></a>
## Release Note (`0.5.0`)
> Release time: 2022-08-03 05:13:06
🙇 We'd like to thank all contributors for this new release! In particular,
numb3r3, Ziniu Yu, Alex Shan, felix-wang, Sha Zhou, Jina Dev Bot, Han Xiao, 🙇
### 🆕 New Features
- [[```3402b1d1```](https://github.com/jina-ai/clip-as-service/commit/3402b1d1726120d8ed39ae561e441695f24ddeb3)] __-__ replace traversal_paths with access_paths (#791) (*Ziniu Yu*)
- [[```87928a7b```](https://github.com/jina-ai/clip-as-service/commit/87928a7b8be9e8a4fce4d2352e82975252db162b)] __-__ update onnx models and md5 (#785) (*Ziniu Yu*)
- [[```8bd83896```](https://github.com/jina-ai/clip-as-service/commit/8bd838964b7975c9c1a2394c0ae681507ed5dc18)] __-__ support onnx backend for openclip (#781) (*felix-wang*)
- [[```f043b4d9```](https://github.com/jina-ai/clip-as-service/commit/f043b4d934a9454b5db32e7ea7331307506a1a6f)] __-__ update openclip loader (#782) (*Alex Shan*)
- [[```fa62d8e9```](https://github.com/jina-ai/clip-as-service/commit/fa62d8e93baf2579b2934cc0ed8daca12c144d7d)] __-__ support openclip&mclip models + refactor model loader (#774) (*Alex Shan*)
- [[```32b11cd6```](https://github.com/jina-ai/clip-as-service/commit/32b11cd64bb76bca5075fbcbc84b9334952c236c)] __-__ allow model selection in client (#775) (*Ziniu Yu*)
- [[```0ff4e252```](https://github.com/jina-ai/clip-as-service/commit/0ff4e2526394e0fa86266668f1162f4a6b922bd8)] __-__ allow credential in client (#765) (*Ziniu Yu*)
- [[```ee7da10d```](https://github.com/jina-ai/clip-as-service/commit/ee7da10d1f56a130e6f9a85d5fb3518b80e5df0d)] __-__ support custom onnx file and update model signatures (#761) (*Ziniu Yu*)
- [[```ed1b92d1```](https://github.com/jina-ai/clip-as-service/commit/ed1b92d1896cc0c12733b51bd1bd83040676f505)] __-__ __docs__: add qabot (#759) (*Sha Zhou*)
### 🐞 Bug fixes
- [[```e48a7a38```](https://github.com/jina-ai/clip-as-service/commit/e48a7a38ac01fe0db47a7898ae1401f25394402f)] __-__ change onnx and trt default model name to ViT-B-32::openai (#793) (*Ziniu Yu*)
- [[```8b8082a9```](https://github.com/jina-ai/clip-as-service/commit/8b8082a939f67f7ea01cc9f55ebce9c5368ebe1a)] __-__ mclip cuda device (#792) (*felix-wang*)
- [[```8681b88e```](https://github.com/jina-ai/clip-as-service/commit/8681b88eb3a7806c1286eaefff3bd8a8ab28ff03)] __-__ fp16 inference (#790) (*felix-wang*)
- [[```ab00c2ae```](https://github.com/jina-ai/clip-as-service/commit/ab00c2ae4067678b8f9c8351244867257031f3c2)] __-__ upgrade jina (#788) (*felix-wang*)
- [[```1db43b48```](https://github.com/jina-ai/clip-as-service/commit/1db43b485b0fe368eb3949ddc052b5dd8002c279)] __-__ no allow client to change server batch size (#787) (*Ziniu Yu*)
- [[```58772079```](https://github.com/jina-ai/clip-as-service/commit/5877207924c088739644873d6cf654aabb1f7134)] __-__ add models and md5 (#783) (*Ziniu Yu*)
- [[```7c8285bb```](https://github.com/jina-ai/clip-as-service/commit/7c8285bbf7eb5d757cba1f85b56e6528be66396b)] __-__ async progress bar does not display (#779) (*Ziniu Yu*)
- [[```79e85eed```](https://github.com/jina-ai/clip-as-service/commit/79e85eed7c89f31c16399bfcc1bb098f0ae5c920)] __-__ miscalling clip_server in clip_client (*Han Xiao*)
### 📗 Documentation
- [[```c67a7f59```](https://github.com/jina-ai/clip-as-service/commit/c67a7f59c25760e32a611b330fd9ff5959aa1e4b)] __-__ add model support (#784) (*Alex Shan*)
- [[```bc6b72e6```](https://github.com/jina-ai/clip-as-service/commit/bc6b72e65cce999ad7b09ecb93b25b07ff8f4de1)] __-__ add finetuner docs (#771) (*Ziniu Yu*)
- [[```2b78b12e```](https://github.com/jina-ai/clip-as-service/commit/2b78b12e3aa527b386eac4ee7eed74e580eadbf6)] __-__ improve model support (#768) (*Ziniu Yu*)
### 🍹 Other Improvements
- [[```b00963c4```](https://github.com/jina-ai/clip-as-service/commit/b00963c45983dfdac6d05258b03298de5ad1edf6)] __-__ bump version to 0.5.0 (*numb3r3*)
- [[```c458dd65```](https://github.com/jina-ai/clip-as-service/commit/c458dd6579d6e3125028ad4cb2b88f9f481b4686)] __-__ remove clip_hg (#786) (*Ziniu Yu*)
- [[```ca03dca3```](https://github.com/jina-ai/clip-as-service/commit/ca03dca369d2e7ed55d2f2a339fa9b4e9f41667d)] __-__ fix markdown-table extention (#772) (*felix-wang*)
- [[```7b19bffe```](https://github.com/jina-ai/clip-as-service/commit/7b19bffecb739a74a524544472aa3ad07dff2f2a)] __-__ __version__: the next version will be 0.4.21 (*Jina Dev Bot*)
<a name=release-note-0-5-1></a>
## Release Note (`0.5.1`)
> Release time: 2022-08-08 05:11:18
🙇 We'd like to thank all contributors for this new release! In particular,
Ziniu Yu, Jina Dev Bot, numb3r3, 🙇
### 🆕 New Features
- [[```65032f02```](https://github.com/jina-ai/clip-as-service/commit/65032f02db30671f7a2a6ca78e371588ae98ab2b)] __-__ encode text first when both text and uri are presented (#795) (*Ziniu Yu*)
### 📗 Documentation
- [[```7c6708fa```](https://github.com/jina-ai/clip-as-service/commit/7c6708fa8a592b5ce306f1ab2f1af1504148484a)] __-__ update hub readme (#794) (*Ziniu Yu*)
### 🍹 Other Improvements
- [[```a7c4f490```](https://github.com/jina-ai/clip-as-service/commit/a7c4f4903df5736bcf9e85d82bb83497d850bc4d)] __-__ __version__: the next version will be 0.5.1 (*Jina Dev Bot*)
- [[```b00963c4```](https://github.com/jina-ai/clip-as-service/commit/b00963c45983dfdac6d05258b03298de5ad1edf6)] __-__ bump version to 0.5.0 (*numb3r3*)
<a name=release-note-0-6-0></a>
## Release Note (`0.6.0`)
> Release time: 2022-08-30 04:19:21
🙇 We'd like to thank all contributors for this new release! In particular,
numb3r3, Ziniu Yu, felix-wang, Jina Dev Bot, 🙇
### 🆕 New Features
- [[```3c43eed3```](https://github.com/jina-ai/clip-as-service/commit/3c43eed38afe2ff84c8b06368f4301afcd332cf5)] __-__ do not send blob from server when it is loaded in client (#804) (*Ziniu Yu*)
- [[```f852dfc8```](https://github.com/jina-ai/clip-as-service/commit/f852dfc876caa7b98552b5c707d4c85babc46393)] __-__ add warning if input is too large (#796) (*Ziniu Yu*)
- [[```65032f02```](https://github.com/jina-ai/clip-as-service/commit/65032f02db30671f7a2a6ca78e371588ae98ab2b)] __-__ encode text first when both text and uri are presented (#795) (*Ziniu Yu*)
### 🐞 Bug fixes
- [[```bb2c142b```](https://github.com/jina-ai/clip-as-service/commit/bb2c142b8899075c00db3b08e506fb970fee1478)] __-__ cast dtype for fp16 (#801) (*felix-wang*)
### 📗 Documentation
- [[```a5893c70```](https://github.com/jina-ai/clip-as-service/commit/a5893c70531830f236d38fde5a880a9a2556474f)] __-__ update jcloud gpu usage (#809) (*Ziniu Yu*)
- [[```b4fb0dd2```](https://github.com/jina-ai/clip-as-service/commit/b4fb0dd2823b6218da4395989c6b011cf3de1a38)] __-__ fix hub table typo (#803) (*Ziniu Yu*)
### 🍹 Other Improvements
- [[```2a80235c```](https://github.com/jina-ai/clip-as-service/commit/2a80235c0aa16eefdc6703989fc6da670cbd5c89)] __-__ bump version to 0.6.0 (*numb3r3*)
- [[```59b9f771```](https://github.com/jina-ai/clip-as-service/commit/59b9f7716df9a325fb6e707d086ca6f2612da975)] __-__ update protobuf version (#810) (*Ziniu Yu*)
- [[```89205f06```](https://github.com/jina-ai/clip-as-service/commit/89205f06d1b740952e79c512d6b0ef6f8db18300)] __-__ update executor docstring (#806) (*Ziniu Yu*)
- [[```25c91e21```](https://github.com/jina-ai/clip-as-service/commit/25c91e21ee8de9e2cd1766d2c6c319f6e5609e80)] __-__ __version__: the next version will be 0.5.2 (*Jina Dev Bot*)
<a name=release-note-0-6-1></a>
## Release Note (`0.6.1`)
> Release time: 2022-08-30 13:57:32
🙇 We'd like to thank all contributors for this new release! In particular,
felix-wang, Jina Dev Bot, numb3r3, 🙇
### 🐞 Bug fixes
- [[```ea239685```](https://github.com/jina-ai/clip-as-service/commit/ea239685bff56372aeadaeb3050f5c2ccc37175f)] __-__ grpc meta auth (#811) (*felix-wang*)
### 🍹 Other Improvements
- [[```83a8120c```](https://github.com/jina-ai/clip-as-service/commit/83a8120c22c76cf34f0d2e5966c368031e0fe9b4)] __-__ __version__: the next version will be 0.6.1 (*Jina Dev Bot*)
- [[```2a80235c```](https://github.com/jina-ai/clip-as-service/commit/2a80235c0aa16eefdc6703989fc6da670cbd5c89)] __-__ bump version to 0.6.0 (*numb3r3*)
<a name=release-note-0-6-2></a>
## Release Note (`0.6.2`)
> Release time: 2022-09-01 04:16:27
🙇 We'd like to thank all contributors for this new release! In particular,
Ziniu Yu, Jina Dev Bot, felix-wang, 🙇
### 🐞 Bug fixes
- [[```ea239685```](https://github.com/jina-ai/clip-as-service/commit/ea239685bff56372aeadaeb3050f5c2ccc37175f)] __-__ grpc meta auth (#811) (*felix-wang*)
### 📗 Documentation
- [[```4461d2e9```](https://github.com/jina-ai/clip-as-service/commit/4461d2e9ab07c01669237b220cd24cd6f95e30e8)] __-__ update model support table (#813) (*Ziniu Yu*)
### 🍹 Other Improvements
- [[```f7ee26a1```](https://github.com/jina-ai/clip-as-service/commit/f7ee26a17d47c1de0efc1122ccb40d3b22d217a8)] __-__ improve model not found error msg (#812) (*Ziniu Yu*)
- [[```f1c0057d```](https://github.com/jina-ai/clip-as-service/commit/f1c0057d7e1c51953303bbf7b3743e19a9c300ab)] __-__ __version__: the next version will be 0.6.2 (*Jina Dev Bot*)
<a name=release-note-0-7-0></a>
## Release Note (`0.7.0`)
> Release time: 2022-09-13 13:47:54
🙇 We'd like to thank all contributors for this new release! In particular,
numb3r3, felix-wang, Jie Fu, Ziniu Yu, Jina Dev Bot, 🙇
### 🆕 New Features
- [[```a07a5218```](https://github.com/jina-ai/clip-as-service/commit/a07a52182d02b3cab1135235c9aee8e1af4f280c)] __-__ support clip retrieval (#816) (*felix-wang*)
### 🐞 Bug fixes
- [[```213ecc28```](https://github.com/jina-ai/clip-as-service/commit/213ecc28afa20bbb0984efd4ab28dd08443e9369)] __-__ always return docarray as search result (#821) (*felix-wang*)
- [[```eca57745```](https://github.com/jina-ai/clip-as-service/commit/eca577455a0d378cc4d9974ef3109f2d2e74c1b3)] __-__ __readme__: use new demo server (#819) (*felix-wang*)
### 📗 Documentation
- [[```8d9725fb```](https://github.com/jina-ai/clip-as-service/commit/8d9725fb874d94944cb1129ca2ccc8293c52dc90)] __-__ update clip search (#820) (*felix-wang*)
- [[```fa7e5776```](https://github.com/jina-ai/clip-as-service/commit/fa7e577606d68e65a0e7952048c64d2b3a28e231)] __-__ docs for retrieval (#808) (*Jie Fu*)
- [[```47144c23```](https://github.com/jina-ai/clip-as-service/commit/47144c23fd6b10f9aed0dfc4a2e37f83bc33f284)] __-__ enable horizontal scrolling in wide tables (#818) (*Ziniu Yu*)
### 🍹 Other Improvements
- [[```53636cea```](https://github.com/jina-ai/clip-as-service/commit/53636cea63bf8063bcfd744aae4577df8e0eab2e)] __-__ bump version to 0.7.0 (*numb3r3*)
- [[```eda4aa8e```](https://github.com/jina-ai/clip-as-service/commit/eda4aa8e958bbbd83dddcd5932622bcf041f3918)] __-__ __version__: the next version will be 0.6.3 (*Jina Dev Bot*)
- [[```f7ee26a1```](https://github.com/jina-ai/clip-as-service/commit/f7ee26a17d47c1de0efc1122ccb40d3b22d217a8)] __-__ improve model not found error msg (#812) (*Ziniu Yu*)
<a name=release-note-0-8-0></a>
## Release Note (`0.8.0`)
> Release time: 2022-10-12 08:11:40
🙇 We'd like to thank all contributors for this new release! In particular,
numb3r3, Jie Fu, Ziniu Yu, felix-wang, Jina Dev Bot, 🙇
### 🆕 New Features
- [[```2ba8a4fe```](https://github.com/jina-ai/clip-as-service/commit/2ba8a4fe71f26faa5e92d62df04edb616389f6bd)] __-__ support large ONNX model files (#828) (*Ziniu Yu*)
- [[```09d15485```](https://github.com/jina-ai/clip-as-service/commit/09d15485d50c51a77cb57380f4b848b41764a1b6)] __-__ support B/32, L/14, H/14, and g/14 trained on LAION-2B (#825) (*Ziniu Yu*)
- [[```c690c247```](https://github.com/jina-ai/clip-as-service/commit/c690c247946017d178d9340d8c951342c0321943)] __-__ drop image content to boost latency (#824) (*felix-wang*)
- [[```bcce9900```](https://github.com/jina-ai/clip-as-service/commit/bcce990032abfd618cea408ab3f0fb4e352789ae)] __-__ in-place result in clip_client; preserve output order by uid (#815) (*Ziniu Yu*)
### 📗 Documentation
- [[```87fdc548```](https://github.com/jina-ai/clip-as-service/commit/87fdc5489c5b33b76e28dd1c0b54017a51dd4abe)] __-__ add memory profile (#841) (*Jie Fu*)
- [[```7ee58c8b```](https://github.com/jina-ai/clip-as-service/commit/7ee58c8b2751f949790983f223209ad1d2261fca)] __-__ clip benchmark on zeroshot classification and retrieval tasks (#832) (*Ziniu Yu*)
### 🍹 Other Improvements
- [[```920b3107```](https://github.com/jina-ai/clip-as-service/commit/920b31070f54b1b6af4d4e58e7db351a576e0783)] __-__ bump version to 0.8.0 (*numb3r3*)
- [[```54e99786```](https://github.com/jina-ai/clip-as-service/commit/54e99786ea07b9ad109f593890e3b4945d39b768)] __-__ add description for retrieval playground (#834) (*Jie Fu*)
- [[```a26a883f```](https://github.com/jina-ai/clip-as-service/commit/a26a883fa15a47243450c9cebbfc7f472e6cfa04)] __-__ use open clip naming convention for model names (#836) (*Ziniu Yu*)
- [[```f40513d5```](https://github.com/jina-ai/clip-as-service/commit/f40513d57c0c3f7e466160f41547c970618af85a)] __-__ fix docs website template (#833) (*Ziniu Yu*)
- [[```d520ebb8```](https://github.com/jina-ai/clip-as-service/commit/d520ebb835e2814f7696148a0dcabbbf8bdadc76)] __-__ remove unused md (*numb3r3*)
- [[```2c3c61f9```](https://github.com/jina-ai/clip-as-service/commit/2c3c61f9d6f5a351f235dbad45879f0c7c4fd986)] __-__ __version__: the next version will be 0.7.1 (*Jina Dev Bot*)
- [[```53636cea```](https://github.com/jina-ai/clip-as-service/commit/53636cea63bf8063bcfd744aae4577df8e0eab2e)] __-__ bump version to 0.7.0 (*numb3r3*)
<a name=release-note-0-8-1></a>
## Release Note (`0.8.1`)
> Release time: 2022-11-15 11:15:48
🙇 We'd like to thank all contributors for this new release! In particular,
YangXiuyu, Ziniu Yu, felix-wang, Jie Fu, Jina Dev Bot, numb3r3, 🙇
### 🆕 New Features
- [[```e4717a35```](https://github.com/jina-ai/clip-as-service/commit/e4717a35f850e6a2cd8b4d8b4c994fad30fd5c72)] __-__ Integrate flash attention (#853) (*YangXiuyu*)
- [[```4fcbf68a```](https://github.com/jina-ai/clip-as-service/commit/4fcbf68a883cb3143e47738df4c8044dfec2a131)] __-__ allow custom callback in clip_client (#849) (*Ziniu Yu*)
### 🐞 Bug fixes
- [[```71086227```](https://github.com/jina-ai/clip-as-service/commit/710862279bdef342983bd7944f413d8ee54f9603)] __-__ increase timeout ready for executor docker images (#854) (*Ziniu Yu*)
- [[```f96ce543```](https://github.com/jina-ai/clip-as-service/commit/f96ce5433dc1ec473ae89e22f01520b93abc6071)] __-__ install transformers for executor docker images (#851) (*Ziniu Yu*)
### 📗 Documentation
- [[```9aa8c224```](https://github.com/jina-ai/clip-as-service/commit/9aa8c224f93c4a7b52fecac8fe8a18832ce98814)] __-__ add tips for client parallelism usage (#846) (*Ziniu Yu*)
- [[```8776784d```](https://github.com/jina-ai/clip-as-service/commit/8776784d2cf2b0bfce44724db10c18dbda7acb77)] __-__ add instructions for using clip server hosted by jina (#848) (*Ziniu Yu*)
- [[```d91da50c```](https://github.com/jina-ai/clip-as-service/commit/d91da50cc86942623dbee2cdb6b31350d9ce6a8e)] __-__ move benchmark conclusion to beginning (#847) (*Ziniu Yu*)
- [[```baf94b5f```](https://github.com/jina-ai/clip-as-service/commit/baf94b5f70b9c18cfe2c0fea3e284fe30e4ca093)] __-__ update finetuner docs (#843) (*Jie Fu*)
### 🍹 Other Improvements
- [[```d2ecec60```](https://github.com/jina-ai/clip-as-service/commit/d2ecec60e9be4235518d19b0e2f2342fa5401dfc)] __-__ allow test to pass even if commit name is not good (#856) (*Ziniu Yu*)
- [[```ebfa494c```](https://github.com/jina-ai/clip-as-service/commit/ebfa494c9218a848e0bc49a552dabecda1373dbb)] __-__ replace clip server address in docs (#857) (*Ziniu Yu*)
- [[```fe112ea5```](https://github.com/jina-ai/clip-as-service/commit/fe112ea5ec8dd9de8fd842633b17dcb9079c79a4)] __-__ change hub url from hub.jina.ai to cloud.jina.ai (#845) (*Ziniu Yu*)
- [[```ae05624d```](https://github.com/jina-ai/clip-as-service/commit/ae05624d68bf8c3fbcefc1d07b0adabbe1cad422)] __-__ use new free service in playground (#844) (*felix-wang*)
- [[```6cdc3e21```](https://github.com/jina-ai/clip-as-service/commit/6cdc3e21bb6e0b0476b94e40cfa88a475d4a5f7d)] __-__ __version__: the next version will be 0.8.1 (*Jina Dev Bot*)
- [[```920b3107```](https://github.com/jina-ai/clip-as-service/commit/920b31070f54b1b6af4d4e58e7db351a576e0783)] __-__ bump version to 0.8.0 (*numb3r3*)
<a name=release-note-0-8-2></a>
## Release Note (`0.8.2`)
> Release time: 2023-04-19 08:23:45
🙇 We'd like to thank all contributors for this new release! In particular,
Ziniu Yu, Yang Ruiyi, YangXiuyu, Jie Fu, zawabest, Girish Chandrashekar, Jina Dev Bot, 🙇
### 🆕 New Features
- [[```cce3b05a```](https://github.com/jina-ai/clip-as-service/commit/cce3b05a1cfa23db129e8a7077e75e75f5da73c6)] __-__ set prefetch in client for traffic control (#897) (*Ziniu Yu*)
- [[```dabbe8bc```](https://github.com/jina-ai/clip-as-service/commit/dabbe8bc3ef633e4460e1be3f1c06792fe08f00c)] __-__ add cn clip model (#888) (*Yang Ruiyi*)
- [[```1fe3a5a0```](https://github.com/jina-ai/clip-as-service/commit/1fe3a5a01123dcfea8a7981fc5aea212d42c1299)] __-__ add fp16 inference support (torch/onnx) (#871) (*YangXiuyu*)
- [[```1eebdd7f```](https://github.com/jina-ai/clip-as-service/commit/1eebdd7f489abb8e694226d5c5c29b011eab229a)] __-__ add custom tracing spans with jina>=3.12.0 (#861) (*Girish Chandrashekar*)
- [[```f2515394```](https://github.com/jina-ai/clip-as-service/commit/f25153942464bb9230158af33c324cdb0b8b70a4)] __-__ add three new open clip roberta base models (#860) (*YangXiuyu*)
- [[```e4717a35```](https://github.com/jina-ai/clip-as-service/commit/e4717a35f850e6a2cd8b4d8b4c994fad30fd5c72)] __-__ Integrate flash attention (#853) (*YangXiuyu*)
### 🐞 Bug fixes
- [[```280b925e```](https://github.com/jina-ai/clip-as-service/commit/280b925e16ab5605a124d412f66ff56caa492553)] __-__ fix docarray at v1 (#911) (*Ziniu Yu*)
- [[```35733a0b```](https://github.com/jina-ai/clip-as-service/commit/35733a0ba7fe6d9ae64d2d4d657d6ded2df3a6d1)] __-__ replace transform ndarray with transform blob (#910) (*Ziniu Yu*)
- [[```d70f2382```](https://github.com/jina-ai/clip-as-service/commit/d70f238220f76593fb9b14e43e50f9a9d2cecd8a)] __-__ onnx package conflict during setup (#894) (*Ziniu Yu*)
- [[```8a576c58```](https://github.com/jina-ai/clip-as-service/commit/8a576c585756e6526b1fe4a526858252d096535a)] __-__ install pytorch cu116 for server docker image (#882) (*Ziniu Yu*)
- [[```0b293ec8```](https://github.com/jina-ai/clip-as-service/commit/0b293ec834e80f7335aa625d683904594373a607)] __-__ dynamic convert onnx model to fp16 during start session (#876) (*YangXiuyu*)
- [[```fd16e5ab```](https://github.com/jina-ai/clip-as-service/commit/fd16e5abef94e274572d40912f12baeffece8696)] __-__ check dtype when loading models (#872) (*Ziniu Yu*)
- [[```67f551ca```](https://github.com/jina-ai/clip-as-service/commit/67f551ca46c2bcf8c8598d6749544bd335da8bdb)] __-__ torchvision version to avoid compatibility issue (#866) (*Jie Fu*)
- [[```0223e6fa```](https://github.com/jina-ai/clip-as-service/commit/0223e6fa071534bfc1a3b2010dd7065623afd540)] __-__ add pip installable flash attention (#863) (*YangXiuyu*)
### 📗 Documentation
- [[```1888ef65```](https://github.com/jina-ai/clip-as-service/commit/1888ef65f20a94b38f318696e663d447c7cb1dc6)] __-__ fix broken link in client doc (#909) (*Ziniu Yu*)
- [[```f4eed3bc```](https://github.com/jina-ai/clip-as-service/commit/f4eed3bcbf5757571365159582d09f22c0ca8ed2)] __-__ add link and intro to inference api (#900) (*Ziniu Yu*)
- [[```702fff88```](https://github.com/jina-ai/clip-as-service/commit/702fff88fc8070138b6eee517d9bb6167da0e87f)] __-__ default model suggestion (#874) (*Jie Fu*)
### 🍹 Other Improvements
- [[```19b4fa51```](https://github.com/jina-ai/clip-as-service/commit/19b4fa51f7534b38a8ca236f05483602e44c0536)] __-__ remove docsqa html (#899) (*Ziniu Yu*)
- [[```aa07d257```](https://github.com/jina-ai/clip-as-service/commit/aa07d2577fd27df03ccfff409ee00420071c41af)] __-__ remove docsqa (#898) (*Ziniu Yu*)
- [[```f3421f7c```](https://github.com/jina-ai/clip-as-service/commit/f3421f7c1decbbdd3a5e1f1038666479c8fe60f6)] __-__ bump open-clip-torch to v2.8.0 (#883) (*Ziniu Yu*)
- [[```c7af9f71```](https://github.com/jina-ai/clip-as-service/commit/c7af9f718550600973c6880de442619228f655e8)] __-__ fix configuration file for the search flow doc (#869) (*zawabest*)
- [[```53cd0630```](https://github.com/jina-ai/clip-as-service/commit/53cd06301efde97e6e59a2b143323ccd5f5f2565)] __-__ hide changelog in docs (#864) (*Ziniu Yu*)
- [[```9bb7d1f4```](https://github.com/jina-ai/clip-as-service/commit/9bb7d1f47d19e15e844108dec5f84cabcce7975d)] __-__ __version__: the next version will be 0.8.2 (*Jina Dev Bot*)
<a name=release-note-0-8-3></a>
## Release Note (`0.8.3`)
> Release time: 2023-12-20 04:13:18
🙇 We'd like to thank all contributors for this new release! In particular,
Zihao Jing, Han Xiao, Nick de Silva, Ziniu Yu, Jina Dev Bot, 🙇
### 🐞 Bug fixes
- [[```280b925e```](https://github.com/jina-ai/clip-as-service/commit/280b925e16ab5605a124d412f66ff56caa492553)] __-__ fix docarray at v1 (#911) (*Ziniu Yu*)
### 📗 Documentation
- [[```ca2b25b7```](https://github.com/jina-ai/clip-as-service/commit/ca2b25b7564bc9b18ae38b93f0134e1f9aa0cee7)] __-__ remove jina self-hosted parts (#942) (*Zihao Jing*)
- [[```6e418fe6```](https://github.com/jina-ai/clip-as-service/commit/6e418fe69c10dbac155e02267828d922a5601691)] __-__ replace free service docs with inference docs (#918) (*Ziniu Yu*)
### 🍹 Other Improvements
- [[```d4e7a30b```](https://github.com/jina-ai/clip-as-service/commit/d4e7a30b755b2d314f89181fcc42624a1224b9ae)] __-__ Update README.md (*Han Xiao*)
- [[```679de4e3```](https://github.com/jina-ai/clip-as-service/commit/679de4e3c9cb02b712f58540f6a3dd2e32d8e5e9)] __-__ change slack link to discord (*Han Xiao*)
- [[```02abdc7b```](https://github.com/jina-ai/clip-as-service/commit/02abdc7b68214bedc181d9ef4be1c093ee60c609)] __-__ __version__: the next version will be 0.8.3 (*Jina Dev Bot*)
================================================
FILE: Dockerfiles/base.Dockerfile
================================================
# !!! An ARG declared before a FROM is outside of a build stage, so it can’t be used in any instruction after a FROM
ARG JINA_VERSION=3.11.0
FROM jinaai/jina:${JINA_VERSION}-py38-standard
ARG BACKEND_TAG=torch
# constant, wont invalidate cache
LABEL org.opencontainers.image.vendor="Jina AI Limited" \
org.opencontainers.image.licenses="Apache 2.0" \
org.opencontainers.image.title="CLIP-as-Service" \
org.opencontainers.image.description="Embed images and sentences into fixed-length vectors with CLIP" \
org.opencontainers.image.authors="hello@jina.ai" \
org.opencontainers.image.url="clip-as-service" \
org.opencontainers.image.documentation="https://clip-as-service.jina.ai/"
RUN pip3 install --no-cache-dir torch torchvision torchaudio transformers --extra-index-url https://download.pytorch.org/whl/cpu
# copy will almost always invalid the cache
COPY . /cas/
WORKDIR /cas
RUN if [ "${BACKEND_TAG}" != "torch" ]; then python3 -m pip install --no-cache-dir "./[${BACKEND_TAG}]" ; fi \
&& python3 -m pip install --no-cache-dir .
RUN echo "\
jtype: CLIPEncoder\n\
metas:\n\
py_modules:\n\
- clip_server.executors.clip_$BACKEND_TAG\n\
" > /tmp/config.yml
ENTRYPOINT ["jina", "executor", "--uses", "/tmp/config.yml", "--timeout-ready", "3000000"]
================================================
FILE: Dockerfiles/cuda.Dockerfile
================================================
ARG CUDA_VERSION=11.4.2
FROM nvcr.io/nvidia/cuda:${CUDA_VERSION}-cudnn8-runtime-ubuntu20.04
ENV DEBIAN_FRONTEND=noninteractive
ARG JINA_VERSION=3.11.0
ARG BACKEND_TAG=torch
# constant, wont invalidate cache
LABEL org.opencontainers.image.vendor="Jina AI Limited" \
org.opencontainers.image.licenses="Apache 2.0" \
org.opencontainers.image.title="CLIP-as-Service" \
org.opencontainers.image.description="Embed images and sentences into fixed-length vectors with CLIP" \
org.opencontainers.image.authors="hello@jina.ai" \
org.opencontainers.image.url="clip-as-service" \
org.opencontainers.image.documentation="https://clip-as-service.jina.ai/"
RUN apt-get update && apt-get install -y --no-install-recommends \
python3-setuptools python3-wheel python3-pip \
&& apt-get clean && rm -rf /var/lib/apt/lists/*;
RUN python3 -m pip install --default-timeout=1000 --no-cache-dir torch torchvision torchaudio nvidia-pyindex transformers --extra-index-url https://download.pytorch.org/whl/cu113
RUN python3 -m pip install --default-timeout=1000 --no-cache-dir "jina[standard]==${JINA_VERSION}"
# copy will almost always invalid the cache
COPY . /cas/
WORKDIR /cas
RUN if [ "${BACKEND_TAG}" != "torch" ]; then python3 -m pip install --no-cache-dir "./[${BACKEND_TAG}]" ; fi \
&& python3 -m pip install --no-cache-dir .
RUN echo "\
jtype: CLIPEncoder\n\
metas:\n\
py_modules:\n\
- clip_server.executors.clip_$BACKEND_TAG\n\
" > /tmp/config.yml
ENTRYPOINT ["jina", "executor", "--uses", "/tmp/config.yml", "--timeout-ready", "3000000"]
================================================
FILE: Dockerfiles/server.Dockerfile
================================================
ARG CUDA_VERSION=11.6.0
FROM nvidia/cuda:${CUDA_VERSION}-devel-ubuntu20.04
ARG CAS_NAME=cas
WORKDIR /${CAS_NAME}
ENV PIP_NO_CACHE_DIR=1 \
PIP_DISABLE_PIP_VERSION_CHECK=1
# constant, wont invalidate cache
LABEL org.opencontainers.image.vendor="Jina AI Limited" \
org.opencontainers.image.licenses="Apache 2.0" \
org.opencontainers.image.title="CLIP-as-Service" \
org.opencontainers.image.description="Embed images and sentences into fixed-length vectors with CLIP" \
org.opencontainers.image.authors="hello@jina.ai" \
org.opencontainers.image.url="clip-as-service" \
org.opencontainers.image.documentation="https://clip-as-service.jina.ai/"
RUN apt-get update \
&& apt-get install -y --no-install-recommends python3 python3-pip wget \
&& ln -sf python3 /usr/bin/python \
&& ln -sf pip3 /usr/bin/pip \
&& pip install --upgrade pip \
&& pip install wheel setuptools nvidia-pyindex \
&& pip install torch torchvision torchaudio --extra-index-url https://download.pytorch.org/whl/cu116
COPY server ./server
# given by builder
ARG PIP_TAG
RUN pip install --default-timeout=1000 --compile ./server/ \
&& if [ -n "${PIP_TAG}" ]; then pip install --default-timeout=1000 --compile "./server[${PIP_TAG}]" ; fi
ENV LD_LIBRARY_PATH=/usr/local/cuda/lib64
ARG USER_ID=1000
ARG GROUP_ID=1000
ARG USER_NAME=${CAS_NAME}
ARG GROUP_NAME=${CAS_NAME}
RUN groupadd -g ${GROUP_ID} ${USER_NAME} &&\
useradd -l -u ${USER_ID} -g ${USER_NAME} ${GROUP_NAME} &&\
mkdir /home/${USER_NAME} &&\
chown ${USER_NAME}:${GROUP_NAME} /home/${USER_NAME} &&\
chown -R ${USER_NAME}:${GROUP_NAME} /${CAS_NAME}/
USER ${USER_NAME}
ENTRYPOINT ["python", "-m", "clip_server"]
================================================
FILE: Dockerfiles/tensorrt.Dockerfile
================================================
# Dockerfile to run Clip-as-Service with TensorRT, CUDA integration
ARG TENSORRT_VERSION=22.04
FROM nvcr.io/nvidia/tensorrt:${TENSORRT_VERSION}-py3
ARG JINA_VERSION=3.7.0
ARG BACKEND_TAG=tensorrt
# constant, wont invalidate cache
LABEL org.opencontainers.image.vendor="Jina AI Limited" \
org.opencontainers.image.licenses="Apache 2.0" \
org.opencontainers.image.title="CLIP-as-Service" \
org.opencontainers.image.description="Embed images and sentences into fixed-length vectors with CLIP" \
org.opencontainers.image.authors="hello@jina.ai" \
org.opencontainers.image.url="clip-as-service" \
org.opencontainers.image.documentation="https://clip-as-service.jina.ai/"
RUN pip3 install --default-timeout=1000 --no-cache-dir torch torchvision torchaudio --extra-index-url https://download.pytorch.org/whl/cu113
RUN pip3 -m pip install --default-timeout=1000 --no-cache-dir "jina[standard]==${JINA_VERSION}"
# copy will almost always invalid the cache
COPY . /cas/
WORKDIR /cas
RUN python3 -m pip install --no-cache-dir "./[$BACKEND_TAG]"
RUN echo "\
jtype: CLIPEncoder\n\
metas:\n\
py_modules:\n\
- clip_server.executors.clip_$BACKEND_TAG\n\
" > /tmp/config.yml
ENTRYPOINT ["jina", "executor", "--uses", "/tmp/config.yml"]
================================================
FILE: LICENSE
================================================
Copyright 2020-2022 Jina AI Limited. All rights reserved.
The following two files are licensed under MIT License via https://github.com/mlfoundations/open_clip Copyright (c) 2021, OpenCLIP
server/clip_server/model/model.py
server/clip_server/model/simple_tokenizer.py
Apache License
Version 2.0, January 2004
http://www.apache.org/licenses/
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
1. Definitions.
"License" shall mean the terms and conditions for use, reproduction,
and distribution as defined by Sections 1 through 9 of this document.
"Licensor" shall mean the copyright owner or entity authorized by
the copyright owner that is granting the License.
"Legal Entity" shall mean the union of the acting entity and all
other entities that control, are controlled by, or are under common
control with that entity. For the purposes of this definition,
"control" means (i) the power, direct or indirect, to cause the
direction or management of such entity, whether by contract or
otherwise, or (ii) ownership of fifty percent (50%) or more of the
outstanding shares, or (iii) beneficial ownership of such entity.
"You" (or "Your") shall mean an individual or Legal Entity
exercising permissions granted by this License.
"Source" form shall mean the preferred form for making modifications,
including but not limited to software source code, documentation
source, and configuration files.
"Object" form shall mean any form resulting from mechanical
transformation or translation of a Source form, including but
not limited to compiled object code, generated documentation,
and conversions to other media types.
"Work" shall mean the work of authorship, whether in Source or
Object form, made available under the License, as indicated by a
copyright notice that is included in or attached to the work
(an example is provided in the Appendix below).
"Derivative Works" shall mean any work, whether in Source or Object
form, that is based on (or derived from) the Work and for which the
editorial revisions, annotations, elaborations, or other modifications
represent, as a whole, an original work of authorship. For the purposes
of this License, Derivative Works shall not include works that remain
separable from, or merely link (or bind by name) to the interfaces of,
the Work and Derivative Works thereof.
"Contribution" shall mean any work of authorship, including
the original version of the Work and any modifications or additions
to that Work or Derivative Works thereof, that is intentionally
submitted to Licensor for inclusion in the Work by the copyright owner
or by an individual or Legal Entity authorized to submit on behalf of
the copyright owner. For the purposes of this definition, "submitted"
means any form of electronic, verbal, or written communication sent
to the Licensor or its representatives, including but not limited to
communication on electronic mailing lists, source code control systems,
and issue tracking systems that are managed by, or on behalf of, the
Licensor for the purpose of discussing and improving the Work, but
excluding communication that is conspicuously marked or otherwise
designated in writing by the copyright owner as "Not a Contribution."
"Contributor" shall mean Licensor and any individual or Legal Entity
on behalf of whom a Contribution has been received by Licensor and
subsequently incorporated within the Work.
2. Grant of Copyright License. Subject to the terms and conditions of
this License, each Contributor hereby grants to You a perpetual,
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
copyright license to reproduce, prepare Derivative Works of,
publicly display, publicly perform, sublicense, and distribute the
Work and such Derivative Works in Source or Object form.
3. Grant of Patent License. Subject to the terms and conditions of
this License, each Contributor hereby grants to You a perpetual,
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
(except as stated in this section) patent license to make, have made,
use, offer to sell, sell, import, and otherwise transfer the Work,
where such license applies only to those patent claims licensable
by such Contributor that are necessarily infringed by their
Contribution(s) alone or by combination of their Contribution(s)
with the Work to which such Contribution(s) was submitted. If You
institute patent litigation against any entity (including a
cross-claim or counterclaim in a lawsuit) alleging that the Work
or a Contribution incorporated within the Work constitutes direct
or contributory patent infringement, then any patent licenses
granted to You under this License for that Work shall terminate
as of the date such litigation is filed.
4. Redistribution. You may reproduce and distribute copies of the
Work or Derivative Works thereof in any medium, with or without
modifications, and in Source or Object form, provided that You
meet the following conditions:
(a) You must give any other recipients of the Work or
Derivative Works a copy of this License; and
(b) You must cause any modified files to carry prominent notices
stating that You changed the files; and
(c) You must retain, in the Source form of any Derivative Works
that You distribute, all copyright, patent, trademark, and
attribution notices from the Source form of the Work,
excluding those notices that do not pertain to any part of
the Derivative Works; and
(d) If the Work includes a "NOTICE" text file as part of its
distribution, then any Derivative Works that You distribute must
include a readable copy of the attribution notices contained
within such NOTICE file, excluding those notices that do not
pertain to any part of the Derivative Works, in at least one
of the following places: within a NOTICE text file distributed
as part of the Derivative Works; within the Source form or
documentation, if provided along with the Derivative Works; or,
within a display generated by the Derivative Works, if and
wherever such third-party notices normally appear. The contents
of the NOTICE file are for informational purposes only and
do not modify the License. You may add Your own attribution
notices within Derivative Works that You distribute, alongside
or as an addendum to the NOTICE text from the Work, provided
that such additional attribution notices cannot be construed
as modifying the License.
You may add Your own copyright statement to Your modifications and
may provide additional or different license terms and conditions
for use, reproduction, or distribution of Your modifications, or
for any such Derivative Works as a whole, provided Your use,
reproduction, and distribution of the Work otherwise complies with
the conditions stated in this License.
5. Submission of Contributions. Unless You explicitly state otherwise,
any Contribution intentionally submitted for inclusion in the Work
by You to the Licensor shall be under the terms and conditions of
this License, without any additional terms or conditions.
Notwithstanding the above, nothing herein shall supersede or modify
the terms of any separate license agreement you may have executed
with Licensor regarding such Contributions.
6. Trademarks. This License does not grant permission to use the trade
names, trademarks, service marks, or product names of the Licensor,
except as required for reasonable and customary use in describing the
origin of the Work and reproducing the content of the NOTICE file.
7. Disclaimer of Warranty. Unless required by applicable law or
agreed to in writing, Licensor provides the Work (and each
Contributor provides its Contributions) on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
implied, including, without limitation, any warranties or conditions
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
PARTICULAR PURPOSE. You are solely responsible for determining the
appropriateness of using or redistributing the Work and assume any
risks associated with Your exercise of permissions under this License.
8. Limitation of Liability. In no event and under no legal theory,
whether in tort (including negligence), contract, or otherwise,
unless required by applicable law (such as deliberate and grossly
negligent acts) or agreed to in writing, shall any Contributor be
liable to You for damages, including any direct, indirect, special,
incidental, or consequential damages of any character arising as a
result of this License or out of the use or inability to use the
Work (including but not limited to damages for loss of goodwill,
work stoppage, computer failure or malfunction, or any and all
other commercial damages or losses), even if such Contributor
has been advised of the possibility of such damages.
9. Accepting Warranty or Additional Liability. While redistributing
the Work or Derivative Works thereof, You may choose to offer,
and charge a fee for, acceptance of support, warranty, indemnity,
or other liability obligations and/or rights consistent with this
License. However, in accepting such obligations, You may act only
on Your own behalf and on Your sole responsibility, not on behalf
of any other Contributor, and only if You agree to indemnify,
defend, and hold each Contributor harmless for any liability
incurred by, or claims asserted against, such Contributor by reason
of your accepting any such warranty or additional liability.
END OF TERMS AND CONDITIONS
Copyright 2020-2022 Jina AI Limited
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
================================================
FILE: README.md
================================================
<p align="center">
<a href="https://clip-as-service.jina.ai"><img src="https://github.com/jina-ai/clip-as-service/blob/main/docs/_static/logo-light.svg?raw=true" alt="CLIP-as-service logo: The data structure for unstructured data" width="200px"></a>
<br><br><br>
</p>
<p align=center>
<a href="https://pypi.org/project/clip_server/"><img alt="PyPI" src="https://img.shields.io/pypi/v/clip_server?label=Release&style=flat-square"></a>
<a href="https://discord.jina.ai"><img src="https://img.shields.io/discord/1106542220112302130?logo=discord&logoColor=white&style=flat-square"></a>
<a href="https://codecov.io/gh/jina-ai/clip-as-service"><img alt="Codecov branch" src="https://img.shields.io/codecov/c/github/jina-ai/clip-as-service/main?logo=Codecov&logoColor=white&style=flat-square"></a>
<a href="https://colab.research.google.com/github/jina-ai/clip-as-service/blob/main/docs/hosting/cas-on-colab.ipynb"><img src="https://img.shields.io/badge/Host-on%20Google%20Colab%20(GPU/TPU)-brightgreen?style=flat-square&logo=googlecolab&&logoColor=white" alt="Host on Google Colab with GPU/TPU support"></a>
</p>
<!-- start elevator-pitch -->
CLIP-as-service is a low-latency high-scalability service for embedding images and text. It can be easily integrated as a microservice into neural search solutions.
⚡ **Fast**: Serve CLIP models with TensorRT, ONNX runtime and PyTorch w/o JIT with 800QPS<sup>[*]</sup>. Non-blocking duplex streaming on requests and responses, designed for large data and long-running tasks.
🫐 **Elastic**: Horizontally scale up and down multiple CLIP models on single GPU, with automatic load balancing.
🐥 **Easy-to-use**: No learning curve, minimalist design on client and server. Intuitive and consistent API for image and sentence embedding.
👒 **Modern**: Async client support. Easily switch between gRPC, HTTP, WebSocket protocols with TLS and compression.
🍱 **Integration**: Smooth integration with neural search ecosystem including [Jina](https://github.com/jina-ai/jina) and [DocArray](https://github.com/jina-ai/docarray). Build cross-modal and multi-modal solutions in no time.
<sup>[*] with default config (single replica, PyTorch no JIT) on GeForce RTX 3090. </sup>
<!-- end elevator-pitch -->
### Text & image embedding
<table>
<tr>
<td> via HTTPS 🔐 </td>
<td> via gRPC 🔐⚡⚡ </td>
</tr>
<tr>
<td>
```bash
curl \
-X POST https://<your-inference-address>-http.wolf.jina.ai/post \
-H 'Content-Type: application/json' \
-H 'Authorization: <your access token>' \
-d '{"data":[{"text": "First do it"},
{"text": "then do it right"},
{"text": "then do it better"},
{"uri": "https://picsum.photos/200"}],
"execEndpoint":"/"}'
```
</td>
<td>
```python
# pip install clip-client
from clip_client import Client
c = Client(
'grpcs://<your-inference-address>-grpc.wolf.jina.ai',
credential={'Authorization': '<your access token>'},
)
r = c.encode(
[
'First do it',
'then do it right',
'then do it better',
'https://picsum.photos/200',
]
)
print(r)
```
</td>
</tr>
</table>
### Visual reasoning
There are four basic visual reasoning skills: object recognition, object counting, color recognition, and spatial relation understanding. Let's try some:
> You need to install [`jq` (a JSON processor)](https://stedolan.github.io/jq/) to prettify the results.
<table>
<tr>
<td> Image </td>
<td> via HTTPS 🔐 </td>
</tr>
<tr>
<td>
<img src="https://picsum.photos/id/1/300/300">
</td>
<td>
```bash
curl \
-X POST https://<your-inference-address>-http.wolf.jina.ai/post \
-H 'Content-Type: application/json' \
-H 'Authorization: <your access token>' \
-d '{"data":[{"uri": "https://picsum.photos/id/1/300/300",
"matches": [{"text": "there is a woman in the photo"},
{"text": "there is a man in the photo"}]}],
"execEndpoint":"/rank"}' \
| jq ".data[].matches[] | (.text, .scores.clip_score.value)"
```
gives:
```
"there is a woman in the photo"
0.626907229423523
"there is a man in the photo"
0.37309277057647705
```
</td>
</tr>
<tr>
<td>
<img src="https://picsum.photos/id/133/300/300">
</td>
<td>
```bash
curl \
-X POST https://<your-inference-address>-http.wolf.jina.ai/post \
-H 'Content-Type: application/json' \
-H 'Authorization: <your access token>' \
-d '{"data":[{"uri": "https://picsum.photos/id/133/300/300",
"matches": [
{"text": "the blue car is on the left, the red car is on the right"},
{"text": "the blue car is on the right, the red car is on the left"},
{"text": "the blue car is on top of the red car"},
{"text": "the blue car is below the red car"}]}],
"execEndpoint":"/rank"}' \
| jq ".data[].matches[] | (.text, .scores.clip_score.value)"
```
gives:
```
"the blue car is on the left, the red car is on the right"
0.5232442617416382
"the blue car is on the right, the red car is on the left"
0.32878655195236206
"the blue car is below the red car"
0.11064132302999496
"the blue car is on top of the red car"
0.03732786327600479
```
</td>
</tr>
<tr>
<td>
<img src="https://picsum.photos/id/102/300/300">
</td>
<td>
```bash
curl \
-X POST https://<your-inference-address>-http.wolf.jina.ai/post \
-H 'Content-Type: application/json' \
-H 'Authorization: <your access token>' \
-d '{"data":[{"uri": "https://picsum.photos/id/102/300/300",
"matches": [{"text": "this is a photo of one berry"},
{"text": "this is a photo of two berries"},
{"text": "this is a photo of three berries"},
{"text": "this is a photo of four berries"},
{"text": "this is a photo of five berries"},
{"text": "this is a photo of six berries"}]}],
"execEndpoint":"/rank"}' \
| jq ".data[].matches[] | (.text, .scores.clip_score.value)"
```
gives:
```
"this is a photo of three berries"
0.48507222533226013
"this is a photo of four berries"
0.2377079576253891
"this is a photo of one berry"
0.11304923892021179
"this is a photo of five berries"
0.0731358453631401
"this is a photo of two berries"
0.05045759305357933
"this is a photo of six berries"
0.04057715833187103
```
</td>
</tr>
</table>
## [Documentation](https://clip-as-service.jina.ai)
## Install
CLIP-as-service consists of two Python packages `clip-server` and `clip-client` that can be installed _independently_. Both require Python 3.7+.
### Install server
<table>
<tr>
<td> Pytorch Runtime ⚡ </td>
<td> ONNX Runtime ⚡⚡</td>
<td> TensorRT Runtime ⚡⚡⚡ </td>
</tr>
<tr>
<td>
```bash
pip install clip-server
```
</td>
<td>
```bash
pip install "clip-server[onnx]"
```
</td>
<td>
```bash
pip install nvidia-pyindex
pip install "clip-server[tensorrt]"
```
</td>
</tr>
</table>
You can also [host the server on Google Colab](https://clip-as-service.jina.ai/hosting/colab/), leveraging its free GPU/TPU.
### Install client
```bash
pip install clip-client
```
### Quick check
You can run a simple connectivity check after install.
<table>
<tr>
<th> C/S </th>
<th> Command </th>
<th> Expect output </th>
</tr>
<tr>
<td>
Server
</td>
<td>
```bash
python -m clip_server
```
</td>
<td>
<img src="https://github.com/jina-ai/clip-as-service/blob/main/.github/README-img/server-output.svg?raw=true" alt="Expected server output" width="300px">
</td>
</tr>
<tr>
<td>
Client
</td>
<td>
```python
from clip_client import Client
c = Client('grpc://0.0.0.0:23456')
c.profile()
```
</td>
<td>
<img src="https://github.com/jina-ai/clip-as-service/blob/main/.github/README-img/pyclient-output.svg?raw=true" alt="Expected clip-client output" width="300px">
</td>
</tr>
</table>
You can change `0.0.0.0` to the intranet or public IP address to test the connectivity over private and public network.
## Get Started
### Basic usage
1. Start the server: `python -m clip_server`. Remember its address and port.
2. Create a client:
```python
from clip_client import Client
c = Client('grpc://0.0.0.0:51000')
```
3. To get sentence embedding:
```python
r = c.encode(['First do it', 'then do it right', 'then do it better'])
print(r.shape) # [3, 512]
```
4. To get image embedding:
```python
r = c.encode(['apple.png', # local image
'https://clip-as-service.jina.ai/_static/favicon.png', # remote image
'data:image/gif;base64,R0lGODlhEAAQAMQAAORHHOVSKudfOulrSOp3WOyDZu6QdvCchPGolfO0o/XBs/fNwfjZ0frl3/zy7////wAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAACH5BAkAABAALAAAAAAQABAAAAVVICSOZGlCQAosJ6mu7fiyZeKqNKToQGDsM8hBADgUXoGAiqhSvp5QAnQKGIgUhwFUYLCVDFCrKUE1lBavAViFIDlTImbKC5Gm2hB0SlBCBMQiB0UjIQA7']) # in image URI
print(r.shape) # [3, 512]
```
More comprehensive server and client user guides can be found in the [docs](https://clip-as-service.jina.ai/).
### Text-to-image cross-modal search in 10 lines
Let's build a text-to-image search using CLIP-as-service. Namely, a user can input a sentence and the program returns matching images. We'll use the [Totally Looks Like](https://sites.google.com/view/totally-looks-like-dataset) dataset and [DocArray](https://github.com/jina-ai/docarray) package. Note that DocArray is included within `clip-client` as an upstream dependency, so you don't need to install it separately.
#### Load images
First we load images. You can simply pull them from Jina Cloud:
```python
from docarray import DocumentArray
da = DocumentArray.pull('ttl-original', show_progress=True, local_cache=True)
```
<details>
<summary>or download TTL dataset, unzip, load manually</summary>
Alternatively, you can go to [Totally Looks Like](https://sites.google.com/view/totally-looks-like-dataset) official website, unzip and load images:
```python
from docarray import DocumentArray
da = DocumentArray.from_files(['left/*.jpg', 'right/*.jpg'])
```
</details>
The dataset contains 12,032 images, so it may take a while to pull. Once done, you can visualize it and get the first taste of those images:
```python
da.plot_image_sprites()
```
<p align="center">
<img src="https://github.com/jina-ai/clip-as-service/blob/main/.github/README-img/ttl-image-sprites.png?raw=true" alt="Visualization of the image sprite of Totally looks like dataset" width="50%">
</p>
#### Encode images
Start the server with `python -m clip_server`. Let's say it's at `0.0.0.0:51000` with `GRPC` protocol (you will get this information after running the server).
Create a Python client script:
```python
from clip_client import Client
c = Client(server='grpc://0.0.0.0:51000')
da = c.encode(da, show_progress=True)
```
Depending on your GPU and client-server network, it may take a while to embed 12K images. In my case, it took about two minutes.
<details>
<summary>Download the pre-encoded dataset</summary>
If you're impatient or don't have a GPU, waiting can be Hell. In this case, you can simply pull our pre-encoded image dataset:
```python
from docarray import DocumentArray
da = DocumentArray.pull('ttl-embedding', show_progress=True, local_cache=True)
```
</details>
#### Search via sentence
Let's build a simple prompt to allow a user to type sentence:
```python
while True:
vec = c.encode([input('sentence> ')])
r = da.find(query=vec, limit=9)
r[0].plot_image_sprites()
```
#### Showcase
Now you can input arbitrary English sentences and view the top-9 matching images. Search is fast and instinctive. Let's have some fun:
<table>
<tr>
<th> "a happy potato" </th>
<th> "a super evil AI" </th>
<th> "a guy enjoying his burger" </th>
</tr>
<tr>
<td>
<p align="center">
<img src="https://github.com/jina-ai/clip-as-service/blob/main/.github/README-img/a-happy-potato.png?raw=true" alt="Visualization of the image sprite of Totally looks like dataset" width="100%">
</p>
</td>
<td>
<p align="center">
<img src="https://github.com/jina-ai/clip-as-service/blob/main/.github/README-img/a-super-evil-AI.png?raw=true" alt="Visualization of the image sprite of Totally looks like dataset" width="100%">
</p>
</td>
<td>
<p align="center">
<img src="https://github.com/jina-ai/clip-as-service/blob/main/.github/README-img/a-guy-enjoying-his-burger.png?raw=true" alt="Visualization of the image sprite of Totally looks like dataset" width="100%">
</p>
</td>
</tr>
</table>
<table>
<tr>
<th> "professor cat is very serious" </th>
<th> "an ego engineer lives with parent" </th>
<th> "there will be no tomorrow so lets eat unhealthy" </th>
</tr>
<tr>
<td>
<p align="center">
<img src="https://github.com/jina-ai/clip-as-service/blob/main/.github/README-img/professor-cat-is-very-serious.png?raw=true" alt="Visualization of the image sprite of Totally looks like dataset" width="100%">
</p>
</td>
<td>
<p align="center">
<img src="https://github.com/jina-ai/clip-as-service/blob/main/.github/README-img/an-ego-engineer-lives-with-parent.png?raw=true" alt="Visualization of the image sprite of Totally looks like dataset" width="100%">
</p>
</td>
<td>
<p align="center">
<img src="https://github.com/jina-ai/clip-as-service/blob/main/.github/README-img/there-will-be-no-tomorrow-so-lets-eat-unhealthy.png?raw=true" alt="Visualization of the image sprite of Totally looks like dataset" width="100%">
</p>
</td>
</tr>
</table>
Let's save the embedding result for our next example:
```python
da.save_binary('ttl-image')
```
### Image-to-text cross-modal search in 10 Lines
We can also switch the input and output of the last program to achieve image-to-text search. Precisely, given a query image find the sentence that best describes the image.
Let's use all sentences from the book "Pride and Prejudice".
```python
from docarray import Document, DocumentArray
d = Document(uri='https://www.gutenberg.org/files/1342/1342-0.txt').load_uri_to_text()
da = DocumentArray(
Document(text=s.strip()) for s in d.text.replace('\r\n', '').split('.') if s.strip()
)
```
Let's look at what we got:
```python
da.summary()
```
```text
Documents Summary
Length 6403
Homogenous Documents True
Common Attributes ('id', 'text')
Attributes Summary
Attribute Data type #Unique values Has empty value
──────────────────────────────────────────────────────────
id ('str',) 6403 False
text ('str',) 6030 False
```
#### Encode sentences
Now encode these 6,403 sentences, it may take 10 seconds or less depending on your GPU and network:
```python
from clip_client import Client
c = Client('grpc://0.0.0.0:51000')
r = c.encode(da, show_progress=True)
```
<details>
<summary>Download the pre-encoded dataset</summary>
Again, for people who are impatient or don't have a GPU, we have prepared a pre-encoded text dataset:
```python
from docarray import DocumentArray
da = DocumentArray.pull('ttl-textual', show_progress=True, local_cache=True)
```
</details>
#### Search via image
Let's load our previously stored image embedding, randomly sample 10 image Documents, then find top-1 nearest neighbour of each.
```python
from docarray import DocumentArray
img_da = DocumentArray.load_binary('ttl-image')
for d in img_da.sample(10):
print(da.find(d.embedding, limit=1)[0].text)
```
#### Showcase
Fun time! Note, unlike the previous example, here the input is an image and the sentence is the output. All sentences come from the book "Pride and Prejudice".
<table>
<tr>
<td>
<p align="center">
<img src="https://github.com/jina-ai/clip-as-service/blob/main/.github/README-img/Besides,-there-was-truth-in-his-looks.png?raw=true" alt="Visualization of the image sprite of Totally looks like dataset" height="100px">
</p>
</td>
<td>
<p align="center">
<img src="https://github.com/jina-ai/clip-as-service/blob/main/.github/README-img/Gardiner-smiled.png?raw=true" alt="Visualization of the image sprite of Totally looks like dataset" height="100px">
</p>
</td>
<td>
<p align="center">
<img src="https://github.com/jina-ai/clip-as-service/blob/main/.github/README-img/what’s-his-name.png?raw=true" alt="Visualization of the image sprite of Totally looks like dataset" height="100px">
</p>
</td>
<td>
<p align="center">
<img src="https://github.com/jina-ai/clip-as-service/blob/main/.github/README-img/By-tea-time,-however,-the-dose-had-been-enough,-and-Mr.png?raw=true" alt="Visualization of the image sprite of Totally looks like dataset" height="100px">
</p>
</td>
<td>
<p align="center">
<img src="https://github.com/jina-ai/clip-as-service/blob/main/.github/README-img/You-do-not-look-well.png?raw=true" alt="Visualization of the image sprite of Totally looks like dataset" height="100px">
</p>
</td>
</tr>
<tr>
<td>Besides, there was truth in his looks</td>
<td>Gardiner smiled</td>
<td>what’s his name</td>
<td>By tea time, however, the dose had been enough, and Mr</td>
<td>You do not look well</td>
</tr>
</table>
<table>
<tr>
<td>
<p align="center">
<img src="https://github.com/jina-ai/clip-as-service/blob/main/.github/README-img/“A-gamester!”-she-cried.png?raw=true" alt="Visualization of the image sprite of Totally looks like dataset" height="100px">
</p>
</td>
<td>
<p align="center">
<img src="https://github.com/jina-ai/clip-as-service/blob/main/.github/README-img/If-you-mention-my-name-at-the-Bell,-you-will-be-attended-to.png?raw=true" alt="Visualization of the image sprite of Totally looks like dataset" height="100px">
</p>
</td>
<td>
<p align="center">
<img src="https://github.com/jina-ai/clip-as-service/blob/main/.github/README-img/Never-mind-Miss-Lizzy’s-hair.png?raw=true" alt="Visualization of the image sprite of Totally looks like dataset" height="100px">
</p>
</td>
<td>
<p align="center">
<img src="https://github.com/jina-ai/clip-as-service/blob/main/.github/README-img/Elizabeth-will-soon-be-the-wife-of-Mr.png?raw=true" alt="Visualization of the image sprite of Totally looks like dataset" height="100px">
</p>
</td>
<td>
<p align="center">
<img src="https://github.com/jina-ai/clip-as-service/blob/main/.github/README-img/I-saw-them-the-night-before-last.png?raw=true" alt="Visualization of the image sprite of Totally looks like dataset" height="100px">
</p>
</td>
</tr>
<tr>
<td>“A gamester!” she cried</td>
<td>If you mention my name at the Bell, you will be attended to</td>
<td>Never mind Miss Lizzy’s hair</td>
<td>Elizabeth will soon be the wife of Mr</td>
<td>I saw them the night before last</td>
</tr>
</table>
### Rank image-text matches via CLIP model
From `0.3.0` CLIP-as-service adds a new `/rank` endpoint that re-ranks cross-modal matches according to their joint likelihood in CLIP model. For example, given an image Document with some predefined sentence matches as below:
```python
from clip_client import Client
from docarray import Document
c = Client(server='grpc://0.0.0.0:51000')
r = c.rank(
[
Document(
uri='.github/README-img/rerank.png',
matches=[
Document(text=f'a photo of a {p}')
for p in (
'control room',
'lecture room',
'conference room',
'podium indoor',
'television studio',
)
],
)
]
)
print(r['@m', ['text', 'scores__clip_score__value']])
```
```text
[['a photo of a television studio', 'a photo of a conference room', 'a photo of a lecture room', 'a photo of a control room', 'a photo of a podium indoor'],
[0.9920725226402283, 0.006038925610482693, 0.0009973491542041302, 0.00078492151806131, 0.00010626466246321797]]
```
One can see now `a photo of a television studio` is ranked to the top with `clip_score` score at `0.992`. In practice, one can use this endpoint to re-rank the matching result from another search system, for improving the cross-modal search quality.
<table>
<tr>
<td>
<img src="https://github.com/jina-ai/clip-as-service/blob/main/.github/README-img/rerank.png?raw=true" alt="Rerank endpoint image input" height="150px">
</td>
<td>
<img src="https://github.com/jina-ai/clip-as-service/blob/main/.github/README-img/rerank-chart.svg?raw=true" alt="Rerank endpoint output">
</td>
</tr>
</table>
### Rank text-image matches via CLIP model
In the [DALL·E Flow](https://github.com/jina-ai/dalle-flow) project, CLIP is called for ranking the generated results from DALL·E. [It has an Executor wrapped on top of `clip-client`](https://github.com/jina-ai/dalle-flow/blob/main/executors/rerank/executor.py), which calls `.arank()` - the async version of `.rank()`:
```python
from clip_client import Client
from jina import Executor, requests, DocumentArray
class ReRank(Executor):
def __init__(self, clip_server: str, **kwargs):
super().__init__(**kwargs)
self._client = Client(server=clip_server)
@requests(on='/')
async def rerank(self, docs: DocumentArray, **kwargs):
return await self._client.arank(docs)
```
<p align="center">
<img src="https://github.com/jina-ai/clip-as-service/blob/main/.github/README-img/client-dalle.png?raw=true" alt="CLIP-as-service used in DALLE Flow" width="300px">
</p>
Intrigued? That's only scratching the surface of what CLIP-as-service is capable of. [Read our docs to learn more](https://clip-as-service.jina.ai).
<!-- start support-pitch -->
## Support
- Join our [Discord community](https://discord.jina.ai) and chat with other community members about ideas.
- Watch our [Engineering All Hands](https://youtube.com/playlist?list=PL3UBBWOUVhFYRUa_gpYYKBqEAkO4sxmne) to learn Jina's new features and stay up-to-date with the latest AI techniques.
- Subscribe to the latest video tutorials on our [YouTube channel](https://youtube.com/c/jina-ai)
## Join Us
CLIP-as-service is backed by [Jina AI](https://jina.ai) and licensed under [Apache-2.0](./LICENSE). [We are actively hiring](https://jobs.jina.ai) AI engineers, solution engineers to build the next neural search ecosystem in open-source.
<!-- end support-pitch -->
================================================
FILE: client/clip_client/__init__.py
================================================
__version__ = '0.8.4'
import os
from clip_client.client import Client
if 'NO_VERSION_CHECK' not in os.environ:
from clip_client.helper import is_latest_version
is_latest_version(github_repo='clip-as-service')
================================================
FILE: client/clip_client/client.py
================================================
import mimetypes
import os
import time
import warnings
from typing import (
overload,
TYPE_CHECKING,
Optional,
Union,
Iterator,
Generator,
Iterable,
Dict,
)
from urllib.parse import urlparse
from functools import partial
from docarray import DocumentArray
if TYPE_CHECKING:
import numpy as np
from docarray import Document
from jina.clients.base import CallbackFnType
class Client:
def __init__(self, server: str, credential: dict = {}, **kwargs):
"""Create a Clip client object that connects to the Clip server.
Server scheme is in the format of ``scheme://netloc:port``, where
- scheme: one of grpc, websocket, http, grpcs, websockets, https
- netloc: the server ip address or hostname
- port: the public port of the server
:param server: the server URI
:param credential: the credential for authentication ``{'Authentication': '<token>'}``
"""
try:
r = urlparse(server)
_port = r.port
self._scheme = r.scheme
except:
raise ValueError(f'{server} is not a valid scheme')
_tls = False
if self._scheme in ('grpcs', 'https', 'wss'):
self._scheme = self._scheme[:-1]
_tls = True
if self._scheme == 'ws':
self._scheme = 'websocket' # temp fix for the core
if credential:
warnings.warn(
'Credential is not supported for websocket, please use grpc or http'
)
if self._scheme in ('grpc', 'http', 'websocket'):
_kwargs = dict(host=r.hostname, port=_port, protocol=self._scheme, tls=_tls)
from jina import Client
self._client = Client(**_kwargs)
self._async_client = Client(**_kwargs, asyncio=True)
else:
raise ValueError(f'{server} is not a valid scheme')
self._authorization = credential.get(
'Authorization', os.environ.get('CLIP_AUTH_TOKEN')
)
def profile(self, content: Optional[str] = '') -> Dict[str, float]:
"""Profiling a single query's roundtrip including network and computation latency. Results is summarized in a table.
:param content: the content to be sent for profiling. By default it sends an empty Document
that helps you understand the network latency.
:return: the latency report in a dict.
"""
st = time.perf_counter()
r = self._client.post(
'/', self._iter_doc([content], DocumentArray()), return_responses=True
)
ed = (time.perf_counter() - st) * 1000
route = r[0].routes
gateway_time = (
route[0].end_time.ToMilliseconds() - route[0].start_time.ToMilliseconds()
)
clip_time = (
route[1].end_time.ToMilliseconds() - route[1].start_time.ToMilliseconds()
)
network_time = ed - gateway_time
server_network = gateway_time - clip_time
from rich.table import Table
def make_table(_title, _time, _percent):
table = Table(show_header=False, box=None)
table.add_row(
_title, f'[b]{_time:.0f}[/b]ms', f'[dim]{_percent * 100:.0f}%[/dim]'
)
return table
from rich.tree import Tree
t = Tree(make_table('Roundtrip', ed, 1))
t.add(make_table('Client-server network', network_time, network_time / ed))
t2 = t.add(make_table('Server', gateway_time, gateway_time / ed))
t2.add(
make_table(
'Gateway-CLIP network', server_network, server_network / gateway_time
)
)
t2.add(make_table('CLIP model', clip_time, clip_time / gateway_time))
from rich import print
print(t)
return {
'Roundtrip': ed,
'Client-server network': network_time,
'Server': gateway_time,
'Gateway-CLIP network': server_network,
'CLIP model': clip_time,
}
def _update_pbar(self, response, func: Optional['CallbackFnType'] = None):
from rich import filesize
r = response.data.docs
if not self._pbar._tasks[self._r_task].started:
self._pbar.start_task(self._r_task)
self._pbar.update(
self._r_task,
advance=len(r),
total_size=str(
filesize.decimal(int(os.environ.get('JINA_GRPC_RECV_BYTES', '0')))
),
)
if func is not None:
func(response)
def _prepare_streaming(self, disable, total):
if total is None:
total = 500
warnings.warn(
'The length of the input is unknown, the progressbar would not be accurate.'
)
elif total > 500:
warnings.warn(
'Please ensure all the inputs are valid, otherwise the request will be aborted.'
)
from docarray.array.mixins.io.pbar import get_pbar
self._pbar = get_pbar(disable)
os.environ['JINA_GRPC_SEND_BYTES'] = '0'
os.environ['JINA_GRPC_RECV_BYTES'] = '0'
self._r_task = self._pbar.add_task(
':arrow_down: Progress', total=total, total_size=0, start=False
)
@staticmethod
def _gather_result(
response, results: 'DocumentArray', attribute: Optional[str] = None
):
r = response.data.docs
if attribute:
results[r[:, 'id']][:, attribute] = r[:, attribute]
def _iter_doc(
self, content, results: Optional['DocumentArray'] = None
) -> Generator['Document', None, None]:
from docarray import Document
for c in content:
if isinstance(c, str):
_mime = mimetypes.guess_type(c)[0]
if _mime and _mime.startswith('image'):
d = Document(
uri=c,
).load_uri_to_blob()
else:
d = Document(text=c)
elif isinstance(c, Document):
if c.content_type in ('text', 'blob'):
d = c
elif not c.blob and c.uri:
c.load_uri_to_blob()
d = c
elif c.tensor is not None:
d = c
else:
raise TypeError(f'unsupported input type {c!r} {c.content_type}')
else:
raise TypeError(f'unsupported input type {c!r}')
if results is not None:
results.append(d)
yield d
def _get_post_payload(
self, content, results: Optional['DocumentArray'] = None, **kwargs
):
payload = dict(
inputs=self._iter_doc(content, results),
request_size=kwargs.get('batch_size', 8),
total_docs=len(content) if hasattr(content, '__len__') else None,
)
if self._scheme == 'grpc' and self._authorization:
payload.update(metadata=(('authorization', self._authorization),))
elif self._scheme == 'http' and self._authorization:
payload.update(headers={'Authorization': self._authorization})
return payload
@staticmethod
def _unboxed_result(results: Optional['DocumentArray'] = None, unbox: bool = False):
if results is not None:
if results.embeddings is None:
raise ValueError(
'Empty embedding returned from the server. '
'This often due to a mis-config of the server, '
'restarting the server or changing the serving port number often solves the problem'
)
return results.embeddings if unbox else results
@overload
def encode(
self,
content: Iterable[str],
*,
batch_size: Optional[int] = None,
show_progress: bool = False,
parameters: Optional[dict] = None,
on_done: Optional['CallbackFnType'] = None,
on_error: Optional['CallbackFnType'] = None,
on_always: Optional['CallbackFnType'] = None,
prefetch: int = 100,
) -> 'np.ndarray':
"""Encode images and texts into embeddings where the input is an iterable of raw strings.
Each image and text must be represented as a string. The following strings are acceptable:
- local image filepath, will be considered as an image
- remote image http/https, will be considered as an image
- a dataURI, will be considered as an image
- plain text, will be considered as a sentence
:param content: an iterator of image URIs or sentences, each element is an image or a text sentence as a string.
:param batch_size: the number of elements in each request when sending ``content``
:param show_progress: if set, show a progress bar
:param parameters: the parameters for the encoding, you can specify the model to use when you have multiple models
:param on_done: the callback function executed while streaming, after successful completion of each request.
It takes the response ``DataRequest`` as the only argument
:param on_error: the callback function executed while streaming, after failed completion of each request.
It takes the response ``DataRequest`` as the only argument
:param on_always: the callback function executed while streaming, after completion of each request.
It takes the response ``DataRequest`` as the only argument
:param prefetch: the number of in-flight batches made by the post() method. Use a lower value for expensive
operations, and a higher value for faster response times
:return: the embedding in a numpy ndarray with shape ``[N, D]``. ``N`` is in the same length of ``content``
"""
...
@overload
def encode(
self,
content: Union['DocumentArray', Iterable['Document']],
*,
batch_size: Optional[int] = None,
show_progress: bool = False,
parameters: Optional[dict] = None,
on_done: Optional['CallbackFnType'] = None,
on_error: Optional['CallbackFnType'] = None,
on_always: Optional['CallbackFnType'] = None,
prefetch: int = 100,
) -> 'DocumentArray':
"""Encode images and texts into embeddings where the input is an iterable of :class:`docarray.Document`.
:param content: an iterable of :class:`docarray.Document`, each Document must be filled with `.uri`, `.text` or `.blob`.
:param batch_size: the number of elements in each request when sending ``content``
:param show_progress: if set, show a progress bar
:param parameters: the parameters for the encoding, you can specify the model to use when you have multiple models
:param on_done: the callback function executed while streaming, after successful completion of each request.
It takes the response ``DataRequest`` as the only argument
:param on_error: the callback function executed while streaming, after failed completion of each request.
It takes the response ``DataRequest`` as the only argument
:param on_always: the callback function executed while streaming, after completion of each request.
It takes the response ``DataRequest`` as the only argument
:param prefetch: the number of in-flight batches made by the post() method. Use a lower value for expensive
operations, and a higher value for faster response times
:return: the embedding in a numpy ndarray with shape ``[N, D]``. ``N`` is in the same length of ``content``
"""
...
def encode(self, content, **kwargs):
if isinstance(content, str):
raise TypeError(
f'Content must be an Iterable of [str, Document], try `.encode(["{content}"])` instead'
)
if hasattr(content, '__len__') and len(content) == 0:
return DocumentArray() if isinstance(content, DocumentArray) else []
self._prepare_streaming(
not kwargs.get('show_progress'),
total=len(content) if hasattr(content, '__len__') else None,
)
on_done = kwargs.pop('on_done', None)
on_error = kwargs.pop('on_error', None)
on_always = kwargs.pop('on_always', None)
prefetch = kwargs.pop('prefetch', 100)
results = DocumentArray() if not on_done and not on_always else None
if not on_done:
on_done = partial(
self._gather_result, results=results, attribute='embedding'
)
with self._pbar:
parameters = kwargs.pop('parameters', {})
parameters['drop_image_content'] = parameters.get(
'drop_image_content', True
)
model_name = parameters.pop('model_name', '') if parameters else ''
self._client.post(
on=f'/encode/{model_name}'.rstrip('/'),
**self._get_post_payload(content, results, **kwargs),
on_done=on_done,
on_error=on_error,
on_always=partial(self._update_pbar, func=on_always),
parameters=parameters,
prefetch=prefetch,
)
unbox = hasattr(content, '__len__') and isinstance(content[0], str)
return self._unboxed_result(results, unbox)
@overload
async def aencode(
self,
content: Iterator[str],
*,
batch_size: Optional[int] = None,
show_progress: bool = False,
parameters: Optional[dict] = None,
on_done: Optional['CallbackFnType'] = None,
on_error: Optional['CallbackFnType'] = None,
on_always: Optional['CallbackFnType'] = None,
prefetch: int = 100,
) -> 'np.ndarray':
...
@overload
async def aencode(
self,
content: Union['DocumentArray', Iterable['Document']],
*,
batch_size: Optional[int] = None,
show_progress: bool = False,
parameters: Optional[dict] = None,
on_done: Optional['CallbackFnType'] = None,
on_error: Optional['CallbackFnType'] = None,
on_always: Optional['CallbackFnType'] = None,
prefetch: int = 100,
) -> 'DocumentArray':
...
async def aencode(self, content, **kwargs):
if isinstance(content, str):
raise TypeError(
f'Content must be an Iterable of [str, Document], try `.aencode(["{content}"])` instead'
)
if hasattr(content, '__len__') and len(content) == 0:
return DocumentArray() if isinstance(content, DocumentArray) else []
self._prepare_streaming(
not kwargs.get('show_progress'),
total=len(content) if hasattr(content, '__len__') else None,
)
on_done = kwargs.pop('on_done', None)
on_error = kwargs.pop('on_error', None)
on_always = kwargs.pop('on_always', None)
prefetch = kwargs.pop('prefetch', 100)
results = DocumentArray() if not on_done and not on_always else None
if not on_done:
on_done = partial(
self._gather_result, results=results, attribute='embedding'
)
with self._pbar:
parameters = kwargs.pop('parameters', {})
parameters['drop_image_content'] = parameters.get(
'drop_image_content', True
)
model_name = parameters.get('model_name', '') if parameters else ''
async for _ in self._async_client.post(
on=f'/encode/{model_name}'.rstrip('/'),
**self._get_post_payload(content, results, **kwargs),
on_done=on_done,
on_error=on_error,
on_always=partial(self._update_pbar, func=on_always),
parameters=parameters,
prefetch=prefetch,
):
continue
unbox = hasattr(content, '__len__') and isinstance(content[0], str)
return self._unboxed_result(results, unbox)
def _iter_rank_docs(
self, content, results: Optional['DocumentArray'] = None, source='matches'
) -> Generator['Document', None, None]:
from docarray import Document
for c in content:
if isinstance(c, Document):
d = self._prepare_rank_doc(c, source)
else:
raise TypeError(f'Unsupported input type {c!r}')
gitextract_i8arbao_/
├── .dockerignore
├── .github/
│ ├── README-exec/
│ │ ├── onnx.readme.md
│ │ └── torch.readme.md
│ ├── codecov.yml
│ ├── labeler.yml
│ ├── release-template.ejs
│ └── workflows/
│ ├── cd.yml
│ ├── ci.yml
│ ├── force-docker-build-cas.yml
│ ├── force-docker-build.yml
│ ├── force-docs-build.yml
│ ├── force-hub-push.yml
│ ├── force-release.yml
│ ├── label-pr.yml
│ └── tag.yml
├── .gitignore
├── .pre-commit-config.yaml
├── CHANGELOG.md
├── Dockerfiles/
│ ├── base.Dockerfile
│ ├── cuda.Dockerfile
│ ├── server.Dockerfile
│ └── tensorrt.Dockerfile
├── LICENSE
├── README.md
├── client/
│ ├── clip_client/
│ │ ├── __init__.py
│ │ ├── client.py
│ │ └── helper.py
│ └── setup.py
├── docs/
│ ├── Makefile
│ ├── _static/
│ │ ├── cas-grafana.json
│ │ ├── demo-embed.html
│ │ ├── demo-text-rank.html
│ │ └── main.css
│ ├── _templates/
│ │ ├── page.html
│ │ └── sidebar/
│ │ ├── brand.html
│ │ └── navigation.html
│ ├── changelog/
│ │ └── index.md
│ ├── conf.py
│ ├── hosting/
│ │ ├── by-jina.md
│ │ ├── cas-on-colab.ipynb
│ │ ├── colab.md
│ │ └── on-jcloud.md
│ ├── html_extra/
│ │ └── robots.txt
│ ├── index.md
│ ├── makedoc.sh
│ ├── playground/
│ │ ├── embedding.md
│ │ ├── reasoning.md
│ │ └── searching.md
│ ├── requirements.txt
│ └── user-guides/
│ ├── benchmark.rst
│ ├── client.md
│ ├── faq.md
│ ├── finetuner.md
│ ├── retriever.md
│ └── server.md
├── scripts/
│ ├── MANIFEST.in
│ ├── benchmark.py
│ ├── black.sh
│ ├── docstrings_lint.sh
│ ├── get-all-test-paths.sh
│ ├── get-last-release-note.py
│ ├── get-requirements.py
│ ├── onnx_helper.py
│ ├── release.sh
│ └── setup.py
├── server/
│ ├── MANIFEST.in
│ ├── clip_server/
│ │ ├── __init__.py
│ │ ├── __main__.py
│ │ ├── executors/
│ │ │ ├── __init__.py
│ │ │ ├── clip_onnx.py
│ │ │ ├── clip_tensorrt.py
│ │ │ ├── clip_torch.py
│ │ │ └── helper.py
│ │ ├── helper.py
│ │ ├── model/
│ │ │ ├── __init__.py
│ │ │ ├── clip.py
│ │ │ ├── clip_model.py
│ │ │ ├── clip_onnx.py
│ │ │ ├── clip_trt.py
│ │ │ ├── cnclip_model.py
│ │ │ ├── flash_attention.py
│ │ │ ├── mclip_model.py
│ │ │ ├── model.py
│ │ │ ├── openclip_model.py
│ │ │ ├── pretrained_models.py
│ │ │ ├── simple_tokenizer.py
│ │ │ ├── tokenization.py
│ │ │ └── trt_utils.py
│ │ ├── onnx-flow.yml
│ │ ├── tensorrt-flow.yml
│ │ └── torch-flow.yml
│ └── setup.py
└── tests/
├── __init__.py
├── conftest.py
├── test_asyncio.py
├── test_client.py
├── test_helper.py
├── test_model.py
├── test_ranker.py
├── test_search.py
├── test_server.py
├── test_simple.py
├── test_tensorrt.py
└── test_tokenization.py
SYMBOL INDEX (222 symbols across 34 files)
FILE: client/clip_client/client.py
class Client (line 25) | class Client:
method __init__ (line 26) | def __init__(self, server: str, credential: dict = {}, **kwargs):
method profile (line 68) | def profile(self, content: Optional[str] = '') -> Dict[str, float]:
method _update_pbar (line 122) | def _update_pbar(self, response, func: Optional['CallbackFnType'] = No...
method _prepare_streaming (line 138) | def _prepare_streaming(self, disable, total):
method _gather_result (line 161) | def _gather_result(
method _iter_doc (line 168) | def _iter_doc(
method _get_post_payload (line 199) | def _get_post_payload(
method _unboxed_result (line 215) | def _unboxed_result(results: Optional['DocumentArray'] = None, unbox: ...
method encode (line 226) | def encode(
method encode (line 261) | def encode(
method encode (line 290) | def encode(self, content, **kwargs):
method aencode (line 333) | async def aencode(
method aencode (line 348) | async def aencode(
method aencode (line 362) | async def aencode(self, content, **kwargs):
method _iter_rank_docs (line 405) | def _iter_rank_docs(
method _get_rank_payload (line 419) | def _get_rank_payload(
method _prepare_single_doc (line 436) | def _prepare_single_doc(d: 'Document'):
method _prepare_rank_doc (line 448) | def _prepare_rank_doc(d: 'Document', _source: str = 'matches'):
method rank (line 456) | def rank(
method arank (line 503) | async def arank(
method index (line 542) | def index(
method index (line 578) | def index(
method index (line 608) | def index(self, content, **kwargs):
method aindex (line 647) | async def aindex(
method aindex (line 662) | async def aindex(
method aindex (line 676) | async def aindex(self, content, **kwargs):
method search (line 716) | def search(
method search (line 751) | def search(
method search (line 785) | def search(self, content, limit: int = 10, **kwargs) -> 'DocumentArray':
method asearch (line 823) | async def asearch(
method asearch (line 839) | async def asearch(
method asearch (line 854) | async def asearch(self, content, limit: int = 10, **kwargs):
FILE: client/clip_client/helper.py
function _version_check (line 12) | def _version_check(package: str = None, github_repo: str = None):
function is_latest_version (line 47) | def is_latest_version(package: str = None, github_repo: str = None) -> N...
FILE: docs/conf.py
function add_server_address (line 188) | def add_server_address(app):
function setup (line 195) | def setup(app):
FILE: scripts/benchmark.py
function warn (line 10) | def warn(*args, **kwargs):
class BenchmarkClient (line 22) | class BenchmarkClient(threading.Thread):
method __init__ (line 23) | def __init__(
method run (line 47) | def run(self):
function main (line 107) | def main(server, batch_sizes, num_iter, concurrent_clients, image_sample):
FILE: scripts/onnx_helper.py
function convert_float_to_float16 (line 1) | def convert_float_to_float16(model_path: str, output_model_path: str):
function quantize (line 29) | def quantize(model_path: str, output_model_path: str):
FILE: server/clip_server/executors/clip_onnx.py
class CLIPEncoder (line 21) | class CLIPEncoder(Executor):
method __init__ (line 22) | def __init__(
method _preproc_images (line 113) | def _preproc_images(self, docs: 'DocumentArray', drop_image_content: b...
method _preproc_texts (line 127) | def _preproc_texts(self, docs: 'DocumentArray'):
method rank (line 136) | async def rank(self, docs: 'DocumentArray', parameters: Dict, **kwargs):
method encode (line 143) | async def encode(
FILE: server/clip_server/executors/clip_tensorrt.py
class CLIPEncoder (line 20) | class CLIPEncoder(Executor):
method __init__ (line 21) | def __init__(
method _preproc_images (line 76) | def _preproc_images(self, docs: 'DocumentArray', drop_image_content: b...
method _preproc_texts (line 90) | def _preproc_texts(self, docs: 'DocumentArray'):
method rank (line 104) | async def rank(self, docs: 'DocumentArray', parameters: Dict, **kwargs):
method encode (line 111) | async def encode(
FILE: server/clip_server/executors/clip_torch.py
class CLIPEncoder (line 23) | class CLIPEncoder(Executor):
method __init__ (line 24) | def __init__(
method _preproc_images (line 100) | def _preproc_images(self, docs: 'DocumentArray', drop_image_content: b...
method _preproc_texts (line 115) | def _preproc_texts(self, docs: 'DocumentArray'):
method rank (line 129) | async def rank(self, docs: 'DocumentArray', parameters: Dict, **kwargs):
method encode (line 136) | async def encode(
FILE: server/clip_server/executors/helper.py
function numpy_softmax (line 12) | def numpy_softmax(x: 'np.ndarray', axis: int = -1) -> 'np.ndarray':
function preproc_image (line 20) | def preproc_image(
function preproc_text (line 59) | def preproc_text(
function split_img_txt_da (line 82) | def split_img_txt_da(doc: 'Document', img_da: 'DocumentArray', txt_da: '...
function set_rank (line 89) | def set_rank(docs, _logit_scale=np.exp(4.60517)):
function get_image_size (line 127) | def get_image_size(name: str):
FILE: server/clip_server/helper.py
function _version_check (line 26) | def _version_check(package: str = None, github_repo: str = None):
function is_latest_version (line 61) | def is_latest_version(package: str = None, github_repo: str = None) -> N...
FILE: server/clip_server/model/clip.py
function _convert_image_to_rgb (line 17) | def _convert_image_to_rgb(image):
function _blob2image (line 21) | def _blob2image(blob):
function _transform_blob (line 25) | def _transform_blob(n_px):
function _transform_ndarray (line 41) | def _transform_ndarray(n_px):
FILE: server/clip_server/model/clip_model.py
class BaseCLIPModel (line 9) | class BaseCLIPModel:
method __init__ (line 10) | def __init__(self, name: str, **kwargs):
method get_model_name (line 15) | def get_model_name(name: str):
method model_name (line 19) | def model_name(self):
method image_size (line 23) | def image_size(self):
class CLIPModel (line 27) | class CLIPModel(BaseCLIPModel):
method __new__ (line 28) | def __new__(cls, name: str, **kwargs):
FILE: server/clip_server/model/clip_onnx.py
class CLIPOnnxModel (line 203) | class CLIPOnnxModel(BaseCLIPModel):
method __init__ (line 204) | def __init__(
method get_model_name (line 252) | def get_model_name(name: str):
method start_sessions (line 264) | def start_sessions(
method encode_image (line 301) | def encode_image(self, image_input: Dict):
method encode_text (line 305) | def encode_text(self, text_input: Dict):
FILE: server/clip_server/model/clip_trt.py
class CLIPTensorRTModel (line 50) | class CLIPTensorRTModel(BaseCLIPModel):
method __init__ (line 51) | def __init__(
method get_model_name (line 124) | def get_model_name(name: str):
method start_engines (line 136) | def start_engines(self):
method encode_image (line 142) | def encode_image(self, image_input: Dict):
method encode_text (line 146) | def encode_text(self, text_input: Dict):
FILE: server/clip_server/model/cnclip_model.py
class CNClipModel (line 18) | class CNClipModel(CLIPModel):
method __init__ (line 19) | def __init__(
method get_model_name (line 36) | def get_model_name(name: str):
method encode_text (line 39) | def encode_text(self, input_ids: 'torch.Tensor', **kwargs):
method encode_image (line 42) | def encode_image(self, pixel_values: 'torch.Tensor', **kwargs):
method model_name (line 46) | def model_name(self):
method image_size (line 50) | def image_size(self):
FILE: server/clip_server/model/flash_attention.py
class MultiheadAttention (line 10) | class MultiheadAttention(nn.MultiheadAttention):
method __init__ (line 11) | def __init__(
method attention (line 39) | def attention(
method forward (line 85) | def forward(
FILE: server/clip_server/model/mclip_model.py
class MCLIPConfig (line 17) | class MCLIPConfig(transformers.PretrainedConfig):
method __init__ (line 20) | def __init__(
class MultilingualCLIP (line 33) | class MultilingualCLIP(transformers.PreTrainedModel):
method __init__ (line 36) | def __init__(self, config, *args, **kwargs):
method forward (line 43) | def forward(self, input_ids: torch.Tensor, attention_mask: torch.Tenso...
class MultilingualCLIPModel (line 53) | class MultilingualCLIPModel(CLIPModel):
method __init__ (line 54) | def __init__(self, name: str, device: str = 'cpu', jit: bool = False, ...
method get_model_name (line 62) | def get_model_name(name: str):
method encode_text (line 65) | def encode_text(
method encode_image (line 72) | def encode_image(self, pixel_values: torch.Tensor):
FILE: server/clip_server/model/model.py
class ModifiedResNet (line 40) | class ModifiedResNet(_ModifiedResNet):
method forward (line 41) | def forward(self, x):
class ResidualAttentionBlock (line 47) | class ResidualAttentionBlock(_ResidualAttentionBlock):
method __init__ (line 48) | def __init__(
class Transformer (line 65) | class Transformer(_Transformer):
method __init__ (line 66) | def __init__(self, layers: int, dtype: torch.dtype = torch.float32, **...
class VisionTransformer (line 73) | class VisionTransformer(_VisionTransformer):
method __init__ (line 74) | def __init__(
method forward (line 92) | def forward(self, x: torch.Tensor):
class TextTransformer (line 98) | class TextTransformer(_TextTransformer):
method __init__ (line 99) | def __init__(
class CLIPVisionCfg (line 113) | class CLIPVisionCfg:
class CLIPTextCfg (line 138) | class CLIPTextCfg:
function _build_vision_tower (line 152) | def _build_vision_tower(
function _build_text_tower (line 211) | def _build_text_tower(
class CustomTextCLIP (line 249) | class CustomTextCLIP(_CustomTextCLIP):
method __init__ (line 250) | def __init__(
class CLIP (line 270) | class CLIP(_CLIP):
method __init__ (line 271) | def __init__(
function convert_weights_to_lp (line 300) | def convert_weights_to_lp(model: nn.Module, dtype=torch.float16):
function load_state_dict (line 332) | def load_state_dict(checkpoint_path: str, map_location='cpu'):
function build_model_from_openai_state_dict (line 343) | def build_model_from_openai_state_dict(
function load_openai_model (line 430) | def load_openai_model(
function load_openclip_model (line 562) | def load_openclip_model(
FILE: server/clip_server/model/openclip_model.py
class OpenCLIPModel (line 15) | class OpenCLIPModel(CLIPModel):
method __init__ (line 16) | def __init__(
method get_model_name (line 51) | def get_model_name(name: str):
method encode_text (line 60) | def encode_text(self, input_ids: 'torch.Tensor', **kwargs):
method encode_image (line 63) | def encode_image(self, pixel_values: 'torch.Tensor', **kwargs):
FILE: server/clip_server/model/pretrained_models.py
function md5file (line 132) | def md5file(filename: str):
function get_model_url_md5 (line 141) | def get_model_url_md5(name: str):
function download_model (line 149) | def download_model(
FILE: server/clip_server/model/simple_tokenizer.py
function default_bpe (line 15) | def default_bpe():
function bytes_to_unicode (line 20) | def bytes_to_unicode():
function get_pairs (line 46) | def get_pairs(word):
function basic_clean (line 58) | def basic_clean(text):
function whitespace_clean (line 64) | def whitespace_clean(text):
class SimpleTokenizer (line 70) | class SimpleTokenizer(object):
method __init__ (line 71) | def __init__(self, bpe_path: str = default_bpe()):
method bpe (line 94) | def bpe(self, token):
method encode (line 135) | def encode(self, text):
method decode (line 145) | def decode(self, tokens):
FILE: server/clip_server/model/tokenization.py
class Tokenizer (line 9) | class Tokenizer:
method __init__ (line 10) | def __init__(self, name: str, **kwargs):
method __call__ (line 25) | def __call__(
method _tokenize (line 47) | def _tokenize(
FILE: server/clip_server/model/trt_utils.py
function fix_fp16_network (line 28) | def fix_fp16_network(network_definition: INetworkDefinition) -> INetwork...
function build_engine (line 57) | def build_engine(
function get_output_tensors (line 131) | def get_output_tensors(
function infer_tensorrt (line 159) | def infer_tensorrt(
function load_engine (line 196) | def load_engine(
function save_engine (line 229) | def save_engine(engine: ICudaEngine, engine_file_path: str) -> None:
function get_binding_idxs (line 239) | def get_binding_idxs(engine: trt.ICudaEngine, profile_index: int):
FILE: tests/conftest.py
function port_generator (line 6) | def port_generator():
function make_flow (line 20) | def make_flow(port_generator, request):
function make_torch_flow (line 44) | def make_torch_flow(port_generator, request):
function make_trt_flow (line 53) | def make_trt_flow(port_generator, request):
function make_search_flow (line 62) | def make_search_flow(tmpdir, port_generator, request):
FILE: tests/test_asyncio.py
function another_heavylifting_job (line 9) | async def another_heavylifting_job():
function test_async_encode (line 14) | async def test_async_encode(make_flow):
function test_async_docarray_preserve_original_inputs (line 40) | async def test_async_docarray_preserve_original_inputs(make_flow, inputs):
function test_async_docarray_preserve_original_order (line 61) | async def test_async_docarray_preserve_original_order(make_flow, inputs):
FILE: tests/test_client.py
class Exec1 (line 10) | class Exec1(Executor):
method aencode (line 12) | async def aencode(self, docs, **kwargs):
class Exec2 (line 17) | class Exec2(Executor):
method __init__ (line 18) | def __init__(self, server_host: str = '', **kwargs):
method process (line 25) | async def process(self, docs, **kwargs):
class ErrorExec (line 30) | class ErrorExec(Executor):
method foo (line 32) | def foo(self, docs, **kwargs):
function test_client_concurrent_requests (line 36) | def test_client_concurrent_requests(port_generator):
function test_client_large_input (line 66) | def test_client_large_input(make_torch_flow):
function test_empty_input (line 85) | def test_empty_input(make_torch_flow, inputs, endpoint):
function test_async_empty_input (line 110) | async def test_async_empty_input(make_torch_flow, inputs, endpoint):
function test_wrong_input_type (line 127) | def test_wrong_input_type(make_torch_flow, endpoint):
function test_wrong_input_type (line 138) | async def test_wrong_input_type(make_torch_flow, endpoint):
function test_custom_on_done (line 149) | def test_custom_on_done(make_torch_flow, mocker, endpoint):
function test_async_custom_on_done (line 175) | async def test_async_custom_on_done(make_torch_flow, mocker, endpoint):
function test_custom_on_error (line 200) | def test_custom_on_error(port_generator, mocker, endpoint):
function test_async_custom_on_error (line 229) | async def test_async_custom_on_error(port_generator, mocker, endpoint):
FILE: tests/test_helper.py
function test_numpy_softmax (line 11) | def test_numpy_softmax(shape, axis):
function test_split_img_txt_da (line 74) | def test_split_img_txt_da(inputs):
function test_preproc_image (line 95) | def test_preproc_image(inputs):
FILE: tests/test_model.py
function test_torch_model (line 19) | def test_torch_model(name, model_cls):
function test_onnx_model (line 32) | def test_onnx_model(name):
function test_large_onnx_model_fp16 (line 41) | def test_large_onnx_model_fp16(name):
FILE: tests/test_ranker.py
function test_torch_executor_rank_img2texts (line 14) | async def test_torch_executor_rank_img2texts(encoder_class):
function test_torch_executor_rank_text2imgs (line 41) | async def test_torch_executor_rank_text2imgs(encoder_class):
function test_docarray_inputs (line 130) | def test_docarray_inputs(make_flow, inputs):
function test_async_arank (line 195) | async def test_async_arank(make_flow, inputs):
function test_docarray_preserve_original_order (line 233) | def test_docarray_preserve_original_order(make_flow, inputs):
function test_async_docarray_preserve_original_order (line 264) | async def test_async_docarray_preserve_original_order(make_flow, inputs):
FILE: tests/test_search.py
function test_index_search (line 34) | def test_index_search(make_search_flow, inputs, limit):
function test_async_index_search (line 72) | async def test_async_index_search(make_search_flow, inputs, limit):
FILE: tests/test_server.py
function test_server_download (line 11) | def test_server_download(tmpdir):
function test_server_download_md5 (line 40) | def test_server_download_md5(tmpdir, md5):
function test_server_download_not_regular_file (line 58) | def test_server_download_not_regular_file(tmpdir):
function test_make_onnx_flow_wrong_name_path (line 74) | def test_make_onnx_flow_wrong_name_path():
function test_server_preprocess_ndarray_image (line 94) | def test_server_preprocess_ndarray_image(image_uri, size):
function test_transform_arbitrary_tensor (line 113) | def test_transform_arbitrary_tensor(tensor):
FILE: tests/test_simple.py
function test_protocols (line 12) | def test_protocols(port_generator, protocol, jit, pytestconfig):
function test_plain_inputs (line 44) | def test_plain_inputs(make_flow, inputs):
function test_docarray_inputs (line 76) | def test_docarray_inputs(make_flow, inputs):
function test_docarray_preserve_original_inputs (line 103) | def test_docarray_preserve_original_inputs(make_flow, inputs):
function test_docarray_traversal (line 130) | def test_docarray_traversal(make_flow, inputs):
function test_docarray_preserve_original_order (line 161) | def test_docarray_preserve_original_order(make_flow, inputs):
FILE: tests/test_tensorrt.py
function test_docarray_inputs (line 35) | def test_docarray_inputs(make_trt_flow, inputs):
function test_async_arank (line 64) | async def test_async_arank(make_trt_flow, d):
FILE: tests/test_tokenization.py
function test_tokenizer_name (line 8) | def test_tokenizer_name(name):
Condensed preview — 104 files, each showing path, character count, and a content snippet. Download the .json file or copy for the full structured content (641K chars).
[
{
"path": ".dockerignore",
"chars": 25,
"preview": ".git\n.github\nscripts\ndocs"
},
{
"path": ".github/README-exec/onnx.readme.md",
"chars": 8297,
"preview": "# CLIPOnnxEncoder\n\n**CLIPOnnxEncoder** is the executor implemented in [CLIP-as-service](https://github.com/jina-ai/clip-"
},
{
"path": ".github/README-exec/torch.readme.md",
"chars": 8806,
"preview": "# CLIPTorchEncoder\n\n**CLIPTorchEncoder** is the executor implemented in [CLIP-as-service](https://github.com/jina-ai/cli"
},
{
"path": ".github/codecov.yml",
"chars": 476,
"preview": "codecov:\n # https://docs.codecov.io/docs/comparing-commits\n allow_coverage_offsets: true\ncoverage:\n status:\n proje"
},
{
"path": ".github/labeler.yml",
"chars": 475,
"preview": "# Add 'label1' to any changes within 'example' folder or any subfolders\narea/docs:\n - docs/**/*\n - ./*.md\n\narea/testin"
},
{
"path": ".github/release-template.ejs",
"chars": 4614,
"preview": "<% var groupCommits = [\n{\n name: 'breaking',\n show: true,\n list: []\n}, {\n name: 'feat',\n show: true,\n "
},
{
"path": ".github/workflows/cd.yml",
"chars": 5424,
"preview": "name: CD\n\non:\n push:\n branches:\n - main\n\n\njobs:\n prep-testbed:\n if: |\n !startsWith(github.event.head_c"
},
{
"path": ".github/workflows/ci.yml",
"chars": 9714,
"preview": "name: CI\n\non:\n pull_request:\n\n\njobs:\n commit-lint:\n runs-on: ubuntu-latest\n steps:\n - name: find the prev w"
},
{
"path": ".github/workflows/force-docker-build-cas.yml",
"chars": 5781,
"preview": "name: Manual CAS Docker Build\n\non:\n workflow_dispatch:\n inputs:\n release_token:\n description: 'Your rele"
},
{
"path": ".github/workflows/force-docker-build.yml",
"chars": 4876,
"preview": "name: Manual Docker Build\n\non:\n workflow_dispatch:\n inputs:\n release_token:\n description: 'Your release "
},
{
"path": ".github/workflows/force-docs-build.yml",
"chars": 1855,
"preview": "name: Manual Docs Build\n\non:\n workflow_dispatch:\n inputs:\n release_token:\n description: 'Your release to"
},
{
"path": ".github/workflows/force-hub-push.yml",
"chars": 7321,
"preview": "name: Manual Hub Push\n\non:\n workflow_dispatch:\n inputs:\n release_token:\n description: 'Your release toke"
},
{
"path": ".github/workflows/force-release.yml",
"chars": 1490,
"preview": "name: Manual Release\n\non:\n workflow_dispatch:\n inputs:\n release_token:\n description: 'Your release token"
},
{
"path": ".github/workflows/label-pr.yml",
"chars": 2884,
"preview": "name: PR\n\non:\n pull_request:\n\n\njobs:\n assign-label-to-pr:\n runs-on: ubuntu-latest\n if: ${{ !github.event.pull_re"
},
{
"path": ".github/workflows/tag.yml",
"chars": 2286,
"preview": "name: Release CD\n\non:\n push:\n tags:\n - \"v*\" # push to version tags trigger the build\n\njobs:\n update-doc:\n "
},
{
"path": ".gitignore",
"chars": 1775,
"preview": "# Initially taken from Github's Python gitignore file\n\n# Byte-compiled / optimized / DLL files\n__pycache__/\n*.py[cod]\n*$"
},
{
"path": ".pre-commit-config.yaml",
"chars": 295,
"preview": "repos:\n- repo: https://github.com/ambv/black\n rev: 22.3.0\n hooks:\n - id: black\n types: [python]\n exclude: ^(doc"
},
{
"path": "CHANGELOG.md",
"chars": 74166,
"preview": "\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n<a name=release-note-0-0-3></a>\n## Release Note (`0.0.3`)"
},
{
"path": "Dockerfiles/base.Dockerfile",
"chars": 1304,
"preview": "# !!! An ARG declared before a FROM is outside of a build stage, so it can’t be used in any instruction after a FROM\nARG"
},
{
"path": "Dockerfiles/cuda.Dockerfile",
"chars": 1592,
"preview": "ARG CUDA_VERSION=11.4.2\n\nFROM nvcr.io/nvidia/cuda:${CUDA_VERSION}-cudnn8-runtime-ubuntu20.04\nENV DEBIAN_FRONTEND=noninte"
},
{
"path": "Dockerfiles/server.Dockerfile",
"chars": 1724,
"preview": "ARG CUDA_VERSION=11.6.0\n\nFROM nvidia/cuda:${CUDA_VERSION}-devel-ubuntu20.04\n\nARG CAS_NAME=cas\nWORKDIR /${CAS_NAME}\n\nENV "
},
{
"path": "Dockerfiles/tensorrt.Dockerfile",
"chars": 1273,
"preview": "# Dockerfile to run Clip-as-Service with TensorRT, CUDA integration\n\nARG TENSORRT_VERSION=22.04\n\nFROM nvcr.io/nvidia/ten"
},
{
"path": "LICENSE",
"chars": 11045,
"preview": "Copyright 2020-2022 Jina AI Limited. All rights reserved.\n\nThe following two files are licensed under MIT License via h"
},
{
"path": "README.md",
"chars": 22155,
"preview": "<p align=\"center\">\n<a href=\"https://clip-as-service.jina.ai\"><img src=\"https://github.com/jina-ai/clip-as-service/blob/m"
},
{
"path": "client/clip_client/__init__.py",
"chars": 221,
"preview": "__version__ = '0.8.4'\n\nimport os\n\nfrom clip_client.client import Client\n\nif 'NO_VERSION_CHECK' not in os.environ:\n fr"
},
{
"path": "client/clip_client/client.py",
"chars": 36690,
"preview": "import mimetypes\nimport os\nimport time\nimport warnings\nfrom typing import (\n overload,\n TYPE_CHECKING,\n Optiona"
},
{
"path": "client/clip_client/helper.py",
"chars": 1987,
"preview": "import json\nimport sys\nimport threading\nfrom packaging.version import Version\nfrom urllib.request import Request, urlope"
},
{
"path": "client/setup.py",
"chars": 3270,
"preview": "import sys\nfrom os import path\n\nfrom setuptools import find_packages\nfrom setuptools import setup\n\nif sys.version_info <"
},
{
"path": "docs/Makefile",
"chars": 609,
"preview": "# Minimal makefile for Sphinx documentation\n# Used only for local building\n\n# You can set these variables from the comma"
},
{
"path": "docs/_static/cas-grafana.json",
"chars": 21834,
"preview": "{\n \"__inputs\": [\n {\n \"name\": \"DS_PROMETHEUS\",\n \"label\": \"Prometheus\",\n \"description\": \"\",\n \"type"
},
{
"path": "docs/_static/demo-embed.html",
"chars": 6280,
"preview": "<script src=\"https://cdn.jsdelivr.net/npm/vue@2/dist/vue.js\"></script>\n<script src='https://cdnjs.cloudflare.com/ajax/li"
},
{
"path": "docs/_static/demo-text-rank.html",
"chars": 7377,
"preview": "<script src=\"https://cdn.jsdelivr.net/npm/vue@2/dist/vue.js\"></script>\n<script src='https://cdnjs.cloudflare.com/ajax/li"
},
{
"path": "docs/_static/main.css",
"chars": 3435,
"preview": "html.loaded-in-iframe #announcement,\nhtml.loaded-in-iframe #sidebar-drawer,\nhtml.loaded-in-iframe footer,\nhtml.loaded-in"
},
{
"path": "docs/_templates/page.html",
"chars": 10837,
"preview": "{% extends \"base.html\" %}\n\n{% block body -%}\n{{ super() }}\n{% include \"partials/icons.html\" %}\n\n<input type=\"checkbox\" c"
},
{
"path": "docs/_templates/sidebar/brand.html",
"chars": 1981,
"preview": "<a class=\"sidebar-brand{% if logo %} centered{% endif %}\" href=\"{{ pathto(master_doc) }}\">\n {% block brand_content %}\n "
},
{
"path": "docs/_templates/sidebar/navigation.html",
"chars": 2579,
"preview": "<div class=\"sidebar-tree\">\n {{ furo_navigation_tree }}\n <p class=\"caption\" role=\"heading\"><span class=\"caption-tex"
},
{
"path": "docs/changelog/index.md",
"chars": 1125,
"preview": "# Changelog\n\nCLIP-as-service follows semantic versioning. However, before the project reach 1.0.0, any breaking change w"
},
{
"path": "docs/conf.py",
"chars": 6795,
"preview": "import os\nimport re\nimport sys\nfrom os import path\n\nsys.path.insert(0, path.abspath('..'))\n\nproject = 'CLIP-as-service'\n"
},
{
"path": "docs/hosting/by-jina.md",
"chars": 3317,
"preview": "# Hosted by Jina AI\n\n```{include} ../../README.md\n:start-after: <!-- start inference-banner -->\n:end-before: <!-- end in"
},
{
"path": "docs/hosting/cas-on-colab.ipynb",
"chars": 12444,
"preview": "{\n \"nbformat\": 4,\n \"nbformat_minor\": 0,\n \"metadata\": {\n \"colab\": {\n \"name\": \"cas-on-colab.ipynb\",\n \"provenance\": []"
},
{
"path": "docs/hosting/colab.md",
"chars": 1239,
"preview": "# Host on Google Colab\n\n```{figure} https://clip-as-service.jina.ai/_images/colab-banner.png\n:width: 0 %\n:scale: 0 %\n```"
},
{
"path": "docs/hosting/on-jcloud.md",
"chars": 2250,
"preview": "# Host on JCloud\n\nEssentially `clip_server` is a Jina [Flow](https://docs.jina.ai/fundamentals/flow/). Any Jina Flow can"
},
{
"path": "docs/html_extra/robots.txt",
"chars": 66,
"preview": "User-agent: *\nsitemap: https://clip-as-service.jina.ai/sitemap.xml"
},
{
"path": "docs/index.md",
"chars": 3513,
"preview": "# Welcome to CLIP-as-service!\n\n\n```{include} ../README.md\n:start-after: <!-- start elevator-pitch -->\n:end-before: <!-- "
},
{
"path": "docs/makedoc.sh",
"chars": 69,
"preview": "#!/usr/bin/env bash\n\nset -ex\n\nrm -rf api && make clean\n\nmake dirhtml\n"
},
{
"path": "docs/playground/embedding.md",
"chars": 890,
"preview": "# Text & Image Embedding\n\nEmbedding is a basic task in CLIP-as-service. It means converting your input sentence or image"
},
{
"path": "docs/playground/reasoning.md",
"chars": 1075,
"preview": "# Visual Reasoning\n\nVisual reasoning is another basic task in CLIP-as-service. There are four basic visual reasoning ski"
},
{
"path": "docs/playground/searching.md",
"chars": 1286,
"preview": "# Text & Image Searching\n\nCLIP-as-service enables us to encode text and images into a common space. This is a powerful t"
},
{
"path": "docs/requirements.txt",
"chars": 451,
"preview": "# cf. https://github.com/ryanfox/sphinx-markdown-tables/issues/36\nmarkdown<3.4.0\nsphinx\nsphinx-argparse==0.3.1\nsphinxcon"
},
{
"path": "docs/user-guides/benchmark.rst",
"chars": 49499,
"preview": "Benchmark\n=========\n\nIn order to understand the zero-shot performance of CLIP and its limitations, we conducted a benchm"
},
{
"path": "docs/user-guides/client.md",
"chars": 27475,
"preview": "# Client API\n\nCLIP-as-service is designed in a client-server architecture. You can use `clip_client` to send images and "
},
{
"path": "docs/user-guides/faq.md",
"chars": 3349,
"preview": "# FAQ\n\nThis is a list of Frequently Asked Questions about CLIP-as-service. Feel free to suggest new entries!\n\n\nWhat is C"
},
{
"path": "docs/user-guides/finetuner.md",
"chars": 15470,
"preview": "(Finetuner)=\n# Fine-tune Models\n\nAlthough CLIP-as-service has provided you a list of pre-trained models, you can also fi"
},
{
"path": "docs/user-guides/retriever.md",
"chars": 7899,
"preview": "# CLIP Search\n\n\nCLIP Search is a search paradigm that uses the CLIP model to encode the text and image documents into a "
},
{
"path": "docs/user-guides/server.md",
"chars": 24966,
"preview": "# Server API\n\nCLIP-as-service is designed in a client-server architecture. A server is a long-running program that recei"
},
{
"path": "scripts/MANIFEST.in",
"chars": 45,
"preview": "include LICENSE\nprune tests/\nprune **/tests/\n"
},
{
"path": "scripts/benchmark.py",
"chars": 4201,
"preview": "import random\nimport time\nfrom typing import Optional\nimport threading\nimport click\nimport numpy as np\nfrom docarray imp"
},
{
"path": "scripts/black.sh",
"chars": 464,
"preview": "#!/bin/bash\npip install black==22.3.0\narrVar=()\necho we ignore non-*.py files and files generated from protobuf\nexcluded"
},
{
"path": "scripts/docstrings_lint.sh",
"chars": 1334,
"preview": "#!/bin/bash\n# required in order to get the status of all the files at once\npip install darglint==1.6.0\npip install pydoc"
},
{
"path": "scripts/get-all-test-paths.sh",
"chars": 763,
"preview": "#!/usr/bin/env bash\n\nset -ex\n\nBATCH_SIZE=3\n#declare -a array1=( \"tests/unit/test_*.py\" )\n#declare -a array2=( $(ls -d te"
},
{
"path": "scripts/get-last-release-note.py",
"chars": 292,
"preview": "## under jina root dir\n# python scripts/get-last-release-note.py\n## result in root/tmp.md\n\nwith open('CHANGELOG.md') as "
},
{
"path": "scripts/get-requirements.py",
"chars": 397,
"preview": "## under clip-as-service root dir\n# python scripts/get-requirments.py $PIP_TAG /path/to/requirements.txt\n\nimport sys\nfro"
},
{
"path": "scripts/onnx_helper.py",
"chars": 2083,
"preview": "def convert_float_to_float16(model_path: str, output_model_path: str):\n import onnx\n from onnxmltools.utils.float1"
},
{
"path": "scripts/release.sh",
"chars": 4208,
"preview": "#!/usr/bin/env bash\n\n# Requirements\n# brew install hub\n# npm install -g git-release-notes\n# pip install twine wheel\n\nset"
},
{
"path": "scripts/setup.py",
"chars": 2771,
"preview": "import sys\nfrom os import path\n\nfrom setuptools import find_packages\nfrom setuptools import setup\n\nif sys.version_info <"
},
{
"path": "server/MANIFEST.in",
"chars": 68,
"preview": "recursive-include clip_server/resources *\ninclude clip_server/*.yml\n"
},
{
"path": "server/clip_server/__init__.py",
"chars": 22,
"preview": "__version__ = '0.8.4'\n"
},
{
"path": "server/clip_server/__main__.py",
"chars": 605,
"preview": "import inspect\nimport os\nimport sys\n\nif __name__ == '__main__':\n if 'NO_VERSION_CHECK' not in os.environ:\n fro"
},
{
"path": "server/clip_server/executors/__init__.py",
"chars": 0,
"preview": ""
},
{
"path": "server/clip_server/executors/clip_onnx.py",
"chars": 9096,
"preview": "import os\nimport warnings\nfrom functools import partial\nfrom multiprocessing.pool import ThreadPool\nfrom typing import D"
},
{
"path": "server/clip_server/executors/clip_tensorrt.py",
"chars": 7670,
"preview": "import warnings\nfrom functools import partial\nfrom multiprocessing.pool import ThreadPool\nfrom typing import Dict, Optio"
},
{
"path": "server/clip_server/executors/clip_torch.py",
"chars": 9685,
"preview": "import os\nimport warnings\nfrom functools import partial\nfrom multiprocessing.pool import ThreadPool\nfrom typing import D"
},
{
"path": "server/clip_server/executors/helper.py",
"chars": 3875,
"preview": "from typing import Tuple, List, Callable, Any, Dict, Union\nimport torch\nimport numpy as np\nfrom docarray import Document"
},
{
"path": "server/clip_server/helper.py",
"chars": 2283,
"preview": "import json\nimport os\nimport sys\nimport threading\nimport torch\nfrom packaging.version import Version\nfrom urllib.request"
},
{
"path": "server/clip_server/model/__init__.py",
"chars": 0,
"preview": ""
},
{
"path": "server/clip_server/model/clip.py",
"chars": 1220,
"preview": "# Originally from https://github.com/openai/CLIP. MIT License, Copyright (c) 2021 OpenAI\n\nimport io\n\nimport pillow_avif\n"
},
{
"path": "server/clip_server/model/clip_model.py",
"chars": 1885,
"preview": "from clip_server.model.pretrained_models import (\n _OPENCLIP_MODELS,\n _MULTILINGUALCLIP_MODELS,\n _CNCLIP_MODELS"
},
{
"path": "server/clip_server/model/clip_onnx.py",
"chars": 12608,
"preview": "import os\nfrom typing import Dict, Optional\n\nfrom clip_server.model.pretrained_models import (\n download_model,\n _"
},
{
"path": "server/clip_server/model/clip_trt.py",
"chars": 4889,
"preview": "import os\nfrom typing import Dict\n\ntry:\n import tensorrt as trt\n from tensorrt.tensorrt import Logger, Runtime\n\n "
},
{
"path": "server/clip_server/model/cnclip_model.py",
"chars": 1431,
"preview": "# Originally from https://github.com/OFA-Sys/Chinese-CLIP. MIT License.\n\nimport torch\n\nfrom clip_server.model.clip_model"
},
{
"path": "server/clip_server/model/flash_attention.py",
"chars": 3549,
"preview": "import torch\nimport torch.nn as nn\nfrom torch import Tensor\nfrom typing import Optional, Tuple\n\nfrom torch.nn.functional"
},
{
"path": "server/clip_server/model/mclip_model.py",
"chars": 2592,
"preview": "# Originally from https://github.com/FreddeFrallan/Multilingual-CLIP. MIT License, Copyright (c) 2022 Multilingual-CLIP\n"
},
{
"path": "server/clip_server/model/model.py",
"chars": 20554,
"preview": "\"\"\" CLIP Model\n\nAdapted from https://github.com/mlfoundations/open_clip.\n\nOriginally MIT License, Copyright (c) 2012-202"
},
{
"path": "server/clip_server/model/openclip_model.py",
"chars": 1992,
"preview": "# Originally from https://github.com/mlfoundations/open_clip.\n#\n# Copyright (c) 2012-2021 Gabriel Ilharco, Mitchell Wort"
},
{
"path": "server/clip_server/model/pretrained_models.py",
"chars": 8451,
"preview": "import os\nimport hashlib\nimport shutil\nimport urllib\n\n\n_OPENCLIP_S3_BUCKET = 'https://clip-as-service.s3.us-east-2.amazo"
},
{
"path": "server/clip_server/model/simple_tokenizer.py",
"chars": 4954,
"preview": "# Originally from https://github.com/openai/CLIP. MIT License, Copyright (c) 2021 OpenAI\n\nimport gzip\nimport html\nimport"
},
{
"path": "server/clip_server/model/tokenization.py",
"chars": 3901,
"preview": "import torch\nfrom typing import List, Union\nfrom clip_server.model.pretrained_models import (\n _MULTILINGUALCLIP_MODE"
},
{
"path": "server/clip_server/model/trt_utils.py",
"chars": 11395,
"preview": "# Originally from https://github.com/ELS-RD/transformer-deploy.\n# Apache License, Version 2.0, Copyright (c) 2022 Lefebv"
},
{
"path": "server/clip_server/onnx-flow.yml",
"chars": 227,
"preview": "jtype: Flow\nversion: '1'\nwith:\n port: 51000\nexecutors:\n - name: clip_o\n uses:\n jtype: CLIPEncoder\n metas:"
},
{
"path": "server/clip_server/tensorrt-flow.yml",
"chars": 231,
"preview": "jtype: Flow\nversion: '1'\nwith:\n port: 51000\nexecutors:\n - name: clip_r\n uses:\n jtype: CLIPEncoder\n metas:"
},
{
"path": "server/clip_server/torch-flow.yml",
"chars": 228,
"preview": "jtype: Flow\nversion: '1'\nwith:\n port: 51000\nexecutors:\n - name: clip_t\n uses:\n jtype: CLIPEncoder\n metas:"
},
{
"path": "server/setup.py",
"chars": 3593,
"preview": "import sys\nfrom os import path\n\nfrom setuptools import find_packages, setup\n\nif sys.version_info < (3, 7, 0):\n raise "
},
{
"path": "tests/__init__.py",
"chars": 47,
"preview": "import os\n\nos.environ['OMP_NUM_THREADS'] = '1'\n"
},
{
"path": "tests/conftest.py",
"chars": 2153,
"preview": "import pytest\nfrom jina import helper, Flow\n\n\n@pytest.fixture(scope='session')\ndef port_generator():\n generated_ports"
},
{
"path": "tests/test_asyncio.py",
"chars": 2293,
"preview": "import asyncio\nimport os\nimport pytest\n\nfrom clip_client import Client\nfrom docarray import Document, DocumentArray\n\n\nas"
},
{
"path": "tests/test_client.py",
"chars": 7448,
"preview": "import os\nimport random\nimport time\nimport pytest\nimport numpy as np\nfrom docarray import Document, DocumentArray\nfrom j"
},
{
"path": "tests/test_helper.py",
"chars": 3234,
"preview": "import pytest\nimport numpy as np\nfrom clip_server.executors.helper import numpy_softmax\nfrom clip_server.executors.helpe"
},
{
"path": "tests/test_model.py",
"chars": 1152,
"preview": "import pytest\nfrom clip_server.model.clip_model import CLIPModel\nfrom clip_server.model.clip_onnx import CLIPOnnxModel\nf"
},
{
"path": "tests/test_ranker.py",
"chars": 8447,
"preview": "import os\n\nimport numpy as np\nimport pytest\nfrom docarray import DocumentArray, Document\n\nfrom clip_client import Client"
},
{
"path": "tests/test_search.py",
"chars": 2894,
"preview": "import os\n\nimport numpy as np\nimport pytest\nfrom docarray import DocumentArray, Document\n\nfrom clip_client import Client"
},
{
"path": "tests/test_server.py",
"chars": 3417,
"preview": "import os\n\nimport pytest\nfrom clip_server.model.clip import _transform_ndarray, _transform_blob\nfrom clip_server.model.p"
},
{
"path": "tests/test_simple.py",
"chars": 5443,
"preview": "import os\n\nimport pytest\nfrom docarray import Document, DocumentArray\nfrom jina import Flow\n\nfrom clip_client.client imp"
},
{
"path": "tests/test_tensorrt.py",
"chars": 2445,
"preview": "import os\n\nimport pytest\nimport numpy as np\nfrom docarray import Document, DocumentArray\nfrom jina import Flow\n\nfrom cli"
},
{
"path": "tests/test_tokenization.py",
"chars": 564,
"preview": "import pytest\nfrom clip_server.model.tokenization import Tokenizer\n\n\n@pytest.mark.parametrize(\n 'name', ['ViT-L/14@33"
}
]
About this extraction
This page contains the full source code of the jina-ai/clip-as-service GitHub repository, extracted and formatted as plain text for AI agents and large language models (LLMs). The extraction includes 104 files (598.7 KB), approximately 163.1k tokens, and a symbol index with 222 extracted functions, classes, methods, constants, and types. Use this with OpenClaw, Claude, ChatGPT, Cursor, Windsurf, or any other AI tool that accepts text input. You can copy the full output to your clipboard or download it as a .txt file.
Extracted by GitExtract — free GitHub repo to text converter for AI. Built by Nikandr Surkov.