Skip to content

Commit 2c9d28d

Browse files
committed
Fix DeepSeek-OCR model loading with AutoModel
Switch from AutoModelForCausalLM to AutoModel to properly load DeepSeek-OCR's custom model architecture (DeepseekOCRConfig). This resolves the 'Unrecognized configuration class' error.
1 parent bc0200a commit 2c9d28d

File tree

1 file changed

+2
-2
lines changed
  • clusters/k3s-stpetersburg/apps/ai/kserve

1 file changed

+2
-2
lines changed

clusters/k3s-stpetersburg/apps/ai/kserve/server.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ def load_model():
4646

4747
from PIL import Image as PILImage
4848
import torch as torch_module
49-
from transformers import AutoModelForCausalLM, AutoTokenizer, AutoProcessor
49+
from transformers import AutoModel, AutoTokenizer, AutoProcessor
5050

5151
model_state["Image"] = PILImage
5252
model_state["torch"] = torch_module
@@ -55,7 +55,7 @@ def load_model():
5555

5656
try:
5757
logger.info(f"Loading model from {model_name}...")
58-
model_state["model"] = AutoModelForCausalLM.from_pretrained(
58+
model_state["model"] = AutoModel.from_pretrained(
5959
model_name,
6060
torch_dtype=torch_module.bfloat16,
6161
device_map="auto",

0 commit comments

Comments
 (0)