| 75 | MODEL_TYPES = tuple(conf.model_type for conf in MODEL_CONFIG_CLASSES) |
| 76 | |
| 77 | def parse_args(): |
| 78 | parser = argparse.ArgumentParser(description="Finetune a transformers model on a causal language modeling task") |
| 79 | parser.add_argument( |
| 80 | "--dataset_name", |
| 81 | type=str, |
| 82 | default=None, |
| 83 | help="The name of the dataset to use (via the datasets library).", |
| 84 | ) |
| 85 | parser.add_argument( |
| 86 | "--dataset_config_name", |
| 87 | type=str, |
| 88 | default=None, |
| 89 | help="The configuration name of the dataset to use (via the datasets library).", |
| 90 | ) |
| 91 | parser.add_argument( |
| 92 | "--dataset_split_name", |
| 93 | type=str, |
| 94 | default="test", |
| 95 | ) |
| 96 | parser.add_argument( |
| 97 | "--train_file", type=str, default=None, help="A csv, txt or a json file containing the training data." |
| 98 | ) |
| 99 | parser.add_argument( |
| 100 | "--validation_file", type=str, default=None, help="A csv, txt or a json file containing the validation data." |
| 101 | ) |
| 102 | parser.add_argument( |
| 103 | "--validation_split_percentage", |
| 104 | default=5, |
| 105 | help="The percentage of the train set used as validation set in case there's no validation split", |
| 106 | ) |
| 107 | parser.add_argument( |
| 108 | "--model_name_or_path", |
| 109 | type=str, |
| 110 | help="Path to pretrained model or model identifier from huggingface.co/models.", |
| 111 | required=False, |
| 112 | ) |
| 113 | parser.add_argument( |
| 114 | "--config_name", |
| 115 | type=str, |
| 116 | default=None, |
| 117 | help="Pretrained config name or path if not the same as model_name", |
| 118 | ) |
| 119 | parser.add_argument( |
| 120 | "--tokenizer_name", |
| 121 | type=str, |
| 122 | default=None, |
| 123 | help="Pretrained tokenizer name or path if not the same as model_name", |
| 124 | ) |
| 125 | parser.add_argument( |
| 126 | "--use_slow_tokenizer", |
| 127 | action="store_true", |
| 128 | help="If passed, will use a slow tokenizer (not backed by the 🤗 Tokenizers library).", |
| 129 | ) |
| 130 | parser.add_argument( |
| 131 | "--per_device_train_batch_size", |
| 132 | type=int, |
| 133 | default=8, |
| 134 | help="Batch size (per device) for the training dataloader.", |