kohya-ss / kohya-ss/sd-scripts

Flux Dedistilled / fluxdev2pro support ?

Open
#1,702 40 comments 0 reactions 0 assignees View on GitHub
Dominant language
Python
Stars
7.2k
Forks
1.2k
Avg merge
11m
Merged PRs (30d)
2

Description

I'm trying to use the amazing new Dedistilled models with the trainer

If you haven't tried them, they are groundbreaking : https://civitai.com/models/843551
For me it's the biggest thing in the Flux community since we're able to train LoRas.

They would allow training with CFG > 1 (Guidance > 1) thus probably allowing much better caption adherence during training / possible better prompt adherence later on

(Although it is not sure we can properly use a LoRa trained with CFG > 1 with distilled models. But if we can it would probably be amazing, that is why we need to try ASAP)

Currently I've just tried to replace flux1dev.sft by another file in the following parameter

--pretrained_model_name_or_path "C:\fluxgym\models\unet\flux1-dev.sft"

But I got this error which I haven't really investigated yet. I have the same using fluxdev2pro which is a fine-tuned dedistilled model enhancing training :

File "C:\fluxgym\sd-scripts\flux_train_network.py", line 519, in
trainer.train(args)
File "C:\fluxgym\sd-scripts\train_network.py", line 354, in train
model_version, text_encoder, vae, unet = self.load_target_model(args, weight_dtype, accelerator)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\fluxgym\sd-scripts\flux_train_network.py", line 82, in load_target_model
model = self.prepare_split_model(model, weight_dtype, accelerator)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\fluxgym\sd-scripts\flux_train_network.py", line 127, in prepare_split_model
flux_upper.to(accelerator.device, dtype=target_dtype)
File "C:\fluxgym\env\Lib\site-packages\torch\nn\modules\module.py", line 1340, in to
return self._apply(convert)
^^^^^^^^^^^^^^^^^^^^
File "C:\fluxgym\env\Lib\site-packages\torch\nn\modules\module.py", line 900, in _apply
module._apply(fn)
File "C:\fluxgym\env\Lib\site-packages\torch\nn\modules\module.py", line 900, in _apply
module._apply(fn)
File "C:\fluxgym\env\Lib\site-packages\torch\nn\modules\module.py", line 927, in _apply
param_applied = fn(param)
^^^^^^^^^
File "C:\fluxgym\env\Lib\site-packages\torch\nn\modules\module.py", line 1333, in convert
raise NotImplementedError(
NotImplementedError: Cannot copy out of meta tensor; no data! Please use torch.nn.Module.to_empty() instead of torch.nn.Module.to() when moving module from meta to a different device.
Traceback (most recent call last):
File "", line 198, in _run_module_as_main
File "", line 88, in run_code
File "C:\fluxgym\env\Scripts\accelerate.exe_main.py", line 7, in
File "C:\fluxgym\env\Lib\site-packages\accelerate\commands\accelerate_cli.py", line 48, in main
args.func(args)
File "C:\fluxgym\env\Lib\site-packages\accelerate\commands\launch.py", line 1174, in launch_command
simple_launcher(args)
File "C:\fluxgym\env\Lib\site-packages\accelerate\commands\launch.py", line 769, in simple_launcher
raise subprocess.CalledProcessError(returncode=process.returncode, cmd=cmd)
subprocess.CalledProcessError:

Contributor guide

No contributing guide indexed for this repository

Research direction

Start with flux_train_network.py at load_target_model and prepare_split_model, then inspect train_network.py at train where the model is loaded. Reproduce the reported Flux Dedistilled or fluxdev2pro training failure and determine the model-loading changes required; done means supported training completes without the reported meta-tensor error.

Written by the indexing model from the issue text.

Assessment

Tech stack
python, pytorch
Domain
machine-learning
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.