Spaces:
Running
on
CPU Upgrade
Running
on
CPU Upgrade
## | |
<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> |