()
| 2 | str2bool = lambda arg: bool(int(arg)) |
| 3 | |
| 4 | def get_parser(): |
| 5 | ## Model |
| 6 | parser = argparse.ArgumentParser(description='Control Net training') |
| 7 | parser.add_argument('--model_config', type=str, default="model_lib/ControlNet/models/cldm_v15_video_appearance.yaml", |
| 8 | help="The path of model config file") |
| 9 | parser.add_argument('--reinit_hint_block', action='store_true', default=False, |
| 10 | help="Re-initialize hint blocks for channel mis-match") |
| 11 | parser.add_argument('--image_size', type =int, default=64) |
| 12 | parser.add_argument('--empty_text_prob', type=float, default=0.1, |
| 13 | help="For cfg, probablity of replacing text to empty seq ") |
| 14 | parser.add_argument('--sd_locked', type =str2bool, default=True, |
| 15 | help='Freeze parameters in original stable-diffusion decoder') |
| 16 | parser.add_argument('--only_mid_control', type =str2bool, default=False, |
| 17 | help='Only control middle blocks') |
| 18 | parser.add_argument('--finetune_attn', action='store_true', default=False, |
| 19 | help='Fine-tune all self-attention layers in UNet') |
| 20 | parser.add_argument('--finetune_all', action='store_true', default=False, |
| 21 | help='Fine-tune all UNet and ControlNet parameters') |
| 22 | parser.add_argument('--finetune_imagecond_unet', action='store_true', default=False, |
| 23 | help='Fine-tune all UNet and image ControlNet parameters') |
| 24 | parser.add_argument('--finetune_control', action='store_true', default=False, |
| 25 | help='Fine-tune Control') |
| 26 | parser.add_argument("--finetune_dual_attn", action='store_true', default=False, help='Fine-tune DualControl') |
| 27 | parser.add_argument("--finetune_mmonly", action='store_true', default=False, |
| 28 | help = "help agumentation sequence control") |
| 29 | parser.add_argument('--control_type', type=str, nargs="+", default=["pose"], |
| 30 | help='The type of conditioning') |
| 31 | parser.add_argument('--control_dropout', type=float, default=0.0, |
| 32 | help='The probability of dropping out control inputs, only applied for multi-control') |
| 33 | parser.add_argument('--depth_bg_threshold', type=float, default=0.0, |
| 34 | help='The threshold of cutting off depth') |
| 35 | parser.add_argument("--control_mode", type=str, default="balance", |
| 36 | help="Set controlnet is more important or balance.") |
| 37 | parser.add_argument('--wonoise', action='store_true', default=False, |
| 38 | help='Use with referenceonly, remove adding noise on reference image') |
| 39 | ## Training |
| 40 | parser.add_argument('--num_workers', type = int, default = 4, |
| 41 | help='total number of workers for dataloaders') |
| 42 | parser.add_argument('--train_batch_size', type = int, default = 1, |
| 43 | help='batch size for each gpu in distributed training') |
| 44 | parser.add_argument('--val_batch_size', type = int, default = 1, |
| 45 | help='batch size for each gpu during inference(must be set to 1)') |
| 46 | parser.add_argument('--lr', type = float, default = 1e-5, |
| 47 | help='learning rate of new params in control net') |
| 48 | parser.add_argument('--lr_sd', type = float, default = 1e-5, |
| 49 | help='learning rate of params from original stable diffusion modules') |
| 50 | parser.add_argument('--weight_decay', type = float, default = 0, |
| 51 | help='weight decay (L2) regularization') |
| 52 | parser.add_argument('--lr_anneal_steps', type = float, default = 0, |
| 53 | help='steps for learning rate annealing') |
| 54 | parser.add_argument('--ema_rate', type = float, default = 0, |
| 55 | help='rate for ema') |
| 56 | parser.add_argument('--num_train_steps', type = int, default = 1000000, |
| 57 | help='number of train steps') |
| 58 | parser.add_argument('--grad_clip_norm', type = float, default = 0.5, |
| 59 | help='grad_clip_norm') |
| 60 | parser.add_argument("--gradient_accumulation_steps", type=int, default=1, |
| 61 | help="Number of updates steps to accumulate before performing a backward/update pass.") |
no outgoing calls
no test coverage detected