Openai/clip-vit-large-patch14 model: Difference between revisions

From AI Wiki
(Created page with "{{Model infobox | hugging-face-uri = openai/clip-vit-base-patch16 | creator = | type = Computer Vision | task = Zero-Shot Image Classification | library = PyTorch, JAX, Transformers | dataset = | language = | paper = | license = arxiv:2103.00020, arxiv:1908.04913 | related-to = clip, vision | all-tags = Zero-Shot Image Classification, PyTorch, JAX, Transformers, clip, vision, arxiv:2103.00020, arxiv:1908.04913 | all-lang-tags = }} ==Model Description== ==Clone Mod...")
 
No edit summary
Line 1: Line 1:
{{Model infobox
{{Model infobox
| hugging-face-uri = openai/clip-vit-base-patch16
| hugging-face-uri = openai/clip-vit-large-patch14
| creator =  
| creator =  
| type = Computer Vision
| type = Computer Vision
| task = Zero-Shot Image Classification
| task = Zero-Shot Image Classification
| library = PyTorch, JAX, Transformers
| library = PyTorch, TensorFlow, JAX, Transformers
| dataset =  
| dataset =  
| language =  
| language =  
Line 10: Line 10:
| license = arxiv:2103.00020, arxiv:1908.04913
| license = arxiv:2103.00020, arxiv:1908.04913
| related-to = clip, vision
| related-to = clip, vision
| all-tags = Zero-Shot Image Classification, PyTorch, JAX, Transformers, clip, vision, arxiv:2103.00020, arxiv:1908.04913
| all-tags = Zero-Shot Image Classification, PyTorch, TensorFlow, JAX, Transformers, clip, vision, arxiv:2103.00020, arxiv:1908.04913
| all-lang-tags =  
| all-lang-tags =  
}}
}}


==Model Description==
==Model Description==
==Comments==
<comments />


==Clone Model Repository==
==Clone Model Repository==
Line 22: Line 25:
#Be sure to have git-lfs installed (https://git-lfs.com)
#Be sure to have git-lfs installed (https://git-lfs.com)
git lfs install
git lfs install
git clone https://huggingface.co/openai/clip-vit-base-patch16
git clone https://huggingface.co/openai/clip-vit-large-patch14
    
    
#To clone the repo without large files – just their pointers
#To clone the repo without large files – just their pointers
Line 33: Line 36:
#Be sure to have git-lfs installed (https://git-lfs.com)
#Be sure to have git-lfs installed (https://git-lfs.com)
git lfs install
git lfs install
git clone [email protected]:openai/clip-vit-base-patch16
git clone [email protected]:openai/clip-vit-large-patch14
    
    
#To clone the repo without large files – just their pointers
#To clone the repo without large files – just their pointers
Line 45: Line 48:
from transformers import AutoProcessor, AutoModelForZeroShotImageClassification
from transformers import AutoProcessor, AutoModelForZeroShotImageClassification


processor = AutoProcessor.from_pretrained("openai/clip-vit-base-patch16")
processor = AutoProcessor.from_pretrained("openai/clip-vit-large-patch14")


model = AutoModelForZeroShotImageClassification.from_pretrained("openai/clip-vit-base-patch16")
model = AutoModelForZeroShotImageClassification.from_pretrained("openai/clip-vit-large-patch14")
</pre>
</pre>


==Deployment==
==Deployment==
===Inference API===
===Inference API===
<tabber>
 
</tabber>


