Small fix & Update example workflow for LGM

This commit is contained in:
MrForExample
2024-02-09 14:43:46 +01:00
parent 86a06f9ac7
commit cac29f93ab
5 changed files with 246 additions and 300 deletions
+1 -1
View File
@@ -155,7 +155,7 @@ install.bat
If you have already installed ComfyUI on Windows with embed python environment and you don't want to switch to Miniconda/Conda and reinstall all your packages <br>
*(Which is ideal, but unfortunately so far it seems I'm not experienced enough in this matter, but I'll continue to looking for the better solutions and please give me some suggestions if ou know better, thanks :)*
According to [@doctorpangloss](https://github.com/MrForExample/ComfyUI-3D-Pack/issues/5), you can setup the c++/cuda build environments in windows by running following command:
According to [@doctorpangloss](https://github.com/MrForExample/ComfyUI-3D-Pack/issues/5), you can setup the c++/cuda build environments in windows by using [chocolatey](https://chocolatey.org/) with following command:
```bash
# using git bash for the sake of simplicity
# enable developer mode
@@ -1,60 +1,7 @@
{
"last_node_id": 16,
"last_link_id": 18,
"last_node_id": 17,
"last_link_id": 22,
"nodes": [
{
"id": 3,
"type": "[Comfy3D] MVDream Model",
"pos": [
792,
460
],
"size": {
"0": 405.5999755859375,
"1": 238
},
"flags": {},
"order": 5,
"mode": 0,
"inputs": [
{
"name": "mvdream_pipe",
"type": "DIFFUSERS_PIPE",
"link": 1
},
{
"name": "reference_image",
"type": "IMAGE",
"link": 2
},
{
"name": "reference_mask",
"type": "MASK",
"link": 5
}
],
"outputs": [
{
"name": "multiview_images",
"type": "IMAGE",
"links": [
6
],
"shape": 3,
"slot_index": 0
}
],
"properties": {
"Node name for S&R": "[Comfy3D] MVDream Model"
},
"widgets_values": [
"",
"ugly, blurry, pixelated obscure, unnatural colors, poor lighting, dull, unclear, cropped, lowres, low quality, artifacts, duplicate",
5,
30,
0
]
},
{
"id": 4,
"type": "LoadImage",
@@ -97,76 +44,6 @@
"image"
]
},
{
"id": 5,
"type": "InvertMask",
"pos": [
539,
689
],
"size": {
"0": 210,
"1": 26
},
"flags": {},
"order": 3,
"mode": 0,
"inputs": [
{
"name": "mask",
"type": "MASK",
"link": 3
}
],
"outputs": [
{
"name": "MASK",
"type": "MASK",
"links": [
5
],
"shape": 3,
"slot_index": 0
}
],
"properties": {
"Node name for S&R": "InvertMask"
}
},
{
"id": 2,
"type": "[Comfy3D] Load Diffusers Pipeline",
"pos": [
381,
319
],
"size": {
"0": 375.3948669433594,
"1": 83.33004760742188
},
"flags": {},
"order": 1,
"mode": 0,
"outputs": [
{
"name": "pipe",
"type": "DIFFUSERS_PIPE",
"links": [
1,
8
],
"shape": 3,
"slot_index": 0
}
],
"properties": {
"Node name for S&R": "[Comfy3D] Load Diffusers Pipeline"
},
"widgets_values": [
"MVDreamPipeline",
"ashawkey/imagedream-ipmv-diffusers"
]
},
{
"id": 12,
"type": "[Comfy3D] Switch 3DGS Axis",
@@ -179,13 +56,13 @@
"1": 106
},
"flags": {},
"order": 7,
"order": 6,
"mode": 0,
"inputs": [
{
"name": "gs_ply",
"type": "GS_PLY",
"link": 12
"link": 19
}
],
"outputs": [
@@ -208,42 +85,6 @@
"-z"
]
},
{
"id": 8,
"type": "Reroute",
"pos": [
1150,
319
],
"size": [
75,
26
],
"flags": {},
"order": 4,
"mode": 0,
"inputs": [
{
"name": "",
"type": "*",
"link": 8
}
],
"outputs": [
{
"name": "",
"type": "DIFFUSERS_PIPE",
"links": [
9
],
"slot_index": 0
}
],
"properties": {
"showOutputText": false,
"horizontal": false
}
},
{
"id": 9,
"type": "[Comfy3D] Save 3DGS",
@@ -256,7 +97,7 @@
"1": 58
},
"flags": {},
"order": 9,
"order": 8,
"mode": 0,
"inputs": [
{
@@ -295,7 +136,7 @@
500
],
"flags": {},
"order": 11,
"order": 10,
"mode": 0,
"inputs": [
{
@@ -315,86 +156,6 @@
null
]
},
{
"id": 1,
"type": "[Comfy3D] Load Large Multiview Gaussian Model",
"pos": [
879,
752
],
"size": {
"0": 315,
"1": 82
},
"flags": {},
"order": 2,
"mode": 0,
"outputs": [
{
"name": "lgm_model",
"type": "LGM_MODEL",
"links": [
7
],
"shape": 3,
"slot_index": 0
}
],
"properties": {
"Node name for S&R": "[Comfy3D] Load Large Multiview Gaussian Model"
},
"widgets_values": [
"model_fp16.safetensors",
"big"
]
},
{
"id": 7,
"type": "[Comfy3D] Large Multiview Gaussian Model",
"pos": [
1270,
460
],
"size": {
"0": 252,
"1": 66
},
"flags": {},
"order": 6,
"mode": 0,
"inputs": [
{
"name": "multiview_images",
"type": "IMAGE",
"link": 6
},
{
"name": "lgm_model",
"type": "LGM_MODEL",
"link": 7
},
{
"name": "mvdream_pipe",
"type": "DIFFUSERS_PIPE",
"link": 9
}
],
"outputs": [
{
"name": "gs_ply",
"type": "GS_PLY",
"links": [
12,
18
],
"shape": 3,
"slot_index": 0
}
],
"properties": {
"Node name for S&R": "[Comfy3D] Large Multiview Gaussian Model"
}
},
{
"id": 15,
"type": "[Comfy3D] Preview 3DMesh",
@@ -407,7 +168,7 @@
500
],
"flags": {},
"order": 12,
"order": 11,
"mode": 0,
"inputs": [
{
@@ -434,18 +195,18 @@
1550,
224
],
"size": [
411.6000061035156,
65.46688079833984
],
"size": {
"0": 411.6000061035156,
"1": 65.46688079833984
},
"flags": {},
"order": 8,
"order": 7,
"mode": 0,
"inputs": [
{
"name": "gs_ply",
"type": "GS_PLY",
"link": 18
"link": 20
}
],
"outputs": [
@@ -478,7 +239,7 @@
"1": 60.248291015625
},
"flags": {},
"order": 10,
"order": 9,
"mode": 0,
"inputs": [
{
@@ -504,6 +265,203 @@
"widgets_values": [
"LGMTest/FatCat.obj"
]
},
{
"id": 17,
"type": "[Comfy3D] Large Multiview Gaussian Model",
"pos": [
1270,
461
],
"size": [
252,
46
],
"flags": {},
"order": 5,
"mode": 0,
"inputs": [
{
"name": "multiview_images",
"type": "IMAGE",
"link": 21
},
{
"name": "lgm_model",
"type": "LGM_MODEL",
"link": 22
}
],
"outputs": [
{
"name": "gs_ply",
"type": "GS_PLY",
"links": [
19,
20
],
"shape": 3,
"slot_index": 0
}
],
"properties": {
"Node name for S&R": "[Comfy3D] Large Multiview Gaussian Model"
}
},
{
"id": 3,
"type": "[Comfy3D] MVDream Model",
"pos": [
792,
460
],
"size": {
"0": 405.5999755859375,
"1": 238
},
"flags": {},
"order": 4,
"mode": 0,
"inputs": [
{
"name": "mvdream_pipe",
"type": "DIFFUSERS_PIPE",
"link": 1
},
{
"name": "reference_image",
"type": "IMAGE",
"link": 2
},
{
"name": "reference_mask",
"type": "MASK",
"link": 5
}
],
"outputs": [
{
"name": "multiview_images",
"type": "IMAGE",
"links": [
21
],
"shape": 3,
"slot_index": 0
}
],
"properties": {
"Node name for S&R": "[Comfy3D] MVDream Model"
},
"widgets_values": [
"",
"ugly, blurry, pixelated obscure, unnatural colors, poor lighting, dull, unclear, cropped, lowres, low quality, artifacts, duplicate",
5,
30,
0
]
},
{
"id": 1,
"type": "[Comfy3D] Load Large Multiview Gaussian Model",
"pos": [
879,
752
],
"size": {
"0": 315,
"1": 82
},
"flags": {},
"order": 1,
"mode": 0,
"outputs": [
{
"name": "lgm_model",
"type": "LGM_MODEL",
"links": [
22
],
"shape": 3,
"slot_index": 0
}
],
"properties": {
"Node name for S&R": "[Comfy3D] Load Large Multiview Gaussian Model"
},
"widgets_values": [
"model_fp16.safetensors",
"big"
]
},
{
"id": 5,
"type": "InvertMask",
"pos": [
542,
545
],
"size": {
"0": 210,
"1": 26
},
"flags": {},
"order": 3,
"mode": 0,
"inputs": [
{
"name": "mask",
"type": "MASK",
"link": 3
}
],
"outputs": [
{
"name": "MASK",
"type": "MASK",
"links": [
5
],
"shape": 3,
"slot_index": 0
}
],
"properties": {
"Node name for S&R": "InvertMask"
}
},
{
"id": 2,
"type": "[Comfy3D] Load Diffusers Pipeline",
"pos": [
380,
345
],
"size": {
"0": 375.3948669433594,
"1": 83.33004760742188
},
"flags": {},
"order": 2,
"mode": 0,
"outputs": [
{
"name": "pipe",
"type": "DIFFUSERS_PIPE",
"links": [
1
],
"shape": 3,
"slot_index": 0
}
],
"properties": {
"Node name for S&R": "[Comfy3D] Load Diffusers Pipeline"
},
"widgets_values": [
"MVDreamPipeline",
"ashawkey/imagedream-ipmv-diffusers"
]
}
],
"links": [
@@ -539,38 +497,6 @@
2,
"MASK"
],
[
6,
3,
0,
7,
0,
"IMAGE"
],
[
7,
1,
0,
7,
1,
"LGM_MODEL"
],
[
8,
2,
0,
8,
0,
"*"
],
[
9,
8,
0,
7,
2,
"DIFFUSERS_PIPE"
],
[
11,
9,
@@ -579,14 +505,6 @@
0,
"STRING"
],
[
12,
7,
0,
12,
0,
"GS_PLY"
],
[
13,
12,
@@ -612,12 +530,36 @@
"MESH"
],
[
18,
7,
19,
17,
0,
12,
0,
"GS_PLY"
],
[
20,
17,
0,
16,
0,
"GS_PLY"
],
[
21,
3,
0,
17,
0,
"IMAGE"
],
[
22,
1,
0,
17,
1,
"LGM_MODEL"
]
],
"groups": [],
+2
View File
@@ -10,6 +10,8 @@ if exist "%python_miniconda_exec%" (
echo Installing with Miniconda Environment
"%python_miniconda_exec%" -s -m pip install -r "%requirements_txt%"
"%python_miniconda_exec%" -s -m pip install -U xformers --index-url https://download.pytorch.org/whl/cu121
set "python_miniconda_exec=..\..\..\..\..\..\..\python_miniconda_env\ComfyUI\python.exe"
cd tgs/models/snowflake/pointnet2_ops_lib && "%python_miniconda_exec%" -s setup.py install && cd ../../../../
+1 -2
View File
@@ -1259,7 +1259,6 @@ class Large_Multiview_Gaussian_Model:
"required": {
"multiview_images": ("IMAGE", ),
"lgm_model": ("LGM_MODEL", ),
"mvdream_pipe": ("DIFFUSERS_PIPE",),
},
}
@@ -1274,7 +1273,7 @@ class Large_Multiview_Gaussian_Model:
CATEGORY = "Comfy3D/Algorithm"
@torch.no_grad()
def run_LGM(self, multiview_images, lgm_model, mvdream_pipe):
def run_LGM(self, multiview_images, lgm_model):
device = "cuda"
ref_image_torch = prepare_torch_img(multiview_images, lgm_model.opt.input_size, lgm_model.opt.input_size, device) # [4, 3, 256, 256]
ref_image_torch = TF.normalize(ref_image_torch, IMAGENET_DEFAULT_MEAN, IMAGENET_DEFAULT_STD)
+5 -2
View File
@@ -1,6 +1,6 @@
import os
from os import listdir
from os.path import isfile, join
from os.path import isfile, join, exists
import sys
from datetime import datetime
@@ -119,4 +119,7 @@ def parse_save_filename(save_path, output_directory, supported_extensions, class
# Get all files in a folder, if extension_filter is provided then only reture the files with extensions in extension_filter
def get_list_filenames(directory, extension_filter=None):
return [f for f in listdir(directory) if isfile(join(directory, f)) and (extension_filter is None or f.lower().endswith(extension_filter))]
if exists(directory):
return [f for f in listdir(directory) if isfile(join(directory, f)) and (extension_filter is None or f.lower().endswith(extension_filter))]
else:
return []