-
Notifications
You must be signed in to change notification settings - Fork 29
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add SHARK user guide to root of docs directory (#528)
Progress on #458 This PR adds a SHARK user guide to root of docs directory and does some basic information re-architecture to point installation paths of current main readmes to the new user guide. One new landing page and removal of duplicate installation paths in SD folder to point to both nightly / new release page depending on use case. Incorporated a mini guide on supported options for the SD Server / Client in the user guide. Changed root readme to include a path for users so that anyone who lands on the main SHARK readme can quickly get started as a non-developer.
- Loading branch information
1 parent
7fd047f
commit 8de8524
Showing
4 changed files
with
192 additions
and
84 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,65 @@ | ||
# SHARK Developer Guide | ||
|
||
Each sub-project has its own developer guide. If you would like to work across | ||
projects, these instructions should help you get started: | ||
|
||
### Setup a venv | ||
|
||
We recommend setting up a Python | ||
[virtual environment (venv)](https://docs.python.org/3/library/venv.html). | ||
The project is configured to ignore `.venv` directories, and editors like | ||
VSCode pick them up by default. | ||
|
||
```bash | ||
python -m venv .venv | ||
source .venv/bin/activate | ||
``` | ||
|
||
### Install PyTorch for your system | ||
|
||
If no explicit action is taken, the default PyTorch version will be installed. | ||
This will give you a current CUDA-based version, which takes longer to download | ||
and includes other dependencies that SHARK does not require. To install a | ||
different variant, run one of these commands first: | ||
|
||
* *CPU:* | ||
|
||
```bash | ||
pip install -r pytorch-cpu-requirements.txt | ||
``` | ||
|
||
* *ROCM:* | ||
|
||
```bash | ||
pip install -r pytorch-rocm-requirements.txt | ||
``` | ||
|
||
* *Other:* see instructions at <https://pytorch.org/get-started/locally/>. | ||
|
||
### Install development packages | ||
|
||
```bash | ||
# Install editable local projects. | ||
pip install -r requirements.txt -e sharktank/ shortfin/ | ||
|
||
# Optionally clone and install the latest editable iree-turbine dep in deps/, | ||
# along with nightly versions of iree-base-compiler and iree-base-runtime. | ||
pip install -f https://iree.dev/pip-release-links.html --upgrade --pre \ | ||
iree-base-compiler iree-base-runtime --src deps \ | ||
-e "git+https://github.com/iree-org/iree-turbine.git#egg=iree-turbine" | ||
``` | ||
|
||
See also: [nightly_releases.md](nightly_releases.md). | ||
|
||
### Running tests | ||
|
||
```bash | ||
pytest sharktank | ||
pytest shortfin | ||
``` | ||
|
||
### Optional: pre-commits and developer settings | ||
|
||
This project is set up to use the `pre-commit` tooling. To install it in | ||
your local repo, run: `pre-commit install`. After this point, when making | ||
commits locally, hooks will run. See https://pre-commit.com/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,115 @@ | ||
# SHARK User Guide | ||
|
||
> [!WARNING] | ||
> This is still pre-release so the artifacts listed here may be broken | ||
> | ||
These instructions cover the usage of the latest stable release of SHARK. For a more bleeding edge release please install the [nightly releases](nightly_releases.md). | ||
|
||
## Prerequisites | ||
|
||
Our current user guide requires that you have: | ||
- Access to a computer with an installed AMD Instinct™ MI300x Series Accelerator | ||
- Installed a compatible version of Linux and ROCm on the computer (see the [ROCm compatability matrix](https://rocm.docs.amd.com/en/latest/compatibility/compatibility-matrix.html)) | ||
|
||
|
||
## Set up Environment | ||
|
||
This section will help you install Python and set up a Python environment with venv. | ||
|
||
Officially we support Python versions: 3.11, 3.12, 3.13, 3.13t | ||
|
||
The rest of this guide assumes you are using Python 3.11. | ||
|
||
### Install Python | ||
To install Python 3.11 on Ubuntu: | ||
|
||
```bash | ||
sudo apt install python3.11 python3.11-dev python3.11-venv | ||
|
||
which python3.11 | ||
# /usr/bin/python3.11 | ||
``` | ||
|
||
### Create a Python Environment | ||
|
||
Setup your Python environment with the following commands: | ||
|
||
```bash | ||
# Set up a virtual environment to isolate packages from other envs. | ||
python3.11 -m venv 3.11.venv | ||
source 3.11.venv/bin/activate | ||
``` | ||
|
||
## Install SHARK and its dependencies | ||
|
||
```bash | ||
pip install shark-ai[apps] | ||
``` | ||
|
||
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 | ||
``` | ||
|
||
### Test the installation. | ||
|
||
``` | ||
python -m shortfin_apps.sd.server --help | ||
``` | ||
|
||
## Quickstart | ||
|
||
### Run the SDXL Server | ||
|
||
Run the [SDXL Server](../shortfin/python/shortfin_apps/sd/README.md#Start-SDXL-Server) | ||
|
||
### Run the SDXL Client | ||
|
||
``` | ||
python -m shortfin_apps.sd.simple_client --interactive | ||
``` | ||
|
||
Congratulations!!! At this point you can play around with the server and client based on your usage. | ||
|
||
### Update flags | ||
|
||
Please see --help for both the server and client for usage instructions. Here's a quick snapshot. | ||
|
||
#### Update server options: | ||
|
||
| Flags | options | | ||
|---|---| | ||
|--host HOST | | ||
|--port PORT | server port | | ||
|--root-path ROOT_PATH | | ||
|--timeout-keep-alive | | ||
|--device | local-task,hip,amdgpu | amdgpu only supported in this release | ||
|--target | gfx942,gfx1100 | gfx942 only supported in this release | ||
|--device_ids | | ||
|--tokenizers | | ||
|--model_config | | ||
| --workers_per_device | | ||
| --fibers_per_device | | ||
| --isolation | per_fiber, per_call, none | | ||
| --show_progress | | ||
| --trace_execution | | ||
| --amdgpu_async_allocations | | ||
| --splat | | ||
| --build_preference | compile,precompiled | | ||
| --compile_flags | | ||
| --flagfile FLAGFILE | | ||
| --artifacts_dir ARTIFACTS_DIR | Where to store cached artifacts from the Cloud | | ||
|
||
#### Update client with different options: | ||
|
||
| Flags |options| | ||
|---|--- | ||
|--file | | ||
|--reps | | ||
|--save | Whether to save image generated by the server | | ||
|--outputdir| output directory to store images generated by SDXL | | ||
|--steps | | ||
|--interactive | | ||
|--port| port to interact with server | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters