wyysf commited on
Commit
d3516a7
1 Parent(s): c459ff0
apps/__pycache__/mv_models.cpython-38.pyc CHANGED
Binary files a/apps/__pycache__/mv_models.cpython-38.pyc and b/apps/__pycache__/mv_models.cpython-38.pyc differ
 
apps/mv_models.py CHANGED
@@ -19,36 +19,6 @@ from huggingface_hub import hf_hub_download
19
 
20
  parent_dir = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
21
 
22
-
23
- @dataclass
24
- class TestConfig:
25
- pretrained_model_name_or_path: str
26
- pretrained_unet_path: str
27
- revision: Optional[str]
28
- validation_dataset: Dict
29
- save_dir: str
30
- seed: Optional[int]
31
- validation_batch_size: int
32
- dataloader_num_workers: int
33
-
34
- local_rank: int
35
-
36
- pipe_kwargs: Dict
37
- pipe_validation_kwargs: Dict
38
- unet_from_pretrained_kwargs: Dict
39
- validation_guidance_scales: List[float]
40
- validation_grid_nrow: int
41
- camera_embedding_lr_mult: float
42
-
43
- num_views: int
44
- camera_embedding_type: str
45
-
46
- pred_type: str # joint, or ablation
47
-
48
- enable_xformers_memory_efficient_attention: bool
49
-
50
- cond_on_normals: bool
51
- cond_on_colors: bool
52
 
53
  class GenMVImage(object):
54
  def __init__(self, device):
@@ -59,9 +29,7 @@ class GenMVImage(object):
59
  self.device = device
60
 
61
  def gen_image_from_crm(self, image):
62
-
63
  from .third_party.CRM.pipelines import TwoStagePipeline
64
- specs = json.load(open(f"{parent_dir}/apps/third_party/CRM/configs/specs_objaverse_total.json"))
65
  stage1_config = OmegaConf.load(f"{parent_dir}/apps/third_party/CRM/configs/nf7_v3_SNR_rd_size_stroke.yaml").config
66
  stage1_sampler_config = stage1_config.sampler
67
  stage1_model_config = stage1_config.models
@@ -127,6 +95,7 @@ class GenMVImage(object):
127
  return mv_imgs[1], mv_imgs[2], mv_imgs[3], mv_imgs[0]
128
 
129
  def gen_image_from_wonder3d(self, image, crop_size):
 
130
  from diffusers import DiffusionPipeline # only tested on diffusers[torch]==0.19.3, may have conflicts with newer versions of diffusers
131
 
132
  weight_dtype = torch.float16
@@ -136,9 +105,9 @@ class GenMVImage(object):
136
  pipeline = self.pipelines['wonder3d']
137
  else:
138
  self.pipelines['wonder3d'] = DiffusionPipeline.from_pretrained(
139
- 'flamehaze1115/wonder3d-v1.0', # or use local checkpoint './ckpts'
140
- custom_pipeline='flamehaze1115/wonder3d-pipeline',
141
- torch_dtype=torch.float16
142
  )
143
  self.pipelines['wonder3d'].unet.enable_xformers_memory_efficient_attention()
144
  self.pipelines['wonder3d'].to(self.device)
 
19
 
20
  parent_dir = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
21
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
22
 
23
  class GenMVImage(object):
24
  def __init__(self, device):
 
29
  self.device = device
30
 
31
  def gen_image_from_crm(self, image):
 
32
  from .third_party.CRM.pipelines import TwoStagePipeline
 
33
  stage1_config = OmegaConf.load(f"{parent_dir}/apps/third_party/CRM/configs/nf7_v3_SNR_rd_size_stroke.yaml").config
34
  stage1_sampler_config = stage1_config.sampler
35
  stage1_model_config = stage1_config.models
 
95
  return mv_imgs[1], mv_imgs[2], mv_imgs[3], mv_imgs[0]
96
 
97
  def gen_image_from_wonder3d(self, image, crop_size):
98
+ sys.path.append(f"{parent_dir}/apps/third_party/Wonder3D")
99
  from diffusers import DiffusionPipeline # only tested on diffusers[torch]==0.19.3, may have conflicts with newer versions of diffusers
100
 
101
  weight_dtype = torch.float16
 
105
  pipeline = self.pipelines['wonder3d']
106
  else:
107
  self.pipelines['wonder3d'] = DiffusionPipeline.from_pretrained(
108
+ 'flamehaze1115/wonder3d-v1.0', # or use local checkpoint './ckpts'
109
+ custom_pipeline='flamehaze1115/wonder3d-pipeline',
110
+ torch_dtype=torch.float16
111
  )
112
  self.pipelines['wonder3d'].unet.enable_xformers_memory_efficient_attention()
113
  self.pipelines['wonder3d'].to(self.device)