diff --git a/.gitignore b/.gitignore index 520190e43..2257a29da 100644 --- a/.gitignore +++ b/.gitignore @@ -29,4 +29,5 @@ models custom_nodes models/ flux_loras/ -custom_nodes/ \ No newline at end of file +custom_nodes/ +pysssss-workflows/ \ No newline at end of file diff --git a/execution.py b/execution.py index afeb855a5..ee99345e1 100644 --- a/execution.py +++ b/execution.py @@ -534,7 +534,7 @@ class PromptExecutor: execution_list.complete_node_execution() else: # Only execute when the while-loop ends without break - self.add_message("execution_success", { "prompt_id": prompt_id, 'ws_id': self.memedeck_worker.ws_id }, broadcast=False) + self.add_message("execution_success", { "prompt_id": prompt_id }, broadcast=False) ui_outputs = {} meta_outputs = {} diff --git a/main.py b/main.py index 24f3d7a48..3a3985647 100644 --- a/main.py +++ b/main.py @@ -58,8 +58,8 @@ def apply_custom_paths(): # --------------------------------------------------------------------------------------- from memedeck import MemedeckWorker -import sys -sys.stdout = open(os.devnull, 'w') # disable all print statements +# import sys +# sys.stdout = open(os.devnull, 'w') # disable all print statements # --------------------------------------------------------------------------------------- def execute_prestartup_script(): diff --git a/memedeck.py b/memedeck.py index 7a9db7663..d4c8e3c89 100644 --- a/memedeck.py +++ b/memedeck.py @@ -55,6 +55,7 @@ class MemedeckWorker: self.loop = loop self.messages = asyncio.Queue() + self.ws_id = None self.http_client = None self.prompt_queue = None self.validate_prompt = None @@ -87,6 +88,9 @@ class MemedeckWorker: self.channel.basic_qos(prefetch_size=0, prefetch_count=1) self.channel.queue_declare(queue=self.queue_name, durable=True) self.channel.basic_consume(queue=self.queue_name, on_message_callback=self.on_message_received, auto_ack=False) + # declare another queue + self.channel.queue_declare(queue='faceswap-queue', durable=True) + self.channel.basic_consume(queue='faceswap-queue', on_message_callback=self.on_message_received, auto_ack=False) def start(self, prompt_queue, validate_prompt): self.prompt_queue = prompt_queue @@ -117,7 +121,11 @@ class MemedeckWorker: # Prepare task_info prompt_id = str(uuid.uuid4()) outputs_to_execute = valid[2] + # get the routing key from the method + routing_key = method.routing_key + self.logger.info(f"[memedeck]: routing_key: {routing_key}") task_info = { + "workflow": 'faceswap' if routing_key == 'faceswap-queue' else 'generation', "prompt_id": prompt_id, "prompt": prompt, "outputs_to_execute": outputs_to_execute, @@ -141,7 +149,7 @@ class MemedeckWorker: if valid[0]: # Enqueue the task into the internal job queue self.loop.call_soon_threadsafe(self.internal_job_queue.put_nowait, (prompt_id, prompt, task_info)) - self.logger.info(f"[memedeck]: Enqueued task for {task_info['ws_id']}") + # self.logger.info(f"[memedeck]: Enqueued task for {task_info['ws_id']}") else: channel.basic_nack(delivery_tag=method.delivery_tag, requeue=False) # unack the message @@ -163,11 +171,14 @@ class MemedeckWorker: 'ws_id': task_info['ws_id'], 'context': task_info['context'] }, task_info['outputs_to_execute'])) + # Acknowledge the message - self.channel.basic_ack(delivery_tag=task_info["delivery_tag"]) # ack the task - self.logger.info(f"[memedeck]: Acked task {prompt_id} {ws_id}") + self.channel.basic_ack(delivery_tag=task_info["delivery_tag"]) # ack the task + + if 'faceswap_strength' not in task_info['context']['prompt_config']: + # pretty print the prompt config + self.logger.info(f"[memedeck]: prompt: {task_info['context']['prompt_config']['character']['id']} {task_info['context']['prompt_config']['positive_prompt']}") - self.logger.info(f"[memedeck]: Started processing prompt {prompt_id}") # Wait until the current task is completed await self.wait_for_task_completion(ws_id) # Task is done @@ -219,12 +230,22 @@ class MemedeckWorker: data, sid=sid, progress=task['current_progress'], - context=task['context'] + context=task['context'], + workflow=task['workflow'] ) else: # Send JSON data / text data if event == "executing": task['current_node'] = data['node'] + if task['workflow'] == 'faceswap' and task["task_status"] == "waiting": + start_data = { + "ws_id": task['ws_id'], + "status": "started", + "info": None, + } + await self.send_to_api(start_data) + + # self.logger.info(f"[memedeck]: faceswap executing: {data}") task["task_status"] = "executing" elif event == "progress": if task['current_node'] == task['websocket_node_id']: @@ -253,7 +274,7 @@ class MemedeckWorker: # Update the task in tasks_by_ws_id self.tasks_by_ws_id[sid] = task - async def send_preview(self, image_data, sid=None, progress=None, context=None): + async def send_preview(self, image_data, sid=None, progress=None, context=None, workflow=None): if sid is None: self.logger.warning("Received preview without sid") return @@ -284,20 +305,29 @@ class MemedeckWorker: bytesIO = BytesIO() image.save(bytesIO, format=image_type, quality=100 if progress == 95 else 75, compress_level=1) preview_bytes = bytesIO.getvalue() - + + kind = "image_generating" if progress < 100 else "image_generated" + ai_queue_progress = { "ws_id": sid, - "kind": "image_generating" if progress < 100 else "image_generated", + "kind": kind, "data": list(preview_bytes), "progress": int(progress), "context": context } - + + # set the kind to faceswap_generated if workflow is faceswap + if workflow == 'faceswap': + ai_queue_progress['kind'] = "faceswap_generated" + del ai_queue_progress['progress'] + # dont print the data field without deleting it + self.logger.info(f"[memedeck]: sending faceswap result") + await self.send_to_api(ai_queue_progress) - if progress == 100: + if progress == 100 or workflow == 'faceswap': del self.tasks_by_ws_id[sid] # Remove the task from tasks_by_ws_id - self.logger.info(f"[memedeck]: Task {sid} completed") + # self.logger.info(f"[memedeck]: Task {sid} completed") async def send_to_api(self, data): ws_id = data.get('ws_id') @@ -312,10 +342,11 @@ class MemedeckWorker: self.logger.error(f"[memedeck]: websocket_node_id is None for {ws_id}") return try: + # this request is not sending properly for faceswap post_func = partial(requests.post, f"{self.api_url}/generation/update", json=data) await self.loop.run_in_executor(None, post_func) except Exception as e: - self.logger.error(f"[memedeck]: error sending to api: {e}") + self.logger.info(f"[memedeck]: error sending to api: {e}") # -------------------------------------------------------------------------- # MemedeckAzureStorage diff --git a/pysssss-workflows/training.json b/pysssss-workflows/training.json deleted file mode 100644 index ba347d920..000000000 --- a/pysssss-workflows/training.json +++ /dev/null @@ -1 +0,0 @@ -{"last_node_id": 141, "last_link_id": 256, "nodes": [{"id": 82, "type": "SomethingToString", "pos": {"0": 3867.1982421875, "1": 867.84130859375}, "size": {"0": 315, "1": 82}, "flags": {"collapsed": true, "pinned": true}, "order": 53, "mode": 0, "inputs": [{"name": "input", "type": "*", "link": 234}], "outputs": [{"name": "STRING", "type": "STRING", "links": [121], "slot_index": 0, "shape": 3}], "properties": {"Node name for S&R": "SomethingToString"}, "widgets_values": ["steps ", ""]}, {"id": 83, "type": "AddLabel", "pos": {"0": 4088.1982421875, "1": 867.84130859375}, "size": {"0": 315, "1": 274}, "flags": {"collapsed": true, "pinned": true}, "order": 59, "mode": 0, "inputs": [{"name": "image", "type": "IMAGE", "link": 122}, {"name": "caption", "type": "STRING", "link": null, "widget": {"name": "caption"}}, {"name": "text", "type": "STRING", "link": 121, "widget": {"name": "text"}}], "outputs": [{"name": "IMAGE", "type": "IMAGE", "links": [204], "slot_index": 0, "shape": 3}], "properties": {"Node name for S&R": "AddLabel"}, "widgets_values": [10, 2, 48, 32, "white", "black", "FreeMono.ttf", "Text", "up", ""]}, {"id": 4, "type": "FluxTrainLoop", "pos": {"0": 1416.79443359375, "1": -104.92213439941406}, "size": {"0": 393, "1": 78}, "flags": {"pinned": true}, "order": 31, "mode": 0, "inputs": [{"name": "network_trainer", "type": "NETWORKTRAINER", "link": 181}], "outputs": [{"name": "network_trainer", "type": "NETWORKTRAINER", "links": [162, 218], "slot_index": 0, "shape": 3}, {"name": "steps", "type": "INT", "links": [220], "slot_index": 1, "shape": 3}], "properties": {"Node name for S&R": "FluxTrainLoop"}, "widgets_values": [250], "color": "#232", "bgcolor": "#353"}, {"id": 79, "type": "SomethingToString", "pos": {"0": 1777.79443359375, "1": 857.0768432617188}, "size": {"0": 315, "1": 82}, "flags": {"collapsed": true, "pinned": true}, "order": 36, "mode": 0, "inputs": [{"name": "input", "type": "*", "link": 220}], "outputs": [{"name": "STRING", "type": "STRING", "links": [111], "slot_index": 0, "shape": 3}], "properties": {"Node name for S&R": "SomethingToString"}, "widgets_values": ["steps ", ""]}, {"id": 44, "type": "FluxTrainLoop", "pos": {"0": 2567.5634765625, "1": -99.79415893554688}, "size": {"0": 361.21923828125, "1": 78}, "flags": {"pinned": true}, "order": 39, "mode": 0, "inputs": [{"name": "network_trainer", "type": "NETWORKTRAINER", "link": 219}], "outputs": [{"name": "network_trainer", "type": "NETWORKTRAINER", "links": [164, 222], "slot_index": 0, "shape": 3}, {"name": "steps", "type": "INT", "links": [235], "slot_index": 1, "shape": 3}], "properties": {"Node name for S&R": "FluxTrainLoop"}, "widgets_values": [250], "color": "#232", "bgcolor": "#353"}, {"id": 45, "type": "FluxTrainValidate", "pos": {"0": 3302.5634765625, "1": -104.79415893554688}, "size": {"0": 312.3999938964844, "1": 49.711063385009766}, "flags": {"pinned": true}, "order": 47, "mode": 0, "inputs": [{"name": "network_trainer", "type": "NETWORKTRAINER", "link": 227}, {"name": "validation_settings", "type": "VALSETTINGS", "link": 244}], "outputs": [{"name": "network_trainer", "type": "NETWORKTRAINER", "links": [223], "slot_index": 0, "shape": 3}, {"name": "validation_images", "type": "IMAGE", "links": [70, 119], "slot_index": 1, "shape": 3}], "properties": {"Node name for S&R": "FluxTrainValidate"}, "widgets_values": [], "color": "#232", "bgcolor": "#353"}, {"id": 62, "type": "FluxTrainSave", "pos": {"0": 4053.1982421875, "1": -111.1568374633789}, "size": {"0": 335.8072204589844, "1": 122}, "flags": {"pinned": true}, "order": 52, "mode": 0, "inputs": [{"name": "network_trainer", "type": "NETWORKTRAINER", "link": 224}], "outputs": [{"name": "network_trainer", "type": "NETWORKTRAINER", "links": [225], "slot_index": 0, "shape": 3}, {"name": "lora_path", "type": "STRING", "links": null, "shape": 3}, {"name": "steps", "type": "INT", "links": [], "slot_index": 2, "shape": 3}], "properties": {"Node name for S&R": "FluxTrainSave"}, "widgets_values": [true, false], "color": "#232", "bgcolor": "#353"}, {"id": 60, "type": "FluxTrainValidate", "pos": {"0": 4404.1982421875, "1": -109.1568374633789}, "size": {"0": 312.3999938964844, "1": 55.36396026611328}, "flags": {"pinned": true}, "order": 56, "mode": 0, "inputs": [{"name": "network_trainer", "type": "NETWORKTRAINER", "link": 225}, {"name": "validation_settings", "type": "VALSETTINGS", "link": 245}], "outputs": [{"name": "network_trainer", "type": "NETWORKTRAINER", "links": [226], "slot_index": 0, "shape": 3}, {"name": "validation_images", "type": "IMAGE", "links": [90, 122], "slot_index": 1, "shape": 3}], "properties": {"Node name for S&R": "FluxTrainValidate"}, "widgets_values": [], "color": "#232", "bgcolor": "#353"}, {"id": 61, "type": "PreviewImage", "pos": {"0": 3652.1982421875, "1": 91.84286499023438}, "size": {"0": 1064.4329833984375, "1": 704.880615234375}, "flags": {"pinned": true}, "order": 58, "mode": 0, "inputs": [{"name": "images", "type": "IMAGE", "link": 90}], "outputs": [], "properties": {"Node name for S&R": "PreviewImage"}, "widgets_values": [], "color": "#2a363b", "bgcolor": "#3f5159"}, {"id": 70, "type": "VisualizeLoss", "pos": {"0": 4950.255859375, "1": 946.3529663085938}, "size": {"0": 254.40000915527344, "1": 198}, "flags": {"pinned": true}, "order": 64, "mode": 0, "inputs": [{"name": "network_trainer", "type": "NETWORKTRAINER", "link": 217}], "outputs": [{"name": "plot", "type": "IMAGE", "links": [138], "slot_index": 0, "shape": 3}, {"name": "loss_list", "type": "FLOAT", "links": null, "shape": 3}], "properties": {"Node name for S&R": "VisualizeLoss"}, "widgets_values": ["ggplot", 1000, true, 768, 512, false]}, {"id": 48, "type": "GetNode", "pos": {"0": 3342.5634765625, "1": 3.2055797576904297}, "size": {"0": 210, "1": 58}, "flags": {"collapsed": true, "pinned": true}, "order": 0, "mode": 0, "inputs": [], "outputs": [{"name": "VALSETTINGS", "type": "VALSETTINGS", "links": [244], "slot_index": 0}], "title": "Get_validation_settings", "properties": {}, "widgets_values": ["validation_settings"], "color": "#232", "bgcolor": "#353"}, {"id": 63, "type": "GetNode", "pos": {"0": 4466.3583984375, "1": 0.10303689539432526}, "size": {"0": 210, "1": 58}, "flags": {"collapsed": true, "pinned": true}, "order": 1, "mode": 0, "inputs": [], "outputs": [{"name": "VALSETTINGS", "type": "VALSETTINGS", "links": [245], "slot_index": 0}], "title": "Get_validation_settings", "properties": {}, "widgets_values": ["validation_settings"], "color": "#232", "bgcolor": "#353"}, {"id": 59, "type": "FluxTrainLoop", "pos": {"0": 3648.1982421875, "1": -107.15684509277344}, "size": {"0": 381.93206787109375, "1": 78}, "flags": {"pinned": true}, "order": 48, "mode": 0, "inputs": [{"name": "network_trainer", "type": "NETWORKTRAINER", "link": 223}], "outputs": [{"name": "network_trainer", "type": "NETWORKTRAINER", "links": [166, 224], "slot_index": 0, "shape": 3}, {"name": "steps", "type": "INT", "links": [234], "slot_index": 1, "shape": 3}], "properties": {"Node name for S&R": "FluxTrainLoop"}, "widgets_values": [250], "color": "#232", "bgcolor": "#353"}, {"id": 38, "type": "SetNode", "pos": {"0": 1178, "1": 77}, "size": {"0": 210, "1": 58}, "flags": {"collapsed": true, "pinned": true}, "order": 22, "mode": 0, "inputs": [{"name": "VALSETTINGS", "type": "VALSETTINGS", "link": 243}], "outputs": [{"name": "*", "type": "*", "links": null}], "title": "Set_validation_settings", "properties": {"previousName": "validation_settings"}, "widgets_values": ["validation_settings"], "color": "#232", "bgcolor": "#353"}, {"id": 133, "type": "FluxTrainEnd", "pos": {"0": 5903.7578125, "1": -89.38908386230469}, "size": {"0": 254.98214721679688, "1": 98}, "flags": {"pinned": true}, "order": 65, "mode": 0, "inputs": [{"name": "network_trainer", "type": "NETWORKTRAINER", "link": 229}], "outputs": [{"name": "lora_name", "type": "STRING", "links": [231], "slot_index": 0, "shape": 3}, {"name": "metadata", "type": "STRING", "links": null, "shape": 3}, {"name": "lora_path", "type": "STRING", "links": [236], "slot_index": 2, "shape": 3}], "properties": {"Node name for S&R": "FluxTrainEnd"}, "widgets_values": [false], "color": "#322", "bgcolor": "#533"}, {"id": 138, "type": "Fast Bypasser (rgthree)", "pos": {"0": -838, "1": 261}, "size": {"0": 304, "1": 78}, "flags": {"pinned": true}, "order": 25, "mode": 0, "inputs": [{"name": "Train 512x512 Dataset", "type": "*", "link": 252, "dir": 3}, {"name": "", "type": "*", "link": null, "dir": 3}], "outputs": [{"name": "OPT_CONNECTION", "type": "*", "links": [253], "slot_index": 0, "dir": 4}], "title": "512x512 Dataset switch (on/off)", "properties": {"toggleRestriction": "default"}, "color": "#232", "bgcolor": "#353"}, {"id": 137, "type": "Fast Bypasser (rgthree)", "pos": {"0": -499, "1": 262}, "size": {"0": 304, "1": 78}, "flags": {"pinned": true}, "order": 27, "mode": 0, "inputs": [{"name": "Train 768x768 Dataset", "type": "*", "link": 249, "dir": 3}, {"name": "", "type": "*", "link": null, "dir": 3}], "outputs": [{"name": "OPT_CONNECTION", "type": "*", "links": [250], "slot_index": 0, "dir": 4}], "title": "768x768 Dataset switch (on/off)", "properties": {"toggleRestriction": "default"}, "color": "#149454", "bgcolor": "#008040"}, {"id": 139, "type": "Fast Bypasser (rgthree)", "pos": {"0": -159, "1": 258}, "size": {"0": 320.79998779296875, "1": 78}, "flags": {"pinned": true}, "order": 29, "mode": 0, "inputs": [{"name": "Train 1024x1024 Dataset", "type": "*", "link": 256, "dir": 3, "label": ""}, {"name": "", "type": "*", "link": null, "dir": 3}], "outputs": [{"name": "OPT_CONNECTION", "type": "*", "links": [255], "slot_index": 0, "dir": 4}], "title": "1024x1024 Dataset switch (on/off)", "properties": {"toggleRestriction": "default"}, "color": "#149494", "bgcolor": "#008080"}, {"id": 123, "type": "GetNode", "pos": {"0": 5961.5439453125, "1": 67.45687866210938}, "size": {"0": 210, "1": 58}, "flags": {"collapsed": true, "pinned": true}, "order": 2, "mode": 0, "inputs": [], "outputs": [{"name": "IMAGE", "type": "IMAGE", "links": [202, 209], "slot_index": 0}], "title": "Get_Sampler1", "properties": {}, "widgets_values": ["Sampler1"], "color": "#322", "bgcolor": "#533"}, {"id": 117, "type": "ImageConcatFromBatch", "pos": {"0": 6119.5439453125, "1": 283.45684814453125}, "size": {"0": 315, "1": 106}, "flags": {"pinned": true}, "order": 24, "mode": 0, "inputs": [{"name": "images", "type": "IMAGE", "link": 195}, {"name": "num_columns", "type": "INT", "link": 199, "widget": {"name": "num_columns"}}], "outputs": [{"name": "IMAGE", "type": "IMAGE", "links": [210], "slot_index": 0, "shape": 3}], "properties": {"Node name for S&R": "ImageConcatFromBatch"}, "widgets_values": [3, false, 4096], "color": "#322", "bgcolor": "#533"}, {"id": 124, "type": "GetNode", "pos": {"0": 5964.5439453125, "1": 118.45687866210938}, "size": {"0": 210, "1": 58}, "flags": {"collapsed": true, "pinned": true}, "order": 3, "mode": 0, "inputs": [], "outputs": [{"name": "IMAGE", "type": "IMAGE", "links": [203], "slot_index": 0}], "title": "Get_Sampler2", "properties": {}, "widgets_values": ["Sampler2"], "color": "#322", "bgcolor": "#533"}, {"id": 126, "type": "GetNode", "pos": {"0": 5967.5439453125, "1": 169.45687866210938}, "size": {"0": 210, "1": 58}, "flags": {"collapsed": true, "pinned": true}, "order": 4, "mode": 0, "inputs": [], "outputs": [{"name": "IMAGE", "type": "IMAGE", "links": [206], "slot_index": 0}], "title": "Get_Sampler3", "properties": {}, "widgets_values": ["Sampler3"], "color": "#322", "bgcolor": "#533"}, {"id": 128, "type": "GetNode", "pos": {"0": 5966.5439453125, "1": 215.45687866210938}, "size": {"0": 210, "1": 58}, "flags": {"collapsed": true, "pinned": true}, "order": 5, "mode": 0, "inputs": [], "outputs": [{"name": "IMAGE", "type": "IMAGE", "links": [208], "slot_index": 0}], "title": "Get_Sampler4", "properties": {}, "widgets_values": ["Sampler4"], "color": "#322", "bgcolor": "#533"}, {"id": 119, "type": "ImageBatchMulti", "pos": {"0": 6213.5439453125, "1": 70.45687866210938}, "size": {"0": 210, "1": 142}, "flags": {"pinned": true}, "order": 20, "mode": 0, "inputs": [{"name": "image_1", "type": "IMAGE", "link": 202}, {"name": "image_2", "type": "IMAGE", "link": 203}, {"name": "image_3", "type": "IMAGE", "link": 206}, {"name": "image_4", "type": "IMAGE", "link": 208}], "outputs": [{"name": "images", "type": "IMAGE", "links": [195], "slot_index": 0, "shape": 3}], "properties": {}, "widgets_values": [4, null], "color": "#322", "bgcolor": "#533"}, {"id": 120, "type": "GetImageSizeAndCount", "pos": {"0": 6224.5439453125, "1": -30.543121337890625}, "size": {"0": 210, "1": 86}, "flags": {"collapsed": true, "pinned": true}, "order": 19, "mode": 0, "inputs": [{"name": "image", "type": "IMAGE", "link": 209}], "outputs": [{"name": "image", "type": "IMAGE", "links": [], "slot_index": 0, "shape": 3}, {"name": "1024 width", "type": "INT", "links": null, "shape": 3}, {"name": "1072 height", "type": "INT", "links": null, "shape": 3}, {"name": "1 count", "type": "INT", "links": [199], "slot_index": 3, "shape": 3}], "properties": {"Node name for S&R": "GetImageSizeAndCount"}, "widgets_values": [], "color": "#322", "bgcolor": "#533"}, {"id": 129, "type": "AddLabel", "pos": {"0": 6248.5439453125, "1": -95.54312133789062}, "size": {"0": 315, "1": 274}, "flags": {"collapsed": true, "pinned": true}, "order": 69, "mode": 0, "inputs": [{"name": "image", "type": "IMAGE", "link": 210}, {"name": "caption", "type": "STRING", "link": null, "widget": {"name": "caption"}}, {"name": "text", "type": "STRING", "link": 231, "widget": {"name": "text"}}], "outputs": [{"name": "IMAGE", "type": "IMAGE", "links": [214], "slot_index": 0, "shape": 3}], "properties": {"Node name for S&R": "AddLabel"}, "widgets_values": [10, 2, 48, 32, "white", "black", "FreeMono.ttf", "Text", "up", ""], "color": "#322", "bgcolor": "#533"}, {"id": 130, "type": "SaveImage", "pos": {"0": 6443.5439453125, "1": -99.54312133789062}, "size": {"0": 671.9758911132812, "1": 719.2059936523438}, "flags": {"pinned": true}, "order": 72, "mode": 0, "inputs": [{"name": "images", "type": "IMAGE", "link": 214}], "outputs": [], "properties": {"Node name for S&R": "SaveImage"}, "widgets_values": ["flux_lora_trainer_sheet"], "color": "#322", "bgcolor": "#533"}, {"id": 131, "type": "Note", "pos": {"0": -1180, "1": 449}, "size": {"0": 370.4340515136719, "1": 60.30167007446289}, "flags": {"pinned": true}, "order": 6, "mode": 0, "inputs": [], "outputs": [], "properties": {"text": ""}, "widgets_values": ["sanity check that all the args are chosen correctly"], "color": "#2a363b", "bgcolor": "#3f5159"}, {"id": 105, "type": "Display Any (rgthree)", "pos": {"0": -1182, "1": 569}, "size": {"0": 1346.8626708984375, "1": 348.1687927246094}, "flags": {"pinned": true}, "order": 33, "mode": 0, "inputs": [{"name": "source", "type": "*", "link": 183, "dir": 3}], "outputs": [], "properties": {"Node name for S&R": "Display Any (rgthree)"}, "widgets_values": ["Namespace(console_log_level=None, console_log_file=None, console_log_simple=False, v2=False, v_parameterization=False, pretrained_model_name_or_path='/home/holium/ComfyUI/models/unet/FLUX1/flux1Dev_v10.safetensors', tokenizer_cache_dir=None, train_data_dir=None, cache_info=False, shuffle_caption=False, caption_separator=',', caption_extension='.caption', caption_extention=None, keep_tokens=0, keep_tokens_separator='', secondary_separator=None, enable_wildcard=False, caption_prefix=None, caption_suffix=None, color_aug=False, flip_aug=False, face_crop_aug_range=None, random_crop=False, debug_dataset=False, resolution=None, cache_latents=True, vae_batch_size=1, cache_latents_to_disk=True, enable_bucket=False, min_bucket_reso=256, max_bucket_reso=1024, bucket_reso_steps=64, bucket_no_upscale=False, token_warmup_min=1, token_warmup_step=0.0, alpha_mask=False, dataset_class=None, caption_dropout_rate=0.0, caption_dropout_every_n_epochs=0, caption_tag_dropout_rate=0.0, reg_data_dir=None, in_json=None, dataset_repeats=1, output_dir='flux_loras', output_name='flux_bombo_rank16_bf16', huggingface_repo_id=None, huggingface_repo_type=None, huggingface_path_in_repo=None, huggingface_token=None, huggingface_repo_visibility=None, save_state_to_huggingface=False, resume_from_huggingface=False, async_upload=False, save_precision='bf16', save_every_n_epochs=None, save_every_n_steps=None, save_n_epoch_ratio=None, save_last_n_epochs=None, save_last_n_epochs_state=None, save_last_n_steps=None, save_last_n_steps_state=None, save_state=False, save_state_on_train_end=False, resume=None, train_batch_size=1, max_token_length=None, mem_eff_attn=True, torch_compile=False, dynamo_backend='inductor', xformers=True, sdpa=False, vae=None, max_train_steps=1000, max_train_epochs=None, max_data_loader_n_workers=0, persistent_data_loader_workers=False, seed=42, gradient_checkpointing=True, gradient_accumulation_steps=1, mixed_precision='bf16', full_fp16=False, full_bf16=True, fp8_base=False, ddp_timeout=None, ddp_gradient_as_bucket_view=False, ddp_static_graph=False, clip_skip=None, logging_dir=None, log_with=None, log_prefix=None, log_tracker_name=None, wandb_run_name=None, log_tracker_config=None, wandb_api_key=None, log_config=False, noise_offset=None, noise_offset_random_strength=False, multires_noise_iterations=None, ip_noise_gamma=None, ip_noise_gamma_random_strength=False, multires_noise_discount=0.3, adaptive_noise_scale=None, zero_terminal_snr=False, min_timestep=None, max_timestep=None, loss_type='l2', huber_schedule='snr', huber_c=0.1, lowram=False, highvram=False, sample_every_n_steps=None, sample_at_first=False, sample_every_n_epochs=None, sample_prompts=['h0d1 he is smoking in a nightclub with pistol pointed at the ceiling. he has a private booth with bottles of whiskey and vodka and several female blonde women cats'], sample_sampler='ddim', config_file=None, output_config=False, metadata_title=None, metadata_author=None, metadata_description=None, metadata_license=None, metadata_tags=None, prior_loss_weight=1.0, conditioning_data_dir=None, masked_loss=False, deepspeed=False, zero_stage=2, offload_optimizer_device=None, offload_optimizer_nvme_path=None, offload_param_device=None, offload_param_nvme_path=None, zero3_init_flag=False, zero3_save_16bit_model=False, fp16_master_weights_and_gradients=False, optimizer_type='adafactor', use_8bit_adam=False, use_lion_optimizer=False, learning_rate=0.00039999999999999996, max_grad_norm=1.0, optimizer_args=['relative_step=False', 'scale_parameter=False', 'warmup_init=False', 'clip_threshold=1.0'], lr_scheduler_type='', lr_scheduler_args=None, lr_scheduler='constant', lr_warmup_steps=0, lr_scheduler_num_cycles=3, lr_scheduler_power=1.0, fused_backward_pass=False, dataset_config='[[datasets]]\\nresolution = [ 512, 512,]\\nbatch_size = 4\\nenable_bucket = true\\nbucket_no_upscale = false\\nmin_bucket_reso = 256\\nmax_bucket_reso = 1024\\n[[datasets.subsets]]\\nimage_dir = \"input/hodi\"\\nclass_tokens = \"h0d1\"\\nnum_repeats = 1\\n\\n\\n[general]\\nshuffle_caption = false\\ncaption_extension = \".txt\"\\nkeep_tokens_separator = \"|||\"\\ncaption_dropout_rate = 0.0\\ncolor_aug = false\\nflip_aug = true\\n', min_snr_gamma=5.0, scale_v_pred_loss_like_noise_pred=False, v_pred_like_loss=None, debiased_estimation_loss=False, weighted_captions=False, no_metadata=False, save_model_as='safetensors', unet_lr=None, text_encoder_lr=0.0, network_weights=None, network_module='.networks.lora_flux', network_dim=16, network_alpha=80.0, network_dropout=None, network_args=['train_blocks=all'], network_train_unet_only=False, network_train_text_encoder_only=False, training_comment=None, dim_from_weights=False, scale_weight_norms=None, base_weights=None, base_weights_multiplier=None, no_half_vae=False, skip_until_initial_step=False, initial_epoch=None, initial_step=None, fp8_base_unet=False, cpu_offload_checkpointing=False, num_cpu_threads_per_process=1, clip_l='/home/holium/ComfyUI/models/clip/clip_l.safetensors', t5xxl='/home/holium/ComfyUI/models/clip/t5/google_t5-v1_1-xxl_encoderonly-fp16.safetensors', ae='/home/holium/ComfyUI/models/vae/FLUX1/ae.sft', t5xxl_max_token_length=512, spda=False, split_mode=False, apply_t5_attn_mask=True, cache_text_encoder_outputs=True, weighting_scheme='logit_normal', logit_mean=0.0, logit_std=1.0, mode_scale=1.29, timestep_sampling='shift', sigmoid_scale=1.0, model_prediction_type='raw', guidance_scale=1.0, discrete_flow_shift=3.1582000000000003, cache_text_encoder_outputs_to_disk=True)"], "color": "#2a363b", "bgcolor": "#3f5159"}, {"id": 2, "type": "FluxTrainModelSelect", "pos": {"0": 252, "1": 45}, "size": {"0": 430, "1": 130}, "flags": {"pinned": true}, "order": 7, "mode": 0, "inputs": [], "outputs": [{"name": "flux_models", "type": "TRAIN_FLUX_MODELS", "links": [179], "shape": 3}], "properties": {"Node name for S&R": "FluxTrainModelSelect"}, "widgets_values": ["FLUX1/flux1Dev_v10.safetensors", "FLUX1/ae.sft", "clip_l.safetensors", "t5/google_t5-v1_1-xxl_encoderonly-fp16.safetensors"], "color": "#1414ff", "bgcolor": "#0000ff"}, {"id": 114, "type": "OptimizerConfigAdafactor", "pos": {"0": 274, "1": 416}, "size": {"0": 315, "1": 316}, "flags": {"pinned": true}, "order": 8, "mode": 0, "inputs": [], "outputs": [{"name": "optimizer_settings", "type": "ARGS", "links": [247], "slot_index": 0, "shape": 3}], "properties": {"Node name for S&R": "OptimizerConfigAdafactor"}, "widgets_values": [1, "constant", 0, 3, 1, false, false, false, 1, 5, ""], "color": "#941414", "bgcolor": "#800000"}, {"id": 136, "type": "Switch any [Crystools]", "pos": {"0": 273, "1": 795}, "size": {"0": 315, "1": 78}, "flags": {"pinned": true}, "order": 21, "mode": 0, "inputs": [{"name": "on_true", "type": "*", "link": 247}, {"name": "on_false", "type": "*", "link": 246}], "outputs": [{"name": "*", "type": "*", "links": [248], "slot_index": 0, "shape": 3}], "title": "Optimizer switch (true = Adafactor)", "properties": {"Node name for S&R": "Switch any [Crystools]"}, "widgets_values": [true], "color": "#941414", "bgcolor": "#800000"}, {"id": 95, "type": "OptimizerConfig", "pos": {"0": 278, "1": 933}, "size": {"0": 315, "1": 244}, "flags": {"pinned": true}, "order": 9, "mode": 0, "inputs": [], "outputs": [{"name": "optimizer_settings", "type": "ARGS", "links": [246], "slot_index": 0, "shape": 3}], "properties": {"Node name for S&R": "OptimizerConfig"}, "widgets_values": ["adamw8bit", 1, "cosine_with_restarts", 4, 3, 1, 5, ""], "color": "#941414", "bgcolor": "#800000"}, {"id": 37, "type": "FluxTrainValidationSettings", "pos": {"0": 831, "1": 44}, "size": {"0": 315, "1": 250}, "flags": {"pinned": true}, "order": 10, "mode": 0, "inputs": [], "outputs": [{"name": "validation_settings", "type": "VALSETTINGS", "links": [243], "slot_index": 0, "shape": 3}], "properties": {"Node name for S&R": "FluxTrainValidationSettings"}, "widgets_values": [20, 1024, 1024, 3, 1055665447947593, "randomize", false, 0.5, 1.15], "color": "#232", "bgcolor": "#353"}, {"id": 9, "type": "PreviewImage", "pos": {"0": 1425, "1": 80}, "size": {"0": 1099.023193359375, "1": 710.3143920898438}, "flags": {"pinned": true}, "order": 40, "mode": 0, "inputs": [{"name": "images", "type": "IMAGE", "link": 8}], "outputs": [], "properties": {"Node name for S&R": "PreviewImage"}, "widgets_values": [], "color": "#2a363b", "bgcolor": "#3f5159"}, {"id": 14, "type": "FluxTrainSave", "pos": {"0": 1828, "1": -112}, "size": {"0": 341.3186340332031, "1": 122}, "flags": {"pinned": true}, "order": 35, "mode": 0, "inputs": [{"name": "network_trainer", "type": "NETWORKTRAINER", "link": 218}], "outputs": [{"name": "network_trainer", "type": "NETWORKTRAINER", "links": [221], "slot_index": 0, "shape": 3}, {"name": "lora_path", "type": "STRING", "links": [], "slot_index": 1, "shape": 3}, {"name": "steps", "type": "INT", "links": [], "slot_index": 2, "shape": 3}], "properties": {"Node name for S&R": "FluxTrainSave"}, "widgets_values": [true, false], "color": "#232", "bgcolor": "#353"}, {"id": 8, "type": "FluxTrainValidate", "pos": {"0": 2202, "1": -116}, "size": {"0": 321.6932373046875, "1": 51.817989349365234}, "flags": {"collapsed": false, "pinned": true}, "order": 38, "mode": 0, "inputs": [{"name": "network_trainer", "type": "NETWORKTRAINER", "link": 221}, {"name": "validation_settings", "type": "VALSETTINGS", "link": 242}], "outputs": [{"name": "network_trainer", "type": "NETWORKTRAINER", "links": [219], "slot_index": 0, "shape": 3}, {"name": "validation_images", "type": "IMAGE", "links": [8, 112], "slot_index": 1, "shape": 3}], "properties": {"Node name for S&R": "FluxTrainValidate"}, "widgets_values": [], "color": "#232", "bgcolor": "#353"}, {"id": 40, "type": "GetNode", "pos": {"0": 2257, "1": -2}, "size": {"0": 277.0899353027344, "1": 58}, "flags": {"collapsed": true, "pinned": true}, "order": 11, "mode": 0, "inputs": [], "outputs": [{"name": "VALSETTINGS", "type": "VALSETTINGS", "links": [242], "slot_index": 0}], "title": "Get_validation_settings", "properties": {}, "widgets_values": ["validation_settings"], "color": "#232", "bgcolor": "#353"}, {"id": 98, "type": "SaveImage", "pos": {"0": 1888, "1": 915}, "size": {"0": 645.9608764648438, "1": 439.37261962890625}, "flags": {"pinned": true}, "order": 37, "mode": 0, "inputs": [{"name": "images", "type": "IMAGE", "link": 161}], "outputs": [], "properties": {"Node name for S&R": "SaveImage"}, "widgets_values": ["flux_lora_loss_plot"]}, {"id": 97, "type": "VisualizeLoss", "pos": {"0": 1495, "1": 1000}, "size": {"0": 303.6300048828125, "1": 198}, "flags": {"pinned": true}, "order": 34, "mode": 0, "inputs": [{"name": "network_trainer", "type": "NETWORKTRAINER", "link": 162}], "outputs": [{"name": "plot", "type": "IMAGE", "links": [161], "slot_index": 0, "shape": 3}, {"name": "loss_list", "type": "FLOAT", "links": null, "shape": 3}], "properties": {"Node name for S&R": "VisualizeLoss"}, "widgets_values": ["seaborn-v0_8-dark-palette", 100, true, 768, 512, false]}, {"id": 78, "type": "AddLabel", "pos": {"0": 1993, "1": 857}, "size": {"0": 315, "1": 274}, "flags": {"collapsed": true, "pinned": true}, "order": 41, "mode": 0, "inputs": [{"name": "image", "type": "IMAGE", "link": 112}, {"name": "caption", "type": "STRING", "link": null, "widget": {"name": "caption"}}, {"name": "text", "type": "STRING", "link": 111, "widget": {"name": "text"}}], "outputs": [{"name": "IMAGE", "type": "IMAGE", "links": [200], "slot_index": 0, "shape": 3}], "properties": {"Node name for S&R": "AddLabel"}, "widgets_values": [10, 2, 48, 32, "white", "black", "FreeMono.ttf", "Text", "up", ""]}, {"id": 121, "type": "SetNode", "pos": {"0": 2150, "1": 857}, "size": {"0": 210, "1": 58}, "flags": {"collapsed": true, "pinned": true}, "order": 45, "mode": 0, "inputs": [{"name": "IMAGE", "type": "IMAGE", "link": 200}], "outputs": [{"name": "*", "type": "*", "links": null}], "title": "Set_Sampler1", "properties": {"previousName": "Sampler1"}, "widgets_values": ["Sampler1"], "color": "#2a363b", "bgcolor": "#3f5159"}, {"id": 99, "type": "VisualizeLoss", "pos": {"0": 2697, "1": 969}, "size": {"0": 254.40000915527344, "1": 198}, "flags": {"pinned": true}, "order": 42, "mode": 0, "inputs": [{"name": "network_trainer", "type": "NETWORKTRAINER", "link": 164}], "outputs": [{"name": "plot", "type": "IMAGE", "links": [163], "slot_index": 0, "shape": 3}, {"name": "loss_list", "type": "FLOAT", "links": null, "shape": 3}], "properties": {"Node name for S&R": "VisualizeLoss"}, "widgets_values": ["seaborn-v0_8-dark-palette", 100, true, 768, 512, false]}, {"id": 100, "type": "SaveImage", "pos": {"0": 3035, "1": 929}, "size": {"0": 574.23046875, "1": 414.46881103515625}, "flags": {"pinned": true}, "order": 46, "mode": 0, "inputs": [{"name": "images", "type": "IMAGE", "link": 163}], "outputs": [], "properties": {"Node name for S&R": "SaveImage"}, "widgets_values": ["flux_lora_loss_plot"]}, {"id": 81, "type": "SomethingToString", "pos": {"0": 2782, "1": 851}, "size": {"0": 315, "1": 82}, "flags": {"collapsed": true, "pinned": true}, "order": 44, "mode": 0, "inputs": [{"name": "input", "type": "*", "link": 235}], "outputs": [{"name": "STRING", "type": "STRING", "links": [117], "slot_index": 0, "shape": 3}], "properties": {"Node name for S&R": "SomethingToString"}, "widgets_values": ["steps ", ""]}, {"id": 80, "type": "AddLabel", "pos": {"0": 3011, "1": 854}, "size": {"0": 315, "1": 274}, "flags": {"collapsed": true, "pinned": true}, "order": 50, "mode": 0, "inputs": [{"name": "image", "type": "IMAGE", "link": 119}, {"name": "caption", "type": "STRING", "link": null, "widget": {"name": "caption"}}, {"name": "text", "type": "STRING", "link": 117, "widget": {"name": "text"}}], "outputs": [{"name": "IMAGE", "type": "IMAGE", "links": [201], "slot_index": 0, "shape": 3}], "properties": {"Node name for S&R": "AddLabel"}, "widgets_values": [10, 2, 48, 32, "white", "black", "FreeMono.ttf", "Text", "up", ""]}, {"id": 122, "type": "SetNode", "pos": {"0": 3209, "1": 856}, "size": {"0": 210, "1": 58}, "flags": {"collapsed": true, "pinned": true}, "order": 54, "mode": 0, "inputs": [{"name": "IMAGE", "type": "IMAGE", "link": 201}], "outputs": [{"name": "*", "type": "*", "links": null}], "title": "Set_Sampler2", "properties": {"previousName": "Sampler2"}, "widgets_values": ["Sampler2"], "color": "#2a363b", "bgcolor": "#3f5159"}, {"id": 46, "type": "PreviewImage", "pos": {"0": 2563, "1": 75}, "size": {"0": 1041.0751953125, "1": 707.7618408203125}, "flags": {"pinned": true}, "order": 49, "mode": 0, "inputs": [{"name": "images", "type": "IMAGE", "link": 70}], "outputs": [], "properties": {"Node name for S&R": "PreviewImage"}, "widgets_values": [], "color": "#2a363b", "bgcolor": "#3f5159"}, {"id": 47, "type": "FluxTrainSave", "pos": {"0": 2950, "1": -112}, "size": {"0": 337.2362976074219, "1": 122}, "flags": {"pinned": true}, "order": 43, "mode": 0, "inputs": [{"name": "network_trainer", "type": "NETWORKTRAINER", "link": 222}], "outputs": [{"name": "network_trainer", "type": "NETWORKTRAINER", "links": [227], "slot_index": 0, "shape": 3}, {"name": "lora_path", "type": "STRING", "links": null, "shape": 3}, {"name": "steps", "type": "INT", "links": [], "slot_index": 2, "shape": 3}], "properties": {"Node name for S&R": "FluxTrainSave"}, "widgets_values": [true, false], "color": "#232", "bgcolor": "#353"}, {"id": 125, "type": "SetNode", "pos": {"0": 4236, "1": 868}, "size": {"0": 210, "1": 58}, "flags": {"collapsed": true, "pinned": true}, "order": 62, "mode": 0, "inputs": [{"name": "IMAGE", "type": "IMAGE", "link": 204}], "outputs": [{"name": "*", "type": "*", "links": [], "slot_index": 0}], "title": "Set_Sampler3", "properties": {"previousName": "Sampler3"}, "widgets_values": ["Sampler3"], "color": "#2a363b", "bgcolor": "#3f5159"}, {"id": 101, "type": "VisualizeLoss", "pos": {"0": 3803, "1": 955}, "size": {"0": 254.40000915527344, "1": 198}, "flags": {"pinned": true}, "order": 51, "mode": 0, "inputs": [{"name": "network_trainer", "type": "NETWORKTRAINER", "link": 166}], "outputs": [{"name": "plot", "type": "IMAGE", "links": [165], "slot_index": 0, "shape": 3}, {"name": "loss_list", "type": "FLOAT", "links": null, "shape": 3}], "properties": {"Node name for S&R": "VisualizeLoss"}, "widgets_values": ["seaborn-v0_8-dark-palette", 100, true, 768, 512, false]}, {"id": 102, "type": "SaveImage", "pos": {"0": 4138, "1": 926}, "size": {"0": 574.23046875, "1": 414.46881103515625}, "flags": {"pinned": true}, "order": 55, "mode": 0, "inputs": [{"name": "images", "type": "IMAGE", "link": 165}], "outputs": [], "properties": {"Node name for S&R": "SaveImage"}, "widgets_values": ["flux_lora_loss_plot"]}, {"id": 90, "type": "SaveImage", "pos": {"0": 5272, "1": 933.4569091796875}, "size": {"0": 574.23046875, "1": 414.46881103515625}, "flags": {"pinned": true}, "order": 68, "mode": 0, "inputs": [{"name": "images", "type": "IMAGE", "link": 138}], "outputs": [], "properties": {"Node name for S&R": "SaveImage"}, "widgets_values": ["flux_lora_loss_plot"]}, {"id": 84, "type": "SomethingToString", "pos": {"0": 5000, "1": 860.4569091796875}, "size": {"0": 315, "1": 82}, "flags": {"collapsed": true, "pinned": true}, "order": 61, "mode": 0, "inputs": [{"name": "input", "type": "*", "link": 215}], "outputs": [{"name": "STRING", "type": "STRING", "links": [124], "slot_index": 0, "shape": 3}], "properties": {"Node name for S&R": "SomethingToString"}, "widgets_values": ["steps ", ""]}, {"id": 85, "type": "AddLabel", "pos": {"0": 5210, "1": 857.4569091796875}, "size": {"0": 315, "1": 274}, "flags": {"collapsed": true, "pinned": true}, "order": 67, "mode": 0, "inputs": [{"name": "image", "type": "IMAGE", "link": 126}, {"name": "caption", "type": "STRING", "link": null, "widget": {"name": "caption"}}, {"name": "text", "type": "STRING", "link": 124, "widget": {"name": "text"}}], "outputs": [{"name": "IMAGE", "type": "IMAGE", "links": [207], "slot_index": 0, "shape": 3}], "properties": {"Node name for S&R": "AddLabel"}, "widgets_values": [10, 2, 48, 32, "white", "black", "FreeMono.ttf", "Text", "up", ""]}, {"id": 127, "type": "SetNode", "pos": {"0": 5380, "1": 858.4569091796875}, "size": {"0": 210, "1": 58}, "flags": {"collapsed": true, "pinned": true}, "order": 71, "mode": 0, "inputs": [{"name": "IMAGE", "type": "IMAGE", "link": 207}], "outputs": [{"name": "*", "type": "*", "links": null}], "title": "Set_Sampler4", "properties": {"previousName": "Sampler4"}, "widgets_values": ["Sampler4"], "color": "#2a363b", "bgcolor": "#3f5159"}, {"id": 66, "type": "PreviewImage", "pos": {"0": 4759, "1": 95.45687866210938}, "size": {"0": 1080.4327392578125, "1": 711.6444702148438}, "flags": {"pinned": true}, "order": 66, "mode": 0, "inputs": [{"name": "images", "type": "IMAGE", "link": 95}], "outputs": [], "properties": {"Node name for S&R": "PreviewImage"}, "widgets_values": [], "color": "#2a363b", "bgcolor": "#3f5159"}, {"id": 64, "type": "FluxTrainLoop", "pos": {"0": 4756, "1": -106.54312133789062}, "size": {"0": 348.72076416015625, "1": 78}, "flags": {"pinned": true}, "order": 57, "mode": 0, "inputs": [{"name": "network_trainer", "type": "NETWORKTRAINER", "link": 226}], "outputs": [{"name": "network_trainer", "type": "NETWORKTRAINER", "links": [232], "slot_index": 0, "shape": 3}, {"name": "steps", "type": "INT", "links": [215], "slot_index": 1, "shape": 3}], "properties": {"Node name for S&R": "FluxTrainLoop"}, "widgets_values": [250], "color": "#232", "bgcolor": "#353"}, {"id": 134, "type": "FluxTrainSave", "pos": {"0": 5139, "1": -105.54312133789062}, "size": {"0": 305.3969421386719, "1": 122}, "flags": {"pinned": true}, "order": 60, "mode": 0, "inputs": [{"name": "network_trainer", "type": "NETWORKTRAINER", "link": 232}], "outputs": [{"name": "network_trainer", "type": "NETWORKTRAINER", "links": [233], "slot_index": 0, "shape": 3}, {"name": "lora_path", "type": "STRING", "links": null, "shape": 3}, {"name": "steps", "type": "INT", "links": [], "slot_index": 2, "shape": 3}], "properties": {"Node name for S&R": "FluxTrainSave"}, "widgets_values": [true, false], "color": "#232", "bgcolor": "#353"}, {"id": 65, "type": "FluxTrainValidate", "pos": {"0": 5488, "1": -99.54312133789062}, "size": {"0": 312.3999938964844, "1": 46}, "flags": {"pinned": true}, "order": 63, "mode": 0, "inputs": [{"name": "network_trainer", "type": "NETWORKTRAINER", "link": 233}, {"name": "validation_settings", "type": "VALSETTINGS", "link": 94}], "outputs": [{"name": "network_trainer", "type": "NETWORKTRAINER", "links": [217, 229], "slot_index": 0, "shape": 3}, {"name": "validation_images", "type": "IMAGE", "links": [95, 126], "slot_index": 1, "shape": 3}], "properties": {"Node name for S&R": "FluxTrainValidate"}, "widgets_values": [], "color": "#232", "bgcolor": "#353"}, {"id": 68, "type": "GetNode", "pos": {"0": 5561, "1": 9.456878662109375}, "size": {"0": 210, "1": 58}, "flags": {"collapsed": true, "pinned": true}, "order": 12, "mode": 0, "inputs": [], "outputs": [{"name": "VALSETTINGS", "type": "VALSETTINGS", "links": [94], "slot_index": 0}], "title": "Get_validation_settings", "properties": {}, "widgets_values": ["validation_settings"], "color": "#232", "bgcolor": "#353"}, {"id": 111, "type": "TrainDatasetAdd", "pos": {"0": -481, "1": -111}, "size": {"0": 267.5897521972656, "1": 318}, "flags": {"pinned": true}, "order": 26, "mode": 4, "inputs": [{"name": "dataset_config", "type": "JSON", "link": 253}], "outputs": [{"name": "dataset", "type": "JSON", "links": [249], "slot_index": 0, "shape": 3}], "title": "Train 768x768 Dataset", "properties": {"Node name for S&R": "TrainDatasetAdd"}, "widgets_values": [768, 768, 1, "../training/input/", "LoraTrigger", true, false, 1, 256, 1024], "color": "#149454", "bgcolor": "#008040"}, {"id": 108, "type": "TrainDatasetGeneralConfig", "pos": {"0": -1178, "1": 177}, "size": {"0": 315, "1": 154}, "flags": {"pinned": true}, "order": 13, "mode": 0, "inputs": [], "outputs": [{"name": "dataset_general", "type": "JSON", "links": [185], "slot_index": 0, "shape": 3}], "properties": {"Node name for S&R": "TrainDatasetGeneralConfig"}, "widgets_values": [false, true, false, 0, false], "color": "#232", "bgcolor": "#353"}, {"id": 113, "type": "Note", "pos": {"0": -1189.3692626953125, "1": -106.29979705810547}, "size": {"0": 327.63427734375, "1": 168.70933532714844}, "flags": {"pinned": true}, "order": 14, "mode": 0, "inputs": [], "outputs": [], "title": "Datasets Note", "properties": {"text": ""}, "widgets_values": ["For multiresolution training, input same source directory with different dataset resolution. From what I hear, Flux likes multiple resolutions.\n\nFor single resolution training, just add single dataset.\n\nVery important: remember to set the directory where input images is located (../training/input/ by default) and the LoraTrigger word if you want one."], "color": "#ff9414", "bgcolor": "#ff8000"}, {"id": 115, "type": "Note", "pos": {"0": 228, "1": -114}, "size": {"0": 464.1640930175781, "1": 101.32028198242188}, "flags": {"pinned": true}, "order": 15, "mode": 0, "inputs": [], "outputs": [], "title": "Note on FLUX model", "properties": {"text": ""}, "widgets_values": ["You can use same models as you use for inference in Comfy. When fp8_base is enabled, the model is downcasted to torch.float_e4m3fn on initialize, meaning if you load fp8 model here it should also be in same format.\n\nDownload the flux1-dev-fp8.safetensors transformer from this link:\nhttps://huggingface.co/Kijai/flux-fp8/tree/main "], "color": "#ff9414", "bgcolor": "#ff8000"}, {"id": 135, "type": "Note", "pos": {"0": 226, "1": 300}, "size": {"0": 401.9402160644531, "1": 63.765438079833984}, "flags": {"pinned": true}, "order": 16, "mode": 0, "inputs": [], "outputs": [], "title": "Note on Optimizers", "properties": {}, "widgets_values": ["You can use Adafactor Optimizer node (suggested) or use the other \"Optimizer Config\" node that allows you to choose the following optimizers: Adamw8bit, Adamw, Prodigy and Came Optimizers."], "color": "#ff9414", "bgcolor": "#ff8000"}, {"id": 116, "type": "Note", "pos": {"0": 802, "1": -113}, "size": {"0": 572.6136474609375, "1": 105.09221649169922}, "flags": {"pinned": true}, "order": 17, "mode": 0, "inputs": [], "outputs": [], "title": "Note on Training and Validation", "properties": {"text": "\n"}, "widgets_values": ["Validation sampling settings are set here for all the 4 sampler nodes.\nRemeber to write a prompt in the \"Init Flux LoRA Training\" node (at the bottom). You can generate more than one image just separating each image's prompt with \"|\".\nIn the 4 Train-groups, the Steps in each Train Loop must be 1/4 of what you set in \"max_train_steps\".\n\nFor training settings in the \"Init Flux LoRA Training\" node visit: https://github.com/kohya-ss/sd-scripts"], "color": "#ff9414", "bgcolor": "#ff8000"}, {"id": 140, "type": "Note Plus (mtb)", "pos": {"0": -1780.3626708984375, "1": -174.3422088623047}, "size": {"0": 564.8421020507812, "1": 583.4563598632812}, "flags": {"pinned": true}, "order": 18, "mode": 0, "inputs": [], "outputs": [], "title": "Unnamed", "properties": {}, "widgets_values": ["
This workflow is based on the incredible work by Kijai (https://github.com/kijai/ComfyUI-FluxTrainer) who created the training nodes for ComfyUI based on Kohya_ss (https://github.com/kohya-ss/sd-scripts) work. All credits go to them. Thanks also to u/tom83_be on Reddit who posted his installation and basic settings tips.
\nTo train a LoRA (Low Rank Adaptation) for FLUX these are the steps you should follow before clicking on Queue:
\n1) Prepare learning data - that is an images set (min 10, 20-30 is fine, but for some specifici LoRA's the more is better)
\n2) You don't need to create the caption .txt files, FLUX model's LoRA's can be trained on images only.
\n3) Check you have set the input (training images) and the output (saved LoRA's) folders correctly.
\n4) Set your LoraTrigger word (optional)
\n5) Add a prompt (or multiple prompts) for Training Validation in the \"Init Flux LoRA Training\" node, at the bottom.
\n6) Adjust training settings (or leave default ones)
\nNow click \"Queue\" and wait a few hours...
\nAt the end of the trainig you will have a few different LoRA's, chose the best one (usually the secondo or the third in my experience) and enjoy it in your next workflow!
\n