johnman3032 / simple-lora-dreambooth-trainer

A collection of simple training GUIs for SD1.5 and SDXL.
43 stars 2 forks source link

SDXL Lora training GUI - not starting #1

Open k8kiss opened 8 months ago

k8kiss commented 8 months ago

Hello! I tried a quick test following instructions but the training fails to start: D:\trainsimple>call venv\scripts\activate D:\trainsimple\train_dreambooth_lora_sdxl.py:444: UserWarning: You need not use --class_prompt without --with_prior_preservation. warnings.warn("You need not use --class_prompt without --with_prior_preservation.") D:\trainsimple\venv\lib\site-packages\accelerate\accelerator.py:382: UserWarning: log_with=tensorboard was passed but no supported trackers are currently installed. warnings.warn(f"log_with={log_with} was passed but no supported trackers are currently installed.") 10/19/2023 15:32:58 - INFO - main - Distributed environment: NO Num processes: 1 Process index: 0 Local process index: 0 Device: cuda

Mixed precision type: fp16

Traceback (most recent call last): File "D:\trainsimple\venv\lib\site-packages\huggingface_hub\utils_errors.py", line 261, in hf_raise_for_status response.raise_for_status() File "D:\trainsimple\venv\lib\site-packages\requests\models.py", line 1021, in raise_for_status raise HTTPError(http_error_msg, response=self) requests.exceptions.HTTPError: 401 Client Error: Unauthorized for url: https://huggingface.co/base-model-path-sdxl/sdxl-fp16-only/resolve/main/tokenizer/tokenizer_config.json

The above exception was the direct cause of the following exception:

Traceback (most recent call last): File "D:\trainsimple\venv\lib\site-packages\transformers\utils\hub.py", line 429, in cached_file resolved_file = hf_hub_download( File "D:\trainsimple\venv\lib\site-packages\huggingface_hub\utils_validators.py", line 118, in _inner_fn return fn(*args, *kwargs) File "D:\trainsimple\venv\lib\site-packages\huggingface_hub\file_download.py", line 1346, in hf_hub_download raise head_call_error File "D:\trainsimple\venv\lib\site-packages\huggingface_hub\file_download.py", line 1232, in hf_hub_download metadata = get_hf_file_metadata( File "D:\trainsimple\venv\lib\site-packages\huggingface_hub\utils_validators.py", line 118, in _inner_fn return fn(args, **kwargs) File "D:\trainsimple\venv\lib\site-packages\huggingface_hub\file_download.py", line 1608, in get_hf_file_metadata hf_raise_for_status(r) File "D:\trainsimple\venv\lib\site-packages\huggingface_hub\utils_errors.py", line 293, in hf_raise_for_status raise RepositoryNotFoundError(message, response) from e huggingface_hub.utils._errors.RepositoryNotFoundError: 401 Client Error. (Request ID: Root=1-6531ae9a-0ed3370e1c873c27008dff5e;d984e697-9cb3-49b1-bb96-cb1e3060e76f)

Repository Not Found for url: https://huggingface.co/base-model-path-sdxl/sdxl-fp16-only/resolve/main/tokenizer/tokenizer_config.json. Please make sure you specified the correct repo_id and repo_type. If you are trying to access a private or gated repo, make sure you are authenticated. Invalid username or password.

The above exception was the direct cause of the following exception:

Traceback (most recent call last): File "D:\trainsimple\train_dreambooth_lora_sdxl.py", line 1449, in main(args) File "D:\trainsimple\train_dreambooth_lora_sdxl.py", line 701, in main tokenizer_one = AutoTokenizer.from_pretrained( File "D:\trainsimple\venv\lib\site-packages\transformers\models\auto\tokenization_auto.py", line 701, in from_pretrained tokenizer_config = get_tokenizer_config(pretrained_model_name_or_path, **kwargs) File "D:\trainsimple\venv\lib\site-packages\transformers\models\auto\tokenization_auto.py", line 534, in get_tokenizer_config resolved_config_file = cached_file( File "D:\trainsimple\venv\lib\site-packages\transformers\utils\hub.py", line 450, in cached_file raise EnvironmentError( OSError: base-model-path-sdxl/sdxl-fp16-only is not a local folder and is not a valid model identifier listed on 'https://huggingface.co/models' If this is a private repository, make sure to pass a token having permission to this repo either by logging in with huggingface-cli login or by passing token=<your_token> ['D:\trainsimple\venv\Scripts\python.exe', 'D:\trainsimple\train_dreambooth_lora_sdxl.py', '--pretrained_model_name_or_path', 'base-model-path-sdxl/sdxl-fp16-only', '--instance_data_dir', 'instance-imgs-sdxl', '--instance_prompt', 'scsggxl3080a', '--class_prompt', '1girl', '--output_dir', 'output-path', '--resolution', '1024', '--train_batch_size', '1', '--num_train_epochs', '40', '--gradient_accumulation_steps', '1', '--learning_rate', '0.0001', '--optimizer', 'AdamW', '--lr_scheduler', 'constant', '--lr_warmup_steps', '0', '--mixed_precision', 'fp16', '--prior_generation_precision', 'fp16', '--rank', '4', '--enable_xformers_memory_efficient_attention']

johnman3032 commented 8 months ago

Hello, I think the issue mainly has to do with not having downloaded the SDXL Diffusers model folder, this is done by running "sdxl_model_download.bat". Just using your own .safetensors model won't work, you'll have to download the Diffusers model using that .bat file.

k8kiss commented 8 months ago

I did complete that step and can confirm that the folder and contents are there. Can't figure out what the issue might be

johnman3032 commented 8 months ago

I did complete that step and can confirm that the folder and contents are there. Can't figure out what the issue might be

I see what the issue is, the folder is not properly being recognized because I used "_" instead of "-". Have you tried to select the "sdxl_fp16_only" folder using "Browse" ?

k8kiss commented 8 months ago

Did you fix this in the source? I haven't tried an update. I believe I tried the manual path, but will check again

johnman3032 commented 8 months ago

Yes I have fixed it, it should work now. Make sure that you have GIT-LFS installed, otherwise it won't be able to download the large model files from Huggingface.

k8kiss commented 8 months ago

That's great news! I still need to update and try again. I didn't have any problems with the Huggingface downloads, the SDXL is about 13 gigs.. correct? Also, another question: If I want to test some other models for both SD1.5 and SDXL that I have locally, how can I convert those to Diffusers for training? Is there a code that can do that? I would like to try for both SD1.5 and SDXL

Many thanks for the great support!

johnman3032 commented 7 months ago

That's great news! I still need to update and try again. I didn't have any problems with the Huggingface downloads, the SDXL is about 13 gigs.. correct? Also, another question: If I want to test some other models for both SD1.5 and SDXL that I have locally, how can I convert those to Diffusers for training? Is there a code that can do that? I would like to try for both SD1.5 and SDXL

Many thanks for the great support!

Conversion to "diffusers" format is more difficult, you would need the "diffusers" repo from https://github.com/huggingface/diffusers You need some entry-level experience with Python, you also need to work with CMD. Navigate to "scripts", you will see two Python scripts called "convert_diffusers_to_original_sdxl.py" and "convert_diffusers_to_original_stable_diffusion.py", these convert SDXL/SD1.5 models to diffusers format. But it is a more complicated operation. My experience has shown to me that using custom models for training does not necessarily improve the quality of the model.