Spaces:
Runtime error
Runtime error
Vo Minh Vu commited on
Commit ·
09e3ade
1
Parent(s): 3ed799f
update float based on cpu or gpu
Browse files- app.py +5 -2
- requirements.txt +3 -3
app.py
CHANGED
|
@@ -46,14 +46,17 @@ IS_FLEXICUBES = os.path.basename(config_path).startswith('instant-mesh')
|
|
| 46 |
# pick device
|
| 47 |
device = torch.device('cuda' if torch.cuda.is_available() else 'cpu')
|
| 48 |
if device.type == 'cpu':
|
| 49 |
-
print("⚠️ No CUDA GPU detected. Falling back to CPU (very slow!)")
|
|
|
|
|
|
|
|
|
|
| 50 |
|
| 51 |
# ——— Load diffusion (Zero123) pipeline ———
|
| 52 |
print("Loading diffusion model …")
|
| 53 |
pipeline = DiffusionPipeline.from_pretrained(
|
| 54 |
"sudo-ai/zero123plus-v1.2",
|
| 55 |
custom_pipeline="zero123plus",
|
| 56 |
-
torch_dtype=
|
| 57 |
)
|
| 58 |
pipeline.scheduler = EulerAncestralDiscreteScheduler.from_config(
|
| 59 |
pipeline.scheduler.config, timestep_spacing='trailing'
|
|
|
|
| 46 |
# pick device
|
| 47 |
device = torch.device('cuda' if torch.cuda.is_available() else 'cpu')
|
| 48 |
if device.type == 'cpu':
|
| 49 |
+
print("⚠️ No CUDA GPU detected. Falling back to CPU (this will be very slow!)")
|
| 50 |
+
|
| 51 |
+
# choose torch dtype: float16 on GPU, float32 on CPU
|
| 52 |
+
torch_dtype = torch.float16 if device.type == 'cuda' else torch.float32
|
| 53 |
|
| 54 |
# ——— Load diffusion (Zero123) pipeline ———
|
| 55 |
print("Loading diffusion model …")
|
| 56 |
pipeline = DiffusionPipeline.from_pretrained(
|
| 57 |
"sudo-ai/zero123plus-v1.2",
|
| 58 |
custom_pipeline="zero123plus",
|
| 59 |
+
torch_dtype=torch_dtype,
|
| 60 |
)
|
| 61 |
pipeline.scheduler = EulerAncestralDiscreteScheduler.from_config(
|
| 62 |
pipeline.scheduler.config, timestep_spacing='trailing'
|
requirements.txt
CHANGED
|
@@ -1,6 +1,6 @@
|
|
| 1 |
-
torch
|
| 2 |
-
torchvision
|
| 3 |
-
torchaudio
|
| 4 |
pytorch-lightning==2.1.2
|
| 5 |
einops
|
| 6 |
omegaconf
|
|
|
|
| 1 |
+
torch
|
| 2 |
+
torchvision
|
| 3 |
+
torchaudio
|
| 4 |
pytorch-lightning==2.1.2
|
| 5 |
einops
|
| 6 |
omegaconf
|