Skip to content

Commit abc904e

Browse files
committed
Adding more PL models to the notebook.
1 parent 38f33a1 commit abc904e

File tree

1 file changed

+103
-2
lines changed

1 file changed

+103
-2
lines changed

trurl-2/deploying-trurl-2.ipynb

Lines changed: 103 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -125,6 +125,52 @@
125125
")"
126126
]
127127
},
128+
{
129+
"cell_type": "code",
130+
"execution_count": null,
131+
"id": "8ae55efa-7e92-476e-9a14-8f2759628d78",
132+
"metadata": {
133+
"tags": []
134+
},
135+
"outputs": [],
136+
"source": [
137+
"model_names = {\n",
138+
" 'qra': 'OPI-PG/Qra-7b',\n",
139+
" 'bielik': 'speakleash/Bielik-7B-v0.1',\n",
140+
" 'azurro-apt3': 'Azurro/APT3-1B-Base',\n",
141+
"}\n",
142+
"\n",
143+
"instance_type = 'ml.g5.2xlarge'\n",
144+
"num_of_gpus = 1\n",
145+
"\n",
146+
"container_startup_timeout = 300\n",
147+
"\n",
148+
"predictors = {}\n",
149+
"\n",
150+
"for (name, model_name) in model_names.items():\n",
151+
" print(f'Deploying {name} from {model_name} ...')\n",
152+
" \n",
153+
" env = {\n",
154+
" 'HF_MODEL_ID': model_name,\n",
155+
" 'SM_NUM_GPUS': json.dumps(num_of_gpus)\n",
156+
" }\n",
157+
"\n",
158+
" hf_image_uri = get_huggingface_llm_image_uri('huggingface', version='1.1.0')\n",
159+
"\n",
160+
" huggingface_model = HuggingFaceModel(\n",
161+
" image_uri=hf_image_uri,\n",
162+
" env=env,\n",
163+
" role=role, \n",
164+
" )\n",
165+
"\n",
166+
" predictors[name] = huggingface_model.deploy(\n",
167+
" initial_instance_count=1,\n",
168+
" instance_type=instance_type,\n",
169+
" container_startup_health_check_timeout=container_startup_timeout,\n",
170+
" endpoint_name=f'example-{name}-endpoint'\n",
171+
" )"
172+
]
173+
},
128174
{
129175
"cell_type": "markdown",
130176
"id": "11dfa13a-b2e0-4cf5-921d-38ee9c02697f",
@@ -150,14 +196,39 @@
150196
" 'temperature': 0.9,\n",
151197
" 'top_k': 50,\n",
152198
" 'max_new_tokens': 100,\n",
153-
" 'repetition_penalty': 1.05,\n",
199+
" 'repetition_penalty': 1.1,\n",
154200
" 'stop': ['</s>']\n",
155201
" }\n",
156202
"}\n",
157203
"\n",
158204
"predictor.predict(data)"
159205
]
160206
},
207+
{
208+
"cell_type": "code",
209+
"execution_count": null,
210+
"id": "c5475ef0-a93e-4c51-86f2-c4ef0f44d27e",
211+
"metadata": {
212+
"tags": []
213+
},
214+
"outputs": [],
215+
"source": [
216+
"data = {\n",
217+
" 'inputs': '<s>[INST]Kim jest Stanisław Lem?[/INST]',\n",
218+
" 'parameters': {\n",
219+
" 'do_sample': True,\n",
220+
" 'top_p': 0.6,\n",
221+
" 'temperature': 0.9,\n",
222+
" 'top_k': 50,\n",
223+
" 'max_new_tokens': 200,\n",
224+
" 'repetition_penalty': 1.1,\n",
225+
" 'stop': ['</s>']\n",
226+
" }\n",
227+
"}\n",
228+
"\n",
229+
"predictors['bielik'].predict(data)"
230+
]
231+
},
161232
{
162233
"cell_type": "code",
163234
"execution_count": null,
@@ -915,6 +986,36 @@
915986
"memoryGiB": 1152,
916987
"name": "ml.p4de.24xlarge",
917988
"vcpuNum": 96
989+
},
990+
{
991+
"_defaultOrder": 57,
992+
"_isFastLaunch": false,
993+
"category": "Accelerated computing",
994+
"gpuNum": 0,
995+
"hideHardwareSpecs": false,
996+
"memoryGiB": 32,
997+
"name": "ml.trn1.2xlarge",
998+
"vcpuNum": 8
999+
},
1000+
{
1001+
"_defaultOrder": 58,
1002+
"_isFastLaunch": false,
1003+
"category": "Accelerated computing",
1004+
"gpuNum": 0,
1005+
"hideHardwareSpecs": false,
1006+
"memoryGiB": 512,
1007+
"name": "ml.trn1.32xlarge",
1008+
"vcpuNum": 128
1009+
},
1010+
{
1011+
"_defaultOrder": 59,
1012+
"_isFastLaunch": false,
1013+
"category": "Accelerated computing",
1014+
"gpuNum": 0,
1015+
"hideHardwareSpecs": false,
1016+
"memoryGiB": 512,
1017+
"name": "ml.trn1n.32xlarge",
1018+
"vcpuNum": 128
9181019
}
9191020
],
9201021
"instance_type": "ml.t3.medium",
@@ -924,7 +1025,7 @@
9241025
"kernelspec": {
9251026
"display_name": "Python 3 (Data Science 3.0)",
9261027
"language": "python",
927-
"name": "python3__SAGEMAKER_INTERNAL__arn:aws:sagemaker:eu-west-1:470317259841:image/sagemaker-data-science-310-v1"
1028+
"name": "python3__SAGEMAKER_INTERNAL__arn:aws:sagemaker:us-west-2:236514542706:image/sagemaker-data-science-310-v1"
9281029
},
9291030
"language_info": {
9301031
"codemirror_mode": {

0 commit comments

Comments
 (0)