kohya-ss / kohya-ss/sd-scripts

AttributeError: module 'torch.optim.lr_scheduler' has no attribute 'constant_with_warmup'

Open
#1,345 0 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

Hello, when I train the image data, I obtain the mistake:AttributeError: module 'torch.optim.lr_scheduler' has no attribute 'constant_with_warmup'.
The command is that: accelerate launch --num_cpu_threads_per_process 1 train_network.py --pretrained_model_name_or_path=./models/realisian_v50.safetensors --dataset_config=./toml/Ulterman.toml --output_dir=./output --output_name=ulterman --save_model_as=safetensors --prior_loss_weight=1.0 --max_train_steps=400 --learning_rate=1e-4 --optimizer_type="AdamW8bit" --xformers --mixed_precision="fp16" --cache_latents --gradient_checkpointing --save_every_n_epochs=2 --network_module=networks.lora
torch==2.0.1

Contributor guide

No contributing guide indexed for this repository

Research direction

Start with train_network.py and reproduce the reported command using torch==2.0.1, focusing on where the learning-rate scheduler is selected. Compare the available torch.optim.lr_scheduler API with the requested constant_with_warmup scheduler; done means training starts without this AttributeError.

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
Needs clarification
Newbie friendliness
30/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.