mirror of
https://github.com/lucidrains/DALLE2-pytorch.git
synced 2025-12-19 17:54:20 +01:00
use @clip-anytorch , thanks to @rom1504
This commit is contained in:
@@ -499,9 +499,7 @@ loss.backward()
|
|||||||
|
|
||||||
Although there is the possibility they are using an unreleased, more powerful CLIP, you can use one of the released ones, if you do not wish to train your own CLIP from scratch. This will also allow the community to more quickly validate the conclusions of the paper.
|
Although there is the possibility they are using an unreleased, more powerful CLIP, you can use one of the released ones, if you do not wish to train your own CLIP from scratch. This will also allow the community to more quickly validate the conclusions of the paper.
|
||||||
|
|
||||||
First you'll need to install <a href="https://github.com/openai/CLIP#usage">the prerequisites</a>
|
To use a pretrained OpenAI CLIP, simply import `OpenAIClipAdapter` and pass it into the `DiffusionPrior` or `Decoder` like so
|
||||||
|
|
||||||
Then to use a pretrained OpenAI CLIP, simply import `OpenAIClipAdapter` and pass it into the `DiffusionPrior` or `Decoder` like so
|
|
||||||
|
|
||||||
```python
|
```python
|
||||||
import torch
|
import torch
|
||||||
|
|||||||
@@ -172,11 +172,7 @@ class OpenAIClipAdapter(BaseClipAdapter):
|
|||||||
self,
|
self,
|
||||||
name = 'ViT-B/32'
|
name = 'ViT-B/32'
|
||||||
):
|
):
|
||||||
try:
|
import clip
|
||||||
import clip
|
|
||||||
except ImportError:
|
|
||||||
print('you must install openai clip in order to use this adapter - `pip install git+https://github.com/openai/CLIP.git` - more instructions at https://github.com/openai/CLIP#usage')
|
|
||||||
|
|
||||||
openai_clip, _ = clip.load(name)
|
openai_clip, _ = clip.load(name)
|
||||||
super().__init__(openai_clip)
|
super().__init__(openai_clip)
|
||||||
|
|
||||||
@@ -1636,4 +1632,3 @@ class DALLE2(nn.Module):
|
|||||||
return images[0]
|
return images[0]
|
||||||
|
|
||||||
return images
|
return images
|
||||||
|
|
||||||
|
|||||||
3
setup.py
3
setup.py
@@ -10,7 +10,7 @@ setup(
|
|||||||
'dream = dalle2_pytorch.cli:dream'
|
'dream = dalle2_pytorch.cli:dream'
|
||||||
],
|
],
|
||||||
},
|
},
|
||||||
version = '0.0.72',
|
version = '0.0.73',
|
||||||
license='MIT',
|
license='MIT',
|
||||||
description = 'DALL-E 2',
|
description = 'DALL-E 2',
|
||||||
author = 'Phil Wang',
|
author = 'Phil Wang',
|
||||||
@@ -23,6 +23,7 @@ setup(
|
|||||||
],
|
],
|
||||||
install_requires=[
|
install_requires=[
|
||||||
'click',
|
'click',
|
||||||
|
'clip-anytorch',
|
||||||
'einops>=0.4',
|
'einops>=0.4',
|
||||||
'einops-exts>=0.0.3',
|
'einops-exts>=0.0.3',
|
||||||
'kornia>=0.5.4',
|
'kornia>=0.5.4',
|
||||||
|
|||||||
Reference in New Issue
Block a user