File tree Expand file tree Collapse file tree 2 files changed +0
-57
lines changed Expand file tree Collapse file tree 2 files changed +0
-57
lines changed Original file line number Diff line number Diff line change 1- import os
2- import sys
3- import importlib .util
4- from loguru import logger
5-
6-
7- def get_module_path (module_name ):
8- spec = importlib .util .find_spec (module_name )
9- if spec is None :
10- return f"Module '{ module_name } ' not found."
11- return spec .origin
12-
13-
14- def check_lmdeploy_lib ():
15- if os .path .exists (os .path .join (lmdeploy_path , "lib" )):
16- return True
17- return False
18-
19-
20- # 示例
21- module_name = "lmdeploy"
22- lmdeploy_path = os .path .dirname (get_module_path (module_name ))
23- if not check_lmdeploy_lib ():
24- logger .warning ("不存在lmdeploy的lib文件目录,系统将会自动下载!" )
25- cmd = "pip install --force-reinstall lmdeploy==0.6.2 --no-deps"
26- logger .info (f"正在执行命令:{ cmd } " )
27- os .system (cmd )
28- logger .info ("安装成功,请重新启动服务!" )
29- sys .exit ()
30- else :
31- pass
Original file line number Diff line number Diff line change 1- from lmdeploy .version import __version__
2-
3- if __version__ == "0.7.3" :
4- from typing import Optional
5- from lmdeploy .model import MODELS , InternLM2Chat7B
6-
7- @MODELS .register_module (name = "internvl2_5" , force = True )
8- class InternVL2_5 (InternLM2Chat7B ):
9-
10- def __init__ (
11- self ,
12- meta_instruction = "你是书生·万象,英文名是InternVL,是由上海人工智能实验室、清华大学及多家合作单位联合开发的多模态大语言模型。" , # noqa
13- ** kwargs ,
14- ):
15- super ().__init__ (meta_instruction = meta_instruction , ** kwargs )
16-
17- @classmethod
18- def match (cls , model_path : str ) -> Optional [str ]:
19- """Return the model_name that was registered to MODELS.
20-
21- Args:
22- model_path (str): the model path used for matching.
23- """
24- path = model_path .lower ()
25- if "internvl2.5" in path or "internvl2_5" in path or "internvl3" in path :
26- return "internvl2_5"
You can’t perform that action at this time.
0 commit comments