| 198 | |
| 199 | |
| 200 | def parse_args(): |
| 201 | parser = argparse.ArgumentParser(description="Simple example of a training script.") |
| 202 | parser.add_argument( |
| 203 | "--input_perturbation", type=float, default=0, help="The scale of input perturbation. Recommended 0.1." |
| 204 | ) |
| 205 | parser.add_argument( |
| 206 | "--pretrained_model_name_or_path", |
| 207 | type=str, |
| 208 | default=None, |
| 209 | required=True, |
| 210 | help="Path to pretrained model or model identifier from huggingface.co/models.", |
| 211 | ) |
| 212 | parser.add_argument( |
| 213 | "--revision", |
| 214 | type=str, |
| 215 | default=None, |
| 216 | required=False, |
| 217 | help="Revision of pretrained model identifier from huggingface.co/models.", |
| 218 | ) |
| 219 | parser.add_argument( |
| 220 | "--variant", |
| 221 | type=str, |
| 222 | default=None, |
| 223 | help="Variant of the model files of the pretrained model identifier from huggingface.co/models, 'e.g.' fp16", |
| 224 | ) |
| 225 | parser.add_argument( |
| 226 | "--dataset_name", |
| 227 | type=str, |
| 228 | default=None, |
| 229 | help=( |
| 230 | "The name of the Dataset (from the HuggingFace hub) to train on (could be your own, possibly private," |
| 231 | " dataset). It can also be a path pointing to a local copy of a dataset in your filesystem," |
| 232 | " or to a folder containing files that 🤗 Datasets can understand." |
| 233 | ), |
| 234 | ) |
| 235 | parser.add_argument( |
| 236 | "--dataset_config_name", |
| 237 | type=str, |
| 238 | default=None, |
| 239 | help="The config of the Dataset, leave as None if there's only one config.", |
| 240 | ) |
| 241 | parser.add_argument( |
| 242 | "--train_data_dir", |
| 243 | type=str, |
| 244 | default=None, |
| 245 | help=( |
| 246 | "A folder containing the training data. Folder contents must follow the structure described in" |
| 247 | " https://huggingface.co/docs/datasets/image_dataset#imagefolder. In particular, a `metadata.jsonl` file" |
| 248 | " must exist to provide the captions for the images. Ignored if `dataset_name` is specified." |
| 249 | ), |
| 250 | ) |
| 251 | parser.add_argument( |
| 252 | "--image_column", type=str, default="image", help="The column of the dataset containing an image." |
| 253 | ) |
| 254 | parser.add_argument( |
| 255 | "--caption_column", |
| 256 | type=str, |
| 257 | default="text", |