rupeshs/fastsdcpu

Environment issue

Opened this issue · 10 comments

Hi all, thank you for developing the project, it's really great.

When I run on Intel Mac (./install-mac.sh and then ./start-webui.sh or ./start.sh) I get the following error:

Traceback (most recent call last):
  File "/Users/username/projects/fastsdcpu_2/src/app.py", line 8, in <module>
    from backend.upscale.tiled_upscale import generate_upscaled_image
  File "/Users/username/projects/fastsdcpu_2/src/backend/upscale/tiled_upscale.py", line 6, in <module>
    from context import Context
  File "/Users/username/projects/fastsdcpu_2/src/context.py", line 5, in <module>
    from backend.lcm_text_to_image import LCMTextToImage
  File "/Users/username/projects/fastsdcpu_2/src/backend/lcm_text_to_image.py", line 19, in <module>
    from backend.openvino.pipelines import (
  File "/Users/username/projects/fastsdcpu_2/src/backend/openvino/pipelines.py", line 9, in <module>
    from optimum.intel.openvino.modeling_diffusion import OVBaseModel
  File "/Users/username/projects/fastsdcpu_2/env/lib/python3.10/site-packages/optimum/intel/openvino/__init__.py", line 19, in <module>
    from .utils import (
  File "/Users/username/projects/fastsdcpu_2/env/lib/python3.10/site-packages/optimum/intel/openvino/utils.py", line 76, in <module>
    "u16": torch.uint16,
  File "/Users/username/projects/fastsdcpu_2/env/lib/python3.10/site-packages/torch/__init__.py", line 1938, in __getattr__
    raise AttributeError(f"module '{__name__}' has no attribute '{name}'")
AttributeError: module 'torch' has no attribute 'uint16'

The only other report I found on this is this one, where they suggest upgrading torch. In fact, I managed to get FastSD CPU running by manually installing pytorch=2.4.0.

I didn't have a chance to try this on another OS, so not sure if this is specific of my environment or some other dependency that needs to be pinned.

@FrenkT Thanks for reporting this

@FrenkT may I ask you how you manually installed pytorch to get Fastsd cpu to work ?
I've had exactly the same issue when trying to run the desktop app or the web ui. (Macbook air with Intel cpu, Mac Os Big Sur)

@FrenkT Have you tried the latest release?

@FrenkT Have you tried the latest release?

Hi @rupeshs, I just tried and I still have the error.

@FrenkT may I ask you how you manually installed pytorch to get Fastsd cpu to work ? I've had exactly the same issue when trying to run the desktop app or the web ui. (Macbook air with Intel cpu, Mac Os Big Sur)

@maburu-keki, here are the steps I followed, hope they work for you.

First of all, it looks like pytorch 2.4.0 is not available on Intel Mac via pip, so I had to go through conda, so:

  • Install miniconda: https://docs.conda.io/projects/conda/en/latest/user-guide/install/macos.html
  • Create a python 3.11: conda create -n env python=3.11 and activate it: conda activate env
  • Install pytorch: conda install pytorch==2.4.0 torchvision -c pytorch and the other requirements: pip install -r requirements.txt
  • Ignore the start.sh script and run directly with python, e.g. python src/app.py --gui

@FrenkT

I get this :

_PackagesNotFoundError: The following packages are not available from current channels:
pytorch==2.4.0

While The "pytorch" channel does have up to the latest stable version (2.5.0) for windows, linux and arm64 osx, it is stuck at version 2.2.2 for mac os x64 (Intel) :
https://anaconda.org/pytorch/pytorch

Should I use another channel ?
Thanks.

@maburu-keki, here are the steps I followed, hope they work for you.

First of all, it looks like pytorch 2.4.0 is not available on Intel Mac via pip, so I had to go through conda, so:

* Install miniconda: https://docs.conda.io/projects/conda/en/latest/user-guide/install/macos.html

* Create a python 3.11: `conda create -n env python=3.11` and activate it: `conda activate env`

* Install pytorch: `conda install pytorch==2.4.0 torchvision -c pytorch` and the other requirements: `pip install -r requirements.txt`

@FrenkT

I had to install pytorch (2.4.1) from the "conda-forge" channel

             conda install pytorch torchvision -c conda-forge

...as official pytorch binaries for Intel Macs are stopped (from 2.3.0 onwards)
@rupeshs : pytorch/pytorch#114602
https://dev-discuss.pytorch.org/t/pytorch-macos-x86-builds-deprecation-starting-january-2024/1690

* Ignore the `start.sh` script and run directly with python, e.g. `python src/app.py --gui`

It got stuck at the command line : no gui window popping, nothing happening at all, for about a minute.
And then :

                   zsh: segmentation fault  python src/app.py --gui

@rupeshs Your app doesn't work at all on Intel Macs running mac os Big Sur.

@maburu-keki
I tried following again my instructions and they work for me, so I am not sure on what's going on your side as I can't reproduce your issue.
It might be that I am on MacOS Sequoia, while you are on Big Sur, which is quite a few releases old.

@maburu-keki It might be that I am on MacOS Sequoia, while you are on Big Sur, which is quite a few releases old.

Most definitely.
But not being able to run the app on an intel macbook air, just because it happens to be on mac os Big Sur, kind of defeats the whole purpose of the project, doesn't it.

I wish I had the latest Mac Os but my mac being a few years (too) old, Apple won't let me upgrade beyond Big Sur.

I have the same problem here on Monterey. could you please changed the title of the issue to 'PyTorch on Mac uint16 or similar, I only found this issue by accident. I'll try the conda route.