forked from kaito-project/kaito
-
Notifications
You must be signed in to change notification settings - Fork 0
/
model.go
147 lines (125 loc) · 4.76 KB
/
model.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
// Copyright (c) Microsoft Corporation.
// Licensed under the MIT license.
package falcon
import (
"time"
kaitov1alpha1 "github.com/azure/kaito/api/v1alpha1"
"github.com/azure/kaito/pkg/inference"
"github.com/azure/kaito/pkg/model"
"github.com/azure/kaito/pkg/utils/plugin"
)
func init() {
plugin.KaitoModelRegister.Register(&plugin.Registration{
Name: PresetFalcon7BModel,
Instance: &falconA,
})
plugin.KaitoModelRegister.Register(&plugin.Registration{
Name: PresetFalcon7BInstructModel,
Instance: &falconB,
})
plugin.KaitoModelRegister.Register(&plugin.Registration{
Name: PresetFalcon40BModel,
Instance: &falconC,
})
plugin.KaitoModelRegister.Register(&plugin.Registration{
Name: PresetFalcon40BInstructModel,
Instance: &falconD,
})
}
var (
PresetFalcon7BModel = "falcon-7b"
PresetFalcon40BModel = "falcon-40b"
PresetFalcon7BInstructModel = PresetFalcon7BModel + "-instruct"
PresetFalcon40BInstructModel = PresetFalcon40BModel + "-instruct"
PresetFalconTagMap = map[string]string{
"Falcon7B": "0.0.2",
"Falcon7BInstruct": "0.0.2",
"Falcon40B": "0.0.2",
"Falcon40BInstruct": "0.0.2",
}
baseCommandPresetFalcon = "accelerate launch"
falconRunParams = map[string]string{
"torch_dtype": "bfloat16",
"pipeline": "text-generation",
}
)
var falconA falcon7b
type falcon7b struct{}
func (*falcon7b) GetInferenceParameters() *model.PresetInferenceParam {
return &model.PresetInferenceParam{
ModelFamilyName: "Falcon",
ImageAccessMode: string(kaitov1alpha1.ModelImageAccessModePublic),
DiskStorageRequirement: "50Gi",
GPUCountRequirement: "1",
TotalGPUMemoryRequirement: "14Gi",
PerGPUMemoryRequirement: "0Gi", // We run Falcon using native vertical model parallel, no per GPU memory requirement.
TorchRunParams: inference.DefaultAccelerateParams,
ModelRunParams: falconRunParams,
DeploymentTimeout: time.Duration(30) * time.Minute,
BaseCommand: baseCommandPresetFalcon,
Tag: PresetFalconTagMap["Falcon7B"],
}
}
func (*falcon7b) SupportDistributedInference() bool {
return false
}
var falconB falcon7bInst
type falcon7bInst struct{}
func (*falcon7bInst) GetInferenceParameters() *model.PresetInferenceParam {
return &model.PresetInferenceParam{
ModelFamilyName: "Falcon",
ImageAccessMode: string(kaitov1alpha1.ModelImageAccessModePublic),
DiskStorageRequirement: "50Gi",
GPUCountRequirement: "1",
TotalGPUMemoryRequirement: "14Gi",
PerGPUMemoryRequirement: "0Gi", // We run Falcon using native vertical model parallel, no per GPU memory requirement.
TorchRunParams: inference.DefaultAccelerateParams,
ModelRunParams: falconRunParams,
DeploymentTimeout: time.Duration(30) * time.Minute,
BaseCommand: baseCommandPresetFalcon,
Tag: PresetFalconTagMap["Falcon7BInstruct"],
}
}
func (*falcon7bInst) SupportDistributedInference() bool {
return false
}
var falconC falcon40b
type falcon40b struct{}
func (*falcon40b) GetInferenceParameters() *model.PresetInferenceParam {
return &model.PresetInferenceParam{
ModelFamilyName: "Falcon",
ImageAccessMode: string(kaitov1alpha1.ModelImageAccessModePublic),
DiskStorageRequirement: "400",
GPUCountRequirement: "2",
TotalGPUMemoryRequirement: "90Gi",
PerGPUMemoryRequirement: "0Gi", // We run Falcon using native vertical model parallel, no per GPU memory requirement.
TorchRunParams: inference.DefaultAccelerateParams,
ModelRunParams: falconRunParams,
DeploymentTimeout: time.Duration(30) * time.Minute,
BaseCommand: baseCommandPresetFalcon,
Tag: PresetFalconTagMap["Falcon40B"],
}
}
func (*falcon40b) SupportDistributedInference() bool {
return false
}
var falconD falcon40bInst
type falcon40bInst struct{}
func (*falcon40bInst) GetInferenceParameters() *model.PresetInferenceParam {
return &model.PresetInferenceParam{
ModelFamilyName: "Falcon",
ImageAccessMode: string(kaitov1alpha1.ModelImageAccessModePublic),
DiskStorageRequirement: "400",
GPUCountRequirement: "2",
TotalGPUMemoryRequirement: "90Gi",
PerGPUMemoryRequirement: "0Gi", // We run Falcon using native vertical model parallel, no per GPU memory requirement.
TorchRunParams: inference.DefaultAccelerateParams,
ModelRunParams: falconRunParams,
DeploymentTimeout: time.Duration(30) * time.Minute,
BaseCommand: baseCommandPresetFalcon,
Tag: PresetFalconTagMap["Falcon40BInstruct"],
}
}
func (*falcon40bInst) SupportDistributedInference() bool {
return false
}