Adds model-related arguments to an argparser.
(cls, parser)
| 139 | |
| 140 | @classmethod |
| 141 | def _add_parser_args(cls, parser): |
| 142 | """Adds model-related arguments to an argparser.""" |
| 143 | model_group = parser.add_mutually_exclusive_group() |
| 144 | |
| 145 | model_names = list(HUGGINGFACE_MODELS.keys()) + list(TEXTATTACK_MODELS.keys()) |
| 146 | model_group.add_argument( |
| 147 | "--model", |
| 148 | type=str, |
| 149 | required=False, |
| 150 | default=None, |
| 151 | help="Name of or path to a pre-trained TextAttack model to load. Choices: " |
| 152 | + str(model_names), |
| 153 | ) |
| 154 | model_group.add_argument( |
| 155 | "--model-from-file", |
| 156 | type=str, |
| 157 | required=False, |
| 158 | help="File of model and tokenizer to import.", |
| 159 | ) |
| 160 | model_group.add_argument( |
| 161 | "--model-from-huggingface", |
| 162 | type=str, |
| 163 | required=False, |
| 164 | help="Name of or path of pre-trained HuggingFace model to load.", |
| 165 | ) |
| 166 | |
| 167 | return parser |
| 168 | |
| 169 | @classmethod |
| 170 | def _create_model_from_args(cls, args): |
no outgoing calls
no test coverage detected