Skip to content

Commit

Permalink
adding accelerator field details (keras-team#1392)
Browse files Browse the repository at this point in the history
  • Loading branch information
hamidriasat committed Jun 1, 2023
1 parent a003857 commit ae5a28b
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 0 deletions.
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,7 @@ Author: (could be `Authors`: as well, and may contain markdown links)
Date created: (date in yyyy/mm/dd format)
Last modified: (date in yyyy/mm/dd format)
Description: (one-line text description)
Accelerator: (could be GPU, TPU, or None)
```

To see examples of tutobooks, you can check out any `.py` file in `examples/` or `guides/`.
Expand Down
8 changes: 8 additions & 0 deletions scripts/tutobooks.py
Original file line number Diff line number Diff line change
Expand Up @@ -303,6 +303,8 @@ def validate(py):
raise ValueError("Missing `Last modified:` field.")
if not lines[5].startswith("Description: "):
raise ValueError("Missing `Description:` field.")
if not lines[6].startswith("Accelerator: "):
raise ValueError("Missing `Accelerator:` field.")
description = lines[5][len("Description: ") :]
if not description:
raise ValueError("Missing `Description:` field content.")
Expand All @@ -312,6 +314,12 @@ def validate(py):
raise ValueError("Description field content must end with a period.")
if len(description) > 100:
raise ValueError("Description field content must be less than 100 chars.")
accelerator = lines[6][len("Accelerator: "):]
accelerator_options = ["GPU", "TPU", "None"]
if accelerator not in accelerator_options:
raise ValueError(
f"Accelerator field content must be one of: {accelerator_options}"
)
for i, line in enumerate(lines):
if line.startswith('"""') and line.endswith('"""') and len(line) > 3:
raise ValueError(
Expand Down

0 comments on commit ae5a28b

Please sign in to comment.