tune: notebook template (#812)

* feat: tune template

* feat: tune template

* fix: auto review

* fix: auto review

* fix: auto review

* fix: auto review

* fix: auti review

* fix: auti review

* fix: auti review

* fix: auti review

* fix: auti review

* fix: auti review

* fix: auti review

* fix: auti review

* fix: auti review

* fix: auti review

* fix: auti review

* fix: auti review

* fix: auti review

* fix: auto review

* fix: auto review

* fix: auto review

* fix: auto review

* fix: auto review

* fix: auto review

* feat: auto review

* feat: auto review

* feat: auto review

* fix: auto review

* fix: auto review

* fix: auto review

* fix: auto review

* fix: auto review

* fix: auto review

* fix: auto review

* feat: auto review script

* tune: project ID and Region

* tune: project ID and Region
This commit is contained in:
Andrew Ferlitsch
2022-08-04 10:51:08 -07:00
committed by GitHub
parent b5cc2b425e
commit acec861ad5
2 changed files with 41 additions and 21 deletions
+7 -19
View File
@@ -289,22 +289,7 @@
},
"outputs": [],
"source": [
"PROJECT_ID = \"\"\n",
"\n",
"# Get your Google Cloud project ID from gcloud\n",
"if not os.getenv(\"IS_TESTING\"):\n",
" shell_output = !gcloud config list --format 'value(core.project)' 2>/dev/null\n",
" PROJECT_ID = shell_output[0]\n",
" print(\"Project ID: \", PROJECT_ID)"
]
},
{
"cell_type": "markdown",
"metadata": {
"id": "qJYoRfYng0XZ"
},
"source": [
"Otherwise, set your project ID here."
"PROJECT_ID = \"[your-project-id]\" # @param {type:\"string\"}"
]
},
{
@@ -315,8 +300,11 @@
},
"outputs": [],
"source": [
"if PROJECT_ID == \"\" or PROJECT_ID is None:\n",
" PROJECT_ID = \"[your-project-id]\" # @param {type:\"string\"}"
"if PROJECT_ID == \"\" or PROJECT_ID is None or PROJECT_ID == \"[your-project-id]\":\n",
" # Get your GCP project id from gcloud\n",
" shell_output = ! gcloud config list --format 'value(core.project)' 2>/dev/null\n",
" PROJECT_ID = shell_output[0]\n",
" print(\"Project ID:\", PROJECT_ID)"
]
},
{
@@ -363,7 +351,7 @@
"#### Region\n",
"\n",
"You can also change the `REGION` variable, which is used for operations\n",
"throughout the rest of this notebook. Below are regions supported for Vertex AI. We recommend that you choose the region closest to you.\n",
"throughout the rest of this notebook. Below are regions supported for Vertex AI. It is recommended that you choose the region closest to you.\n",
"\n",
"- Americas: `us-central1`\n",
"- Europe: `europe-west4`\n",
+34 -2
View File
@@ -223,6 +223,22 @@ def parse_notebook(path):
report_error(path, 32, "Set project ID code section not found")
elif not cell['source'][0].startswith('PROJECT_ID = "[your-project-id]"'):
report_error(path, 33, f"Set project ID not match template: {line}")
cell, nth = get_cell(path, cells, nth)
if cell['cell_type'] != 'code' or 'or PROJECT_ID == "[your-project-id]":' not in cell['source'][0]:
report_error(path, 33, f"Set project ID not match template: {line}")
cell, nth = get_cell(path, cells, nth)
if cell['cell_type'] != 'code' or '! gcloud config set project' not in cell['source'][0]:
report_error(path, 33, f"Set project ID not match template: {line}")
'''
# Region
cell, nth = get_cell(path, cells, nth)
if cell['source'][0].startswith("### Region"):
report_error(path, 34, "Region section not found")
'''
def get_cell(path, cells, nth):
while empty_cell(path, cells, nth):
@@ -313,17 +329,33 @@ def parse_objective(path, cell):
in_desc = False
in_steps = False
in_uses = True
uses += line
continue
elif line.startswith('The steps performed'):
in_desc = False
in_uses = False
in_steps = True
steps += line
continue
if in_desc:
desc += line
elif in_uses:
uses += line
sline = line.strip()
if len(sline) == 0:
uses += '\n'
else:
ch = sline[0]
if ch in ['-', '*', '1', '2', '3', '4', '5', '6', '7', '8', '9']:
uses += line
elif in_steps:
steps += line
sline = line.strip()
if len(sline) == 0:
steps += '\n'
else:
ch = sline[0]
if ch in ['-', '*', '1', '2', '3', '4', '5', '6', '7', '8', '9']:
steps += line
if desc == '':
report_error(path, 17, "Objective section missing desc")