from sagemaker.huggingface import HuggingFaceModel
import boto3

iam_client = boto3.client('iam')
role = iam_client.get_role(RoleName='{IAM_ROLE_WITH_SAGEMAKER_PERMISSIONS}')['Role']['Arn']
# Hub Model configuration. https://huggingface.co/models
hub = {
	'HF_MODEL_ID':'lisdarr/fuck_shanghai_covid19',
	'HF_TASK':'fill-mask'
}

# create Hugging Face Model Class
huggingface_model = HuggingFaceModel(
	transformers_version='4.17.0',
	pytorch_version='1.10.2',
	py_version='py38',
	env=hub,
	role=role, 
)

# deploy model to SageMaker Inference
predictor = huggingface_model.deploy(
	initial_instance_count=1, # number of instances
	instance_type='ml.m5.xlarge' # ec2 instance type
)

predictor.predict({
	'inputs': "The answer to the universe is [MASK]."
})

{"license": "openrail"}
license:openrail region:us
TAGS
#license-openrail #region-us 

from sagemaker.huggingface import HuggingFaceModel
import boto3

iam_client = URL('iam')
role = iam_client.get_role(RoleName='{IAM_ROLE_WITH_SAGEMAKER_PERMISSIONS}')['Role']['Arn']
# Hub Model configuration. URL
hub = {
	'HF_MODEL_ID':'lisdarr/fuck_shanghai_covid19',
	'HF_TASK':'fill-mask'
}

# create Hugging Face Model Class
huggingface_model = HuggingFaceModel(
	transformers_version='4.17.0',
	pytorch_version='1.10.2',
	py_version='py38',
	env=hub,
	role=role, 
)

# deploy model to SageMaker Inference
predictor = huggingface_model.deploy(
	initial_instance_count=1, # number of instances
	instance_type='URL' # ec2 instance type
)

predictor.predict({
	'inputs': "The answer to the universe is [MASK]."
})

# Hub Model configuration. URL
hub = {
	'HF_MODEL_ID':'lisdarr/fuck_shanghai_covid19',
	'HF_TASK':'fill-mask'
} # create Hugging Face Model Class
huggingface_model = HuggingFaceModel(
	transformers_version='4.17.0',
	pytorch_version='1.10.2',
	py_version='py38',
	env=hub,
	role=role, 
) # deploy model to SageMaker Inference
predictor = huggingface_model.deploy(
	initial_instance_count=1, # number of instances
	instance_type='URL' # ec2 instance type
)

predictor.predict({
	'inputs': "The answer to the universe is [MASK]."
})
TAGS
#license-openrail #region-us 
 # Hub Model configuration. URL
hub = {
	'HF_MODEL_ID':'lisdarr/fuck_shanghai_covid19',
	'HF_TASK':'fill-mask'
} # create Hugging Face Model Class
huggingface_model = HuggingFaceModel(
	transformers_version='4.17.0',
	pytorch_version='1.10.2',
	py_version='py38',
	env=hub,
	role=role, 
) # deploy model to SageMaker Inference
predictor = huggingface_model.deploy(
	initial_instance_count=1, # number of instances
	instance_type='URL' # ec2 instance type
)

predictor.predict({
	'inputs': "The answer to the universe is [MASK]."
})
TAGS
#license-openrail #region-us 
# Hub Model configuration. URL
hub = {
	'HF_MODEL_ID':'lisdarr/fuck_shanghai_covid19',
	'HF_TASK':'fill-mask'
}# create Hugging Face Model Class
huggingface_model = HuggingFaceModel(
	transformers_version='4.17.0',
	pytorch_version='1.10.2',
	py_version='py38',
	env=hub,
	role=role, 
)# deploy model to SageMaker Inference
predictor = huggingface_model.deploy(
	initial_instance_count=1, # number of instances
	instance_type='URL' # ec2 instance type
)

predictor.predict({
	'inputs': "The answer to the universe is [MASK]."
})