Skip to content

Commit

Permalink
(shortfin-sd) Cleanup args and instructions. (#511)
Browse files Browse the repository at this point in the history
  • Loading branch information
monorimet authored Nov 14, 2024
1 parent f429c91 commit fa122be
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 8 deletions.
13 changes: 12 additions & 1 deletion shortfin/python/shortfin_apps/sd/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,13 @@ pip install pillow
pip install shark-ai
```

Temporarily, you may need an update to your `shortfin` install.
Install the latest pre-release with:
```
pip install shortfin --upgrade --pre -f https://github.com/nod-ai/SHARK-Platform/releases/expanded_assets/dev-wheels
```

```
python -m shortfin_apps.sd.server --help
```
Expand All @@ -27,7 +34,11 @@ You can check if this (or any) port is in use on Linux with `ss -ntl | grep 8000
```
python -m shortfin_apps.sd.server --device=amdgpu --device_ids=0 --build_preference=precompiled --topology="spx_single"
```

- Wait until your server outputs:
```
INFO - Application startup complete.
INFO - Uvicorn running on http://0.0.0.0:8000 (Press CTRL+C to quit)
```
- Run a CLI client in a separate shell:
```
python -m shortfin_apps.sd.simple_client --interactive
Expand Down
6 changes: 0 additions & 6 deletions shortfin/python/shortfin_apps/sd/server.py
Original file line number Diff line number Diff line change
Expand Up @@ -242,12 +242,6 @@ def main(argv, log_config=uvicorn.config.LOGGING_CONFIG):
parser = argparse.ArgumentParser()
parser.add_argument("--host", type=str, default=None)
parser.add_argument("--port", type=int, default=8000)
parser.add_argument(
"--root-path",
type=str,
default=None,
help="Root path to use for installing behind path based proxy.",
)
parser.add_argument(
"--timeout-keep-alive", type=int, default=5, help="Keep alive timeout"
)
Expand Down
4 changes: 3 additions & 1 deletion shortfin/python/shortfin_apps/sd/simple_client.py
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,9 @@ async def static(args):
if not any([i is None for i in [latencies, sample_counts]]):
total_num_samples = sum(sample_counts)
sps = str(total_num_samples / (end - start))
print(f"Average throughput: {sps} samples per second")
# Until we have better measurements, don't report the throughput that includes saving images.
if not args.save:
print(f"Average throughput: {sps} samples per second")
else:
raise ValueError("Received error response from server.")

Expand Down

0 comments on commit fa122be

Please sign in to comment.