|
80 | 80 | "import platform\n", |
81 | 81 | "from pathlib import Path\n", |
82 | 82 | "\n", |
83 | | - "if not Path(\"ov_ace_helper.py\").exists():\n", |
84 | | - " r = requests.get(url=\"https://raw.githubusercontent.com/openvinotoolkit/openvino_notebooks/latest/notebooks/ace-step-music-generation/ov_ace_helper.py\")\n", |
85 | | - " open(\"ov_ace_helper.py\", \"w\").write(r.text)\n", |
| 83 | + "if not Path(\"ov_ace_helper_test.py\").exists():\n", |
| 84 | + " r = requests.get(url=\"https://raw.githubusercontent.com/openvinotoolkit/openvino_notebooks/latest/notebooks/ace-step-music-generation/ov_ace_helper_test.py\")\n", |
| 85 | + " open(\"ov_ace_helper_test.py\", \"w\").write(r.text)\n", |
86 | 86 | "\n", |
87 | 87 | "if not Path(\"gradio_helper.py\").exists():\n", |
88 | 88 | " r = requests.get(url=\"https://raw.githubusercontent.com/openvinotoolkit/openvino_notebooks/latest/notebooks/ace-step-music-generation/gradio_helper.py\")\n", |
|
390 | 390 | }, |
391 | 391 | { |
392 | 392 | "cell_type": "code", |
393 | | - "execution_count": 9, |
| 393 | + "execution_count": null, |
394 | 394 | "id": "f9db0d8a", |
395 | 395 | "metadata": {}, |
396 | 396 | "outputs": [ |
|
420 | 420 | ], |
421 | 421 | "source": [ |
422 | 422 | "import nncf\n", |
423 | | - "from ov_ace_helper import convert_models\n", |
424 | 423 | "\n", |
425 | 424 | "if model_format.value == \"INT4\":\n", |
426 | 425 | " weights_compression_config = {\"mode\": nncf.CompressWeightsMode.INT4_ASYM, \"group_size\": 128, \"ratio\": 0.8}\n", |
427 | 426 | "elif model_format.value == \"INT8\":\n", |
428 | 427 | " weights_compression_config = {\"mode\": nncf.CompressWeightsMode.INT8_ASYM}\n", |
429 | 428 | "else:\n", |
430 | | - " weights_compression_config = None\n", |
| 429 | + " weights_compression_config = None" |
| 430 | + ] |
| 431 | + }, |
| 432 | + { |
| 433 | + "cell_type": "code", |
| 434 | + "execution_count": null, |
| 435 | + "id": "c004eb47", |
| 436 | + "metadata": {}, |
| 437 | + "outputs": [], |
| 438 | + "source": [ |
| 439 | + "from ov_ace_helper_test import convert_text_encoder\n", |
431 | 440 | "\n", |
432 | 441 | "ov_converted_model_dir = \"ov_models\"\n", |
433 | | - "convert_models(pipeline, model_dir=ov_converted_model_dir, orig_checkpoint_path=checkpoint_dir, quantization_config=weights_compression_config)" |
| 442 | + "convert_text_encoder(pipeline, model_dir=ov_converted_model_dir, orig_checkpoint_path=checkpoint_dir, quantization_config=weights_compression_config)" |
| 443 | + ] |
| 444 | + }, |
| 445 | + { |
| 446 | + "cell_type": "code", |
| 447 | + "execution_count": null, |
| 448 | + "id": "0b44aa58", |
| 449 | + "metadata": {}, |
| 450 | + "outputs": [], |
| 451 | + "source": [ |
| 452 | + "from ov_ace_helper_test import convert_tokenizer_ov\n", |
| 453 | + "\n", |
| 454 | + "convert_tokenizer_ov(pipeline, model_dir=ov_converted_model_dir, orig_checkpoint_path=checkpoint_dir, quantization_config=weights_compression_config)" |
| 455 | + ] |
| 456 | + }, |
| 457 | + { |
| 458 | + "cell_type": "code", |
| 459 | + "execution_count": null, |
| 460 | + "id": "d1f41973", |
| 461 | + "metadata": {}, |
| 462 | + "outputs": [], |
| 463 | + "source": [ |
| 464 | + "from ov_ace_helper_test import convert_vocoder\n", |
| 465 | + "\n", |
| 466 | + "convert_vocoder(pipeline, model_dir=ov_converted_model_dir, orig_checkpoint_path=checkpoint_dir, quantization_config=weights_compression_config)" |
| 467 | + ] |
| 468 | + }, |
| 469 | + { |
| 470 | + "cell_type": "code", |
| 471 | + "execution_count": null, |
| 472 | + "id": "d23e1ba9", |
| 473 | + "metadata": {}, |
| 474 | + "outputs": [], |
| 475 | + "source": [ |
| 476 | + "from ov_ace_helper_test import convert_transformer_models\n", |
| 477 | + "\n", |
| 478 | + "convert_transformer_models(pipeline, model_dir=ov_converted_model_dir, orig_checkpoint_path=checkpoint_dir, quantization_config=weights_compression_config)" |
| 479 | + ] |
| 480 | + }, |
| 481 | + { |
| 482 | + "cell_type": "code", |
| 483 | + "execution_count": null, |
| 484 | + "id": "ce5ed806", |
| 485 | + "metadata": {}, |
| 486 | + "outputs": [], |
| 487 | + "source": [ |
| 488 | + "from ov_ace_helper_test import convert_dcae\n", |
| 489 | + "\n", |
| 490 | + "convert_dcae(pipeline, model_dir=ov_converted_model_dir, orig_checkpoint_path=checkpoint_dir, quantization_config=weights_compression_config)" |
434 | 491 | ] |
435 | 492 | }, |
436 | 493 | { |
|
469 | 526 | }, |
470 | 527 | { |
471 | 528 | "cell_type": "code", |
472 | | - "execution_count": 11, |
| 529 | + "execution_count": null, |
473 | 530 | "id": "a3d15fff", |
474 | 531 | "metadata": {}, |
475 | 532 | "outputs": [], |
476 | 533 | "source": [ |
477 | | - "from ov_ace_helper import OVACEStepPipeline\n", |
| 534 | + "from ov_ace_helper_test import OVACEStepPipeline\n", |
478 | 535 | "\n", |
479 | 536 | "ov_pipeline = OVACEStepPipeline()\n", |
480 | 537 | "ov_pipeline.load_models(ov_models_path=ov_converted_model_dir, device=device.value)" |
|
705 | 762 | }, |
706 | 763 | { |
707 | 764 | "cell_type": "code", |
708 | | - "execution_count": 18, |
| 765 | + "execution_count": null, |
709 | 766 | "id": "2f456bc4", |
710 | 767 | "metadata": {}, |
711 | 768 | "outputs": [ |
|
721 | 778 | } |
722 | 779 | ], |
723 | 780 | "source": [ |
724 | | - "from ov_ace_helper import convert_transformer_models\n", |
| 781 | + "from ov_ace_helper_test import convert_transformer_models\n", |
725 | 782 | "\n", |
726 | 783 | "ov_models_lora = \"ov_models_lora\"\n", |
727 | 784 | "\n", |
|
0 commit comments