===Amazon SageMaker===
===Amazon SageMaker===
Line 67: Line 69:
# Hub Model configuration. https://huggingface.co/models
# Hub Model configuration. https://huggingface.co/models
hub = {
hub = {
'HF_MODEL_ID':'openai/clip-vit-base-patch16',
'HF_MODEL_ID':'openai/clip-vit-large-patch14',
'HF_TASK':'automatic-speech-recognition'
'HF_TASK':'automatic-speech-recognition'
}
}
Line 100: Line 102:
# Hub Model configuration. https://huggingface.co/models
# Hub Model configuration. https://huggingface.co/models
hub = {
hub = {
'HF_MODEL_ID':'openai/clip-vit-base-patch16',
'HF_MODEL_ID':'openai/clip-vit-large-patch14',
'HF_TASK':'automatic-speech-recognition'
'HF_TASK':'automatic-speech-recognition'
}
}
Line 134: Line 136:
# Hub Model configuration. https://huggingface.co/models
# Hub Model configuration. https://huggingface.co/models
hub = {
hub = {
'HF_MODEL_ID':'openai/clip-vit-base-patch16',
'HF_MODEL_ID':'openai/clip-vit-large-patch14',
'HF_TASK':'conversational'
'HF_TASK':'conversational'
}
}
Line 167: Line 169:
# Hub Model configuration. https://huggingface.co/models
# Hub Model configuration. https://huggingface.co/models
hub = {
hub = {
'HF_MODEL_ID':'openai/clip-vit-base-patch16',
'HF_MODEL_ID':'openai/clip-vit-large-patch14',
'HF_TASK':'conversational'
'HF_TASK':'conversational'
}
}
Line 201: Line 203:
# Hub Model configuration. https://huggingface.co/models
# Hub Model configuration. https://huggingface.co/models
hub = {
hub = {
'HF_MODEL_ID':'openai/clip-vit-base-patch16',
'HF_MODEL_ID':'openai/clip-vit-large-patch14',
'HF_TASK':'feature-extraction'
'HF_TASK':'feature-extraction'
}
}
Line 234: Line 236:
# Hub Model configuration. https://huggingface.co/models
# Hub Model configuration. https://huggingface.co/models
hub = {
hub = {
'HF_MODEL_ID':'openai/clip-vit-base-patch16',
'HF_MODEL_ID':'openai/clip-vit-large-patch14',
'HF_TASK':'feature-extraction'
'HF_TASK':'feature-extraction'
}
}
Line 268: Line 270:
# Hub Model configuration. https://huggingface.co/models
# Hub Model configuration. https://huggingface.co/models
hub = {
hub = {
'HF_MODEL_ID':'openai/clip-vit-base-patch16',
'HF_MODEL_ID':'openai/clip-vit-large-patch14',
'HF_TASK':'fill-mask'
'HF_TASK':'fill-mask'
}
}
Line 301: Line 303:
# Hub Model configuration. https://huggingface.co/models
# Hub Model configuration. https://huggingface.co/models
hub = {
hub = {
'HF_MODEL_ID':'openai/clip-vit-base-patch16',
'HF_MODEL_ID':'openai/clip-vit-large-patch14',
'HF_TASK':'fill-mask'
'HF_TASK':'fill-mask'
}
}
Line 335: Line 337:
# Hub Model configuration. https://huggingface.co/models
# Hub Model configuration. https://huggingface.co/models
hub = {
hub = {
'HF_MODEL_ID':'openai/clip-vit-base-patch16',
'HF_MODEL_ID':'openai/clip-vit-large-patch14',
'HF_TASK':'image-classification'
'HF_TASK':'image-classification'
}
}
Line 368: Line 370:
# Hub Model configuration. https://huggingface.co/models
# Hub Model configuration. https://huggingface.co/models
hub = {
hub = {
'HF_MODEL_ID':'openai/clip-vit-base-patch16',
'HF_MODEL_ID':'openai/clip-vit-large-patch14',
'HF_TASK':'image-classification'
'HF_TASK':'image-classification'
}
}
Line 402: Line 404:
# Hub Model configuration. https://huggingface.co/models
# Hub Model configuration. https://huggingface.co/models
hub = {
hub = {
'HF_MODEL_ID':'openai/clip-vit-base-patch16',
'HF_MODEL_ID':'openai/clip-vit-large-patch14',
'HF_TASK':'question-answering'
'HF_TASK':'question-answering'
}
}
Line 435: Line 437:
# Hub Model configuration. https://huggingface.co/models
# Hub Model configuration. https://huggingface.co/models
hub = {
hub = {
'HF_MODEL_ID':'openai/clip-vit-base-patch16',
'HF_MODEL_ID':'openai/clip-vit-large-patch14',
'HF_TASK':'question-answering'
'HF_TASK':'question-answering'
}
}
Line 469: Line 471:
# Hub Model configuration. https://huggingface.co/models
# Hub Model configuration. https://huggingface.co/models
hub = {
hub = {
'HF_MODEL_ID':'openai/clip-vit-base-patch16',
'HF_MODEL_ID':'openai/clip-vit-large-patch14',
'HF_TASK':'summarization'
'HF_TASK':'summarization'
}
}
Line 502: Line 504:
# Hub Model configuration. https://huggingface.co/models
# Hub Model configuration. https://huggingface.co/models
hub = {
hub = {
'HF_MODEL_ID':'openai/clip-vit-base-patch16',
'HF_MODEL_ID':'openai/clip-vit-large-patch14',
'HF_TASK':'summarization'
'HF_TASK':'summarization'
}
}
Line 536: Line 538:
# Hub Model configuration. https://huggingface.co/models
# Hub Model configuration. https://huggingface.co/models
hub = {
hub = {
'HF_MODEL_ID':'openai/clip-vit-base-patch16',
'HF_MODEL_ID':'openai/clip-vit-large-patch14',
'HF_TASK':'table-question-answering'
'HF_TASK':'table-question-answering'
}
}
Line 569: Line 571:
# Hub Model configuration. https://huggingface.co/models
# Hub Model configuration. https://huggingface.co/models
hub = {
hub = {
'HF_MODEL_ID':'openai/clip-vit-base-patch16',
'HF_MODEL_ID':'openai/clip-vit-large-patch14',
'HF_TASK':'table-question-answering'
'HF_TASK':'table-question-answering'
}
}
Line 603: Line 605:
# Hub Model configuration. https://huggingface.co/models
# Hub Model configuration. https://huggingface.co/models
hub = {
hub = {
'HF_MODEL_ID':'openai/clip-vit-base-patch16',
'HF_MODEL_ID':'openai/clip-vit-large-patch14',
'HF_TASK':'text-classification'
'HF_TASK':'text-classification'
}
}
Line 636: Line 638:
# Hub Model configuration. https://huggingface.co/models
# Hub Model configuration. https://huggingface.co/models
hub = {
hub = {
'HF_MODEL_ID':'openai/clip-vit-base-patch16',
'HF_MODEL_ID':'openai/clip-vit-large-patch14',
'HF_TASK':'text-classification'
'HF_TASK':'text-classification'
}
}
Line 670: Line 672:
# Hub Model configuration. https://huggingface.co/models
# Hub Model configuration. https://huggingface.co/models
hub = {
hub = {
'HF_MODEL_ID':'openai/clip-vit-base-patch16',
'HF_MODEL_ID':'openai/clip-vit-large-patch14',
'HF_TASK':'text-generation'
'HF_TASK':'text-generation'
}
}
Line 703: Line 705:
# Hub Model configuration. https://huggingface.co/models
# Hub Model configuration. https://huggingface.co/models
hub = {
hub = {
'HF_MODEL_ID':'openai/clip-vit-base-patch16',
'HF_MODEL_ID':'openai/clip-vit-large-patch14',
'HF_TASK':'text-generation'
'HF_TASK':'text-generation'
}
}
Line 737: Line 739:
# Hub Model configuration. https://huggingface.co/models
# Hub Model configuration. https://huggingface.co/models
hub = {
hub = {
'HF_MODEL_ID':'openai/clip-vit-base-patch16',
'HF_MODEL_ID':'openai/clip-vit-large-patch14',
'HF_TASK':'text2text-generation'
'HF_TASK':'text2text-generation'
}
}
Line 770: Line 772:
# Hub Model configuration. https://huggingface.co/models
# Hub Model configuration. https://huggingface.co/models
hub = {
hub = {
'HF_MODEL_ID':'openai/clip-vit-base-patch16',
'HF_MODEL_ID':'openai/clip-vit-large-patch14',
'HF_TASK':'text2text-generation'
'HF_TASK':'text2text-generation'
}
}
Line 804: Line 806:
# Hub Model configuration. https://huggingface.co/models
# Hub Model configuration. https://huggingface.co/models
hub = {
hub = {
'HF_MODEL_ID':'openai/clip-vit-base-patch16',
'HF_MODEL_ID':'openai/clip-vit-large-patch14',
'HF_TASK':'token-classification'
'HF_TASK':'token-classification'
}
}
Line 837: Line 839:
# Hub Model configuration. https://huggingface.co/models
# Hub Model configuration. https://huggingface.co/models
hub = {
hub = {
'HF_MODEL_ID':'openai/clip-vit-base-patch16',
'HF_MODEL_ID':'openai/clip-vit-large-patch14',
'HF_TASK':'token-classification'
'HF_TASK':'token-classification'
}
}
Line 871: Line 873:
# Hub Model configuration. https://huggingface.co/models
# Hub Model configuration. https://huggingface.co/models
hub = {
hub = {
'HF_MODEL_ID':'openai/clip-vit-base-patch16',
'HF_MODEL_ID':'openai/clip-vit-large-patch14',
'HF_TASK':'translation'
'HF_TASK':'translation'
}
}
Line 904: Line 906:
# Hub Model configuration. https://huggingface.co/models
# Hub Model configuration. https://huggingface.co/models
hub = {
hub = {
'HF_MODEL_ID':'openai/clip-vit-base-patch16',
'HF_MODEL_ID':'openai/clip-vit-large-patch14',
'HF_TASK':'translation'
'HF_TASK':'translation'
}
}
Line 938: Line 940:
# Hub Model configuration. https://huggingface.co/models
# Hub Model configuration. https://huggingface.co/models
hub = {
hub = {
'HF_MODEL_ID':'openai/clip-vit-base-patch16',
'HF_MODEL_ID':'openai/clip-vit-large-patch14',
'HF_TASK':'zero-shot-classification'
'HF_TASK':'zero-shot-classification'
}
}
Line 971: Line 973:
# Hub Model configuration. https://huggingface.co/models
# Hub Model configuration. https://huggingface.co/models
hub = {
hub = {
'HF_MODEL_ID':'openai/clip-vit-base-patch16',
'HF_MODEL_ID':'openai/clip-vit-large-patch14',
'HF_TASK':'zero-shot-classification'
'HF_TASK':'zero-shot-classification'
}
}
Line 1,001: Line 1,003:
import gradio as gr
import gradio as gr


