Installation¶
Install torch-rbln from pre-built wheels or build it from source. To compile and run models on RBLN NPUs, you must install rebel-compiler separately from the RBLN package index.
Use import torch in Python as usual and torch-rbln is available. torch-rbln autoloads as an out-of-tree extension, so no extra import is needed.
For version history, see the release notes.
Prerequisites
- An RBLN NPU host with the RBLN Driver installed. Confirm with
rbln-smi. - Python: 3.10–3.14
- An RBLN Portal account for the RBLN package index, which hosts
rebel-compiler.
Version pairing¶
torch-rbln is built against a specific rebel-compiler interface and a specific PyTorch CPU wheel. Install all three from the same SDK release.
| Package | Where it comes from | Pinned by |
|---|---|---|
torch | PyTorch CPU wheel index (https://download.pytorch.org/whl/cpu) | torch-rbln declares the exact torch==<version>+cpu it was built against as a dependency, so installing torch-rbln with the CPU index as an extra index pulls the matching torch. |
torch-rbln | PyPI | The torch-rbln version in the release notes table |
rebel-compiler | RBLN package index (https://pypi.rbln.ai/simple) | The rebel-compiler version in the release notes table |
import torch checks ABI (Application Binary Interface) compatibility between torch-rbln and rebel-compiler. A pair from different releases fails at import with an RBLN ABI mismatch message. See Troubleshoot.
Quickstart¶
Create a virtual environment, install the packages, then verify.
Install torch-rbln from PyPI together with the torch CPU wheel it pins:
Install rebel-compiler from the RBLN package index (RBLN Portal credentials required):
Verification¶
Run the environment report first. It does not need an NPU and it does not execute any operator:
When the environment is set up correctly, the output looks like the following. Values differ per machine; check that loaded from: under torch-rbln package: and rebel-compiler package: point into the environment you activated, and that rebel ABI handshake: ends with verdict: OK:
...
=== torch-rbln environment diagnostics ===
torch-rbln package:
version: <TORCH_RBLN_VERSION>
install_type: normal
loaded from: /path/to/.venv/lib/python3.x/site-packages/torch_rbln
installed at: /path/to/.venv/lib/python3.x/site-packages/torch_rbln
lib_dir: /path/to/.venv/lib/python3.x/site-packages/torch_rbln/lib (exists: True)
native .so in lib: libc10_rbln.so, ...
rebel-compiler package:
version: <REBEL_COMPILER_VERSION>
install_type: normal
loaded from: /path/to/.venv/lib/python3.x/site-packages/rebel
installed at: /path/to/.venv/lib/python3.x/site-packages/rebel
rebel ABI handshake:
built against ABI: <N>
librbln.so: /path/to/.venv/lib/python3.x/site-packages/tvm/librbln.so
runtime accepts: <MIN>..<CURRENT> (min_supported..current)
verdict: OK
Environment variables (affecting library search):
LD_LIBRARY_PATH= (not set)
PYTHONPATH= (not set)
...
The report is written to stderr; read its text. The module does not load the torch native libraries or the RBLN extension, so it prints even when import torch itself fails.
Then run one operation on the device with fallback logging on. If the log contains no op ran on CPU line, no fallback was detected and the operation ran on the device. The command reads the result back with .cpu() before printing, because printing an rbln tensor directly runs host-side formatting operators that would themselves appear in the fallback log:
The first call compiles the operator and takes noticeably longer than a later call in the same process; that is expected, and every new process compiles again. If the output shows the tensor and no op ran on CPU line, you are done. If it fails:
RuntimeError: Cannot find libraries: ['librbln.so', 'librbln_runtime.so']orFileNotFoundError: Could not find librbln.so:rebel-compileris not installed in this environment, or another stack'sLD_LIBRARY_PATHshadows it. See Troubleshoot.RBLN ABI mismatch: ...:torch-rblnandrebel-compilercome from different releases. Reinstall both from one release. See Troubleshoot.torch.rbln.device_count()returns0: no NPU is visible to this process. Checkrbln-smi, theRBLN_VISIBLE_DEVICESsetting, and container device passthrough. See Troubleshoot.
Optionally print the device topology to confirm which physical NPUs back each logical device:
[RBLN] Device Topology Initialized:
+----------------+------------------+---------------------+
| Logical Device | Physical NPU IDs | Status |
+----------------+------------------+---------------------+
| rbln:0 | [ 0 ] | Active |
+----------------+------------------+---------------------+
Docker¶
The Installation Guide install matrix lists the SDK container images and the docker pull command for each supported OS and Python version. The images carry rebel-compiler; add torch-rbln inside the container with the pip command above. Pass the NPU device nodes into the container with the RBLN Container Toolkit.
Upgrade¶
The Quickstart commands pin exact versions, so running the new release's commands replaces all three packages together. After upgrading, re-run Verification.
Uninstall¶
rebel-compiler and torch are independent packages; remove them only if nothing else in the environment needs them.
Build from source (advanced)¶
Repository: torch-rbln
Requirements¶
- Python: 3.10–3.14
- PyTorch (CPU wheels);
pyproject.tomlpins the exact version rebel-compiler, installed separately into the same environment
Note
An RBLN Portal account is required to install rebel-compiler. The setup script reads credentials from ~/.netrc:
Restrict the file with chmod 600 ~/.netrc; without that restriction the build cannot use the credentials.
Prerequisites¶
- Git
- A C/C++ toolchain (GCC 13 on Linux) for building the
torch-rblnextension - CMake 3.18+ and Ninja
uv(optional). See the uv installation guide.
Get the source¶
Clone the repository and create a virtual environment:
Using dev-setup.sh (recommended)¶
Run the setup script from the repository root. It installs torch from the CPU index, rebel-compiler from the RBLN package index, runs the operator code generation, and performs an editable build:
Without RBLN Portal credentials in ~/.netrc the script stops with:
Verify the installation using Verification.
Build manually¶
Run the following from the repository root:
The build generates torch_rbln/_internal/register_ops.py from aten/src/ATen/native/native_functions.yaml and compiles the C++ extension.
Verify the installation using Verification.
Next steps¶
- Tutorial: Running and debugging - A first operation, a module, fallback logs,
explain(). - Execution Semantics - What to expect from
device="rbln"before porting a model. - Environment Variables - Device mapping for multi-NPU hosts and logging.