Skip to content
This repository was archived by the owner on Jul 7, 2023. It is now read-only.

Commit f41e517

Browse files
lgeigerlukaszkaiser
authored andcommitted
Upgrade ML Engine runtime to 1.13 and remove unused Gcloud class (#1494)
This PR upgrades the ML Engine runtime to 1.13 in order to fix #1472. Unfortunately ML Engine doesn't support TPUs in version 1.13 yet: https://cloud.google.com/ml-engine/docs/release-notes This also removes the unused Gcloud class to clean up the code a bit.
1 parent e26510c commit f41e517

File tree

2 files changed

+7
-52
lines changed

2 files changed

+7
-52
lines changed

tensor2tensor/data_generators/wikisum/parallel_launch.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -146,7 +146,7 @@ def create_instance(instance_name, cpu=1, mem=4):
146146

147147

148148
def list_vm_names_and_ips():
149-
list_out = cloud.shell_output(cloud.Gcloud.LIST_VM)
149+
list_out = cloud.shell_output(cloud.LIST_VM)
150150
lines = [l.split() for l in list_out.split("\n")[1:-1]]
151151
names_and_ips = [(l[0].strip(), l[-2].strip()) for l in lines]
152152
return names_and_ips

tensor2tensor/utils/cloud_mlengine.py

Lines changed: 6 additions & 51 deletions
Original file line numberDiff line numberDiff line change
@@ -35,55 +35,10 @@
3535
FLAGS = tf.flags.FLAGS
3636

3737
CONSOLE_URL = "https://console.cloud.google.com/mlengine/jobs/"
38-
RUNTIME_VERSION = "1.12"
39-
40-
41-
class Gcloud(object):
42-
"""gcloud command strings."""
43-
# Note these can be modified by set_versions
44-
VM_VERSION = "tf-1-12"
45-
TPU_VERSION = "1.12"
46-
47-
@classmethod
48-
def set_versions(cls, vm, tpu):
49-
cls.VM_VERSION = vm
50-
cls.TPU_VERSION = tpu
51-
52-
@classmethod
53-
def create_vm(cls):
54-
create_vm_str = """
55-
gcloud compute instances create {name} \
56-
--machine-type=n1-standard-8 \
57-
--image-family=%s \
58-
--image-project=ml-images \
59-
--scopes=https://www.googleapis.com/auth/cloud-platform
60-
""" % cls.VM_VERSION
61-
return create_vm_str
62-
63-
DELETE_VM = "gcloud compute instances delete {name} --quiet"
64-
65-
@classmethod
66-
def create_tpu(cls):
67-
create_tpu_str = """
68-
gcloud beta compute tpus create \
69-
{name} \
70-
--range={tpu_ip}/29 \
71-
--version=%s
72-
""" % cls.TPU_VERSION
73-
return create_tpu_str
74-
75-
DELETE_TPU = "gcloud beta compute tpus delete {name} --quiet"
76-
77-
LIST_TPU = "gcloud beta compute tpus list"
78-
LIST_VM = "gcloud compute instances list"
79-
80-
SSH_LOCAL_PORT_FORWARD = "-L {local_port}:{host}:{remote_port}"
81-
SSH_TUNNEL = """
82-
gcloud compute ssh {name} -- -N
83-
"""
84-
85-
DEFAULT_PROJECT = "gcloud config get-value project"
86-
DEFAULT_REGION = "gcloud config get-value compute/region"
38+
RUNTIME_VERSION = "1.13"
39+
LIST_VM = "gcloud compute instances list"
40+
DEFAULT_PROJECT = "gcloud config get-value project"
41+
DEFAULT_REGION = "gcloud config get-value compute/region"
8742

8843

8944
def shell_output(cmd_, **kwargs):
@@ -99,11 +54,11 @@ def format_cmd(cmd_, **kwargs):
9954

10055

10156
def default_region():
102-
return shell_output(Gcloud.DEFAULT_REGION).strip()
57+
return shell_output(DEFAULT_REGION).strip()
10358

10459

10560
def default_project():
106-
return shell_output(Gcloud.DEFAULT_PROJECT).strip()
61+
return shell_output(DEFAULT_PROJECT).strip()
10762

10863

10964
def get_setup_file(name, packages=None):

0 commit comments

Comments
 (0)