| 250 | |
| 251 | |
| 252 | def parse_args(input_args=None): |
| 253 | parser = argparse.ArgumentParser(description="Simple example of a ControlNet training script.") |
| 254 | parser.add_argument( |
| 255 | "--pretrained_model_name_or_path", |
| 256 | type=str, |
| 257 | default=None, |
| 258 | required=True, |
| 259 | help="Path to pretrained model or model identifier from huggingface.co/models.", |
| 260 | ) |
| 261 | parser.add_argument( |
| 262 | "--controlnet_model_name_or_path", |
| 263 | type=str, |
| 264 | default=None, |
| 265 | help="Path to pretrained controlnet model or model identifier from huggingface.co/models." |
| 266 | " If not specified controlnet weights are initialized from unet.", |
| 267 | ) |
| 268 | parser.add_argument( |
| 269 | "--revision", |
| 270 | type=str, |
| 271 | default=None, |
| 272 | required=False, |
| 273 | help="Revision of pretrained model identifier from huggingface.co/models.", |
| 274 | ) |
| 275 | parser.add_argument( |
| 276 | "--variant", |
| 277 | type=str, |
| 278 | default=None, |
| 279 | help="Variant of the model files of the pretrained model identifier from huggingface.co/models, 'e.g.' fp16", |
| 280 | ) |
| 281 | parser.add_argument( |
| 282 | "--tokenizer_name", |
| 283 | type=str, |
| 284 | default=None, |
| 285 | help="Pretrained tokenizer name or path if not the same as model_name", |
| 286 | ) |
| 287 | parser.add_argument( |
| 288 | "--output_dir", |
| 289 | type=str, |
| 290 | default="controlnet-model", |
| 291 | help="The output directory where the model predictions and checkpoints will be written.", |
| 292 | ) |
| 293 | parser.add_argument( |
| 294 | "--cache_dir", |
| 295 | type=str, |
| 296 | default=None, |
| 297 | help="The directory where the downloaded models and datasets will be stored.", |
| 298 | ) |
| 299 | parser.add_argument("--seed", type=int, default=None, help="A seed for reproducible training.") |
| 300 | parser.add_argument( |
| 301 | "--resolution", |
| 302 | type=int, |
| 303 | default=512, |
| 304 | help=( |
| 305 | "The resolution for input images, all the images in the train/validation dataset will be resized to this" |
| 306 | " resolution" |
| 307 | ), |
| 308 | ) |
| 309 | parser.add_argument( |