carefree0910/carefree-creator

On: Python 3.10 Installer leads to segfault

danielrh opened this issue · 4 comments

uvicorn apis.interface:app --host 0.0.0.0 --port 8123
clip.large: 1.71GB [02:30, 11.4MB/s]                                            
clip_3.9: 2.11MB [00:01, 1.06MB/s]                                              
kl.f8: 405MB [00:36, 11.2MB/s]                                                  
ldm.sd: 4.27GB [06:12, 11.5MB/s]                                                
XXX lineno: -1, opcode: 0
Traceback (most recent call last):
  File "/home/danielrh/dev/carefree-creator/cfenv/lib/python3.10/site-packages/starlette/routing.py", line 645, in lifespan
    async with self.lifespan_context(app):
  File "/home/danielrh/dev/carefree-creator/cfenv/lib/python3.10/site-packages/starlette/routing.py", line 540, in __aenter__
    await self._router.startup()
  File "/home/danielrh/dev/carefree-creator/cfenv/lib/python3.10/site-packages/starlette/routing.py", line 622, in startup
    await handler()
  File "/home/danielrh/dev/carefree-creator/./apis/interface.py", line 186, in startup
    v.initialize()
  File "/home/danielrh/dev/carefree-creator/./cfcreator/txt2img.py", line 42, in initialize
    self.ms = init_sd_ms()
  File "/home/danielrh/dev/carefree-creator/./cfcreator/common.py", line 213, in init_sd_ms
    "": get_sd(),
  File "/home/danielrh/dev/carefree-creator/./cfcreator/common.py", line 42, in get_sd
    return _get("sd", DiffusionAPI.from_sd)
  File "/home/danielrh/dev/carefree-creator/./cfcreator/common.py", line 36, in _get
    m = init("cuda:0", use_half=True)
  File "/home/danielrh/dev/carefree-creator/cfenv/lib/python3.10/site-packages/cflearn/api/cv/models/diffusion.py", line 738, in from_sd
    return cls.from_pipeline(ldm_sd(), device, use_amp=use_amp, use_half=use_half)
  File "/home/danielrh/dev/carefree-creator/cfenv/lib/python3.10/site-packages/cflearn/api/cv/models/common.py", line 194, in from_pipeline
    return cls(m.model.core, m.model.device, use_amp=use_amp, use_half=use_half)
  File "/home/danielrh/dev/carefree-creator/cfenv/lib/python3.10/site-packages/cflearn/api/cv/models/diffusion.py", line 114, in __init__
    uncond = self.get_cond(unconditional_cond)
  File "/home/danielrh/dev/carefree-creator/cfenv/lib/python3.10/site-packages/cflearn/api/cv/models/diffusion.py", line 174, in get_cond
    return self.cond_model(cond)
  File "/home/danielrh/dev/carefree-creator/cfenv/lib/python3.10/site-packages/torch/nn/modules/module.py", line 1190, in _call_impl
    return forward_call(*input, **kwargs)
  File "/home/danielrh/dev/carefree-creator/cfenv/lib/python3.10/site-packages/cflearn/models/cv/diffusion/cond_models/clip.py", line 37, in forward
    text = self.get_text_indices(cond)
  File "/home/danielrh/dev/carefree-creator/cfenv/lib/python3.10/site-packages/cflearn/models/cv/diffusion/cond_models/clip.py", line 31, in get_text_indices
    text_arrays = [self.tokenizer.tokenize(t) for t in texts]
  File "/home/danielrh/dev/carefree-creator/cfenv/lib/python3.10/site-packages/cflearn/models/cv/diffusion/cond_models/clip.py", line 31, in <listcomp>
    text_arrays = [self.tokenizer.tokenize(t) for t in texts]
  File "D:\data\nolibox\data\CLIP-main\clip\simple_tokenizer.py", line 133, in tokenize
  File "D:\data\nolibox\data\CLIP-main\clip\simple_tokenizer.py", line -1, in <listcomp>
  File "D:\data\nolibox\data\CLIP-main\clip\simple_tokenizer.py", line -1, in encode
