Theguys808 commited on
Commit
309eb21
·
verified ·
1 Parent(s): c2e207e

Update README.md

Browse files
Files changed (1) hide show
  1. README.md +39 -3
README.md CHANGED
@@ -1,3 +1,39 @@
1
- ---
2
- license: creativeml-openrail-m
3
- ---
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ---
2
+ license: bigscience-bloom-rail-1.0
3
+ ---
4
+ ---
5
+ license: creativeml-openrail-m
6
+ ---import json
7
+ import sagemaker
8
+ import boto3
9
+ from sagemaker.huggingface import HuggingFaceModel, get_huggingface_llm_image_uri
10
+
11
+ try:
12
+ role = sagemaker.get_execution_role()
13
+ except ValueError:
14
+ iam = boto3.client('iam')
15
+ role = iam.get_role(RoleName='sagemaker_execution_role')['Role']['Arn']
16
+
17
+ # Hub Model configuration. https://huggingface.co/models
18
+ hub = {
19
+ 'HF_MODEL_ID':'intfloat/multilingual-e5-small'
20
+ }
21
+
22
+
23
+ # create Hugging Face Model Class
24
+ huggingface_model = HuggingFaceModel(
25
+ image_uri=get_huggingface_llm_image_uri("huggingface-tei",version="1.2.3"),
26
+ env=hub,
27
+ role=role,
28
+ )
29
+
30
+ # deploy model to SageMaker Inference
31
+ predictor = huggingface_model.deploy(
32
+ initial_instance_count=1,
33
+ instance_type="ml.g5.2xlarge",
34
+ )
35
+
36
+ # send request
37
+ predictor.predict({
38
+ "inputs": "My name is Clara and I am",
39
+ })