AiuniAI / Unique3D

Official implementation of Unique3D: High-Quality and Efficient 3D Mesh Generation from a Single Image
https://wukailu.github.io/Unique3D/
MIT License
1.96k stars 131 forks source link

For Windows users #15

Closed jtydhr88 closed 2 weeks ago

jtydhr88 commented 2 weeks ago

I got it working on my Windows. It might require Visual Studio Build Tools. However, I am not sure because my local already installed previously. If it needs, you can find from Visual Studio Build Tools.

Env

  1. WIndows 10
  2. Conda - Python 3.11
  3. 3090
  4. Cuda 12.1

Setup Steps

  1. conda create -n unique3d-py311 python=3.11
  2. conda activate unique3d-py311
  3. pip install torch torchvision torchaudio xformers --index-url https://download.pytorch.org/whl/cu121
  4. (Download the trition whl from https://huggingface.co/madbuda/triton-windows-builds, because I use python 311, so download whl build for py311 and install manually) pip install triton-2.1.0-cp311-cp311-win_amd64.whl
  5. pip install Ninja
  6. (Due the latest diffusers is not compatible to the code of repo, we MUST install this for diffusers manually) pip install diffusers==0.27.2
  7. pip install grpcio werkzeug tensorboard-data-server
  8. remove torch>=2.0.1, diffusers>=0.26.3, xformers, onnxruntime_gpu from requirement.txt image
  9. pip install -r requirements.txt
  10. pip uninstall onnxruntime
  11. pip uninstall onnxruntime-gpu
  12. (We MUST uninstall onnxruntime and onnxruntime-gpu first, then install this given version manually) pip install onnxruntime-gpu --extra-index-url https://aiinfra.pkgs.visualstudio.com/PublicPackages/_packaging/onnxruntime-cuda-12/pypi/simple/

Runtime

  1. you need to create the output folder tmp\gradio under the running driver by yourself, for me, it is F:\tmp\gradio

  2. You will see the error of onnxruntime image but it would not effect the generation of the mesh (maybe?)

(Update) In order to fix the TensorRT error, you need to download TensorRT bundle for windows from https://github.com/NVIDIA/TensorRT, and configure TensorRT-10.0.1.6\lib in your PATH env variable. meanwhile also need to configure CUDA and cuDNN, please refer to github page for more details.

Quick test image image

Good luck~

SoftologyPro commented 2 weeks ago

I had a go getting this working under Windows too. For my setup I am supporting CUDA 11.8 and Python 3.10.x because that is what I use for all the AI/ML scripts in Visions of Chaos.

This is my install.bat file. Save to an empty directory (in my case D:\Tests\Unique3D) and run it command line to install Unique3D automatically.

@echo off

echo *** Deleting Unique3D directory if it exists
if exist Unique3D\. rd /S /Q Unique3D

echo *** Cloning Unique3D repository
git clone https://huggingface.co/spaces/Wuvin/Unique3D
cd Unique3D

echo *** Creating venv
python -m venv venv
call venv\scripts\activate.bat

python -m pip install --upgrade pip
pip install torch torchvision torchaudio xformers --index-url https://download.pytorch.org/whl/cu118
pip install https://softology.pro/wheels/triton-2.1.0-cp310-cp310-win_amd64.whl
pip install ninja
pip install diffusers==0.27.2
pip install grpcio werkzeug tensorboard-data-server

echo *** Removing linux specific packages from requirements.txt
type requirements.txt | findstr /v pytorch3d > stripped.txt
del requirements.txt
ren stripped.txt requirements.txt
type requirements.txt | findstr /v ort-nightly > stripped.txt
del requirements.txt
ren stripped.txt requirements.txt
type requirements.txt | findstr /v onnxruntime > stripped.txt
del requirements.txt
ren stripped.txt requirements.txt
type requirements.txt | findstr /v torch-scatter > stripped.txt
del requirements.txt
ren stripped.txt requirements.txt
type requirements.txt | findstr /v diffusers > stripped.txt
del requirements.txt
ren stripped.txt requirements.txt
type requirements.txt | findstr /v xformers > stripped.txt
del requirements.txt
ren stripped.txt requirements.txt
type requirements.txt | findstr /v torch > stripped.txt
del requirements.txt
ren stripped.txt requirements.txt

echo *** Installing requirments.txt
pip install -r requirements.txt

echo *** Installing other required packages
pip uninstall -y xformers
pip install --no-cache-dir --ignore-installed --force-reinstall --no-warn-conflicts xformers==0.0.25 --index-url https://download.pytorch.org/whl/cu118
pip uninstall -y torch
pip uninstall -y torch
pip install --no-cache-dir --ignore-installed --force-reinstall --no-warn-conflicts torch==2.2.1+cu118 torchvision torchaudio --index-url https://download.pytorch.org/whl/cu118

pip uninstall onnxruntime
pip uninstall onnxruntime-gpu
pip install onnxruntime-gpu --extra-index-url https://aiinfra.pkgs.visualstudio.com/PublicPackages/_packaging/onnxruntime-cuda-12/pypi/simple/
pip install ort-nightly-gpu

pip install https://files.pythonhosted.org/packages/b2/3c/6205090507ea96e6e56d0deda8d0fc4c507026ef3772e55b637a5d0b7c61/spaces-0.28.3-py3-none-any.whl

call venv\scripts\deactivate.bat
cd ..

echo *** Finished Unique3D install
echo.

Once the install finishes I try running python gradio_app\gradio_local.py --port 7860 which gives this error

Traceback (most recent call last):
  File "D:\Tests\Unique3D\Unique3D\gradio_app\gradio_local.py", line 20, in <module>
    from gradio_app.gradio_3dgen import create_ui as create_3d_ui
  File "D:\Tests\Unique3D\Unique3D\.\gradio_app\gradio_3dgen.py", line 1, in <module>
    import spaces
ModuleNotFoundError: No module named 'spaces'

After pip install spaces and rerunning it I get

python gradio_app\gradio_local.py --port 7860
Traceback (most recent call last):
  File "D:\Tests\Unique3D\Unique3D\gradio_app\gradio_local.py", line 20, in <module>
    from gradio_app.gradio_3dgen import create_ui as create_3d_ui
  File "D:\Tests\Unique3D\Unique3D\.\gradio_app\gradio_3dgen.py", line 1, in <module>
    import spaces
  File "D:\Tests\Unique3D\Unique3D\venv\lib\site-packages\spaces\__init__.py", line 10, in <module>
    from .zero.decorator import GPU
  File "D:\Tests\Unique3D\Unique3D\venv\lib\site-packages\spaces\zero\decorator.py", line 21, in <module>
    from .wrappers import regular_function_wrapper
  File "D:\Tests\Unique3D\Unique3D\venv\lib\site-packages\spaces\zero\wrappers.py", line 15, in <module>
    from multiprocessing.context import ForkProcess
ImportError: cannot import name 'ForkProcess' from 'multiprocessing.context' (D:\Python\lib\multiprocessing\context.py)

ForkProcess seems to be Linux only so no go for me. If we can get a single click install.bat working that would really help Windows users (and me so I can add support for Unique3D into Visions of Chaos).

Gitterman69 commented 2 weeks ago

bump

Aiunii commented 2 weeks ago

Hey!  Welcome to 4D digital art creation universe—— Aiuni.

🤖First, join our community by:  https://discord.gg/aiuni

🦄️Then you will get the invitation code at “getting-started” channel.

Start your creative journey and have fun!🌟

From: @.> Date: Sat, Jun 15, 2024, 4:23 AM Subject: Re: [AiuniAI/Unique3D] For Windows users (Issue #15) To: @.> Cc: @.> bump — Reply to this email directly, view it on GitHubhttps://github.com/AiuniAI/Unique3D/issues/15#issuecomment-2168712192, or unsubscribehttps://github.com/notifications/unsubscribe-auth/BI3NO5RD3VCI4QZO2WZX2ODZHNGKXAVCNFSM6AAAAABJAOPC56VHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDCNRYG4YTEMJZGI. You are receiving this because you are subscribed to this thread.[image: https://github.com/notifications/beacon/BI3NO5QIEWXNSVVCHOWHMPLZHNGKXA5CNFSM6AAAAABJAOPC56WGG33NNVSW45C7OR4XAZNMJFZXG5LFINXW23LFNZ2KUY3PNVWWK3TUL5UWJTUBIPWAA.gif]Message ID: @.>

DamienCz commented 1 day ago

for autodownload (unique3d-py311) E:\Unique3D>pip show torch Name: torch Version: 2.3.0+cu121 Summary: Tensors and Dynamic neural networks in Python with strong GPU acceleration Home-page: https://pytorch.org/ Author: PyTorch Team Author-email: packages@pytorch.org License: BSD-3 Location: C:\Users\WS01\anaconda3\envs\unique3d-py311\Lib\site-packages Requires: filelock, fsspec, jinja2, mkl, networkx, sympy, typing-extensions Required-by: torchaudio, torchvision, xformers

(unique3d-py311) E:\Unique3D> then .... Failed to build pytorch3d ERROR: Could not build wheels for pytorch3d, which is required to install pyproject.toml-based projects

how to deal with this problem...

jtydhr88 commented 1 day ago

See https://github.com/AiuniAI/Unique3D/issues/29