FazBrowse GitHub Viewer
|
Trending
|
URL:
|
Home
Tools:
[Download Repo ZIP]
[View Raw Code]
[Original HTTPS Page]
ControlNet/tutorial_train.py at main · kindsof/ControlNet · GitHub
kindsof
/
ControlNet
Public
forked from
lllyasviel/ControlNet
Notifications
You must be signed in to change notification settings
Fork
0
Star
0
Code
Pull requests
0
Actions
Projects
Security and quality
0
Insights
Additional navigation options
Code
Pull requests
Actions
Projects
Security and quality
Insights
Expand file tree
Breadcrumbs
ControlNet
/
tutorial_train.py
Copy path
More file actions
More file actions
Latest commit
History
History
History
35 lines (26 loc) · 961 Bytes
Breadcrumbs
ControlNet
/
tutorial_train.py
Copy path
File metadata and controls
35 lines (26 loc) · 961 Bytes
Raw
Copy raw file
Download raw file
Open symbols panel
Edit and raw actions
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
from
share
import
*
import
pytorch_lightning
as
pl
from
torch
.
utils
.
data
import
DataLoader
from
tutorial_dataset
import
MyDataset
from
cldm
.
logger
import
ImageLogger
from
cldm
.
model
import
create_model
,
load_state_dict
# Configs
resume_path
=
'./models/control_sd15_ini.ckpt'
batch_size
=
4
logger_freq
=
300
learning_rate
=
1e-5
sd_locked
=
True
only_mid_control
=
False
# First use cpu to load models. Pytorch Lightning will automatically move it to GPUs.
model
=
create_model
(
'./models/cldm_v15.yaml'
).
cpu
()
model
.
load_state_dict
(
load_state_dict
(
resume_path
,
location
=
'cpu'
))
model
.
learning_rate
=
learning_rate
model
.
sd_locked
=
sd_locked
model
.
only_mid_control
=
only_mid_control
# Misc
dataset
=
MyDataset
()
dataloader
=
DataLoader
(
dataset
,
num_workers
=
0
,
batch_size
=
batch_size
,
shuffle
=
True
)
logger
=
ImageLogger
(
batch_frequency
=
logger_freq
)
trainer
=
pl
.
Trainer
(
gpus
=
1
,
precision
=
32
,
callbacks
=
[
logger
])
# Train!
trainer
.
fit
(
model
,
dataloader
)
Back
|
FazBrowse Home
|
New Git URL