Skip to content

Commit 405b6ee

Browse files
committed
more printing
1 parent 83509a9 commit 405b6ee

1 file changed

Lines changed: 10 additions & 3 deletions

File tree

demos/common/export_models/export_model.py

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -436,11 +436,13 @@ def export_text_generation_model(model_repository_path, source_model, model_name
436436
print("Using default quantization parameters for NPU: --sym --ratio 1.0 --group-size -1")
437437
task_parameters['extra_quantization_params'] = "--sym --ratio 1.0 --group-size -1"
438438
optimum_command = "optimum-cli export openvino --model {} --weight-format {} {} --trust-remote-code {}".format(source_model, precision, task_parameters['extra_quantization_params'], llm_model_path)
439+
print('Running command: ', optimum_command) # for debug purposes
439440
if os.system(optimum_command):
440441
raise ValueError("Failed to export llm model", source_model)
441442
if not (os.path.isfile(os.path.join(llm_model_path, 'openvino_detokenizer.xml'))):
442443
print("Tokenizer and detokenizer not found in the exported model. Exporting tokenizer and detokenizer from HF model")
443444
convert_tokenizer_command = f"convert_tokenizer --with-detokenizer --trust-remote-code -o {llm_model_path} {source_model}"
445+
print('Running command: ', convert_tokenizer_command) # for debug purposes
444446
if os.system(convert_tokenizer_command):
445447
raise ValueError("Failed to export tokenizer and detokenizer", source_model)
446448
### Export draft model for speculative decoding
@@ -465,6 +467,7 @@ def export_text_generation_model(model_repository_path, source_model, model_name
465467
print("Using eagle3 option for the draft model export")
466468
additional_options += " --task text-generation-with-past"
467469
optimum_command = "optimum-cli export openvino --model {} --weight-format {} --trust-remote-code {} {}".format(draft_source_model, precision, additional_options, draft_llm_model_path)
470+
print('Running command: ', optimum_command) # for debug purposes
468471
if os.system(optimum_command):
469472
raise ValueError("Failed to export llm model", source_model)
470473

@@ -515,12 +518,12 @@ def export_embeddings_model_ov(model_repository_path, source_model, model_name,
515518
print("Exporting embeddings model to ",destination_path)
516519
if not os.path.isdir(destination_path) or args['overwrite_models']:
517520
optimum_command = "optimum-cli export openvino --model {} --disable-convert-tokenizer --task feature-extraction --weight-format {} {} --trust-remote-code {}".format(source_model, precision, task_parameters['extra_quantization_params'], destination_path)
518-
print('Running command:', optimum_command) # for debug purposes
521+
print('Running command: ', optimum_command) # for debug purposes
519522
if os.system(optimum_command):
520523
raise ValueError("Failed to export embeddings model", source_model)
521524
print("Exporting tokenizer to ", destination_path)
522525
convert_tokenizer_command = "convert_tokenizer -o {} {} {}".format(destination_path, source_model, set_max_context_length)
523-
print('Running command:', convert_tokenizer_command) # for debug purposes
526+
print('Running command: ', convert_tokenizer_command) # for debug purposes
524527
if (os.system(convert_tokenizer_command)):
525528
raise ValueError("Failed to export tokenizer model", source_model)
526529
gtemplate = jinja2.Environment(loader=jinja2.BaseLoader).from_string(embedding_graph_ov_template)
@@ -535,6 +538,7 @@ def export_text2speech_model(model_repository_path, source_model, model_name, pr
535538
print("Exporting text2speech model to ",destination_path)
536539
if not os.path.isdir(destination_path) or args['overwrite_models']:
537540
optimum_command = "optimum-cli export openvino --model {} --weight-format {} --trust-remote-code --model-kwargs \"{{\\\"vocoder\\\": \\\"{}\\\"}}\" {}".format(source_model, precision, task_parameters['vocoder'], destination_path)
541+
print('Running command: ', optimum_command) # for debug purposes
538542
if os.system(optimum_command):
539543
raise ValueError("Failed to export text2speech model", source_model)
540544
gtemplate = jinja2.Environment(loader=jinja2.BaseLoader).from_string(t2s_graph_template)
@@ -549,6 +553,7 @@ def export_speech2text_model(model_repository_path, source_model, model_name, pr
549553
print("Exporting speech2text model to ",destination_path)
550554
if not os.path.isdir(destination_path) or args['overwrite_models']:
551555
optimum_command = "optimum-cli export openvino --model {} --weight-format {} --trust-remote-code {}".format(source_model, precision, destination_path)
556+
print('Running command: ', optimum_command) # for debug purposes
552557
if os.system(optimum_command):
553558
raise ValueError("Failed to export speech2text model", source_model)
554559
gtemplate = jinja2.Environment(loader=jinja2.BaseLoader).from_string(s2t_graph_template)
@@ -563,6 +568,7 @@ def export_rerank_model_ov(model_repository_path, source_model, model_name, prec
563568
print("Exporting rerank model to ",destination_path)
564569
if not os.path.isdir(destination_path) or args['overwrite_models']:
565570
optimum_command = "optimum-cli export openvino --model {} --disable-convert-tokenizer --task text-classification --weight-format {} {} --trust-remote-code {}".format(source_model, precision, task_parameters['extra_quantization_params'], destination_path)
571+
print('Running command: ', optimum_command) # for debug purposes
566572
if os.system(optimum_command):
567573
raise ValueError("Failed to export rerank model", source_model)
568574
print("Exporting tokenizer to ", destination_path)
@@ -589,6 +595,7 @@ def export_rerank_model(model_repository_path, source_model, model_name, precisi
589595
print("Exporting rerank model to ",embeddings_path)
590596
if not os.path.isdir(embeddings_path) or args['overwrite_models']:
591597
optimum_command = "optimum-cli export openvino --disable-convert-tokenizer --model {} --task text-classification --weight-format {} {} --trust-remote-code {}".format(source_model, precision, task_parameters['extra_quantization_params'], tmpdirname)
598+
print('Running command: ', optimum_command) # for debug purposes
592599
if os.system(optimum_command):
593600
raise ValueError("Failed to export rerank model", source_model)
594601
set_rt_info(tmpdirname, 'openvino_model.xml', 'config.json')
@@ -625,7 +632,7 @@ def export_image_generation_model(model_repository_path, source_model, model_nam
625632
print("Model index file already exists. Skipping conversion, re-generating graph only.")
626633
else:
627634
optimum_command = "optimum-cli export openvino --model {} --weight-format {} {} {}".format(source_model, precision, task_parameters['extra_quantization_params'], target_path)
628-
print(f'optimum cli command: {optimum_command}')
635+
print('Running command: ', optimum_command) # for debug purposes
629636
if os.system(optimum_command):
630637
raise ValueError("Failed to export image generation model", source_model)
631638

0 commit comments

Comments
 (0)