Checklist
Describe the bug
from sglang.srt.layers.linear import ColumnParallelLinear
Traceback (most recent call last):
File "", line 1, in
File "/usr/local/lib/python3.10/dist-packages/sglang/srt/layers/linear.py", line 30, in
from sglang.srt.layers.quantization.base_config import (
File "/usr/local/lib/python3.10/dist-packages/sglang/srt/layers/quantization/init.py", line 52, in
from sglang.srt.layers.linear import LinearBase, UnquantizedLinearMethod
ImportError: cannot import name 'LinearBase' from partially initialized module 'sglang.srt.layers.linear' (most likely due to a circular import) (/usr/local/lib/python3.10/dist-packages/sglang/srt/layers/linear.py)
Reproduction
dockerfile:
install torch.
ENV TORCH_CUDA_ARCH_LIST="8.0"
RUN set -x
&& pip install torch
&& echo "end"
install flashinfer.
RUN set -x
&& git clone -b v0.2.7.post1 --recursive --depth=1 https://github.com/flashinfer-ai/flashinfer.git /usr/local/flashinfer
&& pip install /usr/local/flashinfer --no-build-isolation --verbose
&& echo "end"
install sglang.
RUN set -x
&& pip install sglang[all]>=0.4.9
&& echo "end"
then run docker.
then test with:
[root@e13066a1a980 ~]$ python
Python 3.10.12 (main, Nov 20 2023, 15:14:05) [GCC 11.4.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
from sglang.srt.layers.linear import ColumnParallelLinear
Traceback (most recent call last):
File "", line 1, in
File "/usr/local/lib/python3.10/dist-packages/sglang/srt/layers/linear.py", line 30, in
from sglang.srt.layers.quantization.base_config import (
File "/usr/local/lib/python3.10/dist-packages/sglang/srt/layers/quantization/init.py", line 52, in
from sglang.srt.layers.linear import LinearBase, UnquantizedLinearMethod
ImportError: cannot import name 'LinearBase' from partially initialized module 'sglang.srt.layers.linear' (most likely due to a circular import) (/usr/local/lib/python3.10/dist-packages/sglang/srt/layers/linear.py)
Environment
can reproduced in this docker image: lmsysorg/sglang:v0.4.8.post1-cu126
Checklist
Describe the bug
Reproduction
dockerfile:
install torch.
ENV TORCH_CUDA_ARCH_LIST="8.0"
RUN set -x
&& pip install torch
&& echo "end"
install flashinfer.
RUN set -x
&& git clone -b v0.2.7.post1 --recursive --depth=1 https://github.com/flashinfer-ai/flashinfer.git /usr/local/flashinfer
&& pip install /usr/local/flashinfer --no-build-isolation --verbose
&& echo "end"
install sglang.
RUN set -x
&& pip install sglang[all]>=0.4.9
&& echo "end"
then run docker.
then test with:
[root@e13066a1a980 ~]$ python
Python 3.10.12 (main, Nov 20 2023, 15:14:05) [GCC 11.4.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
Environment
can reproduced in this docker image: lmsysorg/sglang:v0.4.8.post1-cu126