You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Riallto is not just a Python package, it's a collection of software components. When you double click the downloaded installer, select the 'full' option and hit Install the following are delivered:
Python Riallto virtual environment
npu Python package
Ubuntu WSL instance
Series of Jupyter notebooks
Utility scripts and shortcuts
The focus in this post will be on the Python virtual environment.
Why a Virtual Environment?
Some projects require specific versions of certain packages and oftentimes you may not want to downgrade an installed package system-wide. Python virtual environments are a great way to work on individual projects without messing up your main Python environment. For more info and motivations you can read on the official python venv docs.
We create and pre-install all the required Python dependencies for the Riallto npu and onnxruntime packages during the install.
For convenience a powershell script to enter the environment is also provided and added to your system path during installation. Simply type into a powershell prompt
activate_venv.ps1
and you will enter the Riallto venv with the npu package available. Make sure to always run your npu apps from the Riallto venv.
If you launch Jupyter using the Riallto desktop or start menu shortcuts, the Jupyter session is already running in the venv, which means you do not need to worry about it and just start running notebooks/writing your own code.
What is in the venv
The Riallto Python venv is setup using the setup_python.ps1 which you can explore in the repo.
If you do not have a Python 3.9 installation, it will install it for you and automatically setup the venv in the current users appdata directory.
The setup_runtime.ps1 script will install the npu package with its dependencies listed in the repo setup.py.
Additionally the Riallto installation process installs ONNX Runtime and the Vitis AI Execution provider so that runtime sessions can be created using the NPU as shown in 5_1_pytorch_onnx_inference.ipynb. You can review the onnxruntime setup steps in the setup_onnx.ps1 script.
In addition to interacting with the NPU directly using the Riallto npu package, using the Riallto venv you should also be able to run many onnxruntime applications. Visit https://github.com/amd/RyzenAI-SW for inspiration on using the ONNX-based flows.
How to modify the Riallto npu package
Just because the components were installed using a binary Windows installer the individual software components are not set in stone.
If you wish to update the npu package with additional functionality or fix a bug (pull requests are always appreciated!) you can do that by cloning the Riallto repository.
git clone https://github.com/amdresearch/Riallto
Make any edits you want in the npu folder then upgrade the package using pip, but make sure to run activate_venv.ps1 beforehand.
cd Riallto
py -m pip install -U .
If updates exist on the main branch and you just want to update your package you can also do it directly via the github url
In this post we looked over the Python Riallto virtual environment and what it contains. The venv that Riallto delivers does not only contain the npu package with related prerequisites, but also popular machine learning libraries like torch and onnxruntime. We have also went over how you can modify the Riallto npu package without having to run the full installer.
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
-
Riallto Virtual Environment
What is in Riallto
Riallto is not just a Python package, it's a collection of software components. When you double click the downloaded installer, select the 'full' option and hit
Install
the following are delivered:npu
Python packageThe focus in this post will be on the Python virtual environment.
Why a Virtual Environment?
Some projects require specific versions of certain packages and oftentimes you may not want to downgrade an installed package system-wide. Python virtual environments are a great way to work on individual projects without messing up your main Python environment. For more info and motivations you can read on the official python venv docs.
We create and pre-install all the required Python dependencies for the Riallto
npu
andonnxruntime
packages during the install.You can find the installed venv under
For convenience a powershell script to enter the environment is also provided and added to your system path during installation. Simply type into a powershell prompt
and you will enter the Riallto venv with the
npu
package available. Make sure to always run yournpu
apps from the Riallto venv.If you launch Jupyter using the Riallto desktop or start menu shortcuts, the Jupyter session is already running in the venv, which means you do not need to worry about it and just start running notebooks/writing your own code.
What is in the venv
The Riallto Python venv is setup using the setup_python.ps1 which you can explore in the repo.
If you do not have a Python 3.9 installation, it will install it for you and automatically setup the venv in the current users appdata directory.
The setup_runtime.ps1 script will install the
npu
package with its dependencies listed in the repo setup.py.Additionally the Riallto installation process installs ONNX Runtime and the Vitis AI Execution provider so that runtime sessions can be created using the NPU as shown in 5_1_pytorch_onnx_inference.ipynb. You can review the onnxruntime setup steps in the setup_onnx.ps1 script.
In addition to interacting with the NPU directly using the Riallto
npu
package, using the Riallto venv you should also be able to run many onnxruntime applications. Visit https://github.com/amd/RyzenAI-SW for inspiration on using the ONNX-based flows.How to modify the Riallto npu package
Just because the components were installed using a binary Windows installer the individual software components are not set in stone.
If you wish to update the
npu
package with additional functionality or fix a bug (pull requests are always appreciated!) you can do that by cloning the Riallto repository.Make any edits you want in the
npu
folder then upgrade the package usingpip
, but make sure to runactivate_venv.ps1
beforehand.If updates exist on the main branch and you just want to update your package you can also do it directly via the github url
Summary
In this post we looked over the Python Riallto virtual environment and what it contains. The venv that Riallto delivers does not only contain the
npu
package with related prerequisites, but also popular machine learning libraries like torch and onnxruntime. We have also went over how you can modify the Rialltonpu
package without having to run the full installer.Beta Was this translation helpful? Give feedback.
All reactions