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