eps696 / aphantasia

CLIP + FFT/DWT/RGB = text to image/video

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

clip_fft.py won't start

Niotferdi opened this issue · comments

I installed requirements.txt and git+https://github.com/openai/CLIP.git and after that I ran

python clip_fft.py -t "city" -t2 "gradient" --size 1280-720

And after that I got the error

c:\etc\aphantasia-master>python clip_fft.py -t "city" -t2 "gradient" --size 1280-720
Traceback (most recent call last):
  File "clip_fft.py", line 23, in <module>
    from utils import slice_imgs, derivat, sim_func, basename, img_list, img_read, plot_text, txt_clean, checkout, old_torch
  File "c:\etc\aphantasia-master\utils.py", line 13, in <module>
    from kornia.filters.sobel import spatial_gradient
  File "C:\Users\user\AppData\Local\Programs\Python\Python38\lib\site-packages\kornia\__init__.py", line 19, in <module>    from kornia import jit
  File "C:\Users\user\AppData\Local\Programs\Python\Python38\lib\site-packages\kornia\jit\__init__.py", line 9, in <module>
    spatial_soft_argmax2d = torch.jit.script(K.geometry.spatial_soft_argmax2d)
  File "C:\Users\user\AppData\Local\Programs\Python\Python38\lib\site-packages\torch\jit\__init__.py", line 1290, in script
    fn = torch._C._jit_script_compile(qualified_name, ast, _rcb, get_default_args(obj))
  File "C:\Users\user\AppData\Local\Programs\Python\Python38\lib\site-packages\torch\jit\_recursive.py", line 568, in try_compile_fn
    return torch.jit.script(fn, _rcb=rcb)
  File "C:\Users\user\AppData\Local\Programs\Python\Python38\lib\site-packages\torch\jit\__init__.py", line 1290, in script
    fn = torch._C._jit_script_compile(qualified_name, ast, _rcb, get_default_args(obj))
  File "C:\Users\user\AppData\Local\Programs\Python\Python38\lib\site-packages\torch\jit\_recursive.py", line 568, in try_compile_fn
    return torch.jit.script(fn, _rcb=rcb)
  File "C:\Users\user\AppData\Local\Programs\Python\Python38\lib\site-packages\torch\jit\__init__.py", line 1290, in script
    fn = torch._C._jit_script_compile(qualified_name, ast, _rcb, get_default_args(obj))
RuntimeError:
Unknown type name 'torch.dtype':
  File "C:\Users\user\AppData\Local\Programs\Python\Python38\lib\site-packages\kornia\utils\grid.py", line 12
        normalized_coordinates: bool = True,
        device: Optional[torch.device] = torch.device('cpu'),
        dtype: torch.dtype = torch.float32) -> torch.Tensor:
               ~~~~~~~~~~~ <--- HERE
    """Generates a coordinate grid for an image.
'create_meshgrid' is being compiled since it was called from 'spatial_expectation2d'
  File "C:\Users\user\AppData\Local\Programs\Python\Python38\lib\site-packages\kornia\geometry\subpix\dsnt.py", line 100
    # Create coordinates grid.
    grid: torch.Tensor = create_meshgrid(height, width, normalized_coordinates, input.device)
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ <--- HERE
    grid = grid.to(input.dtype)
'spatial_expectation2d' is being compiled since it was called from 'spatial_soft_argmax2d'
  File "C:\Users\user\AppData\Local\Programs\Python\Python38\lib\site-packages\kornia\geometry\subpix\spatial_soft_argmax.py", line 516
    """
    input_soft: torch.Tensor = dsnt.spatial_softmax2d(input, temperature)
    output: torch.Tensor = dsnt.spatial_expectation2d(input_soft, normalized_coordinates)
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ <--- HERE
    return output

How can I make the program work?

provide the output of pip freeze command. it seems, there's some versions incompatibility on your side.

pip freeze produced the following text:

