Skip to content

Commit d6ca4b8

Browse files
committed
Minor bug fixes
1 parent a0d0a40 commit d6ca4b8

5 files changed

Lines changed: 39 additions & 25 deletions

File tree

FlowStateLatentChooser.py

Lines changed: 30 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -137,28 +137,41 @@ def create_latent(self, model_type, resolution, orientation, latent_type, image,
137137
print(f'\n\n\nFlowState Latent Chooser - {model_type}')
138138

139139
selected_model = model_type if isinstance(model_type, str) else model_type[0]
140+
loaded_latent, loaded_img = self.load_and_encode(image, vae)
141+
142+
using_custom = resolution == 'custom'
143+
horizontal_img = orientation == 'horizontal'
144+
using_empty = latent_type == 'empty_latent'
145+
using_input = latent_type == 'input_img'
146+
have_pixels = pixels != None
147+
148+
width_to_use = loaded_img.shape[2]
149+
height_to_use = loaded_img.shape[1]
150+
res = None
151+
res_split = None
152+
153+
if using_custom and using_empty:
154+
width_to_use = custom_width
155+
height_to_use = custom_height
156+
157+
if not using_custom and using_empty:
158+
res_split = res.split(' - ')[0].split('x')
159+
width_to_use = int(res_split[0]) if horizontal_img else int(res_split[1])
160+
height_to_use = int(res_split[1]) if horizontal_img else int(res_split[0])
161+
162+
if using_input and have_pixels:
163+
width_to_use = pixels.shape[2]
164+
height_to_use = pixels.shape[1]
140165

141166
if latent_type == 'empty_latent':
142167
print(f' - Preparing empty latent.\n')
143-
using_custom = resolution == 'custom'
144-
horizontal_img = orientation == 'horizontal'
145-
aspect_split = resolution.split(' - ')[0].split('x')
146-
aspect_w = int(aspect_split[0])
147-
aspect_h = int(aspect_split[1])
148-
width_to_use = custom_width if using_custom else (aspect_w if horizontal_img else aspect_h)
149-
height_to_use = custom_height if using_custom else (aspect_h if horizontal_img else aspect_w)
150-
latent = self.generate(width_to_use, height_to_use, selected_model)
151-
return ({'samples':latent}, vae, image, width_to_use, height_to_use, )
168+
generated_latent = self.generate(width_to_use, height_to_use, selected_model)
169+
return ({'samples': generated_latent}, vae, loaded_img, width_to_use, height_to_use, )
152170
elif latent_type == 'input_img':
153171
print(f' - Preparing latent from input image.')
154-
latent = vae.encode(pixels[:,:,:,:3])
155-
img_width = pixels.shape[2]
156-
img_height = pixels.shape[1]
157-
return ({'samples':latent}, vae, pixels, img_width, img_height, )
172+
input_latent = vae.encode(pixels[:,:,:,:3])
173+
return ({'samples': input_latent}, vae, pixels, width_to_use, height_to_use, )
158174
else:
159175
print(f' - Preparing latent from imported image.')
160-
latent, loaded_img = self.load_and_encode(image, vae)
161-
img_width = loaded_img.shape[2]
162-
img_height = loaded_img.shape[1]
163-
return ({'samples':latent}, vae, loaded_img, img_width, img_height, )
176+
return ({'samples': loaded_latent}, vae, loaded_img, width_to_use, height_to_use, )
164177

FlowStateUnifiedStyler.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -267,15 +267,15 @@ def apply_style(self,
267267

268268
styler_duration, styler_mins, styler_secs = get_mins_and_secs(start_time)
269269

270-
# model_mem_sizes = [ m.size for m in styler_out[0] ]
271-
# kb = [ round(mem / 1024, 2) for mem in model_mem_sizes ]
272-
# mb = [ round(mem / 1024, 2) for mem in kb ]
273-
# gb = [ round(mem / 1024, 2) for mem in mb ]
270+
model_mem_sizes = [ m.size for m in styler_out[0] ]
271+
kb = [ round(mem / 1024, 2) for mem in model_mem_sizes ]
272+
mb = [ round(mem / 1024, 2) for mem in kb ]
273+
gb = [ round(mem / 1024, 2) for mem in mb ]
274274

275275
print(
276276
f'\n\n\nFlowState Unified Styler - Styling generation complete.'
277277
f'\n - Styling Time: {styler_mins}m {styler_secs}s'
278-
# f'\n - Model Sizes (bytes): {model_mem_sizes}'
278+
# f'\n - Model Sizes (bytes): {image}'
279279
# f'\n - Model Sizes (kb): {kb}'
280280
# f'\n - Model Sizes (mb): {mb}'
281281
# f'\n - Model Sizes (gb): {gb}'

README.md

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -57,15 +57,16 @@ COMING SOON: Install through the ComfyUI Custom Node Manager!
5757
<br/><br/>
5858

5959

60-
# LATEST PUSH 10/29/24 - 11:15 am (GMT-5) #
60+
# 1.1.2 RELEASE (LATEST) 10/29/24 - 1:30 pm (GMT-5) #
6161

6262
## Updates
6363
* Introduction of orientation selector
6464
* Fixed "unload_loras" bug
6565
* Converted static model directories to dynamic, so no restart required when downloading new models or changing filenames
66+
* Fixed issue with custom resolution inputs
6667

6768

68-
# PUSH 10/27/24 - 3:00 pm (GMT-5) #
69+
# 1.1.0 RELEASE 10/27/24 - 3:00 pm (GMT-5) #
6970

7071
## Updates
7172
* Video Sampler node is available but still experimental
300 KB
Loading

pyproject.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
[project]
22
name = "flowstate-nodes"
33
description = "A collection of custom nodes to consolidate functionality of many other nodes, enable unified workflows, and add custom functionality you won't find with other nodes."
4-
version = "1.1.1"
4+
version = "1.1.2"
55
license = {file = "LICENSE"}
66
dependencies = [
77
"transformers>=4.0.0",

0 commit comments

Comments
 (0)