Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

For Windows users #15

Closed
jtydhr88 opened this issue Jun 9, 2024 · 10 comments
Closed

For Windows users #15

jtydhr88 opened this issue Jun 9, 2024 · 10 comments

Comments

@jtydhr88
Copy link
Contributor

jtydhr88 commented Jun 9, 2024

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
Copy link

SoftologyPro commented Jun 10, 2024

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
Copy link

bump

@Aiunii
Copy link

Aiunii commented Jun 15, 2024 via email

@DamienCz
Copy link

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: [email protected]
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
Copy link
Contributor Author

See #29

@jayc0207
Copy link

jayc0207 commented Jul 23, 2024

python app\gradio_local.py --port 7860

Warning! extra parameter in cli is not verified, may cause erros.
Loading pipeline components...: 100%|███████████████████████████████████████████████████████████████████████████████████████| 5/5 [00:00<00:00, 416.27it/s]
You have disabled the safety checker for <class 'custum_3d_diffusion.custum_pipeline.unifield_pipeline_img2mvimg.StableDiffusionImage2MVCustomPipeline'> by passing safety_checker=None. Ensure that you abide to the conditions of the Stable Diffusion license and do not expose unfiltered results in services or applications open to the public. Both the diffusers team and Hugging Face strongly recommend to keep the safety filter enabled in all public facing circumstances, disabling it only for use-cases that involve analyzing network behavior or auditing its results. For more information, please have a look at huggingface/diffusers#254 .
Warning! extra parameter in cli is not verified, may cause erros.
C:\Users\jayis\anaconda3\envs\unique3d-py311\Lib\site-packages\huggingface_hub\file_download.py:1150: FutureWarning: resume_download is deprecated and will be removed in version 1.0.0. Downloads always resume when possible. If you want to force a new download, use force_download=True.
warnings.warn(
Traceback (most recent call last):
File "D:\Unique3D\Unique3D\app\gradio_local.py", line 20, in
from app.gradio_3dgen import create_ui as create_3d_ui
File "D:\Unique3D\Unique3D\app\gradio_3dgen.py", line 7, in
from app.custom_models.normal_prediction import predict_normals
File "D:\Unique3D\Unique3D\app\custom_models\normal_prediction.py", line 10, in
trainer, pipeline = load_pipeline(training_config, checkpoint_path)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "D:\Unique3D\Unique3D\app\custom_models\utils.py", line 65, in load_pipeline
configurable_unet.unet.to(device, dtype=weight_dtype)
File "C:\Users\jayis\anaconda3\envs\unique3d-py311\Lib\site-packages\torch\nn\modules\module.py", line 1173, in to
return self._apply(convert)
^^^^^^^^^^^^^^^^^^^^
File "C:\Users\jayis\anaconda3\envs\unique3d-py311\Lib\site-packages\torch\nn\modules\module.py", line 779, in _apply
module._apply(fn)
File "C:\Users\jayis\anaconda3\envs\unique3d-py311\Lib\site-packages\torch\nn\modules\module.py", line 779, in _apply
module._apply(fn)
File "C:\Users\jayis\anaconda3\envs\unique3d-py311\Lib\site-packages\torch\nn\modules\module.py", line 779, in _apply
module._apply(fn)
[Previous line repeated 7 more times]
File "C:\Users\jayis\anaconda3\envs\unique3d-py311\Lib\site-packages\torch\nn\modules\module.py", line 804, in _apply
param_applied = fn(param)
^^^^^^^^^
File "C:\Users\jayis\anaconda3\envs\unique3d-py311\Lib\site-packages\torch\nn\modules\module.py", line 1159, in convert
return t.to(
^^^^^
torch.cuda.OutOfMemoryError: CUDA out of memory. Tried to allocate 26.00 MiB. GPU

How to solve this problem ?
windows 11
nvidia rt3070 Ti 8G
32 G RAM
i9 CPU

@turugi-ni
Copy link

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).

Windows does not support ForkProcess, open venv\lib\site-packages\spaces\zero\wrappers.py in a text editor tool, Change from multiprocessing.context import ForkProcess to from multiprocessing.context import SpawnProcess in line 15 and Try changing line 50 Process = from multiprocessing.get_context('fork').Process to Process = from multiprocessing.get_context('spawn').Process, Still, we encounter new errors. Unique3D has too many dependencies of dependencies and more dependencies of dependencies I gave up installing on Windows.

@mmestiri
Copy link

mmestiri commented Dec 19, 2024

i have this error : python app/gradio_local.py --port 7860
Traceback (most recent call last):
File "C:\Users\mmest\OneDrive\Desktop\generative AI\Unique3D-main\Unique3D-main\app\gradio_local.py", line 20, in
from app.gradio_3dgen import create_ui as create_3d_ui
File "C:\Users\mmest\OneDrive\Desktop\generative AI\Unique3D-main\Unique3D-main\app\gradio_3dgen.py", line 6, in
from app.custom_models.mvimg_prediction import run_mvprediction
File "C:\Users\mmest\OneDrive\Desktop\generative AI\Unique3D-main\Unique3D-main\app\custom_models\mvimg_prediction.py", line 8, in
from app.custom_models.utils import load_pipeline
File "C:\Users\mmest\OneDrive\Desktop\generative AI\Unique3D-main\Unique3D-main\app\custom_models\utils.py", line 6, in
from custum_3d_diffusion import modules
File "C:\Users\mmest\OneDrive\Desktop\generative AI\Unique3D-main\Unique3D-main\custum_3d_diffusion\modules.py", line 14, in
from custum_3d_diffusion.trainings import base, image2mvimage_trainer, image2image_trainer
File "C:\Users\mmest\OneDrive\Desktop\generative AI\Unique3D-main\Unique3D-main\custum_3d_diffusion\trainings\base.py", line 9, in
from diffusers.utils import make_image_grid
File "C:\Users\mmest.conda\envs\unique3d-py311\Lib\site-packages\diffusers_init_.py", line 5, in
from .utils import (
File "C:\Users\mmest.conda\envs\unique3d-py311\Lib\site-packages\diffusers\utils_init_.py", line 38, in
from .dynamic_modules_utils import get_class_from_dynamic_module
File "C:\Users\mmest.conda\envs\unique3d-py311\Lib\site-packages\diffusers\utils\dynamic_modules_utils.py", line 28, in
from huggingface_hub import cached_download, hf_hub_download, model_info
ImportError: cannot import name 'cached_download' from 'huggingface_hub' (C:\Users\mmest.conda\envs\unique3d-py311\Lib\site-packages\huggingface_hub_init_.py)

seem problem with the huggingface_hub

@mmestiri
Copy link

this resolve it : pip install torch==2.2.0 torchvision torchaudio==2.2.0 --index-url https://download.pytorch.org/whl/cu121

@XKMEXX
Copy link

XKMEXX commented Dec 30, 2024

this resolve it : pip install torch==2.2.0 torchvision torchaudio==2.2.0 --index-url https://download.pytorch.org/whl/cu121

It didn't help

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

10 participants