OneTrainer icon indicating copy to clipboard operation
OneTrainer copied to clipboard

[Bug]: "Include Text Encoder"

Open dxqb opened this issue 2 months ago • 1 comments

What happened?

What is the purpose of being able to disable "Include Text Encoder" for models that have multiple text encoders?

Image

If there is a purpose, it shouldn't error:

  File ".../OneTrainer/modules/ui/TrainUI.py", line 754, in __training_thread_function
    trainer.start()
  File ".../OneTrainer/modules/trainer/GenericTrainer.py", line 141, in start
    self.data_loader = self.create_data_loader(
                       ^^^^^^^^^^^^^^^^^^^^^^^^
  File ".../OneTrainer/modules/trainer/BaseTrainer.py", line 61, in create_data_loader
    return create.create_data_loader(
           ^^^^^^^^^^^^^^^^^^^^^^^^^^
  File ".../OneTrainer/modules/util/create.py", line 476, in create_data_loader
    return FluxBaseDataLoader(train_device, temp_device, config, model, train_progress, is_validation)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File ".../OneTrainer/modules/dataLoader/FluxBaseDataLoader.py", line 54, in __init__
    self.__ds = self.create_dataset(
                ^^^^^^^^^^^^^^^^^^^^
  File ".../OneTrainer/modules/dataLoader/FluxBaseDataLoader.py", line 273, in create_dataset
    preparation_modules = self._preparation_modules(config, model)
                          ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File ".../OneTrainer/modules/dataLoader/FluxBaseDataLoader.py", line 79, in _preparation_modules
    tokenize_prompt_1 = Tokenize(in_name='prompt_1', tokens_out_name='tokens_1', mask_out_name='tokens_mask_1', tokenizer=model.tokenizer_1, max_token_length=model.tokenizer_1.model_max_length)
                                                                                                                                                              ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
AttributeError: 'NoneType' object has no attribute 'model_max_length'

What did you expect would happen?

Either remove the toggle, or fix the toggle

Relevant log output


Generate and upload debug_report.log

No response

dxqb avatar Oct 20 '25 16:10 dxqb

@Nerogar could you explain what was the intention here, so we can make the right decision?

dxqb avatar Oct 24 '25 14:10 dxqb

There are models where some of the text encoders are optional. I think SD3 was one of them. This switch completely disables a text encoder. It's not loaded, and during training and sampling the TE output is replaced with 0 vectors.

Nerogar avatar Dec 01 '25 18:12 Nerogar