-
Notifications
You must be signed in to change notification settings - Fork 6
/
project.yaml
167 lines (167 loc) · 8.71 KB
/
project.yaml
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
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
kind: project
metadata:
name: huggingface-demo-iguazio
created: '2023-03-05T15:47:55.390000'
spec:
functions:
- url: src/data_prep.py
name: data-prep
kind: job
handler: prepare_dataset
- url: hub://hugging_face_classifier_trainer
name: hugging_face_classifier_trainer
kind: job
- url: src/serving_test.py
name: server-tester
kind: job
handler: model_server_tester
- name: serving-pretrained
spec:
kind: serving
metadata:
name: serving-pretrained
project: huggingface-demo-iguazio
categories: []
spec:
command: ''
args: []
image: ''
build:
source: ./
commands: []
code_origin: git://github.com/davesh0812/mlrun-huggingface-demo.git#refs/heads/main#2483d5f12f61e35e140a19015521056d4ff1a237
description: ''
disable_auto_mount: false
env: []
resources:
requests:
memory: 1Mi
cpu: 25m
limits:
memory: 20Gi
cpu: '2'
priority_class_name: igz-workload-medium
preemption_mode: prevent
min_replicas: 1
max_replicas: 4
source: ''
function_kind: serving_v2
base_image_pull: false
graph:
steps:
preprocess:
kind: task
handler: src.serving.preprocess
after: []
sentiment-analysis:
kind: task
class_name: mlrun.frameworks.huggingface.HuggingFaceModelServer
class_args:
task: sentiment-analysis
model_name: distilbert-base-uncased
model_class: AutoModelForSequenceClassification
tokenizer_name: distilbert-base-uncased
tokenizer_class: AutoTokenizer
after:
- preprocess
postprocess:
kind: task
handler: src.serving.postprocess
after:
- sentiment-analysis
responder: true
engine: async
secret_sources: []
affinity: null
tolerations: null
security_context: {}
verbose: false
- name: serving-trained
spec:
kind: serving
metadata:
name: serving-trained
tag: staging
project: huggingface-iguazio
spec:
command: ''
args: []
image: ''
build:
functionSourceCode: IyBDb3B5cmlnaHQgMjAxOCBJZ3VhemlvCiMKIyBMaWNlbnNlZCB1bmRlciB0aGUgQXBhY2hlIExpY2Vuc2UsIFZlcnNpb24gMi4wICh0aGUgIkxpY2Vuc2UiKTsKIyB5b3UgbWF5IG5vdCB1c2UgdGhpcyBmaWxlIGV4Y2VwdCBpbiBjb21wbGlhbmNlIHdpdGggdGhlIExpY2Vuc2UuCiMgWW91IG1heSBvYnRhaW4gYSBjb3B5IG9mIHRoZSBMaWNlbnNlIGF0CiMKIyAgIGh0dHA6Ly93d3cuYXBhY2hlLm9yZy9saWNlbnNlcy9MSUNFTlNFLTIuMAojCiMgVW5sZXNzIHJlcXVpcmVkIGJ5IGFwcGxpY2FibGUgbGF3IG9yIGFncmVlZCB0byBpbiB3cml0aW5nLCBzb2Z0d2FyZQojIGRpc3RyaWJ1dGVkIHVuZGVyIHRoZSBMaWNlbnNlIGlzIGRpc3RyaWJ1dGVkIG9uIGFuICJBUyBJUyIgQkFTSVMsCiMgV0lUSE9VVCBXQVJSQU5USUVTIE9SIENPTkRJVElPTlMgT0YgQU5ZIEtJTkQsIGVpdGhlciBleHByZXNzIG9yIGltcGxpZWQuCiMgU2VlIHRoZSBMaWNlbnNlIGZvciB0aGUgc3BlY2lmaWMgbGFuZ3VhZ2UgZ292ZXJuaW5nIHBlcm1pc3Npb25zIGFuZAojIGxpbWl0YXRpb25zIHVuZGVyIHRoZSBMaWNlbnNlLgojCmltcG9ydCB0ZW1wZmlsZQppbXBvcnQgemlwZmlsZQpmcm9tIHR5cGluZyBpbXBvcnQgQW55LCBEaWN0LCBMaXN0LCBUdXBsZSwgVW5pb24KCmltcG9ydCBtbHJ1bgppbX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dCwgZXZlbnQpCg==
source: ./
commands: []
code_origin: git://github.com/davesh0812/mlrun-huggingface-demo.git#refs/heads/main#38415cba3f4ebd173df929d0d0ddaafc1c96f196
origin_filename: src/serving.py
description: ''
default_handler: ''
disable_auto_mount: false
env: []
resources:
requests:
memory: 1Mi
cpu: 25m
limits:
memory: 20Gi
cpu: '2'
priority_class_name: igz-workload-medium
preemption_mode: prevent
min_replicas: 1
max_replicas: 4
source: ''
function_kind: serving_v2
function_handler: serving:handler
base_image_pull: false
secret_sources: []
affinity: null
tolerations: null
security_context: {}
verbose: false
- name: serving-trained-onnx
spec:
kind: serving
metadata:
name: serving-trained-onnx
project: huggingface-demo-iguazio
categories: []
spec:
command: ''
args: []
image: ''
build:
source: ./
commands: []
code_origin: git://github.com/davesh0812/mlrun-huggingface-demo.git#refs/heads/main#2483d5f12f61e35e140a19015521056d4ff1a237
description: ''
disable_auto_mount: false
env: []
resources:
requests:
memory: 1Mi
cpu: 25m
limits:
memory: 20Gi
cpu: '2'
priority_class_name: igz-workload-medium
preemption_mode: prevent
min_replicas: 1
max_replicas: 4
source: ''
function_kind: serving_v2
base_image_pull: false
secret_sources: []
affinity: null
tolerations: null
security_context: {}
verbose: false
workflows:
- path: src/training_workflow.py
name: training_workflow
artifacts: []
source: git://github.com/davesh0812/mlrun-huggingface-demo.git#main
origin_url: git://github.com/davesh0812/mlrun-huggingface-demo.git#refs/heads/main
load_source_on_run: true
desired_state: online
default_image: davesh0812/mlrun:huggingface-mlrun-demo
status:
state: online