Stability-AI / generative-models

Generative Models by Stability AI
MIT License
24.74k stars 2.75k forks source link

How to run SV3D_u on MacBook with M1 chip #360

Open alisonqiu opened 6 months ago

alisonqiu commented 6 months ago

To run SV3D_u on a single image I followed the instruction to download the sv3d_u.safetensors and run python scripts/sampling/simple_video_sample.py but got the errors below and realized xFormers is not supported on Mac.

Was anyone able to find a workaround to run it on Mac?

OMP: Info #276: omp_set_nested routine deprecated, please use omp_set_max_active_levels instead.
/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/site-packages/torchvision/io/image.py:13: UserWarning: Failed to load image Python extension: dlopen(/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/site-packages/torchvision/image.so, 0x0006): Symbol not found: __ZN3c1017RegisterOperatorsD1Ev
  Referenced from: <61623A3D-DA3C-3AAD-B2F0-D363151DDB3F> /Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/site-packages/torchvision/image.so
  Expected in:     <03BFC270-EF54-36FC-B102-371F5164D3C9> /Users/alisonqiu/Library/Python/3.10/lib/python/site-packages/torch/lib/libtorch_cpu.dylib
  warn(f"Failed to load image Python extension: {e}")
WARNING[XFORMERS]: xFormers can't load C++/CUDA extensions. xFormers was built for:
    PyTorch 1.11.0 with CUDA None (you have 2.3.0)
    Python  3.10.1 (you have 3.10.1)
  Please reinstall xformers (see https://github.com/facebookresearch/xformers#installing-xformers)
  Memory-efficient attention, SwiGLU, sparse and more won't be available.
  Set XFORMERS_MORE_DETAILS=1 for more details
Traceback (most recent call last):
  File "/Users/alisonqiu/Downloads/React/generative-models/scripts/sampling/simple_video_sample.py", line 349, in <module>
    Fire(sample)
  File "/Users/alisonqiu/Library/Python/3.10/lib/python/site-packages/fire/core.py", line 143, in Fire
    component_trace = _Fire(component, args, parsed_flag_args, context, name)
  File "/Users/alisonqiu/Library/Python/3.10/lib/python/site-packages/fire/core.py", line 477, in _Fire
    component, remaining_args = _CallAndUpdateTrace(
  File "/Users/alisonqiu/Library/Python/3.10/lib/python/site-packages/fire/core.py", line 693, in _CallAndUpdateTrace
    component = fn(*varargs, **kwargs)
  File "/Users/alisonqiu/Downloads/React/generative-models/scripts/sampling/simple_video_sample.py", line 98, in sample
    model, filter = load_model(
  File "/Users/alisonqiu/Downloads/React/generative-models/scripts/sampling/simple_video_sample.py", line 340, in load_model
    model = instantiate_from_config(config.model).to(device).eval()
  File "/Users/alisonqiu/Downloads/React/generative-models/sgm/util.py", line 175, in instantiate_from_config
    return get_obj_from_str(config["target"])(**config.get("params", dict()))
  File "/Users/alisonqiu/Downloads/React/generative-models/sgm/models/diffusion.py", line 48, in __init__
    model = instantiate_from_config(network_config)
  File "/Users/alisonqiu/Downloads/React/generative-models/sgm/util.py", line 175, in instantiate_from_config
    return get_obj_from_str(config["target"])(**config.get("params", dict()))
  File "/Users/alisonqiu/Downloads/React/generative-models/sgm/modules/diffusionmodules/video_model.py", line 153, in __init__
    linear(model_channels, time_embed_dim),
  File "/Users/alisonqiu/Downloads/React/generative-models/sgm/modules/diffusionmodules/util.py", line 296, in linear
    return nn.Linear(*args, **kwargs)
  File "/Users/alisonqiu/Library/Python/3.10/lib/python/site-packages/torch/nn/modules/linear.py", line 98, in __init__
    self.weight = Parameter(torch.empty((out_features, in_features), **factory_kwargs))
  File "/Users/alisonqiu/Library/Python/3.10/lib/python/site-packages/torch/utils/_device.py", line 78, in __torch_function__
    return func(*args, **kwargs)
  File "/Users/alisonqiu/Library/Python/3.10/lib/python/site-packages/torch/cuda/__init__.py", line 284, in _lazy_init
    raise AssertionError("Torch not compiled with CUDA enabled")
AssertionError: Torch not compiled with CUDA enabled
laohuangsk8 commented 3 months ago

+1