[Model]Support MiniCPM-o 4.5 (#3642)
Signed-off-by: tc-mb <tianchi_cai@icloud.com> Co-authored-by: GKangaroo <1095103651@qq.com> Co-authored-by: GKangaroo <gqx24@mails.tsinghua.edu.cn> Co-authored-by: Hongsheng Liu <liuhongsheng4@huawei.com>
This commit is contained in:
22 files changed
+6840
-6
No files matched your search
@@ -578,6 +578,31 @@ async def build_async_omni_from_stage_config(
|
||||
|
||||
async_omni: EngineClient | None = None
|
||||
|
||||
# Pre-load the model config so HuggingFace registers `transformers_modules`
|
||||
# in this process — only when the user has explicitly opted in via
|
||||
# `--trust-remote-code`. Stage workers consume the same flag through their
|
||||
# deploy config, but the API server process also needs the dynamic modules
|
||||
# for ZMQ pickle deserialization of stage outputs that reference them
|
||||
# (e.g. trust_remote_code models like MiniCPM-o).
|
||||
if getattr(args, "trust_remote_code", False) and getattr(args, "model", None):
|
||||
try:
|
||||
import os
|
||||
|
||||
from transformers import AutoConfig
|
||||
|
||||
# Hide GPUs so the custom config code doesn't allocate CUDA memory.
|
||||
saved = os.environ.get("CUDA_VISIBLE_DEVICES")
|
||||
os.environ["CUDA_VISIBLE_DEVICES"] = ""
|
||||
try:
|
||||
AutoConfig.from_pretrained(args.model, trust_remote_code=True)
|
||||
finally:
|
||||
if saved is not None:
|
||||
os.environ["CUDA_VISIBLE_DEVICES"] = saved
|
||||
else:
|
||||
os.environ.pop("CUDA_VISIBLE_DEVICES", None)
|
||||
except Exception as e:
|
||||
logger.debug("Pre-loading transformers_modules failed: %s", e)
|
||||
|
||||
try:
|
||||
kwargs = vars(args).copy()
|
||||
kwargs.pop("model", None)
|
||||
|
||||
Reference in new issue
Block a user