@@ -140,9 +140,9 @@ def buildDataset(path_file: str, verbose=True) -> EntityHandler:
140
140
sentences , list_of_labels = [], []
141
141
set_entities = set () # set of unique entity found (incrementally updated)
142
142
143
- for field in read_conll (path_file ): # generator
143
+ for fields in read_conll (path_file ): # generator
144
144
145
- tokens , labels = field [0 ], field [1 ]
145
+ tokens , labels = fields [0 ], fields [1 ]
146
146
147
147
sentences .append (" " .join (tokens ))
148
148
list_of_labels .append (" " .join (labels ))
@@ -206,22 +206,33 @@ def random_chars(y):
206
206
207
207
208
208
def parse_args ():
209
- p = argparse .ArgumentParser (description = 'Model configuration.' , add_help = False )
209
+ p = argparse .ArgumentParser (description = 'Model configuration.' , add_help = True )
210
210
211
- p .add_argument ('--datasets' , type = str , nargs = '+' , help = 'Path to the datasets' , default = None )
212
- p . add_argument ( '--models' , type = str , nargs = '+' , help = 'Models in the same order of datasets ' , default = None )
211
+ p .add_argument ('--datasets' , type = str , nargs = '+' ,
212
+ help = 'Dataset used for training, it will split in training, validation and test ' , default = None )
213
213
214
- p .add_argument ('--model_name' , type = str , help = 'Name of trained model' , default = None )
215
- p .add_argument ('--path_model' , type = str , help = 'Directory to save the model' , default = "." )
214
+ p .add_argument ('--models' , type = str , nargs = '+' ,
215
+ help = 'Model trained ready to evaluate or use, if list, the order must follow the same of datasets' ,
216
+ default = None )
216
217
217
- p .add_argument ('--bert' , type = str , help = 'Huggingface model' , default = "dbmdz/bert-base-italian-xxl-cased" )
218
+ p .add_argument ('--model_name' , type = str ,
219
+ help = 'Name to give to a trained model' , default = None )
220
+
221
+ p .add_argument ('--path_model' , type = str ,
222
+ help = 'Directory to save the model' , default = "." )
223
+
224
+ p .add_argument ('--bert' , type = str ,
225
+ help = 'Bert model provided by Huggingface' , default = "dbmdz/bert-base-italian-xxl-cased" )
226
+
227
+ p .add_argument ('--save_model' , type = int ,
228
+ help = 'set 1 if you want save the model otherwise set 0' , default = 1 )
218
229
219
230
p .add_argument ('--lr' , type = float , help = 'Learning rate' , default = 0.010 )
220
231
p .add_argument ('--momentum' , type = float , help = 'Momentum' , default = 0.9 )
221
232
p .add_argument ('--weight_decay' , type = float , help = 'Weight decay' , default = 0.0002 )
222
233
p .add_argument ('--batch_size' , type = int , help = 'Batch size' , default = 2 )
223
234
p .add_argument ('--max_epoch' , type = int , help = 'Max number of epochs' , default = 20 )
224
235
p .add_argument ('--early_stopping' , type = float , help = 'Patience in early stopping' , default = 3 )
225
- p . add_argument ( '--save_model' , type = int , help = '1 to save the model' , default = 1 )
236
+
226
237
227
238
return p .parse_known_args ()
0 commit comments