MCPcopy
hub / github.com/tensorflow/models / require_cloud_storage

Function require_cloud_storage

official/utils/flags/_device.py:23–43  ·  view source on GitHub ↗

Register a validator to check directory flags. Args: flag_names: An iterable of strings containing the names of flags to be checked.

(flag_names)

Source from the content-addressed store, hash-verified

21
22
23def require_cloud_storage(flag_names):
24 """Register a validator to check directory flags.
25
26 Args:
27 flag_names: An iterable of strings containing the names of flags to be
28 checked.
29 """
30 msg = "TPU requires GCS path for {}".format(", ".join(flag_names))
31
32 @flags.multi_flags_validator(["tpu"] + flag_names, message=msg)
33 def _path_check(flag_values): # pylint: disable=missing-docstring
34 if flag_values["tpu"] is None:
35 return True
36
37 valid_flags = True
38 for key in flag_names:
39 if not flag_values[key].startswith("gs://"):
40 logging.error("%s must be a GCS path.", key)
41 valid_flags = False
42
43 return valid_flags
44
45
46def define_device(tpu=True):

Callers

nothing calls this directly

Calls 1

joinMethod · 0.45

Tested by

no test coverage detected