TorchServe KeyError
See original GitHub issueDiscussed in https://github.com/open-mmlab/mmdetection/discussions/9200
<div type='discussions-op-text'>Originally posted by austinmw October 31, 2022
Hi, I used MMDetection 3.0.0rc2 to train a Deformable DETR model and a Faster RCNN model, and then I used the mmdet2torchserve tool to create two model.mar
. I tried testing local deployment with my own TorchServe Dockerfile, but I get errors with both of the TorchServe archives:
KeyError: "class
DeformableDETR
in mmdet/models/detectors/deformable_detr.py: 'DetDataPreprocessor is not in the model registry. Please check whether the value ofDetDataPreprocessor
is correct or it was registered as expected.
and
KeyError: "class
FasterRCNN
in mmdet/models/detectors/faster_rcnn.py: 'DetDataPreprocessor is not in the model registry. Please check whether the value ofDetDataPreprocessor
is correct or it was registered as expected.
My Dockerfile looks like this:
# Use Sagemaker PyTorch inference container as base image
ARG REGION
FROM 763104351884.dkr.ecr.${REGION}.amazonaws.com/pytorch-inference:1.12.1-gpu-py38-cu113-ubuntu20.04-sagemaker
# Install MMEngine, MMCV, MMDetection
WORKDIR /opt/ml/code
RUN pip install cython nvgpu && \
pip install -U pip openmim torch-model-archiver && \
pip install git+https://github.com/open-mmlab/mmengine.git@v0.2.0 && \
mim install "mmcv>=2.0.0rc2" -f https://download.openmmlab.com/mmcv/dist/cu113/torch1.12.0/index.html && \
pip install git+https://github.com/open-mmlab/mmdetection.git@v3.0.0rc2 && \
rm -rf /var/lib/apt/lists/*
COPY config.properties /home/model-server/config.properties
WORKDIR /
ENTRYPOINT ["python", "/usr/local/bin/dockerd-entrypoint.py"]
CMD ["torchserve", "--start", "--ts-config", "/home/model-server/config.properties", "--model-store", "/opt/ml/model"]
I placed the model.mar
s into /opt/ml/model
.
Anyone know how to resolve this KeyError? Is mmdet_handler.py
compatible with v3.0.0rc2
?
Issue Analytics
- State:
- Created 10 months ago
- Comments:5 (1 by maintainers)
Top GitHub Comments
Hi, torchserve is not included in mmdeploy. Deployment for torchserve would be kept in mmdet. As for the error, it’s because of the BC-breaking of mmdet2.x and mmdet3.x. A fixing of this would come later.
Hi, thanks for response, okay I’ll see if I can get it working for PR, otherwise can wait till official 3.0 release