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

make sure mistral_common not imported for non-mistral models #12669

Merged
merged 18 commits into from
Feb 3, 2025

Conversation

youkaichao
Copy link
Member

@youkaichao youkaichao commented Feb 3, 2025

When people use deepseek models, they find that they need to solve cv2 version conflict, see https://zhuanlan.zhihu.com/p/21064432691 .

I added the check, and make all imports of cv2 lazy.

Signed-off-by: youkaichao <[email protected]>
Signed-off-by: youkaichao <[email protected]>
Signed-off-by: youkaichao <[email protected]>
Signed-off-by: youkaichao <[email protected]>
Signed-off-by: youkaichao <[email protected]>
Signed-off-by: youkaichao <[email protected]>
Signed-off-by: youkaichao <[email protected]>
Signed-off-by: youkaichao <[email protected]>
Signed-off-by: youkaichao <[email protected]>
Copy link

github-actions bot commented Feb 3, 2025

👋 Hi! Thank you for contributing to the vLLM project.
Just a reminder: PRs would not trigger full CI run by default. Instead, it would only run fastcheck CI which starts running only a small and essential subset of CI tests to quickly catch errors. You can run other CI tests on top of those by going to your fastcheck build on Buildkite UI (linked in the PR checks section) and unblock them. If you do not have permission to unblock, ping simon-mo or khluu to add you in our Buildkite org.

Once the PR is approved and ready to go, your PR reviewer(s) can run CI to test the changes comprehensively before merging.

To run CI, PR reviewers can do one of these:

  • Add ready label to the PR
  • Enable auto-merge.

🚀

@mergify mergify bot added the ci/build label Feb 3, 2025
bos=add_special_tokens,
eos=add_special_tokens)
elif add_special_tokens is not None:
if isinstance(tokenizer, PreTrainedTokenizerBase):
Copy link
Member Author

Choose a reason for hiding this comment

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

switched the if-else so that we don't need to import MistralTokenizer too early.

Signed-off-by: youkaichao <[email protected]>
@DarkLight1337
Copy link
Member

Perhaps we should actually make opencv an optional dependency? @ywang96

@youkaichao
Copy link
Member Author

Perhaps we should actually make opencv an optional dependency? @ywang96

we tried before, but mistral_common is a required dependency, and it's difficult to enforce their behavior.

@DarkLight1337
Copy link
Member

Can we make mistral_common itself optional? For example we can install vllm[mistral] to use Mistral models...

@youkaichao
Copy link
Member Author

Can we make mistral_common itself optional? For example we can install vllm[mistral] to use Mistral models...

I don't think so. Mistral has many quite popular models.

Signed-off-by: youkaichao <[email protected]>
Signed-off-by: youkaichao <[email protected]>
Signed-off-by: youkaichao <[email protected]>
Copy link
Member

@DarkLight1337 DarkLight1337 left a comment

Choose a reason for hiding this comment

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

This solution should work well enough for now, thanks.

Signed-off-by: youkaichao <[email protected]>
Signed-off-by: youkaichao <[email protected]>
Signed-off-by: youkaichao <[email protected]>
Signed-off-by: youkaichao <[email protected]>
Signed-off-by: youkaichao <[email protected]>
@tsaoyu
Copy link

tsaoyu commented Feb 3, 2025

mistral_common 's depedency is a bit ... Casual and Aggressive

Copy link
Member

@ywang96 ywang96 left a comment

Choose a reason for hiding this comment

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

Thanks for the fix! I'm honestly not sure what a better fix would without asking mistral folks for some help so this will do!

@youkaichao
Copy link
Member Author

after this PR, the only place that imports mistral_common is:

from mistral_common.protocol.instruct.messages import ImageChunk

And we lazy import model architecture code.

So it should be fine now, we don't import any mistral_common code for non-mistral model.

@youkaichao youkaichao changed the title [misc] make sure cv2 import does not occur for text models make sure mistral_common not imported for non-mistral models Feb 3, 2025
@youkaichao youkaichao merged commit 20579c0 into vllm-project:main Feb 3, 2025
16 of 19 checks passed
@youkaichao youkaichao deleted the cv2_lazy_import branch February 3, 2025 05:40
sahelib25 pushed a commit to krai/vllm that referenced this pull request Feb 3, 2025
…oject#12669)

When people use deepseek models, they find that they need to solve cv2
version conflict, see https://zhuanlan.zhihu.com/p/21064432691 .

I added the check, and make all imports of `cv2` lazy.

---------

Signed-off-by: youkaichao <[email protected]>
fxmarty-amd pushed a commit to fxmarty-amd/vllm that referenced this pull request Feb 7, 2025
…oject#12669)

When people use deepseek models, they find that they need to solve cv2
version conflict, see https://zhuanlan.zhihu.com/p/21064432691 .

I added the check, and make all imports of `cv2` lazy.

---------

Signed-off-by: youkaichao <[email protected]>
Signed-off-by: Felix Marty <[email protected]>
ShangmingCai pushed a commit to ShangmingCai/vllm that referenced this pull request Feb 10, 2025
…oject#12669)

When people use deepseek models, they find that they need to solve cv2
version conflict, see https://zhuanlan.zhihu.com/p/21064432691 .

I added the check, and make all imports of `cv2` lazy.

---------

Signed-off-by: youkaichao <[email protected]>
panf2333 pushed a commit to yottalabsai/vllm that referenced this pull request Feb 18, 2025
…oject#12669)

When people use deepseek models, they find that they need to solve cv2
version conflict, see https://zhuanlan.zhihu.com/p/21064432691 .

I added the check, and make all imports of `cv2` lazy.

---------

Signed-off-by: youkaichao <[email protected]>
kerthcet pushed a commit to kerthcet/vllm that referenced this pull request Feb 21, 2025
…oject#12669)

When people use deepseek models, they find that they need to solve cv2
version conflict, see https://zhuanlan.zhihu.com/p/21064432691 .

I added the check, and make all imports of `cv2` lazy.

---------

Signed-off-by: youkaichao <[email protected]>
lk-chen pushed a commit to lk-chen/vllm that referenced this pull request Mar 5, 2025
…oject#12669)

When people use deepseek models, they find that they need to solve cv2
version conflict, see https://zhuanlan.zhihu.com/p/21064432691 .

I added the check, and make all imports of `cv2` lazy.

---------

Signed-off-by: youkaichao <[email protected]>
Signed-off-by: Linkun Chen <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants