MCPcopy
hub / github.com/InternLM/lmdeploy / __init__

Method __init__

lmdeploy/vl/model/base.py:55–71  ·  view source on GitHub ↗

init.

(self,
                 model_path: str,
                 with_llm: bool = False,
                 max_memory: dict[int, int] = None,
                 hf_config: AutoConfig = None,
                 backend: str = '',
                 trust_remote_code: bool = False)

Source from the content-addressed store, hash-verified

53 ]
54
55 def __init__(self,
56 model_path: str,
57 with_llm: bool = False,
58 max_memory: dict[int, int] = None,
59 hf_config: AutoConfig = None,
60 backend: str = '',
61 trust_remote_code: bool = False):
62 """init."""
63 self.model_path = model_path
64 self.with_llm = with_llm
65 self.max_memory = max_memory
66 self.backend = backend
67 self.mm_feature_dtype: torch.dtype | None = None
68 if hf_config is None:
69 _, hf_config = get_model_arch(model_path, trust_remote_code=trust_remote_code)
70 self.hf_config = hf_config
71 self.image_token_id = self.get_pad_token_id(model_path, hf_config, trust_remote_code=trust_remote_code) or 0
72
73 def set_mm_feature_dtype(self, dtype: torch.dtype | None):
74 """Set target dtype for floating MM feature tensors."""

Callers

nothing calls this directly

Calls 2

get_pad_token_idMethod · 0.95
get_model_archFunction · 0.90

Tested by

no test coverage detected