Upload NOTICE with huggingface_hub
This commit is contained in:
parent
338c0296df
commit
c5c476a1a6
@ -91,6 +91,17 @@ class DotsOCRProcessingInfo(Qwen2_5_VLProcessingInfo):
|
|||||||
|
|
||||||
return config
|
return config
|
||||||
|
|
||||||
|
def get_supported_mm_limits(self) -> Mapping[str, Optional[int]]:
|
||||||
|
return {"image": None, "video": 0}
|
||||||
|
|
||||||
|
def get_mm_max_tokens_per_item(
|
||||||
|
self,
|
||||||
|
seq_len: int,
|
||||||
|
mm_counts: Mapping[str, int],
|
||||||
|
) -> Mapping[str, int]:
|
||||||
|
max_image_tokens = self.get_max_image_tokens()
|
||||||
|
return {"image": max_image_tokens, "video": 0}
|
||||||
|
|
||||||
def get_hf_processor(
|
def get_hf_processor(
|
||||||
self,
|
self,
|
||||||
*,
|
*,
|
||||||
@ -99,6 +110,7 @@ class DotsOCRProcessingInfo(Qwen2_5_VLProcessingInfo):
|
|||||||
size: Optional[dict[str, int]] = None,
|
size: Optional[dict[str, int]] = None,
|
||||||
**kwargs: object,
|
**kwargs: object,
|
||||||
) -> Qwen2VLProcessor:
|
) -> Qwen2VLProcessor:
|
||||||
|
self.get_tokenizer().image_token = "<|imgpad|>" # Ensure image token is set
|
||||||
processor = self.ctx.get_hf_processor(
|
processor = self.ctx.get_hf_processor(
|
||||||
Qwen2VLProcessor,
|
Qwen2VLProcessor,
|
||||||
image_processor=self.get_image_processor(min_pixels=min_pixels, max_pixels=max_pixels, size=size),
|
image_processor=self.get_image_processor(min_pixels=min_pixels, max_pixels=max_pixels, size=size),
|
||||||
@ -166,6 +178,11 @@ class DotsOCRForCausalLM(nn.Module, SupportsMultiModal):
|
|||||||
)
|
)
|
||||||
_tp_plan = {}
|
_tp_plan = {}
|
||||||
|
|
||||||
|
@classmethod
|
||||||
|
def get_placeholder_str(cls, modality: str, i: int) -> Optional[str]:
|
||||||
|
if modality in ("image",):
|
||||||
|
return "<|img|><|imgpad|><|endofimg|>"
|
||||||
|
|
||||||
def __init__(self, *, vllm_config: VllmConfig, prefix: str = ""):
|
def __init__(self, *, vllm_config: VllmConfig, prefix: str = ""):
|
||||||
super().__init__()
|
super().__init__()
|
||||||
|
|
||||||
@ -409,6 +426,10 @@ class DotsOCRForCausalLM(nn.Module, SupportsMultiModal):
|
|||||||
|
|
||||||
|
|
||||||
def patch_vllm_chat_placeholder():
|
def patch_vllm_chat_placeholder():
|
||||||
|
import vllm
|
||||||
|
# return when vllm version > 0.9.1
|
||||||
|
if not (vllm.__version_tuple__[0]==0 and vllm.__version_tuple__[1] <= 9 and vllm.__version_tuple__[2] <= 1):
|
||||||
|
return
|
||||||
from vllm.entrypoints.chat_utils import BaseMultiModalItemTracker
|
from vllm.entrypoints.chat_utils import BaseMultiModalItemTracker
|
||||||
|
|
||||||
ori = BaseMultiModalItemTracker._placeholder_str
|
ori = BaseMultiModalItemTracker._placeholder_str
|
||||||
@ -426,4 +447,5 @@ ModelRegistry.register_model(
|
|||||||
"DotsOCRForCausalLM", DotsOCRForCausalLM,
|
"DotsOCRForCausalLM", DotsOCRForCausalLM,
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
patch_vllm_chat_placeholder()
|
patch_vllm_chat_placeholder()
|
||||||
Loading…
Reference in New Issue
Block a user