Skip to content

Commit 3c27fbd

Browse files
committed
Fix SD Tokenizer
1 parent f3b8ce8 commit 3c27fbd

File tree

1 file changed

+6
-4
lines changed

1 file changed

+6
-4
lines changed

optimum/exporters/openvino/__main__.py

+6-4
Original file line numberDiff line numberDiff line change
@@ -381,14 +381,16 @@ class StoreAttr(object):
381381
feature_extractor.save_pretrained(output.joinpath("feature_extractor"))
382382

383383
tokenizer = getattr(model, "tokenizer", None)
384-
if convert_tokenizer and tokenizer is not None and is_openvino_tokenizers_available():
384+
if tokenizer is not None:
385385
tokenizer.save_pretrained(output.joinpath("tokenizer"))
386-
export_tokenizer(tokenizer, output)
386+
if convert_tokenizer and is_openvino_tokenizers_available():
387+
export_tokenizer(tokenizer, output)
387388

388389
tokenizer_2 = getattr(model, "tokenizer_2", None)
389-
if convert_tokenizer and tokenizer_2 is not None and is_openvino_tokenizers_available():
390+
if tokenizer_2 is not None:
390391
tokenizer_2.save_pretrained(output.joinpath("tokenizer_2"))
391-
export_tokenizer(tokenizer, output, suffix="_2")
392+
if convert_tokenizer and is_openvino_tokenizers_available():
393+
export_tokenizer(tokenizer, output, suffix="_2")
392394

393395
model.save_config(output)
394396

0 commit comments

Comments
 (0)