Unverified Commit 20932e55 authored by Kiyoung Kim's avatar Kiyoung Kim Committed by GitHub
Browse files

Add tpu_zone and gcp_project in training_args_tf.py (#9825)

* add tpu_zone and gcp_project in training_args_tf.py

* make style

Co-authored-by: kykim <kykim>
parent 763ece2f
datasets @ 7a6c3bae
Subproject commit 7a6c3bae98d738742629ee82a48cf7b18db89154
...@@ -135,6 +135,12 @@ class TFTrainingArguments(TrainingArguments): ...@@ -135,6 +135,12 @@ class TFTrainingArguments(TrainingArguments):
at the next training step under the keyword argument ``mems``. at the next training step under the keyword argument ``mems``.
tpu_name (:obj:`str`, `optional`): tpu_name (:obj:`str`, `optional`):
The name of the TPU the process is running on. The name of the TPU the process is running on.
tpu_zone (:obj:`str`, `optional`):
The zone of the TPU the process is running on. If not specified, we will attempt to automatically detect
from metadata.
gcp_project (:obj:`str`, `optional`):
Google Cloud Project name for the Cloud TPU-enabled project. If not specified, we will attempt to
automatically detect from metadata.
run_name (:obj:`str`, `optional`): run_name (:obj:`str`, `optional`):
A descriptor for the run. Notably used for wandb logging. A descriptor for the run. Notably used for wandb logging.
xla (:obj:`bool`, `optional`): xla (:obj:`bool`, `optional`):
...@@ -146,6 +152,16 @@ class TFTrainingArguments(TrainingArguments): ...@@ -146,6 +152,16 @@ class TFTrainingArguments(TrainingArguments):
metadata={"help": "Name of TPU"}, metadata={"help": "Name of TPU"},
) )
tpu_zone: str = field(
default=None,
metadata={"help": "Zone of TPU"},
)
gcp_project: str = field(
default=None,
metadata={"help": "Name of Cloud TPU-enabled project"},
)
poly_power: float = field( poly_power: float = field(
default=1.0, default=1.0,
metadata={"help": "Power for the Polynomial decay LR scheduler."}, metadata={"help": "Power for the Polynomial decay LR scheduler."},
...@@ -173,7 +189,9 @@ class TFTrainingArguments(TrainingArguments): ...@@ -173,7 +189,9 @@ class TFTrainingArguments(TrainingArguments):
else: else:
try: try:
if self.tpu_name: if self.tpu_name:
tpu = tf.distribute.cluster_resolver.TPUClusterResolver(self.tpu_name) tpu = tf.distribute.cluster_resolver.TPUClusterResolver(
self.tpu_name, zone=self.tpu_zone, project=self.gcp_project
)
else: else:
tpu = tf.distribute.cluster_resolver.TPUClusterResolver() tpu = tf.distribute.cluster_resolver.TPUClusterResolver()
except ValueError: except ValueError:
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment