-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathvalohai.yaml
More file actions
210 lines (207 loc) · 7.15 KB
/
Copy pathvalohai.yaml
File metadata and controls
210 lines (207 loc) · 7.15 KB
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
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
- step:
name: load-data
image: nvcr.io/nvidia/clara/bionemo-framework:1.3
environment: pro-trial-prod-oci-vm-gpu-a10-1
command:
- pip install valohai-utils
- python prepare-data.py
parameters:
- name: data_version
type: string
default: v1.0
description: Version of the dataset to use when saving preprocessed data
- step:
name: predict-properties
image: nvcr.io/nvidia/clara/bionemo-framework:2.4
environment: pro-trial-prod-oci-vm-gpu-a10-1
command:
- pip install -r requirements.txt
- python predict-properties.py
environment-variables:
- name: WORK_DIR
default: "/valohai/outputs/esm2_inference_tutorial"
description: Working directory for the inference step
inputs:
- name: dataset
default: "https://drive.google.com/uc?export=download&id=1lKd6CNtZEho_rIXqRiw7zMeDOK5_pjSS"
parameters:
- name: num_gpus
type: integer
default: 1
description: Number of GPUs to use
- name: precision
type: string
default: fp16
description: Precision to use (fp16 or fp32)
- name: micro-batch-size
type: integer
default: 8
description: Micro batch size for inference
- step:
name: generate-proteins
image: nvidia/cuda:11.8.0-cudnn8-runtime-ubuntu22.04
environment: pro-trial-prod-oci-vm-gpu-a10-1
command:
- apt-get update && apt-get install -y python3-pip
- pip3 install torch==2.7.1+cu118 torchvision torchaudio --index-url https://download.pytorch.org/whl/cu118
- pip3 install -r requirements.txt
- python3 generate-proteins.py
environment-variables:
- name: WORK_DIR
default: "/valohai/outputs/protein_generation"
description: Working directory for the generation step
parameters:
- name: max_length
type: integer
default: 100
description: Maximum length of generated sequences
- name: top_k
type: integer
default: 950
description: Top-k sampling
- name: repetition_penalty
type: float
default: 1.2
- name: num_return_sequences
type: integer
default: 10
description: Number of sequences to generate
- name: eos_token_id
type: integer
default: 0
description: End-of-sequence token ID
- step:
name: evaluate-generated
image: docker.io/python:3.10
environment: pro-trial-prod-oci-vm-gpu-a10-1
command:
- pip install torch==2.7.1
- pip install -r requirements.txt
- python evaluate-generated.py
environment-variables:
- name: WORK_DIR
default: "/valohai/outputs/evaluate_generated"
description: Working directory for the generation step
inputs:
- name: sequences
default: "datum://01993303-06cb-3ff9-30b6-a78467ddd67b"
- step:
name: visualize-similarity
image: docker.io/python:3.10
environment: pro-trial-prod-oci-vm-gpu-a10-1
command:
- pip install torch pandas scikit-learn matplotlib valohai-utils
- python protein-similarity-visualization.py
inputs:
- name: embeddings
default: "datum://01993283-53bf-e659-b9df-d77062d76d84"
parameters:
- name: query_idx
type: integer
default: 0
description: Query index for similarity search
- name: topk
type: integer
default: 20
description: Number of top similar proteins to retrieve
- step:
name: deploy-NIM
image: docker.io/python:3.10
environment: pro-trial-prod-oci-vm-gpu-a10-1
command:
- pip install valohai-utils transformers>=4.41 torch>=2.6.0
- python convert-model.py
- apt-get update && apt-get install -y --no-install-recommends openssh-client ca-certificates && rm -rf /var/lib/apt/lists/*
# prepare the ssh key (Add your private key as a Valohai input)
- cp /valohai/inputs/key/tomi-gpu-test-2025-ec2-unsecure.pem /tmp/key.pem
# set the right permissions
- chmod 400 /tmp/key.pem
- ssh -o StrictHostKeyChecking=no -o UserKnownHostsFile=/dev/null -o IdentitiesOnly=yes -i /tmp/key.pem ec2-user@{parameter-value:host_name} "echo connected"
# ensure remote target folder exists
- ssh -o StrictHostKeyChecking=no -o UserKnownHostsFile=/dev/null -o IdentitiesOnly=yes -i /tmp/key.pem ec2-user@{parameter-value:host_name} "mkdir -p /home/ec2-user/models/protgpt2"
# copy the model files into that folder
- scp -o StrictHostKeyChecking=no -o UserKnownHostsFile=/dev/null -o IdentitiesOnly=yes -i /tmp/key.pem -r /valohai/outputs/my-output/ProtGPT2-safetensors/* ec2-user@{parameter-value:host_name}:/home/ec2-user/models/protgpt2/
# restart NIM to load the new model
- ssh -o StrictHostKeyChecking=no -o UserKnownHostsFile=/dev/null -o IdentitiesOnly=yes -i /tmp/key.pem ec2-user@{parameter-value:host_name} "~/restart_nim.sh"
parameters:
- name: host_name
type: string
default: 51.44.10.163
inputs:
- name: key
default: "datum://0199760b-5401-37b2-e22f-287f424bb6f3"
- pipeline:
name: bionemo_end_to_end
parameters:
- name: num_gpus
targets:
- predict-properties.parameters.num_gpus
default: 1
- name: precision
targets:
- predict-properties.parameters.precision
default: fp16
- name: micro-batch-size
targets:
- predict-properties.parameters.micro-batch-size
default: 8
- name: max_length
targets:
- generate-proteins.parameters.max_length
default: 100
- name: top_k
targets:
- generate-proteins.parameters.top_k
default: 950
- name: repetition_penalty
targets:
- generate-proteins.parameters.repetition_penalty
default: 1.2
- name: num_return_sequences
targets:
- generate-proteins.parameters.num_return_sequences
default: 10
- name: eos_token_id
targets:
- generate-proteins.parameters.eos_token_id
default: 0
- name: query_idx
targets:
- visualize-similarity.parameters.query_idx
default: 0
- name: topk
targets:
- visualize-similarity.parameters.topk
default: 20
nodes:
- name: load-data
type: execution
step: load-data
- name: predict-properties
type: execution
step: predict-properties
- name: visualize-similarity
type: execution
step: visualize-similarity
- name: generate-proteins
type: execution
step: generate-proteins
- name: evaluate-generated
type: execution
step: evaluate-generated
- name: deploy-NIM
type: execution
step: deploy-NIM
actions:
- when: node-starting
then: require-approval
edges:
- [load-data.outputs.*.zip, predict-properties.input.dataset]
- [
predict-properties.outputs.*.zip,
visualize-similarity.input.embeddings,
]
- [
generate-proteins.outputs.sequences*.*,
evaluate-generated.input.sequences,
]