Skip to content

Commit

Permalink
Merge pull request #1010 from bjwswang/main
Browse files Browse the repository at this point in the history
feat: add menus for llama factory
  • Loading branch information
bjwswang authored Apr 11, 2024
2 parents 12e790b + b57b9e6 commit bca8882
Show file tree
Hide file tree
Showing 10 changed files with 168 additions and 76 deletions.
Original file line number Diff line number Diff line change
@@ -1,15 +1,19 @@
apiVersion: v2
name: llama-factory
version: 0.1.1
appVersion: 0.1.0
version: 0.0.1
appVersion: 0.6.1
description: llama-factory
type: application

keywords:
- llama-factory
- model tune
sources:
- https://github.com/huangqg/LLaMA-Factory
- https://github.com/hiyouga/LLaMA-Factory
maintainers:
- name: huangqg
url: https://github.com/huangqg
- name: bjwswang
url: https://github.com/bjwswang
- name: Lanture1064
url: https://github.com/Lanture1064
17 changes: 17 additions & 0 deletions deploy/charts/llama-factory/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
# llama-factory

Originally from [llama-factory](https://github.com/huangqg/helm-charts/tree/main/charts/llama-factory)

## Usage

Before install llama-factory:

- Must replace `<replaced-ingress-nginx-ip>`with the real ingress ip address(`172.18.0.2` for example) if ingress is enabled

### Install via helm

```shell
helm install -nkubeagi-system lmf .
```

If `<replaced-ingress-nginx-ip>` is `172.18.0.2`, then the dashboard of llama factory is `https://lmf.172.18.0.2.nip.io`.
58 changes: 58 additions & 0 deletions deploy/charts/llama-factory/templates/deployment.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
apiVersion: apps/v1
kind: Deployment
metadata:
name: {{ .Release.Name }}-llama-factory
namespace: {{ .Release.Namespace }}
labels:
app: {{ .Release.Name }}-llama-factory
spec:
selector:
matchLabels:
app: {{ .Release.Name }}-llama-factory
replicas: 1
template:
metadata:
labels:
app: {{ .Release.Name }}-llama-factory
spec:
containers:
- image: {{ .Values.image }}
imagePullPolicy: {{ .Values.imagePullPolicy }}
name: llama-factory
ports:
- containerPort: 7860
protocol: TCP
resources: {{ toYaml .Values.resources | nindent 10 }}
volumeMounts:
{{- if ne .Values.volume.hfcache "" }}
- name: hf-cache
mountPath: /root/.cache/huggingface/
{{- end }}
{{- if ne .Values.volume.data "" }}
- name: data
mountPath: /app/data
{{- end }}
{{- if ne .Values.volume.output "" }}
- name: output
mountPath: /app/output
{{- end }}
volumes:
{{- if ne .Values.volume.hfcache "" }}
- name: hf-cache
hostPath:
path: {{ .Values.volume.hfcache }}
type: "Directory"
{{- end }}
{{- if ne .Values.volume.data "" }}
- name: data
hostPath:
path: {{ .Values.volume.data }}
type: "Directory"
{{- end }}
{{- if ne .Values.volume.output "" }}
- name: output
hostPath:
path: {{ .Values.volume.output }}
type: "Directory"
{{- end }}
terminationGracePeriodSeconds: 30
Original file line number Diff line number Diff line change
Expand Up @@ -26,16 +26,16 @@ metadata:
nginx.ingress.kubernetes.io/upstream-vhost: $host
labels:
ingress-lb: {{ .Values.ingress.ingressClassName }}
name: llama-factory
name: {{ .Release.Name }}-llama-factory
namespace: {{ .Release.Namespace }}
spec:
rules:
- host: portal.{{ .Values.ingress.ingressDomain }}
- host: {{ .Release.Name }}.{{ .Values.ingress.ingressDomain }}
http:
paths:
- backend:
service:
name: llama-factory
name: {{ .Release.Name }}-llama-factory
port:
number: 7860
path: /
Expand Down
52 changes: 52 additions & 0 deletions deploy/charts/llama-factory/templates/menus.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
{{ if .Capabilities.APIVersions.Has "core.kubebb.k8s.com.cn/v1alpha1/Menu" -}}
apiVersion: core.kubebb.k8s.com.cn/v1alpha1
kind: Menu
metadata:
name: kubeagi-model-tune
spec:
disabled: false
rankingInColumn: 400
target: ""
text: 模型调优
textEn: model_tuneing
parentOwnerReferences:
apiVersion: core.kubebb.k8s.com.cn/v1alpha1
kind: Menu
name: yunti-kubeagi-portal
uid: ""
---
apiVersion: core.kubebb.k8s.com.cn/v1alpha1
kind: Menu
metadata:
name: kubeagi-model-tune-submenu
spec:
parentOwnerReferences:
apiVersion: core.kubebb.k8s.com.cn/v1alpha1
kind: Menu
name: kubeagi-model-tune
uid: ""
cluster: false
disabled: false
icon: '{"name":"Ai","data":"<path d=\"M334.351 1023.768c-46.718 0-84.33-12.976-111.596-40.217-84.33-75.25-59.694-230.958-59.694-236.143l-5.185-5.185-108.991-32.427c-12.976-5.185-27.242-12.976-32.427-27.241-5.185-14.266-5.185-29.847
2.606-42.823 0 0 62.273-119.361 121.967-238.748C143.636 206.348 244.836.052 525.09.052c168.685
0 272.491 67.458 326.974 124.572 59.694 62.273 79.144 124.572 79.144 127.152 2.606
5.185 64.879 184.24-35.032 349.03-81.75 138.837-35.032 219.271-32.426 224.482
7.79 12.976 2.605 29.847-7.79 37.637-12.976 7.791-29.847 5.186-37.638-7.79-2.606-5.185-71.354-111.597
29.847-281.571 84.33-144.023 29.846-303.627 29.846-306.207-2.605-10.37-67.458-211.507-354.214-211.507-304.917
0-329.579 271.175-329.579 355.53v5.185l-2.605 5.185C137.109 530.741 80.02 635.837
69.65 660.5l103.806 29.846c27.241 7.791 46.718 35.032 44.112 62.274 0 2.605-19.45
134.942 40.217 189.425 29.847 27.241 79.145 32.426 141.418 16.87 40.217-10.37
79.144-29.846 111.596-42.822 37.638-19.45 71.354-32.426 101.2-32.426 51.904 0
81.75 51.903 92.12 81.75 5.186 12.975-2.605 29.846-19.45 35.032-12.976 5.185-29.847-2.606-35.032-19.451-2.605-10.37-19.45-42.823-37.637-42.823-16.871
0-46.718 12.976-76.565 27.242-35.032 16.87-76.564 35.032-121.966 49.297-27.216
5.16-51.878 9.055-79.119 9.055zm89.902-783.42H397.01l-163.5 433.359h54.51l40.216-108.991h190.741l40.217
108.99h54.508L450.204 240.349h-25.951zm-84.356 281.57l84.33-224.482 92.12 224.483h-176.45zm356.82-281.57h54.509v433.359h-54.509z\"></path>"}'
pathname: /oidc/tune-model
project: false
rankingInColumn: 96
redirect: https://{{ .Release.Name }}.{{ .Values.ingress.ingressDomain }}
target: iframe
tenant: false
text: 模型调优
textEn: model_tuning
{{- end }}
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@ apiVersion: v1
kind: Service
metadata:
labels:
app: llama-factory
name: llama-factory
app: {{ .Release.Name }}-llama-factory
name: {{ .Release.Name }}-llama-factory
namespace: {{ .Release.Namespace }}
spec:
ports:
Expand All @@ -12,6 +12,6 @@ spec:
protocol: TCP
targetPort: 7860
selector:
app: llama-factory
app: {{ .Release.Name }}-llama-factory
sessionAffinity: None
type: ClusterIP
28 changes: 28 additions & 0 deletions deploy/charts/llama-factory/values.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
# ingress configurations for component
ingress:
# set enable to `true` to enable ingress
enable: true
ingressClassName: portal-ingress
ingressDomain: <replaced-ingress-nginx-ip>.nip.io

# volume configurations for llama-factory
volume:
# hfcache is the cache path for huggingface model from host
hfcache: ""
# data is the data path for llama-factory from host
data: ""
# output is the output path for llama-factory from host
output: ""

# llama-factory configurations
image: kubeagi/llama-factory:v0.6.1
imagePullPolicy: IfNotPresent
resources:
limits:
cpu: "4"
memory: 12Gi
nvidia.com/gpu: "0"
requests:
cpu: "1"
memory: 1Gi
nvidia.com/gpu: "0"
1 change: 0 additions & 1 deletion deploy/llama-factory/README.md

This file was deleted.

43 changes: 0 additions & 43 deletions deploy/llama-factory/templates/deployment.yaml

This file was deleted.

23 changes: 0 additions & 23 deletions deploy/llama-factory/values.yaml

This file was deleted.

0 comments on commit bca8882

Please sign in to comment.