Spaces:
Runtime error
Runtime error
Commit ·
392212b
1
Parent(s): b6aed58
update
Browse files- app.py +31 -25
- requirements.txt +5 -5
app.py
CHANGED
|
@@ -66,29 +66,29 @@ def images_to_video(images, output_path, fps=30):
|
|
| 66 |
|
| 67 |
import shutil
|
| 68 |
|
| 69 |
-
def find_cuda():
|
| 70 |
-
# Check if CUDA_HOME or CUDA_PATH environment variables are set
|
| 71 |
-
cuda_home = os.environ.get('CUDA_HOME') or os.environ.get('CUDA_PATH')
|
| 72 |
-
|
| 73 |
-
if cuda_home and os.path.exists(cuda_home):
|
| 74 |
-
return cuda_home
|
| 75 |
-
|
| 76 |
-
# Search for the nvcc executable in the system's PATH
|
| 77 |
-
nvcc_path = shutil.which('nvcc')
|
| 78 |
-
|
| 79 |
-
if nvcc_path:
|
| 80 |
-
# Remove the 'bin/nvcc' part to get the CUDA installation path
|
| 81 |
-
cuda_path = os.path.dirname(os.path.dirname(nvcc_path))
|
| 82 |
-
return cuda_path
|
| 83 |
-
|
| 84 |
-
return None
|
| 85 |
-
|
| 86 |
-
cuda_path = find_cuda()
|
| 87 |
-
|
| 88 |
-
if cuda_path:
|
| 89 |
-
print(f"CUDA installation found at: {cuda_path}")
|
| 90 |
-
else:
|
| 91 |
-
print("CUDA installation not found")
|
| 92 |
|
| 93 |
config_path = 'configs/instant-mesh-large.yaml'
|
| 94 |
config = OmegaConf.load(config_path)
|
|
@@ -98,7 +98,13 @@ infer_config = config.infer_config
|
|
| 98 |
|
| 99 |
IS_FLEXICUBES = True if config_name.startswith('instant-mesh') else False
|
| 100 |
|
| 101 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 102 |
|
| 103 |
# load diffusion model
|
| 104 |
print('Loading diffusion model ...')
|
|
@@ -358,4 +364,4 @@ with gr.Blocks() as demo:
|
|
| 358 |
outputs=[output_model_obj]
|
| 359 |
)
|
| 360 |
|
| 361 |
-
demo.launch()
|
|
|
|
| 66 |
|
| 67 |
import shutil
|
| 68 |
|
| 69 |
+
#def find_cuda():
|
| 70 |
+
# # Check if CUDA_HOME or CUDA_PATH environment variables are set
|
| 71 |
+
# cuda_home = os.environ.get('CUDA_HOME') or os.environ.get('CUDA_PATH')
|
| 72 |
+
#
|
| 73 |
+
# if cuda_home and os.path.exists(cuda_home):
|
| 74 |
+
# return cuda_home
|
| 75 |
+
#
|
| 76 |
+
# # Search for the nvcc executable in the system's PATH
|
| 77 |
+
# nvcc_path = shutil.which('nvcc')
|
| 78 |
+
#
|
| 79 |
+
# if nvcc_path:
|
| 80 |
+
# # Remove the 'bin/nvcc' part to get the CUDA installation path
|
| 81 |
+
# cuda_path = os.path.dirname(os.path.dirname(nvcc_path))
|
| 82 |
+
# return cuda_path
|
| 83 |
+
#
|
| 84 |
+
# return None
|
| 85 |
+
#
|
| 86 |
+
#cuda_path = find_cuda()
|
| 87 |
+
#
|
| 88 |
+
#if cuda_path:
|
| 89 |
+
# print(f"CUDA installation found at: {cuda_path}")
|
| 90 |
+
#else:
|
| 91 |
+
# print("CUDA installation not found")
|
| 92 |
|
| 93 |
config_path = 'configs/instant-mesh-large.yaml'
|
| 94 |
config = OmegaConf.load(config_path)
|
|
|
|
| 98 |
|
| 99 |
IS_FLEXICUBES = True if config_name.startswith('instant-mesh') else False
|
| 100 |
|
| 101 |
+
if torch.backends.mps.is_available():
|
| 102 |
+
_device = "mps"
|
| 103 |
+
elif torch.cuda.is_available():
|
| 104 |
+
_device = "cuda"
|
| 105 |
+
else:
|
| 106 |
+
_device = "cpu"
|
| 107 |
+
device = torch.device(_device)
|
| 108 |
|
| 109 |
# load diffusion model
|
| 110 |
print('Loading diffusion model ...')
|
|
|
|
| 364 |
outputs=[output_model_obj]
|
| 365 |
)
|
| 366 |
|
| 367 |
+
demo.launch()
|
requirements.txt
CHANGED
|
@@ -1,6 +1,6 @@
|
|
| 1 |
-
torch==2.1.0
|
| 2 |
-
torchvision==0.16.0
|
| 3 |
-
torchaudio==2.1.0
|
| 4 |
pytorch-lightning==2.1.2
|
| 5 |
einops
|
| 6 |
omegaconf
|
|
@@ -18,6 +18,6 @@ bitsandbytes
|
|
| 18 |
imageio[ffmpeg]
|
| 19 |
xatlas
|
| 20 |
plyfile
|
| 21 |
-
xformers==0.0.22.post7
|
| 22 |
git+https://github.com/NVlabs/nvdiffrast/
|
| 23 |
-
huggingface-hub
|
|
|
|
| 1 |
+
#torch==2.1.0
|
| 2 |
+
#torchvision==0.16.0
|
| 3 |
+
#torchaudio==2.1.0
|
| 4 |
pytorch-lightning==2.1.2
|
| 5 |
einops
|
| 6 |
omegaconf
|
|
|
|
| 18 |
imageio[ffmpeg]
|
| 19 |
xatlas
|
| 20 |
plyfile
|
| 21 |
+
#xformers==0.0.22.post7
|
| 22 |
git+https://github.com/NVlabs/nvdiffrast/
|
| 23 |
+
huggingface-hub
|