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

Update VLM example code in README #1466

Merged
merged 2 commits into from
Jan 7, 2025

Conversation

helena-intel
Copy link
Collaborator

@helena-intel helena-intel commented Jan 2, 2025

Add pipe.start_chat() to VLM example. Without this, inference with several models results in empty outputs.

This can be removed if this will be the default for VLM models, but at the moment, the most basic example should work with supported models.

Also changed printing the VLMDecodedResults to getting the generated text and printing that (see comment from Ilya).

Add pipe.start_chat() to VLM example. Without this, inference with several models results in empty outputs.
@ilya-lavrenov ilya-lavrenov added this to the 2025.0 milestone Jan 4, 2025
@ilya-lavrenov ilya-lavrenov self-assigned this Jan 4, 2025
@@ -133,6 +133,7 @@ from PIL import Image

# Choose GPU instead of CPU in the line below to run the model on Intel integrated or discrete GPU
pipe = ov_genai.VLMPipeline("./InternVL2-1B", "CPU")
pipe.start_chat()

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

BTW, below we have print(pipe.generate(prompt, image=image_data, max_new_tokens=100)) which returns VLMDecodedResults

should we fix it to extract texts[0] from this structure?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks, I added that to this PR. Apparently VLMDecodedResults has a .__str__ method that shows the text so it is not immediately noticeable that this generate method does not actually return the text; I agree it's better to be explicit about this in the example.

Explicitly print result.texts[0] in VLM example
@Wovchena
Copy link
Collaborator

Wovchena commented Jan 7, 2025

build_jenkins

@ilya-lavrenov ilya-lavrenov added this pull request to the merge queue Jan 7, 2025
@ilya-lavrenov ilya-lavrenov removed this pull request from the merge queue due to a manual request Jan 7, 2025
@ilya-lavrenov ilya-lavrenov merged commit 9ac38f0 into openvinotoolkit:master Jan 7, 2025
59 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants