| 385 | |
| 386 | |
| 387 | def parse_args(): |
| 388 | parser = argparse.ArgumentParser( |
| 389 | description="Script to train Stable Diffusion XL for InstructPix2Pix." |
| 390 | ) |
| 391 | parser.add_argument( |
| 392 | "--pretrained_model_name_or_path", |
| 393 | type=str, |
| 394 | default=None, |
| 395 | required=True, |
| 396 | help="Path to pretrained model or model identifier from huggingface.co/models.", |
| 397 | ) |
| 398 | parser.add_argument( |
| 399 | "--revision", |
| 400 | type=str, |
| 401 | default=None, |
| 402 | required=False, |
| 403 | help="Revision of pretrained model identifier from huggingface.co/models.", |
| 404 | ) |
| 405 | |
| 406 | parser.add_argument( |
| 407 | "--num_frames", |
| 408 | type=int, |
| 409 | default=14, |
| 410 | ) |
| 411 | parser.add_argument( |
| 412 | "--dataset_type", |
| 413 | type=str, |
| 414 | default='ubc', |
| 415 | ) |
| 416 | parser.add_argument( |
| 417 | "--num_validation_images", |
| 418 | type=int, |
| 419 | default=1, |
| 420 | help="Number of images that should be generated during validation with `validation_prompt`.", |
| 421 | ) |
| 422 | parser.add_argument( |
| 423 | "--validation_steps", |
| 424 | type=int, |
| 425 | default=500, |
| 426 | help=( |
| 427 | "Run fine-tuning validation every X epochs. The validation process consists of running the text/image prompt" |
| 428 | " multiple times: `args.num_validation_images`." |
| 429 | ), |
| 430 | ) |
| 431 | parser.add_argument( |
| 432 | "--output_dir", |
| 433 | type=str, |
| 434 | default="./outputs", |
| 435 | help="The output directory where the model predictions and checkpoints will be written.", |
| 436 | ) |
| 437 | parser.add_argument( |
| 438 | "--seed", type=int, default=None, help="A seed for reproducible training." |
| 439 | ) |
| 440 | parser.add_argument( |
| 441 | "--per_gpu_batch_size", |
| 442 | type=int, |
| 443 | default=1, |
| 444 | help="Batch size (per device) for the training dataloader.", |