Commit
·
d21768e
1
Parent(s):
51828e5
Update README.md
Browse files
README.md
CHANGED
@@ -10,4 +10,37 @@ tags:
|
|
10 |
- art
|
11 |
size_categories:
|
12 |
- n>1T
|
13 |
-
---
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
10 |
- art
|
11 |
size_categories:
|
12 |
- n>1T
|
13 |
+
---
|
14 |
+
import sagemaker
|
15 |
+
import boto3
|
16 |
+
from sagemaker.huggingface import HuggingFace
|
17 |
+
|
18 |
+
# gets role for executing training job
|
19 |
+
iam_client = boto3.client('iam')
|
20 |
+
role = iam_client.get_role(RoleName='{IAM_ROLE_WITH_SAGEMAKER_PERMISSIONS}')['Role']['Arn']
|
21 |
+
hyperparameters = {
|
22 |
+
'model_name_or_path':'databricks/dolly-v2-12b',
|
23 |
+
'output_dir':'/opt/ml/model'
|
24 |
+
# add your remaining hyperparameters
|
25 |
+
# more info here https://github.com/huggingface/transformers/tree/v4.17.0/examples/pytorch/question-answering
|
26 |
+
}
|
27 |
+
|
28 |
+
# git configuration to download our fine-tuning script
|
29 |
+
git_config = {'repo': 'https://github.com/huggingface/transformers.git','branch': 'v4.17.0'}
|
30 |
+
|
31 |
+
# creates Hugging Face estimator
|
32 |
+
huggingface_estimator = HuggingFace(
|
33 |
+
entry_point='run_qa.py',
|
34 |
+
source_dir='./examples/pytorch/question-answering',
|
35 |
+
instance_type='ml.p3.2xlarge',
|
36 |
+
instance_count=1,
|
37 |
+
role=role,
|
38 |
+
git_config=git_config,
|
39 |
+
transformers_version='4.17.0',
|
40 |
+
pytorch_version='1.10.2',
|
41 |
+
py_version='py38',
|
42 |
+
hyperparameters = hyperparameters
|
43 |
+
)
|
44 |
+
|
45 |
+
# starting the train job
|
46 |
+
huggingface_estimator.fit()
|