InternLM / InternLM/lmdeploy

[Bug] KeyError: 'Phi3ForCausalLM'

Open
#1,794 6 comments 0 reactions 1 assignee Claimed by @RunningLeon View on GitHub
Dominant language
Python
Stars
8.1k
Forks
748
Avg merge
6d 2h
Merged PRs (30d)
54

Description

### Checklist

- [X] 1. I have searched related issues but cannot get the expected help.
- [x] 2. The bug has not been fixed in the latest version.

### Describe the bug

```
Special tokens have been added in the vocabulary, make sure the associated word embeddings are fine-tuned or trained.
Traceback (most recent call last):
File "/opt/py38/bin/lmdeploy", line 33, in
sys.exit(load_entry_point('lmdeploy', 'console_scripts', 'lmdeploy')())
File "/opt/lmdeploy/lmdeploy/cli/entrypoint.py", line 37, in run
args.run(args)
File "/opt/lmdeploy/lmdeploy/cli/serve.py", line 303, in api_server
run_api_server(args.model_path,
File "/opt/lmdeploy/lmdeploy/serve/openai/api_server.py", line 1197, in serve
VariableInterface.async_engine = pipeline_class(
File "/opt/lmdeploy/lmdeploy/serve/vl_async_engine.py", line 21, in __init__
super().__init__(model_path, **kwargs)
File "/opt/lmdeploy/lmdeploy/serve/async_engine.py", line 200, in __init__
self._build_turbomind(model_path=model_path,
File "/opt/lmdeploy/lmdeploy/serve/async_engine.py", line 247, in _build_turbomind
self.engine = tm.TurboMind.from_pretrained(
File "/opt/lmdeploy/lmdeploy/turbomind/turbomind.py", line 344, in from_pretrained
return cls(model_path=pretrained_model_name_or_path,
File "/opt/lmdeploy/lmdeploy/turbomind/turbomind.py", line 146, in __init__
self.model_comm = self._from_hf(model_source=model_source,
File "/opt/lmdeploy/lmdeploy/turbomind/turbomind.py", line 229, in _from_hf
input_model = INPUT_MODELS.get(input_model_name)(
File "/opt/lmdeploy/lmdeploy/turbomind/deploy/source_model/internvl.py", line 47, in __init__
self.Reader = _readers[arch]
KeyError: 'Phi3ForCausalLM'

```

### Reproduction

```
FROM openmmlab/lmdeploy:latest

RUN apt-get update && apt-get install -y python3 python3-pip git

WORKDIR /app

RUN pip3 uninstall pkg_resources -y
RUN pip3 install --upgrade pip
RUN pip3 install --upgrade setuptools==66.1.1
RUN pip3 uninstall -y ninja && pip3 install ninja
RUN CUDA_HOME=/usr/local/cuda-11.8/ PIP_EXTRA_INDEX_URL=https://download.pytorch.org/whl/cu118 pip3 install timm xformers triton==2.1.0
RUN MAX_JOBS=4 CUDA_HOME=/usr/local/cuda-11.8/ PIP_EXTRA_INDEX_URL=https://download.pytorch.org/whl/cu118 FLASH_ATTENTION_FORCE_BUILD=TRUE pip3 install flash-attn==2.5.2 --no-build-isolation
RUN pip3 install git+https://github.com/haotian-liu/LLaVA.git --no-deps

COPY . .

CMD ["lmdeploy", "serve", "api_server", "OpenGVLab/InternVL-Chat-V1-5"]
```

```
docker build - < Dockerfile.internalvl -t internalvl
```

```
docker run -d --restart=always --runtime nvidia --gpus '"device=4"' \
-v $HOME/.cache/huggingface:/root/.cache/huggingface \
--env "HUGGING_FACE_HUB_TOKEN=$HUGGING_FACE_HUB_TOKEN" \
-p 5001:23333 \
--ipc=host \
--name mini-internvl-chat-4b_lmdeploy \
internalvl \
lmdeploy serve api_server OpenGVLab/Mini-InternVL-Chat-4B-V1-5 --model-name OpenGVLab/Mini-InternVL-Chat-4B-V1-5
```

### Environment

```Shell
ubuntu 22 docker
```

### Error traceback

_No response_

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.