Fix GLM-4V processor registration when glm_ocr is unavailable (#18885)
This commit is contained in:
@@ -3,7 +3,6 @@ from typing import List, Union
|
||||
from sglang.srt.layers.rotary_embedding import MRotaryEmbedding
|
||||
from sglang.srt.models.glm4v import Glm4vForConditionalGeneration
|
||||
from sglang.srt.models.glm4v_moe import Glm4vMoeForConditionalGeneration
|
||||
from sglang.srt.models.glm_ocr import GlmOcrForConditionalGeneration
|
||||
from sglang.srt.multimodal.processors.base_processor import (
|
||||
BaseMultimodalProcessor as SGLangBaseProcessor,
|
||||
)
|
||||
@@ -11,12 +10,21 @@ from sglang.srt.multimodal.processors.base_processor import (
|
||||
MultimodalSpecialTokens,
|
||||
)
|
||||
|
||||
try:
|
||||
from sglang.srt.models.glm_ocr import GlmOcrForConditionalGeneration
|
||||
except ImportError:
|
||||
GlmOcrForConditionalGeneration = None
|
||||
|
||||
|
||||
class Glm4vImageProcessor(SGLangBaseProcessor):
|
||||
models = [
|
||||
Glm4vForConditionalGeneration,
|
||||
Glm4vMoeForConditionalGeneration,
|
||||
GlmOcrForConditionalGeneration,
|
||||
m
|
||||
for m in [
|
||||
Glm4vForConditionalGeneration,
|
||||
Glm4vMoeForConditionalGeneration,
|
||||
GlmOcrForConditionalGeneration,
|
||||
]
|
||||
if m is not None
|
||||
]
|
||||
|
||||
def __init__(self, hf_config, server_args, _processor, *args, **kwargs):
|
||||
|
||||
Reference in New Issue
Block a user