gr.Interface.load("models/openai/clip-vit-base-patch16").launch()
gr.Interface.load("models/openai/clip-vit-large-patch14").launch()
</pre>
</pre>


Line 1,017: Line 1,019:
role = sagemaker.get_execution_role()
role = sagemaker.get_execution_role()
hyperparameters = {
hyperparameters = {
'model_name_or_path':'openai/clip-vit-base-patch16',
'model_name_or_path':'openai/clip-vit-large-patch14',
'output_dir':'/opt/ml/model'
'output_dir':'/opt/ml/model'
# add your remaining hyperparameters
# add your remaining hyperparameters
Line 1,054: Line 1,056:
role = iam_client.get_role(RoleName='{IAM_ROLE_WITH_SAGEMAKER_PERMISSIONS}')['Role']['Arn']
role = iam_client.get_role(RoleName='{IAM_ROLE_WITH_SAGEMAKER_PERMISSIONS}')['Role']['Arn']
hyperparameters = {
hyperparameters = {
'model_name_or_path':'openai/clip-vit-base-patch16',
'model_name_or_path':'openai/clip-vit-large-patch14',
'output_dir':'/opt/ml/model'
'output_dir':'/opt/ml/model'
# add your remaining hyperparameters
# add your remaining hyperparameters
Line 1,091: Line 1,093:
role = sagemaker.get_execution_role()
role = sagemaker.get_execution_role()
hyperparameters = {
hyperparameters = {
'model_name_or_path':'openai/clip-vit-base-patch16',
'model_name_or_path':'openai/clip-vit-large-patch14',
'output_dir':'/opt/ml/model'
'output_dir':'/opt/ml/model'
# add your remaining hyperparameters
# add your remaining hyperparameters
Line 1,128: Line 1,130:
role = iam_client.get_role(RoleName='{IAM_ROLE_WITH_SAGEMAKER_PERMISSIONS}')['Role']['Arn']
role = iam_client.get_role(RoleName='{IAM_ROLE_WITH_SAGEMAKER_PERMISSIONS}')['Role']['Arn']
hyperparameters = {
hyperparameters = {
'model_name_or_path':'openai/clip-vit-base-patch16',
'model_name_or_path':'openai/clip-vit-large-patch14',
'output_dir':'/opt/ml/model'
'output_dir':'/opt/ml/model'
# add your remaining hyperparameters
# add your remaining hyperparameters
Line 1,165: Line 1,167:
role = sagemaker.get_execution_role()
role = sagemaker.get_execution_role()
hyperparameters = {
hyperparameters = {
'model_name_or_path':'openai/clip-vit-base-patch16',
'model_name_or_path':'openai/clip-vit-large-patch14',
'output_dir':'/opt/ml/model'
'output_dir':'/opt/ml/model'
# add your remaining hyperparameters
# add your remaining hyperparameters
Line 1,202: Line 1,204:
role = iam_client.get_role(RoleName='{IAM_ROLE_WITH_SAGEMAKER_PERMISSIONS}')['Role']['Arn']
role = iam_client.get_role(RoleName='{IAM_ROLE_WITH_SAGEMAKER_PERMISSIONS}')['Role']['Arn']
hyperparameters = {
hyperparameters = {
'model_name_or_path':'openai/clip-vit-base-patch16',
'model_name_or_path':'openai/clip-vit-large-patch14',
'output_dir':'/opt/ml/model'
'output_dir':'/opt/ml/model'
# add your remaining hyperparameters
# add your remaining hyperparameters
Line 1,239: Line 1,241:
role = sagemaker.get_execution_role()
role = sagemaker.get_execution_role()
hyperparameters = {
hyperparameters = {
'model_name_or_path':'openai/clip-vit-base-patch16',
'model_name_or_path':'openai/clip-vit-large-patch14',
'output_dir':'/opt/ml/model'
'output_dir':'/opt/ml/model'
# add your remaining hyperparameters
# add your remaining hyperparameters
Line 1,276: Line 1,278:
role = iam_client.get_role(RoleName='{IAM_ROLE_WITH_SAGEMAKER_PERMISSIONS}')['Role']['Arn']
role = iam_client.get_role(RoleName='{IAM_ROLE_WITH_SAGEMAKER_PERMISSIONS}')['Role']['Arn']
hyperparameters = {
hyperparameters = {
'model_name_or_path':'openai/clip-vit-base-patch16',
'model_name_or_path':'openai/clip-vit-large-patch14',
'output_dir':'/opt/ml/model'
'output_dir':'/opt/ml/model'
# add your remaining hyperparameters
# add your remaining hyperparameters
Line 1,313: Line 1,315:
role = sagemaker.get_execution_role()
role = sagemaker.get_execution_role()
hyperparameters = {
hyperparameters = {
'model_name_or_path':'openai/clip-vit-base-patch16',
'model_name_or_path':'openai/clip-vit-large-patch14',
'output_dir':'/opt/ml/model'
'output_dir':'/opt/ml/model'
# add your remaining hyperparameters
# add your remaining hyperparameters
Line 1,350: Line 1,352:
role = iam_client.get_role(RoleName='{IAM_ROLE_WITH_SAGEMAKER_PERMISSIONS}')['Role']['Arn']
role = iam_client.get_role(RoleName='{IAM_ROLE_WITH_SAGEMAKER_PERMISSIONS}')['Role']['Arn']
hyperparameters = {
hyperparameters = {
'model_name_or_path':'openai/clip-vit-base-patch16',
'model_name_or_path':'openai/clip-vit-large-patch14',
'output_dir':'/opt/ml/model'
'output_dir':'/opt/ml/model'
# add your remaining hyperparameters
# add your remaining hyperparameters
Line 1,387: Line 1,389:
role = sagemaker.get_execution_role()
role = sagemaker.get_execution_role()
hyperparameters = {
hyperparameters = {
'model_name_or_path':'openai/clip-vit-base-patch16',
'model_name_or_path':'openai/clip-vit-large-patch14',
'output_dir':'/opt/ml/model'
'output_dir':'/opt/ml/model'
# add your remaining hyperparameters
# add your remaining hyperparameters
Line 1,424: Line 1,426:
role = iam_client.get_role(RoleName='{IAM_ROLE_WITH_SAGEMAKER_PERMISSIONS}')['Role']['Arn']
role = iam_client.get_role(RoleName='{IAM_ROLE_WITH_SAGEMAKER_PERMISSIONS}')['Role']['Arn']
hyperparameters = {
hyperparameters = {
'model_name_or_path':'openai/clip-vit-base-patch16',
'model_name_or_path':'openai/clip-vit-large-patch14',
'output_dir':'/opt/ml/model'
'output_dir':'/opt/ml/model'
# add your remaining hyperparameters
# add your remaining hyperparameters
Line 1,461: Line 1,463:
role = sagemaker.get_execution_role()
role = sagemaker.get_execution_role()
hyperparameters = {
hyperparameters = {
'model_name_or_path':'openai/clip-vit-base-patch16',
'model_name_or_path':'openai/clip-vit-large-patch14',
'output_dir':'/opt/ml/model'
'output_dir':'/opt/ml/model'
# add your remaining hyperparameters
# add your remaining hyperparameters
Line 1,498: Line 1,500:
role = iam_client.get_role(RoleName='{IAM_ROLE_WITH_SAGEMAKER_PERMISSIONS}')['Role']['Arn']
role = iam_client.get_role(RoleName='{IAM_ROLE_WITH_SAGEMAKER_PERMISSIONS}')['Role']['Arn']
hyperparameters = {
hyperparameters = {
'model_name_or_path':'openai/clip-vit-base-patch16',
'model_name_or_path':'openai/clip-vit-large-patch14',
'output_dir':'/opt/ml/model'
'output_dir':'/opt/ml/model'
# add your remaining hyperparameters
# add your remaining hyperparameters

Revision as of 18:32, 21 May 2023

Openai/clip-vit-large-patch14 model is a Computer Vision model used for Zero-Shot Image Classification.

Model Description

Comments

Loading comments...

Clone Model Repository

#Be sure to have git-lfs installed (https://git-lfs.com)
git lfs install
git clone https://huggingface.co/openai/clip-vit-large-patch14
  
#To clone the repo without large files – just their pointers
#prepend git clone with the following env var:
GIT_LFS_SKIP_SMUDGE=1

#Be sure to have git-lfs installed (https://git-lfs.com)
git lfs install
git clone [email protected]:openai/clip-vit-large-patch14
  
#To clone the repo without large files – just their pointers
#prepend git clone with the following env var:
GIT_LFS_SKIP_SMUDGE=1

Hugging Face Transformers Library

from transformers import AutoProcessor, AutoModelForZeroShotImageClassification

processor = AutoProcessor.from_pretrained("openai/clip-vit-large-patch14")

model = AutoModelForZeroShotImageClassification.from_pretrained("openai/clip-vit-large-patch14")

Deployment

Inference API

Amazon SageMaker

from sagemaker.huggingface import HuggingFaceModel
import sagemaker

role = sagemaker.get_execution_role()
# Hub Model configuration. https://huggingface.co/models
hub = {
	'HF_MODEL_ID':'openai/clip-vit-large-patch14',
	'HF_TASK':'automatic-speech-recognition'
}

# 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': No input example has been defined for this model task.
})

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':'openai/clip-vit-large-patch14',
	'HF_TASK':'automatic-speech-recognition'
}

# 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': No input example has been defined for this model task.
})

from sagemaker.huggingface import HuggingFaceModel
import sagemaker

role = sagemaker.get_execution_role()
# Hub Model configuration. https://huggingface.co/models
hub = {
	'HF_MODEL_ID':'openai/clip-vit-large-patch14',
	'HF_TASK':'conversational'
}

# 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': No input example has been defined for this model task.
})

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':'openai/clip-vit-large-patch14',
	'HF_TASK':'conversational'
}

# 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': No input example has been defined for this model task.
})

from sagemaker.huggingface import HuggingFaceModel
import sagemaker

role = sagemaker.get_execution_role()
# Hub Model configuration. https://huggingface.co/models
hub = {
	'HF_MODEL_ID':'openai/clip-vit-large-patch14',
	'HF_TASK':'feature-extraction'
}

# 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': No input example has been defined for this model task.
})

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':'openai/clip-vit-large-patch14',
	'HF_TASK':'feature-extraction'
}

# 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': No input example has been defined for this model task.
})

from sagemaker.huggingface import HuggingFaceModel
import sagemaker

role = sagemaker.get_execution_role()
# Hub Model configuration. https://huggingface.co/models
hub = {
	'HF_MODEL_ID':'openai/clip-vit-large-patch14',
	'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': No input example has been defined for this model task.
})

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':'openai/clip-vit-large-patch14',
	'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': No input example has been defined for this model task.
})

from sagemaker.huggingface import HuggingFaceModel
import sagemaker

role = sagemaker.get_execution_role()
# Hub Model configuration. https://huggingface.co/models
hub = {
	'HF_MODEL_ID':'openai/clip-vit-large-patch14',
	'HF_TASK':'image-classification'
}

# 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': No input example has been defined for this model task.
})

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':'openai/clip-vit-large-patch14',
	'HF_TASK':'image-classification'
}

# 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': No input example has been defined for this model task.
})

from sagemaker.huggingface import HuggingFaceModel
import sagemaker

role = sagemaker.get_execution_role()
# Hub Model configuration. https://huggingface.co/models
hub = {
	'HF_MODEL_ID':'openai/clip-vit-large-patch14',
	'HF_TASK':'question-answering'
}

# 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': No input example has been defined for this model task.
})

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':'openai/clip-vit-large-patch14',
	'HF_TASK':'question-answering'
}

# 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': No input example has been defined for this model task.
})

