Files changed (1) hide show
  1. uncertain +33 -0
uncertain ADDED
@@ -0,0 +1,33 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import sagemaker
2
+ import boto3
3
+ from sagemaker.huggingface import HuggingFace
4
+
5
+ # gets role for executing training job
6
+ iam_client = boto3.client('iam')
7
+ role = iam_client.get_role(RoleName='{IAM_ROLE_WITH_SAGEMAKER_PERMISSIONS}')['Role']['Arn']
8
+ hyperparameters = {
9
+ 'model_name_or_path':'dalle-mini/vqgan_imagenet_f16_16384',
10
+ 'output_dir':'/opt/ml/model'
11
+ # add your remaining hyperparameters
12
+ # more info here https://github.com/huggingface/transformers/tree/v4.17.0/examples/pytorch/language-modeling
13
+ }
14
+
15
+ # git configuration to download our fine-tuning script
16
+ git_config = {'repo': 'https://github.com/huggingface/transformers.git','branch': 'v4.17.0'}
17
+
18
+ # creates Hugging Face estimator
19
+ huggingface_estimator = HuggingFace(
20
+ entry_point='run_mlm.py',
21
+ source_dir='./examples/pytorch/language-modeling',
22
+ instance_type='ml.p3.2xlarge',
23
+ instance_count=1,
24
+ role=role,
25
+ git_config=git_config,
26
+ transformers_version='4.17.0',
27
+ pytorch_version='1.10.2',
28
+ py_version='py38',
29
+ hyperparameters = hyperparameters
30
+ )
31
+
32
+ # starting the train job
33
+ huggingface_estimator.fit()