Nerogar / OneTrainer

OneTrainer is a one-stop solution for all your stable diffusion training needs.
GNU Affero General Public License v3.0
1.73k stars 143 forks source link

[Bug]: AttributeError: 'NoneType' object has no attribute 'model_max_length' #523

Open nikolaiusa opened 23 hours ago

nikolaiusa commented 23 hours ago

What happened?

error when i start lora training

What did you expect would happen?

noeror

Relevant log output

activating venv N:\ONETRAINER\OneTrainer\venv
Using Python "N:\ONETRAINER\OneTrainer\venv\Scripts\python.exe"
N:\ONETRAINER\OneTrainer\venv\lib\site-packages\timm\models\layers\__init__.py:48: FutureWarning: Importing from timm.models.layers is deprecated, please import via timm.layers
  warnings.warn(f"Importing from {__name__} is deprecated, please import via timm.layers", FutureWarning)
Clearing cache directory workspace-cache/run! You can disable this if you want to continue using the same cache.

Traceback (most recent call last):
  File "N:\ONETRAINER\OneTrainer\modules\ui\TrainUI.py", line 557, in __training_thread_function
    trainer.start()
  File "N:\ONETRAINER\OneTrainer\modules\trainer\GenericTrainer.py", line 141, in start
    self.data_loader = self.create_data_loader(
  File "N:\ONETRAINER\OneTrainer\modules\trainer\BaseTrainer.py", line 59, in create_data_loader
    return create.create_data_loader(
  File "N:\ONETRAINER\OneTrainer\modules\util\create.py", line 363, in create_data_loader
    return StableDiffusion3BaseDataLoader(train_device, temp_device, config, model, train_progress, is_validation)
  File "N:\ONETRAINER\OneTrainer\modules\dataLoader\StableDiffusion3BaseDataLoader.py", line 51, in __init__
    self.__ds = self.create_dataset(
  File "N:\ONETRAINER\OneTrainer\modules\dataLoader\StableDiffusion3BaseDataLoader.py", line 296, in create_dataset
    preparation_modules = self._preparation_modules(config, model)
  File "N:\ONETRAINER\OneTrainer\modules\dataLoader\StableDiffusion3BaseDataLoader.py", line 73, in _preparation_modules
    tokenize_prompt_1 = Tokenize(in_name='prompt', 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'

Output of pip freeze

N:\ONETRAINER\OneTrainer\venv\Scripts>activate

(venv) N:\ONETRAINER\OneTrainer\venv\Scripts>pip freeze absl-py==2.1.0 accelerate==0.30.1 aiohappyeyeballs==2.4.3 aiohttp==3.10.10 aiosignal==1.3.1 antlr4-python3-runtime==4.9.3 async-timeout==4.0.3 attrs==24.2.0 bitsandbytes==0.44.0 certifi==2024.8.30 charset-normalizer==3.4.0 cloudpickle==3.1.0 colorama==0.4.6 coloredlogs==15.0.1 contourpy==1.3.0 customtkinter==5.2.2 cycler==0.12.1 dadaptation==3.2 darkdetect==0.8.0 -e git+https://github.com/huggingface/diffusers.git@e45c25d03aeb0a967d8aaa0f6a79f280f6838e1f#egg=diffusers filelock==3.16.1 flatbuffers==24.3.25 fonttools==4.54.1 frozenlist==1.5.0 fsspec==2024.10.0 ftfy==6.3.1 grpcio==1.67.0 huggingface-hub==0.23.3 humanfriendly==10.0 idna==3.10 importlib_metadata==8.5.0 intel-openmp==2021.4.0 invisible-watermark==0.2.0 Jinja2==3.1.4 kiwisolver==1.4.7 lightning-utilities==0.11.8 lion-pytorch==0.1.4 Markdown==3.7 markdown-it-py==3.0.0 MarkupSafe==3.0.2 matplotlib==3.9.0 mdurl==0.1.2 -e git+https://github.com/Nerogar/mgds.git@85bf18746488a898818c36eca651d24734f87431#egg=mgds mkl==2021.4.0 mpmath==1.3.0 multidict==6.1.0 networkx==3.4.2 numpy==1.26.4 omegaconf==2.3.0 onnxruntime-gpu==1.18.0 open-clip-torch==2.24.0 opencv-python==4.9.0.80 packaging==24.1 pillow==10.3.0 platformdirs==4.3.6 pooch==1.8.1 prodigyopt==1.0 propcache==0.2.0 protobuf==4.25.5 psutil==6.1.0 Pygments==2.18.0 pynvml==11.5.0 pyparsing==3.2.0 pyreadline3==3.5.4 python-dateutil==2.9.0.post0 pytorch-lightning==2.2.5 pytorch_optimizer==3.0.2 PyWavelets==1.7.0 PyYAML==6.0.1 regex==2024.9.11 requests==2.32.3 rich==13.9.3 safetensors==0.4.3 scalene==1.5.41 schedulefree==1.2.5 sentencepiece==0.2.0 six==1.16.0 sympy==1.13.3 tbb==2021.13.1 tensorboard==2.17.0 tensorboard-data-server==0.7.2 timm==1.0.11 tokenizers==0.19.1 torch==2.3.1+cu118 torchmetrics==1.5.1 torchvision==0.18.1+cu118 tqdm==4.66.4 transformers==4.42.3 typing_extensions==4.12.2 urllib3==2.2.3 wcwidth==0.2.13 Werkzeug==3.0.6 xformers==0.0.27+cu118 yarl==1.16.0 zipp==3.20.2

nikolaiusa commented 23 hours ago

this solved the problem: pip install transformers==4.42.2