SystemError: unknown opcode

Application startup failed. Exiting.

I was using python-3.10; is that compatible?

then later I tried the same command

uvicorn apis.interface:app --host 0.0.0.0 --port 8123
XXX lineno: -1, opcode: 47
Segmentation fault (core dumped)

Here's a list of packages I installed

cfenv/lib/python3.10/site-packages$ pip list --local
Package                  Version     Editable project location
------------------------ ----------- -----------------------------------
aiohttp                  3.8.3
aiosignal                1.2.0
albumentations           1.3.0
anyio                    3.6.2
async-timeout            4.0.2
attrs                    22.1.0
Brotli                   1.0.9
carefree-client          0.1.2
carefree-creator         0.1.0       /home/danielrh/dev/carefree-creator
carefree-cv              0.1.0
carefree-learn           0.3.3.10
carefree-toolkit         0.2.18
certifi                  2022.9.24
charset-normalizer       2.1.1
click                    8.1.3
coloredlogs              15.0.1
commonmark               0.9.1
dill                     0.3.6
dnspython                2.2.1
email-validator          1.3.0
fastapi                  0.85.1
flatbuffers              22.10.26
frozenlist               1.3.1
ftfy                     6.1.1
future                   0.18.2
gevent                   22.10.1
geventhttpclient         2.0.8
greenlet                 1.1.3.post0
h11                      0.14.0
httptools                0.5.0
humanfriendly            10.0
idna                     3.4
imageio                  2.22.2
joblib                   1.2.0
lmdb                     1.3.0
mpmath                   1.2.1
multidict                6.0.2
multiprocess             0.70.14
networkx                 2.8.7
numpy                    1.23.4
nvidia-cublas-cu11       11.10.3.66
nvidia-cuda-nvrtc-cu11   11.7.99
nvidia-cuda-runtime-cu11 11.7.99
nvidia-cudnn-cu11        8.5.0.96
onnx                     1.12.0
onnx-simplifier          0.4.8
onnxruntime              1.13.1
opencv-python-headless   4.6.0.66
packaging                21.3
pathos                   0.3.0
Pillow                   9.3.0
pip                      22.0.2
pox                      0.3.2
ppft                     1.7.6.6
protobuf                 3.20.1
psutil                   5.9.3
pydantic                 1.10.2
Pygments                 2.13.0
pyparsing                3.0.9
python-dotenv            0.21.0
python-multipart         0.0.5
PyWavelets               1.4.1
PyYAML                   6.0
qudida                   0.0.4
regex                    2022.9.13
requests                 2.28.1
requests-toolbelt        0.10.1
rich                     12.6.0
scikit-image             0.19.3
scikit-learn             1.1.3
scipy                    1.9.3
setuptools               59.6.0
six                      1.16.0
sniffio                  1.3.0
SQLAlchemy               1.4.41
sqlalchemy2-stubs        0.0.2a29
sqlmodel                 0.0.8
starlette                0.20.4
sympy                    1.11.1
threadpoolctl            3.1.0
tifffile                 2022.10.10
torch                    1.13.0
torchvision              0.14.0
tqdm                     4.64.1
typing_extensions        4.4.0
urllib3                  1.26.12
uvicorn                  0.19.0
uvloop                   0.17.0
watchfiles               0.18.0
wcwidth                  0.2.5
websockets               10.4
wheel                    0.37.1
yarl                     1.8.1
zope.event               4.5.0
zope.interface           5.5.0

Oops, 3.10 is not supported yet 🤣.

For now, carefree-creator is based on carefree-learn, which requires 3.8 / 3.9 (as shown here), but I'll try to make it 3.10 compatible ASAP!

Maybe I should add a python version requirement to the README!

Hi!

In case you are still interested, this project should be compatible with python 3.10 now! 🥳

You'll need to pull the latest codes and rerun pip install -e . to activate the updates. 😉

I've tested the python 3.10 and it looks good. Feel free to re-open this issue if you are still getting into troubles!