Skip to content

Updating saxml with better grammar in README and RELEASE, as well as code improvements #2

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 4 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 9 additions & 9 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ specific published models.

## Install Sax

### Install and set up the `gcloud` tool
### Installing and set up the `gcloud` tool

[Install](https://cloud.google.com/sdk/gcloud#download_and_install_the) the
`gcloud` CLI and set the default account and project:
Expand All @@ -20,7 +20,7 @@ gcloud config set account <your-email-account>
gcloud config set project <your-project>
```

### Create a Cloud Storage bucket to store Sax server states
### Creating a Cloud Storage bucket to store Sax server states

[Create](https://cloud.google.com/storage/docs/creating-buckets) a
Cloud Storage bucket:
Expand All @@ -30,7 +30,7 @@ GSBUCKET=sax-data
gcloud storage buckets create gs://${GSBUCKET}
```

### Create a Compute Engine VM instance for the admin server
### Creating a Compute Engine VM instance for the admin server

[Create](https://cloud.google.com/compute/docs/create-linux-vm-instance) a
Compute Engine VM instance:
Expand All @@ -43,7 +43,7 @@ gcloud compute instances create sax-admin \
--scopes=https://www.googleapis.com/auth/cloud-platform
```

### Create a Cloud TPU VM instance for a model server
### Creating a Cloud TPU VM instance for a model server

Use this [guide](https://cloud.google.com/tpu/docs/users-guide-tpu-vm) to
enable the Cloud TPU API in a Google Cloud project.
Expand Down Expand Up @@ -85,7 +85,7 @@ bazel run saxml/bin:admin_config -- \
--alsologtostderr
```

Start the Sax admin server:
Starting the Sax admin server:

```
bazel run saxml/bin:admin_server -- \
Expand All @@ -95,7 +95,7 @@ bazel run saxml/bin:admin_server -- \
--alsologtostderr
```

### Start the Sax model server
### Starting the Sax model server

SSH to the Cloud TPU VM instance:

Expand All @@ -111,7 +111,7 @@ cd saxml
saxml/tools/init_cloud_vm.sh
```

Start the Sax model server:
Starting the Sax model server:

```
SAX_ROOT=gs://${GSBUCKET}/sax-root \
Expand All @@ -123,9 +123,9 @@ bazel run saxml/server:server -- \
--alsologtostderr
```

You should see a log message "Joined [admin server IP:port]" from the model server to indicate it has successfully joined the admin server.
You should see a log message "Joined [admin server IP: port]" from the model server to indicate it has successfully joined the admin server.

## Use Sax
## Using Sax

Sax comes with a command-line tool called `saxutil` for easy usage:

Expand Down
4 changes: 2 additions & 2 deletions RELEASE.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Release 0.1.0
# Version 0.1.0

# Major Features and Improvements
# Major Features and Improvements:

* A Pax model server that supports Google Cloud TPU slice serving.
* An admin server that manages model servers.
Expand Down
2 changes: 1 addition & 1 deletion saxml/server/acl.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@


def Check(aclname: Optional[str], principal: Optional[str]) -> bool:
"""Returns true iff username is allowed by the acl.
"""Returns true if username is allowed by the acl.

Args:
aclname: The access control list. The ACL is currently just a dot-separated
Expand Down
16 changes: 8 additions & 8 deletions saxml/server/ipaddr.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,19 +22,19 @@ def MyIPAddr() -> str:
hostname = socket.gethostname()

try:
addrs = socket.getaddrinfo(hostname, None, socket.AF_INET6)
if addrs:
addr = addrs[0][4][0]
address = socket.getaddrinfo(hostname, None, socket.AF_INET6)
if address:
addr = address[0][4][0]
ip = ipaddress.ip_address(addr)
if not ip.is_link_local and (ip.is_private or ip.is_global):
return addr
except socket.error:
pass

try:
addrs = socket.getaddrinfo(hostname, None, socket.AF_INET)
if addrs:
addr = addrs[0][4][0]
address = socket.getaddrinfo(hostname, None, socket.AF_INET)
if address:
addr = address[0][4][0]
ip = ipaddress.ip_address(addr)
if not ip.is_link_local and (ip.is_private or ip.is_global):
return addr
Expand All @@ -47,6 +47,6 @@ def MyIPAddr() -> str:
def Join(ip: str, port: int) -> str:
"""Returns an IP address joined with a port."""
if not ip.startswith("[") and ":" in ip:
return "[%s]:%d" % (ip, port)
return f"[{ip}]: {port}"
else:
return "%s:%d" % (ip, port)
return f"{ip}: {port}" % (ip, port)