| 310 | |
| 311 | |
| 312 | def parse_args(input_args=None): |
| 313 | parser = argparse.ArgumentParser(description="Simple example of a training script.") |
| 314 | parser.add_argument( |
| 315 | "--pretrained_model_name_or_path", |
| 316 | type=str, |
| 317 | default=None, |
| 318 | required=True, |
| 319 | help="Path to pretrained model or model identifier from huggingface.co/models.", |
| 320 | ) |
| 321 | parser.add_argument( |
| 322 | "--revision", |
| 323 | type=str, |
| 324 | default=None, |
| 325 | required=False, |
| 326 | help="Revision of pretrained model identifier from huggingface.co/models.", |
| 327 | ) |
| 328 | parser.add_argument( |
| 329 | "--tokenizer_name", |
| 330 | type=str, |
| 331 | default=None, |
| 332 | help="Pretrained tokenizer name or path if not the same as model_name", |
| 333 | ) |
| 334 | parser.add_argument( |
| 335 | "--instance_data_dir", |
| 336 | type=str, |
| 337 | default=None, |
| 338 | help="A folder containing the training data of instance images.", |
| 339 | ) |
| 340 | parser.add_argument( |
| 341 | "--class_data_dir", |
| 342 | type=str, |
| 343 | default=None, |
| 344 | required=False, |
| 345 | help="A folder containing the training data of class images.", |
| 346 | ) |
| 347 | parser.add_argument( |
| 348 | "--instance_prompt", |
| 349 | type=str, |
| 350 | default=None, |
| 351 | help="The prompt with identifier specifying the instance", |
| 352 | ) |
| 353 | parser.add_argument( |
| 354 | "--class_prompt", |
| 355 | type=str, |
| 356 | default=None, |
| 357 | help="The prompt to specify images in the same class as provided instance images.", |
| 358 | ) |
| 359 | parser.add_argument( |
| 360 | "--validation_prompt", |
| 361 | type=str, |
| 362 | default=None, |
| 363 | help="A prompt that is used during validation to verify that the model is learning.", |
| 364 | ) |
| 365 | parser.add_argument( |
| 366 | "--num_validation_images", |
| 367 | type=int, |
| 368 | default=4, |
| 369 | help="Number of images that should be generated during validation with `validation_prompt`.", |