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