Hacker News new | ask | show | jobs
by alexfromapex 1290 days ago
All I had to do was:

- create a virtual environment (Python 3.8.15 worked best)

- upgrade pip

- pip install wheel

- pip install -r requirements.txt

- and then, python setup.py install

- Had to update my XCode to use the generated mlpackage files :/

- Expand drawer with instructions and follow them to download model and convert it to Core ML format

- Run their CLI command as mentioned

2 comments

> Had to update my XCode to use the generated mlpackage files :/

I keep running into this, message is

  RuntimeError: Error compiling model: "Error reading protobuf spec. validator error: The model supplied is of version 7, intended for a newer version of Xcode. This version of Xcode supports model version 6 or earlier.".
I upgraded XCode, tried re-installing the command line tools with various invocations of `sudo rm -rf /Library/Developer/CommandLineTools ; xcode-select --install` etc but still get the above message

(thanks in advance, in case you see this and reply)

edit: I see from https://github.com/apple/ml-stable-diffusion/issues/7 that somebody upgraded to macos 13.0.1 and that fixed the issue for them. I've put off upgrading to Ventura so far and don't want to upgrade just to mess around with stable diffusion on m1, if it can be avoided.

I'm past the edit window, but: I'm a dope, I didn't see the quite clear "macos 13 or newer" requirement.
Where did you get those instructions from? Is creating a virtual environment necessary if I'm fine with it running on my real system?

I assume the environment part is what the "conda" commands on the GitHub repo readme are doing, but finding "conda" to install seems to be its own process. It's not on MacPorts, pip seems to only install a Python package instead of an executable, and getting a package from some other site feels sketchy.

What is it with ML and Python, anyway? Why is this amazing new technology being shrouded in an ecosystem and language which… well, I guess if I can't say anything nice…

Conda's actually a pretty well respected python distribution package manager from Anaconda.com (see e.g. https://en.wikipedia.org/wiki/Anaconda_(Python_distribution)). Anaconda has a lot of the standard scientific python computing packages in addition to a virtual environment and package manager or you could use Miniconda version for just the conda package manager + virtualenv.

I think whether you need a virtualenv depends on your system python version and compatibility of any of the dependencies, but it's also pretty nice to be able to spin up or blow away envs without bloating your main python directory or worrying that you're overwriting dependencies for a different project.

> finding conda to install seems to be its own process

    brew install miniconda
brew comes from:

    /bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
Don't take my word for it, visit https://brew.sh.
I’m still stubbornly using MacPorts. If it ain’t broke…

But given that the entire world of technical documentation assumes all technically-inclined people using Macs are using Homebrew, I’ll probably have to give up and switch over at some point. But not yet.

Grew up on BSD so I feel you. I'd say it became time to give in after they cleaned up need for su and put everything in opt.

In fact, if you used it before they cleaned all that up, or used it before moving from Intel to ARM and did a restore to the new arch instead of fresh install, it's worth doing a brew dump to a Brewfile, uninstalling ALL packages and brew, and reinstalling fresh on this side of the permissions and path cleanups.

- Migrate Homebrew from Intel Macs to Apple Silicon Macs:

- https://sparanoid.blog/749577

They are basically conventions for Python but the actual instructions I just found are unexpanded in the README on the GitHub repo. You have to run one of the commands which downloads the model and converts it for you to Core ML. If you've never used Hugging Face, you'll need to create an account to get a token and then use their CLI to login with the token to be able to download the model. Then you can run prompts from CLI with the commands they give.
+1