kohya-ss / kohya-ss/sd-scripts

LoHAの学習時にエラーが出る

Open
#563 2 comments 0 reactions 0 assignees View on GitHub
Dominant language
Python
Stars
7.2k
Forks
1.2k
Avg merge
11m
Merged PRs (30d)
2

Description

LoHaを学習させようとすると学習直前に次のエラーが出て止まります。
`Traceback (most recent call last):
File "/content/sd-scripts/train_network.py", line 864, in
train(args)
File "/content/sd-scripts/train_network.py", line 214, in train
network = network_module.create_network(
File "/usr/local/lib/python3.10/dist-packages/lycoris/kohya.py", line 26, in create_network
dropout = float(kwargs.get('dropout', 0.))
TypeError: float() argument must be a string or a real number, not 'NoneType'
╭───────────────────── Traceback (most recent call last) ──────────────────────╮
│ /content/sd-scripts/train_network.py:864 in │
│ │
│ 861 │ args = parser.parse_args() │
│ 862 │ args = train_util.read_config_from_file(args, parser) │
│ 863 │ │
│ ❱ 864 │ train(args) │
│ 865 │
│ │
│ /content/sd-scripts/train_network.py:214 in train │
│ │
│ 211 │ │ network, _ = network_module.create_network_from_weights(1, arg │
│ 212 │ else: │
│ 213 │ │ # LyCORIS will work with this... │
│ ❱ 214 │ │ network = network_module.create_network( │
│ 215 │ │ │ 1.0, args.network_dim, args.network_alpha, vae, text_encod │
│ 216 │ │ ) │
│ 217 │ if network is None: │
│ │
│ /usr/local/lib/python3.10/dist-packages/lycoris/kohya.py:26 in │
│ create_network │
│ │
│ 23 │ │ network_dim = 4 # default │
│ 24 │ conv_dim = int(kwargs.get('conv_dim', network_dim)) │
│ 25 │ conv_alpha = float(kwargs.get('conv_alpha', network_alpha)) │
│ ❱ 26 │ dropout = float(kwargs.get('dropout', 0.)) │
│ 27 │ algo = kwargs.get('algo', 'lora') │
│ 28 │ use_cp = (not kwargs.get('disable_conv_cp', True) │
│ 29 │ │ │ or kwargs.get('use_conv_cp', False)) │
╰──────────────────────────────────────────────────────────────────────────────╯
TypeError: float() argument must be a string or a real number, not 'NoneType'
╭───────────────────── Traceback (most recent call last) ──────────────────────╮
│ /usr/local/bin/accelerate:8 in │
│ │
│ 5 from accelerate.commands.accelerate_cli import main │
│ 6 if __name__ == '__main__': │
│ 7 │ sys.argv[0] = re.sub(r'(-script\.pyw|\.exe)?$', '', sys.argv[0]) │
│ ❱ 8 │ sys.exit(main()) │
│ 9 │
│ │
│ /usr/local/lib/python3.10/dist-packages/accelerate/commands/accelerate_cli.p │
│ y:45 in main │
│ │
│ 42 │ │ exit(1) │
│ 43 │ │
│ 44 │ # Run │
│ ❱ 45 │ args.func(args) │
│ 46 │
│ 47 │
│ 48 if __name__ == "__main__": │
│ │
│ /usr/local/lib/python3.10/dist-packages/accelerate/commands/launch.py:1104 │
│ in launch_command │
│ │
│ 1101 │ elif defaults is not None and defaults.compute_environment == Com │
│ 1102 │ │ sagemaker_launcher(defaults, args) │
│ 1103 │ else: │
│ ❱ 1104 │ │ simple_launcher(args) │
│ 1105 │
│ 1106 │
│ 1107 def main(): │
│ │
│ /usr/local/lib/python3.10/dist-packages/accelerate/commands/launch.py:567 in │
│ simple_launcher │
│ │
│ 564 │ process = subprocess.Popen(cmd, env=current_env) │
│ 565 │ process.wait() │
│ 566 │ if process.returncode != 0: │
│ ❱ 567 │ │ raise subprocess.CalledProcessError(returncode=process.return │
│ 568 │
│ 569 │
│ 570 def multi_gpu_launcher(args): │
╰──────────────────────────────────────────────────────────────────────────────╯
CalledProcessError: Command '['/usr/bin/python3', 'sd-scripts/train_network.py',
'--pretrained_model_name_or_path=kubanemil/AnyLORA',
'--dataset_config=/content/kohya-mydatasets/datasets/suc.toml',
'--network_dim=4', '--network_alpha=1',
'--output_dir=/content/drive/MyDrive/loras/suc_loha_0.0039',
'--lr_scheduler=cosine_with_restarts', '--lr_scheduler_num_cycles=2',
'--learning_rate=0.0039', '--output_name=suc_loha_0.0039',
'--prior_loss_weight=1.0', '--seed=42', '--max_train_epochs=10',
'--optimizer_type=AdamW8bit', '--optimizer_args', 'weight_decay=1e-1',
'betas=0.9,0.99', '--max_grad_norm=1.0', '--mixed_precision=fp16', '--xformers',
'--gradient_checkpointing', '--save_precision=fp16',
'--sample_every_n_epochs=1',
'--sample_prompts=/content/kohya-mydatasets/datasets/suc.txt',
'--save_model_as=safetensors', '--color_aug', '--bucket_no_upscale',
'--log_with=wandb', '--wandb_api_key=a156eaf006b4bb38f565d4938684c66f0da523fa',
'--network_module=lycoris.kohya', '--network_args', 'conv_dim=4',
'conv_alpha=1', 'algo=loha', '--max_token_length=150', '--logging_dir=logs',
'--noise_offset=0.05', '--adaptive_noise_scale=0.05', '--clip_skip=2',
'--min_snr_gamma=5']' returned non-zero exit status 1.`

画像ファイルには破損は見られませんでした

Contributor guide

No contributing guide indexed for this repository

Research direction

Start with sd-scripts/train_network.py around train() and the network_module.create_network call, then inspect the reported lycoris/kohya.py create_network entry point and the supplied network_args. Reproduce the failure without exposing the credentials in the command, and consider the issue done when LoHa training passes network creation without the NoneType conversion error.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
machine-learning
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.