from sagemaker.huggingface import HuggingFaceModel
import sagemaker

role = sagemaker.get_execution_role()
# Hub Model configuration. https://huggingface.co/models
hub = {
	'HF_MODEL_ID':'openai/clip-vit-large-patch14',
	'HF_TASK':'summarization'
}

# 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': No input example has been defined for this model task.
})

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':'openai/clip-vit-large-patch14',
	'HF_TASK':'summarization'
}

# 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': No input example has been defined for this model task.
})

from sagemaker.huggingface import HuggingFaceModel
import sagemaker

role = sagemaker.get_execution_role()
# Hub Model configuration. https://huggingface.co/models
hub = {
	'HF_MODEL_ID':'openai/clip-vit-large-patch14',
	'HF_TASK':'table-question-answering'
}

# 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': No input example has been defined for this model task.
})

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':'openai/clip-vit-large-patch14',
	'HF_TASK':'table-question-answering'
}

# 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': No input example has been defined for this model task.
})

from sagemaker.huggingface import HuggingFaceModel
import sagemaker

role = sagemaker.get_execution_role()
# Hub Model configuration. https://huggingface.co/models
hub = {
	'HF_MODEL_ID':'openai/clip-vit-large-patch14',
	'HF_TASK':'text-classification'
}

# 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': No input example has been defined for this model task.
})

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':'openai/clip-vit-large-patch14',
	'HF_TASK':'text-classification'
}

