Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: clip as external executor #74

Merged
merged 13 commits into from Aug 8, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/flow.svg
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
6 changes: 6 additions & 0 deletions .gitignore
@@ -1,3 +1,6 @@
# OS
.DS_Store

# Byte-compiled / optimized / DLL files
__pycache__/
*.py[cod]
Expand Down Expand Up @@ -127,3 +130,6 @@ dmypy.json

# Pyre type checker
.pyre/

# Jina
.jina/
2 changes: 1 addition & 1 deletion Dockerfile
Expand Up @@ -23,7 +23,7 @@ RUN apt-get update \
RUN if [ -n "${APT_PACKAGES}" ]; then apt-get update && apt-get install --no-install-recommends -y ${APT_PACKAGES}; fi && \
git clone --depth=1 https://github.com/JingyunLiang/SwinIR.git && \
git clone --depth=1 https://github.com/CompVis/latent-diffusion.git && \
git clone --depth=1 https://github.com/hanxiao/glid-3-xl.git && \
git clone --depth=1 https://github.com/jina-ai/glid-3-xl.git && \
pip install jax[cuda11_cudnn82]==0.3.13 -f https://storage.googleapis.com/jax-releases/jax_cuda_releases.html && \
pip install torch torchvision torchaudio --extra-index-url https://download.pytorch.org/whl/cu113 && \
cd latent-diffusion && pip install --timeout=1000 -e . && cd - && \
Expand Down
8 changes: 7 additions & 1 deletion README.md
Expand Up @@ -29,6 +29,7 @@ DALL·E Flow is in client-server architecture.

## Updates

- ⚠️ **2022/8/8** Started using CLIP-as-servive as an [external executor](https://docs.jina.ai/fundamentals/flow/add-executors/#external-executors). Now you can easily [deploy your own CLIP executor](#run-your-own-clip) if you want. There is [a small breaking change](https://github.com/jina-ai/dalle-flow/pull/74/files#diff-b335630551682c19a781afebcf4d07bf978fb1f8ac04c6bf87428ed5106870f5R103) as a result of this improvement, so [please _reopen_ the notebook in Google Colab](https://colab.research.google.com/github/jina-ai/dalle-flow/blob/main/client.ipynb).
- ⚠️ **2022/7/6** Demo server migration to AWS EKS for better availability and robustness, **server URL is now changing to `grpcs://dalle-flow.dev.jina.ai`**. All connections are now with TLS encryption, [please _reopen_ the notebook in Google Colab](https://colab.research.google.com/github/jina-ai/dalle-flow/blob/main/client.ipynb).
- ⚠️ **2022/6/25** Unexpected downtime between 6/25 0:00 - 12:00 CET due to out of GPU quotas. The new server now has 2 GPUs, add healthcheck in client notebook.
- **2022/6/3** Reduce default number of images to 2 per pathway, 4 for diffusion.
Expand Down Expand Up @@ -99,6 +100,7 @@ The 16 candidates are sorted by [CLIP-as-service](https://github.com/jina-ai/cli
```python
fav_id = 3
fav = da[fav_id]
fav.embedding = da.embedding
fav.display()
```

Expand Down Expand Up @@ -243,7 +245,7 @@ mkdir dalle && cd dalle
git clone https://github.com/jina-ai/dalle-flow.git
git clone https://github.com/JingyunLiang/SwinIR.git
git clone https://github.com/CompVis/latent-diffusion.git
git clone https://github.com/hanxiao/glid-3-xl.git
git clone https://github.com/jina-ai/glid-3-xl.git
```

You should have the following folder structure:
Expand Down Expand Up @@ -314,6 +316,10 @@ Congrats! Now you should be able to [run the client](#client).

You can modify and extend the server flow as you like, e.g. changing the model, adding persistence, or even auto-posting to Instagram/OpenSea. With Jina and DocArray, you can easily make DALL·E Flow [cloud-native and ready for production](https://github.com/jina-ai/jina).

### Run your own CLIP

By default [`CLIPTorchEncoder`](https://hub.jina.ai/executor/gzpbl8jh) runs as an [external executor](https://docs.jina.ai/fundamentals/flow/add-executors/#external-executors).
If you want to run your own CLIP, you can do that by just changing `external: true` to `external: false` in [`flow.yml`](./flow.yml).

<!-- start support-pitch -->
## Support
Expand Down
1 change: 1 addition & 0 deletions client.ipynb
Expand Up @@ -259,6 +259,7 @@
"fav_id = 3\n",
"\n",
"fav = da[fav_id]\n",
"fav.embedding = da.embedding\n",
"\n",
"fav.display()"
]
Expand Down
2 changes: 1 addition & 1 deletion executors/dalle/executor/dalle.py
Expand Up @@ -8,7 +8,7 @@


class DalleGenerator(Executor):
@requests(on='/')
@requests
def generate(self, docs: DocumentArray, parameters: Dict, **kwargs):

# can be of course larger but to save time and reduce the queue when serving public
Expand Down