File size: 1,819 Bytes
06a60a3
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
##
<pre>
+base_job_name: accelerate-sagemaker-1
+compute_environment: AMAZON_SAGEMAKER
distributed_type: 'NO'
dynamo_backend: 'NO'
+ec2_instance_type: ml.p3.2xlarge
+gpu_ids: all
+iam_role_name: MY_IAM_ROLE_NAME
mixed_precision: 'no'
+num_machines: 1
+profile: MY_PROFILE_NAME
+py_version: py38
+pytorch_version: 1.10.2
+region: us-east-1
+transformers_version: 4.17.0
use_cpu: false
</pre>
##
<pre>
def parse_args():
    parser = argparse.ArgumentParse(
        description="sample task"
    )

    parser.add_argument(
        "--some_bool_arg",
-        action="store_true",
+        type=bool,
+        default=False,
    )
</pre>
##
If the YAML was generated through the `accelerate config` command:
```
accelerate launch {script_name.py} {--arg1} {--arg2} ...
```

If the YAML is saved to a `~/config.yaml` file:
```
accelerate launch --config_file ~/config.yaml {script_name.py} {--arg1} {--arg2} ...
```
##
SageMaker does not support argparse actions. As a result if a script parameter would normally be a boolean, you need to specify the type as `bool` in the script and provide an explicit `True` or `False` value. 

Also, when using SageMaker all output artifacts should use `/opt/ml/model` or `os.environ["SM_MODEL_DIR"]` as your save directory. After training, artifacts in this directory are uploaded to S3.
##
To learn more checkout the related documentation:
- <a href="https://huggingface.co/docs/accelerate/usage_guides/sagemaker" target="_blank">How to use πŸ€— Accelerate with SageMaker</a>
- <a href="https://github.com/huggingface/notebooks/tree/main/sagemaker/22_accelerate_sagemaker_examples" target="_blank">Examples showcasing AWS SageMaker integration of πŸ€— Accelerate</a>
- <a href="https://huggingface.co/docs/accelerate/main/en/package_reference/cli" target="_blank">The Command Line</a>