kohya-ss / sd-scripts

Apache License 2.0
5.13k stars 855 forks source link

SDXL LORA training error #702

Closed gurilagardnr closed 1 year ago

gurilagardnr commented 1 year ago

prepare optimizer, data loader etc. ╭─────────────────────────────── Traceback (most recent call last) ────────────────────────────────╮ │ G:\kohya_ss\sdxl_train_network.py:174 in │ │ │ │ 171 │ args = train_util.read_config_from_file(args, parser) │ │ 172 │ │ │ 173 │ trainer = SdxlNetworkTrainer() │ │ ❱ 174 │ trainer.train(args) │ │ 175 │ │ │ │ G:\kohya_ss\train_network.py:325 in train │ │ │ │ 322 │ │ │ ) │ │ 323 │ │ │ trainable_params = network.prepare_optimizer_params(args.text_encoder_lr, ar │ │ 324 │ │ │ │ ❱ 325 │ │ optimizer_name, optimizer_args, optimizer = train_util.get_optimizer(args, train │ │ 326 │ │ │ │ 327 │ │ # dataloaderを準備する │ │ 328 │ │ # DataLoaderのプロセス数:0はメインプロセスになる │ │ │ │ G:\kohya_ss\library\train_util.py:3167 in get_optimizer │ │ │ │ 3164 │ if args.optimizer_args is not None and len(args.optimizer_args) > 0: │ │ 3165 │ │ for arg in args.optimizer_args: │ │ 3166 │ │ │ key, value = arg.split("=") │ │ ❱ 3167 │ │ │ value = ast.literal_eval(value) │ │ 3168 │ │ │ │ │ 3169 │ │ │ # value = value.split(",") │ │ 3170 │ │ │ # for i in range(len(value)): │ │ │ │ C:\Program Files\Python310\lib\ast.py:108 in literal_eval │ │ │ │ 105 │ │ │ │ else: │ │ 106 │ │ │ │ │ return left - right │ │ 107 │ │ return _convert_signed_num(node) │ │ ❱ 108 │ return _convert(node_or_string) │ │ 109 │ │ 110 │ │ 111 def dump(node, annotate_fields=True, include_attributes=False, *, indent=None): │ │ │ │ C:\Program Files\Python310\lib\ast.py:107 in _convert │ │ │ │ 104 │ │ │ │ │ return left + right │ │ 105 │ │ │ │ else: │ │ 106 │ │ │ │ │ return left - right │ │ ❱ 107 │ │ return _convert_signed_num(node) │ │ 108 │ return _convert(node_or_string) │ │ 109 │ │ 110 │ │ │ │ C:\Program Files\Python310\lib\ast.py:81 in _convert_signed_num │ │ │ │ 78 │ │ │ │ return + operand │ │ 79 │ │ │ else: │ │ 80 │ │ │ │ return - operand │ │ ❱ 81 │ │ return _convert_num(node) │ │ 82 │ def _convert(node): │ │ 83 │ │ if isinstance(node, Constant): │ │ 84 │ │ │ return node.value │ │ │ │ C:\Program Files\Python310\lib\ast.py:72 in _convert_num │ │ │ │ 69 │ │ raise ValueError(msg + f': {node!r}') │ │ 70 │ def _convert_num(node): │ │ 71 │ │ if not isinstance(node, Constant) or type(node.value) not in (int, float, comple │ │ ❱ 72 │ │ │ _raise_malformed_node(node) │ │ 73 │ │ return node.value │ │ 74 │ def _convert_signed_num(node): │ │ 75 │ │ if isinstance(node, UnaryOp) and isinstance(node.op, (UAdd, USub)): │ │ │ │ C:\Program Files\Python310\lib\ast.py:69 in _raise_malformed_node │ │ │ │ 66 │ │ msg = "malformed node or string" │ │ 67 │ │ if lno := getattr(node, 'lineno', None): │ │ 68 │ │ │ msg += f' on line {lno}' │ │ ❱ 69 │ │ raise ValueError(msg + f': {node!r}') │ │ 70 │ def _convert_num(node): │ │ 71 │ │ if not isinstance(node, Constant) or type(node.value) not in (int, float, comple │ │ 72 │ │ │ _raise_malformed_node(node) │ ╰──────────────────────────────────────────────────────────────────────────────────────────────────╯ ValueError: malformed node or string on line 1: <ast.Name object at 0x00000226F8CBA920> ╭─────────────────────────────── Traceback (most recent call last) ────────────────────────────────╮ │ C:\Program Files\Python310\lib\runpy.py:196 in _run_module_as_main │ │ │ │ 193 │ main_globals = sys.modules["main"].dict │ │ 194 │ if alter_argv: │ │ 195 │ │ sys.argv[0] = mod_spec.origin │ │ ❱ 196 │ return _run_code(code, main_globals, None, │ │ 197 │ │ │ │ │ "main", mod_spec) │ │ 198 │ │ 199 def run_module(mod_name, init_globals=None, │ │ │ │ C:\Program Files\Python310\lib\runpy.py:86 in _run_code │ │ │ │ 83 │ │ │ │ │ loader = loader, │ │ 84 │ │ │ │ │ package = pkg_name, │ │ 85 │ │ │ │ │ spec = mod_spec) │ │ ❱ 86 │ exec(code, run_globals) │ │ 87 │ return run_globals │ │ 88 │ │ 89 def _run_module_code(code, init_globals=None, │ │ │ │ in :7 │ │ │ │ 4 from accelerate.commands.accelerate_cli import main │ │ 5 if name == 'main': │ │ 6 │ sys.argv[0] = re.sub(r'(-script.pyw|.exe)?$', '', sys.argv[0]) │ │ ❱ 7 │ sys.exit(main()) │ │ 8 │ │ │ │ G:\kohya_ss\venv\lib\site-packages\accelerate\commands\accelerate_cli.py:45 in main │ │ │ │ 42 │ │ exit(1) │ │ 43 │ │ │ 44 │ # Run │ │ ❱ 45 │ args.func(args) │ │ 46 │ │ 47 │ │ 48 if name == "main": │ │ │ │ G:\kohya_ss\venv\lib\site-packages\accelerate\commands\launch.py:918 in launch_command │ │ │ │ 915 │ elif defaults is not None and defaults.compute_environment == ComputeEnvironment.AMA │ │ 916 │ │ sagemaker_launcher(defaults, args) │ │ 917 │ else: │ │ ❱ 918 │ │ simple_launcher(args) │ │ 919 │ │ 920 │ │ 921 def main(): │ │ │ │ G:\kohya_ss\venv\lib\site-packages\accelerate\commands\launch.py:580 in simple_launcher │ │ │ │ 577 │ process.wait() │ │ 578 │ if process.returncode != 0: │ │ 579 │ │ if not args.quiet: │ │ ❱ 580 │ │ │ raise subprocess.CalledProcessError(returncode=process.returncode, cmd=cmd) │ │ 581 │ │ else: │ │ 582 │ │ │ sys.exit(1) │ │ 583 │ ╰──────────────────────────────────────────────────────────────────────────────────────────────────╯ CalledProcessError: Command '['G:\kohya_ss\venv\Scripts\python.exe', './sdxl_train_network.py', '--enable_bucket', '--min_bucket_reso=768', '--max_bucket_reso=2048', '--pretrained_model_name_or_path=K:/Stable Diffusion/stable-diffusion-webui/models/Stable-diffusion/sd_xl_base_1.0_0.9vae.safetensors', '--train_data_dir=J:/SDXL-LORA/img', '--resolution=1024,1024', '--output_dir=J:/SDXL-LORA/model', '--logging_dir=J:/SDXL-LORA/log', '--network_alpha=1', '--save_model_as=safetensors', '--network_module=networks.lora', '--text_encoder_lr=0.0004', '--unet_lr=0.0004', '--network_dim=128', '--output_name=pbglam-v1', '--lr_scheduler_num_cycles=5', '--no_half_vae', '--learning_rate=0.0004', '--lr_scheduler=constant', '--train_batch_size=1', '--max_train_steps=5000', '--save_every_n_epochs=1', '--mixed_precision=bf16', '--save_precision=bf16', '--seed=1234', '--caption_extension=.txt', '--cache_latents', '--cache_latents_to_disk', '--optimizer_type=Adafactor', '--optimizer_args', 'scale_parameter=false', 'relative_step=false', 'warmup_init=false', '--max_data_loader_n_workers=0', '--bucket_reso_steps=64', '--xformers', '--bucket_no_upscale', '--noise_offset=0.0325']' returned non-zero exit status 1.

gurilagardnr commented 1 year ago

Resolved error by leaving caption extension field blank