| 54 | MODEL_TYPES = tuple(conf.model_type for conf in MODEL_CONFIG_CLASSES) |
| 55 | |
| 56 | def parse_args(): |
| 57 | parser = argparse.ArgumentParser(description="Finetune a transformers model on a causal language modeling task") |
| 58 | parser.add_argument( |
| 59 | "--dataset_name", |
| 60 | type=str, |
| 61 | default=None, |
| 62 | help="The name of the dataset to use (via the datasets library).", |
| 63 | ) |
| 64 | parser.add_argument( |
| 65 | "--dataset_config_name", |
| 66 | type=str, |
| 67 | default=None, |
| 68 | help="The configuration name of the dataset to use (via the datasets library).", |
| 69 | ) |
| 70 | parser.add_argument( |
| 71 | "--dataset_split_name", |
| 72 | type=str, |
| 73 | default="test", |
| 74 | ) |
| 75 | parser.add_argument( |
| 76 | "--train_file", type=str, default=None, help="A csv, txt or a json file containing the training data." |
| 77 | ) |
| 78 | parser.add_argument( |
| 79 | "--validation_file", type=str, default=None, help="A csv, txt or a json file containing the validation data." |
| 80 | ) |
| 81 | parser.add_argument( |
| 82 | "--validation_split_percentage", |
| 83 | default=5, |
| 84 | help="The percentage of the train set used as validation set in case there's no validation split", |
| 85 | ) |
| 86 | parser.add_argument( |
| 87 | "--model_name_or_path", |
| 88 | type=str, |
| 89 | help="Path to pretrained model or model identifier from huggingface.co/models.", |
| 90 | required=False, |
| 91 | ) |
| 92 | parser.add_argument( |
| 93 | "--config_name", |
| 94 | type=str, |
| 95 | default=None, |
| 96 | help="Pretrained config name or path if not the same as model_name", |
| 97 | ) |
| 98 | parser.add_argument( |
| 99 | "--tokenizer_name", |
| 100 | type=str, |
| 101 | default=None, |
| 102 | help="Pretrained tokenizer name or path if not the same as model_name", |
| 103 | ) |
| 104 | parser.add_argument( |
| 105 | "--use_slow_tokenizer", |
| 106 | action="store_true", |
| 107 | help="If passed, will use a slow tokenizer (not backed by the 🤗 Tokenizers library).", |
| 108 | ) |
| 109 | parser.add_argument( |
| 110 | "--per_device_train_batch_size", |
| 111 | type=int, |
| 112 | default=8, |
| 113 | help="Batch size (per device) for the training dataloader.", |