# 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': No input example has been defined for this model task.
})

from sagemaker.huggingface import HuggingFaceModel
import sagemaker

role = sagemaker.get_execution_role()
# Hub Model configuration. https://huggingface.co/models
hub = {
	'HF_MODEL_ID':'openai/clip-vit-large-patch14',
	'HF_TASK':'text-generation'
}

# 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': No input example has been defined for this model task.
})

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':'openai/clip-vit-large-patch14',
	'HF_TASK':'text-generation'
}

# 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': No input example has been defined for this model task.
})

from sagemaker.huggingface import HuggingFaceModel
import sagemaker

role = sagemaker.get_execution_role()
# Hub Model configuration. https://huggingface.co/models
hub = {
	'HF_MODEL_ID':'openai/clip-vit-large-patch14',
	'HF_TASK':'text2text-generation'
}

# 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': No input example has been defined for this model task.
})

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':'openai/clip-vit-large-patch14',
	'HF_TASK':'text2text-generation'
}

# 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': No input example has been defined for this model task.
})

from sagemaker.huggingface import HuggingFaceModel
import sagemaker

role = sagemaker.get_execution_role()
# Hub Model configuration. https://huggingface.co/models
hub = {
	'HF_MODEL_ID':'openai/clip-vit-large-patch14',
	'HF_TASK':'token-classification'
}

