OneTrainer icon indicating copy to clipboard operation
OneTrainer copied to clipboard

[Bug]: File "E:\OneTrainer\modules\trainer\GenericTrainer.py", line 798, in end self.model.to(self.temp_device) AttributeError: 'NoneType' object has no attribute 'to'

Open IL3DCR opened this issue 1 year ago • 1 comments

What happened?

Hi boss, Im trying to run this for the first time and this error massage dont let me continue with the run, Any ideas?

activating venv E:\OneTrainer\venv Using Python "E:\OneTrainer\venv\Scripts\python.exe" Checking Python version... Python 3.10.11

Warning: Deprecated Python version found. Update to 3.11.0 or newer Starting UI... Clearing cache directory E:/ComfyUi/output/00.GPT waifus/hacker/dataset/entrenamiento/cache! You can disable this if you want to continue using the same cache. E:\OneTrainer\venv\lib\site-packages\tensorboard\default.py:30: UserWarning: pkg_resources is deprecated as an API. See https://setuptools.pypa.io/en/latest/pkg_resources.html. The pkg_resources package is slated for removal as early as 2025-11-30. Refrain from using this package or pin to Setuptools<81. import pkg_resources Fetching 17 files: 100%|███████████████████████████████████████████████████████████████████████| 17/17 [00:00<?, ?it/s] Loading pipeline components...: 57%|█████████████████████████████▋ | 4/7 [00:00<00:00, 10.16it/s]TensorFlow installation not found - running with reduced feature set. Loading pipeline components...: 100%|████████████████████████████████████████████████████| 7/7 [00:02<00:00, 3.28it/s] Serving TensorBoard on localhost; to expose to the network, use a proxy or pass --bind_all TensorBoard 2.19.0 at http://localhost:6006/ (Press CTRL+C to quit) Fetching 17 files: 100%|███████████████████████████████████████████████████████████████████████| 17/17 [00:00<?, ?it/s] Loading pipeline components...: 100%|████████████████████████████████████████████████████| 7/7 [00:02<00:00, 2.47it/s] Traceback (most recent call last): File "E:\OneTrainer\modules\modelLoader\stableDiffusionXL\StableDiffusionXLModelLoader.py", line 244, in load self.__load_internal(model, model_type, weight_dtypes, model_names.base_model, model_names.vae_model) File "E:\OneTrainer\modules\modelLoader\stableDiffusionXL\StableDiffusionXLModelLoader.py", line 53, in __load_internal raise Exception("not an internal model") Exception: not an internal model

