AMDMIGraphX
AMDMIGraphX copied to clipboard
[Issue]: MIGraphX Python module cannot find attribute
Problem Description
I've compiled mgx from source with the following CMake config:
cmake -S . -B build -G Ninja \
-DCMAKE_BUILD_TYPE=Release \
-DCMAKE_PREFIX_PATH="$ROCM_INSTALL_PREFIX;$CONDA_PREFIX/lib/python3.11/site-packages/pybind11" \
-DCMAKE_INSTALL_PREFIX=$ROCM_INSTALL_PREFIX \
-DCMAKE_CXX_COMPILER="$ROCM_INSTALL_PREFIX/bin/clang++" \
-DCMAKE_CXX_FLAGS="-I $ROCM_INSTALL_PREFIX/include" \
-DGPU_TARGETS=$ROCM_GPU_ARCH -DBUILD_TESTING=OFF \
-DMIGRAPHX_ENABLE_GPU=ON -DMIGRAPHX_USE_COMPOSABLEKERNEL=OFF -DMIGRAPHX_ENABLE_MLIR=OFF
where ROCM_INSTALL_PREFIX is where the ROCm installed, and CONDA_PREFIX is the Conda venv for Python.
After successfully compilation and install, I'm trying to run the Python demo with PYTHONPATH=$ROCM_INSTALL_PREFIX python3 example.py from here:
# import migraphx and numpy
import migraphx
import numpy as np
# import and parse inception model
model = migraphx.parse_onnx("inceptioni1.onnx")
# compile model for the GPU target
model.compile(migraphx.get_target("gpu"))
# optionally print compiled model
model.print()
# create random input image
input_image = np.random.rand(1, 3, 299, 299).astype('float32')
# feed image to model, 'x.1` is the input param name
results = model.run({'x.1': input_image})
# get the results back
result_np = np.array(results[0])
# print the inferred class of the input image
print(np.argmax(result_np))
The errors are:
Traceback (most recent call last):
File "/mnt/nvme0/home/abc/example.py", line 6, in <module>
model = migraphx.parse_onnx("inceptioni1.onnx")
^^^^^^^^^^^^^^^^^^^
AttributeError: module 'migraphx' has no attribute 'parse_onnx'
Operating System
Ubuntu 22.04 Jammy Jellyfish
CPU
AMD EPYC 7773X 64-Core Processor
GPU
AMD Instinct MI100
Other
No response
ROCm Version
ROCm 6.0.0
Steps to Reproduce
No response
(Optional for Linux users) Output of /opt/rocm/bin/rocminfo --support
No response
Additional Information
No response