NIRVANALAN commited on
Commit
b1f02f8
β€’
1 Parent(s): 97996d9

update dep

Browse files
Files changed (1) hide show
  1. app.py +55 -50
app.py CHANGED
@@ -32,56 +32,6 @@ import numpy as np
32
  import torch as th
33
  import torch.distributed as dist
34
 
35
- def install_dependency():
36
- # install full cuda first
37
- subprocess.run(
38
- f'conda install -c nvidia cuda-nvcc',
39
- shell=True
40
- )
41
-
42
- # install apex
43
- subprocess.run(
44
- f'TORCH_CUDA_ARCH_LIST="compute capability" FORCE_CUDA=1 {sys.executable} -m pip install -v --disable-pip-version-check --no-cache-dir --no-build-isolation --config-settings "--build-option=--cpp_ext" --config-settings "--build-option=--cuda_ext" git+https://github.com/NVIDIA/apex.git@master',
45
- shell=True,
46
- )
47
-
48
- th.backends.cuda.matmul.allow_tf32 = True
49
- th.backends.cudnn.allow_tf32 = True
50
- th.backends.cudnn.enabled = True
51
-
52
- install_dependency()
53
-
54
- from guided_diffusion import dist_util, logger
55
- from guided_diffusion.script_util import (
56
- NUM_CLASSES,
57
- model_and_diffusion_defaults,
58
- create_model_and_diffusion,
59
- add_dict_to_argparser,
60
- args_to_dict,
61
- continuous_diffusion_defaults,
62
- control_net_defaults,
63
- )
64
-
65
- from pathlib import Path
66
-
67
- from tqdm import tqdm, trange
68
- import dnnlib
69
- from nsr.train_util_diffusion import TrainLoop3DDiffusion as TrainLoop
70
- from guided_diffusion.continuous_diffusion import make_diffusion as make_sde_diffusion
71
- import nsr
72
- import nsr.lsgm
73
- from nsr.script_util import create_3DAE_model, encoder_and_nsr_defaults, loss_defaults, AE_with_Diffusion, rendering_options_defaults, eg3d_options_default, dataset_defaults
74
-
75
- from datasets.shapenet import load_eval_data
76
- from torch.utils.data import Subset
77
- from datasets.eg3d_dataset import init_dataset_kwargs
78
-
79
- from transport.train_utils import parse_transport_args
80
-
81
- from utils.infer_utils import remove_background, resize_foreground
82
-
83
- SEED = 0
84
-
85
 
86
  def resize_to_224(img):
87
  img = transforms.functional.resize(img, 224,
@@ -477,6 +427,61 @@ if __name__ == "__main__":
477
 
478
  @spaces.GPU
479
  def greet(n):
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
480
  print(zero.device) # <-- 'cuda:0' πŸ€—
481
  return f"Hello {zero + n} Tensor"
482
 
 
32
  import torch as th
33
  import torch.distributed as dist
34
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
35
 
36
  def resize_to_224(img):
37
  img = transforms.functional.resize(img, 224,
 
427
 
428
  @spaces.GPU
429
  def greet(n):
430
+
431
+ def install_dependency():
432
+ # install full cuda first
433
+ # subprocess.run(
434
+ # f'conda install -c nvidia cuda-nvcc',
435
+ # shell=True
436
+ # )
437
+
438
+ # install apex
439
+ subprocess.run(
440
+ f'TORCH_CUDA_ARCH_LIST="compute capability" FORCE_CUDA=1 {sys.executable} -m pip install -v --disable-pip-version-check --no-cache-dir --no-build-isolation --config-settings "--build-option=--cpp_ext" --config-settings "--build-option=--cuda_ext" git+https://github.com/NVIDIA/apex.git@master',
441
+ shell=True,
442
+ )
443
+
444
+ th.backends.cuda.matmul.allow_tf32 = True
445
+ th.backends.cudnn.allow_tf32 = True
446
+ th.backends.cudnn.enabled = True
447
+
448
+ install_dependency()
449
+
450
+ from guided_diffusion import dist_util, logger
451
+ from guided_diffusion.script_util import (
452
+ NUM_CLASSES,
453
+ model_and_diffusion_defaults,
454
+ create_model_and_diffusion,
455
+ add_dict_to_argparser,
456
+ args_to_dict,
457
+ continuous_diffusion_defaults,
458
+ control_net_defaults,
459
+ )
460
+
461
+ from pathlib import Path
462
+
463
+ from tqdm import tqdm, trange
464
+ import dnnlib
465
+ from nsr.train_util_diffusion import TrainLoop3DDiffusion as TrainLoop
466
+ from guided_diffusion.continuous_diffusion import make_diffusion as make_sde_diffusion
467
+ import nsr
468
+ import nsr.lsgm
469
+ from nsr.script_util import create_3DAE_model, encoder_and_nsr_defaults, loss_defaults, AE_with_Diffusion, rendering_options_defaults, eg3d_options_default, dataset_defaults
470
+
471
+ from datasets.shapenet import load_eval_data
472
+ from torch.utils.data import Subset
473
+ from datasets.eg3d_dataset import init_dataset_kwargs
474
+
475
+ from transport.train_utils import parse_transport_args
476
+
477
+ from utils.infer_utils import remove_background, resize_foreground
478
+
479
+ SEED = 0
480
+
481
+
482
+
483
+
484
+
485
  print(zero.device) # <-- 'cuda:0' πŸ€—
486
  return f"Hello {zero + n} Tensor"
487