@@ -71,6 +71,7 @@ def main_export(
71
71
compression_option : Optional [str ] = None ,
72
72
compression_ratio : Optional [float ] = None ,
73
73
stateful : bool = True ,
74
+ convert_tokenizer : bool = False ,
74
75
** kwargs_shapes ,
75
76
):
76
77
"""
@@ -344,7 +345,7 @@ class StoreAttr(object):
344
345
generation_config .save_pretrained (output )
345
346
maybe_save_preprocessors (model_name_or_path , output )
346
347
347
- if tokenizer is not None and is_openvino_tokenizers_available ():
348
+ if convert_tokenizer and tokenizer is not None and is_openvino_tokenizers_available ():
348
349
try :
349
350
export_tokenizer (tokenizer , output )
350
351
except Exception as exception :
@@ -380,12 +381,12 @@ class StoreAttr(object):
380
381
feature_extractor .save_pretrained (output .joinpath ("feature_extractor" ))
381
382
382
383
tokenizer = getattr (model , "tokenizer" , None )
383
- if tokenizer is not None and is_openvino_tokenizers_available ():
384
+ if convert_tokenizer and tokenizer is not None and is_openvino_tokenizers_available ():
384
385
tokenizer .save_pretrained (output .joinpath ("tokenizer" ))
385
386
export_tokenizer (tokenizer , output )
386
387
387
388
tokenizer_2 = getattr (model , "tokenizer_2" , None )
388
- if tokenizer_2 is not None and is_openvino_tokenizers_available ():
389
+ if convert_tokenizer and tokenizer_2 is not None and is_openvino_tokenizers_available ():
389
390
tokenizer_2 .save_pretrained (output .joinpath ("tokenizer_2" ))
390
391
export_tokenizer (tokenizer , output , suffix = "_2" )
391
392
0 commit comments