[PR #89] [MERGED] change xformers import location #142

Closed
opened 2026-10-26 21:12:37 +00:00 by bsakaguchi · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/deepseek-ai/DeepSeek-VL2/pull/89
Author: @CUHKSZzxy
Created: 2/19/2025
Status: ✅ Merged
Merged: 2/20/2025
Merged by: @StevenLiuWen

Base: main ← Head: optimize-deps


📝 Commits (2)

📊 Changes

1 file changed (+2 additions, -1 deletions)

View changed files

📝 deepseek_vl2/models/siglip_vit.py (+2 -1)

📄 Description

What does this PR do?

Thanks for your great work, we have been working on supporting the DeepSeek-VL2 series on LMDeploy inference engine.

In this PR, we

  1. change the xformers import position

Why is this change needed?

We want to reuse the image processer and configurations from the upstream DeepSeek-VL2 repository while making the 3rd party dependencies as small as possible. Therefore, we install deepseek_vl2 with

pip install git+https://github.com/deepseek-ai/DeepSeek-VL2.git --no-deps

and attempt to reuse the processer and configuration components with the following:

from deepseek_vl2.models.processing_deepseek_vl_v2 import DeepseekVLV2Processor
from deepseek_vl2.models.configuration_deepseek import DeepseekV2Config

The above commands fail since deepseek_vl2/models/__init__.py invokes a bunch of initialization/imports, subsequently requires xformers here, even if we won't use the xformers-related components (only reuse processors and config).

Therefore, we would recommend changing the xformers import position to where it's needed. This modification will facilitate the integration into LMDeploy, while keeping all the functionalities unchanged.

Besides, the attrdict has never been used. May consider removing those unnecessary codes.

Let me know if any changes are needed!


🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/deepseek-ai/DeepSeek-VL2/pull/89 **Author:** [@CUHKSZzxy](https://github.com/CUHKSZzxy) **Created:** 2/19/2025 **Status:** ✅ Merged **Merged:** 2/20/2025 **Merged by:** [@StevenLiuWen](https://github.com/StevenLiuWen) **Base:** `main` ← **Head:** `optimize-deps` --- ### 📝 Commits (2) - [`cf21982`](https://github.com/deepseek-ai/DeepSeek-VL2/commit/cf21982aa5143e9606f2071440abe906a2c45419) optimize lib dependencies - [`b6e557c`](https://github.com/deepseek-ai/DeepSeek-VL2/commit/b6e557c73e284014e835097478c69bface0a0bde) recover attrdict ### 📊 Changes **1 file changed** (+2 additions, -1 deletions) <details> <summary>View changed files</summary> 📝 `deepseek_vl2/models/siglip_vit.py` (+2 -1) </details> ### 📄 Description ### What does this PR do? Thanks for your great work, we have been working on supporting the DeepSeek-VL2 series on [LMDeploy](https://github.com/InternLM/lmdeploy) inference engine. In this PR, we 1. change the `xformers` import position ### Why is this change needed? We want to reuse the image processer and configurations from the upstream DeepSeek-VL2 repository while making the 3rd party dependencies as small as possible. Therefore, we install deepseek_vl2 with ``` pip install git+https://github.com/deepseek-ai/DeepSeek-VL2.git --no-deps ``` and attempt to reuse the processer and configuration components with the following: ``` from deepseek_vl2.models.processing_deepseek_vl_v2 import DeepseekVLV2Processor from deepseek_vl2.models.configuration_deepseek import DeepseekV2Config ``` The above commands fail since `deepseek_vl2/models/__init__.py` invokes a bunch of initialization/imports, subsequently requires `xformers ` [ here](https://github.com/deepseek-ai/DeepSeek-VL2/blob/main/deepseek_vl2/models/siglip_vit.py#L16), even if we won't use the xformers-related components (only reuse processors and config). Therefore, we would recommend changing the `xformers` import position to where it's needed. This modification will facilitate the integration into [LMDeploy](https://github.com/InternLM/lmdeploy), while keeping all the functionalities unchanged. Besides, the `attrdict` has never been used. May consider removing those unnecessary codes. Let me know if any changes are needed! --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
bsakaguchi 2026-10-26 21:12:37 +00:00
Sign in to join this conversation.
No labels
pull-request
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
deepseek-ai/DeepSeek-VL2#142
No description provided.