Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add quantization #1773

Merged

Conversation

aleksandr-mokrov
Copy link
Contributor

CVS-129098

Copy link

Check out this pull request on  ReviewNB

See visual diffs & provide feedback on Jupyter Notebooks.


Powered by ReviewNB

@aleksandr-mokrov aleksandr-mokrov marked this pull request as ready for review February 29, 2024 12:49
@aleksandr-mokrov aleksandr-mokrov requested review from a team, apaniukov and itrushkin and removed request for a team February 29, 2024 12:49
Copy link

review-notebook-app bot commented Feb 29, 2024

View / edit / reply to this conversation on ReviewNB

l-bat commented on 2024-02-29T14:30:58Z
----------------------------------------------------------------

Please add section with comparing inference time between FP16 and INT8 pipelines


aleksandr-mokrov commented on 2024-03-04T22:16:00Z
----------------------------------------------------------------

I'm not sure that here is needed any specific function to calculate inference time. Generation an image in the example takes about 1 minute for fp16 model and about 30 seconds for int8 model and the notebook demonstrates it. Renamed Run inference to Run inference and compare inference time.

Copy link

review-notebook-app bot commented Feb 29, 2024

View / edit / reply to this conversation on ReviewNB

l-bat commented on 2024-02-29T14:30:59Z
----------------------------------------------------------------

please fix the link view


aleksandr-mokrov commented on 2024-03-04T22:06:46Z
----------------------------------------------------------------

fixed

Copy link

review-notebook-app bot commented Feb 29, 2024

View / edit / reply to this conversation on ReviewNB

l-bat commented on 2024-02-29T14:31:00Z
----------------------------------------------------------------

Line #7.        def __init__(self, compiled_model, prob: float, data_cache: List[Any] = None):

prob can be removed


aleksandr-mokrov commented on 2024-03-04T22:06:56Z
----------------------------------------------------------------

removed

Copy link

review-notebook-app bot commented Feb 29, 2024

View / edit / reply to this conversation on ReviewNB

l-bat commented on 2024-02-29T14:31:01Z
----------------------------------------------------------------

Line #18.        lcm_pipeline.unet = CompiledModelDecorator(original_unet)


aleksandr-mokrov commented on 2024-03-04T22:07:04Z
----------------------------------------------------------------

fixed

Copy link

review-notebook-app bot commented Feb 29, 2024

View / edit / reply to this conversation on ReviewNB

l-bat commented on 2024-02-29T14:31:02Z
----------------------------------------------------------------

I think it would be better to compare the images side by side. Look at visualize_results in https://github.com/openvinotoolkit/openvino_notebooks/blob/main/notebooks/265-wuerstchen-image-generation/265-wuerstchen-image-generation.ipynb


aleksandr-mokrov commented on 2024-03-04T22:07:14Z
----------------------------------------------------------------

Changed

Copy link

review-notebook-app bot commented Feb 29, 2024

View / edit / reply to this conversation on ReviewNB

l-bat commented on 2024-02-29T14:31:03Z
----------------------------------------------------------------

Please add an option to use quantized model. Look at use_quantized_model option in https://github.com/openvinotoolkit/openvino_notebooks/blob/main/notebooks/265-wuerstchen-image-generation/265-wuerstchen-image-generation.ipynb


aleksandr-mokrov commented on 2024-03-04T22:07:28Z
----------------------------------------------------------------

Added

Copy link

review-notebook-app bot commented Mar 4, 2024

View / edit / reply to this conversation on ReviewNB

eaidova commented on 2024-03-04T05:03:10Z
----------------------------------------------------------------

Line #1.    from openvino.runtime import Core

please align openvino imports with other notebooks


aleksandr-mokrov commented on 2024-03-04T22:07:40Z
----------------------------------------------------------------

Fixed

eaidova commented on 2024-03-05T05:20:09Z
----------------------------------------------------------------

I mean "import openvino as ov"

aleksandr-mokrov commented on 2024-03-05T13:49:12Z
----------------------------------------------------------------

done

Copy link

review-notebook-app bot commented Mar 4, 2024

View / edit / reply to this conversation on ReviewNB

eaidova commented on 2024-03-04T05:03:11Z
----------------------------------------------------------------

Line #16.    def collect_calibration_data(lcm_pipeline) -> List[Dict]:

lcm has no relation to this notebook, such variable name may confuse users, please give more netral naming


aleksandr-mokrov commented on 2024-03-04T22:07:53Z
----------------------------------------------------------------

renamed

Copy link

review-notebook-app bot commented Mar 4, 2024

View / edit / reply to this conversation on ReviewNB

eaidova commented on 2024-03-04T05:03:12Z
----------------------------------------------------------------

Line #5.    logger = logging.getLogger(__name__)

I do not see logger usage in notebook, why do you need to create its instance?


aleksandr-mokrov commented on 2024-03-04T22:08:04Z
----------------------------------------------------------------

removed

@eaidova
Copy link
Collaborator

eaidova commented Mar 4, 2024

@aleksandr-mokrov, I believe this PR should be closed #1703?

Copy link
Contributor Author

fixed


View entire conversation on ReviewNB

Copy link
Contributor Author

removed


View entire conversation on ReviewNB

Copy link
Contributor Author

fixed


View entire conversation on ReviewNB

Copy link
Contributor Author

Changed


View entire conversation on ReviewNB

Copy link
Contributor Author

Added


View entire conversation on ReviewNB

Copy link
Contributor Author

Fixed


View entire conversation on ReviewNB

Copy link
Contributor Author

renamed


View entire conversation on ReviewNB

Copy link
Contributor Author

removed


View entire conversation on ReviewNB

Copy link
Contributor Author

I'm not sure that here is needed any specific function to calculate inference time. Generation an image in the example takes about 1 minute for fp16 model and about 30 seconds for int8 model and the notebook demonstrates it. Renamed Run inference to Run inference and compare inference time.


View entire conversation on ReviewNB

Copy link
Collaborator

eaidova commented Mar 5, 2024

I mean "import openvino as ov"


View entire conversation on ReviewNB

Copy link

review-notebook-app bot commented Mar 5, 2024

View / edit / reply to this conversation on ReviewNB

eaidova commented on 2024-03-05T05:23:25Z
----------------------------------------------------------------

Line #115.            btn.click(fn=predict, inputs=[image, reference, seed, steps, use_quantize_model], outputs=[image_out],)

I think model selection should be before running otherwise it maybe big memory cost having 2 compiled models or even pipelines during generation)


aleksandr-mokrov commented on 2024-03-05T13:51:03Z
----------------------------------------------------------------

I added a multiselector. Unused pipeline is deleted.

Copy link
Contributor Author

done


View entire conversation on ReviewNB

Copy link
Contributor Author

I added a multiselector. Unused pipeline is deleted.


View entire conversation on ReviewNB

Copy link

review-notebook-app bot commented Mar 6, 2024

View / edit / reply to this conversation on ReviewNB

eaidova commented on 2024-03-06T05:20:18Z
----------------------------------------------------------------

Line #3.    if to_quantize.value:

I think it is better to check that int8 model files exists instead of this flag. if notebook will be used just as demo, there is no need to quantize model every run, but using it in demo still possible


aleksandr-mokrov commented on 2024-03-06T16:40:19Z
----------------------------------------------------------------

Changed. Now it is possible to choose pipeline for demo, run demo, stop demo and choose another pipeline.

Copy link

review-notebook-app bot commented Mar 6, 2024

View / edit / reply to this conversation on ReviewNB

eaidova commented on 2024-03-06T05:20:19Z
----------------------------------------------------------------

Line #63.        pipeline = ov_pipe_inpaint if not use_quantize_model else int8_ov_pipe_inpaint

it seems for me that this line will not work after removing one from pipelines. I recommend to not provide flag inside function, but use pipeline variable that will be equal to int8 or fp16 pipeline in place where you remove pipe that is not used anymore.


aleksandr-mokrov commented on 2024-03-06T16:40:36Z
----------------------------------------------------------------

removed

Copy link
Contributor Author

Changed. Now it is possible to choose pipeline for demo, run demo, stop demo and choose another pipeline.


View entire conversation on ReviewNB

Copy link
Contributor Author

removed


View entire conversation on ReviewNB

@eaidova eaidova merged commit 286382a into openvinotoolkit:main Mar 7, 2024
14 of 15 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants