@@ -135,7 +135,7 @@ def _model_candidates(self) -> List[Dict[str, Any]]:
135
135
chinese_finetune_models = hp .choice (
136
136
"finetune_models" ,
137
137
[
138
- "ernie-1.0-large-zh-cw" # 24-layer, 1024-hidden, 16-heads, 272M parameters.
138
+ "ernie-1.0-large-zh-cw" , # 24-layer, 1024-hidden, 16-heads, 272M parameters.
139
139
"ernie-3.0-xbase-zh" , # 20-layer, 1024-hidden, 16-heads, 296M parameters.
140
140
"ernie-3.0-tiny-base-v2-zh" , # 12-layer, 768-hidden, 12-heads, 118M parameters.
141
141
"ernie-3.0-tiny-medium-v2-zh" , # 6-layer, 768-hidden, 12-heads, 75M parameters.
@@ -152,7 +152,6 @@ def _model_candidates(self) -> List[Dict[str, Any]]:
152
152
"roberta-large" , # 24-layer, 1024-hidden, 16-heads, 334M parameters. Case-sensitive
153
153
"roberta-base" , # 12-layer, 768-hidden, 12-heads, 110M parameters. Case-sensitive
154
154
"distilroberta-base" , # 6-layer, 768-hidden, 12-heads, 66M parameters. Case-sensitive
155
- "ernie-3.0-tiny-mini-v2-en" , # 6-layer, 384-hidden, 12-heads, 27M parameters
156
155
"ernie-2.0-base-en" , # 12-layer, 768-hidden, 12-heads, 103M parameters. Trained on lower-cased English text.
157
156
"ernie-2.0-large-en" , # 24-layer, 1024-hidden, 16-heads, 336M parameters. Trained on lower-cased English text.
158
157
],
@@ -523,7 +522,9 @@ def export(self, export_path, trial_id=None):
523
522
trainer .export_model (export_path )
524
523
trainer .model .plm .save_pretrained (os .path .join (export_path , "plm" ))
525
524
mode = "prompt"
526
- max_length = model_config .get ("PreprocessArguments.max_length" , 128 )
525
+ max_length = model_config .get (
526
+ "PreprocessArguments.max_length" , trainer .model .plm .config .max_position_embeddings
527
+ )
527
528
else :
528
529
if trainer .model .init_config ["init_class" ] in ["ErnieMForSequenceClassification" ]:
529
530
input_spec = [paddle .static .InputSpec (shape = [None , None ], dtype = "int64" , name = "input_ids" )]
@@ -534,7 +535,9 @@ def export(self, export_path, trial_id=None):
534
535
]
535
536
export_model (model = trainer .model , input_spec = input_spec , path = export_path )
536
537
mode = "finetune"
537
- max_length = trainer .model .config .max_position_embeddings
538
+ max_length = model_config .get (
539
+ "PreprocessArguments.max_length" , trainer .model .config .max_position_embeddings
540
+ )
538
541
539
542
# save tokenizer
540
543
trainer .tokenizer .save_pretrained (export_path )
@@ -553,7 +556,7 @@ def export(self, export_path, trial_id=None):
553
556
with open (os .path .join (export_path , "taskflow_config.json" ), "w" , encoding = "utf-8" ) as f :
554
557
json .dump (taskflow_config , f , ensure_ascii = False )
555
558
logger .info (
556
- f"taskflow config saved to { export_path } . You can use the taskflow config to create a Taskflow instance for inference"
559
+ f"Taskflow config saved to { export_path } . You can use the Taskflow config to create a Taskflow instance for inference"
557
560
)
558
561
559
562
if os .path .exists (self .training_path ):
0 commit comments