# 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': No input example has been defined for this model task.
})

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':'openai/clip-vit-large-patch14',
	'HF_TASK':'token-classification'
}

# 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': No input example has been defined for this model task.
})

from sagemaker.huggingface import HuggingFaceModel
import sagemaker

role = sagemaker.get_execution_role()
# Hub Model configuration. https://huggingface.co/models
hub = {
	'HF_MODEL_ID':'openai/clip-vit-large-patch14',
	'HF_TASK':'translation'
}

# 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': No input example has been defined for this model task.
})

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':'openai/clip-vit-large-patch14',
	'HF_TASK':'translation'
}

# 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': No input example has been defined for this model task.
})

from sagemaker.huggingface import HuggingFaceModel
import sagemaker

role = sagemaker.get_execution_role()
# Hub Model configuration. https://huggingface.co/models
hub = {
	'HF_MODEL_ID':'openai/clip-vit-large-patch14',
	'HF_TASK':'zero-shot-classification'
}

# 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': No input example has been defined for this model task.
})

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':'openai/clip-vit-large-patch14',
	'HF_TASK':'zero-shot-classification'
}

# 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': No input example has been defined for this model task.
})

Spaces

import gradio as gr

gr.Interface.load("models/openai/clip-vit-large-patch14").launch()

Training

Amazon SageMaker

import sagemaker
from sagemaker.huggingface import HuggingFace

# gets role for executing training job
role = sagemaker.get_execution_role()
hyperparameters = {
	'model_name_or_path':'openai/clip-vit-large-patch14',
	'output_dir':'/opt/ml/model'
	# add your remaining hyperparameters
	# more info here https://github.com/huggingface/transformers/tree/v4.17.0/examples/pytorch/language-modeling
}

# git configuration to download our fine-tuning script
git_config = {'repo': 'https://github.com/huggingface/transformers.git','branch': 'v4.17.0'}

# creates Hugging Face estimator
huggingface_estimator = HuggingFace(
	entry_point='run_clm.py',
	source_dir='./examples/pytorch/language-modeling',
	instance_type='ml.p3.2xlarge',
	instance_count=1,
	role=role,
	git_config=git_config,
	transformers_version='4.17.0',
	pytorch_version='1.10.2',
	py_version='py38',
	hyperparameters = hyperparameters
)

# starting the train job
huggingface_estimator.fit()

import sagemaker
import boto3
from sagemaker.huggingface import HuggingFace

# gets role for executing training job
iam_client = boto3.client('iam')
role = iam_client.get_role(RoleName='{IAM_ROLE_WITH_SAGEMAKER_PERMISSIONS}')['Role']['Arn']
hyperparameters = {
	'model_name_or_path':'openai/clip-vit-large-patch14',
	'output_dir':'/opt/ml/model'
	# add your remaining hyperparameters
	# more info here https://github.com/huggingface/transformers/tree/v4.17.0/examples/pytorch/language-modeling
}

# git configuration to download our fine-tuning script
git_config = {'repo': 'https://github.com/huggingface/transformers.git','branch': 'v4.17.0'}

# creates Hugging Face estimator
huggingface_estimator = HuggingFace(
	entry_point='run_clm.py',
	source_dir='./examples/pytorch/language-modeling',
	instance_type='ml.p3.2xlarge',
	instance_count=1,
	role=role,
	git_config=git_config,
	transformers_version='4.17.0',
	pytorch_version='1.10.2',
	py_version='py38',
	hyperparameters = hyperparameters
)

# starting the train job
huggingface_estimator.fit()

import sagemaker
from sagemaker.huggingface import HuggingFace

# gets role for executing training job
role = sagemaker.get_execution_role()
hyperparameters = {
	'model_name_or_path':'openai/clip-vit-large-patch14',
	'output_dir':'/opt/ml/model'
	# add your remaining hyperparameters
	# more info here https://github.com/huggingface/transformers/tree/v4.17.0/examples/pytorch/language-modeling
}

# git configuration to download our fine-tuning script
git_config = {'repo': 'https://github.com/huggingface/transformers.git','branch': 'v4.17.0'}

# creates Hugging Face estimator
huggingface_estimator = HuggingFace(
	entry_point='run_mlm.py',
	source_dir='./examples/pytorch/language-modeling',
	instance_type='ml.p3.2xlarge',
	instance_count=1,
	role=role,
	git_config=git_config,
	transformers_version='4.17.0',
	pytorch_version='1.10.2',
	py_version='py38',
	hyperparameters = hyperparameters
)

# starting the train job
huggingface_estimator.fit()

import sagemaker
import boto3
from sagemaker.huggingface import HuggingFace

# gets role for executing training job
iam_client = boto3.client('iam')
role = iam_client.get_role(RoleName='{IAM_ROLE_WITH_SAGEMAKER_PERMISSIONS}')['Role']['Arn']
hyperparameters = {
	'model_name_or_path':'openai/clip-vit-large-patch14',
	'output_dir':'/opt/ml/model'
	# add your remaining hyperparameters
	# more info here https://github.com/huggingface/transformers/tree/v4.17.0/examples/pytorch/language-modeling
}

# git configuration to download our fine-tuning script
git_config = {'repo': 'https://github.com/huggingface/transformers.git','branch': 'v4.17.0'}

