From 7f2e3c1bf27f85bad24931b930c10085f8661c67 Mon Sep 17 00:00:00 2001 From: bjwswang Date: Wed, 28 Feb 2024 02:25:00 +0000 Subject: [PATCH] feat: add more info to model including MaxContextLength,HuggingfaceRepo,ModelscopeRepo Signed-off-by: bjwswang --- api/base/v1alpha1/model.go | 15 +++++++++- api/base/v1alpha1/model_types.go | 8 +++++ .../arcadia.kubeagi.k8s.com.cn_models.yaml | 12 ++++++++ deploy/charts/arcadia/Chart.yaml | 2 +- .../arcadia.kubeagi.k8s.com.cn_models.yaml | 12 ++++++++ .../charts/arcadia/templates/post-models.yaml | 30 ++++++++++++++++++- 6 files changed, 76 insertions(+), 3 deletions(-) diff --git a/api/base/v1alpha1/model.go b/api/base/v1alpha1/model.go index 2650d2996..fe5dfff9d 100644 --- a/api/base/v1alpha1/model.go +++ b/api/base/v1alpha1/model.go @@ -28,7 +28,10 @@ const ( // LabelModelEmbedding indicates this is a embedding model LabelModelEmbedding = Group + "/embedding" // LabelModelLLM indicates this is a llm model - LabelModelLLM = Group + "/llm" + LabelModelLLM = Group + "/llm" + // LabelModelReranking indicates this is a reranking model + LabelModelReranking = Group + "/reranking" + // LabelModelFullPath indicates the full path in storage LabelModelFullPath = Group + "/full-path" ) @@ -52,6 +55,16 @@ func (model Model) IsEmbeddingModel() bool { return false } +// IsRerankingModel checks whether this model is a reranking model +func (model Model) IsRerankingModel() bool { + for _, t := range strings.Split(model.Spec.Types, ",") { + if strings.ToLower(t) == "reranking" { + return true + } + } + return false +} + // FullPath with bucket and object path func (model Model) FullPath() string { return fmt.Sprintf("%s/%s", model.Namespace, model.ObjectPath()) diff --git a/api/base/v1alpha1/model_types.go b/api/base/v1alpha1/model_types.go index d66116afb..450ed40d9 100644 --- a/api/base/v1alpha1/model_types.go +++ b/api/base/v1alpha1/model_types.go @@ -33,6 +33,14 @@ type ModelSpec struct { // Source define the source of the model file Source *TypedObjectReference `json:"source,omitempty"` + + // HuggingFaceRepo defines the huggingface repo which hosts this model + HuggingFaceRepo string `json:"huggingFaceRepo,omitempty"` + // ModelScopeRepo defines the modelscope repo which hosts this model + ModelScopeRepo string `json:"modelScopeRepo,omitempty"` + + // MaxContextLength defines the max context length allowed in this model + MaxContextLength int `json:"maxContextLength,omitempty"` } // ModelStatus defines the observed state of Model diff --git a/config/crd/bases/arcadia.kubeagi.k8s.com.cn_models.yaml b/config/crd/bases/arcadia.kubeagi.k8s.com.cn_models.yaml index 5a288d9a9..9c721a8b5 100644 --- a/config/crd/bases/arcadia.kubeagi.k8s.com.cn_models.yaml +++ b/config/crd/bases/arcadia.kubeagi.k8s.com.cn_models.yaml @@ -44,6 +44,18 @@ spec: displayName: description: DisplayName defines datasource display name type: string + huggingFaceRepo: + description: HuggingFaceRepo defines the huggingface repo which hosts + this model + type: string + maxContextLength: + description: MaxContextLength defines the max context length allowed + in this model + type: integer + modelScopeRepo: + description: ModelScopeRepo defines the modelscope repo which hosts + this model + type: string source: description: Source define the source of the model file properties: diff --git a/deploy/charts/arcadia/Chart.yaml b/deploy/charts/arcadia/Chart.yaml index b88b6036f..20d34210e 100644 --- a/deploy/charts/arcadia/Chart.yaml +++ b/deploy/charts/arcadia/Chart.yaml @@ -2,7 +2,7 @@ apiVersion: v2 name: arcadia description: A Helm chart(Also a KubeBB Component) for KubeAGI Arcadia type: application -version: 0.2.34 +version: 0.2.35 appVersion: "0.1.0" keywords: diff --git a/deploy/charts/arcadia/crds/arcadia.kubeagi.k8s.com.cn_models.yaml b/deploy/charts/arcadia/crds/arcadia.kubeagi.k8s.com.cn_models.yaml index 5a288d9a9..9c721a8b5 100644 --- a/deploy/charts/arcadia/crds/arcadia.kubeagi.k8s.com.cn_models.yaml +++ b/deploy/charts/arcadia/crds/arcadia.kubeagi.k8s.com.cn_models.yaml @@ -44,6 +44,18 @@ spec: displayName: description: DisplayName defines datasource display name type: string + huggingFaceRepo: + description: HuggingFaceRepo defines the huggingface repo which hosts + this model + type: string + maxContextLength: + description: MaxContextLength defines the max context length allowed + in this model + type: integer + modelScopeRepo: + description: ModelScopeRepo defines the modelscope repo which hosts + this model + type: string source: description: Source define the source of the model file properties: diff --git a/deploy/charts/arcadia/templates/post-models.yaml b/deploy/charts/arcadia/templates/post-models.yaml index dc2240dd5..a6fcf46d1 100644 --- a/deploy/charts/arcadia/templates/post-models.yaml +++ b/deploy/charts/arcadia/templates/post-models.yaml @@ -20,11 +20,13 @@ spec: 官网: https://www.baichuan-ai.com/ Github: https://github.com/baichuan-inc/Baichuan2 HuggingFace: https://huggingface.co/baichuan-inc/Baichuan2-7B-Chat - ModelScope: https://modelscope.cn/models/baichuan-inc/Baichuan2-7B-Chat/summary + ModelScope: https://modelscope.cn/models/baichuan-inc/Baichuan2-7B-Chat arXiv: https://arxiv.org/abs/2309.10305 百川智能成立于2023年4月10日,由前搜狗公司CEO王小川创立。公司以帮助大众轻松、普惠地获取世界知识和专业服务为使命,致力于通过语言AI的突破,构建中国最优秀的大模型底座。 types: "llm" + huggingFaceRepo: baichuan-inc/Baichuan2-7B-Chat + modelScopeRepo: baichuan-inc/Baichuan2-7B-Chat --- apiVersion: arcadia.kubeagi.k8s.com.cn/v1alpha1 kind: Model @@ -56,6 +58,8 @@ spec: 北京智谱华章科技有限公司由清华大学计算机系技术成果转化而来,致力于打造新一代认知智能大模型,专注于做大模型的中国创新。 types: "llm" + huggingFaceRepo: THUDM/chatglm2-6b + modelScopeRepo: ZhipuAI/chatglm2-6b --- apiVersion: arcadia.kubeagi.k8s.com.cn/v1alpha1 kind: Model @@ -88,6 +92,8 @@ spec: 通义为阿里云大模型的统一品牌,覆盖语言、听觉、多模态等领域,致力于实现类人智慧的通用智能。 types: "llm" + huggingFaceRepo: Qwen/Qwen-7B-Chat + modelScopeRepo: qwen/Qwen-7B-Chat --- apiVersion: arcadia.kubeagi.k8s.com.cn/v1alpha1 kind: Model @@ -120,4 +126,26 @@ spec: 北京智源人工智能研究院是北京大学的直属研究机构,主要从事人工智能的数理基础、机器学习、智能信息检索与挖掘、智能体系架构与芯片、自然语言处理等领域研究。 types: "embedding" + huggingFaceRepo: BAAI/bge-large-zh-v1.5 +--- +apiVersion: arcadia.kubeagi.k8s.com.cn/v1alpha1 +kind: Model +metadata: + name: bge-reranker-large + namespace: {{ .Release.Namespace }} + annotations: + "helm.sh/hook": post-install + "helm.sh/hook-weight": "1" +spec: + displayName: "bge-reranker-large" + description: | + bge-raranker-large 是一个通用reranking,由北京智源人工智能研究院(BAAI)推出,同时支持中英文 + 官网: https://www.baai.ac.cn/ + Github: https://github.com/FlagOpen/FlagEmbedding + HuggingFace: https://huggingface.co/BAAI/bge-reranker-large + arXiv: https://arxiv.org/pdf/2309.07597 + + 北京智源人工智能研究院是北京大学的直属研究机构,主要从事人工智能的数理基础、机器学习、智能信息检索与挖掘、智能体系架构与芯片、自然语言处理等领域研究。 + types: "reranking" + huggingFaceRepo: BAAI/bge-reranker-large \ No newline at end of file