diff --git a/docs/source/guide/get_started/installation.rst b/docs/source/guide/get_started/installation.rst index cfed36cacf3..3593602f347 100644 --- a/docs/source/guide/get_started/installation.rst +++ b/docs/source/guide/get_started/installation.rst @@ -15,7 +15,8 @@ The current version of OpenVINO™ Training Extensions was tested in the followi Install OpenVINO™ Training Extensions for users (CUDA/CPU) ********************************************************** -1. Install OpenVINO™ Training Extensions package: +1. Install OpenVINO™ Training Extensions +package: * A local source in development mode @@ -41,7 +42,8 @@ Install OpenVINO™ Training Extensions for users (CUDA/CPU) pip install -e . -2. Install PyTorch & Requirements for training according to your system environment. +2. Install PyTorch & Requirements for training +according to your system environment. .. tab-set:: @@ -76,49 +78,63 @@ OpenVINO™ Training Extensions command line functionality. Install OpenVINO™ Training Extensions for users (XPU devices) ************************************************************* -1. Follow the first two steps from above instructions -on cloning the repository and creating a virtual environment. +1. Install OpenVINO™ Training Extensions +package: -2. Install Intel Extensions For Pytorch (IPEX). -Follow the `official documentation `_ to install prerequisites such as OneAPI and proper drivers. +* A local source in development mode -.. code-block:: shell +.. tab-set:: - python -m pip install torch==2.1.0.post0 torchvision==0.16.0.post0 torchaudio==2.1.0.post0 intel-extension-for-pytorch==2.1.20+xpu oneccl_bind_pt==2.1.200+xpu --extra-index-url https://pytorch-extension.intel.com/release-whl/stable/xpu/us/ + .. tab-item:: PyPI -3. Install MMCV. -It is required to install mmcv from source to properly build it with IPEX. + .. code-block:: shell -.. code-block:: shell + pip install otx - git clone https://github.com/open-mmlab/mmcv - cd mmcv - git checkout v2.1.0 - MMCV_WITH_OPS=1 pip install -e . + .. tab-item:: Source -4. Install OpenVINO™ Training Extensions -package from either: + .. code-block:: shell -* A local source in development mode + # Clone the training_extensions repository with the following command: + git clone https://github.com/openvinotoolkit/training_extensions.git + cd training_extensions -.. code-block:: shell + # Set up a virtual environment. + python -m venv .otx + source .otx/bin/activate - pip install -e . + pip install -e . -* PyPI +2. Install Intel Extensions for Pytorch & Requirements +for training according to your system environment. -.. code-block:: shell +.. tab-set:: + + .. tab-item:: Minimum requirements - pip install otx + .. code-block:: shell -5. Install requirements for training -excluding Pytorch. + pip install '.[xpu]' --extra-index-url https://pytorch-extension.intel.com/release-whl/stable/xpu/us/ -.. code-block:: shell + .. note:: - otx install -v --do-not-install-torch + Models from mmlab are not available for this environment. If you want to use mmlab models, you must install them with Full Requirements. + Also, some tasks may not be supported by minimum requirements. + + .. tab-item:: Full Requirements -6. Activate OneAPI environment + .. code-block:: shell + python -m pip install torch==2.1.0.post2 torchvision==0.16.0.post2 torchaudio==2.1.0.post2 intel-extension-for-pytorch==2.1.30+xpu oneccl_bind_pt==2.1.300+xpu --extra-index-url https://pytorch-extension.intel.com/release-whl/stable/xpu/us/ + git clone https://github.com/open-mmlab/mmcv + cd mmcv + git checkout v2.1.0 + MMCV_WITH_OPS=1 pip install -e . + cd .. + otx install -v --do-not-install-torch + +[Optional] Refer to the `Intel® Extension for PyTorch documentation guide `_ + +3. Activate OneAPI environment and export required IPEX system variables .. code-block:: shell @@ -127,7 +143,7 @@ and export required IPEX system variables export LD_PRELOAD=/usr/lib/x86_64-linux-gnu/libstdc++.so.6.0.30 export IPEX_FP32_MATH_MODE=TF32 -7. Once the package is installed in the virtual environment, you can use full +3. Once the package is installed in the virtual environment, you can use full OpenVINO™ Training Extensions command line functionality. .. code-block:: shell @@ -153,7 +169,8 @@ Then you may change code, and all fixes will be directly applied to the editable Install OpenVINO™ Training Extensions by using Docker ***************************************************** -1. By executing the following commands, it will build two Docker images: ``otx:${OTX_VERSION}-cuda`` and ``otx:${OTX_VERSION}-cuda-pretrained-ready``. +1. By executing the following commands, it will build two +Docker images: ``otx:${OTX_VERSION}-cuda`` and ``otx:${OTX_VERSION}-cuda-pretrained-ready``. .. code-block:: shell @@ -161,7 +178,8 @@ Install OpenVINO™ Training Extensions by using Docker cd docker ./build.sh -2. After that, you can check whether the images are built correctly such as +2. After that, you can check whether the +images are built correctly such as .. code-block:: shell diff --git a/pyproject.toml b/pyproject.toml index d5a62a7f29b..454f54ff05c 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -67,6 +67,22 @@ docs = [ "sphinxemoji", "nbsphinx", ] +xpu = [ + "torch==2.1.0.post2", + "torchvision==0.16.0.post2", + "intel-extension-for-pytorch==2.1.30+xpu", + "oneccl_bind_pt==2.1.300+xpu", + "lightning==2.1.2", + "pytorchcv", + "timm", + "openvino==2024.0", + "openvino-dev==2024.0", + "openvino-model-api==0.2.0", + "onnx==1.16.0", + "onnxconverter-common==1.14.0", + "nncf==2.9.0", + "anomalib[core]==1.0.1", +] base = [ "torch==2.1.1", "lightning==2.1.2", diff --git a/src/otx/cli/install.py b/src/otx/cli/install.py index 717dbf3a250..09d09f11a0c 100644 --- a/src/otx/cli/install.py +++ b/src/otx/cli/install.py @@ -90,6 +90,7 @@ def otx_install( requirements_dict = get_requirements("otx") # Add base and openvino requirements. requirements = requirements_dict["base"] + requirements_dict.pop("xpu", None) if option == "full": for extra in requirements_dict: requirements.extend(requirements_dict[extra]) diff --git a/tests/unit/cli/test_install.py b/tests/unit/cli/test_install.py index f960edd59cc..2615661a3a2 100644 --- a/tests/unit/cli/test_install.py +++ b/tests/unit/cli/test_install.py @@ -18,6 +18,7 @@ def setup(self, mocker: MockerFixture) -> None: "openvino": [Requirement.parse("openvino")], "mmlab": [Requirement.parse("mmpretrain")], "api": [Requirement.parse("test1")], + "xpu": [Requirement.parse("torch==2.0.0"), Requirement.parse("ipex")], } mocker.patch("otx.cli.install.get_requirements", return_value=requirements_dict) @@ -63,5 +64,6 @@ def test_install_full(self, mocker: MockerFixture, monkeypatch: MonkeyPatch) -> assert "openvino" in argument_call_list assert "pytorchcv" in argument_call_list assert "mmpretrain" not in argument_call_list + assert "ipex" not in argument_call_list mm_argument_call_list = mock_mim_installation.call_args_list[-1][0][-1] assert "mmpretrain" in mm_argument_call_list