# creates Hugging Face estimator
huggingface_estimator = HuggingFace(
	entry_point='run_mlm.py',
	source_dir='./examples/pytorch/language-modeling',
	instance_type='ml.p3.2xlarge',
	instance_count=1,
	role=role,
	git_config=git_config,
	transformers_version='4.17.0',
	pytorch_version='1.10.2',
	py_version='py38',
	hyperparameters = hyperparameters
)

# starting the train job
huggingface_estimator.fit()

import sagemaker
from sagemaker.huggingface import HuggingFace

# gets role for executing training job
role = sagemaker.get_execution_role()
hyperparameters = {
	'model_name_or_path':'openai/clip-vit-large-patch14',
	'output_dir':'/opt/ml/model'
	# add your remaining hyperparameters
	# more info here https://github.com/huggingface/transformers/tree/v4.17.0/examples/pytorch/question-answering
}

# git configuration to download our fine-tuning script
git_config = {'repo': 'https://github.com/huggingface/transformers.git','branch': 'v4.17.0'}

# creates Hugging Face estimator
huggingface_estimator = HuggingFace(
	entry_point='run_qa.py',
	source_dir='./examples/pytorch/question-answering',
	instance_type='ml.p3.2xlarge',
	instance_count=1,
	role=role,
	git_config=git_config,
	transformers_version='4.17.0',
	pytorch_version='1.10.2',
	py_version='py38',
	hyperparameters = hyperparameters
)

# starting the train job
huggingface_estimator.fit()

import sagemaker
import boto3
from sagemaker.huggingface import HuggingFace

# gets role for executing training job
iam_client = boto3.client('iam')
role = iam_client.get_role(RoleName='{IAM_ROLE_WITH_SAGEMAKER_PERMISSIONS}')['Role']['Arn']
hyperparameters = {
	'model_name_or_path':'openai/clip-vit-large-patch14',
	'output_dir':'/opt/ml/model'
	# add your remaining hyperparameters
	# more info here https://github.com/huggingface/transformers/tree/v4.17.0/examples/pytorch/question-answering
}

# git configuration to download our fine-tuning script
git_config = {'repo': 'https://github.com/huggingface/transformers.git','branch': 'v4.17.0'}

# creates Hugging Face estimator
huggingface_estimator = HuggingFace(
	entry_point='run_qa.py',
	source_dir='./examples/pytorch/question-answering',
	instance_type='ml.p3.2xlarge',
	instance_count=1,
	role=role,
	git_config=git_config,
	transformers_version='4.17.0',
	pytorch_version='1.10.2',
	py_version='py38',
	hyperparameters = hyperparameters
)

# starting the train job
huggingface_estimator.fit()

import sagemaker
from sagemaker.huggingface import HuggingFace

# gets role for executing training job
role = sagemaker.get_execution_role()
hyperparameters = {
	'model_name_or_path':'openai/clip-vit-large-patch14',
	'output_dir':'/opt/ml/model'
	# add your remaining hyperparameters
	# more info here https://github.com/huggingface/transformers/tree/v4.17.0/examples/pytorch/seq2seq
}

# git configuration to download our fine-tuning script
git_config = {'repo': 'https://github.com/huggingface/transformers.git','branch': 'v4.17.0'}

# creates Hugging Face estimator
huggingface_estimator = HuggingFace(
	entry_point='run_summarization.py',
	source_dir='./examples/pytorch/seq2seq',
	instance_type='ml.p3.2xlarge',
	instance_count=1,
	role=role,
	git_config=git_config,
	transformers_version='4.17.0',
	pytorch_version='1.10.2',
	py_version='py38',
	hyperparameters = hyperparameters
)

# starting the train job
huggingface_estimator.fit()

import sagemaker
import boto3
from sagemaker.huggingface import HuggingFace

# gets role for executing training job
iam_client = boto3.client('iam')
role = iam_client.get_role(RoleName='{IAM_ROLE_WITH_SAGEMAKER_PERMISSIONS}')['Role']['Arn']
hyperparameters = {
	'model_name_or_path':'openai/clip-vit-large-patch14',
	'output_dir':'/opt/ml/model'
	# add your remaining hyperparameters
	# more info here https://github.com/huggingface/transformers/tree/v4.17.0/examples/pytorch/seq2seq
}

# git configuration to download our fine-tuning script
git_config = {'repo': 'https://github.com/huggingface/transformers.git','branch': 'v4.17.0'}

# creates Hugging Face estimator
huggingface_estimator = HuggingFace(
	entry_point='run_summarization.py',
	source_dir='./examples/pytorch/seq2seq',
	instance_type='ml.p3.2xlarge',
	instance_count=1,
	role=role,
	git_config=git_config,
	transformers_version='4.17.0',
	pytorch_version='1.10.2',
	py_version='py38',
	hyperparameters = hyperparameters
)

# starting the train job
huggingface_estimator.fit()

import sagemaker
from sagemaker.huggingface import HuggingFace

# gets role for executing training job
role = sagemaker.get_execution_role()
hyperparameters = {
	'model_name_or_path':'openai/clip-vit-large-patch14',
	'output_dir':'/opt/ml/model'
	# add your remaining hyperparameters
	# more info here https://github.com/huggingface/transformers/tree/v4.17.0/examples/pytorch/text-classification
}

# git configuration to download our fine-tuning script
git_config = {'repo': 'https://github.com/huggingface/transformers.git','branch': 'v4.17.0'}

# creates Hugging Face estimator
huggingface_estimator = HuggingFace(
	entry_point='run_glue.py',
	source_dir='./examples/pytorch/text-classification',
	instance_type='ml.p3.2xlarge',
	instance_count=1,
	role=role,
	git_config=git_config,
	transformers_version='4.17.0',
	pytorch_version='1.10.2',
	py_version='py38',
	hyperparameters = hyperparameters
)

