sglang icon indicating copy to clipboard operation
sglang copied to clipboard

Import Errors occurring even when dependencies are installed

Open david-vectorflow opened this issue 1 year ago • 2 comments

I am unable to create a Runtime with sglang as follows runtime = sgl.Runtime(model_path=MODEL_DIR, tokenizer_path=MODEL_DIR). It throws the error below:

ImportError: cannot import name '_set_default_torch_dtype' from 'vllm.model_executor.model_loader' 
(/usr/local/lib/python3.10/dist-packages/vllm/model_executor/model_loader/__init__.py)

I am running this on an A100 with the Nvidia PyTorch base image recommended by the Flash Attention repo ("nvcr.io/nvidia/pytorch:24.03-py3"). I have confirmed via print statements that all the dependencies are installing in the desired location and the files are actually there. I have tried installing sglang both with pip and from source and get the exact same error.

I noticed that not every package in the file structure has an __init__.py file, which can cause issues. Perhaps the version of PyTorch in the base image conflicts somehow with what sglang expects? Aside from that, I am not sure why this is happening. But given how simple this code is, I suspect there is an issue with the library, not the machine.

david-vectorflow avatar Apr 29 '24 22:04 david-vectorflow

Look here: https://github.com/sgl-project/sglang/issues/391

nikita-lukashevich1 avatar May 01 '24 09:05 nikita-lukashevich1

Thanks! Looks like it still isn't solved though?

david-vectorflow avatar May 01 '24 15:05 david-vectorflow

This issue has been automatically closed due to inactivity. Please feel free to reopen it if needed.

github-actions[bot] avatar Jul 25 '24 06:07 github-actions[bot]