-
Notifications
You must be signed in to change notification settings - Fork 864
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
8 changed files
with
138 additions
and
46 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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -11,18 +11,7 @@ Your contributions will fall into two categories: | |
- Search for your issue here: https://github.com/pytorch/serve/issues (look for the "good first issue" tag if you're a first time contributor) | ||
- Pick an issue and comment on the task that you want to work on this feature. | ||
- To ensure your changes doesn't break any of the existing features run the sanity suite as follows from serve directory: | ||
- Install dependencies (if not already installed) | ||
For CPU | ||
|
||
```bash | ||
python ts_scripts/install_dependencies.py --environment=dev | ||
``` | ||
|
||
For GPU | ||
```bash | ||
python ts_scripts/install_dependencies.py --environment=dev --cuda=cu121 | ||
``` | ||
> Supported cuda versions as cu121, cu118, cu117, cu116, cu113, cu111, cu102, cu101, cu92 | ||
- [Install dependencies](#Install-TorchServe-for-development) (if not already installed) | ||
- Install `pre-commit` to your Git flow: | ||
```bash | ||
pre-commit install | ||
|
@@ -60,26 +49,30 @@ pytest -k test/pytest/test_mnist_template.py | |
|
||
If you plan to develop with TorchServe and change some source code, you must install it from source code. | ||
|
||
Ensure that you have `python3` installed, and the user has access to the site-packages or `~/.local/bin` is added to the `PATH` environment variable. | ||
1. Clone the repository, including third-party modules, with `git clone --recurse-submodules --remote-submodules [email protected]:pytorch/serve.git` | ||
2. Ensure that you have `python3` installed, and the user has access to the site-packages or `~/.local/bin` is added to the `PATH` environment variable. | ||
3. Run the following script from the top of the source directory. NOTE: This script force re-installs `torchserve`, `torch-model-archiver` and `torch-workflow-archiver` if existing installations are found | ||
|
||
Run the following script from the top of the source directory. | ||
#### For Debian Based Systems/MacOS | ||
|
||
NOTE: This script force re-installs `torchserve`, `torch-model-archiver` and `torch-workflow-archiver` if existing installations are found | ||
``` | ||
python ./ts_scripts/install_dependencies.py --environment=dev | ||
python ./ts_scripts/install_from_src.py --environment=dev | ||
``` | ||
##### Installing Dependencies for Accelerator Support | ||
Use the optional `--rocm` or `--cuda` flag with `install_dependencies.py` for installing accelerator specific dependencies. | ||
|
||
#### For Debian Based Systems/ MacOS | ||
|
||
``` | ||
python ./ts_scripts/install_dependencies.py --environment=dev | ||
python ./ts_scripts/install_from_src.py --environment=dev | ||
``` | ||
Possible values are | ||
- rocm: `rocm61`, `rocm60` | ||
- cuda: `cu111`, `cu102`, `cu101`, `cu92` | ||
|
||
Use `--cuda` flag with `install_dependencies.py` for installing cuda version specific dependencies. Possible values are `cu111`, `cu102`, `cu101`, `cu92` | ||
For example `python ./ts_scripts/install_dependencies.py --environment=dev --rocm=rocm61` | ||
|
||
#### For Windows | ||
#### For Windows | ||
|
||
Refer to the documentation [here](docs/torchserve_on_win_native.md). | ||
Refer to the documentation [here](docs/torchserve_on_win_native.md). | ||
|
||
For information about the model archiver, see [detailed documentation](model-archiver/README.md). | ||
For information about the model archiver, see [detailed documentation](model-archiver/README.md). | ||
|
||
### What to Contribute? | ||
|
||
|
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
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,81 @@ | ||
# AMD Support | ||
|
||
TorchServe can be run on any combination of operating system and device that is | ||
[supported by ROCm](https://rocm.docs.amd.com/projects/radeon/en/latest/docs/compatibility.html). | ||
|
||
## Supported Versions of ROCm | ||
|
||
The current stable `major.patch` version of ROCm and the previous path version will be supported. For example version `N.2` and `N.1` where `N` is the current major version. | ||
|
||
## Installation | ||
|
||
- Make sure you have **python >= 3.8 installed** on your system. | ||
- clone the repo | ||
```bash | ||
git clone [email protected]:pytorch/serve.git | ||
``` | ||
|
||
- cd into the cloned folder | ||
|
||
```bash | ||
cd serve | ||
``` | ||
|
||
- create a virtual environment for python | ||
|
||
```bash | ||
python -m venv venv | ||
``` | ||
|
||
- activate the virtual environment. If you use another shell (fish, csh, powershell) use the relevant option in from `/venv/bin/` | ||
```bash | ||
source venv/bin/activate | ||
``` | ||
|
||
- install the dependencies needed for ROCm support. | ||
|
||
```bash | ||
python ./ts_scripts/install_dependencies.py --rocm=rocm61 | ||
python ./ts_scripts/install_from_src.py | ||
``` | ||
- enable amd-smi in the python virtual environment | ||
```bash | ||
sudo chown -R $USER:$USER /opt/rocm/share/amd_smi/ | ||
pip install -e /opt/rocm/share/amd_smi/ | ||
``` | ||
|
||
### Selecting Accelerators Using `HIP_VISIBLE_DEVICES` | ||
|
||
If you have multiple accelerators on the system where you are running TorchServe you can select which accelerators should be visible to TorchServe | ||
by setting the environment variable `HIP_VISIBLE_DEVICES` to a string of 0-indexed comma-separated integers representing the ids of the accelerators. | ||
|
||
If you have 8 accelerators but only want TorchServe to see the last four of them do `export HIP_VISIBLE_DEVICES=4,5,6,7`. | ||
|
||
>ℹ️ **Not setting** `HIP_VISIBLE_DEVICES` will cause TorchServe to use all available accelerators on the system it is running on. | ||
|
||
> ⚠️ You can run into trouble if you set `HIP_VISIBLE_DEVICES` to an empty string. | ||
> eg. `export HIP_VISIBLE_DEVICES=` or `export HIP_VISIBLE_DEVICES=""` | ||
> use `unset HIP_VISIBLE_DEVICES` if you want to remove its effect. | ||
|
||
> ⚠️ Setting both `CUDA_VISIBLE_DEVICES` and `HIP_VISIBLE_DEVICES` may cause unintended behaviour and should be avoided. | ||
> Doing so may cause an exception in the future. | ||
|
||
## Docker | ||
|
||
**In Development** | ||
|
||
`Dockerfile.rocm` provides preliminary ROCm support for TorchServe. | ||
|
||
Building and running `dev-image`: | ||
|
||
```bash | ||
docker build --file docker/Dockerfile.rocm --target dev-image -t torch-serve-dev-image-rocm --build-arg USE_ROCM_VERSION=rocm62 --build-arg BUILD_FROM_SRC=true . | ||
docker run -it --rm --device=/dev/kfd --device=/dev/dri torch-serve-dev-image-rocm bash | ||
``` | ||
|
||
## Example Usage | ||
|
||
After installing TorchServe with the required dependencies for ROCm you should be ready to serve your model. | ||
|
||
For a simple example, refer to `serve/examples/image_classifier/mnist/`. |
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,8 @@ | ||
.. toctree:: | ||
:caption: Hardware Support: | ||
|
||
amd_support | ||
apple_silicon_support | ||
linux_aarch64 | ||
nvidia_mps | ||
Intel Extension for PyTorch <https://github.com/pytorch/serve/tree/master/examples/intel_extension_for_pytorch> |
File renamed without changes.
File renamed without changes.