# starting the train job
huggingface_estimator.fit()

import sagemaker
import boto3
from sagemaker.huggingface import HuggingFace

# gets role for executing training job
iam_client = boto3.client('iam')
role = iam_client.get_role(RoleName='{IAM_ROLE_WITH_SAGEMAKER_PERMISSIONS}')['Role']['Arn']
hyperparameters = {
	'model_name_or_path':'openai/clip-vit-large-patch14',
	'output_dir':'/opt/ml/model'
	# add your remaining hyperparameters
	# more info here https://github.com/huggingface/transformers/tree/v4.17.0/examples/pytorch/text-classification
}

# git configuration to download our fine-tuning script
git_config = {'repo': 'https://github.com/huggingface/transformers.git','branch': 'v4.17.0'}

# creates Hugging Face estimator
huggingface_estimator = HuggingFace(
	entry_point='run_glue.py',
	source_dir='./examples/pytorch/text-classification',
	instance_type='ml.p3.2xlarge',
	instance_count=1,
	role=role,
	git_config=git_config,
	transformers_version='4.17.0',
	pytorch_version='1.10.2',
	py_version='py38',
	hyperparameters = hyperparameters
)

# starting the train job
huggingface_estimator.fit()

import sagemaker
from sagemaker.huggingface import HuggingFace

# gets role for executing training job
role = sagemaker.get_execution_role()
hyperparameters = {
	'model_name_or_path':'openai/clip-vit-large-patch14',
	'output_dir':'/opt/ml/model'
	# add your remaining hyperparameters
	# more info here https://github.com/huggingface/transformers/tree/v4.17.0/examples/pytorch/token-classification
}

# git configuration to download our fine-tuning script
git_config = {'repo': 'https://github.com/huggingface/transformers.git','branch': 'v4.17.0'}

# creates Hugging Face estimator
huggingface_estimator = HuggingFace(
	entry_point='run_ner.py',
	source_dir='./examples/pytorch/token-classification',
	instance_type='ml.p3.2xlarge',
	instance_count=1,
	role=role,
	git_config=git_config,
	transformers_version='4.17.0',
	pytorch_version='1.10.2',
	py_version='py38',
	hyperparameters = hyperparameters
)

# starting the train job
huggingface_estimator.fit()

import sagemaker
import boto3
from sagemaker.huggingface import HuggingFace

# gets role for executing training job
iam_client = boto3.client('iam')
role = iam_client.get_role(RoleName='{IAM_ROLE_WITH_SAGEMAKER_PERMISSIONS}')['Role']['Arn']
hyperparameters = {
	'model_name_or_path':'openai/clip-vit-large-patch14',
	'output_dir':'/opt/ml/model'
	# add your remaining hyperparameters
	# more info here https://github.com/huggingface/transformers/tree/v4.17.0/examples/pytorch/token-classification
}

# git configuration to download our fine-tuning script
git_config = {'repo': 'https://github.com/huggingface/transformers.git','branch': 'v4.17.0'}

# creates Hugging Face estimator
huggingface_estimator = HuggingFace(
	entry_point='run_ner.py',
	source_dir='./examples/pytorch/token-classification',
	instance_type='ml.p3.2xlarge',
	instance_count=1,
	role=role,
	git_config=git_config,
	transformers_version='4.17.0',
	pytorch_version='1.10.2',
	py_version='py38',
	hyperparameters = hyperparameters
)

# starting the train job
huggingface_estimator.fit()

import sagemaker
from sagemaker.huggingface import HuggingFace

# gets role for executing training job
role = sagemaker.get_execution_role()
hyperparameters = {
	'model_name_or_path':'openai/clip-vit-large-patch14',
	'output_dir':'/opt/ml/model'
	# add your remaining hyperparameters
	# more info here https://github.com/huggingface/transformers/tree/v4.17.0/examples/pytorch/seq2seq
}

# git configuration to download our fine-tuning script
git_config = {'repo': 'https://github.com/huggingface/transformers.git','branch': 'v4.17.0'}

# creates Hugging Face estimator
huggingface_estimator = HuggingFace(
	entry_point='run_translation.py',
	source_dir='./examples/pytorch/seq2seq',
	instance_type='ml.p3.2xlarge',
	instance_count=1,
	role=role,
	git_config=git_config,
	transformers_version='4.17.0',
	pytorch_version='1.10.2',
	py_version='py38',
	hyperparameters = hyperparameters
)

# starting the train job
huggingface_estimator.fit()

import sagemaker
import boto3
from sagemaker.huggingface import HuggingFace

# gets role for executing training job
iam_client = boto3.client('iam')
role = iam_client.get_role(RoleName='{IAM_ROLE_WITH_SAGEMAKER_PERMISSIONS}')['Role']['Arn']
hyperparameters = {
	'model_name_or_path':'openai/clip-vit-large-patch14',
	'output_dir':'/opt/ml/model'
	# add your remaining hyperparameters
	# more info here https://github.com/huggingface/transformers/tree/v4.17.0/examples/pytorch/seq2seq
}

# git configuration to download our fine-tuning script
git_config = {'repo': 'https://github.com/huggingface/transformers.git','branch': 'v4.17.0'}

# creates Hugging Face estimator
huggingface_estimator = HuggingFace(
	entry_point='run_translation.py',
	source_dir='./examples/pytorch/seq2seq',
	instance_type='ml.p3.2xlarge',
	instance_count=1,
	role=role,
	git_config=git_config,
	transformers_version='4.17.0',
	pytorch_version='1.10.2',
	py_version='py38',
	hyperparameters = hyperparameters
)

# starting the train job
huggingface_estimator.fit()

Model Card