GithubHelp home page GithubHelp logo

Does it work on M1? about if HOT 3 OPEN

deep-floyd avatar deep-floyd commented on August 18, 2024 3
Does it work on M1?

from if.

Comments (3)

brkirch avatar brkirch commented on August 18, 2024 1

https://github.com/brkirch/DeepFloyd-IF-example-Mac

It will require 64 GB of RAM due to the Diffusers SD x4 upscaler pipeline being very memory inefficient on MPS. Only using the stage I and stage II models requires 32 GB.

from if.

Adreitz avatar Adreitz commented on August 18, 2024

I saw jsindy on the IF Discord (April 28) state that they got it working (slowly?) on Mac and posted what I assume to be the Python inference code. I don't know enough about Python to make use of it, though.

I've got an M2 Max with 64 GB unified memory and think that, barring heavy quantization, the Mac is probably the ideal consumer platform to run IF. I just wish there were more evidence of people working on it. I just don't have the expertise or time.

from if.

faxioman avatar faxioman commented on August 18, 2024

No luck on an M1.

ysctl hw | grep BF16

returns

hw.optional.arm.FEAT_BF16: 0

So FEAT_BF16 is not supported on M1 but required by the model.

A full example you can try on your M2:

from deepfloyd_if.modules import IFStageI, IFStageII, StableStageIII
from deepfloyd_if.modules.t5 import T5Embedder
from huggingface_hub import login
from deepfloyd_if.pipelines import dream

login("<your hugginface token>", True)

device = 'mps'
if_I = IFStageI('IF-I-XL-v1.0', device=device)
if_II = IFStageII('IF-II-L-v1.0', device=device)
if_III = StableStageIII('stable-diffusion-x4-upscaler', device=device)
t5 = T5Embedder(device="cpu")


prompt = 'ultra close-up color photo portrait of rainbow owl with deer horns in the woods'
count = 1

result = dream(
    t5=t5, if_I=if_I, if_II=if_II, if_III=if_III,
    prompt=[prompt]*count,
    seed=42,
    if_I_kwargs={
        "guidance_scale": 7.0,
        "sample_timestep_respacing": "smart100",
    },
    if_II_kwargs={
        "guidance_scale": 4.0,
        "sample_timestep_respacing": "smart50",
    },
    if_III_kwargs={
        "guidance_scale": 9.0,
        "noise_level": 20,
        "sample_timestep_respacing": "75",
    },
)

if_III.show(result['III'], size=14)

If you don't have enough RAM, you can also try with the only if_I.

This is the setup (python 3.10.11 installed with pyenv):

pip install deepfloyd_if==1.0.2rc0
pip install xformers==0.0.16
pip install git+https://github.com/openai/CLIP.git --no-deps
pip install protobuf==3.20.3

from if.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.