absl-py==1.0.0
aiohttp==3.8.1
aiosignal==1.2.0
antlr4-python3-runtime==4.8
argon2-cffi==21.1.0
async-timeout==4.0.1
attrs==21.2.0
backcall==0.2.0
bleach==4.1.0
cachetools==4.2.4
certifi==2021.10.8
cffi==1.15.0
chardet==3.0.4
charset-normalizer==2.0.9
click==8.0.3
clip @ git+https://github.com/openai/CLIP.git@573315e83f07b53a61ff5098757e8fc885f1703e
colorama==0.4.4
cycler==0.11.0
debugpy==1.5.1
decorator==5.1.0
defusedxml==0.7.1
einops==0.3.2
entrypoints==0.3
filelock==3.4.0
fonttools==4.28.3
frozenlist==1.2.0
fsspec==2021.11.1
ftfy==6.0.3
future==0.18.2
google-auth==2.3.3
google-auth-oauthlib==0.4.6
googletrans==3.1.0a0
grpcio==1.42.0
h11==0.9.0
h2==3.2.0
hpack==3.0.0
hstspreload==2021.12.1
httpcore==0.9.1
httpx==0.13.3
huggingface-hub==0.2.1
hyperframe==5.2.0
idna==2.10
imageio==2.13.1
importlib-metadata==4.8.2
importlib-resources==5.4.0
ipykernel==6.6.0
ipython==7.30.1
ipython-genutils==0.2.0
ipywidgets==7.6.5
jedi==0.18.1
Jinja2==3.0.3
joblib==1.1.0
jsonschema==4.2.1
jupyter-client==7.1.0
jupyter-core==4.9.1
jupyterlab-pygments==0.1.2
jupyterlab-widgets==1.0.2
kiwisolver==1.3.2
kornia==0.5.3
lpips==0.1.4
Markdown==3.3.6
MarkupSafe==2.0.1
matplotlib==3.5.0
matplotlib-inline==0.1.3
mistune==0.8.4
multidict==5.2.0
nbclient==0.5.9
nbconvert==6.3.0
nbformat==5.1.3
nest-asyncio==1.5.4
nltk==3.6.5
notebook==6.4.6
numpy==1.21.4
oauthlib==3.1.1
omegaconf==2.1.1
opencv-python==4.5.4.60
packaging==21.3
pandocfilters==1.5.0
parso==0.8.3
pickleshare==0.7.5
Pillow==8.4.0
prometheus-client==0.12.0
prompt-toolkit==3.0.23
protobuf==3.19.1
pyasn1==0.4.8
pyasn1-modules==0.2.8
pycparser==2.21
pyDeprecate==0.3.1
Pygments==2.10.0
pyparsing==3.0.6
pyrsistent==0.18.0
python-dateutil==2.8.2
pytorch-lightning==1.5.4
pytorch-wavelets==1.3.0
PyWavelets==1.1.1
pywin32==302
pywinpty==1.1.6
PyYAML==6.0
pyzmq==22.3.0
regex==2021.11.10
requests==2.26.0
requests-oauthlib==1.3.0
rfc3986==1.5.0
rsa==4.8
sacremoses==0.0.46
scikit-learn==1.0.1
scipy==1.7.3
Send2Trash==1.8.0
sentence-transformers==2.1.0
sentencepiece==0.1.96
setuptools-scm==6.3.2
six==1.16.0
sniffio==1.2.0
tensorboard==2.7.0
tensorboard-data-server==0.6.1
tensorboard-plugin-wit==1.8.0
terminado==0.12.1
testpath==0.5.0
threadpoolctl==3.0.0
tokenizers==0.10.3
tomli==1.2.2
torch==1.5.0
torchmetrics==0.6.0
torchvision==0.6.0
tornado==6.1
tqdm==4.62.3
traitlets==5.1.1
transformers==4.12.5
typing-extensions==4.0.1
urllib3==1.26.7
wcwidth==0.2.5
webencodings==0.5.1
Werkzeug==2.0.2
widgetsnbextension==3.5.2
yarl==1.7.2
zipp==3.6.0

I haven't installed almost anything via pip, mostly just what your program needs to work. I don’t know where the incompatibility might be.

pytorch version must be 1.7.1 the lowest, while you have 1.5.0. update pytorch to 1.7.1 or 1.8.0 [as stated in readme].
it's not in the requirements.txt, cause should be installed from the instructions on pytorch.org site.

Thank you kind person