Stability-AI / stable-fast-3d

SF3D: Stable Fast 3D Mesh Reconstruction with UV-unwrapping and Illumination Disentanglement
https://stable-fast-3d.github.io
Other
1.2k stars 133 forks source link

Error when call function SF3D.from_pretrained #44

Open Minhtrna opened 2 months ago

Minhtrna commented 2 months ago

I got the error message: FileNotFoundError: [WinError 2] The system cannot find the file specified. The error message indicates that issuse in : model = SF3D.from_pretrained( "stabilityai/stable-fast-3d", config_name="config.yaml", weight_name="model.safetensors", full error messdage : (test) C:\Mlab-Project\Github\stable-fast-3d>python app.py config.yaml: 100%|████████████████████████████████████████████████████████████████████████████████████████████████████████████████████| 2.40k/2.40k [00:00<?, ?B/s] model.safetensors: 100%|██████████████████████████████████████████████████████████████████████████████████████████████████████| 4.02G/4.02G [00:52<00:00, 76.5MB/s] config.json: 100%|████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████| 549/549 [00:00<?, ?B/s] model.safetensors: 100%|██████████████████████████████████████████████████████████████████████████████████████████████████████| 1.22G/1.22G [00:15<00:00, 78.9MB/s] open_clip_pytorch_model.bin: 100%|██████████████████████████████████████████████████████████████████████████████████████████████| 605M/605M [00:08<00:00, 72.3MB/s] Traceback (most recent call last): File "C:\Mlab-Project\Github\stable-fast-3d\app.py", line 32, in model = SF3D.from_pretrained( ^^^^^^^^^^^^^^^^^^^^^ File "C:\Mlab-Project\Github\stable-fast-3d\sf3d\system.py", line 89, in from_pretrained model = cls(cfg) ^^^^^^^^ File "C:\Mlab-Project\Github\stable-fast-3d\sf3d\models\utils.py", line 29, in init self.configure(*args, *kwargs) File "C:\Mlab-Project\Github\stable-fast-3d\sf3d\system.py", line 139, in configure self.baker = TextureBaker() ^^^^^^^^^^^^^^ File "C:\Mlab-Project\Github\stable-fast-3d\sf3d\texture_baker.py", line 13, in init self.baker = slangtorch.loadModule( ^^^^^^^^^^^^^^^^^^^^^^ File "C:\Users\quang\anaconda3\envs\test\Lib\site-packages\slangtorch\slangtorch.py", line 617, in loadModule rawModule = _loadModule(fileName, moduleName, buildDir, options, sourceDir=outputFolder, verbose=verbose, includePaths=includePaths, dryRun=False) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "C:\Users\quang\anaconda3\envs\test\Lib\site-packages\slangtorch\slangtorch.py", line 536, in _loadModule slangLib, metadata = compileAndLoadModule( ^^^^^^^^^^^^^^^^^^^^^ File "C:\Users\quang\anaconda3\envs\test\Lib\site-packages\slangtorch\slangtorch.py", line 427, in compileAndLoadModule slangLib = _compileAndLoadModule(metadata, sources, moduleName, buildDir, slangSourceDir, verbose) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "C:\Users\quang\anaconda3\envs\test\Lib\site-packages\slangtorch\slangtorch.py", line 447, in _compileAndLoadModule _add_msvc_to_env_var() File "C:\Users\quang\anaconda3\envs\test\Lib\site-packages\slangtorch\slangtorch.py", line 83, in _add_msvc_to_env_var path_to_add = find_cl() ^^^^^^^^^ File "C:\Users\quang\anaconda3\envs\test\Lib\site-packages\slangtorch\slangtorch.py", line 67, in find_cl result = subprocess.run([vswhere_path, '-latest', '-property', 'installationPath'], stdout=subprocess.PIPE, stderr=subprocess.PIPE) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "C:\Users\quang\anaconda3\envs\test\Lib\subprocess.py", line 548, in run with Popen(popenargs, **kwargs) as process: ^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "C:\Users\quang\anaconda3\envs\test\Lib\subprocess.py", line 1026, in init self._execute_child(args, executable, preexec_fn, close_fds, File "C:\Users\quang\anaconda3\envs\test\Lib\subprocess.py", line 1538, in _execute_child hp, ht, pid, tid = _winapi.CreateProcess(executable, args, ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ FileNotFoundError: [WinError 2] The system cannot find the file specified.

I have logged into huggingface with a token so the error cannot come from not logging in, I have also taken access from huggingface, recreate new env and try again but still not work. Any solution for this?

Minhtrna commented 2 months ago

Ok i followed some instruction on internet to add shell=True in result = subprocess.run([vswhere_path, '-latest', '-property', 'installationPath'], stdout=subprocess.PIPE, stderr=subprocess.PIPE, shell=True) a line of find_cl() function in slangtorch.py. Now the error become

Traceback (most recent call last): File "C:\Mlab-Project\Github\stable-fast-3d\app.py", line 32, in model = SF3D.from_pretrained( ^^^^^^^^^^^^^^^^^^^^^ File "C:\Mlab-Project\Github\stable-fast-3d\sf3d\system.py", line 89, in from_pretrained model = cls(cfg) ^^^^^^^^ File "C:\Mlab-Project\Github\stable-fast-3d\sf3d\models\utils.py", line 29, in init self.configure(*args, **kwargs) File "C:\Mlab-Project\Github\stable-fast-3d\sf3d\system.py", line 139, in configure self.baker = TextureBaker() ^^^^^^^^^^^^^^ File "C:\Mlab-Project\Github\stable-fast-3d\sf3d\texture_baker.py", line 13, in init self.baker = slangtorch.loadModule( ^^^^^^^^^^^^^^^^^^^^^^ File "C:\Users\quang\anaconda3\envs\test\Lib\site-packages\slangtorch\slangtorch.py", line 617, in loadModule rawModule = _loadModule(fileName, moduleName, buildDir, options, sourceDir=outputFolder, verbose=verbose, includePaths=includePaths, dryRun=False) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "C:\Users\quang\anaconda3\envs\test\Lib\site-packages\slangtorch\slangtorch.py", line 536, in _loadModule slangLib, metadata = compileAndLoadModule( ^^^^^^^^^^^^^^^^^^^^^ File "C:\Users\quang\anaconda3\envs\test\Lib\site-packages\slangtorch\slangtorch.py", line 427, in compileAndLoadModule slangLib = _compileAndLoadModule(metadata, sources, moduleName, buildDir, slangSourceDir, verbose) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "C:\Users\quang\anaconda3\envs\test\Lib\site-packages\slangtorch\slangtorch.py", line 447, in _compileAndLoadModule _add_msvc_to_env_var() File "C:\Users\quang\anaconda3\envs\test\Lib\site-packages\slangtorch\slangtorch.py", line 83, in _add_msvc_to_env_var path_to_add = find_cl() ^^^^^^^^^ File "C:\Users\quang\anaconda3\envs\test\Lib\site-packages\slangtorch\slangtorch.py", line 74, in find_cl raise ValueError("cl.exe not found in default Visual Studio installation path") ValueError: cl.exe not found in default Visual Studio installation path

seem to be i need the c++ build tools to beable to load the model. But it still run fine on google colab. why it's cannot on local machine :(

jammm commented 2 months ago

It seems like you are using the code from the huggingface repo which is an older version. Can you instead clone the latest main branch from the GitHub repo on GitHub that we're on right now ? https://github.com/Stability-AI/stable-fast-3d

Then use gradio_app.py instead of app.py.

For Windows, install Visual Studio (with "Desktop development with C++" selected during setup) as it's a required dependency that includes the cl.exe MSVC compiler that's need to compile the C++/CUDA extensions. Follow the README.md for instructions https://github.com/Stability-AI/stable-fast-3d/blob/main/README.md