Traceback (most recent call last): File "E:\OneTrainer\modules\modelLoader\stableDiffusionXL\StableDiffusionXLModelLoader.py", line 250, in load self.__load_diffusers(model, model_type, weight_dtypes, model_names.base_model, model_names.vae_model) File "E:\OneTrainer\modules\modelLoader\stableDiffusionXL\StableDiffusionXLModelLoader.py", line 63, in __load_diffusers tokenizer_1 = CLIPTokenizer.from_pretrained( File "E:\OneTrainer\venv\lib\site-packages\transformers\tokenization_utils_base.py", line 1890, in from_pretrained raise ValueError( ValueError: Calling CLIPTokenizer.from_pretrained() with the path to a single file or url is not supported for this tokenizer. Use a model identifier or the path to a directory instead.

Traceback (most recent call last): File "E:\OneTrainer\venv\src\diffusers\src\diffusers\configuration_utils.py", line 441, in load_config config_dict = cls._dict_from_json_file(config_file, dduf_entries=dduf_entries) File "E:\OneTrainer\venv\src\diffusers\src\diffusers\configuration_utils.py", line 571, in _dict_from_json_file text = reader.read() File "D:\Programas y cosas sin importancia\Python310\lib\codecs.py", line 322, in decode (result, consumed) = self._buffer_decode(data, self.errors, final) UnicodeDecodeError: 'utf-8' codec can't decode byte 0xa2 in position 25704: invalid start byte

During handling of the above exception, another exception occurred:

Traceback (most recent call last): File "E:\OneTrainer\modules\modelLoader\stableDiffusionXL\StableDiffusionXLModelLoader.py", line 256, in load self.__load_safetensors(model, model_type, weight_dtypes, model_names.base_model, model_names.vae_model) File "E:\OneTrainer\modules\modelLoader\stableDiffusionXL\StableDiffusionXLModelLoader.py", line 201, in __load_safetensors vae = self._load_diffusers_sub_module( File "E:\OneTrainer\modules\modelLoader\mixin\HFModelLoaderMixin.py", line 202, in _load_diffusers_sub_module config, unused_kwargs, commit_hash = module_type.load_config( File "E:\OneTrainer\venv\lib\site-packages\huggingface_hub\utils_validators.py", line 114, in _inner_fn return fn(*args, **kwargs) File "E:\OneTrainer\venv\src\diffusers\src\diffusers\configuration_utils.py", line 445, in load_config raise EnvironmentError(f"It looks like the config file at '{config_file}' is not a valid JSON file.") OSError: It looks like the config file at 'E:/ComfyUi/models/vae/sdxl_vae.safetensors' is not a valid JSON file.

Traceback (most recent call last): File "E:\OneTrainer\venv\src\diffusers\src\diffusers\configuration_utils.py", line 441, in load_config config_dict = cls._dict_from_json_file(config_file, dduf_entries=dduf_entries) File "E:\OneTrainer\venv\src\diffusers\src\diffusers\configuration_utils.py", line 571, in _dict_from_json_file text = reader.read() File "D:\Programas y cosas sin importancia\Python310\lib\codecs.py", line 322, in decode (result, consumed) = self._buffer_decode(data, self.errors, final) UnicodeDecodeError: 'utf-8' codec can't decode byte 0xa2 in position 25704: invalid start byte

During handling of the above exception, another exception occurred:

Traceback (most recent call last): File "E:\OneTrainer\modules\modelLoader\stableDiffusionXL\StableDiffusionXLModelLoader.py", line 262, in load self.__load_ckpt(model, model_type, weight_dtypes, model_names.base_model, model_names.vae_model) File "E:\OneTrainer\modules\modelLoader\stableDiffusionXL\StableDiffusionXLModelLoader.py", line 151, in __load_ckpt pipeline.vae = AutoencoderKL.from_pretrained( File "E:\OneTrainer\venv\lib\site-packages\huggingface_hub\utils_validators.py", line 114, in _inner_fn return fn(*args, **kwargs) File "E:\OneTrainer\venv\src\diffusers\src\diffusers\models\modeling_utils.py", line 983, in from_pretrained config, unused_kwargs, commit_hash = cls.load_config( File "E:\OneTrainer\venv\lib\site-packages\huggingface_hub\utils_validators.py", line 114, in _inner_fn return fn(*args, **kwargs) File "E:\OneTrainer\venv\src\diffusers\src\diffusers\configuration_utils.py", line 445, in load_config raise EnvironmentError(f"It looks like the config file at '{config_file}' is not a valid JSON file.") OSError: It looks like the config file at 'E:/ComfyUi/models/vae/sdxl_vae.safetensors' is not a valid JSON file.

Traceback (most recent call last): File "E:\OneTrainer\modules\ui\TrainUI.py", line 601, in __training_thread_function trainer.start() File "E:\OneTrainer\modules\trainer\GenericTrainer.py", line 119, in start self.model = self.model_loader.load( File "E:\OneTrainer\modules\modelLoader\StableDiffusionXLLoRAModelLoader.py", line 48, in load base_model_loader.load(model, model_type, model_names, weight_dtypes) File "E:\OneTrainer\modules\modelLoader\stableDiffusionXL\StableDiffusionXLModelLoader.py", line 269, in load raise Exception("could not load model: " + model_names.base_model) Exception: could not load model: I:/SD-Models/checkpoints/illustriousXL_v01.safetensors Exception in thread Thread-3 (__training_thread_function): Traceback (most recent call last): File "D:\Programas y cosas sin importancia\Python310\lib\threading.py", line 1016, in _bootstrap_inner self.run() File "D:\Programas y cosas sin importancia\Python310\lib\threading.py", line 953, in run self._target(*self._args, **self._kwargs) File "E:\OneTrainer\modules\ui\TrainUI.py", line 611, in __training_thread_function trainer.end() File "E:\OneTrainer\modules\trainer\GenericTrainer.py", line 798, in end self.model.to(self.temp_device) AttributeError: 'NoneType' object has no attribute 'to'

What did you expect would happen?

To run the process,

Relevant log output


Generate and upload debug_report.log

No response

IL3DCR avatar Jun 24 '25 02:06 IL3DCR

fixed in https://github.com/Nerogar/OneTrainer/commit/5031626351d98cd1fa0d10add1d516e4e594bac8

dxqb avatar Sep 07 '25 19:09 dxqb