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
 
(One intermediate revision by the same user not shown)
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 =  
| paper =
| paper = arxiv:2103.00020, arxiv:1908.04913
| license = arxiv:2103.00020, arxiv:1908.04913
| license =
| 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 =  
}}
}}
Line 22: Line 22:
#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 33:
#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 45:
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 65:
# 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 98:
# 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 132:
# 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 165:
# 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 199:
# 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 232:
# 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 266:
# 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 299:
# 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 333:
# 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 366:
# 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 400:
# 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 433:
# 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 467:
# 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 500:
# 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 534:
# 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 567:
# 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 601:
# 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 634:
# 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 668:
# 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 701:
# 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 735:
# 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 768:
# 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 802:
# 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 835:
# 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 869:
# 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 902:
# 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 936:
# 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 969:
# 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 999:
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,015:
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,052:
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,089:
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,126:
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,163:
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,200:
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,237:
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,274:
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,311:
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,348:
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,385:
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,422:
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,459:
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,496:
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,528: Line 1,526:


==Model Card==
==Model Card==
==Comments==
<comments />

Latest revision as of 03:27, 23 May 2023

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

Model Description

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

Comments

Loading comments...